on xenial help sign in
Fixed suggestions from MR-comments.
ea9dc25Mirco Müller
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 {
40
40
41 clip: true
41 clip: true
42
42
43− UnityMenuModel {
43+ UnityMenuModelPaths {
44− id: menu
44+ id: paths
45
45
46− property UnityMenuModelPaths paths: UnityMenuModelPaths {
47− source: hints["x-canonical-private-menu-model"]
46+ source: hints["x-canonical-private-menu-model"]
48
47
49− busNameHint: "busName"
48+ busNameHint: "busName"
50− actionsHint: "actions"
49+ actionsHint: "actions"
51− menuObjectPathHint: "menuPath"
50+ menuObjectPathHint: "menuPath"
52− }
51+ }
52+
53+ UnityMenuModel {
54+ id: unityMenuModel
53
55
54 busName: paths.busName
56 busName: paths.busName
55 actions: paths.actions
57 actions: paths.actions
@@ -159,32 +161,24 @@ UbuntuShape {
159 }
161 }
160 }
162 }
161
163
162− ListView {
164+ Column {
163− id: dialogListView
164−
165 objectName: "dialogListView"
165 objectName: "dialogListView"
166 spacing: units.gu(2)
166 spacing: units.gu(2)
167− interactive: false
168
167
169 visible: count > 0
168 visible: count > 0
170− height: childrenRect.height
171
169
172− anchors {
170+ anchors.left: parent.left; anchors.right: parent.right
173− left: parent.left
171+
174− right: parent.right
172+ Repeater {
175− }
173+ model: unityMenuModel
176
174
177− model: menu
175+ NotificationMenuItemFactory {
176+ anchors.left: parent.left; anchors.right: parent.right
178
177
179− delegate: NotificationMenuItemFactory {
178+ menuModel: unityMenuModel
180− anchors {
179+ menuData: model
181− left: parent.left
180+ menuIndex: index
182− right: parent.right
183 }
181 }
184−
185− menuModel: menu
186− menuData: model
187− menuIndex: index
188 }
182 }
189 }
183 }
190
184
Notifications/NotificationMenuItemFactory.qml+4−13
@@ -19,7 +19,7 @@
19
19
20import QtQuick 2.0
20import QtQuick 2.0
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22−import "../Greeter"
22+import "../Components"
23
23
24Loader {
24Loader {
25 id: menuFactory
25 id: menuFactory
@@ -54,10 +54,7 @@ Loader {
54 Column {
54 Column {
55 spacing: units.gu(.5)
55 spacing: units.gu(.5)
56
56
57− anchors {
58− left: parent.left
59− right: parent.right
57+ anchors.left: parent.left; anchors.right: parent.right
60− }
61
58
62 Component.onCompleted: {
59 Component.onCompleted: {
63 menuModel.loadExtendedAttributes(menuIndex, {"x-echo-mode-password": "bool"});
60 menuModel.loadExtendedAttributes(menuIndex, {"x-echo-mode-password": "bool"});
@@ -73,10 +70,7 @@ Loader {
73 TextField {
70 TextField {
74 id: textfield
71 id: textfield
75
72
76− anchors {
77− left: parent.left
78− right: parent.right
73+ anchors.left: parent.left; anchors.right: parent.right
79− }
80
74
81 onTextChanged: {
75 onTextChanged: {
82 menuModel.changeState(menuIndex, text);
76 menuModel.changeState(menuIndex, text);
@@ -88,10 +82,7 @@ Loader {
88 Component {
82 Component {
89 id: pinLock
83 id: pinLock
90 PinLockscreen {
84 PinLockscreen {
91− anchors {
92− left: parent.left
93− right: parent.right
85+ anchors.left: parent.left; anchors.right: parent.right
94− }
95
86
96 onEntered: {
87 onEntered: {
97 menuModel.changeState(menuIndex, passphrase);
88 menuModel.changeState(menuIndex, passphrase);
plugins/Utils/unitymenumodelpaths.cpp+28−32
@@ -19,30 +19,9 @@
19
19
20#include "unitymenumodelpaths.h"
20#include "unitymenumodelpaths.h"
21#include <QDBusArgument>
21#include <QDBusArgument>
22−#include <QDebug>
23
22
24static QVariant parseVariantData(const QVariant& var);
23static QVariant parseVariantData(const QVariant& var);
25
24
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−
46const QDBusArgument &operator>>(const QDBusArgument &arg, QVariantMap &map)
25const QDBusArgument &operator>>(const QDBusArgument &arg, QVariantMap &map)
47{
26{
48 arg.beginMap();
27 arg.beginMap();
@@ -62,21 +41,39 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QVariantMap &map)
62}
41}
63
42
64static QVariant parseVariantData(const QVariant& var) {
43static QVariant parseVariantData(const QVariant& var) {
65− if ((int)var.type() == QMetaType::User) {
66− if (var.userType() == qMetaTypeId<QDBusArgument>()) {
44+ if ((int)var.type() == QMetaType::User && var.userType() == qMetaTypeId<QDBusArgument>()) {
67−
68− QDBusArgument arg(var.value<QDBusArgument>());
45+ QDBusArgument arg(var.value<QDBusArgument>());
69− if (arg.currentType() == QDBusArgument::MapType) {
46+ if (arg.currentType() == QDBusArgument::MapType) {
70− QVariantMap map;
47+ QVariantMap map;
71− arg >> map;
48+ arg >> map;
72− return map;
73− }
74− return arg.asVariant();
49+ return map;
75 }
50 }
51+ return arg.asVariant();
76 }
52 }
53+
77 return var;
54 return var;
78}
55}
79
56
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+
80void UnityMenuModelPaths::updateData()
77void UnityMenuModelPaths::updateData()
81{
78{
82 QVariantMap dataMap = parseVariantData(m_sourceData).toMap();
79 QVariantMap dataMap = parseVariantData(m_sourceData).toMap();
@@ -121,7 +118,6 @@ QVariantMap UnityMenuModelPaths::actions() const
121void UnityMenuModelPaths::setActions(const QVariantMap &actions)
118void UnityMenuModelPaths::setActions(const QVariantMap &actions)
122{
119{
123 if (m_actions != actions) {
120 if (m_actions != actions) {
124− qDebug() << "UnityMenuModelPaths setActions " << actions;
125 m_actions = actions;
121 m_actions = actions;
126 Q_EMIT actionsChanged();
122 Q_EMIT actionsChanged();
127 }
123 }