1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-04 17:30:55 +00:00

Fix broken build without baloo-widgets master

D11245 introduced a dependency on baloo-widgets master, but
baloo-widgets is only an optional dependency.
This commit is contained in:
Elvis Angelaccio 2018-05-12 20:52:15 +02:00
parent 1c9d91b217
commit 2912894d4f
2 changed files with 14 additions and 7 deletions

View 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

View 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)