on xenial help sign in
Fixed suggestions from MR-comments.
commitea9dc25d35e5acaa3a5354771fe89f0103936531 authorMirco Müller <mirco.mueller@ubuntu.com> dateMon 30 Sep 2013, 17:25 (13 years ago) parentb0fb8f2
5 files changed+52−71
Greeter/PinLockscreen.qml → Components/PinLockscreen.qml Greeter/PinPadButton.qml → Components/PinPadButton.qml Notifications/Notification.qml+20−26 Notifications/NotificationMenuItemFactory.qml+4−13 plugins/Utils/unitymenumodelpaths.cpp+28−32
Greeter/PinLockscreen.qml → Components/PinLockscreen.qmlrenamed

The content is the same.

Greeter/PinPadButton.qml → Components/PinPadButton.qmlrenamed

The content is the same.

Notifications/Notification.qml+20−26
@@ -40,16 +40,18 @@ UbuntuShape {
4040
4141 clip: true
4242
43− UnityMenuModel {
44− id: menu
43+ UnityMenuModelPaths {
44+ id: paths
4545
46− property UnityMenuModelPaths paths: UnityMenuModelPaths {
47− source: hints["x-canonical-private-menu-model"]
46+ source: hints["x-canonical-private-menu-model"]
4847
49− busNameHint: "busName"
50− actionsHint: "actions"
51− menuObjectPathHint: "menuPath"
52− }
48+ busNameHint: "busName"
49+ actionsHint: "actions"
50+ menuObjectPathHint: "menuPath"
51+ }
52+
53+ UnityMenuModel {
54+ id: unityMenuModel
5355
5456 busName: paths.busName
5557 actions: paths.actions
@@ -159,32 +161,24 @@ UbuntuShape {
159161 }
160162 }
161163
162− ListView {
163− id: dialogListView
164−
164+ Column {
165165 objectName: "dialogListView"
166166 spacing: units.gu(2)
167− interactive: false
168167
169168 visible: count > 0
170− height: childrenRect.height
171169
172− anchors {
173− left: parent.left
174− right: parent.right
175− }
170+ anchors.left: parent.left; anchors.right: parent.right
171+
172+ Repeater {
173+ model: unityMenuModel
176174
177− model: menu
175+ NotificationMenuItemFactory {
176+ anchors.left: parent.left; anchors.right: parent.right
178177
179− delegate: NotificationMenuItemFactory {
180− anchors {
181− left: parent.left
182− right: parent.right
178+ menuModel: unityMenuModel
179+ menuData: model
180+ menuIndex: index
183181 }
184−
185− menuModel: menu
186− menuData: model
187− menuIndex: index
188182 }
189183 }
190184
Notifications/NotificationMenuItemFactory.qml+4−13
@@ -19,7 +19,7 @@
1919
2020import QtQuick 2.0
2121import Ubuntu.Components 0.1
22−import "../Greeter"
22+import "../Components"
2323
2424Loader {
2525 id: menuFactory
@@ -54,10 +54,7 @@ Loader {
5454 Column {
5555 spacing: units.gu(.5)
5656
57− anchors {
58− left: parent.left
59− right: parent.right
60− }
57+ anchors.left: parent.left; anchors.right: parent.right
6158
6259 Component.onCompleted: {
6360 menuModel.loadExtendedAttributes(menuIndex, {"x-echo-mode-password": "bool"});
@@ -73,10 +70,7 @@ Loader {
7370 TextField {
7471 id: textfield
7572
76− anchors {
77− left: parent.left
78− right: parent.right
79− }
73+ anchors.left: parent.left; anchors.right: parent.right
8074
8175 onTextChanged: {
8276 menuModel.changeState(menuIndex, text);
@@ -88,10 +82,7 @@ Loader {
8882 Component {
8983 id: pinLock
9084 PinLockscreen {
91− anchors {
92− left: parent.left
93− right: parent.right
94− }
85+ anchors.left: parent.left; anchors.right: parent.right
9586
9687 onEntered: {
9788 menuModel.changeState(menuIndex, passphrase);
plugins/Utils/unitymenumodelpaths.cpp+28−32
@@ -19,30 +19,9 @@
1919
2020#include "unitymenumodelpaths.h"
2121#include <QDBusArgument>
22−#include <QDebug>
2322
2423static QVariant parseVariantData(const QVariant& var);
2524
26−UnityMenuModelPaths::UnityMenuModelPaths(QObject *parent)
27− : QObject(parent)
28−{
29−}
30−
31−QVariant UnityMenuModelPaths::source() const
32−{
33− return m_sourceData;
34−}
35−
36−void UnityMenuModelPaths::setSource(const QVariant& data)
37−{
38− if (m_sourceData != data) {
39− m_sourceData = data;
40− Q_EMIT sourceChanged();
41−
42− updateData();
43− }
44−}
45−
4625const QDBusArgument &operator>>(const QDBusArgument &arg, QVariantMap &map)
4726{
4827 arg.beginMap();
@@ -62,21 +41,39 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QVariantMap &map)
6241}
6342
6443static QVariant parseVariantData(const QVariant& var) {
65− if ((int)var.type() == QMetaType::User) {
66− if (var.userType() == qMetaTypeId<QDBusArgument>()) {
67−
68− QDBusArgument arg(var.value<QDBusArgument>());
69− if (arg.currentType() == QDBusArgument::MapType) {
70− QVariantMap map;
71− arg >> map;
72− return map;
73− }
74− return arg.asVariant();
44+ if ((int)var.type() == QMetaType::User && var.userType() == qMetaTypeId<QDBusArgument>()) {
45+ QDBusArgument arg(var.value<QDBusArgument>());
46+ if (arg.currentType() == QDBusArgument::MapType) {
47+ QVariantMap map;
48+ arg >> map;
49+ return map;
7550 }
51+ return arg.asVariant();
7652 }
53+
7754 return var;
7855}
7956
57+UnityMenuModelPaths::UnityMenuModelPaths(QObject *parent)
58+ : QObject(parent)
59+{
60+}
61+
62+QVariant UnityMenuModelPaths::source() const
63+{
64+ return m_sourceData;
65+}
66+
67+void UnityMenuModelPaths::setSource(const QVariant& data)
68+{
69+ if (m_sourceData != data) {
70+ m_sourceData = data;
71+ Q_EMIT sourceChanged();
72+
73+ updateData();
74+ }
75+}
76+
8077void UnityMenuModelPaths::updateData()
8178{
8279 QVariantMap dataMap = parseVariantData(m_sourceData).toMap();
@@ -121,7 +118,6 @@ QVariantMap UnityMenuModelPaths::actions() const
121118void UnityMenuModelPaths::setActions(const QVariantMap &actions)
122119{
123120 if (m_actions != actions) {
124− qDebug() << "UnityMenuModelPaths setActions " << actions;
125121 m_actions = actions;
126122 Q_EMIT actionsChanged();
127123 }