From 27afd0eb9a061b59826bca3b5b1543664dd8d235 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sat, 23 Dec 2023 21:05:48 +0100 Subject: [PATCH] [app] Undo Qt5 compatibility hacks and fix QML code --- CMakeLists.txt | 11 ----------- app/CMakeLists.txt | 9 +-------- app/qml/DevicePage.qml | 4 ++-- app/qml/PluginInfoPage.qml | 2 +- app/qml/presentationRemote.qml | 14 ++++++++------ app/qml/runcommand.qml | 16 +++++++++------- app/resources.qrc | 18 ++++++++++++++++++ app/resources.qrc.in | 18 ------------------ 8 files changed, 39 insertions(+), 53 deletions(-) create mode 100644 app/resources.qrc delete mode 100644 app/resources.qrc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 7681feefe..f923b903d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,17 +37,6 @@ ecm_setup_version(${RELEASE_SERVICE_VERSION} VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/kdeconnect-version.h ) -if(QT_MAJOR_VERSION STREQUAL "6") - set(KIRIGAMI_ICON "icon.name") - set(KIRIGAMI_PAGE_ACTIONS "actions") - set(QTQUICK_FILEDIALOG_FOLDER "currentFolder") -else() - set(QTQUICK_DIALOGS_IMPORT_VERSION 1.0) - set(KIRIGAMI_ICON "icon") - set(KIRIGAMI_PAGE_ACTIONS "contextualActions") - set(QTQUICK_FILEDIALOG_FOLDER "folder") -endif() - ecm_set_disabled_deprecation_versions( QT 5.15 KF 5.110 diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 74c914006..c34279603 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,11 +1,4 @@ -configure_file(qml/main.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/main.qml) -configure_file(qml/DevicePage.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/DevicePage.qml) -configure_file(qml/FindDevicesPage.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/FindDevicesPage.qml) -configure_file(qml/PluginInfoPage.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/PluginInfoPage.qml) -configure_file(qml/runcommand.qml ${CMAKE_CURRENT_BINARY_DIR}/qml/runcommand.qml) -configure_file(resources.qrc.in ${CMAKE_CURRENT_SOURCE_DIR}/resources.generated.qrc) - -qt_add_resources(kdeconnect_SRCS resources.generated.qrc) +qt_add_resources(kdeconnect_SRCS resources.qrc) qt_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc) diff --git a/app/qml/DevicePage.qml b/app/qml/DevicePage.qml index 2293f51df..514f7fdf0 100644 --- a/app/qml/DevicePage.qml +++ b/app/qml/DevicePage.qml @@ -16,7 +16,7 @@ Kirigami.ScrollablePage { property QtObject currentDevice title: currentDevice.name - @KIRIGAMI_PAGE_ACTIONS@: [ + actions: [ Kirigami.Action { icon.name: "network-disconnect" onTriggered: root.currentDevice.unpair() @@ -172,7 +172,7 @@ Kirigami.ScrollablePage { id: fileDialog readonly property var shareIface: root.currentDevice ? ShareDbusInterfaceFactory.create(root.currentDevice.id()) : null title: i18nd("kdeconnect-app", "Please choose a file") - @QTQUICK_FILEDIALOG_FOLDER@: shortcuts.home + currentFolder: shortcuts.home onAccepted: shareIface.shareUrl(fileDialog.fileUrl) } } diff --git a/app/qml/PluginInfoPage.qml b/app/qml/PluginInfoPage.qml index ab06bf0c1..7e6008567 100644 --- a/app/qml/PluginInfoPage.qml +++ b/app/qml/PluginInfoPage.qml @@ -12,7 +12,7 @@ Kirigami.Page { property string configFile property string device - @KIRIGAMI_PAGE_ACTIONS@: loader.item && loader.item.action ? loader.item.action : null + actions: loader.item && loader.item.action ? [loader.item.action] : [] onConfigFileChanged: loader.setSource(configFile, { device: root.device diff --git a/app/qml/presentationRemote.qml b/app/qml/presentationRemote.qml index e7b30b8d5..4a8524aa3 100644 --- a/app/qml/presentationRemote.qml +++ b/app/qml/presentationRemote.qml @@ -15,13 +15,15 @@ Kirigami.Page title: i18nd("kdeconnect-app", "Presentation Remote") property QtObject pluginInterface - actions.main: Kirigami.Action { - icon.name: "view-fullscreen" - text: i18nd("kdeconnect-app", "Enable Full-Screen") - onTriggered: { - mousepad.pluginInterface.sendKeyPress("", 25 /*XK_F5*/); + actions: [ + Kirigami.Action { + icon.name: "view-fullscreen" + text: i18nd("kdeconnect-app", "Enable Full-Screen") + onTriggered: { + mousepad.pluginInterface.sendKeyPress("", 25 /*XK_F5*/); + } } - } + ] ColumnLayout { diff --git a/app/qml/runcommand.qml b/app/qml/runcommand.qml index 6d5744095..fe1da318d 100644 --- a/app/qml/runcommand.qml +++ b/app/qml/runcommand.qml @@ -16,14 +16,16 @@ Kirigami.ScrollablePage title: i18nd("kdeconnect-app", "Run command") property QtObject pluginInterface - @KIGIGAMI_PAGE_ACTIONS@: Kirigami.Action { - icon.name: "document-edit" - text: i18nd("kdeconnect-app", "Edit commands") - onTriggered: { - pluginInterface.editCommands(); - showPassiveNotification(i18nd("kdeconnect-app", "You can edit commands on the connected device")); + actions: [ + Kirigami.Action { + icon.name: "document-edit" + text: i18nd("kdeconnect-app", "Edit commands") + onTriggered: { + pluginInterface.editCommands(); + showPassiveNotification(i18nd("kdeconnect-app", "You can edit commands on the connected device")); + } } - } + ] ListView { id: commandsList diff --git a/app/resources.qrc b/app/resources.qrc new file mode 100644 index 000000000..b77b92983 --- /dev/null +++ b/app/resources.qrc @@ -0,0 +1,18 @@ + + + qml/main.qml + qml/mpris.qml + qml/mousepad.qml + qml/presentationRemote.qml + + qml/PluginItem.qml + qml/DevicePage.qml + qml/FindDevicesPage.qml + qml/runcommand.qml + qml/volume.qml + qml/MprisSlider.qml + qml/PluginSettings.qml + qml/PluginInfoPage.qml + qml/Settings.qml + + diff --git a/app/resources.qrc.in b/app/resources.qrc.in deleted file mode 100644 index 97bfa1bfc..000000000 --- a/app/resources.qrc.in +++ /dev/null @@ -1,18 +0,0 @@ - - - @CMAKE_CURRENT_BINARY_DIR@/qml/main.qml - qml/mpris.qml - qml/mousepad.qml - qml/presentationRemote.qml - - qml/PluginItem.qml - @CMAKE_CURRENT_BINARY_DIR@/qml/DevicePage.qml - @CMAKE_CURRENT_BINARY_DIR@/qml/FindDevicesPage.qml - @CMAKE_CURRENT_BINARY_DIR@/qml/runcommand.qml - qml/volume.qml - qml/MprisSlider.qml - qml/PluginSettings.qml - @CMAKE_CURRENT_BINARY_DIR@/qml/PluginInfoPage.qml - qml/Settings.qml - -