Merge lp:~attente/ubuntu-system-settings/1256017 into lp:ubuntu-system-settings

Proposed by William Hua
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 507
Merged at revision: 507
Proposed branch: lp:~attente/ubuntu-system-settings/1256017
Merge into: lp:ubuntu-system-settings
Diff against target: 153 lines (+83/-34)
3 files modified
plugins/language/CMakeLists.txt (+1/-0)
plugins/language/KeyboardLayoutItem.qml (+70/-0)
plugins/language/KeyboardLayouts.qml (+12/-34)
To merge this branch: bzr merge lp:~attente/ubuntu-system-settings/1256017
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Sebastien Bacher (community) Approve
Review via email: mp+197101@code.launchpad.net

Commit message

[language] Use custom Base for keyboard layout delegate. (LP: #1256017)

Description of the change

[language] Use custom Base for keyboard layout delegate. (LP: #1256017)

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, that looks fine and works correctly with the current toolkit version!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/language/CMakeLists.txt'
2--- plugins/language/CMakeLists.txt 2013-10-31 18:44:14 +0000
3+++ plugins/language/CMakeLists.txt 2013-11-28 16:49:30 +0000
4@@ -3,6 +3,7 @@
5
6 set(QML_SOURCES
7 DisplayLanguage.qml
8+ KeyboardLayoutItem.qml
9 KeyboardLayouts.qml
10 PageComponent.qml
11 SpellChecking.qml
12
13=== added file 'plugins/language/KeyboardLayoutItem.qml'
14--- plugins/language/KeyboardLayoutItem.qml 1970-01-01 00:00:00 +0000
15+++ plugins/language/KeyboardLayoutItem.qml 2013-11-28 16:49:30 +0000
16@@ -0,0 +1,70 @@
17+/*
18+ * This file is part of system-settings
19+ *
20+ * Copyright (C) 2013 Canonical Ltd.
21+ *
22+ * Contact: William Hua <william.hua@canonical.com>
23+ *
24+ * This program is free software: you can redistribute it and/or modify it
25+ * under the terms of the GNU General Public License version 3, as published
26+ * by the Free Software Foundation.
27+ *
28+ * This program is distributed in the hope that it will be useful, but
29+ * WITHOUT ANY WARRANTY; without even the implied warranties of
30+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
31+ * PURPOSE. See the GNU General Public License for more details.
32+ *
33+ * You should have received a copy of the GNU General Public License along
34+ * with this program. If not, see <http://www.gnu.org/licenses/>.
35+ */
36+
37+import QtQuick 2.0
38+import Ubuntu.Components 0.1
39+import Ubuntu.Components.ListItems 0.1 as ListItem
40+
41+ListItem.Base {
42+ property alias name: name.text
43+ property alias checked: checkBox.checked
44+ property alias shortName: shortName.text
45+
46+ Row {
47+ anchors.top: parent.top
48+ anchors.left: parent.left
49+ anchors.bottom: parent.bottom
50+ spacing: units.gu(1)
51+
52+ Rectangle {
53+ width: units.gu(3.0)
54+ height: units.gu(3.0)
55+ radius: units.gu(0.5)
56+
57+ color: Theme.palette.normal.backgroundText
58+
59+ anchors.verticalCenter: parent.verticalCenter
60+
61+ Label {
62+ id: shortName
63+
64+ color: Theme.palette.normal.background
65+ fontSize: "small"
66+
67+ anchors.centerIn: parent
68+ }
69+ }
70+
71+ Label {
72+ id: name
73+
74+ anchors.verticalCenter: parent.verticalCenter
75+ }
76+ }
77+
78+ CheckBox {
79+ id: checkBox
80+
81+ anchors.right: parent.right
82+ anchors.verticalCenter: parent.verticalCenter
83+ }
84+
85+ onClicked: checked = !checked
86+}
87
88=== modified file 'plugins/language/KeyboardLayouts.qml'
89--- plugins/language/KeyboardLayouts.qml 2013-10-31 18:44:14 +0000
90+++ plugins/language/KeyboardLayouts.qml 2013-11-28 16:49:30 +0000
91@@ -18,9 +18,7 @@
92 * with this program. If not, see <http://www.gnu.org/licenses/>.
93 */
94
95-import QtQuick 2.0
96 import SystemSettings 1.0
97-import Ubuntu.Components 0.1
98 import Ubuntu.Components.ListItems 0.1 as ListItem
99 import Ubuntu.SystemSettings.LanguagePlugin 1.0
100
101@@ -42,40 +40,20 @@
102 supersetLabel: i18n.tr("All layouts available:")
103
104 model: plugin.keyboardLayoutsModel
105- delegate: ListItem.Standard {
106+ delegate: KeyboardLayoutItem {
107+ name: model.language
108+ shortName: model.icon
109+ checked: model.checked
110 enabled: model.enabled
111
112- icon: Rectangle {
113- width: units.gu(3.0)
114- height: units.gu(3.0)
115- radius: units.gu(0.5)
116-
117- color: Theme.palette.normal.backgroundText
118-
119- Label {
120- text: model.icon
121-
122- color: Theme.palette.normal.background
123- fontSize: "small"
124-
125- anchors.centerIn: parent
126- }
127- }
128-
129- text: model.language
130-
131- control: CheckBox {
132- checked: model.checked
133-
134- onCheckedChanged: {
135- var element = index < subsetView.model.subset.length ?
136- subsetView.model.subset[index] :
137- index - subsetView.model.subset.length
138-
139- plugin.keyboardLayoutsModel.setChecked(element, checked, checked ? 0 : subsetView.delay)
140-
141- checked = Qt.binding(function() { return model.checked })
142- }
143+ onCheckedChanged: {
144+ var element = model.index < subsetView.model.subset.length ?
145+ subsetView.model.subset[model.index] :
146+ model.index - subsetView.model.subset.length
147+
148+ plugin.keyboardLayoutsModel.setChecked(element, checked, checked ? 0 : subsetView.delay)
149+
150+ checked = Qt.binding(function() { return model.checked })
151 }
152 }
153 }

Subscribers

People subscribed via source and target branches