Changeset View
Changeset View
Standalone View
Standalone View
kcms/access/package/contents/ui/main.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2018 Tomaz Canabrava <tcanabrava@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2 of | ||||
7 | * the License or (at your option) version 3 or any later version | ||||
8 | * accepted by the membership of KDE e.V. (or its successor approved | ||||
9 | * by the membership of KDE e.V.), which shall act as a proxy | ||||
10 | * defined in Section 14 of version 3 of the license. | ||||
11 | * | ||||
12 | * This program is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | * GNU General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU General Public License | ||||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | import QtQuick 2.9 | ||||
22 | import QtQuick.Layouts 1.12 | ||||
23 | import QtQuick.Window 2.2 | ||||
24 | import QtQuick.Dialogs 1.0 as QtDialogs | ||||
25 | import QtQuick.Controls 2.12 as QQC2 | ||||
26 | import org.kde.kirigami 2.4 as Kirigami | ||||
27 | import org.kde.kcm 1.1 as KCM | ||||
28 | | ||||
29 | KCM.SimpleKCM { | ||||
30 | id: root | ||||
31 | | ||||
32 | property var elements: [ | ||||
33 | { | ||||
34 | icon: "preferences-desktop-notification-bell", | ||||
35 | title: i18nc("System Bell Configuration", "Bell") | ||||
36 | }, | ||||
37 | { | ||||
38 | icon: "input-keyboard", | ||||
ngraham: should be more descriptive, like `sidebarScrollView` or something | |||||
39 | title: i18nc("System Modifier Keys Configuration", "Modifier Keys") | ||||
40 | }, | ||||
41 | { | ||||
42 | icon: "preferences-desktop-keyboard", | ||||
43 | title: i18nc("System keyboard filters configuration", "Keyboard Filters") | ||||
Needs keyboard navigation. See https://cgit.kde.org/plasma-desktop.git/commit/?id=659fe0a76f19b60021733c4a74e451d4318a8359 for details regarding how. ngraham: Needs keyboard navigation. See https://cgit.kde.org/plasma-desktop.git/commit/? | |||||
more than that, the correct way of doing keyboard navigation in ListView is setting in the ListView instance activeFocusOnTab: true (and leaving keyNavigationWraps to false) mart: more than that, the correct way of doing keyboard navigation in ListView is setting in the… | |||||
44 | }, | ||||
45 | { | ||||
46 | icon: "input-mouse", | ||||
47 | title: i18nc("System mouse navigation configuration", "Mouse Navigation") | ||||
48 | }, | ||||
49 | { | ||||
50 | icon: "audio-input-microphone", | ||||
51 | title: i18nc("System mouse navigation configuration", "Screen Reader") | ||||
needs to force focus to the scrollview when clicked: onClicked: listView.forceActiveFocus(); ngraham: needs to force focus to the scrollview when clicked: `onClicked: listView.forceActiveFocus();` | |||||
52 | } | ||||
53 | ] | ||||
54 | | ||||
ngraham: title should already be translated; no need to put this in an `i18n()` call | |||||
tcanabrava: this was a ListElement Q_NOOP_TR issue | |||||
55 | RowLayout { | ||||
56 | anchors.margins: Kirigami.Units.largeSpacing | ||||
This also needs a height set so that it fills the full height available in the KCM. probably anchors.fill: parent would be appropriate ngraham: This also needs a height set so that it fills the full height available in the KCM. probably… | |||||
57 | | ||||
58 | QQC2.ScrollView { | ||||
59 | id: leftSidePaneBackground | ||||
60 | | ||||
61 | // This does not work anymore. returns a null value. | ||||
62 | Component.onCompleted: leftSidePaneBackground.background.visible = true | ||||
63 | | ||||
64 | Layout.fillHeight: true | ||||
65 | Layout.preferredWidth: parent.width * 0.3 | ||||
66 | | ||||
67 | ListView { | ||||
68 | id: listView | ||||
69 | | ||||
70 | model: elements | ||||
71 | anchors.fill: parent | ||||
72 | activeFocusOnTab: true | ||||
73 | keyNavigationEnabled: true | ||||
74 | | ||||
75 | onCurrentIndexChanged: stackView.currentIndex = currentIndex | ||||
76 | | ||||
77 | delegate: Kirigami.BasicListItem { | ||||
78 | width: listView.width | ||||
ngraham: Shouldn't these be `i18n()` calls? | |||||
79 | icon: modelData.icon | ||||
80 | label: modelData.title | ||||
81 | onClicked: listView.forceActiveFocus() | ||||
82 | } | ||||
83 | } | ||||
84 | } | ||||
85 | | ||||
86 | StackLayout { | ||||
87 | id: stackView | ||||
88 | | ||||
89 | Layout.fillHeight: true | ||||
90 | Layout.fillWidth: true | ||||
91 | | ||||
92 | Bell {} | ||||
93 | ModifierKeys {} | ||||
94 | KeyboardFilters {} | ||||
95 | MouseNavigation {} | ||||
96 | ScreenReader {} | ||||
97 | } | ||||
98 | } | ||||
99 | } |
should be more descriptive, like sidebarScrollView or something