X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/bc1a99bd11f4e1c054e55c8fde957ce0de89f989..ecf1ae6d0b1691bfe36fc0ff64500f111f3abc32:/src/panels/information/informationpanel.cpp diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index a864cb005..9a0358df0 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -36,7 +36,6 @@ #include #include "dolphin_informationpanelsettings.h" -#include "filemetadataconfigurationdialog.h" InformationPanel::InformationPanel(QWidget* parent) : Panel(parent), @@ -168,7 +167,8 @@ void InformationPanel::contextMenuEvent(QContextMenuEvent* event) Panel::contextMenuEvent(event); } -void InformationPanel::showContextMenu(const QPoint &pos) { +void InformationPanel::showContextMenu(const QPoint &pos) +{ QMenu popup(this); QAction* previewAction = popup.addAction(i18nc("@action:inmenu", "Preview")); @@ -178,6 +178,9 @@ void InformationPanel::showContextMenu(const QPoint &pos) { QAction* configureAction = popup.addAction(i18nc("@action:inmenu", "Configure...")); configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); + if (m_inConfigurationMode) { + configureAction->setEnabled(false); + } QAction* dateformatAction = popup.addAction(i18nc("@action:inmenu", "Condensed Date")); dateformatAction->setIcon(QIcon::fromTheme(QStringLiteral("change-date-symbolic"))); @@ -185,7 +188,8 @@ void InformationPanel::showContextMenu(const QPoint &pos) { dateformatAction->setChecked(InformationPanelSettings::dateFormat() == static_cast(Baloo::DateFormats::ShortFormat)); popup.addSeparator(); - foreach (QAction* action, customContextMenuActions()) { + const auto actions = customContextMenuActions(); + for (QAction *action : actions) { popup.addAction(action); } @@ -198,16 +202,11 @@ void InformationPanel::showContextMenu(const QPoint &pos) { const bool isChecked = action->isChecked(); if (action == previewAction) { - m_content->setPreviewVisible(isChecked); InformationPanelSettings::setPreviewsShown(isChecked); + m_content->refreshPreview(); } else if (action == configureAction) { - FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(this); - dialog->setDescription(i18nc("@label::textbox", - "Select which data should be shown in the information panel:")); - dialog->setItems(m_content->items()); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->show(); - connect(dialog, &FileMetaDataConfigurationDialog::destroyed, m_content, &InformationPanelContent::refreshMetaData); + m_inConfigurationMode = true; + m_content->configureShownProperties(); } if (action == dateformatAction) { int dateFormat = static_cast(isChecked ? Baloo::DateFormats::ShortFormat : Baloo::DateFormats::LongFormat); @@ -311,7 +310,7 @@ void InformationPanel::slotFilesAdded(const QString& directory) void InformationPanel::slotFilesChanged(const QStringList& files) { - foreach (const QString& fileName, files) { + for (const QString& fileName : files) { if (m_shownUrl == QUrl::fromLocalFile(fileName)) { showItemInfo(); break; @@ -321,7 +320,7 @@ void InformationPanel::slotFilesChanged(const QStringList& files) void InformationPanel::slotFilesRemoved(const QStringList& files) { - foreach (const QString& fileName, files) { + for (const QString& fileName : files) { if (m_shownUrl == QUrl::fromLocalFile(fileName)) { // the currently shown item has been removed, show // the parent directory as fallback @@ -410,6 +409,7 @@ void InformationPanel::init() m_content = new InformationPanelContent(this); connect(m_content, &InformationPanelContent::urlActivated, this, &InformationPanel::urlActivated); + connect(m_content, &InformationPanelContent::configurationFinished, this, [this]() { m_inConfigurationMode = false; }); QVBoxLayout* layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0);