on xenial help sign in
Merge new-header
commit5a2323b68774a3a1e9b9943db001305f55d4d2a1 authorMichał Sawicz <michal.sawicz@canonical.com> dateTue 8 Jul 2014, 23:01 (12 years ago) parent741c4fcbd26328
11 files changed+368−44
debian/changelog+7 debian/control+5−5 po/ast.po+11−11 po/gl.po+10−8 po/unity8.pot+30−6 po/update-unity-pot+2−1 qml/Panel/Indicators/DefaultIndicatorPage.qml+1 qml/Panel/Indicators/MenuItemFactory.qml+177−13 qml/Panel/Indicators/MessageMenuItemFactory.qml+3 tests/mocks/QMenuModel/QDBusActionGroup.qml+60 tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+62
debian/changelog+7
@@ -1,3 +1,10 @@
1+unity8 (7.90+14.10.20140707-0ubuntu1) utopic; urgency=low
2+
3+ [ Nick Dedekind ]
4+ * Added support for TransferMenu
5+
6+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 07 Jul 2014 11:40:59 +0000
7+
18unity8 (7.90+14.10.20140703.1-0ubuntu1) utopic; urgency=low
29
310 [ Michał Sawicz ]
debian/control+5−5
@@ -39,8 +39,8 @@ Build-Depends: cmake,
3939 qtdeclarative5-dev-tools,
4040 qtdeclarative5-private-dev (>= 5.2.1),
4141 qtdeclarative5-qtmultimedia-plugin,
42− qtdeclarative5-ubuntu-settings-components (>= 0.2),
43− qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.48) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.48),
42+ qtdeclarative5-ubuntu-settings-components (>= 0.3),
43+ qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
4444 ttf-ubuntu-font-family,
4545Standards-Version: 3.9.4
4646Homepage: http://launchpad.net/unity
@@ -53,7 +53,7 @@ Vcs-Browser: https://bazaar.launchpad.net/~unity-team/unity8/trunk
5353Package: indicators-client
5454Architecture: amd64 armhf i386
5555Depends: qmenumodel-qml (>= 0.2.7),
56− qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.48) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.48),
56+ qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
5757 unity8 (= ${binary:Version}),
5858 ${misc:Depends},
5959 ${shlibs:Depends},
@@ -80,7 +80,7 @@ Depends: gsettings-desktop-schemas,
8080 qmenumodel-qml (>= 0.2.7),
8181 qml-module-qtquick-xmllistmodel,
8282 qtdeclarative5-gsettings1.0,
83− qtdeclarative5-ubuntu-settings-components (>= 0.2),
83+ qtdeclarative5-ubuntu-settings-components (>= 0.3),
8484 unity-launcher-impl-3,
8585 unity8-common (= ${source:Version}),
8686 unity8-private (= ${binary:Version}),
@@ -101,7 +101,7 @@ Description: Unity 8 shell
101101Package: unity8-common
102102Architecture: all
103103Depends: qtdeclarative5-ubuntu-thumbnailer0.1 | ubuntu-thumbnailer-impl,
104− qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.48) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.48),
104+ qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
105105 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
106106 ubuntu-thumbnailer-impl-0,
107107 unity-application-impl-2,
po/ast.po+11−11
@@ -8,14 +8,14 @@ msgstr ""
88"Project-Id-Version: unity8\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11−"PO-Revision-Date: 2014-04-04 02:16+0000\n"
12−"Last-Translator: Xuacu Saturio <xuacusk8@gmail.com>\n"
11+"PO-Revision-Date: 2014-07-04 15:29+0000\n"
12+"Last-Translator: ivarela <ivarela@ubuntu.com>\n"
1313"Language-Team: Asturian <ast@li.org>\n"
1414"MIME-Version: 1.0\n"
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
17−"X-Launchpad-Export-Date: 2014-06-17 06:51+0000\n"
18−"X-Generator: Launchpad (build 17045)\n"
17+"X-Launchpad-Export-Date: 2014-07-05 05:59+0000\n"
18+"X-Generator: Launchpad (build 17086)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -73,8 +73,8 @@ msgid ""
7373"You have now mastered the edge gestures and can start using the "
7474"phone<br><br>Tap on the screen to start"
7575msgstr ""
76−"Agora domina los xestos de los bordes y pue principiar a usar el "
77−"teléfonu<br><br>Toque la pantalla pa comenzar"
76+"Agora yá domines los xestos de los berbesos y pues entamar a usar el "
77+"teléfonu<br><br>Toca la pantalla pa comenzar"
7878
7979#: qml/Components/Lockscreen.qml:214
8080msgid "Emergency Call"
@@ -82,7 +82,7 @@ msgstr "Llamada d'emerxencia"
8282
8383#: qml/Components/Lockscreen.qml:231
8484msgid "OK"
85−msgstr ""
85+msgstr "Aceutar"
8686
8787#: qml/Components/PageHeader.qml:365
8888msgid "Recent searches"
@@ -99,11 +99,11 @@ msgstr "Hola"
9999
100100#: qml/Components/PinLockscreen.qml:198
101101msgid "CANCEL"
102−msgstr ""
102+msgstr "ENCABOXAR"
103103
104104#: qml/Components/PinLockscreen.qml:216
105105msgid "DONE"
106−msgstr ""
106+msgstr "FECHO"
107107
108108#: qml/Components/SeeMore.qml:35
109109msgid "See more"
@@ -139,7 +139,7 @@ msgstr "Unviar"
139139
140140#: qml/Greeter/Greeter.qml:157
141141msgid "Swipe to unlock"
142−msgstr ""
142+msgstr "Esliza pa desbloquiar"
143143
144144#: qml/Hud/HudParametrizedActionsPage.qml:132
145145msgid "Confirm"
@@ -167,7 +167,7 @@ msgstr "Amosar contraseña"
167167
168168#: qml/Notifications/NotificationMenuItemFactory.qml:103
169169msgid "Please enter SIM PIN"
170−msgstr "Escriba'l PIN de la SIM"
170+msgstr "Escribi'l PIN de la SIM"
171171
172172#: qml/Panel/SearchIndicator.qml:27
173173msgid "Search"
po/gl.po+10−8
@@ -8,14 +8,14 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11−"PO-Revision-Date: 2014-06-07 13:26+0000\n"
11+"PO-Revision-Date: 2014-07-06 15:53+0000\n"
1212"Last-Translator: Marcos Lans <Unknown>\n"
1313"Language-Team: Galician <gl@li.org>\n"
1414"MIME-Version: 1.0\n"
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
17−"X-Launchpad-Export-Date: 2014-06-17 06:51+0000\n"
18−"X-Generator: Launchpad (build 17045)\n"
17+"X-Launchpad-Export-Date: 2014-07-07 06:08+0000\n"
18+"X-Generator: Launchpad (build 17086)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -36,7 +36,7 @@ msgstr "Bordo dereito"
3636
3737#: qml/Components/EdgeDemo.qml:114
3838msgid "Try swiping from the right edge to unlock the phone"
39−msgstr "Probe a esvarar desde o bordo dereito para desbloquear o teléfono"
39+msgstr "Esvare o dedo desde o bordo dereito para desbloquear o teléfono"
4040
4141#: qml/Components/EdgeDemo.qml:145
4242msgid "Top edge"
@@ -44,7 +44,7 @@ msgstr "Bordo superior"
4444
4545#: qml/Components/EdgeDemo.qml:146
4646msgid "Try swiping from the top edge to access the indicators"
47−msgstr "Esvare desde o bordo superior para acceder aos indicadores."
47+msgstr "Esvare o dedo desde o bordo superior para acceder aos indicadores."
4848
4949#: qml/Components/EdgeDemo.qml:171
5050msgid "Close"
@@ -52,7 +52,7 @@ msgstr "Pechar"
5252
5353#: qml/Components/EdgeDemo.qml:172
5454msgid "Swipe up again to close the settings screen"
55−msgstr "Esvare cara a arriba para pechar os axustes"
55+msgstr "Esvare o dedo cara a arriba para pechar os axustes"
5656
5757#: qml/Components/EdgeDemo.qml:199
5858msgid "Left edge"
@@ -60,7 +60,9 @@ msgstr "Bordo esquerdo"
6060
6161#: qml/Components/EdgeDemo.qml:200
6262msgid "Swipe from the left to reveal the launcher for quick access to apps"
63−msgstr "Esvare desde a esquerda para mostrar o iniciador de acceso rápido"
63+msgstr ""
64+"Esvare o dedo desde a esquerda para mostrar o iniciador rápido aos "
65+"aplicativos"
6466
6567#: qml/Components/EdgeDemo.qml:227
6668msgid "Well done"
@@ -137,7 +139,7 @@ msgstr "Enviar"
137139
138140#: qml/Greeter/Greeter.qml:157
139141msgid "Swipe to unlock"
140−msgstr "Esvare para desbloquear"
142+msgstr "Esvare o dedo para desbloquear"
141143
142144#: qml/Hud/HudParametrizedActionsPage.qml:132
143145msgid "Confirm"
po/unity8.pot+30−6
@@ -8,22 +8,22 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11+"POT-Creation-Date: 2014-07-07 12:15+0100\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
1515"Language: \n"
1616"MIME-Version: 1.0\n"
17−"Content-Type: text/plain; charset=CHARSET\n"
17+"Content-Type: text/plain; charset=UTF-8\n"
1818"Content-Transfer-Encoding: 8bit\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
22−msgid "Lock to Launcher"
22+msgid "Pin shortcut"
2323msgstr ""
2424
2525#: plugins/Unity/Launcher/launcheritem.cpp:73
26−msgid "Unlock from Launcher"
26+msgid "Unpin shortcut"
2727msgstr ""
2828
2929#: qml/Components/EdgeDemoOverlay.qml:151
@@ -80,7 +80,7 @@ msgstr ""
8080msgid "OK"
8181msgstr ""
8282
83−#: qml/Components/PageHeader.qml:365
83+#: qml/Components/PageHeader.qml:366
8484msgid "Recent searches"
8585msgstr ""
8686
@@ -165,11 +165,35 @@ msgstr ""
165165msgid "Please enter SIM PIN"
166166msgstr ""
167167
168+#: qml/Panel/Indicators/MenuItemFactory.qml:583
169+msgid "In queue…"
170+msgstr ""
171+
172+#: qml/Panel/Indicators/MenuItemFactory.qml:587
173+msgid "Downloading"
174+msgstr ""
175+
176+#: qml/Panel/Indicators/MenuItemFactory.qml:589
177+msgid "Paused, tap to resume"
178+msgstr ""
179+
180+#: qml/Panel/Indicators/MenuItemFactory.qml:591
181+msgid "Canceled"
182+msgstr ""
183+
184+#: qml/Panel/Indicators/MenuItemFactory.qml:593
185+msgid "Finished"
186+msgstr ""
187+
188+#: qml/Panel/Indicators/MenuItemFactory.qml:595
189+msgid "Failed, tap to retry"
190+msgstr ""
191+
168192#: qml/Panel/SearchIndicator.qml:27
169193msgid "Search"
170194msgstr ""
171195
172−#: qml/Shell.qml:334
196+#: qml/Shell.qml:359
173197#, qt-format
174198msgid "Please enter %1"
175199msgstr ""
po/update-unity-pot+2−1
@@ -22,6 +22,7 @@ xgettext \
2222 --keyword=tr \
2323 --keyword=tr:1,2 \
2424 --package-name="unity8" \
25− --copyright-holder="Canonical Ltd."
25+ --copyright-holder="Canonical Ltd." \
26+ --from-code="UTF-8"
2627
2728echo "$PROGNAME: $PO_DIR/auto-generated.pot updated"
qml/Panel/Indicators/DefaultIndicatorPage.qml+1
@@ -176,6 +176,7 @@ IndicatorBase {
176176
177177 MenuItemFactory {
178178 id: factory
179+ rootModel: main.menuModel ? main.menuModel : null
179180 menuModel: mainMenu.model ? mainMenu.model : null
180181 }
181182
qml/Panel/Indicators/MenuItemFactory.qml+177−13
@@ -19,7 +19,8 @@
1919
2020import QtQuick 2.0
2121import Ubuntu.Settings.Menus 0.1 as Menus
22−import QMenuModel 0.1 as QMenuModel
22+import Ubuntu.Settings.Components 0.1 as SettingsComponents
23+import QMenuModel 0.1
2324import Utils 0.1 as Utils
2425import Ubuntu.Components.ListItems 0.1 as ListItems
2526import Ubuntu.Components 0.1
@@ -27,20 +28,23 @@ import Ubuntu.Components 0.1
2728Item {
2829 id: menuFactory
2930
31+ property var rootModel: null
3032 property var menuModel: null
3133
3234 property var _map: {
3335 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
3436 "unity.widgets.systemsettings.tablet.switch" : switchMenu,
3537
36− "com.canonical.indicator.button" : buttonMenu,
37− "com.canonical.indicator.div" : separatorMenu,
38− "com.canonical.indicator.section" : sectionMenu,
39− "com.canonical.indicator.progress" : progressMenu,
40− "com.canonical.indicator.slider" : sliderMenu,
41− "com.canonical.indicator.switch" : switchMenu,
42− "com.canonical.indicator.alarm" : alarmMenu,
43− "com.canonical.indicator.appointment" : appointmentMenu,
38+ "com.canonical.indicator.button" : buttonMenu,
39+ "com.canonical.indicator.div" : separatorMenu,
40+ "com.canonical.indicator.section" : sectionMenu,
41+ "com.canonical.indicator.progress" : progressMenu,
42+ "com.canonical.indicator.slider" : sliderMenu,
43+ "com.canonical.indicator.switch" : switchMenu,
44+ "com.canonical.indicator.alarm" : alarmMenu,
45+ "com.canonical.indicator.appointment" : appointmentMenu,
46+ "com.canonical.indicator.transfer" : transferMenu,
47+ "com.canonical.indicator.button-section" : buttonSectionMenu,
4448
4549 "com.canonical.indicator.messages.messageitem" : messageItem,
4650 "com.canonical.indicator.messages.sourceitem" : groupedMessage,
@@ -64,6 +68,7 @@ Item {
6468
6569 Component {
6670 id: separatorMenu;
71+
6772 Menus.SeparatorMenu {
6873 objectName: "separatorMenu"
6974 }
@@ -71,6 +76,7 @@ Item {
7176
7277 Component {
7378 id: sliderMenu;
79+
7480 Menus.SliderMenu {
7581 objectName: "sliderMenu"
7682 property QtObject menuData: null
@@ -122,6 +128,7 @@ Item {
122128
123129 Component {
124130 id: buttonMenu;
131+
125132 Menus.ButtonMenu {
126133 objectName: "buttonMenu"
127134 property QtObject menuData: null
@@ -139,6 +146,7 @@ Item {
139146 }
140147 Component {
141148 id: sectionMenu;
149+
142150 Menus.SectionMenu {
143151 objectName: "sectionMenu"
144152 property QtObject menuData: null
@@ -151,6 +159,7 @@ Item {
151159
152160 Component {
153161 id: progressMenu;
162+
154163 Menus.ProgressValueMenu {
155164 objectName: "progressMenu"
156165 property QtObject menuData: null
@@ -165,6 +174,7 @@ Item {
165174
166175 Component {
167176 id: standardMenu;
177+
168178 Menus.StandardMenu {
169179 objectName: "standardMenu"
170180 property QtObject menuData: null
@@ -183,6 +193,7 @@ Item {
183193
184194 Component {
185195 id: checkableMenu;
196+
186197 Menus.CheckableMenu {
187198 objectName: "checkableMenu"
188199 property QtObject menuData: null
@@ -202,6 +213,7 @@ Item {
202213
203214 Component {
204215 id: switchMenu;
216+
205217 Menus.SwitchMenu {
206218 objectName: "switchMenu"
207219 property QtObject menuData: null
@@ -221,6 +233,7 @@ Item {
221233
222234 Component {
223235 id: alarmMenu;
236+
224237 Menus.EventMenu {
225238 objectName: "alarmMenu"
226239 property QtObject menuData: null
@@ -258,6 +271,7 @@ Item {
258271
259272 Component {
260273 id: appointmentMenu;
274+
261275 Menus.EventMenu {
262276 objectName: "appointmentMenu"
263277 property QtObject menuData: null
@@ -297,6 +311,7 @@ Item {
297311
298312 Component {
299313 id: wifiSection;
314+
300315 Menus.SectionMenu {
301316 objectName: "wifiSection"
302317 property QtObject menuData: null
@@ -323,6 +338,7 @@ Item {
323338
324339 Component {
325340 id: accessPoint;
341+
326342 Menus.AccessPointMenu {
327343 objectName: "accessPoint"
328344 property QtObject menuData: null
@@ -330,7 +346,7 @@ Item {
330346 property int menuIndex: -1
331347 property var extendedData: menuData && menuData.ext || undefined
332348
333− property var strengthAction: QMenuModel.UnityMenuAction {
349+ property var strengthAction: UnityMenuAction {
334350 model: menuModel
335351 index: menuIndex
336352 name: getExtendedProperty(extendedData, "xCanonicalWifiApStrengthAction", "")
@@ -365,6 +381,7 @@ Item {
365381
366382 Component {
367383 id: messageItem
384+
368385 MessageMenuItemFactory {
369386 objectName: "messageItem"
370387 menuModel: menuFactory.menuModel
@@ -373,6 +390,7 @@ Item {
373390
374391 Component {
375392 id: groupedMessage
393+
376394 Menus.GroupedMessageMenu {
377395 objectName: "groupedMessage"
378396 property QtObject menuData: null
@@ -409,6 +427,7 @@ Item {
409427
410428 Component {
411429 id: mediaPayerMenu;
430+
412431 Menus.MediaPlayerMenu {
413432 objectName: "mediaPayerMenu"
414433 property QtObject menuData: null
@@ -435,6 +454,7 @@ Item {
435454
436455 Component {
437456 id: playbackItemMenu;
457+
438458 Menus.PlaybackItemMenu {
439459 objectName: "playbackItemMenu"
440460 property QtObject menuData: null
@@ -442,17 +462,17 @@ Item {
442462 property int menuIndex: -1
443463 property var extendedData: menuData && menuData.ext || undefined
444464
445− property var playAction: QMenuModel.UnityMenuAction {
465+ property var playAction: UnityMenuAction {
446466 model: menuModel
447467 index: menuIndex
448468 name: getExtendedProperty(extendedData, "xCanonicalPlayAction", "")
449469 }
450− property var nextAction: QMenuModel.UnityMenuAction {
470+ property var nextAction: UnityMenuAction {
451471 model: menuModel
452472 index: menuIndex
453473 name: getExtendedProperty(extendedData, "xCanonicalNextAction", "")
454474 }
455− property var previousAction: QMenuModel.UnityMenuAction {
475+ property var previousAction: UnityMenuAction {
456476 model: menuModel
457477 index: menuIndex
458478 name: getExtendedProperty(extendedData, "xCanonicalPreviousAction", "")
@@ -489,6 +509,150 @@ Item {
489509 }
490510 }
491511
512+ Component {
513+ id: transferMenu
514+
515+ Menus.TransferMenu {
516+ objectName: "transferMenu"
517+ id: transfer
518+ property QtObject menuData: null
519+ property var menuModel: menuFactory.menuModel
520+ property int menuIndex: -1
521+ property var extendedData: menuData && menuData.ext || undefined
522+ property var uid: getExtendedProperty(extendedData, "xCanonicalUid", undefined)
523+
524+ text: menuData && menuData.label || ""
525+ iconSource: menuData && menuData.icon || ""
526+ maximum: 1.0
527+ enabled: menuData && menuData.sensitive || false
528+ removable: true
529+ confirmRemoval: true
530+
531+ QDBusActionGroup {
532+ id: actionGroup
533+ busType: 1
534+ busName: rootModel.busName
535+ objectPath: rootModel.actions["indicator"]
536+
537+ property var activateAction: action("activate-transfer")
538+ property var cancelAction: action("cancel-transfer")
539+ property var transferStateAction: uid !== undefined ? action("transfer-state."+uid) : null
540+
541+ Component.onCompleted: actionGroup.start()
542+ }
543+
544+ property var transferState: {
545+ if (actionGroup.transferStateAction === null) return undefined;
546+ return actionGroup.transferStateAction.valid ? actionGroup.transferStateAction.state : undefined
547+ }
548+
549+ property var runningState : transferState !== undefined ? transferState["state"] : undefined
550+ property var secondsLeft : transferState !== undefined ? transferState["seconds-left"] : undefined
551+
552+ active: runningState !== undefined && runningState !== Menus.TransferState.Finished
553+ progress: transferState !== undefined ? transferState["percent"] : 0.0
554+
555+ // TODO - Should be in the SDK
556+ property var timeRemaining: {
557+ if (secondsLeft === undefined) return undefined;
558+
559+ var remaining = "";
560+ var hours = Math.floor(secondsLeft / (60 * 60));
561+ var minutes = Math.floor(secondsLeft / 60) % 60;
562+ var seconds = secondsLeft % 60;
563+ if (hours > 0) {
564+ remaining += hours + (hours == 1 ? " hour" : " hours");
565+ }
566+ if (minutes > 0) {
567+ if (remaining != "") remaining += ", ";
568+ remaining += minutes + (minutes == 1 ? " minute" : " minutes");
569+ }
570+ // don't include seconds if hours > 0
571+ if (hours == 0 && minutes < 5 && seconds > 0) {
572+ if (remaining != "") remaining += ", ";
573+ remaining += seconds + (seconds == 1 ? " second" : " seconds");
574+ }
575+ if (remaining == "")
576+ remaining = "0 seconds";
577+ return remaining + " remaining";
578+ }
579+
580+ stateText: {
581+ switch (runningState) {
582+ case Menus.TransferState.Queued:
583+ return i18n.tr("In queue…");
584+ case Menus.TransferState.Hashing:
585+ case Menus.TransferState.Processing:
586+ case Menus.TransferState.Running:
587+ return timeRemaining === undefined ? i18n.tr("Downloading") : timeRemaining;
588+ case Menus.TransferState.Paused:
589+ return i18n.tr("Paused, tap to resume");
590+ case Menus.TransferState.Canceled:
591+ return i18n.tr("Canceled");
592+ case Menus.TransferState.Finished:
593+ return i18n.tr("Finished");
594+ case Menus.TransferState.Error:
595+ return i18n.tr("Failed, tap to retry");
596+ }
597+ return "";
598+ }
599+
600+ onMenuModelChanged: {
601+ loadAttributes();
602+ }
603+ onMenuIndexChanged: {
604+ loadAttributes();
605+ }
606+ onTriggered: {
607+ actionGroup.activateAction.activate(uid);
608+ }
609+ onItemRemoved: {
610+ actionGroup.cancelAction.activate(uid);
611+ }
612+
613+ function loadAttributes() {
614+ if (!menuModel || menuIndex == -1) return;
615+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-uid': 'string'});
616+ }
617+ }
618+ }
619+
620+ Component {
621+ id: buttonSectionMenu;
622+
623+ ListItems.Standard {
624+ objectName: "buttonSectionMenu"
625+ property QtObject menuData: null
626+ property var menuModel: menuFactory.menuModel
627+ property int menuIndex: -1
628+ property var extendedData: menuData && menuData.ext || undefined
629+
630+ iconSource: menuData && menuData.icon || ""
631+ enabled: menuData && menuData.sensitive || false
632+ text: menuData && menuData.label || ""
633+ showDivider: false
634+
635+ onMenuModelChanged: {
636+ loadAttributes();
637+ }
638+ onMenuIndexChanged: {
639+ loadAttributes();
640+ }
641+ function loadAttributes() {
642+ if (!menuModel || menuIndex == -1) return;
643+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-extra-label': 'string'});
644+ }
645+
646+ control: Button {
647+ text: getExtendedProperty(extendedData, "xCanonicalExtraLabel", "")
648+
649+ onClicked: {
650+ menuModel.activate(menuIndex);
651+ }
652+ }
653+ }
654+ }
655+
492656 function load(modelData) {
493657 if (modelData.type !== undefined) {
494658 var component = _map[modelData.type];
qml/Panel/Indicators/MessageMenuItemFactory.qml+3
@@ -77,6 +77,7 @@ Item {
7777
7878 Component {
7979 id: simpleTextMessage
80+
8081 Menus.SimpleTextMessageMenu {
8182 id: message
8283 objectName: "simpleTextMessage"
@@ -115,6 +116,7 @@ Item {
115116
116117 Component {
117118 id: textMessage
119+
118120 Menus.TextMessageMenu {
119121 id: message
120122 objectName: "textMessage"
@@ -165,6 +167,7 @@ Item {
165167 }
166168 Component {
167169 id: snapDecision
170+
168171 Menus.SnapDecisionMenu {
169172 id: message
170173 objectName: "snapDecision"
tests/mocks/QMenuModel/QDBusActionGroup.qml+60
@@ -18,10 +18,70 @@
1818 */
1919
2020import QtQuick 2.0
21+import Ubuntu.Settings.Menus 0.1 as Menus
2122
2223QtObject {
2324 property int busType
2425 property string busName
2526 property string objectPath
2627 function start() {}
28+ function action(actionName) {
29+ switch (actionName) {
30+ case "transfer-state.queued":
31+ return {
32+ 'valid': true,
33+ 'state': {
34+ 'state': Menus.TransferState.Queued,
35+ 'percent': 0.0
36+ }
37+ }
38+ case "transfer-state.running":
39+ return {
40+ 'valid': true,
41+ 'state': {
42+ 'state': Menus.TransferState.Running,
43+ 'seconds-left': 100,
44+ 'percent': 0.1
45+ }
46+ }
47+ case "transfer-state.paused":
48+ return {
49+ 'valid': true,
50+ 'state': {
51+ 'state': Menus.TransferState.Paused,
52+ 'seconds-left': 100,
53+ 'percent': 0.5
54+ }
55+ }
56+ case "transfer-state.cancelled":
57+ return {
58+ 'valid': true,
59+ 'state': {
60+ 'state': Menus.TransferState.Canceled,
61+ 'percent': 0.4
62+ }
63+ }
64+ case "transfer-state.finished": return {
65+ 'valid': true,
66+ 'state': {
67+ 'state': Menus.TransferState.Finished,
68+ 'seconds-left': 0,
69+ 'percent': 1.0
70+ }
71+ }
72+ case "transfer-state.error":
73+ return {
74+ 'valid': true,
75+ 'state': {
76+ 'state': Menus.TransferState.Error,
77+ 'seconds-left': 100,
78+ 'percent': 0.0
79+ }
80+ }
81+ default:
82+ break;
83+ }
84+
85+ return null;
86+ }
2787}
tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+62
@@ -98,6 +98,8 @@ Item {
9898 { tag: 'switch2', type: "com.canonical.indicator.switch", objectName: "switchMenu" },
9999 { tag: 'alarm', type: "com.canonical.indicator.alarm", objectName: "alarmMenu" },
100100 { tag: 'appointment', type: "com.canonical.indicator.appointment", objectName: "appointmentMenu" },
101+ { tag: 'transfer', type: "com.canonical.indicator.transfer", objectName: "transferMenu" },
102+ { tag: 'buttonSection', type: "com.canonical.indicator.button-section", objectName: "buttonSectionMenu" },
101103
102104 { tag: 'messageItem', type: "com.canonical.indicator.messages.messageitem", objectName: "messageItem" },
103105 { tag: 'sourceItem', type: "com.canonical.indicator.messages.sourceitem", objectName: "groupedMessage" },
@@ -428,6 +430,66 @@ Item {
428430 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
429431 }
430432
433+ function test_create_transferMenu_data() {
434+ return [
435+ {tag: "queued", label: "testLabel1", enabled: true, active: true, icon: "file:///testIcon1", progress: 0, stateText: "In queue…" },
436+ {tag: "running", label: "testLabel2", enabled: true, active: true, icon: "file:///testIcon2", progress: 0.1, stateText: "1 minute, 40 seconds remaining" },
437+ {tag: "paused", label: "testLabel3", enabled: true, active: true, icon: "file:///testIcon3", progress: 0.5, stateText: "Paused, tap to resume" },
438+ {tag: "cancelled", label: "testLabel4", enabled: true, active: true, icon: "file:///testIcon4", progress: 0.4, stateText: "Canceled" },
439+ {tag: "finished", label: "testLabel5", enabled: false, active: false, icon: "file:///testIcon5", progress: 1.0, stateText: "Finished" },
440+ {tag: "error", label: "testLabel6", enabled: false, active: true, icon: "file:///testIcon6", progress: 0, stateText: "Failed, tap to retry" },
441+ ];
442+ }
443+
444+ function test_create_transferMenu(data) {
445+ menuData.type = "com.canonical.indicator.transfer";
446+ menuData.label = data.label;
447+ menuData.sensitive = data.enabled;
448+ menuData.icon = data.icon;
449+ menuData.ext = {
450+ 'xCanonicalUid': data.tag
451+ };
452+
453+ loader.data = menuData;
454+ loader.sourceComponent = factory.load(menuData);
455+ tryCompareFunction(function() { return loader.item != undefined; }, true);
456+ compare(loader.item.objectName, "transferMenu", "Should have created a transfer menu");
457+
458+ compare(loader.item.text, data.label, "Label does not match data");
459+ compare(loader.item.iconSource, data.icon, "Icon does not match data");
460+ compare(loader.item.enabled, data.enabled, "Enabled does not match data");
461+ compare(loader.item.progress, data.progress, "Icon does not match data");
462+ compare(loader.item.active, data.active, "Active does not match data");
463+ compare(loader.item.stateText, data.stateText, "State text does not match data");
464+ }
465+
466+ function test_create_buttonSectionMenu_data() {
467+ return [
468+ {label: "testLabel1", enabled: true, buttonText: "buttonLabel1", icon: "file:///testIcon1" },
469+ {label: "testLabel2", enabled: false, buttonText: "buttonLabel1", icon: "file:///testIcon2" },
470+ ];
471+ }
472+
473+ function test_create_buttonSectionMenu(data) {
474+ menuData.type = "com.canonical.indicator.button-section";
475+ menuData.label = data.label;
476+ menuData.sensitive = data.enabled;
477+ menuData.icon = data.icon;
478+ menuData.ext = {
479+ 'xCanonicalExtraLabel': data.buttonText
480+ };
481+
482+ loader.data = menuData;
483+ loader.sourceComponent = factory.load(menuData);
484+ tryCompareFunction(function() { return loader.item != undefined; }, true);
485+ compare(loader.item.objectName, "buttonSectionMenu", "Should have created a transfer menu");
486+
487+ compare(loader.item.text, data.label, "Label does not match data");
488+ compare(loader.item.iconSource, data.icon, "Icon does not match data");
489+ compare(loader.item.enabled, data.enabled, "Enabled does not match data");
490+ compare(loader.item.control.text, data.buttonText, "Button text does not match data");
491+ }
492+
431493 function test_create_wifiSection_data() {
432494 return [
433495 {label: "testLabel1", busy: false },