mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-04 17:30:55 +00:00
Port away from kdelibs4support
Summary: It was only used as fallback when baloo was not found, but `KFileMetaDataWidget` is useless without nepomuk. The result of this patch is that the information panel and the tooltips won't be available from platforms without baloo (instead of being available but broken). The baloo dependency remains optional. Closes T8720 Test Plan: Build dolphin with `cmake -DCMAKE_DISABLE_FIND_PACKAGE_KF5Baloo=ON ..` and make sure it doesn't show tooltips or the information panel. Reviewers: #dolphin, broulik, ngraham Subscribers: kfm-devel Tags: #dolphin Maniphest Tasks: T8720 Differential Revision: https://phabricator.kde.org/D14814
This commit is contained in:
parent
9134951cb0
commit
6674c9c387
|
@ -94,10 +94,7 @@ if (KF5Baloo_FOUND AND KF5BalooWidgets_FOUND AND KF5FileMetaData_FOUND)
|
|||
message(STATUS "Baloo packages are found")
|
||||
set(HAVE_BALOO TRUE)
|
||||
else()
|
||||
message(WARNING "Baloo packages not found. They are needed for the metadata features of Dolphin.")
|
||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
|
||||
KDELibs4Support # for KFileMetaDataWidget
|
||||
)
|
||||
message(WARNING "Baloo packages not found. They are needed for the metadata features of Dolphin (including the information panel).")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
|
|
@ -98,8 +98,6 @@ set(dolphinprivate_LIB_SRCS
|
|||
views/dolphinviewactionhandler.cpp
|
||||
views/draganddrophelper.cpp
|
||||
views/renamedialog.cpp
|
||||
views/tooltips/dolphinfilemetadatawidget.cpp
|
||||
views/tooltips/tooltipmanager.cpp
|
||||
views/versioncontrol/updateitemstatesthread.cpp
|
||||
views/versioncontrol/versioncontrolobserver.cpp
|
||||
views/viewmodecontroller.cpp
|
||||
|
@ -114,6 +112,8 @@ set(dolphinprivate_LIB_SRCS
|
|||
if(HAVE_BALOO)
|
||||
set(dolphinprivate_LIB_SRCS
|
||||
${dolphinprivate_LIB_SRCS}
|
||||
views/tooltips/dolphinfilemetadatawidget.cpp
|
||||
views/tooltips/tooltipmanager.cpp
|
||||
kitemviews/private/kbaloorolesprovider.cpp
|
||||
)
|
||||
endif()
|
||||
|
@ -155,11 +155,6 @@ if(HAVE_BALOO)
|
|||
KF5::Baloo
|
||||
KF5::BalooWidgets
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
dolphinprivate PUBLIC
|
||||
KF5::KDELibs4Support # for KFileMetaDataWidget
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(dolphinprivate PROPERTIES
|
||||
|
@ -204,11 +199,6 @@ set(dolphinstatic_SRCS
|
|||
dolphintabwidget.cpp
|
||||
trash/dolphintrash.cpp
|
||||
filterbar/filterbar.cpp
|
||||
panels/information/filemetadataconfigurationdialog.cpp
|
||||
panels/information/informationpanel.cpp
|
||||
panels/information/informationpanelcontent.cpp
|
||||
panels/information/pixmapviewer.cpp
|
||||
panels/information/phononwidget.cpp
|
||||
panels/places/placespanel.cpp
|
||||
panels/places/placesitem.cpp
|
||||
panels/places/placesitemeditdialog.cpp
|
||||
|
@ -252,6 +242,17 @@ set(dolphinstatic_SRCS
|
|||
global.cpp
|
||||
)
|
||||
|
||||
if(HAVE_BALOO)
|
||||
set(dolphinstatic_SRCS
|
||||
${dolphinstatic_SRCS}
|
||||
panels/information/filemetadataconfigurationdialog.cpp
|
||||
panels/information/informationpanel.cpp
|
||||
panels/information/informationpanelcontent.cpp
|
||||
panels/information/pixmapviewer.cpp
|
||||
panels/information/phononwidget.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
kconfig_add_kcfg_files(dolphinstatic_SRCS GENERATE_MOC
|
||||
panels/folders/dolphin_folderspanelsettings.kcfgc
|
||||
panels/information/dolphin_informationpanelsettings.kcfgc
|
||||
|
|
|
@ -1266,6 +1266,8 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
infoDock->setLocked(lock);
|
||||
infoDock->setObjectName(QStringLiteral("infoDock"));
|
||||
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
#ifdef HAVE_BALOO
|
||||
InformationPanel* infoPanel = new InformationPanel(infoDock);
|
||||
infoPanel->setCustomContextMenuActions({lockLayoutAction});
|
||||
connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
|
||||
|
@ -1281,6 +1283,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
infoPanel, &InformationPanel::setSelection);
|
||||
connect(this, &DolphinMainWindow::requestItemInfo,
|
||||
infoPanel, &InformationPanel::requestDelayedItemInfo);
|
||||
#endif
|
||||
|
||||
// Setup "Folders"
|
||||
DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
|
||||
|
|
|
@ -19,11 +19,7 @@
|
|||
|
||||
#include "filemetadataconfigurationdialog.h"
|
||||
|
||||
#ifndef HAVE_BALOO
|
||||
#include <kfilemetadataconfigurationwidget.h>
|
||||
#else
|
||||
#include <Baloo/FileMetaDataConfigWidget>
|
||||
#endif
|
||||
#include <KConfigGroup>
|
||||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
@ -56,12 +52,7 @@ FileMetaDataConfigurationDialog::FileMetaDataConfigurationDialog(QWidget* parent
|
|||
"be shown:"), this);
|
||||
m_descriptionLabel->setWordWrap(true);
|
||||
|
||||
#ifndef HAVE_BALOO
|
||||
m_configWidget = new KFileMetaDataConfigurationWidget(this);
|
||||
#else
|
||||
m_configWidget = new Baloo::FileMetaDataConfigWidget(this);
|
||||
#endif
|
||||
|
||||
|
||||
QWidget* mainWidget = new QWidget(this);
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(mainWidget);
|
||||
|
|
|
@ -70,11 +70,7 @@ protected slots:
|
|||
void slotAccepted();
|
||||
private:
|
||||
QLabel* m_descriptionLabel;
|
||||
#ifndef HAVE_BALOO
|
||||
KFileMetaDataConfigurationWidget* m_configWidget;
|
||||
#else
|
||||
Baloo::FileMetaDataConfigWidget* m_configWidget;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,11 +32,7 @@
|
|||
#include <QMenu>
|
||||
#include <QTextDocument>
|
||||
|
||||
#ifndef HAVE_BALOO
|
||||
#include <KFileMetaDataWidget>
|
||||
#else
|
||||
#include <Baloo/FileMetaDataWidget>
|
||||
#endif
|
||||
|
||||
#include <panels/places/placesitem.h>
|
||||
#include <panels/places/placesitemmodel.h>
|
||||
|
@ -106,16 +102,10 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
|
|||
const bool previewsShown = InformationPanelSettings::previewsShown();
|
||||
m_preview->setVisible(previewsShown);
|
||||
|
||||
#ifndef HAVE_BALOO
|
||||
m_metaDataWidget = new KFileMetaDataWidget(parent);
|
||||
connect(m_metaDataWidget, &KFileMetaDataWidget::urlActivated,
|
||||
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);
|
||||
|
||||
|
@ -194,9 +184,7 @@ 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);
|
||||
}
|
||||
|
@ -285,12 +273,11 @@ 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);
|
||||
|
@ -316,14 +303,12 @@ 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)
|
||||
|
|
|
@ -78,9 +78,11 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
|
||||
|
||||
#ifdef HAVE_BALOO
|
||||
// 'Show tooltips'
|
||||
m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"));
|
||||
topLayout->addRow(i18nc("@title:group", "Miscellaneous: "), m_showToolTips);
|
||||
#endif
|
||||
|
||||
// 'Show selection marker'
|
||||
m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"));
|
||||
|
@ -98,7 +100,9 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
|
|||
|
||||
connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
|
||||
connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
|
||||
#ifdef HAVE_BALOO
|
||||
connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
|
||||
#endif
|
||||
connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
|
||||
connect(m_naturalSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
|
||||
connect(m_caseInsensitiveSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
|
||||
|
@ -118,7 +122,9 @@ void BehaviorSettingsPage::applySettings()
|
|||
|
||||
const bool useGlobalViewProps = m_globalViewProps->isChecked();
|
||||
settings->setGlobalViewProps(useGlobalViewProps);
|
||||
#ifdef HAVE_BALOO
|
||||
settings->setShowToolTips(m_showToolTips->isChecked());
|
||||
#endif
|
||||
settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
|
||||
setSortingChoiceValue(settings);
|
||||
settings->setRenameInline(m_renameInline->isChecked());
|
||||
|
@ -149,7 +155,9 @@ void BehaviorSettingsPage::loadSettings()
|
|||
m_localViewProps->setChecked(!useGlobalViewProps);
|
||||
m_globalViewProps->setChecked(useGlobalViewProps);
|
||||
|
||||
#ifdef HAVE_BALOO
|
||||
m_showToolTips->setChecked(GeneralSettings::showToolTips());
|
||||
#endif
|
||||
m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
|
||||
m_renameInline->setChecked(GeneralSettings::renameInline());
|
||||
m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView());
|
||||
|
|
|
@ -176,8 +176,10 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
|
|||
connect(selectionManager, &KItemListSelectionManager::selectionChanged,
|
||||
this, &DolphinView::slotSelectionChanged);
|
||||
|
||||
#ifdef HAVE_BALOO
|
||||
m_toolTipManager = new ToolTipManager(this);
|
||||
connect(m_toolTipManager, &ToolTipManager::urlActivated, this, &DolphinView::urlActivated);
|
||||
#endif
|
||||
|
||||
m_versionControlObserver = new VersionControlObserver(this);
|
||||
m_versionControlObserver->setModel(m_model);
|
||||
|
@ -1030,7 +1032,9 @@ void DolphinView::slotItemHovered(int index)
|
|||
const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint());
|
||||
itemRect.moveTo(pos);
|
||||
|
||||
#ifdef HAVE_BALOO
|
||||
m_toolTipManager->showToolTip(item, itemRect, nativeParentWidget()->windowHandle());
|
||||
#endif
|
||||
}
|
||||
|
||||
emit requestItemInfo(item);
|
||||
|
@ -1407,9 +1411,11 @@ void DolphinView::updateViewState()
|
|||
|
||||
void DolphinView::hideToolTip()
|
||||
{
|
||||
#ifdef HAVE_BALOO
|
||||
if (GeneralSettings::showToolTips()) {
|
||||
m_toolTipManager->hideToolTip();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DolphinView::calculateItemCount(int& fileCount,
|
||||
|
|
|
@ -24,11 +24,7 @@
|
|||
#include <KColorScheme>
|
||||
#include <KSeparator>
|
||||
#include <KStringHandler>
|
||||
#ifndef HAVE_BALOO
|
||||
#include <KFileMetaDataWidget>
|
||||
#else
|
||||
#include <Baloo/FileMetaDataWidget>
|
||||
#endif
|
||||
|
||||
#include <QLabel>
|
||||
#include <QStyleOptionFrame>
|
||||
|
@ -61,19 +57,11 @@ DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) :
|
|||
m_name->setMaximumWidth(fontMetrics.averageCharWidth() * 40);
|
||||
|
||||
// Create widget for the meta data
|
||||
#ifndef HAVE_BALOO
|
||||
m_fileMetaDataWidget = new KFileMetaDataWidget(this);
|
||||
connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished,
|
||||
this, &DolphinFileMetaDataWidget::metaDataRequestFinished);
|
||||
connect(m_fileMetaDataWidget, &KFileMetaDataWidget::urlActivated,
|
||||
this, &DolphinFileMetaDataWidget::urlActivated);
|
||||
#else
|
||||
m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this);
|
||||
connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished,
|
||||
this, &DolphinFileMetaDataWidget::metaDataRequestFinished);
|
||||
connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::urlActivated,
|
||||
this, &DolphinFileMetaDataWidget::urlActivated);
|
||||
#endif
|
||||
m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
|
||||
m_fileMetaDataWidget->setReadOnly(true);
|
||||
|
||||
|
|
|
@ -29,13 +29,9 @@
|
|||
class KFileItemList;
|
||||
class QLabel;
|
||||
|
||||
#ifndef HAVE_BALOO
|
||||
class KFileMetaDataWidget;
|
||||
#else
|
||||
namespace Baloo {
|
||||
class FileMetaDataWidget;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Widget that shows the meta information and a preview of one
|
||||
|
@ -79,11 +75,7 @@ signals:
|
|||
private:
|
||||
QLabel* m_preview;
|
||||
QLabel* m_name;
|
||||
#ifndef HAVE_BALOO
|
||||
KFileMetaDataWidget* m_fileMetaDataWidget;
|
||||
#else
|
||||
Baloo::FileMetaDataWidget* m_fileMetaDataWidget;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user