]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Port to Qt6
authorMéven Car <meven@kde.org>
Sun, 7 May 2023 16:27:41 +0000 (18:27 +0200)
committerMéven Car <meven@kde.org>
Sun, 7 May 2023 16:32:17 +0000 (18:32 +0200)
16 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/dolphinnavigatorswidgetaction.cpp
src/dolphinpart.cpp
src/dolphintabbar.cpp
src/kitemviews/kfileitemmodelrolesupdater.cpp
src/panels/places/placespanel.cpp
src/settings/contextmenu/contextmenusettingspage.cpp
src/settings/kcm/kcmdolphingeneral.cpp
src/settings/kcm/kcmdolphingeneral.h
src/settings/kcm/kcmdolphinnavigation.cpp
src/settings/kcm/kcmdolphinnavigation.h
src/settings/kcm/kcmdolphinviewmodes.cpp
src/settings/kcm/kcmdolphinviewmodes.h
src/settings/trash/trashsettingspage.cpp
src/settings/trash/trashsettingspage.h

index 0054a554017a60b34a69c7b8be5eca278bbe4062..d4ad4c69f5c378676239bf616fb5ba4d47da094c 100644 (file)
@@ -7,8 +7,8 @@ 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})
 
-set(QT_MIN_VERSION "5.15.2")
-set(KF6_MIN_VERSION "5.102.0")
+set(QT_MIN_VERSION "6.4.0")
+set(KF6_MIN_VERSION "5.240.0")
 
 # ECM setup
 find_package(ECM ${KF6_MIN_VERSION} CONFIG REQUIRED)
@@ -32,14 +32,14 @@ ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX DOLPHIN
                   VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/src/dolphin_version.h"
 )
 
-ecm_setup_version("5.0.0" VARIABLE_PREFIX DOLPHINVCS
+ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX DOLPHINVCS
                   VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/dolphinvcs_version.h"
                   PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfigVersion.cmake"
-                  SOVERSION 5
+                  SOVERSION ${QT_MAJOR_VERSION}
 )
 
-ecm_setup_version("5.0.0" VARIABLE_PREFIX DOLPHINPRIVATE
-                  SOVERSION 5
+ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE
+                  SOVERSION ${QT_MAJOR_VERSION}
 )
 
 find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
@@ -77,16 +77,17 @@ find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
     WindowSystem
     WidgetsAddons
     Codecs
+    MoreTools
 )
 
-find_package(KF6MoreTools)
-find_package(KUserFeedback 1.2.0)
+find_package(KUserFeedbackQt6 1.2.0)
 set_package_properties(KUserFeedback
         PROPERTIES TYPE OPTIONAL
         PURPOSE "Used for submission of telemetry data"
         )
 
-if(KUserFeedback_FOUND)
+if(KUserFeedbackQt6_FOUND)
+    message ("HAVE_KUSERFEEDBACK")
     set(HAVE_KUSERFEEDBACK TRUE)
 endif()
 
@@ -119,7 +120,7 @@ set_package_properties(KF6Baloo PROPERTIES DESCRIPTION "Baloo Core libraries"
                        PURPOSE "For adding desktop-wide search and tagging support to dolphin"
                       )
 
-find_package(KF6BalooWidgets 19.07.70)
+find_package(KF6BalooWidgets 23.07.70)
 set_package_properties(KF6BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets"
                        URL "https://www.kde.org"
                        TYPE OPTIONAL
@@ -150,11 +151,6 @@ else()
     set(HAVE_TERMINAL TRUE)
 endif()
 
-ecm_set_disabled_deprecation_versions(
-    QT 5.15
-    KF 5.90
-)
-
 add_subdirectory(src)
 add_subdirectory(doc)
 
index af942a4d6ed9b931a32fce50bcaeb39b8c5e1b58..fedf96688f77845c7532c0f122a5db6fe868320d 100644 (file)
@@ -208,6 +208,7 @@ target_link_libraries(
     KF6::WindowSystem
     KF6::WidgetsAddons
     KF6::Codecs
+    KF6::KCMUtils
 
     KF6::MoreTools
 )
@@ -443,8 +444,8 @@ endif()
 if (HAVE_KUSERFEEDBACK)
     target_link_libraries(
         dolphinstatic
-        KUserFeedbackCore
-        KUserFeedbackWidgets
+        KUserFeedbackCoreQt6
+        KUserFeedbackWidgetsQt6
     )
 endif()
 
@@ -473,7 +474,7 @@ target_link_libraries(dolphin
 
 if (HAVE_X11)
     if (QT_MAJOR_VERSION STREQUAL "5")
-        target_link_libraries(dolphin PRIVATE Qt5::X11Extras)
+        target_link_libraries(dolphin PRIVATE Qt{QT_MAJOR_VERSION}::X11Extras)
     else()
         target_link_libraries(dolphin PRIVATE Qt::GuiPrivate)
     endif()
index 47a2a2303454b78998a62e45b864c859b590eaf8..cb2e4bc002862cb47bc8b748fb9f623681ab6d60 100644 (file)
@@ -42,7 +42,7 @@ DolphinNavigatorsWidgetAction::DolphinNavigatorsWidgetAction(QWidget *parent)
 
 void DolphinNavigatorsWidgetAction::adjustSpacing()
 {
-    m_previousWindowWidth = parentWidget()->window()->width();
+    m_previousWindowWidth = qobject_cast<QWidget *>(parent())->window()->width();
     auto viewGeometries = m_viewGeometriesHelper.viewGeometries();
     const int widthOfSplitterPrimary = viewGeometries.globalXOfPrimary + viewGeometries.widthOfPrimary - viewGeometries.globalXOfNavigatorsWidget;
     const QList<int> splitterSizes = {widthOfSplitterPrimary, m_splitter->width() - widthOfSplitterPrimary};
@@ -298,7 +298,7 @@ DolphinNavigatorsWidgetAction::ViewGeometriesHelper::ViewGeometriesHelper(QWidge
 bool DolphinNavigatorsWidgetAction::ViewGeometriesHelper::eventFilter(QObject *watched, QEvent *event)
 {
     if (event->type() == QEvent::Resize) {
-        if (m_navigatorsWidgetAction->parentWidget()->window()->width() != m_navigatorsWidgetAction->m_previousWindowWidth) {
+        if (qobject_cast<QWidget*>(m_navigatorsWidgetAction->parent())->window()->width() != m_navigatorsWidgetAction->m_previousWindowWidth) {
             // The window is being resized which means not all widgets have gotten their new sizes yet.
             // Let's wait a bit so the sizes of the navigatorsWidget and the viewContainers have all
             // had a chance to be updated.
index cb5d31c1fde89f926d3def044ed2653ac54fe639..0af0fd6b3462f65e656b26d61d93b48e7dcb09f7 100644 (file)
 #include <QStandardPaths>
 #include <QTextDocument>
 
+#include <KPluginFactory>
+
 K_PLUGIN_CLASS_WITH_JSON(DolphinPart, "dolphinpart.json")
 
 DolphinPart::DolphinPart(QWidget *parentWidget, QObject *parent, const KPluginMetaData &metaData, const QVariantList &args)
-    : KParts::ReadOnlyPart(parent)
+    : KParts::ReadOnlyPart(parent, metaData)
     , m_openTerminalAction(nullptr)
     , m_removeAction(nullptr)
 {
     Q_UNUSED(args)
-    setMetaData(metaData);
 
     m_extension = new DolphinPartBrowserExtension(this);
 
index 82695ac21a32f16ce372f95bf63a8bea6b421959..aa74e17ae6dea5949d4ce0d5edf678301e3cbd2d 100644 (file)
@@ -32,7 +32,7 @@ DolphinTabBar::DolphinTabBar(QWidget *parent)
 void DolphinTabBar::dragEnterEvent(QDragEnterEvent *event)
 {
     const QMimeData *mimeData = event->mimeData();
-    const int index = tabAt(event->pos());
+    const int index = tabAt(event->position().toPoint());
 
     if (mimeData->hasUrls()) {
         event->acceptProposedAction();
@@ -52,7 +52,7 @@ void DolphinTabBar::dragLeaveEvent(QDragLeaveEvent *event)
 void DolphinTabBar::dragMoveEvent(QDragMoveEvent *event)
 {
     const QMimeData *mimeData = event->mimeData();
-    const int index = tabAt(event->pos());
+    const int index = tabAt(event->position().toPoint());
 
     if (mimeData->hasUrls()) {
         updateAutoActivationTimer(index);
@@ -67,7 +67,7 @@ void DolphinTabBar::dropEvent(QDropEvent *event)
     updateAutoActivationTimer(-1);
 
     const QMimeData *mimeData = event->mimeData();
-    const int index = tabAt(event->pos());
+    const int index = tabAt(event->position().toPoint());
 
     if (mimeData->hasUrls()) {
         Q_EMIT tabDropEvent(index, event);
index 1a849dcd5e76cbad0955d65566dbb2015d7cd147..4ff7306524af7d6fac143667abbc83d43d80f95b 100644 (file)
@@ -118,7 +118,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel *model, QO
     m_directoryContentsCounter = new KDirectoryContentsCounter(m_model, this);
     connect(m_directoryContentsCounter, &KDirectoryContentsCounter::result, this, &KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived);
 
-    const QString pluginNamespace = QStringLiteral("kf" QT_STRINGIFY(QT_VERSION_MAJOR)) + QStringLiteral("/overlayicon");
+    const QString pluginNamespace = QStringLiteral("kf" QT_STRINGIFY(QT_MAJOR_VERSION)) + QStringLiteral("/overlayicon");
     const auto plugins = KPluginMetaData::findPlugins(pluginNamespace, {}, KPluginMetaData::AllowEmptyMetaData);
     for (const KPluginMetaData &data : plugins) {
         auto instance = QPluginLoader(data.fileName()).instance();
index 6467f9c230ceabe09b396bb9dd04ff381d190d04..2155f29bdc0abffa690c0fc78a92af7b96fde6ea 100644 (file)
@@ -142,7 +142,7 @@ static bool isInternalDrag(const QMimeData *mimeData)
 
 void PlacesPanel::dragMoveEvent(QDragMoveEvent *event)
 {
-    const QModelIndex index = indexAt(event->pos());
+    const QModelIndex index = indexAt(event->position().toPoint());
     if (index.isValid()) {
         auto *placesModel = static_cast<KFilePlacesModel *>(model());
 
index daf15bc1b3e98b34c7d68606a9922cc498780d73..ebdda1c1c1d0488eee504b8b6acd7d07d76816dd 100644 (file)
@@ -300,7 +300,7 @@ void ContextMenuSettingsPage::loadServices()
     }
 
     // Load JSON-based plugins that implement the KFileItemActionPlugin interface
-    const auto jsonPlugins = KPluginMetaData::findPlugins(QStringLiteral("kf" QT_STRINGIFY(QT_VERSION_MAJOR)) + QStringLiteral("/kfileitemaction"));
+    const auto jsonPlugins = KPluginMetaData::findPlugins(QStringLiteral("kf" QT_STRINGIFY(QT_MAJOR_VERSION)) + QStringLiteral("/kfileitemaction"));
 
     for (const auto &jsonMetadata : jsonPlugins) {
         const QString desktopEntryName = jsonMetadata.pluginId();
index 25e3b6876d8d9582c04d6162f8777762c784c4d2..417979d234d868c8e8f476dbbb1d402957130ae9 100644 (file)
 
 K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule, "kcmdolphingeneral.json")
 
-DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args)
-    : KCModule(parent, args)
+DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data)
+    : KCModule(qobject_cast<QWidget *>(parent), data)
     , m_pages()
 {
     setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
 
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
+    const auto parentWidget = qobject_cast<QWidget *>(parent);
+    QVBoxLayout *topLayout = new QVBoxLayout(parentWidget);
     topLayout->setContentsMargins(0, 0, 0, 0);
 
-    QTabWidget *tabWidget = new QTabWidget(this);
+    QTabWidget *tabWidget = new QTabWidget(parentWidget);
 
     // initialize 'Behavior' tab
     BehaviorSettingsPage *behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget);
index 889317738796c1ce93922cfeb12c41b2320116d5..828332539e0750dc2b9aec47a022339774112991 100644 (file)
@@ -21,7 +21,7 @@ class DolphinGeneralConfigModule : public KCModule
     Q_OBJECT
 
 public:
-    DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args);
+    DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data);
     ~DolphinGeneralConfigModule() override;
 
     void save() override;
index 63591f4fd213dd8df0f839f65b2b48f06c40e1c6..b18f00c5b1a41e54831403f9b3ec2d4eceb775e6 100644 (file)
 
 K_PLUGIN_CLASS_WITH_JSON(DolphinNavigationConfigModule, "kcmdolphinnavigation.json")
 
-DolphinNavigationConfigModule::DolphinNavigationConfigModule(QWidget *parent, const QVariantList &args)
-    : KCModule(parent, args)
+DolphinNavigationConfigModule::DolphinNavigationConfigModule(QObject *parent)
+    : KCModule(qobject_cast<QWidget *>(parent))
     , m_navigation(nullptr)
 {
     setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
 
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
+    const auto parentWidget = qobject_cast<QWidget *>(parent);
+    QVBoxLayout *topLayout = new QVBoxLayout(parentWidget);
     topLayout->setContentsMargins(0, 0, 0, 0);
 
-    m_navigation = new NavigationSettingsPage(this);
+    m_navigation = new NavigationSettingsPage(parentWidget);
     connect(m_navigation, &NavigationSettingsPage::changed, this, &DolphinNavigationConfigModule::markAsChanged);
     topLayout->addWidget(m_navigation, 0, {});
 }
index 97d7bff85a15d5d3527c79f22933a18922fde947..a2540515597bf12066b4a2b32bc9427410600e78 100644 (file)
@@ -19,7 +19,7 @@ class DolphinNavigationConfigModule : public KCModule
     Q_OBJECT
 
 public:
-    DolphinNavigationConfigModule(QWidget *parent, const QVariantList &args);
+    DolphinNavigationConfigModule(QObject *parent);
     ~DolphinNavigationConfigModule() override;
 
     void save() override;
index 50ee1361891b6df2cedf1856e5aa277a4c74d7ad..0f0068108f065ad984a6937cf86a43b8ced8257f 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <KLocalizedString>
 #include <KPluginFactory>
+#include <KCModule>
 
 #include <QDBusConnection>
 #include <QDBusMessage>
 
 K_PLUGIN_CLASS_WITH_JSON(DolphinViewModesConfigModule, "kcmdolphinviewmodes.json")
 
-DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget *parent, const QVariantList &args)
-    : KCModule(parent, args)
+DolphinViewModesConfigModule::DolphinViewModesConfigModule(QObject *parent, const KPluginMetaData &data)
+    : KCModule(qobject_cast<QWidget *>(parent), data)
     , m_tabs()
 {
     setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
 
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
+    const auto parentWidget = qobject_cast<QWidget *>(parent);
+    QVBoxLayout *topLayout = new QVBoxLayout(parentWidget);
     topLayout->setContentsMargins(0, 0, 0, 0);
 
-    QTabWidget *tabWidget = new QTabWidget(this);
+    QTabWidget *tabWidget = new QTabWidget(parentWidget);
 
     // Initialize 'Icons' tab
     ViewSettingsTab *iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
index 33c0b77a520eb1902c08596635022befee047188..59cbca31414129ed3c06f3888cceb4aee1a7d9e3 100644 (file)
@@ -19,7 +19,7 @@ class DolphinViewModesConfigModule : public KCModule
     Q_OBJECT
 
 public:
-    DolphinViewModesConfigModule(QWidget *parent, const QVariantList &args);
+    DolphinViewModesConfigModule(QObject *parent, const KPluginMetaData &data);
     ~DolphinViewModesConfigModule() override;
 
     void save() override;
index 511d6b353536d1f724a4dea7e5cc74820695fc3e..d21b4833e86918986b5d947dbcb1d704924af0f2 100644 (file)
@@ -6,7 +6,8 @@
 
 #include "trashsettingspage.h"
 
-#include <KCModuleProxy>
+#include <KCModuleLoader>
+#include <KCModule>
 #include <KPluginMetaData>
 
 #include <QFormLayout>
@@ -16,12 +17,13 @@ TrashSettingsPage::TrashSettingsPage(QWidget *parent)
 {
     QFormLayout *topLayout = new QFormLayout(this);
 
-    m_proxy = new KCModuleProxy(KPluginMetaData(QStringLiteral("kcm_trash")));
-    topLayout->addRow(m_proxy);
+    m_kcm = KCModuleLoader::loadModule(KPluginMetaData(QStringLiteral("kcm_trash")));
+
+    topLayout->addRow(m_kcm->widget());
 
     loadSettings();
 
-    connect(m_proxy, &KCModuleProxy::changed, this, &TrashSettingsPage::changed);
+    connect(m_kcm, &KCModule::needsSaveChanged, this, &TrashSettingsPage::changed);
 }
 
 TrashSettingsPage::~TrashSettingsPage()
@@ -30,15 +32,15 @@ TrashSettingsPage::~TrashSettingsPage()
 
 void TrashSettingsPage::applySettings()
 {
-    m_proxy->save();
+    m_kcm->save();
 }
 
 void TrashSettingsPage::restoreDefaults()
 {
-    m_proxy->defaults();
+    m_kcm->defaults();
 }
 
 void TrashSettingsPage::loadSettings()
 {
-    m_proxy->load();
+    m_kcm->load();
 }
index b0e48a018defb506974af7cba4cb124c811493dc..a5253774cf43ff6dfa2a83bc0c9924bae10ac594 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "settings/settingspagebase.h"
 
-class KCModuleProxy;
+class KCModule;
 
 /**
  * @brief Tab page for the 'Trash' settings of the Dolphin settings dialog, it uses the KCM.
@@ -29,7 +29,7 @@ public:
 
 private:
     void loadSettings();
-    KCModuleProxy *m_proxy;
+    KCModule *m_kcm;
 };
 
 #endif