Rework config dialog

Use new KirigamiAddons ConfigurationsView as a replacement for
CategorizedSettings. Fix some issues on desktop when running Qt 6.8
and some less recent issues on mobile.

Visually this looks the same.
This commit is contained in:
Carl Schwan
2024-05-31 12:33:00 +02:00
parent 1460132772
commit a15a11f44b
17 changed files with 271 additions and 302 deletions

View File

@@ -15,13 +15,14 @@ QQC2.Menu {
id: root id: root
required property NeoChatConnection connection required property NeoChatConnection connection
required property Kirigami.ApplicationWindow window
margins: Kirigami.Units.smallSpacing margins: Kirigami.Units.smallSpacing
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Edit this account") text: i18n("Edit this account")
icon.name: "document-edit" icon.name: "document-edit"
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), { onTriggered: root.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
connection: root.connection connection: root.connection
}, { }, {
title: i18n("Account editor") title: i18n("Account editor")
@@ -30,32 +31,22 @@ QQC2.Menu {
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Notification settings") text: i18n("Notification settings")
icon.name: "notifications" icon.name: "notifications"
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings'), { onTriggered: {
defaultPage: "notifications", NeoChatSettingsView.open('notifications');
connection: root.connection }
}, {
title: i18n("Configure"),
width: Kirigami.Units.gridUnit * 50,
height: Kirigami.Units.gridUnit * 42
})
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Devices") text: i18n("Devices")
icon.name: "computer-symbolic" icon.name: "computer-symbolic"
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings'), { onTriggered: {
defaultPage: "devices", NeoChatSettingsView.open('devices');
connection: root.connection }
}, {
title: i18n("Configure"),
width: Kirigami.Units.gridUnit * 50,
height: Kirigami.Units.gridUnit * 42
})
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Open developer tools") text: i18n("Open developer tools")
icon.name: "tools" icon.name: "tools"
visible: Config.developerTools visible: Config.developerTools
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), { onTriggered: root.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), {
connection: root.connection connection: root.connection
}, { }, {
title: i18nc("@title:window", "Developer Tools"), title: i18nc("@title:window", "Developer Tools"),
@@ -67,7 +58,7 @@ QQC2.Menu {
text: i18nc("@action:inmenu", "Open Secret Backup") text: i18nc("@action:inmenu", "Open Secret Backup")
icon.name: "unlock" icon.name: "unlock"
visible: Config.secretBackup visible: Config.secretBackup
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UnlockSSSSDialog'), {}, { onTriggered: root.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UnlockSSSSDialog'), {}, {
title: i18nc("@title:window", "Open Key Backup") title: i18nc("@title:window", "Open Key Backup")
}) })
} }
@@ -80,7 +71,7 @@ QQC2.Menu {
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Logout") text: i18n("Logout")
icon.name: "list-remove-user" icon.name: "list-remove-user"
onTriggered: confirmLogoutDialogComponent.createObject(applicationWindow().overlay).open() onTriggered: confirmLogoutDialogComponent.createObject(root.window.overlay).open()
} }
Component { Component {

View File

@@ -108,14 +108,11 @@ Loader {
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Room Settings") text: i18nc("@action:inmenu", "Room Settings")
icon.name: "configure" icon.name: 'settings-configure-symbolic'
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings'), { onTriggered: {
room: room, RoomSettingsView.openRoomSettings(root.room, RoomSettingsView.Room);
connection: connection }
}, {
title: i18n("Room Settings")
})
} }
QQC2.MenuSeparator {} QQC2.MenuSeparator {}
@@ -187,14 +184,10 @@ Loader {
} }
QQC2.ToolButton { QQC2.ToolButton {
icon.name: 'settings-configure' text: i18nc("@action:button", "Room Settings")
icon.name: 'settings-configure-symbolic'
onClicked: { onClicked: {
QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings'), { RoomSettingsView.openRoomSettings(root.room, RoomSettingsView.Room);
room: room,
connection: root.connection
}, {
title: i18n("Room Settings")
});
drawer.close(); drawer.close();
} }
} }

View File

@@ -25,13 +25,7 @@ Labs.MenuBar {
text: i18nc("menu", "Configure NeoChat...") text: i18nc("menu", "Configure NeoChat...")
shortcut: StandardKey.Preferences shortcut: StandardKey.Preferences
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings'), { onTriggered: NeoChatSettingsView.open()
connection: root.connection
}, {
title: i18n("Configure"),
width: Kirigami.Units.gridUnit * 50,
height: Kirigami.Units.gridUnit * 42
})
} }
Labs.MenuItem { Labs.MenuItem {
text: i18nc("menu", "Quit NeoChat") text: i18nc("menu", "Quit NeoChat")

View File

@@ -41,6 +41,7 @@ Kirigami.ApplicationWindow {
onConnectionChanged: { onConnectionChanged: {
CustomEmojiModel.connection = root.connection; CustomEmojiModel.connection = root.connection;
SpaceHierarchyCache.connection = root.connection; SpaceHierarchyCache.connection = root.connection;
NeoChatSettingsView.connection = root.connection;
if (ShareHandler.text && root.connection) { if (ShareHandler.text && root.connection) {
root.handleShare(); root.handleShare();
} }
@@ -190,6 +191,9 @@ Kirigami.ApplicationWindow {
Component.onCompleted: { Component.onCompleted: {
CustomEmojiModel.connection = root.connection; CustomEmojiModel.connection = root.connection;
SpaceHierarchyCache.connection = root.connection; SpaceHierarchyCache.connection = root.connection;
RoomSettingsView.window = root;
NeoChatSettingsView.window = root;
NeoChatSettingsView.connection = root.connection;
WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout); WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout);
if (ShareHandler.text && root.connection) { if (ShareHandler.text && root.connection) {
root.handleShare() root.handleShare()
@@ -321,15 +325,10 @@ Kirigami.ApplicationWindow {
Shortcut { Shortcut {
sequence: "Ctrl+Shift+," sequence: "Ctrl+Shift+,"
onActivated: { onActivated: {
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings'), { NeoChatSettingsView.open();
connection: root.connection
}, {
title: i18n("Configure"),
width: Kirigami.Units.gridUnit * 50,
height: Kirigami.Units.gridUnit * 42
});
} }
} }
Connections { Connections {
target: ShareHandler target: ShareHandler
function onTextChanged(): void { function onTextChanged(): void {

View File

@@ -100,20 +100,17 @@ Kirigami.OverlayDrawer {
QQC2.ToolButton { QQC2.ToolButton {
id: settingsButton id: settingsButton
icon.name: "settings-configure"
text: i18n("Room settings")
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
text: i18nc("@action:button", "Room settings")
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings'), { icon.name: 'settings-configure-symbolic'
room: room,
connection: root.connection
}, {
title: i18n("Room Settings")
})
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
onClicked: {
RoomSettingsView.openRoomSettings(root.room, RoomSettingsView.Room);
}
} }
} }
} }

View File

@@ -300,7 +300,7 @@ QQC2.Control {
} }
} }
function createContextMenu(room) { function createContextMenu(room: NeoChatRoom): void {
let context = spaceListContextMenu.createObject(root, { let context = spaceListContextMenu.createObject(root, {
room: room, room: room,
connection: root.connection connection: root.connection
@@ -309,6 +309,8 @@ QQC2.Control {
} }
Component { Component {
id: spaceListContextMenu id: spaceListContextMenu
SpaceListContextMenu {} SpaceListContextMenu {
window: root.QQC2.ApplicationWindow.window
}
} }
} }

View File

@@ -70,15 +70,15 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
} }
QQC2.Button { QQC2.Button {
text: i18nc("@button", "Space settings") id: settingsButton
icon.name: "settings-configure"
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings'), { text: i18nc("'Space' is a matrix space", "Space Settings")
room: root.currentRoom, onClicked: {
connection: root.currentRoom.connection RoomSettingsView.openRoomSettings(root.currentRoom, RoomSettingsView.Space);
}, { drawer.close();
title: i18n("Room Settings") }
}) icon.name: 'settings-configure-symbolic'
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay

View File

@@ -21,6 +21,7 @@ Loader {
property NeoChatRoom room property NeoChatRoom room
required property NeoChatConnection connection required property NeoChatConnection connection
required property Kirigami.ApplicationWindow window
signal closed signal closed
@@ -45,13 +46,10 @@ Loader {
QQC2.MenuItem { QQC2.MenuItem {
text: i18nc("'Space' is a matrix space", "Space Settings") text: i18nc("'Space' is a matrix space", "Space Settings")
icon.name: 'settings-configure' icon.name: 'settings-configure-symbolic'
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings'), { onTriggered: {
room: room, RoomSettingsView.openRoomSettings(root.room, RoomSettingsView.Space);
connection: connection }
}, {
title: i18n("Space Settings")
})
} }
QQC2.MenuSeparator {} QQC2.MenuSeparator {}
@@ -130,13 +128,11 @@ Loader {
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: i18nc("'Space' is a matrix space", "Space Settings") text: i18nc("'Space' is a matrix space", "Space Settings")
icon.name: 'settings-configure' icon.name: 'settings-configure-symbolic'
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings'), { onClicked: {
room: room, RoomSettingsView.openRoomSettings(root.room, RoomSettingsView.Space);
connection: connection drawer.close();
}, { }
title: i18n("Space Settings")
})
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {

View File

@@ -48,21 +48,16 @@ RowLayout {
activeFocusOnTab: true activeFocusOnTab: true
onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings'), { onClicked: {
defaultPage: "accounts", NeoChatSettingsView.open("accounts")
connection: root.connection, }
initialAccount: root.connection
}, {
title: i18nc("@action:button", "Configure"),
width: Kirigami.Units.gridUnit * 50,
height: Kirigami.Units.gridUnit * 42
})
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: accountMenu.open() onTapped: accountMenu.open()
} }
} }
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: Math.round(root.width * 0.55) Layout.maximumWidth: Math.round(root.width * 0.55)
@@ -99,15 +94,13 @@ RowLayout {
}).open(); }).open();
}, },
Kirigami.Action { Kirigami.Action {
id: openSettingsAction
text: i18n("Open Settings") text: i18n("Open Settings")
icon.name: "settings-configure" icon.name: "settings-configure-symbolic"
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings'), { onTriggered: {
connection: root.connection NeoChatSettingsView.open();
}, { }
title: i18n("Configure"),
width: Kirigami.Units.gridUnit * 50,
height: Kirigami.Units.gridUnit * 42
})
} }
] ]

View File

@@ -1,9 +0,0 @@
// SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org>
// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
// SPDX-License-Identifier: LGPL-2.0-or-later
import org.kde.kirigamiaddons.formcard as FormCard
FormCard.AboutPage {
title: i18nc("@title:window", "About NeoChat")
}

View File

@@ -1,8 +0,0 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
import org.kde.kirigamiaddons.formcard as FormCard
FormCard.AboutKDE {
title: i18nc("@title:window", "About KDE")
}

View File

@@ -28,7 +28,7 @@ FormCard.FormCardPage {
id: intialAccountTimer id: intialAccountTimer
interval: 10 interval: 10
running: false running: false
onTriggered: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), { onTriggered: root.QQC2.ApplicationWindow.window.pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
connection: initialAccount connection: initialAccount
}, { }, {
title: i18n("Account editor") title: i18n("Account editor")
@@ -45,7 +45,7 @@ FormCard.FormCardPage {
id: accountDelegate id: accountDelegate
required property NeoChatConnection connection required property NeoChatConnection connection
Layout.fillWidth: true Layout.fillWidth: true
onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), { onClicked: root.QQC2.ApplicationWindow.window.pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
connection: accountDelegate.connection connection: accountDelegate.connection
}, { }, {
title: i18n("Account editor") title: i18n("Account editor")
@@ -87,7 +87,7 @@ FormCard.FormCardPage {
QQC2.ToolButton { QQC2.ToolButton {
text: i18n("Logout") text: i18n("Logout")
icon.name: "im-kick-user" icon.name: "im-kick-user"
onClicked: confirmLogoutDialogComponent.createObject(applicationWindow().overlay).open() onClicked: confirmLogoutDialogComponent.createObject(root.QQC2.Overlay.overlay).open()
} }
Component { Component {
@@ -117,7 +117,7 @@ FormCard.FormCardPage {
id: addAccountDelegate id: addAccountDelegate
text: i18n("Add Account") text: i18n("Add Account")
icon.name: "list-add" icon.name: "list-add"
onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat.login', 'WelcomePage')) onClicked: root.QQC2.ApplicationWindow.window.pageStack.layers.push(Qt.createComponent('org.kde.neochat.login', 'WelcomePage'))
} }
} }

View File

@@ -2,14 +2,20 @@
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
qt_add_library(settings STATIC) qt_add_library(settings STATIC)
set_source_files_properties(
RoomSettingsView.qml
NeoChatSettingsView.qml
PROPERTIES
QT_QML_SINGLETON_TYPE TRUE
)
qt_add_qml_module(settings qt_add_qml_module(settings
URI org.kde.neochat.settings URI org.kde.neochat.settings
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat/settings OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat/settings
QML_FILES QML_FILES
NeoChatSettings.qml NeoChatSettingsView.qml
RoomSettings.qml RoomSettingsView.qml
About.qml
AboutKDE.qml
AccountsPage.qml AccountsPage.qml
AccountEditorPage.qml AccountEditorPage.qml
AppearanceSettingsPage.qml AppearanceSettingsPage.qml

View File

@@ -1,113 +0,0 @@
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.settings as KirigamiSettings
import QtQuick.Layouts
import org.kde.neochat
KirigamiSettings.CategorizedSettings {
id: root
property NeoChatConnection connection
property NeoChatConnection initialAccount
objectName: "settingsPage"
actions: [
KirigamiSettings.SettingAction {
actionName: "general"
text: i18n("General")
icon.name: "org.kde.neochat"
page: Qt.resolvedUrl("NeoChatGeneralPage.qml")
},
KirigamiSettings.SettingAction {
actionName: "appearance"
text: i18n("Appearance")
icon.name: "preferences-desktop-theme-global"
page: Qt.resolvedUrl("AppearanceSettingsPage.qml")
},
KirigamiSettings.SettingAction {
actionName: "notifications"
text: i18n("Notifications")
icon.name: "preferences-desktop-notification"
page: Qt.resolvedUrl("GlobalNotificationsPage.qml")
initialProperties: {
return {
connection: root.connection
};
}
},
KirigamiSettings.SettingAction {
actionName: "security"
text: i18n("Security")
icon.name: "preferences-security"
page: Qt.resolvedUrl("NeoChatSecurityPage.qml")
initialProperties: {
return {
connection: root.connection
};
}
},
KirigamiSettings.SettingAction {
actionName: "accounts"
text: i18n("Accounts")
icon.name: "preferences-system-users"
page: Qt.resolvedUrl("AccountsPage.qml")
initialProperties: {
return {
initialAccount: root.initialAccount
};
}
},
KirigamiSettings.SettingAction {
actionName: "emoticons"
text: i18n("Stickers & Emojis")
icon.name: "preferences-desktop-emoticons"
page: Qt.resolvedUrl("EmoticonsPage.qml")
initialProperties: {
return {
connection: root.connection
};
}
},
KirigamiSettings.SettingAction {
actionName: "spellChecking"
text: i18n("Spell Checking")
icon.name: "tools-check-spelling"
page: Qt.resolvedUrl("SonnetConfigPage.qml")
visible: Qt.platform.os !== "android"
},
KirigamiSettings.SettingAction {
actionName: "networkProxy"
text: i18n("Network Proxy")
icon.name: "network-connect"
page: Qt.resolvedUrl("NetworkProxyPage.qml")
},
KirigamiSettings.SettingAction {
actionName: "devices"
text: i18n("Devices")
icon.name: "computer"
page: Qt.resolvedUrl("DevicesPage.qml")
initialProperties: {
return {
connection: root.connection
};
}
},
KirigamiSettings.SettingAction {
actionName: "aboutNeochat"
text: i18n("About NeoChat")
icon.name: "help-about"
page: Qt.resolvedUrl("About.qml")
},
KirigamiSettings.SettingAction {
actionName: "aboutKDE"
text: i18n("About KDE")
icon.name: "kde"
page: Qt.resolvedUrl("AboutKDE.qml")
}
]
}

View File

@@ -0,0 +1,110 @@
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
pragma Singleton
import QtQuick
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.settings as KirigamiSettings
import QtQuick.Layouts
import org.kde.neochat
KirigamiSettings.ConfigurationView {
id: root
property NeoChatConnection connection
objectName: "settingsPage"
modules: [
KirigamiSettings.ConfigurationModule {
moduleId: "general"
text: i18n("General")
icon.name: "org.kde.neochat"
page: () => Qt.createComponent("org.kde.neochat.settings", "NeoChatGeneralPage")
},
KirigamiSettings.ConfigurationModule {
moduleId: "appearance"
text: i18n("Appearance")
icon.name: "preferences-desktop-theme-global"
page: () => Qt.createComponent("org.kde.neochat.settings", "AppearanceSettingsPage")
},
KirigamiSettings.ConfigurationModule {
moduleId: "notifications"
text: i18n("Notifications")
icon.name: "preferences-desktop-notification"
page: () => Qt.createComponent("org.kde.neochat.settings", "GlobalNotificationsPage")
initialProperties: () => {
return {
connection: root.connection
};
}
},
KirigamiSettings.ConfigurationModule {
moduleId: "security"
text: i18n("Security")
icon.name: "preferences-security"
page: () => Qt.createComponent("org.kde.neochat.settings", "NeoChatSecurityPage")
initialProperties: () => {
return {
connection: root.connection
};
}
},
KirigamiSettings.ConfigurationModule {
moduleId: "accounts"
text: i18n("Accounts")
icon.name: "preferences-system-users"
page: () => Qt.createComponent("org.kde.neochat.settings", "AccountsPage")
},
KirigamiSettings.ConfigurationModule {
moduleId: "emoticons"
text: i18n("Stickers & Emojis")
icon.name: "preferences-desktop-emoticons"
page: () => Qt.createComponent("org.kde.neochat.settings", "EmoticonsPage")
initialProperties: () => {
return {
connection: root.connection
};
}
},
KirigamiSettings.ConfigurationModule {
moduleId: "spellChecking"
text: i18n("Spell Checking")
icon.name: "tools-check-spelling"
page: () => Qt.createComponent("org.kde.neochat.settings", "SonnetConfigPage")
visible: Qt.platform.os !== "android"
},
KirigamiSettings.ConfigurationModule {
moduleId: "networkProxy"
text: i18n("Network Proxy")
icon.name: "network-connect"
page: () => Qt.createComponent("org.kde.neochat.settings", "NetworkProxyPage")
},
KirigamiSettings.ConfigurationModule {
moduleId: "devices"
text: i18n("Devices")
icon.name: "computer"
page: () => Qt.createComponent("org.kde.neochat.settings", "DevicesPage")
initialProperties: () => {
return {
connection: root.connection
};
}
},
KirigamiSettings.ConfigurationModule {
moduleId: "aboutNeochat"
text: i18n("About NeoChat")
icon.name: "help-about"
page: () => Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutPage")
category: i18nc("@title:group", "About")
},
KirigamiSettings.ConfigurationModule {
moduleId: "aboutKDE"
text: i18n("About KDE")
icon.name: "kde"
page: () => Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutKDE")
category: i18nc("@title:group", "About")
}
]
}

View File

@@ -1,65 +0,0 @@
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.settings as KirigamiSettings
import QtQuick.Layouts
import org.kde.neochat
KirigamiSettings.CategorizedSettings {
id: root
property NeoChatRoom room
required property NeoChatConnection connection
objectName: "settingsPage"
actions: [
KirigamiSettings.SettingAction {
actionName: "general"
text: i18n("General")
icon.name: "settings-configure"
page: Qt.resolvedUrl("RoomGeneralPage.qml")
initialProperties: {
return {
room: root.room,
connection: root.connection
};
}
},
KirigamiSettings.SettingAction {
actionName: "security"
text: i18n("Security")
icon.name: "security-low"
page: Qt.resolvedUrl("RoomSecurityPage.qml")
initialProperties: {
return {
room: root.room
};
}
},
KirigamiSettings.SettingAction {
actionName: "permissions"
text: i18n("Permissions")
icon.name: "visibility"
page: Qt.resolvedUrl("Permissions.qml")
initialProperties: {
return {
room: root.room
};
}
},
KirigamiSettings.SettingAction {
actionName: "notifications"
text: i18n("Notifications")
icon.name: "notifications"
page: Qt.resolvedUrl("PushNotification.qml")
initialProperties: {
return {
room: root.room
};
}
}
]
}

View File

@@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
pragma Singleton
import QtQuick
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.settings as KirigamiSettings
import QtQuick.Layouts
import org.kde.neochat
KirigamiSettings.ConfigurationView {
id: root
enum Type {
Room,
Space
}
property NeoChatRoom _room
property NeoChatConnection _connection
function openRoomSettings(room: NeoChatRoom, type: int): void {
root._room = room;
root._connection = room.connection;
if (type === RoomSettingsView.Type.Space) {
root.title = i18nc("@title:window", "Space Settings");
} else {
root.title = i18nc("@title:window", "Room Settings");
}
open();
}
objectName: "settingsPage"
modules: [
KirigamiSettings.ConfigurationModule {
moduleId: "general"
text: i18n("General")
icon.name: "settings-configure"
page: () => Qt.createComponent("org.kde.neochat.settings", "RoomGeneralPage")
initialProperties: () => {
return {
room: root._room,
connection: root._connection
};
}
},
KirigamiSettings.ConfigurationModule {
moduleId: "security"
text: i18n("Security")
icon.name: "security-low"
page: () => Qt.createComponent("org.kde.neochat.settings", "RoomSecurityPage")
initialProperties: () => {
return {
room: root._room
};
}
},
KirigamiSettings.ConfigurationModule {
moduleId: "permissions"
text: i18n("Permissions")
icon.name: "visibility"
page: () => Qt.createComponent("org.kde.neochat.settings", "Permissions")
initialProperties: () => {
return {
room: root._room
};
}
},
KirigamiSettings.ConfigurationModule {
moduleId: "notifications"
text: i18n("Notifications")
icon.name: "notifications"
page: () => Qt.createComponent("org.kde.neochat.settings", "PushNotification")
initialProperties: () => {
return {
room: root._room
};
}
}
]
}