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
=== modified file 'plugins/language/CMakeLists.txt'
--- plugins/language/CMakeLists.txt 2013-10-31 18:44:14 +0000
+++ plugins/language/CMakeLists.txt 2013-11-28 16:49:30 +0000
@@ -3,6 +3,7 @@
33
4set(QML_SOURCES4set(QML_SOURCES
5 DisplayLanguage.qml5 DisplayLanguage.qml
6 KeyboardLayoutItem.qml
6 KeyboardLayouts.qml7 KeyboardLayouts.qml
7 PageComponent.qml8 PageComponent.qml
8 SpellChecking.qml9 SpellChecking.qml
910
=== added file 'plugins/language/KeyboardLayoutItem.qml'
--- plugins/language/KeyboardLayoutItem.qml 1970-01-01 00:00:00 +0000
+++ plugins/language/KeyboardLayoutItem.qml 2013-11-28 16:49:30 +0000
@@ -0,0 +1,70 @@
1/*
2 * This file is part of system-settings
3 *
4 * Copyright (C) 2013 Canonical Ltd.
5 *
6 * Contact: William Hua <william.hua@canonical.com>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21import QtQuick 2.0
22import Ubuntu.Components 0.1
23import Ubuntu.Components.ListItems 0.1 as ListItem
24
25ListItem.Base {
26 property alias name: name.text
27 property alias checked: checkBox.checked
28 property alias shortName: shortName.text
29
30 Row {
31 anchors.top: parent.top
32 anchors.left: parent.left
33 anchors.bottom: parent.bottom
34 spacing: units.gu(1)
35
36 Rectangle {
37 width: units.gu(3.0)
38 height: units.gu(3.0)
39 radius: units.gu(0.5)
40
41 color: Theme.palette.normal.backgroundText
42
43 anchors.verticalCenter: parent.verticalCenter
44
45 Label {
46 id: shortName
47
48 color: Theme.palette.normal.background
49 fontSize: "small"
50
51 anchors.centerIn: parent
52 }
53 }
54
55 Label {
56 id: name
57
58 anchors.verticalCenter: parent.verticalCenter
59 }
60 }
61
62 CheckBox {
63 id: checkBox
64
65 anchors.right: parent.right
66 anchors.verticalCenter: parent.verticalCenter
67 }
68
69 onClicked: checked = !checked
70}
071
=== modified file 'plugins/language/KeyboardLayouts.qml'
--- plugins/language/KeyboardLayouts.qml 2013-10-31 18:44:14 +0000
+++ plugins/language/KeyboardLayouts.qml 2013-11-28 16:49:30 +0000
@@ -18,9 +18,7 @@
18 * with this program. If not, see <http://www.gnu.org/licenses/>.18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */19 */
2020
21import QtQuick 2.0
22import SystemSettings 1.021import SystemSettings 1.0
23import Ubuntu.Components 0.1
24import Ubuntu.Components.ListItems 0.1 as ListItem22import Ubuntu.Components.ListItems 0.1 as ListItem
25import Ubuntu.SystemSettings.LanguagePlugin 1.023import Ubuntu.SystemSettings.LanguagePlugin 1.0
2624
@@ -42,40 +40,20 @@
42 supersetLabel: i18n.tr("All layouts available:")40 supersetLabel: i18n.tr("All layouts available:")
4341
44 model: plugin.keyboardLayoutsModel42 model: plugin.keyboardLayoutsModel
45 delegate: ListItem.Standard {43 delegate: KeyboardLayoutItem {
44 name: model.language
45 shortName: model.icon
46 checked: model.checked
46 enabled: model.enabled47 enabled: model.enabled
4748
48 icon: Rectangle {49 onCheckedChanged: {
49 width: units.gu(3.0)50 var element = model.index < subsetView.model.subset.length ?
50 height: units.gu(3.0)51 subsetView.model.subset[model.index] :
51 radius: units.gu(0.5)52 model.index - subsetView.model.subset.length
5253
53 color: Theme.palette.normal.backgroundText54 plugin.keyboardLayoutsModel.setChecked(element, checked, checked ? 0 : subsetView.delay)
5455
55 Label {56 checked = Qt.binding(function() { return model.checked })
56 text: model.icon
57
58 color: Theme.palette.normal.background
59 fontSize: "small"
60
61 anchors.centerIn: parent
62 }
63 }
64
65 text: model.language
66
67 control: CheckBox {
68 checked: model.checked
69
70 onCheckedChanged: {
71 var element = index < subsetView.model.subset.length ?
72 subsetView.model.subset[index] :
73 index - subsetView.model.subset.length
74
75 plugin.keyboardLayoutsModel.setChecked(element, checked, checked ? 0 : subsetView.delay)
76
77 checked = Qt.binding(function() { return model.checked })
78 }
79 }57 }
80 }58 }
81 }59 }

Subscribers

People subscribed via source and target branches