Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85647527
D354.1787756094.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D354.1787756094.diff
View Options
diff --git a/src/contents/ui/ActionSettingsPage.qml b/src/contents/ui/ActionSettingsPage.qml
--- a/src/contents/ui/ActionSettingsPage.qml
+++ b/src/contents/ui/ActionSettingsPage.qml
@@ -12,6 +12,7 @@
Kazv.ClosableScrollableOverlay {
id: page
property alias actionsToConfigure: settings.actions
+ property alias actionsGrouped: settings.actionsGrouped
title: l10n.get('action-settings-page-title')
KazvShortcuts.ActionSettings {
diff --git a/src/contents/ui/Main.qml b/src/contents/ui/Main.qml
--- a/src/contents/ui/Main.qml
+++ b/src/contents/ui/Main.qml
@@ -159,7 +159,7 @@
globalDrawer: Kirigami.GlobalDrawer {
title: l10n.get('global-drawer-title')
titleIcon: "applications-graphics"
- property var actionGroupName: 'global-drawer-actions'
+ property var actionGroupName: l10n.get('action-group-global-drawer-actions')
actions: [
Kirigami.Action {
objectName: 'switch-account'
@@ -238,9 +238,11 @@
id: contextDrawer
enabled: !!Kirigami.Settings.isMobile
actions: Kirigami.Settings.isMobile ? (pageStack.currentItem?.actions || []) : []
+ property var actionGroupName: l10n.get('action-group-context-drawer-actions')
}
property var roomPageActions: QtObject {
+ property var actionGroupName: l10n.get('action-group-room-page-actions')
property list<Kirigami.Action> actions: [
Kirigami.Action {
objectName: 'send-message'
@@ -354,6 +356,7 @@
function pushActionSettingsPage() {
pageStack.layers.push(Qt.resolvedUrl("ActionSettingsPage.qml"), {
actionsToConfigure: globalActionCollection.allActions(),
+ actionsGrouped: globalActionCollection.allActionsGrouped(),
});
}
diff --git a/src/contents/ui/shortcuts/ActionCollection.qml b/src/contents/ui/shortcuts/ActionCollection.qml
--- a/src/contents/ui/shortcuts/ActionCollection.qml
+++ b/src/contents/ui/shortcuts/ActionCollection.qml
@@ -50,6 +50,10 @@
}
function allActions() {
+ return getActionsImpl(currentCollection).map((a) => a.action);
+ }
+
+ function allActionsGrouped() {
return getActionsImpl(currentCollection);
}
@@ -60,7 +64,7 @@
for (let i = 0; i < collection.actions.length; ++i) {
const action = collection.actions[i];
if (action) {
- res.push(action);
+ res.push({ action: action, group: collection.actionGroupName });
}
}
}
diff --git a/src/contents/ui/shortcuts/ActionSettings.qml b/src/contents/ui/shortcuts/ActionSettings.qml
--- a/src/contents/ui/shortcuts/ActionSettings.qml
+++ b/src/contents/ui/shortcuts/ActionSettings.qml
@@ -6,22 +6,56 @@
import QtQuick 2.15
+import org.kde.kirigami as Kirigami
+
import '.' as KazvShortcuts
ListView {
id: actionSettings
property var actions
+ property var actionsGrouped
/// shortcutsConfig: {
/// QStringList shortcutForAction(QString actionName)
/// void setShortcutForAction(QString actionName, QStringList shortcut)
/// }
property var shortcutsConfig
- model: actions.length
+ readonly property var displayModel: {
+ const res = [];
+ let prevGroup;
+ for (const entry of actionsGrouped) {
+ if (entry.group !== prevGroup) {
+ res.push({ isHeader: true, name: entry.group });
+ prevGroup = entry.group;
+ }
+ res.push({ isHeader: false, action: entry.action });
+ }
+ return res;
+ }
+
+ model: displayModel
- delegate: KazvShortcuts.ActionItem {
+ delegate: Loader {
+ id: actionDelegate
+ required property var modelData
width: actionSettings.width
- action: actions[index]
+ sourceComponent: modelData.isHeader ? headerComponent : actionComponent
+
+ Component {
+ id: headerComponent
+ Kirigami.ListSectionHeader {
+ width: actionDelegate.width
+ text: actionDelegate.modelData.name
+ }
+ }
+
+ Component {
+ id: actionComponent
+ KazvShortcuts.ActionItem {
+ width: actionDelegate.width
+ action: actionDelegate.modelData.action
+ }
+ }
}
function shortcutToSequence(str) {
diff --git a/src/l10n/cmn-Hans/100-ui.ftl b/src/l10n/cmn-Hans/100-ui.ftl
--- a/src/l10n/cmn-Hans/100-ui.ftl
+++ b/src/l10n/cmn-Hans/100-ui.ftl
@@ -17,6 +17,10 @@
about-author-task-maintainer = 维护者
about-author-task-developer = 开发者
+action-group-global-drawer-actions = 全局操作
+action-group-context-drawer-actions = 页面操作
+action-group-room-page-actions = 房间页面操作
+
user-name-with-id = { $name } ({ $userId })
user-name-overrided = { $overridedName } ({ $globalName })
diff --git a/src/l10n/en/100-ui.ftl b/src/l10n/en/100-ui.ftl
--- a/src/l10n/en/100-ui.ftl
+++ b/src/l10n/en/100-ui.ftl
@@ -17,6 +17,10 @@
about-author-task-maintainer = Maintainer
about-author-task-developer = Developer
+action-group-global-drawer-actions = Global Actions
+action-group-context-drawer-actions = Page Actions
+action-group-room-page-actions = Room Page Actions
+
user-name-with-id = { $name } ({ $userId })
user-name-overrided = { $overridedName } ({ $globalName })
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 26, 7:54 AM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1735412
Default Alt Text
D354.1787756094.diff (5 KB)
Attached To
Mode
D354: Add section header in configure shortcuts page
Attached
Detach File
Event Timeline
Log In to Comment