diff options
| -rw-r--r-- | CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/kitemviews/private/kfileitemmodeldirlister.cpp | 5 | ||||
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/settings/contextmenu/contextmenusettingspage.cpp | 15 | ||||
| -rw-r--r-- | src/settings/dolphin_generalsettings.kcfg | 4 | ||||
| -rw-r--r-- | src/settings/general/statusbarsettingspage.cpp | 16 | ||||
| -rw-r--r-- | src/settings/general/statusbarsettingspage.h | 2 | ||||
| -rw-r--r-- | src/statusbar/dolphinstatusbar.cpp | 3 | ||||
| -rw-r--r-- | src/trash/dolphintrash.cpp | 5 | ||||
| -rw-r--r-- | src/views/versioncontrol/kversioncontrolplugin.h | 23 | ||||
| -rw-r--r-- | src/views/versioncontrol/versioncontrolobserver.cpp | 50 |
12 files changed, 109 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6115b26a3..4336205fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.0) # KDE Application Version, managed by release script set (RELEASE_SERVICE_VERSION_MAJOR "21") -set (RELEASE_SERVICE_VERSION_MINOR "03") -set (RELEASE_SERVICE_VERSION_MICRO "80") +set (RELEASE_SERVICE_VERSION_MINOR "07") +set (RELEASE_SERVICE_VERSION_MICRO "70") set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}") project(Dolphin VERSION ${RELEASE_SERVICE_VERSION}) @@ -53,7 +53,6 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS DocTools - Init KCMUtils NewStuff CoreAddons diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f3ecfff2..f70659467 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -333,12 +333,11 @@ set(dolphin_SRCS file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/icons/*system-file-manager.png") ecm_add_app_icon(dolphin_SRCS ICONS ${ICONS_SRCS}) -kf5_add_kdeinit_executable(dolphin ${dolphin_SRCS}) +add_executable(dolphin ${dolphin_SRCS}) - -target_link_libraries(kdeinit_dolphin PUBLIC - dolphinprivate +target_link_libraries(dolphin PRIVATE + dolphinprivate dolphinstatic KF5::Crash ) @@ -346,13 +345,12 @@ target_link_libraries(kdeinit_dolphin PUBLIC include(DbusInterfaceMacros) generate_and_install_dbus_interface( - kdeinit_dolphin + dolphin dbusinterface.h org.freedesktop.FileManager1.xml OPTIONS -a ) -install(TARGETS kdeinit_dolphin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS dolphin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## diff --git a/src/kitemviews/private/kfileitemmodeldirlister.cpp b/src/kitemviews/private/kfileitemmodeldirlister.cpp index 90c970874..eb860a2b9 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.cpp +++ b/src/kitemviews/private/kfileitemmodeldirlister.cpp @@ -8,11 +8,16 @@ #include <KLocalizedString> #include <KIO/Job> +#include <kio_version.h> KFileItemModelDirLister::KFileItemModelDirLister(QObject* parent) : KDirLister(parent) { +#if KIO_VERSION < QT_VERSION_CHECK(5, 82, 0) setAutoErrorHandlingEnabled(false, nullptr); +#else + setAutoErrorHandlingEnabled(false); +#endif } KFileItemModelDirLister::~KFileItemModelDirLister() diff --git a/src/main.cpp b/src/main.cpp index ef2905d77..fba45f43c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ #endif #include <iostream> -extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) +int main(int argc, char **argv) { #ifndef Q_OS_WIN // Prohibit using sudo or kdesu (but allow using the root user directly) diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index 0723fee2e..8631b0ceb 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -304,9 +304,24 @@ void ContextMenuSettingsPage::loadVersionControlSystems() const QStringList enabledPlugins = VersionControlSettings::enabledPlugins(); // Create a checkbox for each available version control plugin + QSet<QString> loadedPlugins; + + const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("dolphin/vcs")); + for (const auto &plugin : plugins) { + const QString pluginName = plugin.name(); + addRow(QStringLiteral("code-class"), + pluginName, + VersionControlServicePrefix + pluginName, + enabledPlugins.contains(pluginName)); + loadedPlugins += pluginName; + } + const KService::List pluginServices = KServiceTypeTrader::self()->query(QStringLiteral("FileViewVersionControlPlugin")); for (const auto &plugin : pluginServices) { const QString pluginName = plugin->name(); + if (loadedPlugins.contains(pluginName)) { + continue; + } addRow(QStringLiteral("code-class"), pluginName, VersionControlServicePrefix + pluginName, diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index bc1cf72aa..728d11634 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -101,6 +101,10 @@ <label>Use auto-expanding folders for all view types</label> <default>false</default> </entry> + <entry name="ShowStatusBar" type="Bool"> + <label>Show the statusbar</label> + <default>true</default> + </entry> <entry name="ShowZoomSlider" type="Bool"> <label>Show zoom slider in the statusbar</label> <default>true</default> diff --git a/src/settings/general/statusbarsettingspage.cpp b/src/settings/general/statusbarsettingspage.cpp index ddefa1a40..9d90a64fd 100644 --- a/src/settings/general/statusbarsettingspage.cpp +++ b/src/settings/general/statusbarsettingspage.cpp @@ -15,19 +15,24 @@ StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) : SettingsPageBase(parent), + m_showStatusBar(nullptr), m_showZoomSlider(nullptr), m_showSpaceInfo(nullptr) { + m_showStatusBar = new QCheckBox(i18nc("@option:check", "Show status bar"), this); m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), this); m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), this); QVBoxLayout* topLayout = new QVBoxLayout(this); + topLayout->addWidget(m_showStatusBar); topLayout->addWidget(m_showZoomSlider); topLayout->addWidget(m_showSpaceInfo); topLayout->addStretch(); loadSettings(); + connect(m_showStatusBar, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed); + connect(m_showStatusBar, &QCheckBox::toggled, this, &StatusBarSettingsPage::onShowStatusBarToggled); connect(m_showZoomSlider, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed); connect(m_showSpaceInfo, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed); } @@ -36,9 +41,17 @@ StatusBarSettingsPage::~StatusBarSettingsPage() { } +void StatusBarSettingsPage::onShowStatusBarToggled() +{ + const bool checked = m_showStatusBar->isChecked(); + m_showZoomSlider->setEnabled(checked); + m_showSpaceInfo->setEnabled(checked); +} + void StatusBarSettingsPage::applySettings() { GeneralSettings* settings = GeneralSettings::self(); + settings->setShowStatusBar(m_showStatusBar->isChecked()); settings->setShowZoomSlider(m_showZoomSlider->isChecked()); settings->setShowSpaceInfo(m_showSpaceInfo->isChecked()); settings->save(); @@ -54,7 +67,10 @@ void StatusBarSettingsPage::restoreDefaults() void StatusBarSettingsPage::loadSettings() { + m_showStatusBar->setChecked(GeneralSettings::showStatusBar()); m_showZoomSlider->setChecked(GeneralSettings::showZoomSlider()); m_showSpaceInfo->setChecked(GeneralSettings::showSpaceInfo()); + + onShowStatusBarToggled(); } diff --git a/src/settings/general/statusbarsettingspage.h b/src/settings/general/statusbarsettingspage.h index 3c5e7c2ad..af8e06164 100644 --- a/src/settings/general/statusbarsettingspage.h +++ b/src/settings/general/statusbarsettingspage.h @@ -29,8 +29,10 @@ public: private: void loadSettings(); + void onShowStatusBarToggled(); private: + QCheckBox* m_showStatusBar; QCheckBox* m_showZoomSlider; QCheckBox* m_showSpaceInfo; }; diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp index 91c843366..8ac74e71f 100644 --- a/src/statusbar/dolphinstatusbar.cpp +++ b/src/statusbar/dolphinstatusbar.cpp @@ -321,12 +321,15 @@ void DolphinStatusBar::updateZoomSliderToolTip(int zoomLevel) void DolphinStatusBar::setExtensionsVisible(bool visible) { + bool showStatusBar = visible; bool showSpaceInfo = visible; bool showZoomSlider = visible; if (visible) { + showStatusBar = GeneralSettings::showStatusBar(); showSpaceInfo = GeneralSettings::showSpaceInfo(); showZoomSlider = GeneralSettings::showZoomSlider(); } + setVisible(showStatusBar); m_spaceInfo->setShown(showSpaceInfo); m_spaceInfo->setVisible(showSpaceInfo); m_zoomSlider->setVisible(showZoomSlider); diff --git a/src/trash/dolphintrash.cpp b/src/trash/dolphintrash.cpp index bec266c3b..8684cda06 100644 --- a/src/trash/dolphintrash.cpp +++ b/src/trash/dolphintrash.cpp @@ -8,6 +8,7 @@ #include "dolphintrash.h" #include <KIO/JobUiDelegate> +#include <kio_version.h> #include <KJobWidgets> #include <QList> #include <KNotification> @@ -21,7 +22,11 @@ Trash::Trash() // The trash icon must always be updated dependent on whether // the trash is empty or not. We use a KDirLister that automatically // watches for changes if the number of items has been changed. +#if KIO_VERSION < QT_VERSION_CHECK(5, 82, 0) m_trashDirLister->setAutoErrorHandlingEnabled(false, nullptr); +#else + m_trashDirLister->setAutoErrorHandlingEnabled(false); +#endif m_trashDirLister->setDelayedMimeTypes(true); auto trashDirContentChanged = [this]() { bool isTrashEmpty = m_trashDirLister->items().isEmpty(); diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h index aeac5ad29..c908be247 100644 --- a/src/views/versioncontrol/kversioncontrolplugin.h +++ b/src/views/versioncontrol/kversioncontrolplugin.h @@ -23,14 +23,15 @@ class KFileItem; * steps are required (in the example below it is assumed that a plugin for * Subversion will be written): * - * - Create a fileviewsvnplugin.desktop file with the following content: + * - Create a fileviewsvnplugin.json file with the following content: * <code> - * [Desktop Entry] - * Type=Service - * Name=Subversion - * X-KDE-ServiceTypes=FileViewVersionControlPlugin - * MimeType=text/plain; - * X-KDE-Library=fileviewsvnplugin + * { + * "KPlugin": { + * "Description": "The svn plugin", + * "Name": "Svn" + * } + * } + * </code> * * - Create a class FileViewSvnPlugin derived from KVersionControlPlugin and @@ -45,15 +46,13 @@ class KFileItem; * <code> * #include <KPluginFactory> * #include <KPluginLoader> - * K_PLUGIN_FACTORY(FileViewSvnPluginFactory, registerPlugin<FileViewSvnPlugin>();) - * K_EXPORT_PLUGIN(FileViewSvnPluginFactory("fileviewsvnplugin")) + * K_PLUGIN_CLASS_WITH_JSON(FileViewSvnPlugin, "fileviewsvnplugin.json") * </code> * * - Add the following lines to your CMakeLists.txt file: * <code> - * kde4_add_plugin(fileviewsvnplugin fileviewsvnplugin.cpp) - * target_link_libraries(fileviewsvnplugin konq) - * install(FILES fileviewsvnplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR}) + * kcoreaddons_add_plugin(fileviewsvnplugin SOURCES fileviewsvnplugin.cpp INSTALL_NAMESPACE "dolphin/vcs") + * target_link_libraries(fileviewsvnplugin DolphinVcs) * </code> * * General implementation notes: diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index cf5be3c91..175d362bc 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -15,6 +15,8 @@ #include <KLocalizedString> #include <KService> #include <KServiceTypeTrader> +#include <KPluginLoader> +#include <KPluginMetaData> #include <QTimer> @@ -279,24 +281,54 @@ void VersionControlObserver::initPlugins() // all fileview version control plugins and remember them in 'plugins'. const QStringList enabledPlugins = VersionControlSettings::enabledPlugins(); + const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("dolphin/vcs")); + + QSet<QString> loadedPlugins; + + for (const auto &p : plugins) { + if (enabledPlugins.contains(p.name())) { + KPluginLoader loader(p.fileName()); + KPluginFactory *factory = loader.factory(); + KVersionControlPlugin *plugin = factory->create<KVersionControlPlugin>(); + if (plugin) { + m_plugins.append(plugin); + loadedPlugins += p.name(); + } + } + } + + // Deprecated: load plugins using KService. This mechanism will be removed with KF6 const KService::List pluginServices = KServiceTypeTrader::self()->query(QStringLiteral("FileViewVersionControlPlugin")); for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) { + if (loadedPlugins.contains((*it)->property("Name", QVariant::String).toString())) { + continue; + } if (enabledPlugins.contains((*it)->name())) { + KPluginLoader pluginLoader(*(*it)); + // Need to cast to int, because pluginVersion() returns -1 as + // an unsigned int for plugins without versions. + if (int(pluginLoader.pluginVersion()) < 2) { + qCWarning(DolphinDebug) << "Can't load old plugin" << (*it)->name(); + continue; + } KVersionControlPlugin* plugin = (*it)->createInstance<KVersionControlPlugin>(this); if (plugin) { - connect(plugin, &KVersionControlPlugin::itemVersionsChanged, - this, &VersionControlObserver::silentDirectoryVerification); - connect(plugin, &KVersionControlPlugin::infoMessage, - this, &VersionControlObserver::infoMessage); - connect(plugin, &KVersionControlPlugin::errorMessage, - this, &VersionControlObserver::errorMessage); - connect(plugin, &KVersionControlPlugin::operationCompletedMessage, - this, &VersionControlObserver::operationCompletedMessage); - m_plugins.append(plugin); } } } + + for (auto &plugin : qAsConst(m_plugins)) { + connect(plugin, &KVersionControlPlugin::itemVersionsChanged, + this, &VersionControlObserver::silentDirectoryVerification); + connect(plugin, &KVersionControlPlugin::infoMessage, + this, &VersionControlObserver::infoMessage); + connect(plugin, &KVersionControlPlugin::errorMessage, + this, &VersionControlObserver::errorMessage); + connect(plugin, &KVersionControlPlugin::operationCompletedMessage, + this, &VersionControlObserver::operationCompletedMessage); + } + m_pluginsInitialized = true; } } |
