From 61f9cd41f7cfec77543708fca5f5c2727c2a770d Mon Sep 17 00:00:00 2001 From: James Graham Date: Fri, 27 Jun 2025 16:08:14 +0100 Subject: [PATCH] Initial Account Restore the functionality where clicking on "edit this account" from the AccountMenu opens setting to the account rather than pushing as its own window --- src/app/qml/AccountMenu.qml | 6 +----- src/settings/NeoChatSettingsView.qml | 11 +++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/qml/AccountMenu.qml b/src/app/qml/AccountMenu.qml index bedd1c0ed..84e7d15d4 100644 --- a/src/app/qml/AccountMenu.qml +++ b/src/app/qml/AccountMenu.qml @@ -47,11 +47,7 @@ KirigamiComponents.ConvergentContextMenu { QQC2.Action { text: i18n("Edit This Account") icon.name: "document-edit" - onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), { - connection: root.connection - }, { - title: i18n("Account editor") - }) + onTriggered: NeoChatSettingsView.openWithInitialProperties("accounts", {initialAccount: root.connection}); } QQC2.Action { diff --git a/src/settings/NeoChatSettingsView.qml b/src/settings/NeoChatSettingsView.qml index bffbe2947..645b56105 100644 --- a/src/settings/NeoChatSettingsView.qml +++ b/src/settings/NeoChatSettingsView.qml @@ -59,6 +59,7 @@ KirigamiSettings.ConfigurationView { visible: root.connection !== null }, KirigamiSettings.ConfigurationModule { + id: accountsModule moduleId: "accounts" text: i18n("Accounts") icon.name: "preferences-system-users-symbolic" @@ -111,4 +112,14 @@ KirigamiSettings.ConfigurationView { category: i18nc("@title:group", "About") } ] + + function openWithInitialProperties(defaultModule = '', initialProperties): void { + let module = modules.find(module => module.moduleId == defaultModule) ?? null; + if (module) { + module.initialProperties = () => { + return initialProperties; + } + } + root.open(defaultModule); + } }