From ecf1ae6d0b1691bfe36fc0ff64500f111f3abc32 Mon Sep 17 00:00:00 2001 From: Stefan BrĂ¼ns Date: Sun, 14 Apr 2019 02:44:01 +0200 Subject: [InformationPanel] Use the new inline configuration mode Summary: The current external configuration dialog has some issues: - its layout is suboptimal, as its initial size is typically to small - it is quite disassociated with the actual widget it configures, properties have a different order, and the property names can be quite abstract without the corresponding value. Doing the visibility selection inline typically avoids the sizing problem, as the containing application (dolphin) is often vertically maximized. The selection becomes more obvious, as the item order is kept, and the values are shown. Depends on D20524 CCBUG: 389571 Reviewers: #dolphin, #baloo, #frameworks, ngraham, astippich, #vdg, elvisangelaccio Reviewed By: #dolphin, elvisangelaccio Subscribers: elvisangelaccio, meven, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D20525 --- src/panels/information/informationpanelcontent.cpp | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/panels/information/informationpanelcontent.cpp') diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 6e718f961..5b7dbbfe9 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -107,6 +108,29 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : m_metaDataWidget->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); + // Configuration + m_configureLabel = new QLabel(i18nc("@label::textbox", + "Select which data should be shown:"), this); + m_configureLabel->setWordWrap(true); + m_configureLabel->setVisible(false); + + m_configureButtons = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel); + m_configureButtons->setVisible(false); + connect(m_configureButtons, &QDialogButtonBox::accepted, this, [this]() { + m_metaDataWidget->setConfigurationMode(Baloo::ConfigurationMode::Accept); + m_configureButtons->setVisible(false); + m_configureLabel->setVisible(false); + emit configurationFinished(); + } + ); + connect(m_configureButtons, &QDialogButtonBox::rejected, this, [this]() { + m_metaDataWidget->setConfigurationMode(Baloo::ConfigurationMode::Cancel); + m_configureButtons->setVisible(false); + m_configureLabel->setVisible(false); + emit configurationFinished(); + } + ); + m_metaDataArea = new QScrollArea(parent); m_metaDataArea->setWidget(m_metaDataWidget); m_metaDataArea->setWidgetResizable(true); @@ -119,7 +143,9 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : layout->addWidget(m_phononWidget); layout->addWidget(m_nameLabel); layout->addWidget(new KSeparator()); + layout->addWidget(m_configureLabel); layout->addWidget(m_metaDataArea); + layout->addWidget(m_configureButtons); m_placesItemModel = new PlacesItemModel(this); } @@ -200,6 +226,13 @@ void InformationPanelContent::refreshPreview() } } +void InformationPanelContent::configureShownProperties() +{ + m_configureLabel->setVisible(true); + m_configureButtons->setVisible(true); + m_metaDataWidget->setConfigurationMode(Baloo::ConfigurationMode::ReStart); +} + void InformationPanelContent::refreshMetaData() { m_metaDataWidget->setDateFormat(static_cast(InformationPanelSettings::dateFormat())); -- cgit v1.3