@@ -0,0 +1,115 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Nick Dedekind <nick.dedekind@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import "../Greeter"
23+
24+Loader {
25+ id: menuFactory
26+
27+ property QtObject menuModel: null
28+ property QtObject menuData: null
29+ property int menuIndex
30+ property var notification
31+
32+ property var _map: {
33+ "com.canonical.snapdecision.textfield": textfield,
34+ "com.canonical.snapdecision.selectionlist": selectionlist,
35+ "com.canonical.snapdecision.pinlock" : pinLock,
36+ }
37+
38+ sourceComponent: {
39+ if (menuData.type !== undefined) {
40+ var component = _map[menuData.type];
41+ if (component !== undefined) {
42+ return component;
43+ }
44+ } else {
45+ if (menuData.isSeparator) {
46+ return divMenu;
47+ }
48+ }
49+ return standardMenu;
50+ }
51+
52+ Component {
53+ id: textfield
54+
55+ Column {
56+ spacing: units.gu(.5)
57+
58+ Component.onCompleted: {
59+ menuModel.loadExtendedAttributes(menuIndex, {"x-echo-mode-password": "bool"});
60+ textfield.echoMode = menuData.ext.xEchoModePassword ? TextInput.Password : TextInput.Normal
61+ }
62+
63+ Label {
64+ anchors.left: parent.left
65+ fontSize: "medium"
66+ color: "white"
67+ text: menuData.label
68+ }
69+
70+ TextField {
71+ id: textfield
72+ onTextChanged: {
73+ menuModel.changeState(menuIndex, text);
74+ }
75+ }
76+ }
77+ }
78+
79+ Component {
80+ id: selectionlist
81+
82+ Column {
83+ spacing: units.gu(.5)
84+ anchors {
85+ left: parent.left
86+ right: parent.right
87+ }
88+
89+ Label {
90+ anchors.horizontalCenter: parent.horizontalCenter
91+ fontSize: "large"
92+ color: "white"
93+ text: "Selection List"
94+ }
95+ }
96+ }
97+
98+ Component {
99+ id: pinLock
100+ PinLockscreen {
101+ anchors {
102+ left: parent.left
103+ right: parent.right
104+ }
105+
106+ onEntered: {
107+ menuModel.changeState(menuIndex, passphrase);
108+ }
109+
110+ onCancel: {
111+ menuModel.activate(menuIndex, false);
112+ }
113+ }
114+ }
115+}