Changeset View
Changeset View
Standalone View
Standalone View
src/panels/information/informationpanel.cpp
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 171 | void InformationPanel::showContextMenu(const QPoint &pos) { | |||
---|---|---|---|---|---|
180 | configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); | 180 | configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); | ||
181 | 181 | | |||
182 | QAction* dateformatAction = popup.addAction(i18nc("@action:inmenu", "Condensed Date")); | 182 | QAction* dateformatAction = popup.addAction(i18nc("@action:inmenu", "Condensed Date")); | ||
183 | dateformatAction->setIcon(QIcon::fromTheme(QStringLiteral("change-date-symbolic"))); | 183 | dateformatAction->setIcon(QIcon::fromTheme(QStringLiteral("change-date-symbolic"))); | ||
184 | dateformatAction->setCheckable(true); | 184 | dateformatAction->setCheckable(true); | ||
185 | dateformatAction->setChecked(InformationPanelSettings::dateFormat() == static_cast<int>(Baloo::DateFormats::ShortFormat)); | 185 | dateformatAction->setChecked(InformationPanelSettings::dateFormat() == static_cast<int>(Baloo::DateFormats::ShortFormat)); | ||
186 | 186 | | |||
187 | popup.addSeparator(); | 187 | popup.addSeparator(); | ||
188 | foreach (QAction* action, customContextMenuActions()) { | 188 | const auto actions = customContextMenuActions(); | ||
189 | for (QAction *action : actions) { | ||||
elvisangelaccio: This will detach the container. Please put `customContextMenuActions()` in a `const` variable… | |||||
189 | popup.addAction(action); | 190 | popup.addAction(action); | ||
190 | } | 191 | } | ||
191 | 192 | | |||
192 | // Open the popup and adjust the settings for the | 193 | // Open the popup and adjust the settings for the | ||
193 | // selected action. | 194 | // selected action. | ||
194 | QAction* action = popup.exec(pos); | 195 | QAction* action = popup.exec(pos); | ||
195 | if (!action) { | 196 | if (!action) { | ||
196 | return; | 197 | return; | ||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 305 | if (m_shownUrl == QUrl::fromLocalFile(directory)) { | |||
306 | // the signal filesAdded("trash:/") will be emitted. | 307 | // the signal filesAdded("trash:/") will be emitted. | ||
307 | KFileItem item(QUrl::fromLocalFile(directory)); | 308 | KFileItem item(QUrl::fromLocalFile(directory)); | ||
308 | requestDelayedItemInfo(item); | 309 | requestDelayedItemInfo(item); | ||
309 | } | 310 | } | ||
310 | } | 311 | } | ||
311 | 312 | | |||
312 | void InformationPanel::slotFilesChanged(const QStringList& files) | 313 | void InformationPanel::slotFilesChanged(const QStringList& files) | ||
313 | { | 314 | { | ||
314 | foreach (const QString& fileName, files) { | 315 | for (const QString& fileName : files) { | ||
315 | if (m_shownUrl == QUrl::fromLocalFile(fileName)) { | 316 | if (m_shownUrl == QUrl::fromLocalFile(fileName)) { | ||
316 | showItemInfo(); | 317 | showItemInfo(); | ||
317 | break; | 318 | break; | ||
318 | } | 319 | } | ||
319 | } | 320 | } | ||
320 | } | 321 | } | ||
321 | 322 | | |||
322 | void InformationPanel::slotFilesRemoved(const QStringList& files) | 323 | void InformationPanel::slotFilesRemoved(const QStringList& files) | ||
323 | { | 324 | { | ||
324 | foreach (const QString& fileName, files) { | 325 | for (const QString& fileName : files) { | ||
325 | if (m_shownUrl == QUrl::fromLocalFile(fileName)) { | 326 | if (m_shownUrl == QUrl::fromLocalFile(fileName)) { | ||
326 | // the currently shown item has been removed, show | 327 | // the currently shown item has been removed, show | ||
327 | // the parent directory as fallback | 328 | // the parent directory as fallback | ||
328 | markUrlAsInvalid(); | 329 | markUrlAsInvalid(); | ||
329 | break; | 330 | break; | ||
330 | } | 331 | } | ||
331 | } | 332 | } | ||
332 | } | 333 | } | ||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |
This will detach the container. Please put customContextMenuActions() in a const variable first.