]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix broken build without baloo-widgets master
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Sat, 12 May 2018 18:52:15 +0000 (20:52 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Sat, 12 May 2018 18:54:01 +0000 (20:54 +0200)
D11245 introduced a dependency on baloo-widgets master, but
baloo-widgets is only an optional dependency.

CMakeLists.txt
src/panels/information/informationpanelcontent.cpp

index c71790e52094cd1d8c3d606feb06da05f95092ac..707160f53cb43335052e7cf315215e414acaf1db 100644 (file)
@@ -77,7 +77,7 @@ set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "Baloo Core libraries"
                        PURPOSE "For adding desktop-wide search and tagging support to dolphin"
                       )
 
-find_package(KF5BalooWidgets 4.97)
+find_package(KF5BalooWidgets 18.07.70)
 set_package_properties(KF5BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets"
                        URL "http://www.kde.org"
                        TYPE OPTIONAL
index 0d6987bb0f3fce7144ac2ea6c864a2fbac2cfd41..0cba0cdf0687cb86f04c820a09c305fa0c5d5a8d 100644 (file)
@@ -112,12 +112,12 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
             this, &InformationPanelContent::urlActivated);
 #else
     m_metaDataWidget = new Baloo::FileMetaDataWidget(parent);
+    m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
     connect(m_metaDataWidget, &Baloo::FileMetaDataWidget::urlActivated,
             this, &InformationPanelContent::urlActivated);
 #endif
     m_metaDataWidget->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
     m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
-    m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
  
     // Encapsulate the MetaDataWidget inside a container that has a dummy widget
     // at the bottom. This prevents that the meta data widget gets vertically stretched
@@ -194,7 +194,9 @@ void InformationPanelContent::showItem(const KFileItem& item)
     }
 
     if (m_metaDataWidget) {
+#ifdef HAVE_BALOO
         m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
+#endif
         m_metaDataWidget->show();
         m_metaDataWidget->setItems(KFileItemList() << item);
     }
@@ -283,10 +285,12 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon
     QAction* configureAction = popup.addAction(i18nc("@action:inmenu", "Configure..."));
     configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
 
+#ifdef HAVE_BALOO
     QAction* dateformatAction = popup.addAction(i18nc("@action:inmenu", "Condensed Date"));
     dateformatAction->setIcon(QIcon::fromTheme(QStringLiteral("change-date-symbolic")));
     dateformatAction->setCheckable(true);
     dateformatAction->setChecked(InformationPanelSettings::dateFormat() == static_cast<int>(Baloo::DateFormats::ShortFormat));
+#endif
     popup.addSeparator();
     foreach (QAction* action, customContextMenuActions) {
         popup.addAction(action);
@@ -303,11 +307,6 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon
     if (action == previewAction) {
         m_preview->setVisible(isChecked);
         InformationPanelSettings::setPreviewsShown(isChecked);
-    } else if (action == dateformatAction) {
-        int dateFormat = static_cast<int>(isChecked ? Baloo::DateFormats::ShortFormat : Baloo::DateFormats::LongFormat);
-         
-        InformationPanelSettings::setDateFormat(dateFormat);
-        refreshMetaData();
     } else if (action == configureAction) {
         FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(this);
         dialog->setDescription(i18nc("@label::textbox",
@@ -317,6 +316,14 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon
         dialog->show();
         connect(dialog, &FileMetaDataConfigurationDialog::destroyed, this, &InformationPanelContent::refreshMetaData);
     }
+#ifdef HAVE_BALOO
+    if (action == dateformatAction) {
+        int dateFormat = static_cast<int>(isChecked ? Baloo::DateFormats::ShortFormat : Baloo::DateFormats::LongFormat);
+
+        InformationPanelSettings::setDateFormat(dateFormat);
+        refreshMetaData();
+    }
+#endif
 }
 
 void InformationPanelContent::showIcon(const KFileItem& item)