┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/informationpanelcontent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels/information/informationpanelcontent.cpp')
-rw-r--r--src/panels/information/informationpanelcontent.cpp68
1 files changed, 44 insertions, 24 deletions
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index 0eaa125f1..5b7dbbfe9 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -40,6 +40,7 @@
#include <Phonon/MediaObject>
#include <QLabel>
+#include <QDialogButtonBox>
#include <QScrollArea>
#include <QTextLayout>
#include <QTimer>
@@ -107,18 +108,31 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
m_metaDataWidget->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
- // Encapsulate the MetaDataWidget inside a container that has a dummy widget
- // at the bottom. This prevents that the meta data widget gets vertically stretched
- // in the case where the height of m_metaDataArea > m_metaDataWidget.
- QWidget* metaDataWidgetContainer = new QWidget(parent);
- QVBoxLayout* containerLayout = new QVBoxLayout(metaDataWidgetContainer);
- containerLayout->setContentsMargins(0, 0, 0, 0);
- containerLayout->setSpacing(0);
- containerLayout->addWidget(m_metaDataWidget);
- containerLayout->addStretch();
+ // 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(metaDataWidgetContainer);
+ m_metaDataArea->setWidget(m_metaDataWidget);
m_metaDataArea->setWidgetResizable(true);
m_metaDataArea->setFrameShape(QFrame::NoFrame);
@@ -129,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);
}
@@ -147,7 +163,8 @@ void InformationPanelContent::showItem(const KFileItem& item)
refreshMetaData();
}
-void InformationPanelContent::refreshPreview() {
+void InformationPanelContent::refreshPreview()
+{
// If there is a preview job, kill it to prevent that we have jobs for
// multiple items running, and thus a race condition (bug 250787).
if (m_previewJob) {
@@ -209,12 +226,18 @@ void InformationPanelContent::refreshPreview() {
}
}
-void InformationPanelContent::refreshMetaData() {
- if (m_metaDataWidget) {
- m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
- m_metaDataWidget->show();
- m_metaDataWidget->setItems(KFileItemList() << m_item);
- }
+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<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
+ m_metaDataWidget->show();
+ m_metaDataWidget->setItems(KFileItemList() << m_item);
}
void InformationPanelContent::showItems(const KFileItemList& items)
@@ -230,9 +253,7 @@ void InformationPanelContent::showItems(const KFileItemList& items)
);
setNameLabelText(i18ncp("@label", "%1 item selected", "%1 items selected", items.count()));
- if (m_metaDataWidget) {
- m_metaDataWidget->setItems(items);
- }
+ m_metaDataWidget->setItems(items);
m_phononWidget->hide();
@@ -297,7 +318,8 @@ void InformationPanelContent::markOutdatedPreview()
m_preview->setPixmap(disabledPixmap);
}
-KFileItemList InformationPanelContent::items() {
+KFileItemList InformationPanelContent::items()
+{
return m_metaDataWidget->items();
}
@@ -349,9 +371,7 @@ void InformationPanelContent::adjustWidgetSizes(int width)
// The metadata widget also contains a text widget which may return
// a large preferred width.
- if (m_metaDataWidget) {
- m_metaDataWidget->setMaximumWidth(maxWidth);
- }
+ m_metaDataWidget->setMaximumWidth(maxWidth);
// try to increase the preview as large as possible
m_preview->setSizeHint(QSize(maxWidth, maxWidth));