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 | RowLayout { | ||||
33 | anchors.fill: parent | ||||
34 | anchors.margins: Kirigami.Units.largeSpacing | ||||
35 | | ||||
36 | QQC2.ScrollView { | ||||
37 | id: bgObject | ||||
38 | Component.onCompleted: bgObject.background.visible = true | ||||
ngraham: should be more descriptive, like `sidebarScrollView` or something | |||||
39 | Layout.fillHeight: true | ||||
40 | Layout.preferredWidth: parent.width * 0.3 | ||||
41 | | ||||
42 | ListView { | ||||
43 | id: listView | ||||
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 | model: elements | ||||
45 | anchors.fill: parent | ||||
46 | onCurrentIndexChanged: stackView.currentIndex = currentIndex | ||||
47 | activeFocusOnTab: true | ||||
48 | keyNavigationEnabled: true | ||||
49 | | ||||
50 | delegate: Kirigami.BasicListItem { | ||||
51 | width: listView.width | ||||
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 | icon: model.icon | ||||
53 | label: i18n(model.title) | ||||
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 | } | ||||
56 | } | ||||
57 | | ||||
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… | |||||
58 | | ||||
59 | StackLayout { | ||||
60 | id: stackView | ||||
61 | Layout.fillHeight: true | ||||
62 | Layout.fillWidth: true | ||||
63 | | ||||
64 | Bell {} | ||||
65 | ModifierKeys {} | ||||
66 | KeyboardFilters {} | ||||
67 | MouseNavigation {} | ||||
68 | ScreenReader {} | ||||
69 | } | ||||
70 | } | ||||
71 | | ||||
72 | ListModel { | ||||
73 | id: elements | ||||
74 | ListElement { | ||||
75 | icon: "preferences-desktop-notification-bell" | ||||
76 | title: i18n("Bell") | ||||
77 | } | ||||
78 | ListElement { | ||||
ngraham: Shouldn't these be `i18n()` calls? | |||||
79 | icon: "input-keyboard" | ||||
80 | title: i18n("Modifier Keys") | ||||
81 | } | ||||
82 | ListElement { | ||||
83 | icon: "preferences-desktop-keyboard" | ||||
84 | title: i18n("Keyboard Filters") | ||||
85 | } | ||||
86 | ListElement { | ||||
87 | icon: "input-mouse" | ||||
88 | title: i18n("Mouse Navigation") | ||||
89 | } | ||||
90 | ListElement { | ||||
91 | icon: "audio-input-microphone" | ||||
92 | title: i18n("Screen Reader") | ||||
93 | } | ||||
94 | } | ||||
95 | } |
should be more descriptive, like sidebarScrollView or something