From bc67033c003e7f8b73fadd4239ab5b737de27877 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Thu, 22 Feb 2024 21:10:50 +0100 Subject: [PATCH] Adapt to QTP0001 --- CMakeLists.txt | 3 +++ src/main.cpp | 2 +- src/qml/AccountEditorPage.qml | 2 +- src/qml/AccountMenu.qml | 6 +++--- src/qml/AccountsPage.qml | 4 ++-- src/qml/AppearanceSettingsPage.qml | 2 +- src/qml/Captcha.qml | 2 +- src/qml/ContextMenu.qml | 4 ++-- src/qml/CreateRoomDialog.qml | 4 ++-- src/qml/DelegateContextMenu.qml | 4 ++-- src/qml/Email.qml | 2 +- src/qml/ExploreComponent.qml | 8 ++++---- src/qml/ExploreComponentMobile.qml | 8 ++++---- src/qml/FancyEffectsContainer.qml | 8 ++++---- src/qml/FileDelegateContextMenu.qml | 2 +- src/qml/GlobalMenu.qml | 6 +++--- src/qml/Homeserver.qml | 4 ++-- src/qml/Login.qml | 8 ++++---- src/qml/LoginMethod.qml | 4 ++-- src/qml/LoginRegister.qml | 4 ++-- src/qml/LoginStep.qml | 2 +- src/qml/MessageDelegateContextMenu.qml | 2 +- src/qml/Password.qml | 4 ++-- src/qml/RegisterPassword.qml | 2 +- src/qml/RoomData.qml | 4 ++-- src/qml/RoomDelegate.qml | 2 +- src/qml/RoomDrawer.qml | 2 +- src/qml/RoomDrawerPage.qml | 2 +- src/qml/RoomInformation.qml | 8 ++++---- src/qml/RoomListPage.qml | 6 +++--- src/qml/RoomPage.qml | 2 +- src/qml/SelectParentDialog.qml | 4 ++-- src/qml/ShareAction.qml | 2 +- src/qml/SpaceDrawer.qml | 4 ++-- src/qml/SpaceHomePage.qml | 6 +++--- src/qml/SpaceListContextMenu.qml | 4 ++-- src/qml/Sso.qml | 4 ++-- src/qml/Terms.qml | 2 +- src/qml/UserDetailDialog.qml | 4 ++-- src/qml/UserInfo.qml | 6 +++--- src/qml/Username.qml | 4 ++-- src/qml/WelcomePage.qml | 20 +++++++++++--------- src/qml/main.qml | 14 +++++++------- 43 files changed, 101 insertions(+), 96 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc2e418f3..7bc898da2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,9 @@ set_package_properties(Qt6 PROPERTIES TYPE REQUIRED PURPOSE "Basic application components" ) + +qt_policy(SET QTP0001 NEW) + find_package(KF6 ${KF_MIN_VERSION} COMPONENTS Kirigami I18n Notifications Config CoreAddons Sonnet ItemModels ColorScheme) set_package_properties(KF6 PROPERTIES TYPE REQUIRED diff --git a/src/main.cpp b/src/main.cpp index 7e6c44459..7884d3f37 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) engine.addImageProvider(QLatin1String("mxc"), MatrixImageProvider::create(&engine, &engine)); engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider); - engine.load(QUrl(QStringLiteral("qrc:/org/kde/neochat/qml/main.qml"))); + engine.load(QUrl(QStringLiteral("qrc:/qt/qml/org/kde/neochat/qml/main.qml"))); if (engine.rootObjects().isEmpty()) { return -1; } diff --git a/src/qml/AccountEditorPage.qml b/src/qml/AccountEditorPage.qml index 2866dbbc9..4e337a9d4 100644 --- a/src/qml/AccountEditorPage.qml +++ b/src/qml/AccountEditorPage.qml @@ -213,7 +213,7 @@ FormCard.FormCardPage { FormCard.FormButtonDelegate { id: deactivateAccountButton text: i18n("Deactivate Account") - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ConfirmDeactivateAccountDialog.qml", { + onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ConfirmDeactivateAccountDialog.qml'), { connection: root.connection }, { title: i18nc("@title", "Confirm Deactivating Account") diff --git a/src/qml/AccountMenu.qml b/src/qml/AccountMenu.qml index 8b0dee5ef..2a4e141dc 100644 --- a/src/qml/AccountMenu.qml +++ b/src/qml/AccountMenu.qml @@ -20,7 +20,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18n("Edit this account") icon.name: "document-edit" - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/AccountEditorPage.qml", { + onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'AccountEditorPage.qml'), { connection: root.connection }, { title: i18n("Account editor") @@ -29,7 +29,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18n("Notification settings") icon.name: "notifications" - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { + onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), { defaultPage: "notifications", connection: root.connection }, { @@ -41,7 +41,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18n("Devices") icon.name: "computer-symbolic" - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { + onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), { defaultPage: "devices", connection: root.connection }, { diff --git a/src/qml/AccountsPage.qml b/src/qml/AccountsPage.qml index 98b0abc6b..9519e6477 100644 --- a/src/qml/AccountsPage.qml +++ b/src/qml/AccountsPage.qml @@ -29,7 +29,7 @@ FormCard.FormCardPage { id: accountDelegate required property NeoChatConnection connection Layout.fillWidth: true - onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/AccountEditorPage.qml", { + onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'AccountEditorPage.qml'), { connection: accountDelegate.connection }, { title: i18n("Account editor") @@ -101,7 +101,7 @@ FormCard.FormCardPage { id: addAccountDelegate text: i18n("Add Account") icon.name: "list-add" - onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/WelcomePage.qml") + onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'WelcomePage.qml')) } } diff --git a/src/qml/AppearanceSettingsPage.qml b/src/qml/AppearanceSettingsPage.qml index 2a373b570..79c4d0c94 100644 --- a/src/qml/AppearanceSettingsPage.qml +++ b/src/qml/AppearanceSettingsPage.qml @@ -221,7 +221,7 @@ FormCard.FormCardPage { Loader { id: colorSchemeDelegate visible: item !== null - source: "qrc:/org/kde/neochat/qml/ColorScheme.qml" + sourceComponent: Qt.createComponent('org.kde.neochat', 'ColorScheme.qml') Layout.fillWidth: true } } diff --git a/src/qml/Captcha.qml b/src/qml/Captcha.qml index 8ebe48933..2669bc83f 100644 --- a/src/qml/Captcha.qml +++ b/src/qml/Captcha.qml @@ -43,6 +43,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") + onTriggered: root.processed("Username.qml") } } diff --git a/src/qml/ContextMenu.qml b/src/qml/ContextMenu.qml index fd8a7a96d..cfd6bae0d 100644 --- a/src/qml/ContextMenu.qml +++ b/src/qml/ContextMenu.qml @@ -121,7 +121,7 @@ Loader { QQC2.MenuItem { text: i18n("Room Settings") icon.name: "configure" - onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), { room: room, connection: connection }, { @@ -195,7 +195,7 @@ Loader { QQC2.ToolButton { icon.name: 'settings-configure' onClicked: { - QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), { room: room, connection: root.connection }, { diff --git a/src/qml/CreateRoomDialog.qml b/src/qml/CreateRoomDialog.qml index 7658e1966..63d90c7b1 100644 --- a/src/qml/CreateRoomDialog.qml +++ b/src/qml/CreateRoomDialog.qml @@ -111,7 +111,7 @@ FormCard.FormCardPage { visible: !chosenRoomDelegate.visible text: i18nc("@action:button", "Pick room") onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Explore Rooms") @@ -194,7 +194,7 @@ FormCard.FormCardPage { } onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Explore Rooms") diff --git a/src/qml/DelegateContextMenu.qml b/src/qml/DelegateContextMenu.qml index 9f8a3452c..cb5eef74f 100644 --- a/src/qml/DelegateContextMenu.qml +++ b/src/qml/DelegateContextMenu.qml @@ -94,7 +94,7 @@ Loader { text: i18n("Remove") icon.name: "edit-delete-remove" icon.color: "red" - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", { + onTriggered: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'RemoveSheet.qml'), { room: currentRoom, eventId: eventId }, { @@ -117,7 +117,7 @@ Loader { text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report") icon.name: "dialog-warning-symbolic" visible: !author.isLocalUser - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", { + onTriggered: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReportSheet.qml'), { room: currentRoom, eventId: eventId }, { diff --git a/src/qml/Email.qml b/src/qml/Email.qml index cbceb2fb5..5e37178da 100644 --- a/src/qml/Email.qml +++ b/src/qml/Email.qml @@ -55,6 +55,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") + onTriggered: root.processed("Username.qml") } } diff --git a/src/qml/ExploreComponent.qml b/src/qml/ExploreComponent.qml index 7e4a70c9e..bff942504 100644 --- a/src/qml/ExploreComponent.qml +++ b/src/qml/ExploreComponent.qml @@ -23,7 +23,7 @@ RowLayout { text: i18n("Explore rooms") icon.name: "compass" onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Explore Rooms") @@ -36,7 +36,7 @@ RowLayout { property Kirigami.Action chatAction: Kirigami.Action { text: i18n("Find your friends") icon.name: "list-add-user" - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Find your friends") @@ -46,7 +46,7 @@ RowLayout { text: i18n("Create a Room") icon.name: "system-users-symbolic" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog.qml'), { connection: root.connection }, { title: i18nc("@title", "Create a Room") @@ -58,7 +58,7 @@ RowLayout { text: i18n("Create a Space") icon.name: "list-add" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog.qml'), { connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space") diff --git a/src/qml/ExploreComponentMobile.qml b/src/qml/ExploreComponentMobile.qml index 023198b07..4fde7ef1d 100644 --- a/src/qml/ExploreComponentMobile.qml +++ b/src/qml/ExploreComponentMobile.qml @@ -52,7 +52,7 @@ ColumnLayout { text: i18n("Explore rooms") icon.name: "compass" onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Explore Rooms") @@ -67,7 +67,7 @@ ColumnLayout { text: i18n("Find your friends") icon.name: "list-add-user" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Find your friends") @@ -140,7 +140,7 @@ ColumnLayout { text: i18n("Create a Room") icon.name: "system-users-symbolic" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Create a Room") @@ -156,7 +156,7 @@ ColumnLayout { text: i18n("Create a Space") icon.name: "list-add" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog.qml'), { connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space") diff --git a/src/qml/FancyEffectsContainer.qml b/src/qml/FancyEffectsContainer.qml index 90f845dbd..b1a1a10f5 100644 --- a/src/qml/FancyEffectsContainer.qml +++ b/src/qml/FancyEffectsContainer.qml @@ -63,7 +63,7 @@ Item { } ImageParticle { - source: "qrc:/org/kde/neochat/qml/confetti.png" + source: "qrc:/qt/qml/org/kde/neochat/qml/confetti.png" entryEffect: ImageParticle.Scale rotationVariation: 360 rotationVelocity: 90 @@ -211,7 +211,7 @@ Item { ImageParticle { id: fireworksParticleA system: fireworksSystem - source: "qrc:/org/kde/neochat/qml/glowdot.png" + source: "qrc:/qt/qml/org/kde/neochat/qml/glowdot.png" alphaVariation: root.isThemeDark ? 0.1 : 0.1 alpha: root.isThemeDark ? 0.5 : 1 groups: ["a"] @@ -222,7 +222,7 @@ Item { ImageParticle { system: fireworksSystem - source: "qrc:/org/kde/neochat/qml/glowdot.png" + source: "qrc:/qt/qml/org/kde/neochat/qml/glowdot.png" color: root.isThemeDark ? "white" : "gold" alphaVariation: root.isThemeDark ? 0.1 : 0.1 alpha: root.isThemeDark ? 0.5 : 1 @@ -235,7 +235,7 @@ Item { ImageParticle { id: fireworksParticleB system: fireworksSystem - source: "qrc:/org/kde/neochat/qml/glowdot.png" + source: "qrc:/qt/qml/org/kde/neochat/qml/glowdot.png" alphaVariation: root.isThemeDark ? 0.1 : 0.1 alpha: root.isThemeDark ? 0.5 : 1 groups: ["b"] diff --git a/src/qml/FileDelegateContextMenu.qml b/src/qml/FileDelegateContextMenu.qml index a783c67e6..178faa7a5 100644 --- a/src/qml/FileDelegateContextMenu.qml +++ b/src/qml/FileDelegateContextMenu.qml @@ -68,7 +68,7 @@ DelegateContextMenu { text: i18n("Remove") icon.name: "edit-delete-remove" icon.color: "red" - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", { + onTriggered: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'RemoveSheet.qml'), { room: currentRoom, eventId: eventId }, { diff --git a/src/qml/GlobalMenu.qml b/src/qml/GlobalMenu.qml index bb2b4eb57..51d26ae8a 100644 --- a/src/qml/GlobalMenu.qml +++ b/src/qml/GlobalMenu.qml @@ -28,7 +28,7 @@ Labs.MenuBar { text: i18nc("menu", "Configure NeoChat...") shortcut: StandardKey.Preferences - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { + onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), { connection: root.connection }, { title: i18n("Configure"), @@ -49,7 +49,7 @@ Labs.MenuBar { Labs.MenuItem { text: i18nc("menu", "Find your friends") enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0 - onTriggered: pushReplaceLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + onTriggered: pushReplaceLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Find your friends") @@ -67,7 +67,7 @@ Labs.MenuBar { Labs.MenuItem { text: i18nc("menu", "Browse Chats…") onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Explore Rooms") diff --git a/src/qml/Homeserver.qml b/src/qml/Homeserver.qml index e74b0baf1..dd8862f97 100644 --- a/src/qml/Homeserver.qml +++ b/src/qml/Homeserver.qml @@ -40,9 +40,9 @@ LoginStep { nextAction: Kirigami.Action { text: Registration.testing ? i18n("Loading") : null enabled: Registration.status > Registration.ServerNoRegistration - onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") + onTriggered: root.processed("Username.qml") } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml") + onTriggered: root.processed("LoginRegister.qml") } } diff --git a/src/qml/Login.qml b/src/qml/Login.qml index 0b2b972e5..5a2639685 100644 --- a/src/qml/Login.qml +++ b/src/qml/Login.qml @@ -38,18 +38,18 @@ LoginStep { text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue") onTriggered: { if (LoginHelper.supportsSso && LoginHelper.supportsPassword) { - processed("qrc:/org/kde/neochat/qml/LoginMethod.qml"); + processed("LoginMethod.qml"); } else if (LoginHelper.supportsSso) { - processed("qrc:/org/kde/neochat/qml/Sso.qml"); + processed("Sso.qml"); } else { - processed("qrc:/org/kde/neochat/qml/Password.qml"); + processed("Password.qml"); } } enabled: LoginHelper.homeserverReachable } previousAction: Kirigami.Action { onTriggered: { - root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml"); + root.processed("LoginRegister.qml"); } } } diff --git a/src/qml/LoginMethod.qml b/src/qml/LoginMethod.qml index b85775566..934e13cd9 100644 --- a/src/qml/LoginMethod.qml +++ b/src/qml/LoginMethod.qml @@ -18,12 +18,12 @@ LoginStep { FormCard.FormButtonDelegate { id: loginPasswordButton text: i18nc("@action:button", "Login with password") - onClicked: processed("qrc:/org/kde/neochat/qml/Password.qml") + onClicked: processed("Password.qml") } FormCard.FormButtonDelegate { id: loginSsoButton text: i18nc("@action:button", "Login with single sign-on") - onClicked: processed("qrc:/org/kde/neochat/qml/Sso.qml") + onClicked: processed("Sso.qml") } } diff --git a/src/qml/LoginRegister.qml b/src/qml/LoginRegister.qml index e8b8120e0..d780b05e4 100644 --- a/src/qml/LoginRegister.qml +++ b/src/qml/LoginRegister.qml @@ -22,13 +22,13 @@ LoginStep { FormCard.FormButtonDelegate { id: loginButton text: i18nc("@action:button", "Login") - onClicked: root.processed("qrc:/org/kde/neochat/qml/Login.qml") + onClicked: root.processed("Login.qml") } FormCard.FormDelegateSeparator {} FormCard.FormButtonDelegate { text: i18nc("@action:button", "Register") - onClicked: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml") + onClicked: root.processed("Homeserver.qml") } } diff --git a/src/qml/LoginStep.qml b/src/qml/LoginStep.qml index 24f3c220a..cc0dc71dc 100644 --- a/src/qml/LoginStep.qml +++ b/src/qml/LoginStep.qml @@ -21,7 +21,7 @@ ColumnLayout { property QQC2.Action previousAction: null /// Called when switching to the next step. - signal processed(url nextUrl) + signal processed(string nextComponent) /// Show a message in a banner at the top of the page. signal showMessage(string message) diff --git a/src/qml/MessageDelegateContextMenu.qml b/src/qml/MessageDelegateContextMenu.qml index 4665eb1e6..0e1009114 100644 --- a/src/qml/MessageDelegateContextMenu.qml +++ b/src/qml/MessageDelegateContextMenu.qml @@ -48,7 +48,7 @@ DelegateContextMenu { text: i18nc("@action:inmenu As in 'Forward this message'", "Forward") icon.name: "mail-forward-symbolic" onTriggered: { - let page = applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ChooseRoomDialog.qml", { + let page = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog.qml'), { connection: root.connection }, { title: i18nc("@title", "Forward Message"), diff --git a/src/qml/Password.qml b/src/qml/Password.qml index feb34c373..003e201d0 100644 --- a/src/qml/Password.qml +++ b/src/qml/Password.qml @@ -15,7 +15,7 @@ LoginStep { Connections { target: LoginHelper function onConnected() { - processed("qrc:/org/kde/neochat/qml/Loading.qml"); + processed("Loading.qml"); } } @@ -46,6 +46,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: processed("qrc:/org/kde/neochat/qml/Login.qml") + onTriggered: processed("Login.qml") } } diff --git a/src/qml/RegisterPassword.qml b/src/qml/RegisterPassword.qml index 771e62ad5..d768db81b 100644 --- a/src/qml/RegisterPassword.qml +++ b/src/qml/RegisterPassword.qml @@ -47,6 +47,6 @@ LoginStep { } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") + onTriggered: root.processed("Username.qml") } } diff --git a/src/qml/RoomData.qml b/src/qml/RoomData.qml index 10fe4b88e..d5a637dd3 100644 --- a/src/qml/RoomData.qml +++ b/src/qml/RoomData.qml @@ -63,7 +63,7 @@ ColumnLayout { model: root.room.accountDataEventTypes delegate: FormCard.FormButtonDelegate { text: modelData - onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/MessageSourceSheet.qml", { + onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet.qml'), { "sourceText": root.room.roomAcountDataJson(text) }, { "title": i18n("Event Source"), @@ -89,7 +89,7 @@ ColumnLayout { delegate: FormCard.FormButtonDelegate { text: model.type description: model.stateKey - onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/MessageSourceSheet.qml', { + onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet.qml'), { sourceText: stateModel.stateEventJson(stateEventFilterModel.mapToSource(stateEventFilterModel.index(model.index, 0))) }, { title: i18n("Event Source"), diff --git a/src/qml/RoomDelegate.qml b/src/qml/RoomDelegate.qml index 01a513183..1ddf0d1fe 100644 --- a/src/qml/RoomDelegate.qml +++ b/src/qml/RoomDelegate.qml @@ -141,7 +141,7 @@ Delegates.RoundedItemDelegate { } function createRoomListContextMenu() { - const component = Qt.createComponent("qrc:/org/kde/neochat/qml/ContextMenu.qml"); + const component = Qt.createComponent(Qt.createComponent('org.kde.neochat', 'ContextMenu.qml')); if (component.status === Component.Error) { console.error(component.errorString()); } diff --git a/src/qml/RoomDrawer.qml b/src/qml/RoomDrawer.qml index e3a507996..44c13b738 100644 --- a/src/qml/RoomDrawer.qml +++ b/src/qml/RoomDrawer.qml @@ -102,7 +102,7 @@ Kirigami.OverlayDrawer { text: i18n("Room settings") display: QQC2.AbstractButton.IconOnly - onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), { room: room, connection: root.connection }, { diff --git a/src/qml/RoomDrawerPage.qml b/src/qml/RoomDrawerPage.qml index 3b50e066c..77b85bb2b 100644 --- a/src/qml/RoomDrawerPage.qml +++ b/src/qml/RoomDrawerPage.qml @@ -44,7 +44,7 @@ Kirigami.Page { displayHint: Kirigami.DisplayHint.IconOnly text: i18n("Settings") icon.name: "settings-configure" - onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + onTriggered: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), { room: root.room, connection: root.connection }, { diff --git a/src/qml/RoomInformation.qml b/src/qml/RoomInformation.qml index 4b75c0822..119452649 100644 --- a/src/qml/RoomInformation.qml +++ b/src/qml/RoomInformation.qml @@ -82,7 +82,7 @@ QQC2.ScrollView { Layout.fillWidth: true onClicked: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/DevtoolsPage.qml", { + applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'DevtoolsPage.qml'), { room: root.room, connection: root.connection }, { @@ -100,7 +100,7 @@ QQC2.ScrollView { Layout.fillWidth: true onClicked: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RoomSearchPage.qml", { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'RoomSearchPage.qml'), { room: root.room }, { title: i18nc("@action:title", "Search") @@ -125,7 +125,7 @@ QQC2.ScrollView { icon.name: "map-flat" text: i18n("Show locations for this room") - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/LocationsPage.qml", { + onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'LocationsPage.qml'), { room: root.room }, { title: i18nc("Locations on a map", "Locations") @@ -147,7 +147,7 @@ QQC2.ScrollView { icon.name: "list-add-user" onClicked: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", { + applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'InviteUserPage.qml'), { room: root.room }, { title: i18nc("@title", "Invite a User") diff --git a/src/qml/RoomListPage.qml b/src/qml/RoomListPage.qml index 66e78d6b3..686350bf1 100644 --- a/src/qml/RoomListPage.qml +++ b/src/qml/RoomListPage.qml @@ -207,7 +207,7 @@ Kirigami.Page { icon.width: Kirigami.Units.gridUnit * 2 icon.height: Kirigami.Units.gridUnit * 2 - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Find your friends") @@ -236,7 +236,7 @@ Kirigami.Page { icon.name: sortFilterRoomTreeModel.filterText.length > 0 ? "search" : "list-add" text: sortFilterRoomTreeModel.filterText.length > 0 ? i18n("Search in room directory") : i18n("Explore rooms") onTriggered: { - let dialog = pageStack.layers.push("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.connection, keyword: sortFilterRoomTreeModel.filterText }, { @@ -252,7 +252,7 @@ Kirigami.Page { id: userSearchAction icon.name: sortFilterRoomTreeModel.filterText.length > 0 ? "search" : "list-add" text: sortFilterRoomTreeModel.filterText.length > 0 ? i18n("Search in friend directory") : i18n("Find your friends") - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage.qml'), { connection: root.connection }, { title: i18nc("@title", "Find your friends") diff --git a/src/qml/RoomPage.qml b/src/qml/RoomPage.qml index 83af98df0..5093a0bcf 100644 --- a/src/qml/RoomPage.qml +++ b/src/qml/RoomPage.qml @@ -243,7 +243,7 @@ Kirigami.Page { } function onShowEventSource(eventId) { - applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/MessageSourceSheet.qml', { + applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet.qml'), { sourceText: root.currentRoom.getEventJsonSource(eventId) }, { title: i18n("Message Source"), diff --git a/src/qml/SelectParentDialog.qml b/src/qml/SelectParentDialog.qml index f2ea1566b..075b738e4 100644 --- a/src/qml/SelectParentDialog.qml +++ b/src/qml/SelectParentDialog.qml @@ -49,7 +49,7 @@ Kirigami.Dialog { visible: !chosenRoomDelegate.visible text: i18nc("@action:button", "Pick room") onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.room.connection, showOnlySpaces: true }, { @@ -133,7 +133,7 @@ Kirigami.Dialog { } onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage.qml'), { connection: root.room.connection, showOnlySpaces: true }, { diff --git a/src/qml/ShareAction.qml b/src/qml/ShareAction.qml index d62afb7b3..3c2624d44 100644 --- a/src/qml/ShareAction.qml +++ b/src/qml/ShareAction.qml @@ -60,7 +60,7 @@ Kirigami.Action { if (id != root.eventId) { return; } - applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/ShareDialog.qml', { + applicationWindow().pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "ShareDialog.qml"), { title: root.text, index: index, model: root._instantiator.model diff --git a/src/qml/SpaceDrawer.qml b/src/qml/SpaceDrawer.qml index 5e11496ec..12703f3a7 100644 --- a/src/qml/SpaceDrawer.qml +++ b/src/qml/SpaceDrawer.qml @@ -74,7 +74,7 @@ QQC2.Control { source: "notifications" } - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/NotificationsView.qml", { + onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'NotificationsView.qml'), { connection: root.connection }, { title: i18nc("@title", "Notifications") @@ -308,7 +308,7 @@ QQC2.Control { contentItem: Kirigami.Icon { source: "list-add" } - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog.qml'), { connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space") diff --git a/src/qml/SpaceHomePage.qml b/src/qml/SpaceHomePage.qml index 7cb83deda..e3299b5d1 100644 --- a/src/qml/SpaceHomePage.qml +++ b/src/qml/SpaceHomePage.qml @@ -46,7 +46,7 @@ Kirigami.Page { visible: root.currentRoom.canSendState("invite") text: i18nc("@button", "Invite user to space") icon.name: "list-add-user" - onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", { + onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'InviteUserPage.qml'), { room: root.currentRoom }, { title: i18nc("@title", "Invite a User") @@ -70,7 +70,7 @@ Kirigami.Page { text: i18nc("@button", "Space settings") icon.name: "settings-configure" display: QQC2.AbstractButton.IconOnly - onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), { room: root.currentRoom, connection: root.currentRoom.connection }, { @@ -158,7 +158,7 @@ Kirigami.Page { QtObject { id: _private function createRoom(parentId) { - let dialog = applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + let dialog = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomDialog.qml'), { title: i18nc("@title", "Create a Child"), connection: root.currentRoom.connection, parentId: parentId, diff --git a/src/qml/SpaceListContextMenu.qml b/src/qml/SpaceListContextMenu.qml index f7f535428..a23558e45 100644 --- a/src/qml/SpaceListContextMenu.qml +++ b/src/qml/SpaceListContextMenu.qml @@ -45,7 +45,7 @@ Loader { QQC2.MenuItem { text: i18nc("'Space' is a matrix space", "Space Settings") icon.name: 'settings-configure' - onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), { room: room, connection: connection }, { @@ -130,7 +130,7 @@ Loader { FormCard.FormButtonDelegate { text: i18nc("'Space' is a matrix space", "Space Settings") icon.name: 'settings-configure' - onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), { room: room, connection: connection }, { diff --git a/src/qml/Sso.qml b/src/qml/Sso.qml index 68b56ad42..5a815673e 100644 --- a/src/qml/Sso.qml +++ b/src/qml/Sso.qml @@ -22,7 +22,7 @@ LoginStep { UrlHelper.openUrl(LoginHelper.ssoUrl); } function onConnected() { - processed("qrc:/org/kde/neochat/qml/Loading.qml"); + processed("Loading.qml"); } } @@ -31,7 +31,7 @@ LoginStep { } previousAction: Kirigami.Action { - onTriggered: processed("qrc:/org/kde/neochat/qml/Login.qml") + onTriggered: processed("Login.qml") } nextAction: Kirigami.Action { diff --git a/src/qml/Terms.qml b/src/qml/Terms.qml index 488ca70b0..34516e53a 100644 --- a/src/qml/Terms.qml +++ b/src/qml/Terms.qml @@ -33,6 +33,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") + onTriggered: root.processed("Username.qml") } } diff --git a/src/qml/UserDetailDialog.qml b/src/qml/UserDetailDialog.qml index b98670abe..39ace40d9 100644 --- a/src/qml/UserDetailDialog.qml +++ b/src/qml/UserDetailDialog.qml @@ -148,7 +148,7 @@ Kirigami.Dialog { icon.name: "im-ban-user" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/BanSheet.qml", { + applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'BanSheet.qml'), { room: root.room, userId: root.user.id }, { @@ -206,7 +206,7 @@ Kirigami.Dialog { icon.name: "delete" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", { + applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'RemoveSheet.qml'), { room: root.room, userId: root.user.id }, { diff --git a/src/qml/UserInfo.qml b/src/qml/UserInfo.qml index 87026b1d2..49c026b4c 100644 --- a/src/qml/UserInfo.qml +++ b/src/qml/UserInfo.qml @@ -51,7 +51,7 @@ RowLayout { if (button == Qt.RightButton) { accountMenu.open(); } else { - pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/org/kde/neochat/qml/AccountEditorPage.qml'), { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'AccountEditorPage.qml'), { connection: root.connection }, { title: i18n("Account editor") @@ -120,7 +120,7 @@ RowLayout { } QQC2.ToolButton { icon.name: "settings-configure" - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { + onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), { connection: root.connection }, { title: i18n("Configure"), @@ -187,7 +187,7 @@ RowLayout { } onClicked: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/WelcomePage.qml", {}, { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'WelcomePage.qml'), {}, { title: i18nc("@title:window", "Login") }); if (switchUserButton.checked) { diff --git a/src/qml/Username.qml b/src/qml/Username.qml index 6904113e9..3e492c7df 100644 --- a/src/qml/Username.qml +++ b/src/qml/Username.qml @@ -37,11 +37,11 @@ LoginStep { nextAction: Kirigami.Action { text: Registration.status === Registration.TestingUsername ? i18n("Loading") : null - onTriggered: root.processed("qrc:/org/kde/neochat/qml/RegisterPassword.qml") + onTriggered: root.processed("RegisterPassword.qml") enabled: Registration.status === Registration.Ready } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml") + onTriggered: root.processed("Homeserver.qml") } } diff --git a/src/qml/WelcomePage.qml b/src/qml/WelcomePage.qml index 85a5606aa..b179031b1 100644 --- a/src/qml/WelcomePage.qml +++ b/src/qml/WelcomePage.qml @@ -15,9 +15,10 @@ FormCard.FormCardPage { id: root property bool showExisting: false - property bool _showExisting: showExisting && module.source == root.initialStep + property bool _showExisting: showExisting && root.currentStepString === root.initialStep property alias currentStep: module.item - property string initialStep: "qrc:/org/kde/neochat/qml/LoginRegister.qml" + property string currentStepString: initialStep + property string initialStep: "LoginRegister.qml" signal connectionChosen @@ -127,14 +128,15 @@ FormCard.FormCardPage { Loader { id: module Layout.fillWidth: true - source: root.initialStep + sourceComponent: Qt.createComponent('org.kde.neochat', root.initialStep) Connections { id: stepConnections target: currentStep - function onProcessed(nextUrl: string): void { - module.source = nextUrl; + function onProcessed(nextStep: string): void { + module.source = nextStep; + root.currentStepString = nextStep; headerMessage.text = ""; headerMessage.visible = false; if (!module.item.noControls) { @@ -164,16 +166,16 @@ FormCard.FormCardPage { target: Registration function onNextStepChanged() { if (Registration.nextStep === "m.login.recaptcha") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Captcha.qml"); + stepConnections.onProcessed("Captcha.qml"); } if (Registration.nextStep === "m.login.terms") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Terms.qml"); + stepConnections.onProcessed("Terms.qml"); } if (Registration.nextStep === "m.login.email.identity") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Email.qml"); + stepConnections.onProcessed("Email.qml"); } if (Registration.nextStep === "loading") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Loading.qml"); + stepConnections.onProcessed("Loading.qml"); } } } diff --git a/src/qml/main.qml b/src/qml/main.qml index b68af2276..c94eae508 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -123,7 +123,7 @@ Kirigami.ApplicationWindow { target: RoomManager function onPushRoom(room, event) { - root.roomPage = pageStack.push("qrc:/org/kde/neochat/qml/RoomPage.qml", { + root.roomPage = pageStack.push(Qt.createComponent('org.kde.neochat', 'RoomPage.qml'), { connection: root.connection }); root.roomPage.forceActiveFocus(); @@ -133,7 +133,7 @@ Kirigami.ApplicationWindow { } function onPushSpaceHome(room) { - root.spaceHomePage = pageStack.push("qrc:/org/kde/neochat/qml/SpaceHomePage.qml"); + root.spaceHomePage = pageStack.push(Qt.createComponent('org.kde.neochat', 'SpaceHomePage.qml')); root.spaceHomePage.forceActiveFocus(); } @@ -142,7 +142,7 @@ Kirigami.ApplicationWindow { pageStack.currentIndex = pageStack.depth - 1; } else { pageStack.pop(); - root.roomPage = pageStack.push("qrc:/org/kde/neochat/qml/RoomPage.qml", { + root.roomPage = pageStack.push(Qt.createComponent('org.kde.neochat', 'RoomPage.qml'), { connection: root.connection }); root.spaceHomePage = null; @@ -158,7 +158,7 @@ Kirigami.ApplicationWindow { pageStack.currentIndex = pageStack.depth - 1; } else { pageStack.pop(); - root.spaceHomePage = pageStack.push("qrc:/org/kde/neochat/qml/SpaceHomePage.qml"); + root.spaceHomePage = pageStack.push(Qt.createComponent('org.kde.neochat', 'SpaceHomePage.qml')); root.roomPage = null; } root.spaceHomePage.forceActiveFocus(); @@ -196,7 +196,7 @@ Kirigami.ApplicationWindow { } function openRoomDrawer() { - pageStack.push("qrc:/org/kde/neochat/qml/RoomDrawerPage.qml", { + pageStack.push(Qt.createComponent('org.kde.neochat', 'RoomDrawerPage.qml'), { connection: root.connection }); } @@ -305,7 +305,7 @@ Kirigami.ApplicationWindow { RoomManager.reset(); pageStack.clear(); roomListLoaded = false; - pageStack.push("qrc:/org/kde/neochat/qml/WelcomePage.qml"); + pageStack.push(Qt.createComponent('org.kde.neochat', '.qml')); } } } @@ -439,7 +439,7 @@ Kirigami.ApplicationWindow { Shortcut { sequence: "Ctrl+Shift+," onActivated: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { + pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), { connection: root.connection }, { title: i18n("Configure"),