[app] Undo Qt5 compatibility hacks and fix QML code

This commit is contained in:
Nicolas Fella 2023-12-23 21:05:48 +01:00
parent 37ff0b5318
commit 27afd0eb9a
8 changed files with 39 additions and 53 deletions

View file

@ -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

View file

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

View file

@ -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)
}
}

View file

@ -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

View file

@ -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
{

View file

@ -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

18
app/resources.qrc Normal file
View file

@ -0,0 +1,18 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="qml/main.qml">qml/main.qml</file>
<file>qml/mpris.qml</file>
<file>qml/mousepad.qml</file>
<file>qml/presentationRemote.qml</file>
<file>qml/PluginItem.qml</file>
<file alias="qml/DevicePage.qml">qml/DevicePage.qml</file>
<file alias="qml/FindDevicesPage.qml">qml/FindDevicesPage.qml</file>
<file alias="qml/runcommand.qml">qml/runcommand.qml</file>
<file>qml/volume.qml</file>
<file>qml/MprisSlider.qml</file>
<file>qml/PluginSettings.qml</file>
<file alias="qml/PluginInfoPage.qml">qml/PluginInfoPage.qml</file>
<file>qml/Settings.qml</file>
</qresource>
</RCC>

View file

@ -1,18 +0,0 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="qml/main.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/main.qml</file>
<file>qml/mpris.qml</file>
<file>qml/mousepad.qml</file>
<file>qml/presentationRemote.qml</file>
<file>qml/PluginItem.qml</file>
<file alias="qml/DevicePage.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/DevicePage.qml</file>
<file alias="qml/FindDevicesPage.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/FindDevicesPage.qml</file>
<file alias="qml/runcommand.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/runcommand.qml</file>
<file>qml/volume.qml</file>
<file>qml/MprisSlider.qml</file>
<file>qml/PluginSettings.qml</file>
<file alias="qml/PluginInfoPage.qml">@CMAKE_CURRENT_BINARY_DIR@/qml/PluginInfoPage.qml</file>
<file>qml/Settings.qml</file>
</qresource>
</RCC>