on xenial help sign in
Resolve conflicts and merge trunk
commitb963df67234c514629c720be0e468d68ccb1f2a6 authorAndrea Cimitan <andrea.cimitan@canonical.com> dateWed 17 Jul 2013, 12:03 (13 years ago) parent8228ad5b620e36
248 files changed+9159−1697
CMakeLists.txt+4−3 CODING+5−6 Components/Showable.qml+5−14 Dash/Generic/GenericPreview.qml+84 Dash/GenericScopeView.qml+119 Dash/PreviewDelegateMapper.qml+34 Launcher/Launcher.qml+2−5 Launcher/LauncherPanel.qml+3−2 Panel/IndicatorItem.qml+22−35 Panel/IndicatorRow.qml+5−3 Panel/Indicators.qml+3−7 Panel/Indicators/DatetimeIndicatorPage.qml+97 Panel/Indicators/DatetimeIndicatorWidget.qml+65 Panel/Indicators/DefaultIndicatorPage.qml+25 Panel/Indicators/DefaultIndicatorWidget.qml+80 Panel/Indicators/MessagingIndicatorPage.qml+35 Panel/Indicators/MessagingIndicatorWidget.qml+25 Panel/Indicators/NetworkIndicatorPage.qml+79 Panel/Indicators/NetworkIndicatorWidget.qml+109 Panel/Indicators/SoundIndicatorWidget.qml+25 Panel/Indicators/client/IndicatorsClient.qml+42 Panel/Indicators/client/IndicatorsList.qml+62 Panel/Indicators/client/IndicatorsPage.qml+49 Panel/IndicatorsDataModel.qml+66 Panel/MenuContent.qml+18−21 Panel/Menus/Overview/OverviewGrid.qml+15−24 Panel/graphics/time_and_date@18.png Shell.qml−3 build+2−5 cmake/modules/Plugins.cmake+25−15 cmake/modules/autopilot.cmake+7−4 debian/changelog+80 debian/control+53−36 debian/indicators-client.install+1 debian/unity8.install+1 main.cpp+1−2 paths.h.in+15 plugins/HudClient/CMakeLists.txt+2−1 plugins/LightDM/CMakeLists.txt+2−1 plugins/ListViewWithPageHeader/CMakeLists.txt+2−1 plugins/Ubuntu/Gestures/CMakeLists.txt+2−1 plugins/Unity/CMakeLists.txt+6−2 plugins/Unity/Indicators/CMakeLists.txt+54 plugins/Unity/Indicators/Messaging/CMakeLists.txt+1 plugins/Unity/Indicators/Messaging/qml/ActionButton.qml+43 plugins/Unity/Indicators/Messaging/qml/ActionTextField.qml+66 plugins/Unity/Indicators/Messaging/qml/CMakeLists.txt+5 plugins/Unity/Indicators/Messaging/qml/GroupedMessage.qml+96 plugins/Unity/Indicators/Messaging/qml/HeroMessage.qml+120 plugins/Unity/Indicators/Messaging/qml/HeroMessageHeader.qml+161 plugins/Unity/Indicators/Messaging/qml/MessageMenuItem.qml+96 plugins/Unity/Indicators/Messaging/qml/QuickReply.qml+160 plugins/Unity/Indicators/Messaging/qml/SimpleTextMessage.qml+97 plugins/Unity/Indicators/Messaging/qml/SnapDecision.qml+142 plugins/Unity/Indicators/Messaging/qml/TextMessage.qml+35 plugins/Unity/Indicators/Messaging/qml/qmldir+12 plugins/Unity/Indicators/Messaging/qml/utils.js+27 plugins/Unity/Indicators/Network/CMakeLists.txt+45 plugins/Unity/Indicators/Network/networkagent.cpp+146 plugins/Unity/Indicators/Network/networkagent.h+65 tests/mocks/Ubuntu/ChewieUI/fake_chewie_plugin.cpp → plugins/Unity/Indicators/Network/plugin.cpp+12−11 plugins/Unity/Indicators/Network/plugin.h+32 plugins/Unity/Indicators/Network/qml/AccessPoint.qml+68 plugins/Unity/Indicators/Network/qml/CMakeLists.txt+5 plugins/Unity/Indicators/Network/qml/PasswordPage.qml+88 plugins/Unity/Indicators/Network/qml/PasswordTextField.qml+68 plugins/Unity/Indicators/Network/qml/WifiSection.qml+34 plugins/Unity/Indicators/Network/qml/qmldir+9 plugins/Unity/Indicators/Network/secret-agent.c+382 plugins/Unity/Indicators/Network/secret-agent.h+102 plugins/Unity/Indicators/flatmenuproxymodel.cpp+272 plugins/Unity/Indicators/flatmenuproxymodel.h+91 plugins/Unity/Indicators/indicator.cpp+88 plugins/Unity/Indicators/indicator.h+57 plugins/Unity/Indicators/indicators.h+103 plugins/Unity/Indicators/indicatorsmanager.cpp+285 plugins/Unity/Indicators/indicatorsmanager.h+73 plugins/Unity/Indicators/indicatorsmodel.cpp+321 tests/mocks/Ubuntu/ChewieUI/fake_pluginmodel.h → plugins/Unity/Indicators/indicatorsmodel.h+32−45 plugins/Unity/Indicators/plugin.cpp+44 tests/mocks/Ubuntu/ChewieUI/fake_chewie_plugin.h → plugins/Unity/Indicators/plugin.h+8−7 plugins/Unity/Indicators/qml/BasicMenuItem.qml+48 plugins/Unity/Indicators/qml/ButtonMenuItem.qml+47 plugins/Unity/Indicators/qml/CMakeLists.txt+5 plugins/Unity/Indicators/qml/DivMenuItem.qml+26 plugins/Unity/Indicators/qml/HLine.qml+29 plugins/Unity/Indicators/qml/IndicatorBase.qml+59 plugins/Unity/Indicators/qml/IndicatorPage.qml+197 plugins/Unity/Indicators/qml/IndicatorWidget.qml+68 plugins/Unity/Indicators/qml/MenuAction.qml+86 plugins/Unity/Indicators/qml/MenuActionBinding.qml+106 plugins/Unity/Indicators/qml/MenuItem.qml+40 plugins/Unity/Indicators/qml/MenuItemFactory.qml+110 plugins/Unity/Indicators/qml/ProgressMenuItem.qml+65 plugins/Unity/Indicators/qml/RemoveBackground.qml+55 plugins/Unity/Indicators/qml/SectionMenuItem.qml+57 plugins/Unity/Indicators/qml/SliderMenuItem.qml+64 plugins/Unity/Indicators/qml/SwitchMenuItem.qml+43 plugins/Unity/Indicators/qml/qmldir+21 plugins/Unity/Indicators/resources/artwork/messaging/default_app.svg+42 plugins/Unity/Indicators/resources/artwork/messaging/default_contact.png plugins/Unity/Indicators/resources/artwork/messaging/message_sms01_54px.png plugins/Unity/Indicators/resources/indicators.qrc+7 plugins/Unity/Launcher/CMakeLists.txt+28 plugins/Unity/Launcher/backend/launcherbackend.cpp+145 plugins/Unity/Launcher/backend/launcherbackend.h+132 plugins/Unity/Launcher/common/quicklistentry.cpp+54 plugins/Unity/Launcher/common/quicklistentry.h+44 plugins/Unity/Launcher/launcheritem.cpp+127 plugins/Unity/Launcher/launcheritem.h+76 plugins/Unity/Launcher/launchermodel.cpp+170 plugins/Unity/Launcher/launchermodel.h+61 plugins/Unity/Launcher/plugin.cpp+47 plugins/Unity/Launcher/plugin.h+34 plugins/Unity/Launcher/qmldir+3 plugins/Unity/Launcher/quicklistmodel.cpp+60 plugins/Unity/Launcher/quicklistmodel.h+48 plugins/Unity/launchermodel.cpp−153 plugins/Unity/launchermodel.h−86 plugins/Unity/plugin.cpp−3 plugins/Utils/CMakeLists.txt+3−1 plugins/Utils/applicationpaths.h+38 plugins/Utils/plugin.cpp+8 po/ar.po+3−27 po/az.po+4−10 po/bg.po+3−15 po/ca.po+4−16 po/de.po+5−29 po/el.po+4−10 po/en_AU.po+3−27 po/en_GB.po+4−28 po/eo.po+3−3 po/es.po+1−1 po/fi.po+4−25 po/fo.po+4−10 po/fr.po+40−61 po/gl.po+4−16 po/he.po+4−10 po/hr.po+4−10 po/hu.po+4−10 po/hy.po+3−15 po/id.po+3−3 po/it.po+4−10 po/ja.po+3−3 po/kn.po+4−10 po/ko.po+4−4 po/ky.po+4−10 po/lv.po+4−10 po/my.po+4−7 po/nb.po+3−9 po/nl.po+4−10 po/pl.po+8−32 po/pt_BR.po+4−10 po/ro.po+4−10 po/ru.po+22−37 po/si.po+3−3 po/sl.po+1−1 po/sr.po+4−10 po/sv.po+3−3 po/te.po+4−4 po/tr.po+3−24 po/ug.po+6−27 po/uk.po+5−29 po/zh_CN.po+3−27 po/zh_TW.po+4−16 run+3−3 run_on_device+1−3 src/CMakeLists.txt+1 src/Panel/CMakeLists.txt+1 src/Panel/Indicators/CMakeLists.txt+2 src/Panel/Indicators/client/CMakeLists.txt+25 src/Panel/Indicators/client/indicatorsclient.cpp+99 src/Panel/Indicators/client/indicatorsclient.h+45 src/Panel/Indicators/client/main.cpp+26 src/Panel/Indicators/servicefiles/CMakeLists.txt+18 src/Panel/Indicators/servicefiles/com.canonical.indicator.battery+9 src/Panel/Indicators/servicefiles/com.canonical.indicator.messages+9 src/Panel/Indicators/servicefiles/com.canonical.indicator.time+9 src/Panel/Indicators/servicefiles/com.canonical.settings.network+9 src/Panel/Indicators/servicefiles/com.canonical.settings.sound+9 tests/autopilot/unity8/indicators_client/__init__.py+8 tests/autopilot/unity8/indicators_client/emulators/__init__.py+31 tests/autopilot/unity8/indicators_client/emulators/common.py+14 tests/autopilot/unity8/indicators_client/emulators/main_window.py+27 tests/autopilot/unity8/indicators_client/tests/__init__.py+87 tests/autopilot/unity8/indicators_client/tests/test_battery.py+99 tests/autopilot/unity8/shell/__init__.py+8 tests/autopilot/unity8/emulators/__init__.py → tests/autopilot/unity8/shell/emulators/__init__.py tests/autopilot/unity8/emulators/main_window.py → tests/autopilot/unity8/shell/emulators/main_window.py tests/autopilot/unity8/tests/__init__.py → tests/autopilot/unity8/shell/tests/__init__.py+1−1 tests/autopilot/unity8/tests/helpers.py → tests/autopilot/unity8/shell/tests/helpers.py tests/autopilot/unity8/tests/testbigscreen.py → tests/autopilot/unity8/shell/tests/testbigscreen.py+1−1 tests/autopilot/unity8/tests/testhud.py → tests/autopilot/unity8/shell/tests/testhud.py+2−2 tests/autopilot/unity8/tests/testlockscreen.py → tests/autopilot/unity8/shell/tests/testlockscreen.py+2−2 tests/data/unity/indicators/com.canonical.indicator.fake1+9 tests/data/unity/indicators/com.canonical.indicator.fake2+9 tests/data/unity/indicators/com.canonical.indicator.fake3+9 tests/data/unity/indicators/com.canonical.indicator.fake4+9 tests/mocks/LightDM/demo/InfographicModelPrivate.cpp+3−3 tests/mocks/LightDM/demo/UsersModelPrivate.cpp+1−1 tests/mocks/Ubuntu/CMakeLists.txt−1 tests/mocks/Ubuntu/ChewieUI/CMakeLists.txt−33 tests/mocks/Ubuntu/ChewieUI/fake_pluginmodel.cpp−206 tests/mocks/Ubuntu/ChewieUI/qmldir−1 tests/mocks/Unity/CMakeLists.txt+4−1 tests/mocks/Unity/Indicators/CMakeLists.txt+52 tests/mocks/Unity/Indicators/IndicatorsModel.qml+104 tests/mocks/Unity/Indicators/fakeplugin.cpp+37 tests/mocks/Unity/Indicators/fakeplugin.h+32 tests/mocks/Unity/Indicators/indicators_fake.qrc+14 tests/qmltests/Panel/qml/FakeMenuPlugin.qml → tests/mocks/Unity/Indicators/qml/FakeMenuPage.qml tests/qmltests/Panel/qml/fake_menu_plugin1.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin2.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin3.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin4.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin5.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml+3−2 tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml+23 tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml+23 tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml+23 tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml+23 tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml+23 tests/mocks/Unity/Indicators/qmldir+5 tests/mocks/Unity/Launcher/CMakeLists.txt+26 tests/mocks/Unity/Launcher/MockLauncherItem.cpp+134 tests/mocks/Unity/Launcher/MockLauncherItem.h+70 tests/mocks/Unity/Launcher/MockLauncherModel.cpp+152 tests/mocks/Unity/Launcher/MockLauncherModel.h+54 tests/mocks/Unity/Launcher/MockQuickListModel.cpp+46 tests/mocks/Unity/Launcher/MockQuickListModel.h+38 tests/mocks/Unity/Launcher/plugin.cpp+45 tests/mocks/Unity/Launcher/plugin.h+35 tests/mocks/Unity/Launcher/qmldir+2 tests/mocks/Unity/fake_launchermodel.cpp−150 tests/mocks/Unity/fake_launchermodel.h−86 tests/mocks/Unity/fake_unity_plugin.cpp−3 tests/plugins/Unity/CMakeLists.txt+2 tests/plugins/Unity/Indicators/CMakeLists.txt+27 tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp+138 tests/plugins/Unity/Indicators/indicatorsmodeltest.cpp+102 tests/qmltests/Panel/tst_IndicatorItem.qml+13−28 tests/qmltests/Panel/tst_IndicatorRow.qml+4−3 tests/qmltests/Panel/tst_Indicators.qml+1−2 tests/qmltests/Panel/tst_MenuContent.qml+11−10 tests/qmltests/Panel/tst_Overview.qml+5−17 tests/qmltests/Panel/tst_Panel.qml−1 tests/qmltests/modules/CMakeLists.txt+1 tests/qmltests/modules/Unity/CMakeLists.txt+1 unity8.qmlproject+1
CMakeLists.txt+4−3
@@ -91,9 +91,8 @@ enable_testing()
9191
9292# Autopilot tests
9393include(autopilot)
94−declare_autopilot_test(unity8 ${CMAKE_SOURCE_DIR}/tests/autopilot/)
95−
96−add_subdirectory(tests)
94+declare_autopilot_test(shell unity8.shell ${CMAKE_SOURCE_DIR}/tests/autopilot/)
95+declare_autopilot_test(indicators_client unity8.indicators_client ${CMAKE_SOURCE_DIR}/tests/autopilot/)
9796
9897set(SHELL_APP unity8)
9998
@@ -132,7 +131,9 @@ install(FILES ${QML_JS_FILES}
132131 )
133132
134133# add subdirectories to build
134+add_subdirectory(tests)
135135add_subdirectory(plugins)
136+add_subdirectory(src)
136137
137138# install subdirectories
138139set(QML_DIRS
CODING+5−6
@@ -23,15 +23,12 @@ $ cd ~/unity8/trunk
2323$ ./build --setup
2424
2525 this will:
26− - add the following PPA's
27− - ppa:phablet-team/desktop-deps
28− - ppa:canonical-qt5-edgers/qt5-proper
29− - ppa:ubuntu-sdk-team
26+ - add ppa:ubuntu-unity/next
3027 - install the required dependencies to build, as well as run on the desktop
3128 - it should also install unity-scope-home and unity-lens-application which
3229 are technically "recommends", not strict dependencies
3330
34−Note, once the PPA's are added, the script runs apt-get update, if you have
31+Note, once the PPA is added, the script runs apt-get update, if you have
3532any failures associated with it, the build script will bail out of the setup
3633and fail to install all the required dependencies.
3734
@@ -45,6 +42,7 @@ $ ./build
4542You may also rebuild with the -c for clean, which just deletes the build
4643directory.
4744
45+
4846Running Unity 8 on your desktop
4947===============================
5048
@@ -73,6 +71,7 @@ Notes
7371 - Create an EDS address book
7472 - Populate the address book with sample data
7573
74+
7675Running Unity 8 on devices
7776==========================
7877- Ubuntu Touch builds are currently only available in 13.10 flavour
@@ -91,7 +90,6 @@ $ cd ~/unity/trunk
9190$ ./run_on_device --setup
9291 this will:
9392 - install your public SSH key on the device
94− - add ppa:canonical-qt5-edgers/qt5-proper and ppa:phablet-team
9593 - install the needed dependencies
9694
9795$ ./run_on_device
@@ -109,6 +107,7 @@ $ ./run_on_device -p OR -k
109107Notes
110108-----
111109- using adb over TCP has some advantages, Google will be of help here
110+ - NOTE: this is not yet available for flipped images
112111 - TL;DR: `adb tcpip 5555; adb connect $your_device_ip`
113112 - you can persist the above via `adb shell setprop persist.adb.tcp.port 5555`
114113 - it's unsafe - anyone can connect to your device
Components/Showable.qml+5−14
@@ -52,7 +52,7 @@ Item {
5252 function show() {
5353 required = true;
5454 if (created) {
55− __reallyShow(true);
55+ __reallyShow();
5656 } else {
5757 __shouldShow = true;
5858 }
@@ -60,16 +60,12 @@ Item {
6060
6161 onCreatedChanged: {
6262 if (created && __shouldShow) {
63− __reallyShow(true);
63+ __reallyShow();
6464 __shouldShow = false;
6565 }
6666 }
6767
68− function showWithoutAnimation() {
69− __reallyShow(false);
70− }
71−
72− function __reallyShow(animated) {
68+ function __reallyShow() {
7369 if (!available) {
7470 return false;
7571 }
@@ -81,13 +77,8 @@ Item {
8177 }
8278
8379 if (showAnimation != undefined) {
84− if (animated) {
85− if (!showAnimation.running) {
86− showAnimation.restart()
87− }
88− } else {
89− showAnimation.start();
90− showAnimation.complete();
80+ if (!showAnimation.running) {
81+ showAnimation.restart()
9182 }
9283 } else {
9384 visible = true;
Dash/Generic/GenericPreview.qmlnew file+84
@@ -0,0 +1,84 @@
1+/*
2+ * Copyright (C) 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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+import "../../Components"
20+import "../../Components/ListItems" as ListItems
21+import "../../Components/IconUtil.js" as IconUtil
22+import ".."
23+
24+DashPreview {
25+ id: genericPreview
26+ property var previewData
27+
28+ title: previewData.title
29+ url: IconUtil.from_gicon(previewData.image)
30+ previewWidthRatio: 0.6
31+
32+ buttons: GridView {
33+ id: buttons
34+ model: genericPreview.previewData.actions
35+
36+ property int numOfRows: (count + 1) / 2
37+ property int spacing: units.gu(1)
38+ height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
39+
40+ cellWidth: Math.max(units.gu(9), width / 2)
41+ cellHeight: buttonHeight + spacing
42+ property int buttonWidth: Math.max(0, width / 2 - spacing)
43+ property int buttonHeight: units.gu(4)
44+
45+ delegate: Button {
46+ width: Math.max(units.gu(4), buttons.buttonWidth)
47+ height: buttons.buttonHeight
48+ color: "#dd4814"
49+ text: modelData.displayName
50+ iconSource: modelData.iconHint
51+ iconPosition: "right"
52+ visible: true
53+ onClicked: {
54+ genericPreview.previewData.execute(modelData.id, { })
55+ }
56+ }
57+ focus: false
58+ }
59+ description: Column {
60+ spacing: units.gu(2)
61+
62+ Label {
63+ visible: text != ""
64+ fontSize: "medium"
65+ opacity: 0.6
66+ color: "white"
67+ text: previewData.subtitle
68+ style: Text.Raised
69+ styleColor: "black"
70+ wrapMode: Text.WordWrap
71+ }
72+
73+ Label {
74+ visible: text != ""
75+ fontSize: "small"
76+ opacity: 0.6
77+ color: "white"
78+ text: previewData.description
79+ style: Text.Raised
80+ styleColor: "black"
81+ wrapMode: Text.WordWrap
82+ }
83+ }
84+}
Dash/GenericScopeView.qml+119
@@ -22,6 +22,7 @@ import "../Components/IconUtil.js" as IconUtil
2222
2323ScopeView {
2424 id: scopeView
25+ property alias previewShown: previewLoader.onScreen
2526
2627 onIsCurrentChanged: {
2728 pageHeader.resetSearch();
@@ -47,6 +48,8 @@ ScopeView {
4748 id: categoryView
4849 anchors.fill: parent
4950 model: scopeView.categories
51+ forceNoClip: previewLoader.onScreen
52+
5053 onAtYEndChanged: if (atYEnd) endReached()
5154 onMovingChanged: if (moving && atYEnd) endReached()
5255
@@ -75,7 +78,32 @@ ScopeView {
7578 text: title
7679 imageWidth: units.gu(11)
7780 imageHeight: units.gu(16)
81+
7882 source: IconUtil.from_gicon(icon)
83+
84+ MouseArea {
85+ anchors {
86+ fill: parent
87+ }
88+ onClicked: {
89+ mouse.accepted = true
90+ effect.positionPx = mapToItem(categoryView, 0, 0).y
91+ scopeView.scope.activate(uri, icon,
92+ category, 0,
93+ mimetype, title,
94+ comment, dndUri,
95+ metadata)
96+ }
97+ onPressAndHold: {
98+ mouse.accepted = true
99+ effect.positionPx = mapToItem(categoryView, 0, 0).y
100+ scopeView.scope.preview(uri, icon,
101+ category, 0,
102+ mimetype, title,
103+ comment, dndUri,
104+ metadata)
105+ }
106+ }
79107 }
80108 }
81109 }
@@ -93,4 +121,95 @@ ScopeView {
93121 searchEntryEnabled: true
94122 }
95123 }
124+
125+ OpenEffect {
126+ id: effect
127+ anchors {
128+ fill: parent
129+ bottomMargin: -bottomOverflow
130+ }
131+ sourceItem: categoryView
132+
133+ enabled: gap > 0.0
134+
135+ topGapPx: (1 - gap) * positionPx
136+ topOpacity: (1 - gap * 1.2)
137+ bottomGapPx: positionPx + gap * (targetBottomGapPx - positionPx)
138+ bottomOverflow: units.gu(20)
139+ bottomOpacity: 1 - (gap * 0.8)
140+
141+ property int targetBottomGapPx: height - units.gu(8) - bottomOverflow
142+ property real gap: previewLoader.open ? 1.0 : 0.0
143+
144+ Behavior on gap {
145+ NumberAnimation {
146+ duration: 200
147+ easing.type: Easing.InOutQuad
148+ onRunningChanged: {
149+ if (!previewLoader.open && !running) {
150+ previewLoader.onScreen = false
151+ }
152+ }
153+ }
154+ }
155+ }
156+
157+ Connections {
158+ target: scopeView.scope
159+ onPreviewReady: {
160+ previewLoader.previewData = preview
161+ previewLoader.open = true
162+ }
163+ }
164+
165+ PreviewDelegateMapper {
166+ id: previewDelegateMapper
167+ }
168+
169+ Connections {
170+ ignoreUnknownSignals: true
171+ target: previewLoader.valid ? previewLoader.item : null
172+ onClose: {
173+ previewLoader.open = false
174+ }
175+ }
176+
177+ Loader {
178+ id: previewLoader
179+ property var previewData
180+ height: effect.bottomGapPx - effect.topGapPx
181+ anchors {
182+ top: parent.top
183+ topMargin: effect.topGapPx
184+ left: parent.left
185+ right: parent.right
186+ }
187+ source: onScreen ? previewDelegateMapper.map(previewLoader.previewData.rendererName) : ""
188+
189+ property bool open: false
190+ property bool onScreen: false
191+ property bool valid: item !== null
192+
193+ onOpenChanged: {
194+ if (open) {
195+ onScreen = true
196+ }
197+ }
198+
199+ onLoaded: {
200+ item.previewData = previewLoader.previewData
201+ }
202+ }
203+
204+ // TODO: Move as InverseMouseArea to DashPreview
205+ MouseArea {
206+ enabled: previewLoader.onScreen
207+ anchors {
208+ fill: parent
209+ topMargin: effect.bottomGapPx
210+ }
211+ onClicked: {
212+ previewLoader.open = false;
213+ }
214+ }
96215}
Dash/PreviewDelegateMapper.qmlnew file+34
@@ -0,0 +1,34 @@
1+/*
2+ * Copyright (C) 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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+QtObject {
20+ property var d: QtObject {
21+ readonly property string genericPreview: "Generic/GenericPreview.qml"
22+ property var previewDelegateMapping: {"preview-generic": genericPreview,
23+ }
24+ }
25+
26+ function map(rendererName) {
27+ var customPreview = d.previewDelegateMapping[rendererName]
28+ if (customPreview != undefined) {
29+ return customPreview
30+ }
31+ console.debug("Renderer "+rendererName+" not found, using preview-generic")
32+ return d.genericPreview
33+ }
34+}
Launcher/Launcher.qml+2−5
@@ -19,6 +19,7 @@ import "../Components"
1919import Ubuntu.Components 0.1
2020import Ubuntu.Gestures 0.1
2121import Unity 0.1
22+import Unity.Launcher 0.1
2223
2324Item {
2425 id: root
@@ -96,10 +97,6 @@ Item {
9697 }
9798 }
9899
99− LauncherModel {
100− id: launcherModel
101− }
102−
103100 MouseArea {
104101 id: launcherDragArea
105102 enabled: root.state == "visible"
@@ -152,7 +149,7 @@ Item {
152149 bottom: parent.bottom
153150 }
154151 x: -width
155− model: launcherModel
152+ model: LauncherModel
156153
157154 property bool animate: true
158155
Launcher/LauncherPanel.qml+3−2
@@ -17,6 +17,7 @@
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import Unity 0.1
20+import Unity.Launcher 0.1
2021import "../Components/ListItems"
2122
2223Item {
@@ -140,7 +141,7 @@ Item {
140141 } else if (angle < -12) {
141142 launcherListView.flick(0, launcherListView.clickFlickSpeed);
142143 } else {
143− root.applicationSelected(launcherModel.get(index).desktopFile);
144+ root.applicationSelected(LauncherModel.get(index).desktopFile);
144145 }
145146 return;
146147 }
@@ -151,7 +152,7 @@ Item {
151152 } else if (angle < -30) {
152153 launcherListView.flick(0, launcherListView.clickFlickSpeed);
153154 } else {
154− root.applicationSelected(launcherModel.get(index).desktopFile);
155+ root.applicationSelected(LauncherModel.get(index).desktopFile);
155156 }
156157 }
157158 }
Panel/IndicatorItem.qml+22−35
@@ -16,55 +16,42 @@
1616
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
19+import Unity.Indicators 0.1 as Indicators
1920
2021Item {
2122 id: indicatorItem
2223
23− property alias iconSource: itemImage.source
24− property alias label: itemLabel.text
24+ property alias widgetSource: loader.source
2525 property bool highlighted: false
2626 property bool dimmed: false
27+ property var indicatorProperties: undefined
28+
29+ opacity: dimmed ? 0.4 : 1
2730
2831 // only visible when non-empty
29− visible: label != "" || iconSource != ""
30− width: itemRow.width + units.gu(1)
32+ visible: loader.item != undefined && loader.status == Loader.Ready ? loader.item.enabled : false
33+ width: visible ? loader.item.width : 0
34+
35+ Loader {
36+ id: loader
37+
38+ onLoaded: {
39+ item.height = Qt.binding(function() { return indicatorItem.height; });
40+
41+ for(var pName in indicatorProperties) {
42+ if (item.hasOwnProperty(pName)) {
43+ item[pName] = indicatorProperties[pName];
44+ }
45+ }
46+ }
47+ }
3148
3249 Rectangle {
3350 color: Theme.palette.selected.foreground
51+ objectName: "highlight"
3452 height: units.dp(2)
3553 width: parent.width
3654 anchors.top: parent.bottom
3755 visible: highlighted
3856 }
39−
40− Row {
41− id: itemRow
42− objectName: "itemRow"
43− anchors {
44− top: parent.top
45− bottom: parent.bottom
46− horizontalCenter: parent.horizontalCenter
47− }
48− spacing: units.gu(0.5)
49− opacity: dimmed ? 0.4 : 1
50−
51− Image {
52− id: itemImage
53− objectName: "itemImage"
54− visible: source != ""
55− height: units.gu(2.5)
56− width: units.gu(2.5)
57− anchors.verticalCenter: parent.verticalCenter
58− }
59−
60− Label {
61− id: itemLabel
62− objectName: "itemLabel"
63− color: Theme.palette.selected.backgroundText
64− opacity: 0.8
65− font.family: "Ubuntu"
66− fontSize: "medium"
67− anchors.verticalCenter: parent.verticalCenter
68− }
69− }
7057}
Panel/IndicatorRow.qml+5−3
@@ -21,7 +21,7 @@ Item {
2121 id: indicatorRow
2222
2323 property QtObject currentItem : null
24− property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
24+ readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
2525 property alias row: row
2626 property QtObject indicatorsModel: null
2727 property bool overviewActive: false // "state of the menu"
@@ -54,13 +54,15 @@ Item {
5454 id: rowRepeater
5555 objectName: "rowRepeater"
5656 model: indicatorsModel ? indicatorsModel : undefined
57+
5758 IndicatorItem {
5859 id: indicatorItem
5960
6061 property int ownIndex: index
6162
62− label: model.label
63− iconSource: model.iconSource
63+ widgetSource: model.widgetSource
64+
65+ indicatorProperties : model.indicatorProperties
6466 highlighted: indicatorRow.state == "reveal" || indicatorRow.state == "locked" || indicatorRow.state == "commit" ? ownIndex == indicatorRow.currentItemIndex : false
6567 dimmed: { //See FIXME in Indicators regarding the "states" change
6668 if (indicatorRow.state == "initial" || indicatorRow.state == "") {
Panel/Indicators.qml+3−7
@@ -17,7 +17,6 @@
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import Ubuntu.Gestures 0.1
20−import Ubuntu.ChewieUI 0.1 as ChewieUI
2120
2221import "../Components"
2322import "../Components/ListItems"
@@ -70,8 +69,7 @@ Showable {
7069 // we dont want to switch to a indicator menu until we hit reveal state.
7170 if (menuContent.overviewActive) {
7271 menuContent.showOverview()
73− }
74− else {
72+ } else {
7573 menuContent.showMenu()
7674 }
7775 indicators.state = "locked"
@@ -272,9 +270,8 @@ Showable {
272270
273271 }
274272
275− ChewieUI.PluginModel {
273+ IndicatorsDataModel {
276274 id: indicatorsModel
277− Component.onCompleted: load()
278275 }
279276
280277 Connections {
@@ -294,8 +291,7 @@ Showable {
294291 if (showAnimation.running) {
295292 if (indicators.state == "initial") {
296293 openOverview()
297− }
298− else {
294+ } else {
299295 indicators.calculateCurrentItem(dragHandle.touchX, false)
300296 menuContent.showMenu()
301297 }
Panel/Indicators/DatetimeIndicatorPage.qmlnew file+97
@@ -0,0 +1,97 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Ubo Riboni <ugo.riboni@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+
24+Flickable {
25+ id: page
26+
27+ contentHeight: image.height
28+
29+ Image {
30+ id: image
31+ anchors {
32+ left: parent.left
33+ right: parent.right
34+ }
35+ source: "../graphics/time_and_date@18.png"
36+ fillMode: Image.PreserveAspectFit
37+ }
38+
39+ Item {
40+ anchors {
41+ top: parent.top
42+ topMargin: units.gu(5)
43+ left: parent.left
44+ right: parent.right
45+ }
46+
47+ height: units.gu(30)
48+
49+ Label {
50+ id: timeLabel
51+ anchors {
52+ horizontalCenter: parent.horizontalCenter
53+ verticalCenter: parent.verticalCenter
54+ }
55+
56+ text: ""
57+ color: Theme.palette.selected.backgroundText
58+ font.weight: Font.Light
59+ font.pixelSize: units.gu(6)
60+ }
61+
62+ Label {
63+ id: dateLabel
64+
65+ anchors {
66+ left: parent.left
67+ leftMargin: units.gu(2)
68+ bottom: parent.bottom
69+ bottomMargin: units.gu(1.5)
70+ }
71+ text: ""
72+ color: Theme.palette.selected.backgroundText
73+ fontSize: "small"
74+ }
75+ }
76+
77+ Timer {
78+ interval: 1000 * 10 // 10 seconds
79+ running: true
80+ repeat: true
81+ triggeredOnStart: true
82+ onTriggered: updateTime();
83+ }
84+
85+ function updateTime() {
86+ var dt = new Date();
87+ var time = Qt.formatTime(dt);
88+ var space = time.indexOf(" ");
89+ timeLabel.text = time.substr(0, space > 0 ? space : 5);
90+ dateLabel.text = Qt.formatDateTime(dt, "dddd,\ndd MMMM");
91+ }
92+
93+ // Make it compatible with the PluginItem interface
94+ function start() {}
95+ function stop() {}
96+ function reset() {}
97+}
Panel/Indicators/DatetimeIndicatorWidget.qmlnew file+65
@@ -0,0 +1,65 @@
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 Unity.Indicators 0.1 as Indicators
23+
24+Indicators.IndicatorWidget {
25+ id: indicatorWidget
26+
27+ width: timeLabel.width + units.gu(1)
28+
29+ property alias label: timeLabel.text
30+
31+ Label {
32+ id: timeLabel
33+ objectName: "timeLabel"
34+ color: Theme.palette.selected.backgroundText
35+ opacity: 0.8
36+ font.family: "Ubuntu"
37+ fontSize: "medium"
38+ anchors.centerIn: parent
39+ text: Qt.formatTime(timer.dateNow)
40+ }
41+
42+ Timer {
43+ id: timer
44+ interval: 1000 * 10
45+ running: indicatorWidget.visible
46+ repeat: true
47+ triggeredOnStart: true
48+ property date dateNow
49+
50+ onTriggered: dateNow = new Date
51+ }
52+
53+ onActionStateChanged: {
54+ if (action == undefined || !action.valid) {
55+ return;
56+ }
57+
58+ if (action.state == undefined) {
59+ visible = false;
60+ return;
61+ }
62+
63+ indicatorWidget.visible = action.state[3];
64+ }
65+}
Panel/Indicators/DefaultIndicatorPage.qmlnew file+25
@@ -0,0 +1,25 @@
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 Unity.Indicators 0.1 as Indicators
22+
23+Indicators.IndicatorPage {
24+ anchors.fill: parent
25+}
Panel/Indicators/DefaultIndicatorWidget.qmlnew file+80
@@ -0,0 +1,80 @@
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 Unity.Indicators 0.1 as Indicators
23+
24+Indicators.IndicatorWidget {
25+ id: indicatorWidget
26+
27+ width: itemRow.width + units.gu(1)
28+
29+ property alias label: itemLabel.text
30+ property alias iconSource: itemImage.source
31+
32+ Row {
33+ id: itemRow
34+ objectName: "itemRow"
35+ anchors {
36+ top: parent.top
37+ bottom: parent.bottom
38+ horizontalCenter: parent.horizontalCenter
39+ }
40+ spacing: units.gu(0.5)
41+
42+ // FIXME : Should us Ubuntu.Icon . results in low res images
43+ Image {
44+ id: itemImage
45+ objectName: "itemImage"
46+ visible: source != ""
47+ height: indicatorWidget.iconSize
48+ width: indicatorWidget.iconSize
49+ anchors.verticalCenter: parent.verticalCenter
50+ }
51+
52+ Label {
53+ id: itemLabel
54+ objectName: "itemLabel"
55+ color: Theme.palette.selected.backgroundText
56+ opacity: 0.8
57+ font.family: "Ubuntu"
58+ fontSize: "medium"
59+ anchors.verticalCenter: parent.verticalCenter
60+ visible: text != ""
61+ }
62+ }
63+
64+ onActionStateChanged: {
65+ if (action == undefined || !action.valid) {
66+ return;
67+ }
68+
69+ if (action.state == undefined) {
70+ label = "";
71+ iconSource = "";
72+ enabled = false;
73+ return;
74+ }
75+
76+ label = action.state[Indicators.ActionState.Label];
77+ iconSource = "image://gicon/" + action.state[Indicators.ActionState.IconSource];
78+ enabled = action.state[Indicators.ActionState.Visible];
79+ }
80+}
Panel/Indicators/MessagingIndicatorPage.qmlnew file+35
@@ -0,0 +1,35 @@
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 Unity.Indicators 0.1 as Indicators
23+
24+Indicators.IndicatorPage {
25+ anchors.fill: parent
26+
27+ highlightFollowsCurrentItem: false
28+ emptyText: "You have no more outstanding messages."
29+
30+ function stop() {
31+ // never stops the service
32+ // this will keep all objects in memory, consume more memory
33+ // but will optimize the menu contruction on the screen
34+ }
35+}
Panel/Indicators/MessagingIndicatorWidget.qmlnew file+25
@@ -0,0 +1,25 @@
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+
22+DefaultIndicatorWidget {
23+ // default the icon so we have something to show when we don't have the bus.
24+ iconSource: "image://gicon/indicator-messages"
25+}
Panel/Indicators/NetworkIndicatorPage.qmlnew file+79
@@ -0,0 +1,79 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Unity.Indicators 0.1 as Indicators
22+import Unity.Indicators.Network 0.1 as ICNetwork
23+import Ubuntu.Components 0.1
24+
25+PageStack {
26+ id: _network
27+
28+ property alias title: _mainPage.title
29+ property alias emptyText: _pluginItem.emptyText
30+ property alias busType: _pluginItem.busType
31+ property alias busName: _pluginItem.busName
32+ property alias actionsObjectPath : _pluginItem.actionsObjectPath
33+ property alias menuObjectPaths : _pluginItem.menuObjectPaths
34+
35+ __showHeader: false
36+ anchors.fill: parent
37+
38+ Page {
39+ id: _mainPage
40+
41+ Indicators.IndicatorPage {
42+ id: _pluginItem
43+ anchors.fill: parent
44+ }
45+ }
46+
47+ Component {
48+ id: passwordPageComponent
49+
50+ ICNetwork.PasswordPage {
51+ agent: networkAgent
52+ }
53+ }
54+
55+ ICNetwork.NetworkAgent {
56+ id: networkAgent
57+
58+ onSecretRequested: {
59+ _network.push(passwordPageComponent, {"token": token});
60+ }
61+ }
62+
63+ function start()
64+ {
65+ push(_mainPage);
66+ _pluginItem.start();
67+ }
68+
69+ function stop()
70+ {
71+ clear();
72+ _pluginItem.stop();
73+ }
74+
75+ function reset()
76+ {
77+ _pluginItem.reset();
78+ }
79+}
Panel/Indicators/NetworkIndicatorWidget.qmlnew file+109
@@ -0,0 +1,109 @@
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 Unity.Indicators 0.1 as Indicators
23+
24+Indicators.IndicatorWidget {
25+ id: indicatorWidget
26+
27+ width: networkIcon.width + units.gu(1)
28+
29+ property int signalStrength: 0
30+ property int connectionState: Indicators.NetworkConnection.Initial
31+ rootMenuType: "com.canonical.indicator.root.network"
32+
33+ // FIXME : Should us Ubuntu.Icon . results in low res images
34+ Image {
35+ id: networkIcon
36+ objectName: "itemImage"
37+ source: get_icon_for_signal(connectionState, signalStrength)
38+ visible: source != ""
39+ height: indicatorWidget.iconSize
40+ width: indicatorWidget.iconSize
41+ anchors.centerIn: parent
42+ }
43+
44+ onActionStateChanged: {
45+ if (action == undefined || !action.valid) {
46+ return;
47+ }
48+
49+ if (action.state == undefined) {
50+ connectionState = 0;
51+ return;
52+ }
53+
54+ connectionState = action.state[Indicators.NetworkActionState.Connection];
55+ if (connectionState == Indicators.NetworkConnection.Activated) {
56+ signalStrength = action.state[Indicators.NetworkActionState.SignalStrength];
57+ }
58+ }
59+
60+ NumberAnimation {
61+ id: activation_animation
62+ target: indicatorWidget
63+ property: "signalStrength"
64+ from: 0
65+ to: 100
66+ duration: 2500 // 5 states in 2.5 seconds
67+ loops: Animation.Infinite
68+ }
69+
70+ states: [
71+ State {
72+ name: "unknown"
73+ when: connectionState < Indicators.NetworkConnection.Activating || connectionState > Indicators.NetworkConnection.Deactivating
74+ PropertyChanges { target: activation_animation; running: false }
75+ },
76+ State {
77+ name: "activating"
78+ when: connectionState == Indicators.NetworkConnection.Activating
79+ PropertyChanges { target: activation_animation; running: true }
80+ },
81+ State {
82+ name: "activated"
83+ when: connectionState == Indicators.NetworkConnection.Activated
84+ PropertyChanges { target: activation_animation; running: false }
85+ },
86+ State {
87+ name: "deactivating"
88+ when: connectionState == Indicators.NetworkConnection.Deactivating
89+ PropertyChanges { target: activation_animation; running: true }
90+ }
91+ ]
92+
93+
94+ function get_icon_for_signal(con_state, value) {
95+ if (con_state >= Indicators.NetworkConnection.Activating && con_state <= Indicators.NetworkConnection.Deactivating) {
96+ if (value == 0) {
97+ return "image://gicon/nm-signal-00";
98+ } else if (value <= 25) {
99+ return "image://gicon/nm-signal-25";
100+ } else if (value <= 50) {
101+ return "image://gicon/nm-signal-50";
102+ } else if (value <= 75) {
103+ return "image://gicon/nm-signal-75";
104+ }
105+ return "image://gicon/nm-signal-100";
106+ }
107+ return "image://gicon/wifi-none";
108+ }
109+}
Panel/Indicators/SoundIndicatorWidget.qmlnew file+25
@@ -0,0 +1,25 @@
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+
22+DefaultIndicatorWidget {
23+ // default the icon so we have something to show when we don't have the bus.
24+ iconSource: "image://gicon/audio-volume-high"
25+}
Panel/Indicators/client/IndicatorsClient.qmlnew file+42
@@ -0,0 +1,42 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
23+
24+Rectangle {
25+ color: "black"
26+ id: root
27+
28+ PageStack {
29+ id: pages
30+
31+ anchors.fill: parent
32+ Component.onCompleted: root.reset()
33+ }
34+
35+ function reset() {
36+ pages.clear();
37+ var component = Qt.createComponent("IndicatorsList.qml");
38+ var page = component.createObject(pages);
39+ console.log(component.errorString());
40+ pages.push(page);
41+ }
42+}
Panel/Indicators/client/IndicatorsList.qmlnew file+62
@@ -0,0 +1,62 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
23+import Unity.Indicators 0.1 as Indicators
24+import "../.."
25+
26+Page {
27+ id: page
28+ anchors.fill: parent
29+ title: "Plugin list"
30+
31+ IndicatorsDataModel {
32+ id: indicatorsModel
33+ }
34+
35+ ListView {
36+ id: mainMenu
37+ objectName: "mainMenu"
38+ anchors.fill: parent
39+ model: indicatorsModel
40+
41+ delegate: Indicators.MenuItem {
42+ anchors.left: parent.left
43+ anchors.right: parent.right
44+ progression: isValid
45+ objectName: identifier
46+
47+ Label {
48+ anchors.left: parent.left
49+ anchors.leftMargin: units.gu(0.5)
50+ anchors.verticalCenter: parent.verticalCenter
51+ text: title
52+ }
53+
54+ onClicked: {
55+ if (progression) {
56+ var new_page = Qt.createComponent("IndicatorsPage.qml");
57+ page.pageStack.push(new_page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource});
58+ }
59+ }
60+ }
61+ }
62+}
Panel/Indicators/client/IndicatorsPage.qmlnew file+49
@@ -0,0 +1,49 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+Page {
24+ id: _page
25+
26+ title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title : ""
27+ property variant indicatorProperties
28+ property alias pageSource : page_loader.source
29+
30+ anchors.fill: parent
31+
32+ Loader {
33+ id: page_loader
34+ objectName: "page_loader"
35+
36+ anchors.fill: parent
37+
38+ onStatusChanged: {
39+ if (status == Loader.Ready) {
40+ for(var pName in indicatorProperties) {
41+ if (item.hasOwnProperty(pName)) {
42+ item[pName] = indicatorProperties[pName];
43+ }
44+ }
45+ item.start();
46+ }
47+ }
48+ }
49+}
Panel/IndicatorsDataModel.qmlnew file+66
@@ -0,0 +1,66 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Unity.Indicators 0.1 as Indicators
22+import Utils 0.1
23+
24+Indicators.IndicatorsModel {
25+ id: ic_model
26+
27+ Component.onCompleted: load()
28+
29+ indicatorData : {
30+ 'indicator-messaging' : {
31+ 'title': 'Messaging',
32+ 'description' : '',
33+ 'priority': 10,
34+ 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/MessagingIndicatorWidget.qml',
35+ 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/MessagingIndicatorPage.qml'
36+ },
37+ 'indicator-sound' : {
38+ 'title': 'Sound',
39+ 'description' : '',
40+ 'priority': 20,
41+ 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/SoundIndicatorWidget.qml',
42+ 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage.qml'
43+ },
44+ 'indicator-network' : {
45+ 'title': 'Networks',
46+ 'description' : '',
47+ 'priority': 30,
48+ 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorWidget.qml',
49+ 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorPage.qml'
50+ },
51+ 'indicator-battery' : {
52+ 'title': 'Battery',
53+ 'description' : '',
54+ 'priority': 40,
55+ 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget.qml',
56+ 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage.qml'
57+ },
58+ 'indicator-time' : {
59+ 'title': 'Date and Time',
60+ 'description' : '',
61+ 'priority': 100,
62+ 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DatetimeIndicatorWidget.qml',
63+ 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DatetimeIndicatorPage.qml'
64+ }
65+ }
66+}
Panel/MenuContent.qml+18−21
@@ -16,6 +16,7 @@
1616
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
19+import Unity.Indicators 0.1 as Indicators
1920import "Menus"
2021import "../Components"
2122
@@ -28,8 +29,8 @@ Rectangle {
2829 property bool __shown: false
2930 property bool __contentActive: false
3031 property alias currentIndex : menus.currentIndex
31− property color backgroundColor: "#221e1c"
32− property int contentReleaseInterval: 5000
32+ property color backgroundColor: "#221e1c" // FIXME not in palette yet
33+ property int contentReleaseInterval: 20000
3334
3435 width: units.gu(40)
3536 height: units.gu(42)
@@ -94,7 +95,7 @@ Rectangle {
9495
9596 width: menus.width
9697 height: menus.height
97− sourceComponent: component
98+ source: pageSource
9899 visible: content.__shown
99100 onVisibleChanged: {
100101 // Reset the indicator states
@@ -104,25 +105,15 @@ Rectangle {
104105 }
105106 asynchronous: true
106107
107− onStatusChanged: {
108− if (status == Loader.Ready) {
109− if (indicatorsModel.widgetsMap && item.hasOwnProperty("widgetsMap")) {
110− item["widgetsMap"] = indicatorsModel.widgetsMap
111− }
112− for(var pName in initialProperties) {
113− if (item.hasOwnProperty(pName)) {
114− item[pName] = initialProperties[pName]
115− }
116− }
117− if (contentActive && menus.visible) {
118− item.start()
108+ onLoaded: {
109+ for(var pName in indicatorProperties) {
110+ if (item.hasOwnProperty(pName)) {
111+ item[pName] = indicatorProperties[pName]
119112 }
120113 }
121− }
122−
123− // FIXME: QTBUG-30632 - asynchronous loader crashes when changing index quickly.
124− Component.onDestruction: {
125− active = false;
114+ if (contentActive && menus.visible) {
115+ item.start()
116+ }
126117 }
127118
128119 // Need to use a binding because the handle height changes.
@@ -189,7 +180,13 @@ Rectangle {
189180 left: parent.left
190181 right: parent.right
191182 }
192− text: content.overviewActive ? i18n.tr("Device") : (indicatorsModel && menus.currentIndex >= 0 && menus.currentIndex < indicatorsModel.count) ? indicatorsModel.get(menus.currentIndex).title : ""
183+ text: {
184+ if (content.overviewActive)
185+ return i18n.tr("Device");
186+ if (indicatorsModel && menus.currentIndex >= 0 && menus.currentIndex < indicatorsModel.count)
187+ return indicatorsModel.data(menus.currentIndex, Indicators.IndicatorsModelRole.Title);
188+ return "";
189+ }
193190 opacity: __shown ? 1 : 0
194191 Behavior on opacity {NumberAnimation{duration: 100}}
195192 }
Panel/Menus/Overview/OverviewGrid.qml+15−24
@@ -59,31 +59,22 @@ Item {
5959 objectName: "overviewGridButton" + index
6060 width: grid.cellWidth
6161 height: grid.cellHeight
62− Image {
63− id: imageIcon
64− objectName: "overviewGridButtonImage"
65− source: iconSource
66− width: units.gu(4)
67− height: units.gu(4)
68− anchors {
69− centerIn: parent
70− verticalCenterOffset: -units.gu(1)
71− }
72− sourceSize.width: width
73− sourceSize.height: height
74− visible: labelIcon.text === ""
75− }
7662
77− Label {
78− id: labelIcon
79− text: label
80− color: Theme.palette.selected.backgroundText
81− opacity: 0.8
82− font.family: "Ubuntu"
83− fontSize: "large"
84− anchors {
85− centerIn: parent
86− verticalCenterOffset: -units.gu(1)
63+ Loader {
64+ id: loader
65+ source: widgetSource
66+
67+ width: units.gu(5)
68+ height: units.gu(5)
69+ anchors.centerIn: parent
70+ anchors.verticalCenterOffset: -units.gu(1)
71+
72+ onLoaded: {
73+ for(var pName in indicatorProperties) {
74+ if (item.hasOwnProperty(pName)) {
75+ item[pName] = indicatorProperties[pName]
76+ }
77+ }
8778 }
8879 }
8980
Panel/graphics/time_and_date@18.pngnew file

Binary file not shown.

Shell.qml−3
@@ -265,9 +265,6 @@ FocusScope {
265265 function show() {
266266 stages.show();
267267 }
268− function showWithoutAnimation() {
269− stages.showWithoutAnimation();
270− }
271268 function hide() {
272269 }
273270
build+2−5
@@ -36,17 +36,14 @@ BUILD_TYPE="debug"
3636[ $# -eq 1 ] && BUILD_TYPE="$1"
3737
3838install_dependencies() {
39− [ -f /etc/apt/sources.list.d/phablet-team-desktop-deps-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:phablet-team/desktop-deps || exit 1
40− [ -f /etc/apt/sources.list.d/canonical-qt5-edgers-qt5-proper-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-proper || exit 2;
41− [ -f /etc/apt/sources.list.d/ubuntu-sdk-team-ppa-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:ubuntu-sdk-team/ppa || exit 3
39+ [ -f /etc/apt/sources.list.d/ubuntu-unity-next-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:ubuntu-unity/next || exit 1
4240 sudo apt-get update || exit 4
4341 echo "Installing Unity 8 dependencies.."
4442 sudo apt-get install devscripts \
4543 equivs \
44+ qmenumodel-qml \
4645 qtdeclarative5-ubuntu-ui-toolkit-plugin \
4746 qtdeclarative5-dee-plugin \
48− indicators-client \
49− indicators-client-plugin-* \
5047 ubuntu-mobile-icons \
5148 unity-notifications-impl-1 \
5249 unity-scope-home \
cmake/modules/Plugins.cmake+25−15
@@ -1,17 +1,12 @@
1−# Creates targets for copying and installing qmlfiles and generating the qmltypes file for a plugin
1+# Creates target for copying and installing qmlfiles
22#
3−# export_qmlplugin(plugin version sub_path [TARGETS target1 [target2 ...]])
3+# export_qmlfiles(plugin sub_path)
44#
5−# TARGETS additional install targets (eg the plugin shared object)
65#
7−# Two targets will be created:
6+# Target to be created:
87# - plugin-qmlfiles - Copies the qml files (*.qml, *.js, qmldir) into the shadow build folder.
9−# - plugin-qmltypes - Generates the qmltypes file in the shadow build folder.
10−
118
12−macro(export_qmlplugin PLUGIN VERSION PLUGIN_SUBPATH)
13− set(multi_value_keywords TARGETS)
14− cmake_parse_arguments(qmlplugin "" "" "${multi_value_keywords}" ${ARGN})
9+macro(export_qmlfiles PLUGIN PLUGIN_SUBPATH)
1510
1611 file(GLOB QMLFILES
1712 *.qml
@@ -25,17 +20,32 @@ macro(export_qmlplugin PLUGIN VERSION PLUGIN_SUBPATH)
2520 DEPENDS ${QMLFILES}
2621 )
2722
23+ # install the qmlfiles file.
24+ install(FILES ${QMLFILES}
25+ DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
26+ )
27+endmacro(export_qmlfiles)
28+
29+
30+# Creates target for generating the qmltypes file for a plugin and installs plugin files
31+#
32+# export_qmlplugin(plugin version sub_path [TARGETS target1 [target2 ...]])
33+#
34+# TARGETS additional install targets (eg the plugin shared object)
35+#
36+# Target to be created:
37+# - plugin-qmltypes - Generates the qmltypes file in the shadow build folder.
38+
39+macro(export_qmlplugin PLUGIN VERSION PLUGIN_SUBPATH)
40+ set(multi_value_keywords TARGETS)
41+ cmake_parse_arguments(qmlplugin "" "" "${multi_value_keywords}" ${ARGN})
42+
2843 # create the plugin.qmltypes file
2944 add_custom_target(${PLUGIN}-qmltypes ALL
3045 COMMAND qmlplugindump -notrelocatable ${PLUGIN} ${VERSION} ${CMAKE_BINARY_DIR}/plugins > ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}/plugin.qmltypes
3146 )
3247 add_dependencies(${PLUGIN}-qmltypes ${PLUGIN}-qmlfiles ${qmlplugin_TARGETS})
3348
34− # install the qmldir file.
35− install(FILES ${QMLFILES}
36− DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
37− )
38−
3949 # install the qmltypes file.
4050 install(FILES ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}/plugin.qmltypes
4151 DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
@@ -45,4 +55,4 @@ macro(export_qmlplugin PLUGIN VERSION PLUGIN_SUBPATH)
4555 install(TARGETS ${qmlplugin_TARGETS}
4656 DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
4757 )
48−endmacro(export_qmlplugin)
58+endmacro(export_qmlplugin)
cmake/modules/autopilot.cmake+7−4
@@ -1,7 +1,10 @@
11add_custom_target(autopilot)
22
3−function(declare_autopilot_test TEST_NAME WORKING_DIR)
4− add_custom_command(TARGET autopilot
5− COMMAND autopilot run ${TEST_NAME}
6− WORKING_DIRECTORY ${WORKING_DIR})
3+function(declare_autopilot_test TEST_NAME TEST_SUITE WORKING_DIR)
4+ add_custom_target(autopilot-${TEST_NAME}
5+ COMMAND autopilot run ${TEST_SUITE}
6+ WORKING_DIRECTORY ${WORKING_DIR}
7+ )
8+
9+ add_dependencies(autopilot autopilot-${TEST_NAME})
710endfunction()
debian/changelog+80
@@ -1,3 +1,83 @@
1+unity8 (7.81.3+13.10.20130717ubuntu.unity.next-0ubuntu1) saucy; urgency=low
2+
3+ [ Daniel d'Andrada ]
4+ * Remove dead code: Showable::showWithoutAnimation.
5+
6+ [ Nick Dedekind ]
7+ * Split Plugins export macro into export_qmlfiles and
8+ export_qmlplugins. Added qmltypes to indicators plugin.
9+
10+ [ Ubuntu daily release ]
11+ * Automatic snapshot from revision 112 (ubuntu-unity/next)
12+
13+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 17 Jul 2013 03:14:49 +0000
14+
15+unity8 (7.81.3+13.10.20130716ubuntu.unity.next-0ubuntu1) saucy; urgency=low
16+
17+ [ Pete Woods ]
18+ * Rename the demo user "single" to "phablet" Fix the infographics on
19+ the device At the moment the mock lightdm backend we are using says
20+ the current user is called "single", while in reality the processes
21+ all run as the "phablet" user.
22+
23+ [ Michał Sawicz ]
24+ * Only use ppa:ubuntu-unity/next and clean build scripts and CODING,
25+ accordingly.
26+ * Do not recommend indicator-power and indicator-sound. On device
27+ they're provided by lp:indicator-server for the time being.
28+ * Fix the Network page to provide the correct token. (LP: #1201529)
29+
30+ [ Ubuntu daily release ]
31+ * Automatic snapshot from revision 109 (ubuntu-unity/next)
32+
33+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 16 Jul 2013 02:32:03 +0000
34+
35+unity8 (7.81.3+13.10.20130714ubuntu.unity.next-0ubuntu1) saucy; urgency=low
36+
37+ [ Michael Terry ]
38+ * Change Ok to OK. (LP: #1131842)
39+
40+ [ Ubuntu daily release ]
41+ * Automatic snapshot from revision 104 (ubuntu-unity/next)
42+
43+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Sun, 14 Jul 2013 02:31:57 +0000
44+
45+unity8 (7.81.3+13.10.20130712ubuntu.unity.next-0ubuntu1) saucy; urgency=low
46+
47+ [ Michael Zanetti ]
48+ * Make use of the launcher API defined in unity-api and separate the
49+ model from the backend.
50+
51+ [ Michał Sawicz ]
52+ * Issue wrap-and-sort -abt on debian/.
53+
54+ [ Nick Dedekind ]
55+ * Moved indicators-client code into unity8. (LP: #1191132, #1191822)
56+
57+ [ Ubuntu daily release ]
58+ * Automatic snapshot from revision 102 (ubuntu-unity/next)
59+
60+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 12 Jul 2013 02:31:59 +0000
61+
62+unity8 (7.81.3+13.10.20130711ubuntu.unity.next-0ubuntu1) saucy; urgency=low
63+
64+ [ Michael Zanetti ]
65+ * invert the home button too in case the whole panel is inverted. (LP:
66+ #1199622)
67+
68+ [ Michał Sawicz ]
69+ * Make the OpenEffect non-live by default to improve performance. (LP:
70+ #1124584)
71+
72+ [ Ying-Chun Liu ]
73+ * Add Generic Preview. Modify GenericScopeView to support activate and
74+ preview.
75+
76+ [ Ubuntu daily release ]
77+ * Automatic snapshot from revision 98 (ubuntu-unity/next)
78+
79+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 11 Jul 2013 03:00:53 +0000
80+
181unity8 (7.81.3+13.10.20130710ubuntu.unity.next-0ubuntu1) saucy; urgency=low
282
383 [ Michael Zanetti ]
debian/control+53−36
@@ -4,22 +4,27 @@ Priority: optional
44Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
55Build-Depends: cmake,
66 debhelper (>= 9),
7− libjson-perl,
87 libdee-qt5-dev (>= 3.0),
98 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
109 libgl1-mesa-dri,
1110 libgles2-mesa-dev[armhf],
1211 libhud-client2-dev,
12+ libjson-perl,
13+ libnm-glib-dev,
14+ libnm-util-dev,
1315 libpulse-dev,
16+ libqmenumodel-dev,
1417 libqt5v8-5-private-dev,
18+ libunity-api-dev (>= 7.80.3),
1519 libunity-core-6.0-dev (<< 7.80),
1620 libunity-dev (>= 7.0.3),
21+ libunity-scopes-json-def-phone,
1722 libusermetricsoutput1-dev,
1823 libxcb1-dev,
1924 pkg-config,
20− python3,
2125 python (>= 2.7),
2226 python-setuptools,
27+ python3,
2328 qt5-default,
2429 qtbase5-dev,
2530 qtbase5-private-dev,
@@ -31,7 +36,6 @@ Build-Depends: cmake,
3136 qtdeclarative5-ubuntu-ui-toolkit-plugin,
3237 qtdeclarative5-xmllistmodel-plugin,
3338 ttf-ubuntu-font-family,
34− libunity-scopes-json-def-phone,
3539Standards-Version: 3.9.4
3640Homepage: http://launchpad.net/unity
3741# If you aren't a member of ~unity-team but need to upload
@@ -40,43 +44,56 @@ Homepage: http://launchpad.net/unity
4044Vcs-Bzr: https://code.launchpad.net/unity8
4145Vcs-Browser: https://bazaar.launchpad.net/~unity-team/unity8/trunk
4246
47+Package: indicators-client
48+Architecture: amd64 armhf i386
49+Depends: qmenumodel-qml,
50+ qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
51+ unity8 (= ${binary:Version}),
52+ ${misc:Depends},
53+ ${shlibs:Depends},
54+Description: Indicators client test application
55+ This package contains the client application for indicators used by autopilot
56+
4357Package: unity8
4458Architecture: any
45−Depends: ${misc:Depends},
46− ${shlibs:Depends},
47− unity8-private (= ${binary:Version}),
48− indicators-client (>= 0.6.1),
59+Depends: qmenumodel-qml,
4960 qtdeclarative5-dee-plugin,
5061 qtdeclarative5-ubuntu-ui-toolkit-plugin,
5162 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
52− unity-notifications-impl-1,
5363 qtdeclarative5-xmllistmodel-plugin,
64+ unity-launcher-impl-2,
65+ unity-notifications-impl-1,
5466 unity8-fake-env | qtubuntu-shell,
55−Recommends: ${unity-default-masterscopes},
56− indicators-client-plugin-datetime (>= 0.6.1),
57− indicators-client-plugin-messaging (>= 0.6.1),
58− indicators-client-plugin-network (>= 0.6.1),
59− indicators-client-plugin-power (>= 0.6.1),
60− indicators-client-plugin-sound (>= 0.6.1),
67+ unity8-private (= ${binary:Version}),
68+ unity8-private | unity-launcher-impl,
69+ ${misc:Depends},
70+ ${shlibs:Depends},
71+Recommends: indicator-battery,
72+ indicator-messages,
73+ indicator-time,
74+ ${unity-default-masterscopes},
6175Description: Unity 8 shell
6276 The Unity 8 shell is the primary user interface for Ubuntu devices.
6377
64−Package: unity8-private
65−Architecture: any
66−Multi-Arch: same
67−Pre-Depends: ${misc:Pre-Depends}
68−Depends: ${misc:Depends},
78+Package: unity8-autopilot
79+Architecture: all
80+Depends: indicators-client (>= ${source:Version}),
81+ libautopilot-qt,
82+ libqt5test5,
83+ libqt5widgets5,
84+ python-evdev,
85+ unity8 (>= ${source:Version}),
86+ unity8-fake-env (>= ${source:Version}),
87+ ${misc:Depends},
88+ ${python:Depends},
6989 ${shlibs:Depends},
70−Description: Unity 8 private libs
71− The Unity 8 shell is the primary user interface for Ubuntu devices.
72− .
73− This package contains the private libraries for QML and other components
74− only used by the shell.
90+Description: Test package for Unity 8 shell
91+ Autopilot tests for the unity8 package
7592
7693Package: unity8-fake-env
7794Architecture: any
7895Multi-Arch: same
79−Pre-Depends: ${misc:Pre-Depends}
96+Pre-Depends: ${misc:Pre-Depends},
8097Depends: ${misc:Depends},
8198 ${shlibs:Depends},
8299Provides: qtubuntu-shell,
@@ -84,16 +101,16 @@ Description: Fake environment for running Unity 8 shell
84101 Provides fake implementations of some QML modules used by Unity 8 shell
85102 (e.g Ubuntu.Application) so that you can run it in a sandboxed environment.
86103
87−Package: unity8-autopilot
88−Architecture: all
104+Package: unity8-private
105+Architecture: any
106+Multi-Arch: same
107+Pre-Depends: ${misc:Pre-Depends},
89108Depends: ${misc:Depends},
90109 ${shlibs:Depends},
91− ${python:Depends},
92− libautopilot-qt,
93− libqt5test5,
94− libqt5widgets5,
95− python-evdev,
96− unity8 (>= ${source:Version}),
97− unity8-fake-env (>= ${source:Version}),
98−Description: Test package for Unity 8 shell
99− Autopilot tests for the unity8 package
110+Provides: unity-launcher-impl,
111+ unity-launcher-impl-2,
112+Description: Unity 8 private libs
113+ The Unity 8 shell is the primary user interface for Ubuntu devices.
114+ .
115+ This package contains the private libraries for QML and other components
116+ only used by the shell.
debian/indicators-client.installnew file+1
@@ -0,0 +1 @@
1+/usr/bin/indicators-client
debian/unity8.install+1
@@ -13,3 +13,4 @@ usr/share/unity8/Panel
1313usr/share/unity8/Shell.qml
1414usr/share/unity8/SideStage
1515usr/share/unity8/graphics
16+usr/share/unity8/unity/indicators/*
main.cpp+1−2
@@ -22,6 +22,7 @@
2222#include <QtGui/QIcon>
2323#include <QtGui/QGuiApplication>
2424#include <QtQml/QQmlEngine>
25+#include <QtQml/QQmlContext>
2526#include <qpa/qplatformnativeinterface.h>
2627#include <QLibrary>
2728#include <libintl.h>
@@ -131,8 +132,6 @@ int main(int argc, char** argv)
131132 nativeInterface->setProperty("ubuntuSessionType", 1);
132133 view->setProperty("role", 2); // INDICATOR_ACTOR_ROLE
133134
134− QObject::connect(view->engine(), SIGNAL(quit()), qApp, SLOT(quit()));
135−
136135 QUrl source("Shell.qml");
137136 prependImportPaths(view->engine(), ::overrideImportPaths());
138137 appendImportPaths(view->engine(), ::fallbackImportPaths());
paths.h.in+15
@@ -23,6 +23,7 @@
2323// Qt
2424#include <QtCore/QCoreApplication>
2525#include <QtCore/QDir>
26+#include <QStandardPaths>
2627
2728inline bool isRunningInstalled() {
2829 static bool installed = (QCoreApplication::applicationDirPath() ==
@@ -65,6 +66,20 @@ inline QStringList fallbackImportPaths() {
6566 return paths;
6667}
6768
69+inline QStringList shellDataDirs() {
70+ QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
71+ if (!isRunningInstalled()) {
72+ if (getenv("UNITY_TEST_ENV")==NULL) {
73+ dirs.prepend("@CMAKE_BINARY_DIR@/share");
74+ }
75+ }
76+ else {
77+ // append so by default we use xdg files.
78+ dirs.append(shellAppDirectory());
79+ }
80+ return dirs;
81+}
82+
6883inline QString sourceDirectory() {
6984 return QString("@CMAKE_SOURCE_DIR@/");
7085}
plugins/HudClient/CMakeLists.txt+2−1
@@ -38,5 +38,6 @@ target_link_libraries(HudClientQml
3838
3939qt5_use_modules(HudClientQml Qml)
4040
41−# export the qmldir and qmltypes files
41+# export the qmldir qmltypes and plugin files
42+export_qmlfiles(HudClient HudClient)
4243export_qmlplugin(HudClient 0.1 HudClient TARGETS HudClientQml)
plugins/LightDM/CMakeLists.txt+2−1
@@ -35,5 +35,6 @@ target_link_libraries(LightDM-qml
3535
3636qt5_use_modules(LightDM-qml Gui Qml)
3737
38−# export the qmldir and qmltypes files
38+# export the qmldir qmltypes and plugin files
39+export_qmlfiles(LightDM LightDM)
3940export_qmlplugin(LightDM 0.1 LightDM TARGETS LightDM-qml)
plugins/ListViewWithPageHeader/CMakeLists.txt+2−1
@@ -33,5 +33,6 @@ target_link_libraries(ListViewWithPageHeader-qml
3333
3434qt5_use_modules(ListViewWithPageHeader-qml Qml Quick)
3535
36−# export the qmldir and qmltypes files
36+# export the qmldir qmltypes and plugin files
37+export_qmlfiles(ListViewWithPageHeader ListViewWithPageHeader)
3738export_qmlplugin(ListViewWithPageHeader 0.1 ListViewWithPageHeader TARGETS ListViewWithPageHeader-qml)
plugins/Ubuntu/Gestures/CMakeLists.txt+2−1
@@ -23,5 +23,6 @@ qt5_use_modules(UbuntuGestureQml Core Quick)
2323# So that Foo.cpp can #include "Foo.moc"
2424include_directories(${CMAKE_CURRENT_BINARY_DIR})
2525
26−# export the qmldir and qmltypes files
26+# export the qmldir qmltypes and plugin files
27+export_qmlfiles(Ubuntu.Gestures Ubuntu/Gestures)
2728export_qmlplugin(Ubuntu.Gestures 0.1 Ubuntu/Gestures TARGETS UbuntuGestureQml)
plugins/Unity/CMakeLists.txt+6−2
@@ -1,6 +1,8 @@
11# export_qmlplugin macro
22include(Plugins)
33
4+add_subdirectory(Indicators)
5+
46# Dependencies
57include(FindPkgConfig)
68pkg_check_modules(QTDEE REQUIRED libdee-qt5)
@@ -21,7 +23,6 @@ set(QMLPLUGIN_SRC
2123 categoryresults.cpp
2224 plugin.cpp
2325 bottombarvisibilitycommunicatorshell.cpp
24− launchermodel.cpp
2526 applicationpreview.cpp
2627 genericpreview.cpp
2728 moviepreview.cpp
@@ -47,5 +48,8 @@ target_link_libraries(Unity-qml
4748
4849qt5_use_modules(Unity-qml Qml)
4950
50−# export the qmldir and qmltypes files
51+# export the qmldir qmltypes and plugin files
52+export_qmlfiles(Unity Unity)
5153export_qmlplugin(Unity 0.1 Unity TARGETS Unity-qml)
54+
55+add_subdirectory(Launcher)
plugins/Unity/Indicators/CMakeLists.txtnew file+54
@@ -0,0 +1,54 @@
1+# export_qmlplugin macro
2+include(Plugins)
3+
4+project(IndicatorsQml)
5+
6+pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
7+find_package(Qt5Core REQUIRED)
8+find_package(Qt5Quick REQUIRED)
9+
10+add_subdirectory(qml)
11+add_subdirectory(Messaging)
12+add_subdirectory(Network)
13+
14+include_directories(
15+ ${CMAKE_CURRENT_SOURCE_DIR}
16+ ${CMAKE_CURRENT_BINARY_DIR}
17+ ${QMENUMODEL_INCLUDE_DIRS}
18+)
19+
20+set(IndicatorsQML_SOURCES
21+ flatmenuproxymodel.cpp
22+ indicator.cpp
23+ indicators.h
24+ indicatorsmanager.cpp
25+ indicatorsmodel.cpp
26+ plugin.cpp
27+)
28+
29+set(IndicatorsQML_RESOURCES
30+ resources/indicators.qrc
31+)
32+
33+qt5_add_resources(IndicatorsQML_RESOURCES_RCC
34+ ${IndicatorsQML_RESOURCES}
35+)
36+
37+add_library(IndicatorsQml SHARED
38+ ${IndicatorsQML_RESOURCES_RCC}
39+ ${IndicatorsQML_SOURCES}
40+)
41+# Because this is an internal support library, we want
42+# to expose all symbols in it. Consider changing this
43+# either to a static library or just using the
44+# files directly in targets.
45+set_target_properties(IndicatorsQml PROPERTIES COMPILE_FLAGS -fvisibility=default)
46+
47+target_link_libraries(IndicatorsQml
48+ ${QMENUMODEL_LDFLAGS}
49+)
50+
51+qt5_use_modules(IndicatorsQml Core Qml Quick)
52+
53+# export the qmltypes and plugin files
54+export_qmlplugin(Unity.Indicators 0.1 Unity/Indicators TARGETS IndicatorsQml)
plugins/Unity/Indicators/Messaging/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(qml)
plugins/Unity/Indicators/Messaging/qml/ActionButton.qmlnew file+43
@@ -0,0 +1,43 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Unity.Indicators 0.1 as Indicators
24+
25+Button {
26+ id: button
27+ property QtObject actionGroup: null
28+ property string action
29+
30+ property var actionParameter: null
31+
32+ Indicators.MenuAction {
33+ id: menuAction
34+ actionGroup: button.actionGroup
35+ action: button.action
36+ }
37+
38+ onClicked: {
39+ if (menuAction.valid) {
40+ menuAction.activate(actionParameter);
41+ }
42+ }
43+}
plugins/Unity/Indicators/Messaging/qml/ActionTextField.qmlnew file+66
@@ -0,0 +1,66 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+
24+Item {
25+ property alias actionGroup: sendButton.actionGroup
26+ property alias action: sendButton.action
27+
28+ property alias text: replyField.text
29+ property alias buttonText: sendButton.text
30+
31+ TextField {
32+ id: replyField
33+
34+ anchors {
35+ top: parent.top
36+ bottom: parent.bottom
37+ left: parent.left
38+ right: sendButton.left
39+ rightMargin: units.gu(1)
40+ }
41+ placeholderText: "Reply"
42+ hasClearButton: false
43+
44+ onEnabledChanged: {
45+ //Make sure that the component lost focus when enabled = false,
46+ //otherwise it will get focus again when enable = true
47+ if (!enabled) {
48+ focus = false;
49+ }
50+ }
51+ }
52+
53+ ActionButton {
54+ id: sendButton
55+
56+ actionParameter: replyField.text
57+ anchors {
58+ top: parent.top
59+ bottom: parent.bottom
60+ right: parent.right
61+ }
62+ width: units.gu(9)
63+ enabled: replyField.text !== ""
64+ color: enabled ? "#c94212" : "#bababa"
65+ }
66+}
plugins/Unity/Indicators/Messaging/qml/CMakeLists.txtnew file+5
@@ -0,0 +1,5 @@
1+# export_qmlfiles macro
2+include(Plugins)
3+
4+# export the qmldir, *.qml files.
5+export_qmlfiles(Unity.Indicators.Messaging Unity/Indicators/Messaging)
plugins/Unity/Indicators/Messaging/qml/GroupedMessage.qmlnew file+96
@@ -0,0 +1,96 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Unity.Indicators 0.1 as Indicators
24+
25+Indicators.BasicMenuItem {
26+ id: groupedMessage
27+ property alias count: label.text
28+
29+ color: "#221e1b"
30+ implicitHeight: units.gu(10)
31+
32+ Indicators.MenuAction {
33+ id: menuAction
34+ actionGroup: groupedMessage.actionGroup
35+ action: menu ? menu.action : ""
36+ }
37+
38+ Row {
39+ anchors.fill: parent
40+ anchors.margins: units.gu(2)
41+ spacing: units.gu(4)
42+
43+ UbuntuShape {
44+ height: units.gu(6)
45+ width: units.gu(6)
46+ image: Image {
47+ source: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicators/artwork/messaging/default_app.svg"
48+ fillMode: Image.PreserveAspectFit
49+ }
50+ }
51+
52+ Label {
53+ anchors.verticalCenter: parent.verticalCenter
54+ color: "#e8e1d0"
55+ font.weight: Font.DemiBold
56+ fontSize: "medium"
57+ text: menu && menu.label ? menu.label : ""
58+ }
59+
60+ Label {
61+ id: label
62+ anchors.verticalCenter: parent.verticalCenter
63+ width: parent.width - x
64+ horizontalAlignment: Text.AlignRight
65+ color: "#e8e1d0"
66+ font.weight: Font.DemiBold
67+ fontSize: "medium"
68+ text: menuAction.valid ? menuAction.state[0] : "0"
69+ }
70+ }
71+
72+ Indicators.HLine {
73+ anchors.top: parent.top
74+ color: "#403b37"
75+ }
76+
77+ Indicators.HLine {
78+ anchors.bottom: parent.bottom
79+ color: "#060606"
80+ }
81+
82+ MouseArea {
83+ anchors.fill: parent
84+ onClicked: {
85+ if (menuAction.valid) {
86+ menuAction.activate(true);
87+ }
88+ }
89+ }
90+
91+ onItemRemoved: {
92+ if (menuAction.valid) {
93+ menuAction.activate(false);
94+ }
95+ }
96+}
plugins/Unity/Indicators/Messaging/qml/HeroMessage.qmlnew file+120
@@ -0,0 +1,120 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Unity.Indicators 0.1 as Indicators
24+
25+Indicators.BasicMenuItem {
26+ id: heroMessage
27+
28+ property variant actionsDescription: null
29+ property alias heroMessageHeader: __heroMessageHeader
30+ property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
31+ property real expandedHeight: collapsedHeight
32+
33+ color: "#221e1c"
34+
35+ removable: state !== "expanded"
36+ implicitHeight: collapsedHeight
37+
38+ Indicators.MenuAction {
39+ id: menuAction
40+ actionGroup: heroMessage.actionGroup
41+ action: menu ? menu.action : ""
42+ }
43+
44+ HeroMessageHeader {
45+ id: __heroMessageHeader
46+
47+ anchors.top: parent.top
48+ anchors.left: parent.left
49+ anchors.right: parent.right
50+
51+ avatar: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicators/artwork/messaging/default_contact.png"
52+ icon: menu && (menu.extra.canonical_app_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_app_icon) : ""
53+ appIcon: icon
54+
55+ state: heroMessage.state
56+
57+ onAppIconClicked: {
58+ if (menuAction.valid) {
59+ deactivateMenu();
60+ action.activate(true);
61+ }
62+ }
63+ }
64+
65+ onClicked: {
66+ if (menuActivated) {
67+ deactivateMenu();
68+ } else {
69+ activateMenu();
70+ }
71+ }
72+
73+ Indicators.HLine {
74+ id: __topHLine
75+ anchors.top: parent.top
76+ color: "#403b37"
77+ }
78+
79+ Indicators.HLine {
80+ id: __bottomHLine
81+ anchors.bottom: parent.bottom
82+ color: "#060606"
83+ }
84+
85+ states: State {
86+ name: "expanded"
87+ when: menuActivated
88+
89+ PropertyChanges {
90+ target: heroMessage
91+ color: "#333130"
92+ implicitHeight: heroMessage.expandedHeight
93+ }
94+ PropertyChanges {
95+ target: __topHLine
96+ opacity: 0.0
97+ }
98+ PropertyChanges {
99+ target: __bottomHLine
100+ opacity: 0.0
101+ }
102+ }
103+
104+ transitions: Transition {
105+ ParallelAnimation {
106+ NumberAnimation {
107+ properties: "opacity,implicitHeight"
108+ duration: 200
109+ easing.type: Easing.OutQuad
110+ }
111+ ColorAnimation {}
112+ }
113+ }
114+
115+ onItemRemoved: {
116+ if (menuAction.valid) {
117+ menuAction.activate(false);
118+ }
119+ }
120+}
plugins/Unity/Indicators/Messaging/qml/HeroMessageHeader.qmlnew file+161
@@ -0,0 +1,161 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+
24+Item {
25+ id: heroMessageHeader
26+
27+ property alias avatar: avatarImage.source
28+ property alias icon: iconImage.source
29+ property alias appIcon: appIconImage.source
30+ property alias titleText: __titleText
31+ property alias subtitleText: __subtitleText
32+ property alias bodyText: __bodyText
33+ property real bodyBottom: bodyText.y + bodyText.height
34+
35+ signal appIconClicked()
36+
37+ height: units.gu(9)
38+
39+ UbuntuShape {
40+ id: avatarImageContainer
41+ anchors {
42+ top: parent.top
43+ topMargin: units.gu(2)
44+ left: parent.left
45+ leftMargin: units.gu(2)
46+ }
47+ height: units.gu(6)
48+ width: units.gu(6)
49+ image: Image {
50+ id: avatarImage
51+ fillMode: Image.PreserveAspectFit
52+ }
53+ }
54+
55+ Image {
56+ id: iconImage
57+ anchors {
58+ top: parent.top
59+ topMargin: units.gu(2)
60+ left: avatarImageContainer.right
61+ leftMargin: units.gu(1)
62+ }
63+ height: units.gu(1.5)
64+ width: units.gu(2)
65+ horizontalAlignment: Image.AlignHCenter
66+ verticalAlignment: Image.AlignBottom
67+ fillMode: Image.PreserveAspectFit
68+ }
69+
70+ Label {
71+ id: __titleText
72+ anchors {
73+ baseline: iconImage.bottom
74+ left: iconImage.right
75+ leftMargin: units.gu(1)
76+ right: __appIcon.left
77+ rightMargin: units.gu(2)
78+ }
79+ elide: Text.ElideRight
80+ color: "#e8e1d0"
81+ font.weight: Font.DemiBold
82+ fontSize: "medium"
83+ }
84+
85+ Label {
86+ id: __subtitleText
87+ anchors {
88+ baseline: __titleText.baseline
89+ baselineOffset: units.gu(2.5)
90+ left: __titleText.left
91+ right: __titleText.right
92+ }
93+ elide: Text.ElideRight
94+ color: "#8f8f88"
95+ fontSize: "small"
96+ }
97+
98+ Label {
99+ id: __bodyText
100+ anchors {
101+ baseline: __subtitleText.baseline
102+ baselineOffset: units.gu(2.5)
103+ left: __titleText.left
104+ right: parent.right
105+ rightMargin: units.gu(2)
106+ }
107+ maximumLineCount: 2
108+ wrapMode: Text.WordWrap
109+ elide: Text.ElideRight
110+ color: "#e8e1d0"
111+ fontSize: "small"
112+ }
113+
114+ Item {
115+ id: __appIcon
116+ width: units.gu(7)
117+ height: units.gu(7)
118+ anchors {
119+ top: parent.top
120+ right: parent.right
121+ }
122+ opacity: 0.0
123+ enabled: heroMessageHeader.state === "expanded"
124+
125+ Image {
126+ id: appIconImage
127+ height: width
128+ anchors {
129+ left: parent.left
130+ leftMargin: units.gu(2)
131+ right: parent.right
132+ rightMargin: units.gu(2)
133+ topMargin: units.gu(1)
134+ verticalCenter: parent.verticalCenter
135+ }
136+ fillMode: Image.PreserveAspectFit
137+ }
138+
139+ MouseArea {
140+ anchors.fill: parent
141+ onClicked: heroMessageHeader.appIconClicked()
142+ }
143+ }
144+
145+ states: State {
146+ name: "expanded"
147+
148+ PropertyChanges {
149+ target: __appIcon
150+ opacity: 1.0
151+ }
152+ }
153+
154+ transitions: Transition {
155+ NumberAnimation {
156+ property: "opacity"
157+ duration: 200
158+ easing.type: Easing.OutQuad
159+ }
160+ }
161+}
plugins/Unity/Indicators/Messaging/qml/MessageMenuItem.qmlnew file+96
@@ -0,0 +1,96 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Unity.Indicators 0.1 as Indicators
24+
25+Indicators.BasicMenuItem {
26+ property variant actionsDescription: menu ? menu.extra.canonical_message_actions : undefined
27+
28+ onActionGroupChanged: loadItem()
29+ onActionsDescriptionChanged: loadItem()
30+ implicitHeight: contents.status == Loader.Ready ? contents.item.implicitHeight : 0
31+
32+ Loader {
33+ id: contents
34+
35+ anchors.fill: parent
36+ // Binding all properties for the item, to make sure that any change in the
37+ // property will be propagated to the contents.item at any time
38+ Binding {
39+ target: contents.item
40+ property: "menuActivated"
41+ value: menuActivated
42+ when: (contents.status == Loader.Ready)
43+ }
44+
45+ Binding {
46+ target: contents.item
47+ property: "actionGroup"
48+ value: actionGroup
49+ when: (contents.status == Loader.Ready)
50+ }
51+
52+ Binding {
53+ target: contents.item
54+ property: "menu"
55+ value: menu
56+ when: (contents.status == Loader.Ready)
57+ }
58+
59+ Binding {
60+ target: contents.item
61+ property: "actionsDescription"
62+ value: actionsDescription
63+ when: (contents.status == Loader.Ready)
64+ }
65+
66+ Connections {
67+ target: contents.item ? contents.item : null
68+ onActivateMenu: activateMenu()
69+ onDeactivateMenu: deactivateMenu()
70+ }
71+ }
72+
73+
74+ function loadItem()
75+ {
76+ var parameterType = ""
77+ for (var actIndex in actionsDescription) {
78+ var desc = actionsDescription[actIndex];
79+ if (desc["parameter-type"] !== undefined) {
80+ parameterType += desc["parameter-type"];
81+ } else {
82+ parameterType += "_";
83+ }
84+ }
85+
86+ if (parameterType === "") {
87+ contents.source = "SimpleTextMessage.qml";
88+ } else if (parameterType === "s") {
89+ contents.source = "TextMessage.qml";
90+ } else if (parameterType === "_s") {
91+ contents.source = "SnapDecision.qml";
92+ } else {
93+ console.debug("Unknown paramater type: " + parameterType);
94+ }
95+ }
96+}
plugins/Unity/Indicators/Messaging/qml/QuickReply.qmlnew file+160
@@ -0,0 +1,160 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Unity.Indicators 0.1 as Indicators
24+
25+Item {
26+ property alias actionGroup: actionTextField.actionGroup
27+ property alias action: actionTextField.action
28+
29+ property alias buttonText: actionTextField.buttonText
30+ property real expandedHeight: childrenRect.height
31+ property alias messages : messagelistRepeater.model
32+
33+ Item {
34+ id: header
35+ anchors.top: parent.top
36+ anchors.left: parent.left
37+ anchors.right: parent.right
38+ height: units.gu(4)
39+
40+ Row {
41+ anchors {
42+ fill: parent
43+ leftMargin: units.gu(2)
44+ rightMargin: units.gu(2)
45+ topMargin: units.gu(1)
46+ bottomMargin: units.gu(1)
47+ }
48+ spacing: units.gu(1)
49+
50+ Image {
51+ width: units.gu(2)
52+ height: width
53+ fillMode: Image.PreserveAspectFit
54+ source: "qrc:/indicators/artwork/messaging/message_sms01_54px.png"
55+ }
56+
57+ Label {
58+ height: parent.height
59+ verticalAlignment: Text.AlignVCenter
60+ fontSize: "small"
61+ color: "#8f8f88"
62+ text: "Quick reply with:"
63+ }
64+ }
65+
66+ Indicators.HLine {
67+ anchors.bottom: parent.bottom
68+ color: "#20201F"
69+ }
70+ }
71+
72+ Column {
73+ id: messagelist
74+ anchors {
75+ left: parent.left
76+ right: parent.right
77+ top: header.bottom
78+ }
79+ height: childrenRect.height
80+
81+ Repeater {
82+ id: messagelistRepeater
83+
84+ height: childrenRect.height
85+
86+ Rectangle {
87+ width: messagelist.width
88+ height: units.gu(5)
89+ color: "#333230"
90+
91+ Label {
92+ id: __label
93+
94+ anchors {
95+ fill: parent
96+ leftMargin: units.gu(2)
97+ rightMargin: units.gu(2)
98+ }
99+ verticalAlignment: Text.AlignVCenter
100+ fontSize: "medium"
101+ color: "#e8e1d0"
102+ text: modelData
103+ }
104+
105+ Indicators.HLine {
106+ anchors.top: parent.top
107+ color: "#464543"
108+ }
109+
110+ Indicators.HLine {
111+ anchors.bottom: parent.bottom
112+ color: "#20201F"
113+ }
114+
115+ MouseArea {
116+ id: __mouseArea
117+
118+ anchors.fill: parent
119+ onClicked: {
120+ actionTextField.text = modelData;
121+ }
122+ }
123+
124+ Rectangle {
125+ id: __mask
126+
127+ anchors.fill: parent
128+ color: "black"
129+ opacity: __mouseArea.pressed ? 0.3 : 0.0
130+ Behavior on opacity {
131+ NumberAnimation {
132+ duration: 200
133+ easing.type: Easing.OutQuad
134+ }
135+ }
136+ }
137+ }
138+
139+ }
140+ }
141+
142+ Item {
143+ anchors.top: messagelist.bottom
144+ anchors.left: parent.left
145+ anchors.right: parent.right
146+ height: units.gu(6)
147+
148+ ActionTextField {
149+ id: actionTextField
150+
151+ anchors.fill: parent
152+ anchors.margins: units.gu(1)
153+ }
154+
155+ Indicators.HLine {
156+ anchors.top: parent.top
157+ color: "#464543"
158+ }
159+ }
160+}
plugins/Unity/Indicators/Messaging/qml/SimpleTextMessage.qmlnew file+97
@@ -0,0 +1,97 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import "utils.js" as Utils
24+
25+HeroMessage {
26+ id: __heroMessage
27+
28+ property alias footer: footerLoader.sourceComponent
29+
30+ expandedHeight: fullMessage.y + fullMessage.height + units.gu(2)
31+ heroMessageHeader.titleText.text: menu ? menu.label : ""
32+ heroMessageHeader.subtitleText.text: menu ? Utils.formatDate(menu.extra.canonical_time) : ""
33+ heroMessageHeader.bodyText.text: menu ? menu.extra.canonical_text : ""
34+
35+ Item {
36+ id: fullMessage
37+
38+ anchors {
39+ left: parent.left
40+ leftMargin: units.gu(2)
41+ right: parent.right
42+ rightMargin: units.gu(2)
43+ top: heroMessageHeader.bottom
44+ }
45+ height: childrenRect.height
46+ opacity: 0.0
47+ enabled: false
48+
49+ Label {
50+ id: bodyText
51+ anchors {
52+ top: parent.top
53+ left: parent.left
54+ right: parent.right
55+ }
56+ wrapMode: Text.WordWrap
57+ elide: Text.ElideRight
58+ color: "#e8e1d0"
59+ fontSize: "medium"
60+ text: heroMessageHeader.bodyText.text
61+ }
62+
63+ Loader {
64+ id: footerLoader
65+
66+ anchors {
67+ top: bodyText.bottom
68+ topMargin: units.gu(2)
69+ left: parent.left
70+ right: parent.right
71+ }
72+ height: item != undefined ? units.gu(4) : 0
73+ }
74+
75+ states: State {
76+ name: "expanded"
77+ when: __heroMessage.state === "expanded"
78+
79+ PropertyChanges {
80+ target: heroMessageHeader.bodyText
81+ opacity: 0.0
82+ }
83+
84+ PropertyChanges {
85+ target: fullMessage
86+ opacity: 1.0
87+ enabled: true
88+ }
89+ }
90+ transitions: Transition {
91+ NumberAnimation {
92+ property: "opacity"
93+ duration: 200
94+ }
95+ }
96+ }
97+}
plugins/Unity/Indicators/Messaging/qml/SnapDecision.qmlnew file+142
@@ -0,0 +1,142 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Unity.Indicators 0.1 as Indicators
24+import "utils.js" as Utils
25+
26+HeroMessage {
27+ id: snapDecision
28+
29+ expandedHeight: buttons.y + buttons.height + quickreply.height + units.gu(2)
30+ heroMessageHeader.titleText.text: menu ? menu.label : ""
31+ heroMessageHeader.subtitleText.text: menu ? menu.extra.canonical_text : ""
32+ heroMessageHeader.subtitleText.color: "#e8e1d0"
33+ heroMessageHeader.bodyText.text: menu ? Utils.formatDate(menu.extra.canonical_time) : ""
34+ heroMessageHeader.bodyText.color: "#8f8f88"
35+
36+ Item {
37+ id: buttons
38+
39+ anchors.left: parent.left
40+ anchors.leftMargin: units.gu(2)
41+ anchors.right: parent.right
42+ anchors.rightMargin: units.gu(2)
43+ anchors.top: heroMessageHeader.bottom
44+ anchors.topMargin: units.gu(1)
45+ height: units.gu(4)
46+ opacity: 0.0
47+
48+ Button {
49+ text: "Message"
50+ color: "#bababa"
51+ anchors.left: parent.left
52+ anchors.top: parent.top
53+ anchors.bottom: parent.bottom
54+ width: (parent.width - units.gu(1)) / 2
55+
56+ onClicked: {
57+ if (quickreply.state === "") {
58+ quickreply.state = "expanded";
59+ } else {
60+ quickreply.state = "";
61+ }
62+ }
63+ }
64+
65+ ActionButton {
66+ actionGroup: snapDecision.actionGroup
67+ action: actionsDescription[0].name
68+
69+ text: actionsDescription ? actionsDescription[0].label : "Call back"
70+ color: "#c94212"
71+ anchors.right: parent.right
72+ anchors.top: parent.top
73+ anchors.bottom: parent.bottom
74+ width: (parent.width - units.gu(1)) / 2
75+ }
76+
77+ states: State {
78+ name: "expanded"
79+ when: snapDecision.state === "expanded"
80+
81+ PropertyChanges {
82+ target: buttons
83+ opacity: 1.0
84+ }
85+ }
86+ transitions: Transition {
87+ NumberAnimation {
88+ property: "opacity"
89+ duration: 200
90+ easing.type: Easing.OutQuad
91+ }
92+ }
93+ }
94+
95+ QuickReply {
96+ id: quickreply
97+
98+ actionGroup: snapDecision.actionGroup
99+ action: actionsDescription[1].name
100+
101+ messages: actionsDescription ? actionsDescription[1]["parameter-hint"] : ""
102+ buttonText: actionsDescription ? actionsDescription[1].label : "send"
103+ anchors {
104+ top: buttons.bottom
105+ topMargin: units.gu(2)
106+ left: parent.left
107+ right: parent.right
108+ }
109+ height: 0
110+ opacity: 0.0
111+ enabled: false
112+
113+ states: State {
114+ name: "expanded"
115+
116+ PropertyChanges {
117+ target: quickreply
118+ height: expandedHeight
119+ opacity: 1.0
120+ }
121+
122+ PropertyChanges {
123+ target: quickreply
124+ enabled: true
125+ }
126+ }
127+
128+ transitions: Transition {
129+ NumberAnimation {
130+ properties: "opacity,height"
131+ duration: 200
132+ easing.type: Easing.OutQuad
133+ }
134+ }
135+ }
136+
137+ onStateChanged: {
138+ if (state === "") {
139+ quickreply.state = "";
140+ }
141+ }
142+}
plugins/Unity/Indicators/Messaging/qml/TextMessage.qmlnew file+35
@@ -0,0 +1,35 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1
23+import Unity.Indicators 0.1 as Indicators
24+
25+SimpleTextMessage {
26+ id: simpleMessage
27+
28+ footer: ActionTextField {
29+ anchors.fill: parent
30+ actionGroup: simpleMessage.actionGroup
31+ action: actionsDescription[0].name
32+
33+ buttonText: actionsDescription ? actionsDescription[0].label : "Send"
34+ }
35+}
plugins/Unity/Indicators/Messaging/qml/qmldirnew file+12
@@ -0,0 +1,12 @@
1+module Unity.Indicators.Messaging
2+
3+ActionButton 0.1 ActionButton.qml
4+ActionTextField 0.1 ActionTextField.qml
5+GroupedMessage 0.1 GroupedMessage.qml
6+HeroMessage 0.1 HeroMessage.qml
7+HeroMessageHeader 0.1 HeroMessageHeader.qml
8+MessageMenuItem 0.1 MessageMenuItem.qml
9+QuickReply 0.1 QuickReply.qml
10+SimpleTextMessage 0.1 SimpleTextMessage.qml
11+SnapDecision 0.1 SnapDecision.qml
12+TextMessage 0.1 TextMessage.qml
plugins/Unity/Indicators/Messaging/qml/utils.jsnew file+27
@@ -0,0 +1,27 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Olivier Tilloy <olivier.tilloy@canonical.com>
19+ */
20+
21+.pragma library
22+
23+function formatDate(timestamp) {
24+ // timestamp is in microseconds since epoch
25+ var date = new Date(timestamp / 1000);
26+ return Qt.formatDateTime(date, "hh:mm - MMM dd");
27+}
plugins/Unity/Indicators/Network/CMakeLists.txtnew file+45
@@ -0,0 +1,45 @@
1+# export_qmlplugin macro
2+include(Plugins)
3+
4+project(IndicatorsNetworkQml)
5+
6+pkg_check_modules(GLIB glib-2.0>=2.32)
7+pkg_check_modules(LIBNM_GLIB libnm-glib>=0.9.6)
8+pkg_check_modules(LIBNM_UTIL libnm-util>=0.9.6)
9+
10+if(LIBNM_GLIB_FOUND AND LIBNM_UTIL_FOUND AND GLIB_FOUND)
11+ set(INDICATORS_NETWORK_SRC
12+ networkagent.cpp
13+ plugin.cpp
14+ secret-agent.c
15+ )
16+
17+ add_library(IndicatorsNetworkQml MODULE
18+ ${INDICATORS_NETWORK_SRC}
19+ )
20+
21+ qt5_use_modules(IndicatorsNetworkQml Core Qml Widgets)
22+
23+ set_target_properties(IndicatorsNetworkQml PROPERTIES COMPILE_FLAGS -fPIC)
24+
25+ include_directories(
26+ ${CMAKE_CURRENT_SOURCE_DIR}
27+ ${GLIB_INCLUDE_DIRS}
28+ ${LIBNM_GLIB_INCLUDE_DIRS}
29+ ${LIBNM_UTIL_INCLUDE_DIRS}
30+ )
31+
32+ target_link_libraries(IndicatorsNetworkQml
33+ ${GLIB_LIBRARIES}
34+ ${LIBNM_GLIB_LIBRARIES}
35+ ${LIBNM_UTIL_LIBRARIES}
36+ )
37+
38+ # export the qmltypes and plugin files
39+ export_qmlplugin(Unity.Indicators.Network 0.1 Unity/Indicators/Network TARGETS IndicatorsNetworkQml)
40+
41+else()
42+ message(WARNING "Missing glib or libnm dependency for the network plugin, not building")
43+endif()
44+
45+add_subdirectory(qml)
plugins/Unity/Indicators/Network/networkagent.cppnew file+146
@@ -0,0 +1,146 @@
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+ * Alberto Ruiz <alberto.ruiz@canonical.com>
18+ * Renato Araujo Oliveira Filho <renato@canonical.com>
19+ */
20+
21+#include "networkagent.h"
22+
23+#include <QVariant>
24+#include <QApplication>
25+#include <QDebug>
26+
27+class NetworkAgentToken
28+{
29+public:
30+ NMConnection *connection;
31+ NMSettingWirelessSecurity *wisec;
32+ guint id;
33+ QByteArray keyMgmt;
34+
35+ NetworkAgentToken(NMConnection *connection,
36+ NMSettingWirelessSecurity *wisec,
37+ guint id,
38+ QByteArray keyMgmt)
39+ : connection(connection),
40+ wisec(wisec),
41+ id(id),
42+ keyMgmt(keyMgmt)
43+ {
44+ if (connection) {
45+ g_object_ref(connection);
46+ } else {
47+ qWarning() << "invalid connection object";
48+ }
49+ }
50+
51+ ~NetworkAgentToken()
52+ {
53+ if (connection) {
54+ g_object_unref(connection);
55+ }
56+ }
57+};
58+
59+NetworkAgent::NetworkAgent(QObject *parent)
60+ : QObject(parent)
61+{
62+ m_agent = unity_settings_secret_agent_new();
63+ g_signal_connect(G_OBJECT(m_agent),
64+ UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
65+ G_CALLBACK(onSecretRequested),
66+ this);
67+
68+ g_signal_connect(G_OBJECT(m_agent),
69+ UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
70+ G_CALLBACK(onSecretRequestCancelled),
71+ this);
72+}
73+
74+NetworkAgent::~NetworkAgent()
75+{
76+ nm_secret_agent_unregister(NM_SECRET_AGENT(m_agent));
77+ g_object_unref(m_agent);
78+}
79+
80+void NetworkAgent::authenticate(const QVariant &token, const QString &key)
81+{
82+ NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
83+ if (pToken == NULL) {
84+ return;
85+ }
86+
87+ if ((pToken->keyMgmt == "wpa-none") || (pToken->keyMgmt == "wpa-psk")) {
88+ g_object_set(G_OBJECT(pToken->wisec),
89+ NM_SETTING_WIRELESS_SECURITY_PSK, qPrintable(key),
90+ NULL);
91+ } else if (pToken->keyMgmt == "none") {
92+ g_object_set(G_OBJECT(pToken->wisec),
93+ NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, qPrintable(key),
94+ NULL);
95+ }
96+
97+ GHashTable *settings = nm_connection_to_hash(pToken->connection,
98+ NM_SETTING_HASH_FLAG_ALL);
99+
100+ unity_settings_secret_agent_provide_secret(m_agent,
101+ pToken->id, settings);
102+ g_hash_table_unref(settings);
103+ delete pToken;
104+}
105+
106+void NetworkAgent::cancel(const QVariant &token)
107+{
108+ NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
109+ if (pToken != NULL) {
110+ unity_settings_secret_agent_cancel_request(m_agent, pToken->id);
111+ delete pToken;
112+ }
113+}
114+
115+void NetworkAgent::onSecretRequested(UnitySettingsSecretAgent* /*agent*/,
116+ guint id,
117+ NMConnection* connection,
118+ const char* /*setting_name*/,
119+ const char** /*hints*/,
120+ NMSecretAgentGetSecretsFlags /*flags*/,
121+ NetworkAgent* self)
122+{
123+ NetworkAgentToken *token = new NetworkAgentToken(connection,
124+ NULL,
125+ id,
126+ NULL);
127+
128+ token->wisec = nm_connection_get_setting_wireless_security(connection);
129+ if (token->wisec) {
130+ token->keyMgmt = nm_setting_wireless_security_get_key_mgmt(token->wisec);
131+ }
132+
133+ QVariant varToken = qVariantFromValue((void *) token);
134+ Q_EMIT self->secretRequested(varToken);
135+}
136+
137+void NetworkAgent::onSecretRequestCancelled(UnitySettingsSecretAgent* /*agent*/,
138+ guint /*id*/,
139+ NMConnection* /*connection*/,
140+ const char* /*setting_name*/,
141+ const char** /*hints*/,
142+ NMSecretAgentGetSecretsFlags /*flags*/,
143+ NetworkAgent* /*self*/)
144+{
145+ //Do nothing for now
146+}
plugins/Unity/Indicators/Network/networkagent.hnew file+65
@@ -0,0 +1,65 @@
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+ * Alberto Ruiz <alberto.ruiz@canonical.com>
18+ * Renato Araujo Oliveira Filho <renato@canonical.com>
19+ */
20+
21+#ifndef NETWORKAGENT_H
22+#define NETWORKAGENT_H
23+
24+#include "secret-agent.h"
25+
26+#include <QObject>
27+
28+class NetworkAgentToken;
29+
30+class NetworkAgent : public QObject
31+{
32+ Q_OBJECT
33+public:
34+ NetworkAgent(QObject *parent=0);
35+ ~NetworkAgent();
36+
37+ Q_INVOKABLE void authenticate(const QVariant &token, const QString &key);
38+ Q_INVOKABLE void cancel(const QVariant &token);
39+
40+Q_SIGNALS:
41+ void secretRequested(const QVariant &token);
42+ void secretRequestCancelled();
43+
44+private:
45+ UnitySettingsSecretAgent *m_agent;
46+
47+ static void onSecretRequested(UnitySettingsSecretAgent *agent,
48+ guint id,
49+ NMConnection *connection,
50+ const char *setting_name,
51+ const char **hints,
52+ NMSecretAgentGetSecretsFlags flags,
53+ NetworkAgent *self);
54+
55+ static void onSecretRequestCancelled(UnitySettingsSecretAgent *agent,
56+ guint id,
57+ NMConnection *connection,
58+ const char *setting_name,
59+ const char **hints,
60+ NMSecretAgentGetSecretsFlags flags,
61+ NetworkAgent *self);
62+
63+};
64+
65+#endif
tests/mocks/Ubuntu/ChewieUI/fake_chewie_plugin.cpp → plugins/Unity/Indicators/Network/plugin.cpprenamed+12−11
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012, 2013 Canonical, Ltd.
2+ * Copyright (C) 2012 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -12,19 +12,20 @@
1212 *
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
1517 */
1618
17−#include "fake_chewie_plugin.h"
18−#include "fake_pluginmodel.h"
19+// Qt
20+#include <QtQml>
1921
20−#include <qqml.h>
22+// self
23+#include "plugin.h"
2124
22−void FakeChewieQmlPlugin::registerTypes(const char *uri)
23−{
24−// #ifndef GLIB_VERSION_2_36
25−// g_type_init();
26−// #endif
25+// local
26+#include "networkagent.h"
2727
28− qmlRegisterUncreatableType<WidgetsMap>(uri, 0, 1, "WidgetsMap", "WidgetsMap must be created by PluginModel");
29− qmlRegisterType<PluginModel>(uri, 0, 1, "PluginModel");
28+void IndicatorsNetworkPlugin::registerTypes(const char *uri)
29+{
30+ qmlRegisterType<NetworkAgent>(uri, 0, 1, "NetworkAgent");
3031}
plugins/Unity/Indicators/Network/plugin.hnew file+32
@@ -0,0 +1,32 @@
1+/*
2+ * Copyright (C) 2012 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+#ifndef INDICATORS_NETWORK_PLUGIN_H
20+#define INDICATORS_NETWORK_PLUGIN_H
21+
22+#include <QtQml/QQmlExtensionPlugin>
23+
24+class IndicatorsNetworkPlugin : public QQmlExtensionPlugin
25+{
26+ Q_OBJECT
27+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28+public:
29+ void registerTypes(const char *uri);
30+};
31+
32+#endif // INDICATORS_NETWORK_PLUGIN_H
plugins/Unity/Indicators/Network/qml/AccessPoint.qmlnew file+68
@@ -0,0 +1,68 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
23+import Unity.Indicators 0.1 as Indicators
24+
25+Indicators.MenuItem {
26+ id: accessPoint
27+ property variant actionWifiApStrength : menu && actionGroup ? actionGroup.action(menu.extra.canonical_wifi_ap_strength_action) : null
28+ property variant wifiApStrength : actionWifiApStrength && actionWifiApStrength.valid ? actionWifiApStrength.state : "0"
29+
30+ function getNetworkIcon(data) {
31+ var imageName = "nm-signal-100"
32+ var signalStrength = parseInt(wifiApStrength)
33+
34+ if (data.extra.canonical_wifi_ap_is_adhoc) {
35+ imageName = "nm-adhoc";
36+ } else if (signalStrength == 0) {
37+ imageName = "nm-signal-00";
38+ } else if (signalStrength <= 25) {
39+ imageName = "nm-signal-25";
40+ } else if (signalStrength <= 50) {
41+ imageName = "nm-signal-50";
42+ } else if (signalStrength <= 75) {
43+ imageName = "nm-signal-75";
44+ }
45+
46+ if (data.extra.canonical_wifi_ap_is_secure) {
47+ imageName += "-secure";
48+ }
49+
50+ return "image://gicon/" + imageName;
51+ }
52+
53+ icon: menu && wifiApStrength ? getNetworkIcon(menu) : "image://gicon/wifi-none"
54+ iconFrame: false
55+ control: CheckBox {
56+ id: checkBoxActive
57+ height: units.gu(4)
58+ width: units.gu(4)
59+ anchors.centerIn: parent
60+ }
61+
62+ Indicators.MenuActionBinding {
63+ actionGroup: accessPoint.actionGroup
64+ action: menu ? menu.action : ""
65+ target: checkBoxActive
66+ property: "checked"
67+ }
68+}
plugins/Unity/Indicators/Network/qml/CMakeLists.txtnew file+5
@@ -0,0 +1,5 @@
1+# export_qmlplugin macro
2+include(Plugins)
3+
4+# export the qmldir, *.qml files.
5+export_qmlfiles(Unity.Indicators.Network Unity/Indicators/Network)
plugins/Unity/Indicators/Network/qml/PasswordPage.qmlnew file+88
@@ -0,0 +1,88 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
23+import Unity.Indicators 0.1 as Indicators
24+
25+Page {
26+ id: pagePassword
27+
28+ property variant agent
29+ property variant token
30+
31+ anchors.fill: parent
32+ title: "Network Authentication"
33+
34+ Column {
35+ anchors {
36+ left: parent.left
37+ right: parent.right
38+ }
39+
40+ Indicators.SectionMenuItem {
41+ label: "Authentication"
42+ }
43+
44+ Indicators.MenuItem {
45+ implicitHeight: password.height + units.gu(1)
46+
47+ PasswordTextField {
48+ id: password
49+ anchors {
50+ left: parent.left
51+ right: parent.right
52+ margins: units.gu(3)
53+ verticalCenter: parent.verticalCenter
54+ }
55+ }
56+ }
57+
58+ Indicators.MenuItem {
59+ Row {
60+ anchors {
61+ right: parent.right
62+ verticalCenter: parent.verticalCenter
63+ margins: units.gu(3)
64+ }
65+
66+ spacing: units.gu(1)
67+
68+ Button {
69+ text: "Cancel"
70+ width: units.gu(10)
71+ onClicked: {
72+ agent.cancel(token);
73+ pageStack.pop();
74+ }
75+ }
76+
77+ Button {
78+ text: "OK"
79+ width: units.gu(10)
80+ onClicked: {
81+ agent.authenticate(token, password.text);
82+ pageStack.pop();
83+ }
84+ }
85+ }
86+ }
87+ }
88+}
plugins/Unity/Indicators/Network/qml/PasswordTextField.qmlnew file+68
@@ -0,0 +1,68 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+Item {
24+ id: textMenu
25+
26+ property alias text: textField.text
27+
28+ height: contentColumn.height
29+
30+ Column {
31+ id: contentColumn
32+ spacing: units.gu(0.5)
33+ anchors {
34+ left: parent.left
35+ right: parent.right
36+ }
37+
38+ TextField {
39+ id: textField
40+
41+ anchors {
42+ left: parent.left
43+ right: parent.right
44+ }
45+
46+ placeholderText: "Password"
47+ echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
48+ }
49+
50+ Row {
51+ anchors {
52+ left: parent.left
53+ right: parent.right
54+ }
55+
56+ spacing: units.gu(1)
57+
58+ CheckBox {
59+ id: showPassword
60+ }
61+
62+ Label {
63+ text: "Show password"
64+ anchors.verticalCenter: showPassword.verticalCenter
65+ }
66+ }
67+ }
68+}
plugins/Unity/Indicators/Network/qml/WifiSection.qmlnew file+34
@@ -0,0 +1,34 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Unity.Indicators 0.1 as Indicators
23+
24+Indicators.SectionMenuItem {
25+ id: wifiSectionMenu
26+
27+ Indicators.MenuAction {
28+ id: busyAction
29+ actionGroup: wifiSectionMenu.actionGroup
30+ action: menu ? menu.extra.canonical_busy_action : ""
31+ }
32+
33+ busy: busyAction.valid ? busyAction.state : false
34+}
plugins/Unity/Indicators/Network/qml/qmldirnew file+9
@@ -0,0 +1,9 @@
1+module Unity.Indicators.Network
2+plugin IndicatorsNetworkQml
3+typeinfo plugin.qmltypes
4+
5+NetworkPage 0.1 NetworkPage.qml
6+AccessPoint 0.1 AccessPoint.qml
7+PasswordPage 0.1 PasswordPage.qml
8+PasswordTextField 0.1 PasswordTextField.qml
9+WifiSection 0.1 WifiSection.qml
plugins/Unity/Indicators/Network/secret-agent.cnew file+382
@@ -0,0 +1,382 @@
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+ * Alberto Ruiz <alberto.ruiz@canonical.com>
18+ * Renato Araujo Oliveira Filho <renato@canonical.com>
19+ */
20+
21+
22+#include <glib.h>
23+#include <glib-object.h>
24+#include <nm-secret-agent.h>
25+#include "secret-agent.h"
26+
27+#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
28+#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
29+#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
30+#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
31+#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
32+#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
33+#define UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentPrivate))
34+
35+#define AGENT_ID "com.canonical.settings.network.nm-agent"
36+
37+static gpointer unity_settings_secret_agent_parent_class = NULL;
38+
39+typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
40+
41+struct _UnitySettingsSecretAgentPrivate {
42+ GQueue *requests;
43+};
44+
45+typedef struct _SecretRequest {
46+ gint id;
47+ NMSecretAgent *agent;
48+ NMConnection *connection;
49+ const char *connection_path;
50+ const char *setting_name;
51+ const char **hints;
52+ NMSecretAgentGetSecretsFlags flags;
53+ NMSecretAgentGetSecretsFunc callback;
54+ gpointer callback_data;
55+} SecretRequest;
56+
57+GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
58+enum {
59+ UNITY_SETTINGS_SECRET_AGENT_DUMMY_PROPERTY
60+};
61+
62+enum {
63+ SECRET_REQUESTED,
64+ REQUEST_CANCELLED,
65+ LAST_SIGNAL
66+};
67+
68+static guint signals[LAST_SIGNAL] = { 0 };
69+
70+UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
71+UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
72+
73+int
74+secret_request_find (SecretRequest *req,
75+ guint *id)
76+{
77+ if (req->id > *id)
78+ return -1;
79+
80+ if (req->id < *id)
81+ return 1;
82+
83+ return 0;
84+}
85+
86+void
87+unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
88+ guint request,
89+ GHashTable *secrets)
90+{
91+ GList *iter;
92+ SecretRequest *req;
93+ UnitySettingsSecretAgentPrivate *priv = agent->priv;
94+
95+ iter = g_queue_find_custom (priv->requests,
96+ &request,
97+ (GCompareFunc)secret_request_find);
98+
99+ if (iter == NULL || iter->data == NULL)
100+ {
101+ g_warning ("Secret request with id <%d> was not found", (int)request);
102+ return;
103+ }
104+
105+ req = iter->data;
106+
107+ req->callback (NM_SECRET_AGENT (agent),
108+ req->connection,
109+ secrets,
110+ NULL,
111+ req->callback_data);
112+
113+ g_queue_remove_all (priv->requests, req);
114+ g_free (req);
115+ return;
116+}
117+
118+void
119+free_request (SecretRequest *req)
120+{
121+ g_object_unref (req->connection);
122+ g_free (req);
123+}
124+
125+void
126+unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
127+ guint request)
128+{
129+ GList *iter;
130+ SecretRequest *req;
131+ UnitySettingsSecretAgentPrivate *priv = agent->priv;
132+ GError *error;
133+
134+ iter = g_queue_find_custom (priv->requests,
135+ &request,
136+ (GCompareFunc)secret_request_find);
137+
138+ if (iter == NULL || iter->data == NULL)
139+ {
140+ g_warning ("Secret request with id <%d> was not found", (int)request);
141+ return;
142+ }
143+
144+ req = iter->data;
145+ error = g_error_new (NM_SECRET_AGENT_ERROR,
146+ NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
147+ "This secret request was canceled by the user.");
148+
149+ req->callback (NM_SECRET_AGENT (agent),
150+ req->connection,
151+ NULL,
152+ error,
153+ req->callback_data);
154+
155+ g_queue_remove_all (priv->requests, req);
156+ free_request (req);
157+ return;
158+}
159+
160+static void
161+delete_secrets (NMSecretAgent *agent,
162+ NMConnection *connection,
163+ const char *connection_path,
164+ NMSecretAgentDeleteSecretsFunc callback,
165+ gpointer callback_data)
166+{
167+ g_debug ("delete secrets");
168+}
169+
170+/* If it returns G_MAXUINT it's considered an error */
171+static guint
172+find_available_id (UnitySettingsSecretAgentPrivate *priv)
173+{
174+ guint i = 0;
175+ guint candidate = 0;
176+
177+ if (g_queue_get_length (priv->requests) == G_MAXUINT)
178+ return G_MAXUINT;
179+
180+ while (i < g_queue_get_length (priv->requests))
181+ {
182+ SecretRequest *req = (SecretRequest*)g_queue_peek_nth (priv->requests, i);
183+
184+ if (req->id == candidate)
185+ {
186+ candidate++;
187+ i = 0;
188+ }
189+ else
190+ {
191+ i++;
192+ }
193+ }
194+
195+ return i;
196+}
197+
198+static void
199+get_secrets (NMSecretAgent *agent,
200+ NMConnection *connection,
201+ const char *connection_path,
202+ const char *setting_name,
203+ const char **hints,
204+ NMSecretAgentGetSecretsFlags flags,
205+ NMSecretAgentGetSecretsFunc callback,
206+ gpointer callback_data)
207+{
208+ guint id;
209+ UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
210+ SecretRequest *req = NULL;
211+
212+ if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)
213+ {
214+ GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
215+ NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
216+ "No password found for this connection.");
217+ callback (agent, connection, NULL, error, callback_data);
218+ g_error_free (error);
219+ return;
220+ }
221+
222+ id = find_available_id (priv);
223+ if (id == G_MAXUINT)
224+ {
225+ GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
226+ NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
227+ "Reached maximum number of requests.");
228+ callback (agent, connection, NULL, error, callback_data);
229+ g_error_free (error);
230+ return;
231+ }
232+
233+ /* Adding a request */
234+ req = (SecretRequest*) g_malloc0 (sizeof (SecretRequest));
235+ *req = ((SecretRequest)
236+ { id,
237+ agent,
238+ connection,
239+ connection_path,
240+ setting_name,
241+ hints,
242+ flags,
243+ callback,
244+ callback_data });
245+
246+ g_object_ref (connection);
247+
248+ g_queue_push_tail (priv->requests, req);
249+
250+ g_signal_emit_by_name (agent,
251+ UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
252+ id,
253+ connection,
254+ setting_name,
255+ hints,
256+ flags);
257+}
258+
259+static void
260+save_secrets (NMSecretAgent *agent,
261+ NMConnection *connection,
262+ const char *connection_path,
263+ NMSecretAgentSaveSecretsFunc callback,
264+ gpointer callback_data)
265+{
266+ g_debug ("save secrets");
267+}
268+
269+static void
270+cancel_get_secrets (NMSecretAgent *agent,
271+ const char *connection_path,
272+ const char *setting_name)
273+{
274+ g_debug ("cancel get secrets");
275+}
276+
277+UnitySettingsSecretAgent*
278+unity_settings_secret_agent_construct (GType object_type)
279+{
280+ UnitySettingsSecretAgent * self = NULL;
281+ self = (UnitySettingsSecretAgent*) g_object_new (object_type,
282+ NM_SECRET_AGENT_IDENTIFIER, AGENT_ID,
283+ NULL);
284+ return self;
285+}
286+
287+
288+UnitySettingsSecretAgent*
289+unity_settings_secret_agent_new (void)
290+{
291+ return unity_settings_secret_agent_construct (UNITY_SETTINGS_TYPE_SECRET_AGENT);
292+}
293+
294+static void
295+destroy_pending_request (gpointer data)
296+{
297+ SecretRequest* req = (SecretRequest*)data;
298+ /* Reporting the cancellation of all pending requests */
299+ g_signal_emit_by_name (req->agent,
300+ UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
301+ req->id);
302+
303+ free_request (req);
304+}
305+
306+static void
307+unity_settings_secret_agent_finalize (GObject *agent)
308+{
309+ UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
310+
311+ g_queue_free_full (priv->requests, destroy_pending_request);
312+}
313+
314+static void
315+unity_settings_secret_agent_class_init (UnitySettingsSecretAgentClass *klass)
316+{
317+ unity_settings_secret_agent_parent_class = g_type_class_peek_parent (klass);
318+ NMSecretAgentClass *parent_class = NM_SECRET_AGENT_CLASS (klass);
319+ parent_class->get_secrets = get_secrets;
320+ parent_class->save_secrets = save_secrets;
321+ parent_class->delete_secrets = delete_secrets;
322+ parent_class->cancel_get_secrets = cancel_get_secrets;
323+
324+ g_type_class_add_private (klass, sizeof(UnitySettingsSecretAgentPrivate));
325+ G_OBJECT_CLASS (klass)->finalize = unity_settings_secret_agent_finalize;
326+
327+
328+ signals[SECRET_REQUESTED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
329+ G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
330+ G_SIGNAL_RUN_FIRST,
331+ G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, secret_requested),
332+ NULL, NULL, NULL,
333+ G_TYPE_NONE, 5,
334+ G_TYPE_UINT, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT);
335+
336+ signals[REQUEST_CANCELLED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
337+ G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
338+ G_SIGNAL_RUN_FIRST,
339+ G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, request_cancelled),
340+ NULL, NULL, NULL,
341+ G_TYPE_NONE, 1,
342+ G_TYPE_UINT);
343+}
344+
345+
346+static void
347+unity_settings_secret_agent_instance_init (UnitySettingsSecretAgent *self)
348+{
349+ self->priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (self);
350+ self->priv->requests = g_queue_new ();
351+}
352+
353+GType
354+unity_settings_secret_agent_get_type (void)
355+{
356+ static volatile gsize unity_settings_secret_agent_type_id__volatile = 0;
357+ if (g_once_init_enter (&unity_settings_secret_agent_type_id__volatile))
358+ {
359+ static const GTypeInfo g_define_type_info =
360+ {
361+ sizeof (UnitySettingsSecretAgentClass),
362+ (GBaseInitFunc) NULL,
363+ (GBaseFinalizeFunc) NULL,
364+ (GClassInitFunc) unity_settings_secret_agent_class_init,
365+ (GClassFinalizeFunc) NULL,
366+ NULL,
367+ sizeof (UnitySettingsSecretAgent),
368+ 0,
369+ (GInstanceInitFunc) unity_settings_secret_agent_instance_init,
370+ NULL
371+ };
372+ GType unity_settings_secret_agent_type_id;
373+ unity_settings_secret_agent_type_id = g_type_register_static (NM_TYPE_SECRET_AGENT,
374+ "UnitySettingsSecretAgent",
375+ &g_define_type_info,
376+ 0);
377+ g_once_init_leave (&unity_settings_secret_agent_type_id__volatile,
378+ unity_settings_secret_agent_type_id);
379+ }
380+
381+ return unity_settings_secret_agent_type_id__volatile;
382+}
plugins/Unity/Indicators/Network/secret-agent.hnew file+102
@@ -0,0 +1,102 @@
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+ * Alberto Ruiz <alberto.ruiz@canonical.com>
18+ * Renato Araujo Oliveira Filho <renato@canonical.com>
19+ */
20+
21+#ifndef __SECRET_AGENT_H__
22+#define __SECRET_AGENT_H__
23+
24+#include <glib.h>
25+#include <glib-object.h>
26+#include <nm-secret-agent.h>
27+
28+/*
29+ * This class is a basic implementation of the NetworkManager SecretAgent base class.
30+ *
31+ * The purpose of this class is to handle credential requests from the network,
32+ * for example, from a WiFi hotspot or a VPN network.
33+ *
34+ * It queues requests objects (SecretRequest) on a GQueue in the private struct
35+ * of the class. And notifies the consumer of the class through the "secret-request"
36+ * and the "request-cancelled" signals with the following callback prototypes:
37+ *
38+ * void (*secret_requested) (UnitySettingsSecretAgent *self,
39+ * guint id,
40+ * NMConnection *connection,
41+ * const char *setting_name,
42+ * const char **hints,
43+ * NMSecretAgentGetSecretsFlags flags,
44+ * gpointer user_data);
45+ *
46+ * void (*request_cancelled) (UnitySettingsSecretAgent *self,
47+ * guint id,
48+ * gpointer user_data);
49+ *
50+ */
51+
52+
53+G_BEGIN_DECLS
54+
55+
56+#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
57+#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
58+#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
59+#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
60+#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
61+#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
62+
63+#define UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED "secret-requested"
64+#define UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED "request-cancelled"
65+
66+typedef struct _UnitySettingsSecretAgent UnitySettingsSecretAgent;
67+typedef struct _UnitySettingsSecretAgentClass UnitySettingsSecretAgentClass;
68+typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
69+
70+struct _UnitySettingsSecretAgent {
71+ NMSecretAgent parent_instance;
72+ UnitySettingsSecretAgentPrivate * priv;
73+};
74+
75+struct _UnitySettingsSecretAgentClass {
76+ NMSecretAgentClass parent_class;
77+
78+ void (*secret_requested) (UnitySettingsSecretAgent *self,
79+ guint id,
80+ NMConnection *connection,
81+ const char *setting_name,
82+ const char **hints,
83+ NMSecretAgentGetSecretsFlags flags);
84+
85+ void (*request_cancelled) (UnitySettingsSecretAgent *self,
86+ guint id);
87+};
88+
89+
90+GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
91+UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
92+UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
93+
94+void unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
95+ guint request,
96+ GHashTable *secrets);
97+void unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
98+ guint request);
99+
100+G_END_DECLS
101+
102+#endif
plugins/Unity/Indicators/flatmenuproxymodel.cppnew file+272
@@ -0,0 +1,272 @@
1+/*
2+ * Copyright 2012 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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+extern "C" {
21+#include <gio/gio.h>
22+}
23+
24+#include "flatmenuproxymodel.h"
25+#include <QString>
26+#include <QStringList>
27+
28+FlatMenuProxyModel::FlatMenuProxyModel(QAbstractItemModel *source)
29+ : QAbstractProxyModel(source),
30+ m_rowCount(0)
31+{
32+ m_model = new QDBusMenuModel;
33+ setSourceModel(m_model);
34+}
35+
36+/*! \internal */
37+FlatMenuProxyModel::~FlatMenuProxyModel()
38+{
39+ delete m_model;
40+}
41+
42+void FlatMenuProxyModel::setSourceModel(QAbstractItemModel *source)
43+{
44+ if (sourceModel()) {
45+ QAbstractItemModel *oldSource = sourceModel();
46+ if (oldSource == source) {
47+ return;
48+ }
49+
50+ oldSource->disconnect(this);
51+ }
52+
53+ QAbstractProxyModel::setSourceModel(source);
54+
55+ if (source) {
56+
57+ // FIXME - not working correctly with dynamic inserts/removes
58+
59+ connect(source,
60+ SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
61+ SLOT(onModelAboutToBeReset()));
62+ connect(source,
63+ SIGNAL(rowsInserted(QModelIndex,int,int)),
64+ SLOT(onModelReset()));
65+
66+ connect(source,
67+ SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
68+ SLOT(onModelAboutToBeReset()));
69+ connect(source,
70+ SIGNAL(rowsRemoved(QModelIndex,int,int)),
71+ SLOT(onModelReset()));
72+
73+ connect(source,
74+ SIGNAL(modelAboutToBeReset()),
75+ SLOT(onModelAboutToBeReset()));
76+ connect(source,
77+ SIGNAL(modelReset()),
78+ SLOT(onModelReset()));
79+
80+ connect(source,
81+ SIGNAL(statusChanged(DBusEnums::ConnectionStatus)),
82+ SIGNAL(statusChanged()));
83+
84+ // initiliaze rowCount
85+ QModelIndex lastItem = source->index(source->rowCount() - 1, 0);
86+ m_rowCount = recursiveRowCount(lastItem);
87+ } else {
88+ m_rowCount = 0;
89+ }
90+
91+ Q_EMIT countChanged();
92+}
93+
94+void FlatMenuProxyModel::setBusName(const QString &busName)
95+{
96+ m_model->setBusName(busName);
97+}
98+
99+QString FlatMenuProxyModel::busName() const
100+{
101+ return m_model->busName();
102+}
103+
104+void FlatMenuProxyModel::setObjectPath(const QString &busPath)
105+{
106+ m_model->setObjectPath(busPath);
107+}
108+
109+QString FlatMenuProxyModel::objectPath() const
110+{
111+ return m_model->objectPath();
112+}
113+
114+int FlatMenuProxyModel::status() const
115+{
116+ return m_model->status();
117+}
118+
119+DBusEnums::BusType FlatMenuProxyModel::busType() const
120+{
121+ return m_model->busType();
122+}
123+
124+void FlatMenuProxyModel::setIntBusType(int type)
125+{
126+ m_model->setBusType((DBusEnums::BusType) type);
127+}
128+
129+void FlatMenuProxyModel::start()
130+{
131+ m_model->start();
132+}
133+
134+void FlatMenuProxyModel::stop()
135+{
136+ m_model->stop();
137+}
138+
139+QModelIndex FlatMenuProxyModel::mapFromSource(const QModelIndex &index) const
140+{
141+ if (!index.isValid()) {
142+ return QModelIndex();
143+ }
144+
145+ QModelIndex result = createIndex(rowOffsetOf(index, index.row()), 0);
146+ return result;
147+}
148+
149+QModelIndex FlatMenuProxyModel::mapToSource(const QModelIndex &index) const
150+{
151+ if (sourceModel() && m_indexCache.contains(index.row())) {
152+ QString key = m_indexCache.value(index.row());
153+ QStringList sections = key.split('.', QString::SkipEmptyParts);
154+ QModelIndex sourceIndex = QModelIndex();
155+ for(int i=0; i < sections.size(); i++) {
156+ sourceIndex = sourceModel()->index(sections.at(i).toInt(), 9, sourceIndex);
157+ }
158+ return sourceIndex;
159+ } else {
160+ return QModelIndex();
161+ }
162+}
163+
164+QModelIndex FlatMenuProxyModel::index(int row, int sectionRow, const QModelIndex &parent, const QString &key) const
165+{
166+ for (int i = 0, count = 0; i < sourceModel()->rowCount(parent); i++) {
167+ QModelIndex sourceIndex = sourceModel()->index(i, 0, parent);
168+ int indexCount = recursiveRowCount(sourceIndex);
169+
170+ if (count == sectionRow) {
171+ QString sectionKey = key + "." + QString::number(i);
172+ m_indexCache.insert(row, sectionKey);
173+ return createIndex(row, 0);
174+ } else if ((count + indexCount) >= sectionRow) {
175+ count++;
176+ return index(row, sectionRow - count, sourceIndex, key + "." + QString::number(i));
177+ }
178+
179+ count += indexCount + 1;
180+ }
181+ return QModelIndex();
182+}
183+
184+QModelIndex FlatMenuProxyModel::index(int row, int, const QModelIndex &) const
185+{
186+ return index(row, row, QModelIndex(), "");
187+}
188+
189+QModelIndex FlatMenuProxyModel::parent(const QModelIndex &) const
190+{
191+ return QModelIndex();
192+}
193+
194+int FlatMenuProxyModel::columnCount(const QModelIndex &) const
195+{
196+ return 1;
197+}
198+
199+int FlatMenuProxyModel::rowCount(const QModelIndex &) const
200+{
201+ return m_rowCount;
202+}
203+
204+int FlatMenuProxyModel::count() const
205+{
206+ return rowCount(QModelIndex());
207+}
208+
209+void FlatMenuProxyModel::onModelAboutToBeReset()
210+{
211+ beginResetModel();
212+}
213+
214+void FlatMenuProxyModel::onModelReset()
215+{
216+ // initiliaze rowCount
217+ m_rowCount = 0;
218+ for (int i = 0, iMax = sourceModel()->rowCount(); i < iMax; i++) {
219+ QModelIndex index = sourceModel()->index(i, 0);
220+ m_rowCount += recursiveRowCount(index) + 1;
221+ }
222+ m_indexCache.clear();
223+ endResetModel();
224+ Q_EMIT countChanged();
225+}
226+
227+int FlatMenuProxyModel::recursiveRowCount(const QModelIndex &index) const
228+{
229+ int size = sourceModel()->rowCount(index);
230+ for (int i=0, iMax=size; i < iMax; i++) {
231+ QModelIndex currentIndex = sourceModel()->index(i, 0, index);
232+ size += recursiveRowCount(currentIndex);
233+ }
234+
235+ return size;
236+}
237+
238+int FlatMenuProxyModel::rowOffsetOf(const QModelIndex &index, int row, bool inclusive) const
239+{
240+ int offset = 0;
241+
242+ QModelIndex parent = index.parent();
243+
244+ // Check row 0 offset
245+ while(parent.isValid()) {
246+ offset += 1;
247+ for (int i = 0; i < parent.row(); i++) {
248+ QModelIndex currentIndex = sourceModel()->index(i, 0, parent);
249+ offset += recursiveRowCount(currentIndex) + 1;
250+ }
251+ parent = parent.parent();
252+ }
253+
254+ // Check index.row() offset
255+ for(int i = 0; i < row; i++) {
256+ QModelIndex currentIndex = sourceModel()->index(i, 0, index.parent());
257+ offset += recursiveRowCount(currentIndex) + 1;
258+ }
259+
260+ if (inclusive) {
261+ // itself
262+ QModelIndex currentIndex = sourceModel()->index(row, 0, index.parent());
263+ offset += recursiveRowCount(currentIndex);
264+ }
265+
266+ return offset;
267+}
268+
269+QVariant FlatMenuProxyModel::data(int row, int role) const
270+{
271+ return QAbstractProxyModel::data(index(row, 0), role);
272+}
plugins/Unity/Indicators/flatmenuproxymodel.hnew file+91
@@ -0,0 +1,91 @@
1+/*
2+ * Copyright 2012 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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+#ifndef FLATMENUPROXYMODEL_H
21+#define FLATMENUPROXYMODEL_H
22+
23+#include <QAbstractProxyModel>
24+#include <qdbusmenumodel.h>
25+
26+class SectionInfo;
27+
28+class FlatMenuProxyModel : public QAbstractProxyModel
29+{
30+ Q_OBJECT
31+ Q_PROPERTY(int count READ count NOTIFY countChanged)
32+ Q_PROPERTY(int busType READ busType WRITE setIntBusType NOTIFY busTypeChanged)
33+ Q_PROPERTY(QString busName READ busName WRITE setBusName NOTIFY busNameChanged)
34+ Q_PROPERTY(QString objectPath READ objectPath WRITE setObjectPath NOTIFY objectPathChanged)
35+ Q_PROPERTY(int status READ status NOTIFY statusChanged)
36+
37+ Q_ENUMS(Roles)
38+public:
39+ FlatMenuProxyModel(QAbstractItemModel *source=0);
40+ ~FlatMenuProxyModel();
41+
42+ void setSourceModel(QAbstractItemModel * sourceModel);
43+
44+ Q_INVOKABLE QVariant data(int row, int role = Qt::DisplayRole) const;
45+
46+ QModelIndex mapFromSource(const QModelIndex &index) const;
47+ QModelIndex mapToSource(const QModelIndex &index) const;
48+
49+ QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
50+ QModelIndex parent(const QModelIndex &index) const;
51+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
52+ int count() const;
53+ int columnCount(const QModelIndex &parent) const;
54+
55+ void setBusName(const QString &busName);
56+ QString busName() const;
57+
58+ void setObjectPath(const QString &busName);
59+ QString objectPath() const;
60+
61+ DBusEnums::BusType busType() const;
62+ void setIntBusType(int type);
63+
64+ int status() const;
65+
66+public Q_SLOTS:
67+ void onModelAboutToBeReset();
68+ void onModelReset();
69+
70+ void start();
71+ void stop();
72+
73+Q_SIGNALS:
74+ void countChanged();
75+
76+ void busTypeChanged();
77+ void busNameChanged();
78+ void objectPathChanged();
79+ void statusChanged();
80+
81+private:
82+ QDBusMenuModel *m_model;
83+ mutable QMap<int, QString> m_indexCache;
84+ int m_rowCount;
85+
86+ int rowOffsetOf(const QModelIndex &index, int row, bool inclusive = false) const;
87+ int recursiveRowCount(const QModelIndex &index) const;
88+ QModelIndex index(int row, int rowCount, const QModelIndex &parent, const QString &key) const;
89+};
90+
91+#endif
plugins/Unity/Indicators/indicator.cppnew file+88
@@ -0,0 +1,88 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+#include "indicator.h"
21+
22+#include <QStringList>
23+
24+Indicator::Indicator(QObject *parent)
25+ : QObject(parent)
26+{
27+}
28+
29+Indicator::~Indicator()
30+{
31+}
32+
33+void Indicator::init(const QString& busName, const QSettings& settings)
34+{
35+ setId(settings.value("Indicator Service/Name").toString());
36+
37+ QString actionObjectPath = settings.value("Indicator Service/ObjectPath").toString();
38+
39+ QVariantMap mapMenuObjectPaths;
40+ Q_FOREACH(const QString& childGroup, settings.childGroups())
41+ {
42+ if (childGroup == "Indicator Service")
43+ continue;
44+
45+ QString menuPath = childGroup+"/ObjectPath";
46+ if (settings.contains(menuPath))
47+ {
48+ mapMenuObjectPaths[childGroup] = settings.value(menuPath).toString();
49+ }
50+ }
51+
52+
53+ QVariantMap properties;
54+ properties.clear();
55+ properties.insert("busType", 1);
56+ properties.insert("busName", busName);
57+ properties.insert("actionsObjectPath", actionObjectPath);
58+ properties.insert("menuObjectPaths", mapMenuObjectPaths);
59+ setIndicatorProperties(properties);
60+}
61+
62+QString Indicator::identifier() const
63+{
64+ return m_identifier;
65+}
66+
67+void Indicator::setId(const QString &identifier)
68+{
69+ if (identifier != m_identifier) {
70+ m_identifier = identifier;
71+ Q_EMIT identifierChanged(m_identifier);
72+ }
73+}
74+
75+
76+QVariant Indicator::indicatorProperties() const
77+{
78+ return m_properties;
79+}
80+
81+void Indicator::setIndicatorProperties(const QVariant &properties)
82+{
83+ if (m_properties != properties)
84+ {
85+ m_properties = properties;
86+ Q_EMIT indicatorPropertiesChanged(m_properties);
87+ }
88+}
plugins/Unity/Indicators/indicator.hnew file+57
@@ -0,0 +1,57 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Nick Dedekind <nick.dedekind@canonical.com>
19+ */
20+
21+#ifndef INDICATOR_H
22+#define INDICATOR_H
23+
24+#include <QObject>
25+#include <QSettings>
26+
27+class Indicator : public QObject
28+{
29+ Q_OBJECT
30+ Q_PROPERTY(QString identifier READ identifier NOTIFY identifierChanged)
31+ Q_PROPERTY(QVariant indicatorProperties READ indicatorProperties NOTIFY indicatorPropertiesChanged)
32+
33+public:
34+ typedef QSharedPointer<Indicator> Ptr;
35+
36+ Indicator(QObject *parent = 0);
37+ virtual ~Indicator();
38+
39+ void init(const QString& busName, const QSettings& settings);
40+
41+ QString identifier() const;
42+ QVariant indicatorProperties() const;
43+
44+Q_SIGNALS:
45+ void identifierChanged(const QString &identifier);
46+ void indicatorPropertiesChanged(const QVariant &properties);
47+
48+protected:
49+ void setId(const QString &id);
50+ void setIndicatorProperties(const QVariant &properties);
51+
52+private:
53+ QString m_identifier;
54+ QVariant m_properties;
55+};
56+
57+#endif // INDICATOR_H
plugins/Unity/Indicators/indicators.hnew file+103
@@ -0,0 +1,103 @@
1+/*
2+ * Copyright (C) 2012 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+#ifndef INDICATORS_H
20+#define INDICATORS_H
21+
22+#include <QObject>
23+
24+class ActionState : public QObject
25+{
26+ Q_OBJECT
27+public:
28+ Q_ENUMS(ActionStates)
29+ enum ActionStates {
30+ Label = 0x00,
31+ IconSource = 0x01,
32+ AccessableName = 0x02,
33+ Visible = 0x03,
34+ };
35+
36+ ActionState(QObject*parent=0):QObject(parent) {}
37+};
38+
39+class NetworkActionState : public QObject
40+{
41+ Q_OBJECT
42+public:
43+ Q_ENUMS(NetworkActionStates)
44+ enum NetworkActionStates {
45+ Connection = 0x01,
46+ SignalStrength = 0x02,
47+ };
48+
49+ NetworkActionState(QObject*parent=0):QObject(parent) {}
50+};
51+
52+class NetworkConnection : public QObject
53+{
54+ Q_OBJECT
55+public:
56+ Q_ENUMS(NetworkConnectionStates)
57+ enum NetworkConnectionStates {
58+ Initial = 0x00,
59+ Activating = 0x01,
60+ Activated = 0x02,
61+ Deactivating = 0x03,
62+ };
63+
64+ NetworkConnection(QObject*parent=0):QObject(parent) {}
65+};
66+
67+class IndicatorsModelRole : public QObject
68+{
69+ Q_OBJECT
70+public:
71+ Q_ENUMS(Roles)
72+ enum Roles {
73+ Identifier = 0,
74+ Priority,
75+ Title,
76+ Description,
77+ WidgetSource,
78+ PageSource,
79+ IndicatorProperties,
80+ IsValid
81+ };
82+
83+ IndicatorsModelRole(QObject*parent=0):QObject(parent) {}
84+};
85+
86+class FlatMenuProxyModelRole : public QObject
87+{
88+ Q_OBJECT
89+public:
90+ Q_ENUMS(Roles)
91+ enum Roles {
92+ Action = Qt::DisplayRole + 1,
93+ Label,
94+ Extra,
95+ Depth,
96+ hasSection,
97+ hasSubMenu
98+ };
99+
100+ FlatMenuProxyModelRole(QObject*parent=0):QObject(parent) {}
101+};
102+
103+#endif // INDICATORS_H
plugins/Unity/Indicators/indicatorsmanager.cppnew file+285
@@ -0,0 +1,285 @@
1+/*
2+ * Copyright (C) 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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+#include "indicatorsmanager.h"
20+
21+#include <QSettings>
22+#include <QDebug>
23+
24+#include "paths.h"
25+
26+
27+class IndicatorsManager::IndicatorData
28+{
29+public:
30+ IndicatorData(const QString& name, const QFileInfo& fileInfo)
31+ : m_name(name)
32+ , m_fileInfo(fileInfo)
33+ , m_verified (true)
34+ {}
35+
36+ QString m_name;
37+ QFileInfo m_fileInfo;
38+
39+ bool m_verified;
40+ Indicator::Ptr m_indicator;
41+};
42+
43+IndicatorsManager::IndicatorsManager(QObject* parent)
44+ : QObject(parent)
45+ , m_loaded(false)
46+{
47+}
48+
49+IndicatorsManager::~IndicatorsManager()
50+{
51+ unload();
52+}
53+
54+void IndicatorsManager::load()
55+{
56+ unload();
57+ QStringList xdgLocations = shellDataDirs();//QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
58+
59+ m_fsWatcher.reset(new QFileSystemWatcher(this));
60+
61+ Q_FOREACH(const QString& xdgLocation, xdgLocations)
62+ {
63+ QString indicator_path = QDir::cleanPath(xdgLocation + "/unity/indicators");
64+ QDir indicator_dir(indicator_path);
65+ if (indicator_dir.exists())
66+ {
67+ // watch folder for changes.
68+ m_fsWatcher->addPath(indicator_path);
69+
70+ loadDir(indicator_dir);
71+ }
72+ }
73+
74+ QObject::connect(m_fsWatcher.data(), SIGNAL(directoryChanged(const QString&)), this, SLOT(onDirectoryChanged(const QString&)));
75+ QObject::connect(m_fsWatcher.data(), SIGNAL(fileChanged(const QString&)), this, SLOT(onFileChanged(const QString&)));
76+ setLoaded(true);
77+}
78+
79+void IndicatorsManager::onDirectoryChanged(const QString& directory)
80+{
81+ loadDir(QDir(directory));
82+}
83+
84+void IndicatorsManager::onFileChanged(const QString& file)
85+{
86+ QFileInfo file_info(file);
87+ if (!file_info.exists())
88+ {
89+ unloadFile(file_info);
90+ return;
91+ }
92+ else
93+ {
94+ loadFile(QFileInfo(file));
95+ }
96+}
97+
98+void IndicatorsManager::loadDir(const QDir& dir)
99+{
100+ startVerify(dir.canonicalPath());
101+
102+ QFileInfoList indicator_files = dir.entryInfoList(QStringList(), QDir::Files|QDir::NoDotAndDotDot);
103+ Q_FOREACH(const QFileInfo& indicator_file, indicator_files)
104+ {
105+ loadFile(indicator_file);
106+ }
107+
108+ endVerify(dir.canonicalPath());
109+}
110+
111+void IndicatorsManager::loadFile(const QFileInfo& file_info)
112+{
113+ QSettings indicator_settings(file_info.absoluteFilePath(), QSettings::IniFormat, this);
114+ QString name = indicator_settings.value("Indicator Service/Name").toString();
115+
116+ auto iter = m_indicatorsData.find(name);
117+ if (iter != m_indicatorsData.end())
118+ {
119+ QString newFileInfoDir = QDir::cleanPath(file_info.canonicalPath());
120+ IndicatorData* currentData = (*iter);
121+ currentData->m_verified = true;
122+
123+ int file_info_location = -1;
124+ int current_data_location = -1;
125+
126+ QString currentDataDir = QDir::cleanPath(currentData->m_fileInfo.canonicalPath());
127+
128+ // if we've already got this indicator, we need to make sure we're not overwriting data which is
129+ // from a lower priority standard path
130+ QStringList xdgLocations = shellDataDirs();
131+ for (int i = 0; i < xdgLocations.size(); i++)
132+ {
133+ QString indicatorDir = QDir::cleanPath(xdgLocations[i] + "/unity/indicators");
134+
135+ if (newFileInfoDir == indicatorDir)
136+ {
137+ file_info_location = i;
138+ }
139+ if (currentDataDir == indicatorDir)
140+ {
141+ current_data_location = i;
142+ }
143+
144+ if (file_info_location != -1 && current_data_location != -1)
145+ {
146+ break;
147+ }
148+ }
149+
150+ // file location is higher (or of equal) priority. overwrite.
151+ if (file_info_location <= current_data_location &&
152+ file_info != currentData->m_fileInfo)
153+ {
154+ currentData->m_fileInfo = file_info;
155+ Q_EMIT indicatorLoaded(name);
156+ }
157+ }
158+ else
159+ {
160+ IndicatorData* data = new IndicatorData(name, file_info);
161+ data->m_verified = true;
162+ m_indicatorsData[name]= data;
163+ Q_EMIT indicatorLoaded(name);
164+ }
165+}
166+
167+void IndicatorsManager::unload()
168+{
169+ QHashIterator<QString, IndicatorData*> iter(m_indicatorsData);
170+ while(iter.hasNext())
171+ {
172+ iter.next();
173+ Q_EMIT indicatorAboutToBeUnloaded(iter.key());
174+ }
175+
176+ qDeleteAll(m_indicatorsData);
177+ m_indicatorsData.clear();
178+
179+ setLoaded(false);
180+}
181+
182+void IndicatorsManager::unloadFile(const QFileInfo& file)
183+{
184+ QMutableHashIterator<QString, IndicatorData*> iter(m_indicatorsData);
185+ while(iter.hasNext())
186+ {
187+ iter.next();
188+ IndicatorData* data = iter.value();
189+ if (data->m_fileInfo.absoluteFilePath() == file.absoluteFilePath())
190+ {
191+ if (!data->m_verified)
192+ {
193+ QString name = data->m_name;
194+ Q_EMIT indicatorAboutToBeUnloaded(name);
195+
196+ delete data;
197+ iter.remove();
198+ }
199+ }
200+ }
201+
202+ setLoaded(m_indicatorsData.size() > 0);
203+}
204+
205+void IndicatorsManager::setLoaded(bool loaded)
206+{
207+ if (loaded != m_loaded)
208+ {
209+ m_loaded = loaded;
210+ Q_EMIT loadedChanged(m_loaded);
211+ }
212+}
213+
214+void IndicatorsManager::startVerify(const QString& path)
215+{
216+ QHashIterator<QString, IndicatorData*> iter(m_indicatorsData);
217+ while(iter.hasNext())
218+ {
219+ iter.next();
220+ IndicatorData* data = iter.value();
221+ if (data->m_fileInfo.canonicalPath() == path)
222+ {
223+ data->m_verified = false;
224+ }
225+ }
226+}
227+
228+void IndicatorsManager::endVerify(const QString& path)
229+{
230+ QMutableHashIterator<QString, IndicatorData*> iter(m_indicatorsData);
231+ while(iter.hasNext())
232+ {
233+ iter.next();
234+ IndicatorData* data = iter.value();
235+ if (data->m_fileInfo.canonicalPath() == path)
236+ {
237+ if (!data->m_verified)
238+ {
239+ QString name = data->m_name;
240+ Q_EMIT indicatorAboutToBeUnloaded(name);
241+
242+ delete data;
243+ iter.remove();
244+ }
245+ }
246+ }
247+}
248+
249+Indicator::Ptr IndicatorsManager::indicator(const QString& indicator_name)
250+{
251+ if (!m_indicatorsData.contains(indicator_name))
252+ {
253+ qWarning() << Q_FUNC_INFO << "Invalid indicator name: " << indicator_name;
254+ return Indicator::Ptr();
255+ }
256+
257+ IndicatorData *data = m_indicatorsData[indicator_name];
258+ if (data->m_indicator)
259+ {
260+ return data->m_indicator;
261+ }
262+
263+ Indicator::Ptr new_indicator(new Indicator(this));
264+ data->m_indicator = new_indicator;
265+ QSettings settings(data->m_fileInfo.absoluteFilePath(), QSettings::IniFormat, this);
266+ new_indicator->init(data->m_fileInfo.fileName(), settings);
267+ return new_indicator;
268+}
269+
270+QList<Indicator::Ptr> IndicatorsManager::indicators()
271+{
272+ QList<Indicator::Ptr> list;
273+ Q_FOREACH(IndicatorData* data, m_indicatorsData)
274+ {
275+ Indicator::Ptr ret = indicator(data->m_name);
276+ if (ret)
277+ list.append(ret);
278+ }
279+ return list;
280+}
281+
282+bool IndicatorsManager::isLoaded() const
283+{
284+ return m_loaded;
285+}
plugins/Unity/Indicators/indicatorsmanager.hnew file+73
@@ -0,0 +1,73 @@
1+/*
2+ * Copyright (C) 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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+#ifndef INDICATORS_MANAGER_H
20+#define INDICATORS_MANAGER_H
21+
22+#include <QObject>
23+#include <QFileSystemWatcher>
24+#include <QDir>
25+#include <QHash>
26+#include <QSharedPointer>
27+
28+#include "indicator.h"
29+
30+class IndicatorsManager : public QObject
31+{
32+ Q_OBJECT
33+ Q_PROPERTY(bool loaded READ isLoaded NOTIFY loadedChanged)
34+public:
35+ explicit IndicatorsManager(QObject* parent = 0);
36+ ~IndicatorsManager();
37+
38+ Q_INVOKABLE void load();
39+ Q_INVOKABLE void unload();
40+
41+ Indicator::Ptr indicator(const QString& indicator_name);
42+
43+ QList<Indicator::Ptr> indicators();
44+
45+ bool isLoaded() const;
46+
47+Q_SIGNALS:
48+ void loadedChanged(bool);
49+
50+ void indicatorLoaded(const QString& indicator_name);
51+ void indicatorAboutToBeUnloaded(const QString& indicator_name);
52+
53+private Q_SLOTS:
54+ void onDirectoryChanged(const QString& directory);
55+ void onFileChanged(const QString& file);
56+
57+private:
58+ void loadDir(const QDir& dir);
59+ void loadFile(const QFileInfo& file);
60+ void unloadFile(const QFileInfo& dir);
61+
62+ void startVerify(const QString& path);
63+ void endVerify(const QString& path);
64+
65+ void setLoaded(bool);
66+
67+ class IndicatorData;
68+ QHash<QString, IndicatorData*> m_indicatorsData;
69+ QSharedPointer<QFileSystemWatcher> m_fsWatcher;
70+ bool m_loaded;
71+};
72+
73+#endif // INDICATORS_MANAGER_H
plugins/Unity/Indicators/indicatorsmodel.cppnew file+321
@@ -0,0 +1,321 @@
1+/*
2+ * Copyright 2012 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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+#include "indicatorsmodel.h"
21+#include "indicatorsmanager.h"
22+#include "indicator.h"
23+#include "indicators.h"
24+#include "paths.h"
25+
26+#include <QQmlContext>
27+#include <QQmlEngine>
28+#include <QDebug>
29+
30+/*!
31+ \qmltype IndicatorsModel
32+ \inherits QAbstractListModel
33+
34+ \brief The IndicatorsModel class defines the list model for indicators
35+
36+ \b {This component is under heavy development.}
37+
38+ This class expose the available indicators.
39+
40+ \code
41+ IndicatorsModel {
42+ id: menuModel
43+ }
44+
45+ ListView {
46+ id: view
47+ model: menuModel
48+ Component.onCompleted: menuModel.load()
49+ }
50+ \endcode
51+*/
52+IndicatorsModel::IndicatorsModel(QObject *parent)
53+ : QAbstractListModel(parent)
54+{
55+ m_manager = new IndicatorsManager(this);
56+ QObject::connect(m_manager, SIGNAL(indicatorLoaded(const QString&)), this, SLOT(onIndicatorLoaded(const QString&)));
57+ QObject::connect(m_manager, SIGNAL(indicatorAboutToBeUnloaded(const QString&)), this, SLOT(onIndicatorAboutToBeUnloaded(const QString&)));
58+
59+ QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
60+ QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
61+ QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
62+}
63+
64+/*! \internal */
65+IndicatorsModel::~IndicatorsModel()
66+{
67+ disconnect(m_manager, 0, 0, 0);
68+ m_manager->deleteLater();
69+}
70+
71+/*!
72+ \qmlproperty IndicatorsModel::count
73+ The number of data entries in the model.
74+
75+ \b Note: methods should only be called after the Component has completed.
76+*/
77+int IndicatorsModel::count() const
78+{
79+ return rowCount();
80+}
81+
82+/*!
83+ \qmlmethod IndicatorsModel::unload()
84+
85+ Load all indicators.
86+*/
87+void IndicatorsModel::load()
88+{
89+ m_indicators.clear();
90+ m_manager->load();
91+}
92+
93+/*!
94+ \qmlmethod IndicatorsModel::unload()
95+
96+ Unload all indicators.
97+*/
98+void IndicatorsModel::unload()
99+{
100+ m_manager->unload();
101+}
102+
103+/*! \internal */
104+void IndicatorsModel::onIndicatorLoaded(const QString& indicator_name)
105+{
106+ Indicator::Ptr indicator = m_manager->indicator(indicator_name);
107+ if (!indicator)
108+ {
109+ return;
110+ }
111+
112+ if (m_indicators.indexOf(indicator) >= 0)
113+ {
114+ return;
115+ }
116+
117+ // find the insert position
118+ int pos = 0;
119+ while (pos < count())
120+ {
121+ // keep going while the existing priority is less.
122+ if (indicatorData(indicator, IndicatorsModelRole::Priority).toInt() < data(index(pos), IndicatorsModelRole::Priority).toInt())
123+ break;
124+ pos++;
125+ }
126+
127+ QObject::connect(indicator.data(), SIGNAL(identifierChanged(const QString&)), this, SLOT(onIdentifierChanged()));
128+ QObject::connect(indicator.data(), SIGNAL(indicatorPropertiesChanged(const QVariant&)), this, SLOT(onIndicatorPropertiesChanged()));
129+
130+ beginInsertRows(QModelIndex(), pos, pos);
131+
132+ m_indicators.insert(pos, indicator);
133+ endInsertRows();
134+}
135+
136+/*! \internal */
137+void IndicatorsModel::onIndicatorAboutToBeUnloaded(const QString& indicator_name)
138+{
139+ Indicator::Ptr indicator = m_manager->indicator(indicator_name);
140+ if (!indicator)
141+ {
142+ return;
143+ }
144+
145+ int i = 0;
146+ QMutableListIterator<Indicator::Ptr> iter(m_indicators);
147+ while(iter.hasNext())
148+ {
149+ if (indicator == iter.next())
150+ {
151+ beginRemoveRows(QModelIndex(), i, i);
152+ iter.remove();
153+ endRemoveRows();
154+ break;
155+ }
156+ i++;
157+ }
158+
159+}
160+
161+/*! \internal */
162+void IndicatorsModel::onIdentifierChanged()
163+{
164+ notifyDataChanged(QObject::sender(), IndicatorsModelRole::Identifier);
165+}
166+
167+/*! \internal */
168+void IndicatorsModel::onIndicatorPropertiesChanged()
169+{
170+ notifyDataChanged(QObject::sender(), IndicatorsModelRole::IndicatorProperties);
171+}
172+
173+/*! \internal */
174+void IndicatorsModel::notifyDataChanged(QObject *sender, int role)
175+{
176+ Indicator* indicator = qobject_cast<Indicator*>(sender);
177+ if (!indicator)
178+ {
179+ return;
180+ }
181+
182+ int index = 0;
183+ QMutableListIterator<Indicator::Ptr> iter(m_indicators);
184+ while(iter.hasNext())
185+ {
186+ if (indicator == iter.next())
187+ {
188+ QModelIndex changedIndex = this->index(index);
189+ dataChanged(changedIndex, changedIndex, QVector<int>() << role);
190+ break;
191+ }
192+ index++;
193+ }
194+}
195+
196+/*! \internal */
197+QHash<int, QByteArray> IndicatorsModel::roleNames() const
198+{
199+ static QHash<int, QByteArray> roles;
200+ if (roles.isEmpty())
201+ {
202+ roles[IndicatorsModelRole::Identifier] = "identifier";
203+ roles[IndicatorsModelRole::Priority] = "priority";
204+ roles[IndicatorsModelRole::Title] = "title";
205+ roles[IndicatorsModelRole::Description] = "description";
206+ roles[IndicatorsModelRole::WidgetSource] = "widgetSource";
207+ roles[IndicatorsModelRole::PageSource] = "pageSource";
208+ roles[IndicatorsModelRole::IndicatorProperties] = "indicatorProperties";
209+ roles[IndicatorsModelRole::IsValid] = "isValid";
210+ }
211+ return roles;
212+}
213+
214+/*! \internal */
215+int IndicatorsModel::columnCount(const QModelIndex &) const
216+{
217+ return 1;
218+}
219+
220+/*! \internal */
221+QVariant IndicatorsModel::defaultData(Indicator::Ptr indicator, int role)
222+{
223+ switch (role)
224+ {
225+ case IndicatorsModelRole::Priority:
226+ return 0;
227+ case IndicatorsModelRole::Title:
228+ return indicator ? indicator->identifier() : "Unknown";
229+ case IndicatorsModelRole::Description:
230+ return "";
231+ case IndicatorsModelRole::WidgetSource:
232+ return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml";
233+ case IndicatorsModelRole::PageSource:
234+ return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml";
235+ }
236+ return QVariant();
237+}
238+
239+Q_INVOKABLE QVariant IndicatorsModel::data(int row, int role) const
240+{
241+ return data(index(row, 0), role);
242+}
243+
244+/*! \internal */
245+QVariant IndicatorsModel::data(const QModelIndex &index, int role) const
246+{
247+ if (!index.isValid() || index.row() >= m_indicators.size())
248+ return QVariant();
249+
250+ Indicator::Ptr indicator = m_indicators[index.row()];
251+
252+ switch (role)
253+ {
254+ case IndicatorsModelRole::Identifier:
255+ if (indicator)
256+ {
257+ return QVariant(indicator->identifier());
258+ }
259+ break;
260+ case IndicatorsModelRole::IndicatorProperties:
261+ if (indicator)
262+ {
263+ return QVariant(indicator->indicatorProperties());
264+ }
265+ break;
266+ case IndicatorsModelRole::IsValid:
267+ return (indicator ? true : false);
268+ case IndicatorsModelRole::Priority:
269+ case IndicatorsModelRole::Title:
270+ case IndicatorsModelRole::Description:
271+ case IndicatorsModelRole::WidgetSource:
272+ case IndicatorsModelRole::PageSource:
273+ return indicatorData(indicator, role);
274+ default:
275+ break;
276+ }
277+ return QVariant();
278+}
279+
280+QVariant IndicatorsModel::indicatorData(const Indicator::Ptr& indicator, int role) const
281+{
282+ if (indicator && m_parsed_indicator_data.contains(indicator->identifier()))
283+ {
284+ QVariantMap data = m_parsed_indicator_data[indicator->identifier()];
285+ return data.value(roleNames()[role], QVariant());
286+ }
287+ return defaultData(indicator, role);
288+}
289+
290+/*! \internal */
291+QModelIndex IndicatorsModel::parent(const QModelIndex&) const
292+{
293+ return QModelIndex();
294+}
295+
296+/*! \internal */
297+int IndicatorsModel::rowCount(const QModelIndex&) const
298+{
299+ return m_indicators.count();
300+}
301+
302+void IndicatorsModel::setIndicatorData(const QVariant& data)
303+{
304+ m_indicator_data = data;
305+
306+ m_parsed_indicator_data.clear();
307+ QMap<QString, QVariant> map = data.toMap();
308+ QMapIterator<QString, QVariant> iter(map);
309+ while(iter.hasNext())
310+ {
311+ iter.next();
312+ m_parsed_indicator_data[iter.key()] = iter.value().toMap();
313+ }
314+
315+ Q_EMIT indicatorDataChanged(m_indicator_data);
316+}
317+
318+QVariant IndicatorsModel::indicatorData() const
319+{
320+ return m_indicator_data;
321+}
tests/mocks/Ubuntu/ChewieUI/fake_pluginmodel.h → plugins/Unity/Indicators/indicatorsmodel.hrenamed+32−45
@@ -15,65 +15,35 @@
1515 *
1616 * Authors:
1717 * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Nick Dedekind <nick.dedekind@canonical.com>
1819 */
1920
20−#ifndef PLUGINMODEL_H
21−#define PLUGINMODEL_H
21+#ifndef INDICATORSMODEL_H
22+#define INDICATORSMODEL_H
23+
24+#include "indicator.h"
2225
2326#include <QAbstractListModel>
2427#include <QQmlEngine>
2528
29+class IndicatorsManager;
2630
27−class WidgetsMap : public QObject
28−{
29− Q_OBJECT
30−public:
31− WidgetsMap(QObject *parent=0)
32− : QObject(parent)
33− {}
34−
35− void append(QMap<QString, QUrl> types)
36− {
37− Q_FOREACH(QString key, types.keys()) {
38− m_map.insert(key, types[key]);
39− }
40− }
41− void clear() { m_map.clear(); }
42−
43− Q_INVOKABLE QMap<QString, QUrl> map() const { return m_map; }
44− Q_INVOKABLE QUrl find(const QString &widget) const { return m_map[widget]; }
45−
46−private:
47− QMap<QString, QUrl> m_map;
48−};
49−
50−
51−class PluginModel : public QAbstractListModel
31+class IndicatorsModel : public QAbstractListModel
5232{
5333 Q_OBJECT
54− Q_PROPERTY(WidgetsMap* widgetsMap READ widgetsMap NOTIFY widgetsMapChanged)
34+ Q_ENUMS(Roles)
5535 Q_PROPERTY(int count READ count NOTIFY countChanged)
36+ Q_PROPERTY(QVariant indicatorData READ indicatorData WRITE setIndicatorData NOTIFY indicatorDataChanged)
5637
5738public:
58− enum ModelRoles {
59− Title = 0,
60− IconSource,
61− Label,
62− Description,
63− QMLComponent,
64− InitialProperties,
65− IsValid
66− };
67−
68− PluginModel(QObject *parent=0);
69− ~PluginModel();
7039
71− WidgetsMap* widgetsMap() const;
40+ IndicatorsModel(QObject *parent=0);
41+ ~IndicatorsModel();
7242
7343 Q_INVOKABLE void load();
7444 Q_INVOKABLE void unload();
7545
76− Q_INVOKABLE QVariantMap get(int row) const;
46+ Q_INVOKABLE QVariant data(int row, int role = Qt::DisplayRole) const;
7747
7848 /* QAbstractItemModel */
7949 QHash<int, QByteArray> roleNames() const;
@@ -82,13 +52,30 @@ public:
8252 QModelIndex parent (const QModelIndex &index) const;
8353 int rowCount(const QModelIndex &parent = QModelIndex()) const;
8454
55+ void setIndicatorData(const QVariant& data);
56+ QVariant indicatorData() const;
57+
8558Q_SIGNALS:
86− void widgetsMapChanged(WidgetsMap *widgetsMap);
8759 void countChanged();
60+ void indicatorDataChanged(const QVariant& data);
61+
62+private Q_SLOTS:
63+ void onIdentifierChanged();
64+ void onIndicatorPropertiesChanged();
65+ void onIndicatorLoaded(const QString& indicator);
66+ void onIndicatorAboutToBeUnloaded(const QString& indicator);
8867
8968private:
90− WidgetsMap* m_widgetsMap;
69+ IndicatorsManager *m_manager;
70+
71+ QList<Indicator::Ptr> m_indicators;
72+ QVariant m_indicator_data;
73+ QMap<QString, QVariantMap> m_parsed_indicator_data;
74+
75+ void notifyDataChanged(QObject *sender, int role);
9176 int count() const;
77+ QVariant indicatorData(const Indicator::Ptr& indicator, int role) const;
78+ static QVariant defaultData(Indicator::Ptr indicator, int role);
9279};
9380
94−#endif
81+#endif // INDICATORSMODEL_H
plugins/Unity/Indicators/plugin.cppnew file+44
@@ -0,0 +1,44 @@
1+/*
2+ * Copyright (C) 2012 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+// Qt
20+#include <QtQml>
21+
22+// self
23+#include "plugin.h"
24+
25+// local
26+#include "flatmenuproxymodel.h"
27+#include "indicatorsmanager.h"
28+#include "indicatorsmodel.h"
29+#include "indicators.h"
30+
31+void IndicatorsPlugin::registerTypes(const char *uri)
32+{
33+ Q_INIT_RESOURCE(indicators);
34+
35+ qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager");
36+ qmlRegisterType<FlatMenuProxyModel>(uri, 0, 1, "FlatMenuProxyModel");
37+ qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel");
38+
39+ qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", "Can't create ActionState class");
40+ qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", "Can't create NetworkActionState class");
41+ qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", "Can't create NetworkConnection class");
42+ qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", "Can't create IndicatorsModelRole class");
43+ qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", "Can't create FlatMenuProxyModelRole class");
44+}
tests/mocks/Ubuntu/ChewieUI/fake_chewie_plugin.h → plugins/Unity/Indicators/plugin.hrenamed+8−7
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012, 2013 Canonical, Ltd.
2+ * Copyright (C) 2012 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -12,14 +12,16 @@
1212 *
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
1517 */
1618
17−#ifndef PLUGIN_H
18−#define PLUGIN_H
19+#ifndef INDICATORS_PLUGIN_H
20+#define INDICATORS_PLUGIN_H
1921
20−#include <QQmlExtensionPlugin>
22+#include <QtQml/QQmlExtensionPlugin>
2123
22−class FakeChewieQmlPlugin : public QQmlExtensionPlugin
24+class IndicatorsPlugin : public QQmlExtensionPlugin
2325{
2426 Q_OBJECT
2527 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
@@ -27,5 +29,4 @@ public:
2729 void registerTypes(const char *uri);
2830};
2931
30−
31−#endif
32+#endif // INDICATORS_PLUGIN_H
plugins/Unity/Indicators/qml/BasicMenuItem.qmlnew file+48
@@ -0,0 +1,48 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components.ListItems 0.1 as ListItem
22+
23+ListItem.Standard {
24+ id: stdListItem
25+
26+ property bool menuActivated: false
27+ property QtObject menu
28+ property QtObject actionGroup
29+ property alias color: background.color
30+
31+ signal activateMenu()
32+ signal deactivateMenu()
33+
34+ showDivider: false
35+ __foregroundColor: "#e8e1d0"
36+
37+ backgroundIndicator: RemoveBackground {
38+ state: stdListItem.swipingState
39+ }
40+
41+ Rectangle {
42+ id: background
43+
44+ anchors.fill: parent
45+ color: "#221e1c"
46+ z: -1
47+ }
48+}
plugins/Unity/Indicators/qml/ButtonMenuItem.qmlnew file+47
@@ -0,0 +1,47 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+BasicMenuItem {
24+ id: buttonMenu
25+ color: "#221e1b"
26+ implicitHeight: units.gu(7)
27+
28+ Button {
29+ id: button
30+ enabled: menuAction.valid
31+ text: menu ? menu.label : ""
32+ anchors.centerIn: parent
33+ height: units.gu(4)
34+ width: units.gu(16)
35+ color: "#1b1817"
36+
37+ onClicked: {
38+ menuAction.activate()
39+ }
40+ }
41+
42+ MenuAction {
43+ id: menuAction
44+ actionGroup: buttonMenu.actionGroup
45+ action: menu ? menu.action : ""
46+ }
47+}
plugins/Unity/Indicators/qml/CMakeLists.txtnew file+5
@@ -0,0 +1,5 @@
1+# export_qmlplugin macro
2+include(Plugins)
3+
4+# export the qmldir, *.qml files.
5+export_qmlfiles(Unity.Indicators Unity/Indicators)
plugins/Unity/Indicators/qml/DivMenuItem.qmlnew file+26
@@ -0,0 +1,26 @@
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+ * Olivier Tilloy <olivier.tilloy@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+Rectangle {
24+ color: "#181514"
25+ implicitHeight: units.gu(1)
26+}
plugins/Unity/Indicators/qml/HLine.qmlnew file+29
@@ -0,0 +1,29 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+Rectangle {
24+ height: units.dp(1)
25+ anchors {
26+ left: parent.left
27+ right: parent.right
28+ }
29+}
plugins/Unity/Indicators/qml/IndicatorBase.qmlnew file+59
@@ -0,0 +1,59 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Nick Dedekind <nick.dedekind@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import QMenuModel 0.1
23+import Unity.Indicators 0.1 as Indicators
24+
25+Item {
26+ id: indicatorItem
27+
28+ //const
29+ property string title
30+ property int busType
31+ property string busName
32+ property string actionsObjectPath
33+ property var menuObjectPaths: undefined
34+ readonly property string device: "phone"
35+
36+ property string deviceMenuObjectPath: menuObjectPaths.hasOwnProperty(device) ? menuObjectPaths[device] : ""
37+
38+ signal actionGroupUpdated()
39+ signal modelUpdated()
40+
41+ property var actionGroup: QDBusActionGroup {
42+ busType: indicatorItem.busType
43+ busName: indicatorItem.busName
44+ objectPath: indicatorItem.actionsObjectPath
45+
46+ onActionAppear: indicatorItem.actionGroupUpdated();
47+ }
48+
49+ property var proxyModel: Indicators.FlatMenuProxyModel {
50+ busType: indicatorItem.busType
51+ busName: indicatorItem.busName
52+ objectPath: indicatorItem.deviceMenuObjectPath
53+
54+ onStatusChanged: indicatorItem.modelUpdated();
55+ onRowsInserted: indicatorItem.modelUpdated();
56+ onRowsRemoved: indicatorItem.modelUpdated();
57+ onDataChanged: indicatorItem.modelUpdated();
58+ }
59+}
plugins/Unity/Indicators/qml/IndicatorPage.qmlnew file+197
@@ -0,0 +1,197 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Nick Dedekind <nick.dedekind@canonical.com>
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components 0.1 as Components
23+
24+IndicatorBase {
25+ id: main
26+
27+ //const
28+ property alias emptyText: emptyLabel.text
29+ property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
30+ property bool __active: false
31+
32+ ListView {
33+ id: mainMenu
34+
35+ property int visibleItems: 0
36+
37+ model: proxyModel
38+ anchors {
39+ fill: parent
40+ bottomMargin: Qt.inputMethod.visible ? (Qt.inputMethod.keyboardRectangle.height - main.anchors.bottomMargin) : 0
41+
42+ Behavior on bottomMargin {
43+ NumberAnimation {
44+ duration: 175
45+ easing.type: Easing.OutQuad
46+ }
47+ }
48+ // TODO - does ever frame.
49+ onBottomMarginChanged: {
50+ mainMenu.positionViewAtIndex(mainMenu.currentIndex, ListView.End)
51+ }
52+ }
53+
54+ // Ensure all delegates are cached in order to improve smoothness of scrolling
55+ cacheBuffer: 10000
56+
57+ // Only allow flicking if the content doesn't fit on the page
58+ interactive: contentHeight > height
59+
60+ currentIndex: -1
61+ delegate: Item {
62+ id: item
63+ property bool ready: false
64+ property alias empty: factory.empty
65+
66+ anchors {
67+ left: parent.left
68+ right: parent.right
69+ }
70+ height: div.height + factory.implicitHeight
71+ visible: height > 0
72+
73+ Component.onCompleted: {
74+ if (!item.empty) {
75+ mainMenu.visibleItems += 1;
76+ }
77+ ready = true;
78+ }
79+ Component.onDestruction: {
80+ if (!item.empty) {
81+ mainMenu.visibleItems -= 1;
82+ }
83+ ready = false;
84+ }
85+
86+ onEmptyChanged: {
87+ if (!ready) {
88+ return;
89+ }
90+ if (empty) {
91+ mainMenu.visibleItems -= 1;
92+ } else {
93+ mainMenu.visibleItems += 1;
94+ }
95+ }
96+
97+ ListView.onRemove: {
98+ if (!highlightFollowsCurrentItem) {
99+ mainMenu.currentIndex = -1;
100+ }
101+ }
102+
103+ Column {
104+ id: contents
105+
106+ anchors.fill: parent
107+
108+ DivMenuItem {
109+ id: div
110+
111+ anchors.left: parent.left
112+ anchors.right: parent.right
113+ // only visible if is a root or a section header element and the factory is visible
114+ height: {
115+ // skipe first item
116+ if (item.y == 0) {
117+ return 0;
118+ }
119+ if (hasSection || ((depth == 0) && (!factory.empty))) {
120+ return implicitHeight;
121+ } else {
122+ return 0;
123+ }
124+ }
125+ }
126+
127+ MenuItemFactory {
128+ id: factory
129+
130+ actionGroup: main.actionGroup
131+ isCurrentItem: item.ListView.isCurrentItem
132+ anchors {
133+ left: parent.left
134+ right: parent.right
135+ }
136+ menu: model
137+
138+ Connections {
139+ target : factory
140+ onActivated: item.ListView.view.currentIndex = index
141+ onDeactivated: item.ListView.view.currentIndex = -1
142+ }
143+ }
144+ }
145+ }
146+ }
147+
148+ Components.Label {
149+ id: emptyLabel
150+ visible: (mainMenu.visibleItems === 0)
151+ anchors {
152+ top: parent.top
153+ left: parent.left
154+ right: parent.right
155+ topMargin: units.gu(2)
156+ }
157+ wrapMode: Text.WordWrap
158+ horizontalAlignment: Text.AlignHCenter
159+
160+ //style
161+ color: "#e8e1d0"
162+ fontSize: "medium"
163+
164+ text: "Empty!"
165+ }
166+
167+ function start()
168+ {
169+ reset()
170+ if (!__active) {
171+ proxyModel.start();
172+ actionGroup.start();
173+ __active = true;
174+ }
175+ }
176+
177+ function stop()
178+ {
179+ if (__active) {
180+ __active = false;
181+ proxyModel.stop();
182+ actionGroup.stop();
183+ }
184+ }
185+
186+ function reset()
187+ {
188+ mainMenu.currentIndex = -1;
189+ mainMenu.positionViewAtBeginning();
190+ }
191+
192+ Component.onCompleted: {
193+ if ((busType != 0) && (busName != "") && (deviceMenuObjectPath != "")) {
194+ start();
195+ }
196+ }
197+}
plugins/Unity/Indicators/qml/IndicatorWidget.qmlnew file+68
@@ -0,0 +1,68 @@
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 Unity.Indicators 0.1 as Indicators
22+
23+IndicatorBase {
24+ id: indicatorWidget
25+
26+// enabled: false // FIXME : should be disabled until bus available when we have desktop indicators
27+ property var action: undefined
28+ property bool started: (busType != 0) && (busName != "") && (deviceMenuObjectPath != "")
29+ property int iconSize: height - units.gu(0.5)
30+ property string rootMenuType: "com.canonical.indicator.root"
31+
32+ signal actionStateChanged()
33+
34+ onStartedChanged: {
35+ if (started) {
36+ proxyModel.start();
37+ actionGroup.start();
38+ } else {
39+ proxyModel.stop();
40+ actionGroup.stop();
41+ }
42+ }
43+ onActionChanged: actionStateChanged()
44+ onActionGroupUpdated: update_state()
45+ onModelUpdated: update_state()
46+
47+
48+ function update_state() {
49+ var extra = proxyModel.data(0, Indicators.FlatMenuProxyModelRole.Extra);
50+ if (extra == undefined) {
51+ return;
52+ }
53+
54+ if (!extra.hasOwnProperty("canonical_type")) {
55+ return;
56+ }
57+
58+ if (extra.canonical_type === rootMenuType) {
59+ action = actionGroup.action(proxyModel.data(0, Indicators.FlatMenuProxyModelRole.Action));
60+ }
61+ }
62+
63+ Connections {
64+ target: action == undefined ? null : action
65+ onStateChanged: actionStateChanged()
66+ onValidChanged: actionStateChanged()
67+ }
68+}
plugins/Unity/Indicators/qml/MenuAction.qmlnew file+86
@@ -0,0 +1,86 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+
22+/*!
23+ \qmltype MenuAction
24+ \inqmlmodule Indicators 0.1
25+ \brief Helper class to connect to a qmenumodel action
26+
27+ Example:
28+ \qml
29+ Button {
30+ id: slide
31+ onClick: { action.activate() }
32+ }
33+ MenuAction {
34+ id: action
35+ actionGroup: menuItem.actionGroup
36+ action: "/ubuntu/sound/enabled"
37+ }
38+ \endqml
39+*/
40+
41+Item {
42+ id: menuAction
43+
44+ /*!
45+ \preliminary
46+ The dbus action name
47+ */
48+ property string action: ""
49+
50+ /*!
51+ \preliminary
52+ The dbus action group object
53+ */
54+ property QtObject actionGroup: null
55+
56+ /*!
57+ \preliminary
58+ This is a read-only property with the current validity of the action
59+ */
60+ readonly property bool valid: actionObject ? actionObject.valid : false
61+
62+ readonly property var state: actionObject ? actionObject.state : undefined
63+
64+ // internal
65+ property QtObject actionObject: null
66+
67+ function activate(param) {
68+ if (valid) {
69+ actionObject.activate(param);
70+ }
71+ }
72+
73+ onActionGroupChanged: updateAction()
74+ onActionChanged: updateAction()
75+
76+ Connections {
77+ target: menuAction.actionGroup != undefined ? menuAction.actionGroup : null
78+ onActionAppear: menuAction.updateAction();
79+ onActionVanish: menuAction.updateAction();
80+ onStatusChanged: menuAction.updateAction();
81+ }
82+
83+ function updateAction() {
84+ actionObject = action !== "" && actionGroup ? actionGroup.action(action) : null
85+ }
86+}
plugins/Unity/Indicators/qml/MenuActionBinding.qmlnew file+106
@@ -0,0 +1,106 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+
22+/*!
23+ \qmltype MenuActionBinding
24+ \inqmlmodule Indicators 0.1
25+ \brief Helper class to connect a qmenumodel action state with a qml components property
26+
27+ Example:
28+ \qml
29+ Slider {
30+ id: slide
31+ }
32+ MenuActionBinding {
33+ actionGroup: menuItem.actionGroup
34+ action: "/ubuntu/sound/volume"
35+ target: slider
36+ property: "value"
37+ }
38+ \endqml
39+*/
40+
41+MenuAction {
42+ id: menuAction
43+
44+ /*!
45+ \preliminary
46+ The component which will have the property changed by action
47+ */
48+ property QtObject target: null
49+
50+ /*!
51+ \preliminary
52+ The property name of \l target component which will be linked with action state
53+ */
54+ property string property
55+
56+ /*!
57+ \preliminary
58+ Use this to enable or disable the action state propagation to component property.
59+ */
60+ property bool active: true
61+
62+ Component.onCompleted: connectViewChanges()
63+ onTargetChanged: connectViewChanges()
64+ onPropertyChanged: connectViewChanges()
65+
66+ Item {
67+ id: d
68+ property var currentTarget: undefined
69+ property string currentSignal
70+ }
71+
72+ Binding {
73+ id: propertyBinding
74+ target: menuAction.target
75+ property: menuAction.property
76+ value: menuAction.state
77+ when: menuAction.actionObject && menuAction.active
78+ }
79+
80+ // TODO - re-evaluate in c++
81+ function connectViewChanges() {
82+ if (d.currentTarget != undefined && d.currentSignal !== "") {
83+ if (d.currentTarget[d.currentSignal] !== undefined) {
84+ d.currentTarget[d.currentSignal].disconnect(onViewValueChanged);
85+ }
86+ }
87+
88+ d.currentTarget = null;
89+ d.currentSignal = "";
90+ if (target) {
91+ var signal = "on%1Changed".arg(property.charAt(0).toUpperCase() + property.slice(1));
92+ if (target[signal] !== undefined) {
93+ target[signal].connect(onViewValueChanged);
94+ d.currentTarget = target;
95+ d.currentSignal = signal;
96+ }
97+ }
98+ }
99+
100+ function onViewValueChanged() {
101+ if (valid) {
102+ var propertyValue = target[property];
103+ actionObject.updateState(propertyValue);
104+ }
105+ }
106+}
plugins/Unity/Indicators/qml/MenuItem.qmlnew file+40
@@ -0,0 +1,40 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
23+
24+BasicMenuItem {
25+ objectName: menu ? menu.action : ""
26+ progression: menu && (menu.linkSubMenu !== undefined)
27+ text: menu && menu.label ? menu.label : ""
28+ color: "#221e1c"
29+ implicitHeight: units.gu(7)
30+
31+ HLine {
32+ anchors.top: parent.top
33+ color: "#403b37"
34+ }
35+
36+ HLine {
37+ anchors.bottom: parent.bottom
38+ color: "#060606"
39+ }
40+}
plugins/Unity/Indicators/qml/MenuItemFactory.qmlnew file+110
@@ -0,0 +1,110 @@
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 Unity.Indicators 0.1 as Indicators
22+import Unity.Indicators.Messaging 0.1 as ICMessaging
23+import Unity.Indicators.Network 0.1 as ICNetwork
24+
25+Item {
26+ id: menuFactory
27+
28+ property QtObject menu
29+ property QtObject listView
30+ property QtObject actionGroup
31+ property bool isCurrentItem
32+ readonly property bool empty: (loader.item !== undefined && loader.status == Loader.Ready) ? loader.item.state === "EMPTY" : true
33+
34+ implicitHeight: loader.height
35+
36+ signal activated()
37+ signal deactivated()
38+
39+ property var _map: {
40+ "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
41+ "unity.widgets.systemsettings.tablet.switch" : switchMenu,
42+
43+ "com.canonical.indicator.button" : buttonMenu,
44+ "com.canonical.indicator.div" : divMenu,
45+ "com.canonical.indicator.section" : sectionMenu,
46+ "com.canonical.indicator.progress" : progressMenu,
47+ "com.canonical.indicator.slider" : sliderMenu,
48+ "com.canonical.indicator.switch" : switchMenu,
49+
50+ "com.canonical.indicator.messages.messageitem" : messageItem,
51+ "com.canonical.indicator.messages.snapdecision" : snapDecision,
52+ "com.canonical.indicator.messages.sourceitem" : groupedMessage,
53+
54+ "unity.widget.systemsettings.tablet.sectiontitle" : wifiSection,
55+ "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
56+ "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
57+ }
58+
59+ Component { id: sliderMenu; Indicators.SliderMenuItem {} }
60+ Component { id: switchMenu; Indicators.SwitchMenuItem {} }
61+ Component { id: buttonMenu; Indicators.ButtonMenuItem {} }
62+ Component { id: divMenu; Indicators.DivMenuItem {} }
63+ Component { id: sectionMenu; Indicators.SectionMenuItem {} }
64+ Component { id: progressMenu; Indicators.ProgressMenuItem {} }
65+ Component { id: messageItem; ICMessaging.MessageMenuItem {} }
66+ Component { id: snapDecision; ICMessaging.SnapDecision {} }
67+ Component { id: groupedMessage; ICMessaging.GroupedMessage {} }
68+ Component { id: wifiSection; ICNetwork.WifiSection {} }
69+ Component { id: accessPoint; ICNetwork.AccessPoint {} }
70+ Component { id: indicatorMenu; Indicators.MenuItem {} }
71+
72+ Loader {
73+ id: loader
74+ asynchronous: true
75+
76+ anchors {
77+ left: parent.left
78+ right: parent.right
79+ }
80+
81+ sourceComponent: {
82+ if (!menuFactory.menu || !menuFactory.menu.extra) {
83+ return undefined;
84+ }
85+
86+ var widgetType = menuFactory.menu.extra.canonical_type;
87+ if (widgetType) {
88+ return _map[widgetType];
89+ } else {
90+ if (widgetType === "com.canonical.indicator.root") {
91+ return undefined;
92+ // Try discovery the item based on the basic properties
93+ } else if (menu.hasSection) {
94+ return sectionMenu;
95+ } else {
96+ return indicatorMenu;
97+ }
98+ }
99+ }
100+
101+ onLoaded: {
102+ item.menuActivated = Qt.binding(function() { return isCurrentItem; });
103+ item.actionGroup = Qt.binding(function() { return menuFactory.actionGroup; });
104+ item.menu = Qt.binding(function() { return menuFactory.menu; });
105+
106+ item.activateMenu.connect(function() { menuFactory.activated(); });
107+ item.deactivateMenu.connect(function() { menuFactory.deactivated(); });
108+ }
109+ }
110+}
plugins/Unity/Indicators/qml/ProgressMenuItem.qmlnew file+65
@@ -0,0 +1,65 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+MenuItem {
24+ id: progressMenu
25+ property alias value : progressBar.value
26+
27+ // TODO: Replace this with the official ProgressBar component as soon as
28+ // it is available. For now, this rebuilds the Mockup as close as possible.
29+ UbuntuShape {
30+ id: progressBar
31+ anchors {
32+ right: parent.right
33+ rightMargin: units.gu(2)
34+ left: parent.left
35+ leftMargin: units.gu(2)
36+ }
37+ height: units.gu(4)
38+ anchors.verticalCenter: parent.verticalCenter
39+ color: "transparent"
40+
41+ property int minimumValue: 0
42+ property int maximumValue: 100
43+ property int value: 50
44+
45+ UbuntuShape {
46+ anchors.fill: parent
47+ anchors.rightMargin: parent.width - (parent.width * parent.value / parent.maximumValue)
48+ color: "#c94212"
49+ }
50+
51+ Label {
52+ anchors.centerIn: parent
53+ text: parent.value + " %"
54+ fontSize: "medium"
55+ color: "#e8e1d0"
56+ }
57+ }
58+
59+ MenuActionBinding {
60+ actionGroup: progressMenu.actionGroup
61+ action: menu ? menu.action : ""
62+ target: progressBar
63+ property: "value"
64+ }
65+}
plugins/Unity/Indicators/qml/RemoveBackground.qmlnew file+55
@@ -0,0 +1,55 @@
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+
17+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+
20+Rectangle {
21+ anchors.fill: parent
22+ color: "#333130"
23+ Label {
24+ id: backgroundText
25+
26+ anchors.fill: parent
27+ verticalAlignment: Text.AlignVCenter
28+ text: "Clear"
29+ fontSize: "medium"
30+ color: "#e8e1d0"
31+ font.bold: true
32+ }
33+
34+ states: [
35+ State {
36+ name: "SwipingRight"
37+ PropertyChanges {
38+ target: backgroundText
39+ anchors.rightMargin: units.gu(3)
40+ anchors.leftMargin: 0
41+ horizontalAlignment: Text.AlignRight
42+
43+ }
44+ },
45+ State {
46+ name: "SwipingLeft"
47+ PropertyChanges {
48+ target: backgroundText
49+ anchors.rightMargin: 0
50+ anchors.leftMargin: units.gu(3)
51+ horizontalAlignment: Text.AlignLeft
52+ }
53+ }
54+ ]
55+}
plugins/Unity/Indicators/qml/SectionMenuItem.qmlnew file+57
@@ -0,0 +1,57 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
23+
24+BasicMenuItem {
25+ property string label: menu && menu.label ? menu.label : ""
26+ property bool busy: false
27+ property int count: menu && menu.linkSection ? menu.linkSection.count : 0
28+
29+ color: "#221e1b"
30+ implicitHeight: label !== "" ? __header.height : 0
31+ state: count === 0 ? "EMPTY" : ""
32+
33+ ListItem.Header {
34+ id: __header
35+
36+ text: label
37+ height: units.gu(4)
38+ anchors {
39+ left: parent.left
40+ right: parent.right
41+ top: parent.top
42+ }
43+ visible: text != ""
44+
45+ ActivityIndicator {
46+ id: indicator
47+ running: busy
48+ anchors {
49+ margins: units.gu(0.5)
50+ right: parent.right
51+ }
52+ height: parent.height - (anchors.margins * 2)
53+ width: height
54+ anchors.verticalCenter: parent.verticalCenter
55+ }
56+ }
57+}
plugins/Unity/Indicators/qml/SliderMenuItem.qmlnew file+64
@@ -0,0 +1,64 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+MenuItem {
24+ id: _sliderMenu
25+
26+ property alias minimumValue: slider.minimumValue
27+ property alias maximumValue: slider.maximumValue
28+ property alias value: slider.value
29+
30+ control: Slider {
31+ id: slider
32+ enabled: menuAction.valid
33+ width: _sliderMenu.text ? units.gu(20) : _sliderMenu.width - units.gu(4)
34+ anchors.verticalCenter: parent.verticalCenter
35+ live: false
36+ // FIXME: The interval should be [0.0 - 1.0]. Unfortunately, when
37+ // reaching the boundaries (0.0 or 1.0), the value is converted
38+ // to an integer when automatically wrapped in a variant when
39+ // passed to QStateAction::updateState(…). The server chokes on
40+ // those values, complaining that they’re not of the right type…
41+ minimumValue: menu.extra.canonical_min ? menu.extra.canonical_min * 1.000001 : 0.0000001
42+ maximumValue: {
43+ var maximum = menu.extra.canonical_max ? menu.extra.canonical_max * 1.000001 : 0.9999999
44+ if (maximum <= minimumValue) {
45+ return minimumValue + 1;
46+ }
47+ return maximum;
48+ }
49+
50+ // FIXME - to be deprecated in Ubuntu.Components.
51+ // Use this to disable the label, since there is not way to do it on the component.
52+ function formatValue(v) {
53+ return "";
54+ }
55+ }
56+
57+ MenuActionBinding {
58+ id: menuAction
59+ actionGroup: _sliderMenu.actionGroup
60+ action: menu ? menu.action : ""
61+ target: slider
62+ property: "value"
63+ }
64+}
plugins/Unity/Indicators/qml/SwitchMenuItem.qmlnew file+43
@@ -0,0 +1,43 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+
23+MenuItem {
24+ id: switchMenu
25+
26+ property alias checked: switcher.checked
27+
28+ control: Switch {
29+ id: switcher
30+ enabled: menuAction.valid
31+
32+ anchors.verticalCenter: parent.verticalCenter
33+ anchors.right: parent.right
34+ }
35+
36+ MenuActionBinding {
37+ id: menuAction
38+ actionGroup: switchMenu.actionGroup
39+ action: menu ? menu.action : ""
40+ target: switcher
41+ property: "checked"
42+ }
43+}
plugins/Unity/Indicators/qml/qmldirnew file+21
@@ -0,0 +1,21 @@
1+module Unity.Indicators
2+plugin IndicatorsQml
3+typeinfo plugin.qmltypes
4+
5+BasicMenuItem 0.1 BasicMenuItem.qml
6+ButtonMenuItem 0.1 ButtonMenuItem.qml
7+DivMenuItem 0.1 DivMenuItem.qml
8+HLine 0.1 HLine.qml
9+IndicatorBase 0.1 IndicatorBase.qml
10+IndicatorPage 0.1 IndicatorPage.qml
11+IndicatorWidget 0.1 IndicatorWidget.qml
12+MenuItem 0.1 MenuItem.qml
13+MenuAction 0.1 MenuAction.qml
14+MenuActionBinding 0.1 MenuActionBinding.qml
15+MenuItemFactory 0.1 MenuItemFactory.qml
16+ProgressMenuItem 0.1 ProgressMenuItem.qml
17+SectionMenuItem 0.1 SectionMenuItem.qml
18+SliderMenuItem 0.1 SliderMenuItem.qml
19+SwitchMenuItem 0.1 SwitchMenuItem.qml
20+
21+internal RemoveBackground RemoveBackground.qml
plugins/Unity/Indicators/resources/artwork/messaging/default_app.svgnew file+42
@@ -0,0 +1,42 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+<svg id="svg15137" xmlns="http://www.w3.org/2000/svg" height="48" width="48" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
4+ <defs id="defs15139">
5+ <radialGradient id="radialGradient2612" gradientUnits="userSpaceOnUse" cy="4.625" cx="62.625" gradientTransform="matrix(1 0 0 .34118 0 3.0471)" r="10.625">
6+ <stop id="stop8840" offset="0"/>
7+ <stop id="stop8842" style="stop-opacity:0" offset="1"/>
8+ </radialGradient>
9+ <linearGradient id="linearGradient15133" y2=".24326" gradientUnits="userSpaceOnUse" x2="62.2" gradientTransform="matrix(2.1499 0 0 2.1499 -110.12 31.935)" y1="-12.489" x1="62.2">
10+ <stop id="stop4875" style="stop-color:#fff" offset="0"/>
11+ <stop id="stop4877" style="stop-color:#fff;stop-opacity:0" offset="1"/>
12+ </linearGradient>
13+ <radialGradient id="radialGradient15127" gradientUnits="userSpaceOnUse" cy="-8.7256" cx="62.2" gradientTransform="matrix(2.4129 0 0 2.413 -126.48 34.231)" r="9.7553">
14+ <stop id="stop8649" style="stop-color:#8fb1dc" offset="0"/>
15+ <stop id="stop8651" style="stop-color:#3465a4" offset="1"/>
16+ </radialGradient>
17+ <radialGradient id="radialGradient2418" gradientUnits="userSpaceOnUse" cy="24.149" cx="17.814" gradientTransform="matrix(-2.644 0 2.9365e-8 2.5344 78.725 -37.986)" r="9.125">
18+ <stop id="stop4847" style="stop-color:#fff" offset="0"/>
19+ <stop id="stop4849" style="stop-color:#b6b6b6" offset="1"/>
20+ </radialGradient>
21+ <radialGradient id="radialGradient5145" gradientUnits="userSpaceOnUse" cy="13.067" cx="23.86" gradientTransform="matrix(-1.5425 0 0 -.84553 60.718 23.829)" r="18.098">
22+ <stop id="stop14112" style="stop-color:#557695" offset="0"/>
23+ <stop id="stop14114" style="stop-color:#15395c" offset="1"/>
24+ </radialGradient>
25+ <radialGradient id="radialGradient5147" gradientUnits="userSpaceOnUse" cy="-3.442" cx="62.225" gradientTransform="matrix(1.1035 0 0 1.0265 -4.1555 -1.8158)" r="10.081">
26+ <stop id="stop14118" style="stop-color:#9e9e9e" offset="0"/>
27+ <stop id="stop14120" style="stop-color:#9e9e9e;stop-opacity:0" offset="1"/>
28+ </radialGradient>
29+ </defs>
30+ <g id="layer1">
31+ <path id="path8836" style="opacity:.4;fill-rule:evenodd;fill:url(#radialGradient2612)" d="m73.25 4.625a10.625 3.625 0 1 1 -21.25 0 10.625 3.625 0 1 1 21.25 0z" transform="matrix(2.1647 0 0 2.5637 -111.56 26.85)"/>
32+ <g id="g15122" transform="translate(.79042 -.78563)">
33+ <path id="path6495" style="stroke:#204a87;fill:url(#radialGradient15127)" d="m43.505 24.387c0 10.99-8.9091 19.899-19.897 19.899-10.989 0-19.898-8.9091-19.898-19.899 0-10.989 8.9086-19.897 19.898-19.897 10.988 0 19.897 8.9081 19.897 19.897z"/>
34+ <path id="path6534" style="stroke:url(#radialGradient5147);stroke-width:1.1035;fill:url(#radialGradient5145)" d="m23.726 5.3141c-1.5283 0.12067-3.0328 0.36544-4.4919 0.84567-1.23 0.48843 0.88689-0.42988-0.37486-0.60468-0.75942-0.12994-1.0776 0.65251-1.7561 0.67046-0.7741 0.023841-1.3048 0.71572-2.0319 0.79898-0.26187 1.4432-0.59924-0.56894-0.83949 0.13173 0.19047 0.7212-0.07796 1.1928-0.63582 1.6119-0.60156 0.68249-0.03584 1.2934 0.54212 0.69395 0.2775-0.83446 1.1825-1.7618 2.0655-1.2049 0.8837 0.48448 1.7582 1.6525 2.4938 0.40935-0.75488-0.090735-1.0462-0.73637-1.4079-1.2096-0.40023 0.031761-2.0794-0.32019-1.0059-0.24024 0.5284-0.17249 1.549-0.68558 1.9239-0.66537-0.94013 0.49026 0.35015 0.81268 0.73202 1.2035 0.68671 0.20357 0.99776 1.0757 0.37414 1.527-0.80181 0.4162 0.05573 1.1017 0.221 1.6748 0.12828 0.99827 0.99623 0.43282 1.2716-0.18046 0.39803-1.1153 1.6733-1.0767 2.5958-1.5522 1.008-0.51754 1.0248-0.53575 1.5034 0.20195 0.36764 0.21151 1.5947-0.55825 0.78901-0.929-0.68957 0.03713-1.142 0.46029-0.56364-0.60801 0.13915-0.57404 0.6791-1.3235 0.58092-1.7937-0.662-0.2603-1.324-0.5207-1.986-0.7811zm-9.3732 3.6945c0.35612 0.3643 1.5564 1.0234 1.4368 0.11255-0.14419-0.61744-1.0418-0.62308-1.4368-0.11255zm18.165-0.44471c-0.82412 0.16922-1.6412 0.35467-2.292 0.92363 0.19457 0.7853-0.8341 0.89786-1.2851 1.3281-0.12036 0.25242-0.02467 1.8403 0.51105 1.1573 0.58162-0.77246 0.83368 0.40868 1.4478 0.52687 0.4451-0.14324 0.5002-1.1438 0.33275-1.6043 0.28525-0.46984 0.75058-1.1195 1.3539-1.0659-0.37419 0.57099-0.80163 2.0315 0.3911 1.4345 0.34518-0.006-0.93958 0.75452-1.0166 1.273-0.48258 0.51284-0.9934 0.90587-1.6905 0.50847-0.33355-0.28162-0.50305-1.0992-0.71414-0.17566 0.43341 0.73252-1.089 0.04718-1.0514 1.0356-0.31972 0.61514-0.89623 0.8671-1.563 0.91149 0.24198 0.19141 1.1924 1.3314 0.24953 1.1701-0.60352 0.06628-1.4857 0.40701-1.2414 1.1653-0.27486 0.9444 0.4249 0.70654 0.85522 1.2977 0.70116-0.19916 1.1488-0.62908 1.2634-1.3621 0.65618-0.19273 0.73557-0.93195 1.456-0.91702 0.7182-0.40381 0.88559 0.73738 1.5587 0.82181 0.07058 0.4087-0.33464 1.281 0.45659 0.4693 0.76441-0.55387-0.79512-1.2716-0.30963-1.4066 0.69099 0.22071 0.94006 0.87671 1.051 1.519 0.56306 0.9634 0.70185 0.44404 0.74672-0.40362 0.87723-0.39439 1.1473 1.641 2.3881 1.1397 0.92678 0.19174 0.59949 0.8304-0.01904 1.2203-0.50066 0.47112-1.3382 0.17338-1.9265-0.01558-0.56472-0.27756-1.3196-0.24813-1.6214 0.38347-0.46529-0.21764-0.94642-0.91135-1.4178-1.3118-1.1647-0.5139-2.4314-0.07571-3.5919 0.23946-0.99563 1.1632-2.1949 2.219-2.6236 3.7359-0.62778 0.63853 0.54336 1.0082-0.24392 1.556-0.6428 0.51279 0.10805 1.1629 0.2458 1.7527 0.60445 0.74395 1.6306 3.0723 2.5708 2.1452 0.52705-0.80245 0.81963 0.61582 1.4399-0.30194 0.4952-0.39949 0.9695 0.45802 1.6897 0.14331 0.69372 0.4284 0.56095 1.0433 0.27484 1.6928 0.15583 0.54087 0.93098 0.9344 0.62978 1.6677-0.27366 0.68309 0.58312 1.201 0.41038 1.7987-0.5748 1.1512-0.43928 2.5747 0.09386 3.7157 0.42668 1.0325 0.67699 2.1484 0.64366 3.2692 0.74277 0.2222 1.1367-0.72912 1.8776-0.51313 0.72333 0.09324 0.99191-0.82974 1.5008-1.2158 0.56704-0.46747-0.07223-1.1873 0.82794-1.5185 0.87331-0.42523-1.106-1.0213 0.0152-1.4024 0.46515-0.51761 1.4132-0.69776 1.6008-1.3735-0.33834-1.0398-0.21797-2.1801-0.16738-3.2436 0.32552-0.84167 0.72975-1.6312 1.4262-2.2272 0.28082-0.92669 0.94924-1.7777 0.88942-2.7709-1.6476 0.50399-1.1482-0.21491-0.22962-0.87318 0.63508-0.42199 1.4051-0.84564 1.7006-1.5617 0.14435-0.81048-0.45227-2.1297-1.0079-0.90496-0.24511-0.4707-1.1542-0.71744-1.113-1.3307-0.17659-1.2625 0.34462-0.14427 0.86051 0.10789 1.1146-0.60521 1.6818 1.7766 2.3893 0.35503-0.618-4.471-3.052-8.528-6.34-11.567-0.571-1.0949-0.921 0.75-1.501 0.68-0.464-0.485-1.33-1.1394-0.122-0.914 1.034-0.3028 0.333-0.7027-0.425-0.6842-0.574-0.0697-1.101-0.2706-1.635-0.4789zm-20.56 0.4447c-0.275 1.3534-2.0109 1.1954-2.6162 2.5304-2.9783 3.153-4.8166 7.302-5.32 11.598 0.26584 1.0071 1.1105 1.4908 1.9601 1.9373 0.72184 0.41932 1.7801 0.2342 2.1848 1.1124 0.45187 0.36983 0.93948 1.0997 1.5856 0.87722 0.93664-0.09099 0.36019 0.85823 0.19973 1.3392-0.059277 0.607-0.80778 0.99372-0.52016 1.5778-0.24136 0.66166-0.43304 1.3177 0.10262 1.8906 0.45551 0.83988 0.82632 1.7478 1.6708 2.2751 0.59217 0.49728 1.2625 1.1553 1.0304 1.9974-0.12338 0.68167 0.04306 1.3099 0.3725 1.908-0.11816 0.67146-0.36073 1.3584-0.4105 2.0183 0.87949 0.62206 2.6705 2.0606 2.8031 0.49489 0.50176-0.45161 0.5321-1.1784 1.3743-1.1804 0.3909-0.47777 0.52549-1.2283 0.81706-1.8117-0.42572-0.5384 0.16631-1.3697 0.8046-1.3477 0.81594 0.06128 0.78593-0.89448 1.1111-1.4232-0.0073-0.77224-0.38892-1.6471 0.30542-2.227 0.52242-0.47344 0.46827-1.1675 0.5498-1.8097-1.171-0.7244-2.712-1.0911-3.6386-2.0687-0.18364-0.76504-0.7598-1.0229-1.4925-1.0784-0.30936-0.43256-0.25697-1.4628-0.79753-1.5131-0.69628 0.13369-1.3857 0.24089-1.8917-0.3644-0.573-0.776-1.069 0.2-1.593 0.546-0.492 0.856-1.8683-0.043-1.7038-1.007 0.4839-1.334-1.6425 0.148-0.7699-1.425 0.4151-1.715-0.7067-0.396-1.2952-0.011-0.71822 0.0081-0.98953-0.70747-0.86146-1.3625-0.091117-0.78733 0.48283-1.1877 1.0669-1.5822 0.78161 0.12038 0.97989-0.56085 1.5654-0.4722 0.73603-0.03767 1.0049 0.66782 1.4232 1.1357 0.17514-0.66797-0.18345-1.6152 0.55606-1.9879 0.56414-0.42781 1.137-0.84927 1.2721-1.5904 0.13304-0.77598 1.2893-0.46761 1.4837-1.2526 0.26877-0.8206 1.5114-0.15823 1.7899-0.96804 0.8733-0.82086-0.27242-0.57178-0.89854-0.59806-1.2353 0.12695 0.1228-0.32763 0.58598-0.58155 0.68608 0.09073 1.3195-0.13384 1.9499-0.37629 0.08445 0.85843 0.24597 1.3112 0.68417 0.30788-0.85421-0.20211-0.11618-1.0402-0.95973-1.2614-0.66764 0.04697 0.0066-1.4189-0.81571-1.2577-1.0697 0.70782-0.11401-0.50251-0.9854-0.66347-0.68736-0.74222-0.85436 0.47657-1.2276 0.9183 0.24207 0.84702-0.79095 0.66525-0.97976 1.3606-0.41814 1.2534-0.24143-0.08931-0.74055-0.41035-0.61653-0.24732-1.3592-0.3784-1.3637-1.1899 0.82658-0.60512 2.0667-0.96189 2.5994-1.9148 0.3095-0.74008-0.26215-1.1445-0.96618-1.0889l-0.000005-2e-7zm14.675 1.642c-0.12491 0.65746 0.5475 1.009 0.30788 1.7104-0.21487 0.76842-0.27728 1.3789 0.68289 0.93046 0.99668-0.51183 0.36052-0.90148-0.03867-1.5728-0.27187-0.44613-0.24574-1.275-0.9521-1.0681zm-0.75259 1.0947c-0.79414-0.24012-0.61745 1.4493-0.12164 1.0118 0.7276-0.17916 0.23703-0.5252 0.12164-1.0118zm10.023 8.9969c0.95184 0.84444 1.277 2.0946 1.8858 3.1596 0.90428 0.39972 0.0415 1.0795 0.44521 1.5712 0.84897 0.92228-1.1752 0.24516-0.90606-0.67899-0.1971-1.2139-1.0559-2.044-1.4678-3.1045-0.04294-0.3526-0.38552-0.71788 0.04284-0.94732z"/>
35+ <path id="path8655" style="opacity:.4;stroke:url(#linearGradient15133);fill:none" d="m42.409 24.387c0 10.384-8.4184 18.803-18.801 18.803-10.384 0-18.802-8.4184-18.802-18.803 0-10.384 8.418-18.801 18.802-18.801 10.383 0 18.801 8.4175 18.801 18.801z"/>
36+ </g>
37+ <g id="g2414" transform="matrix(.99991 -.013701 .013701 .99991 -.28870 .53585)">
38+ <path id="path3970" style="stroke-linejoin:round;fill-rule:evenodd;stroke:#666;fill:url(#radialGradient2418)" d="m30.5 20.937 17 16.5-7.75 0.25s3.25 6.75 3.25 6.75c1 3-3.5 4.125-4.25 1.875l-3-6.75-5.5 5.875 0.25-24.5z"/>
39+ <path id="path4853" style="opacity:.4;stroke:#fff;fill:none" d="m31.657 23.379 13.476 13.186-6.9219 0.27746l3.8721 7.7566c0.40273 1.6501-2.0283 2.4126-2.5071 1.1529l-3.6831-7.845-4.4247 4.7083 0.18907-19.236z"/>
40+ </g>
41+ </g>
42+</svg>
plugins/Unity/Indicators/resources/artwork/messaging/default_contact.pngnew file

Binary file not shown.

plugins/Unity/Indicators/resources/artwork/messaging/message_sms01_54px.pngnew file

Binary file not shown.

plugins/Unity/Indicators/resources/indicators.qrcnew file+7
@@ -0,0 +1,7 @@
1+<RCC>
2+ <qresource prefix="/indicators">
3+ <file>artwork/messaging/default_contact.png</file>
4+ <file>artwork/messaging/default_app.svg</file>
5+ <file>artwork/messaging/message_sms01_54px.png</file>
6+ </qresource>
7+</RCC>
plugins/Unity/Launcher/CMakeLists.txtnew file+28
@@ -0,0 +1,28 @@
1+include(FindPkgConfig)
2+pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=2)
3+
4+include_directories(
5+ ${CMAKE_CURRENT_SOURCE_DIR}
6+)
7+
8+set(QMLLAUNCHERPLUGIN_SRC
9+ plugin.cpp
10+ launchermodel.cpp
11+ launcheritem.cpp
12+ quicklistmodel.cpp
13+ common/quicklistentry.cpp
14+ backend/launcherbackend.cpp
15+ ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherItemInterface.h
16+ ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherModelInterface.h
17+ ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/QuickListModelInterface.h
18+ )
19+
20+add_library(UnityLauncher-qml MODULE
21+ ${QMLLAUNCHERPLUGIN_SRC}
22+ )
23+
24+qt5_use_modules(UnityLauncher-qml Qml)
25+
26+# export the qmldir and qmltypes files
27+export_qmlfiles(Unity.Launcher Unity/Launcher)
28+export_qmlplugin(Unity.Launcher 0.1 Unity/Launcher TARGETS UnityLauncher-qml)
plugins/Unity/Launcher/backend/launcherbackend.cppnew file+145
@@ -0,0 +1,145 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * Authors:
5+ * Michael Zanetti <michael.zanetti@canonical.com>
6+ *
7+ * This program is free software; you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation; version 3.
10+ *
11+ * This program is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License
17+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+ */
19+
20+#include "launcherbackend.h"
21+
22+#include <QHash>
23+
24+LauncherBackend::LauncherBackend(QObject *parent):
25+ QObject(parent)
26+{
27+
28+ // TODO: load default pinned ones from default config, instead of hardcoding here...
29+
30+ m_storedApps <<
31+ QLatin1String("phone-app.desktop") <<
32+ QLatin1String("camera-app.desktop") <<
33+ QLatin1String("gallery-app.desktop") <<
34+ QLatin1String("facebook-webapp.desktop") <<
35+ QLatin1String("webbrowser-app.desktop") <<
36+ QLatin1String("twitter-webapp.desktop") <<
37+ QLatin1String("gmail-webapp.desktop") <<
38+ QLatin1String("ubuntu-weather-app.desktop") <<
39+ QLatin1String("notes-app.desktop") <<
40+ QLatin1String("ubuntu-calendar-app.desktop");
41+
42+ // TODO: get stuff from desktop files instead this hardcoded map
43+ m_displayNameMap.insert("phone-app.desktop", "Phone");
44+ m_displayNameMap.insert("camera-app.desktop", "Camera");
45+ m_displayNameMap.insert("gallery-app.desktop", "Gallery");
46+ m_displayNameMap.insert("facebook-webapp.desktop", "Facebook");
47+ m_displayNameMap.insert("webbrowser-app.desktop", "Browser");
48+ m_displayNameMap.insert("twitter-webapp.desktop", "Twitter");
49+ m_displayNameMap.insert("gmail-webapp.desktop", "GMail");
50+ m_displayNameMap.insert("ubuntu-weather-app.desktop", "Weather");
51+ m_displayNameMap.insert("notes-app.desktop", "Notes");
52+ m_displayNameMap.insert("ubuntu-calendar-app.desktop", "Calendar");
53+
54+ // TODO: get stuff from desktop files instead this hardcoded map
55+ m_iconMap.insert("phone-app.desktop", "phone-app");
56+ m_iconMap.insert("camera-app.desktop", "camera");
57+ m_iconMap.insert("gallery-app.desktop", "gallery");
58+ m_iconMap.insert("facebook-webapp.desktop", "facebook");
59+ m_iconMap.insert("webbrowser-app.desktop", "browser");
60+ m_iconMap.insert("twitter-webapp.desktop", "twitter");
61+ m_iconMap.insert("gmail-webapp.desktop", "gmail");
62+ m_iconMap.insert("ubuntu-weather-app.desktop", "weather");
63+ m_iconMap.insert("notes-app.desktop", "notepad");
64+ m_iconMap.insert("ubuntu-calendar-app.desktop", "calendar");
65+
66+}
67+
68+LauncherBackend::~LauncherBackend()
69+{
70+
71+}
72+
73+QStringList LauncherBackend::storedApplications() const
74+{
75+ return m_storedApps;
76+}
77+
78+void LauncherBackend::setStoredApplications(const QStringList &appIds)
79+{
80+ m_storedApps = appIds;
81+ // TODO: Cleanup pinned state from settings for apps not in list any more.
82+}
83+
84+QString LauncherBackend::desktopFile(const QString &appId) const
85+{
86+ // TODO: return real path instead of this hardcoded one
87+ return QLatin1String("/usr/share/applications/") + appId;
88+}
89+
90+QString LauncherBackend::displayName(const QString &appId) const
91+{
92+ return m_displayNameMap.value(appId);
93+}
94+
95+QString LauncherBackend::icon(const QString &appId) const
96+{
97+ return m_iconMap.value(appId);
98+}
99+
100+bool LauncherBackend::isPinned(const QString &appId) const
101+{
102+ // TODO: return app's pinned state from settings
103+ Q_UNUSED(appId)
104+ return true;
105+}
106+
107+void LauncherBackend::setPinned(const QString &appId, bool pinned)
108+{
109+ // TODO: Store pinned state in settings.
110+ Q_UNUSED(appId)
111+ Q_UNUSED(pinned)
112+}
113+
114+QList<QuickListEntry> LauncherBackend::quickList(const QString &appId) const
115+{
116+ // TODO: Get static (from .desktop file) and dynamic (from the app itself)
117+ // entries and return them here. Frontend related entries (like "Pin to launcher")
118+ // don't matter here. This is just the backend part.
119+ // TODO: emit quickListChanged() when the dynamic part changes
120+ Q_UNUSED(appId)
121+ return QList<QuickListEntry>();
122+}
123+
124+int LauncherBackend::progress(const QString &appId) const
125+{
126+ // TODO: Return value for progress emblem.
127+ // TODO: emit progressChanged() when this value changes.
128+ Q_UNUSED(appId)
129+ return -1;
130+}
131+
132+int LauncherBackend::count(const QString &appId) const
133+{
134+ // TODO: Return value for count emblem.
135+ // TODO: emit countChanged() when this value changes.
136+ Q_UNUSED(appId)
137+ return 0;
138+}
139+
140+void LauncherBackend::triggerQuickListAction(const QString &appId, const QString &quickListId)
141+{
142+ // TODO: execute the given quicklist action
143+ Q_UNUSED(appId)
144+ Q_UNUSED(quickListId)
145+}
plugins/Unity/Launcher/backend/launcherbackend.hnew file+132
@@ -0,0 +1,132 @@
1+/* Copyright (C) 2013 Canonical, Ltd.
2+ *
3+ * Authors:
4+ * Michael Zanetti <michael.zanetti@canonical.com>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; version 3.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+
19+#ifndef LAUNCHERBACKEND_H
20+#define LAUNCHERBACKEND_H
21+
22+#include "common/quicklistentry.h"
23+
24+#include <QObject>
25+#include <QStringList>
26+#include <QHash>
27+
28+/**
29+ * @brief An interface that provides all the data needed by the launcher.
30+ */
31+
32+class LauncherBackend : public QObject
33+{
34+ Q_OBJECT
35+
36+
37+public:
38+ LauncherBackend(QObject *parent = 0);
39+ virtual ~LauncherBackend();
40+
41+ /**
42+ * @brief Returns a list of stored applications.
43+ * @returns A list of application IDs.
44+ */
45+ QStringList storedApplications() const;
46+
47+ /**
48+ * @brief Set the list of stored applications.
49+ *
50+ * Any previously stored information for apps not contained
51+ * in the list any more, e.g. the pinned state, will be
52+ * discarded.
53+ *
54+ * @param appIds The new list of stored applications.
55+ */
56+ void setStoredApplications(const QStringList &appIds);
57+
58+ /**
59+ * @brief Get the full path to the .desktop file.
60+ * @returns The full path to the .dekstop file.
61+ */
62+ QString desktopFile(const QString &appId) const;
63+
64+ /**
65+ * @brief Get the user friendly name of an application.
66+ * @param appId The ID of the application.
67+ * @returns The user friendly name of the application.
68+ */
69+ QString displayName(const QString &appId) const;
70+
71+ /**
72+ * @brief Get the icon of an application.
73+ * @param appId The ID of the application.
74+ * @returns The full path to the icon for the application.
75+ */
76+ QString icon(const QString &appId) const;
77+
78+ /**
79+ * @brief Is the app manually pinned?
80+ * @returns true if pinned, otherwise false.
81+ */
82+ bool isPinned(const QString &appId) const;
83+
84+ /**
85+ * @brief Change the pinned state of an application.
86+ * @param appId The application where the pinned flag should be set.
87+ * @param pinned true if pinned, otherwise false.
88+ */
89+ void setPinned(const QString &appId, bool pinned);
90+
91+ //TODO: Fill in getters for all the other things needed from the .desktop file.
92+
93+ /**
94+ * @brief Get the QuickList for an application.
95+ * @param appId The ID of the application.
96+ * @returns A QuickListModelInterface containing the QuickList.
97+ */
98+ QList<QuickListEntry> quickList(const QString &appId) const;
99+
100+ /**
101+ * @brief Execute an action from the quickList
102+ * @param appId The app ID for which the action was triggered
103+ * @param the quicklist ID of the action that was triggered
104+ */
105+ void triggerQuickListAction(const QString &appId, const QString &entryId);
106+
107+ /**
108+ * @brief Get the progress for the progress overlay of an application.
109+ * @param appId The ID of the application.
110+ * @returns The percentage of the overlay progress bar. -1 if no progress bar available.
111+ */
112+ int progress(const QString &appId) const;
113+
114+ /**
115+ * @brief Get the count of the count overlay of an application.
116+ * @param appId The ID of the application.
117+ * @returns The number to be displayed in the overlay. -1 if no count overlay is available.
118+ */
119+ int count(const QString &appId) const;
120+
121+Q_SIGNALS:
122+ void quickListChanged(const QString &appId, const QList<QuickListEntry> &quickList);
123+ void progressChanged(const QString &appId, int progress);
124+ void countChanged(const QString &appId, int count);
125+
126+private:
127+ QStringList m_storedApps;
128+ QHash<QString, QString> m_displayNameMap;
129+ QHash<QString, QString> m_iconMap;
130+};
131+
132+#endif // LAUNCHERBACKEND_H
plugins/Unity/Launcher/common/quicklistentry.cppnew file+54
@@ -0,0 +1,54 @@
1+/* Copyright (C) 2013 Canonical, Ltd.
2+ *
3+ * Authors:
4+ * Michael Zanetti <michael.zanetti@canonical.com>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; version 3.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+
19+#include "quicklistentry.h"
20+
21+QuickListEntry::QuickListEntry()
22+{
23+
24+}
25+
26+QString QuickListEntry::actionId() const
27+{
28+ return m_actionId;
29+}
30+
31+void QuickListEntry::setActionId(const QString &actionId)
32+{
33+ m_actionId = actionId;
34+}
35+
36+QString QuickListEntry::text() const
37+{
38+ return m_text;
39+}
40+
41+void QuickListEntry::setText(const QString &text)
42+{
43+ m_text = text;
44+}
45+
46+QString QuickListEntry::icon() const
47+{
48+ return m_icon;
49+}
50+
51+void QuickListEntry::setIcon(const QString &icon)
52+{
53+ m_icon = icon;
54+}
plugins/Unity/Launcher/common/quicklistentry.hnew file+44
@@ -0,0 +1,44 @@
1+/* Copyright (C) 2013 Canonical, Ltd.
2+ *
3+ * Authors:
4+ * Michael Zanetti <michael.zanetti@canonical.com>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; version 3.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+
19+#ifndef QUICKLISTENTRY_H
20+#define QUICKLISTENTRY_H
21+
22+#include <QString>
23+
24+class QuickListEntry
25+{
26+public:
27+ QuickListEntry();
28+
29+ QString actionId() const;
30+ void setActionId(const QString &actionId);
31+
32+ QString text() const;
33+ void setText(const QString &text);
34+
35+ QString icon() const;
36+ void setIcon(const QString &icon);
37+
38+private:
39+ QString m_actionId;
40+ QString m_text;
41+ QString m_icon;
42+};
43+
44+#endif // QUICKLISTENTRY
plugins/Unity/Launcher/launcheritem.cppnew file+127
@@ -0,0 +1,127 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "launcheritem.h"
21+#include "quicklistmodel.h"
22+
23+LauncherItem::LauncherItem(const QString &appId, const QString &desktopFile, const QString &name, const QString &icon, QObject *parent) :
24+ LauncherItemInterface(parent),
25+ m_appId(appId),
26+ m_desktopFile(desktopFile),
27+ m_name(name),
28+ m_icon(icon),
29+ m_pinned(false),
30+ m_running(false),
31+ m_recent(false),
32+ m_progress(-1),
33+ m_count(0),
34+ m_quickList(new QuickListModel(this))
35+{
36+
37+}
38+
39+QString LauncherItem::appId() const
40+{
41+ return m_appId;
42+}
43+
44+QString LauncherItem::desktopFile() const
45+{
46+ return m_desktopFile;
47+}
48+
49+QString LauncherItem::name() const
50+{
51+ return m_name;
52+}
53+
54+QString LauncherItem::icon() const
55+{
56+ return m_icon;
57+}
58+
59+bool LauncherItem::pinned() const
60+{
61+ return m_pinned;
62+}
63+
64+void LauncherItem::setPinned(bool pinned)
65+{
66+ if (m_pinned != pinned) {
67+ m_pinned = pinned;
68+ Q_EMIT pinnedChanged(pinned);
69+ }
70+}
71+
72+bool LauncherItem::running() const
73+{
74+ return m_running;
75+}
76+
77+void LauncherItem::setRunning(bool running)
78+{
79+ if (m_running != running) {
80+ m_running = running;
81+ Q_EMIT runningChanged(running);
82+ }
83+}
84+
85+bool LauncherItem::recent() const
86+{
87+ return m_recent;
88+}
89+
90+void LauncherItem::setRecent(bool recent)
91+{
92+ if (m_recent != recent) {
93+ m_recent = recent;
94+ Q_EMIT recentChanged(recent);
95+ }
96+}
97+
98+int LauncherItem::progress() const
99+{
100+ return m_progress;
101+}
102+
103+void LauncherItem::setProgress(int progress)
104+{
105+ if (m_progress != progress) {
106+ m_progress = progress;
107+ Q_EMIT progressChanged(progress);
108+ }
109+}
110+
111+int LauncherItem::count() const
112+{
113+ return m_count;
114+}
115+
116+void LauncherItem::setCount(int count)
117+{
118+ if (m_count != count) {
119+ m_count = count;
120+ Q_EMIT countChanged(count);
121+ }
122+}
123+
124+unity::shell::launcher::QuickListModelInterface *LauncherItem::quickList() const
125+{
126+ return m_quickList;
127+}
plugins/Unity/Launcher/launcheritem.hnew file+76
@@ -0,0 +1,76 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef LAUNCHERITEM_H
21+#define LAUNCHERITEM_H
22+
23+#include "quicklistmodel.h"
24+
25+#include <unity/shell/launcher/LauncherItemInterface.h>
26+
27+class QuickListModel;
28+
29+using namespace unity::shell::launcher;
30+
31+class LauncherItem: public LauncherItemInterface
32+{
33+ Q_OBJECT
34+public:
35+ LauncherItem(const QString &appId, const QString &desktopFile, const QString &name, const QString &icon, QObject *parent = 0);
36+
37+ QString appId() const;
38+ QString desktopFile() const;
39+ QString name() const;
40+ QString icon() const;
41+
42+ bool pinned() const;
43+ void setPinned(bool pinned);
44+
45+ bool running() const;
46+ void setRunning(bool running);
47+
48+ bool recent() const;
49+ void setRecent(bool recent);
50+
51+ int progress() const;
52+ void setProgress(int progress);
53+
54+ int count() const;
55+ void setCount(int count);
56+
57+ unity::shell::launcher::QuickListModelInterface *quickList() const;
58+
59+Q_SIGNALS:
60+ void favoriteChanged(bool favorite);
61+ void runningChanged(bool running);
62+
63+private:
64+ QString m_appId;
65+ QString m_desktopFile;
66+ QString m_name;
67+ QString m_icon;
68+ bool m_pinned;
69+ bool m_running;
70+ bool m_recent;
71+ int m_progress;
72+ int m_count;
73+ QuickListModel *m_quickList;
74+};
75+
76+#endif // LAUNCHERITEM_H
plugins/Unity/Launcher/launchermodel.cppnew file+170
@@ -0,0 +1,170 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "launchermodel.h"
21+#include "launcheritem.h"
22+#include "backend/launcherbackend.h"
23+
24+LauncherModel::LauncherModel(QObject *parent):
25+ LauncherModelInterface(parent),
26+ m_backend(new LauncherBackend(this))
27+{
28+ Q_FOREACH (const QString &entry, m_backend->storedApplications()) {
29+ LauncherItem *item = new LauncherItem(entry,
30+ m_backend->desktopFile(entry),
31+ m_backend->displayName(entry),
32+ m_backend->icon(entry),
33+ this);
34+ if (m_backend->isPinned(entry)) {
35+ item->setPinned(true);
36+ } else {
37+ item->setRecent(true);
38+ }
39+ m_list.append(item);
40+ }
41+}
42+
43+LauncherModel::~LauncherModel()
44+{
45+ while (!m_list.empty()) {
46+ m_list.takeFirst()->deleteLater();
47+ }
48+}
49+
50+int LauncherModel::rowCount(const QModelIndex &parent) const
51+{
52+ Q_UNUSED(parent)
53+ return m_list.count();
54+}
55+
56+QVariant LauncherModel::data(const QModelIndex &index, int role) const
57+{
58+ LauncherItem *item = m_list.at(index.row());
59+ switch(role) {
60+ case RoleAppId:
61+ return item->desktopFile();
62+ case RoleDesktopFile:
63+ return item->desktopFile();
64+ case RoleName:
65+ return item->name();
66+ case RoleIcon:
67+ return item->icon();
68+ case RolePinned:
69+ return item->pinned();
70+ }
71+
72+ return QVariant();
73+}
74+
75+unity::shell::launcher::LauncherItemInterface *LauncherModel::get(int index) const
76+{
77+ if (index < 0 || index >= m_list.count()) {
78+ return 0;
79+ }
80+ return m_list.at(index);
81+}
82+
83+void LauncherModel::move(int oldIndex, int newIndex)
84+{
85+ // Perform the move in our list
86+ beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
87+ m_list.move(oldIndex, newIndex);
88+ endMoveRows();
89+
90+ storeAppList();
91+
92+ pin(m_list.at(newIndex)->appId());
93+}
94+
95+void LauncherModel::pin(const QString &appId, int index)
96+{
97+ int currentIndex = findApplication(appId);
98+
99+ if (currentIndex >= 0) {
100+ if (index == -1 || index == currentIndex) {
101+ m_list.at(currentIndex)->setPinned(true);
102+ QModelIndex modelIndex = this->index(currentIndex);
103+ Q_EMIT dataChanged(modelIndex, modelIndex);
104+ } else {
105+ move(currentIndex, index);
106+ }
107+ } else {
108+ if (index == -1) {
109+ index = m_list.count();
110+ }
111+ beginInsertRows(QModelIndex(), index, index);
112+ LauncherItem *item = new LauncherItem(appId,
113+ m_backend->desktopFile(appId),
114+ m_backend->displayName(appId),
115+ m_backend->icon(appId));
116+ item->setPinned(true);
117+ m_list.insert(index, item);
118+ endInsertRows();
119+ }
120+}
121+
122+void LauncherModel::requestRemove(const QString &appId)
123+{
124+ int index = findApplication(appId);
125+ if (index < 0) {
126+ return;
127+ }
128+
129+ beginRemoveRows(QModelIndex(), index, index);
130+ m_list.takeAt(index)->deleteLater();
131+ endRemoveRows();
132+
133+ storeAppList();
134+}
135+
136+void LauncherModel::quickListActionInvoked(const QString &appId, int actionIndex)
137+{
138+ int index = findApplication(appId);
139+ if (index < 0) {
140+ return;
141+ }
142+
143+ QuickListModel *model = qobject_cast<QuickListModel*>(m_list.at(index)->quickList());
144+ if (model) {
145+ QString actionId = model->get(actionIndex).actionId();
146+ m_backend->triggerQuickListAction(appId, actionId);
147+ }
148+}
149+
150+void LauncherModel::storeAppList()
151+{
152+ QStringList appIds;
153+ Q_FOREACH(LauncherItem *item, m_list) {
154+ if (item->pinned() || item->recent()) {
155+ appIds << item->appId();
156+ }
157+ }
158+ m_backend->setStoredApplications(appIds);
159+}
160+
161+int LauncherModel::findApplication(const QString &appId)
162+{
163+ for (int i = 0; i < m_list.count(); ++i) {
164+ LauncherItem *item = m_list.at(i);
165+ if (item->appId() == appId) {
166+ return i;
167+ }
168+ }
169+ return -1;
170+}
plugins/Unity/Launcher/launchermodel.hnew file+61
@@ -0,0 +1,61 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef LAUNCHERMODELH
21+#define LAUNCHERMODEL_H
22+
23+// unity-api
24+#include <unity/shell/launcher/LauncherModelInterface.h>
25+
26+// Qt
27+#include <QAbstractListModel>
28+
29+class LauncherItem;
30+class LauncherBackend;
31+
32+using namespace unity::shell::launcher;
33+
34+class LauncherModel: public LauncherModelInterface
35+{
36+ Q_OBJECT
37+
38+public:
39+ LauncherModel(QObject *parent = 0);
40+ ~LauncherModel();
41+
42+ int rowCount(const QModelIndex &parent) const;
43+
44+ QVariant data(const QModelIndex &index, int role) const;
45+
46+ Q_INVOKABLE unity::shell::launcher::LauncherItemInterface* get(int index) const;
47+ Q_INVOKABLE void move(int oldIndex, int newIndex);
48+ Q_INVOKABLE void pin(const QString &appId, int index = -1);
49+ Q_INVOKABLE void requestRemove(const QString &appId);
50+ Q_INVOKABLE void quickListActionInvoked(const QString &appId, int actionIndex);
51+
52+private:
53+ void storeAppList();
54+ int findApplication(const QString &appId);
55+
56+private:
57+ QList<LauncherItem*> m_list;
58+ LauncherBackend *m_backend;
59+};
60+
61+#endif // LAUNCHERMODEL_H
plugins/Unity/Launcher/plugin.cppnew file+47
@@ -0,0 +1,47 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+// Qt
21+#include <QtQml>
22+
23+// self
24+#include "plugin.h"
25+
26+// local
27+#include "launchermodel.h"
28+#include "launcheritem.h"
29+
30+
31+using namespace unity::shell::launcher;
32+
33+static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
34+{
35+ return new LauncherModel();
36+}
37+
38+void UnityLauncherPlugin::registerTypes(const char *uri)
39+{
40+ Q_ASSERT(uri == QLatin1String("Unity.Launcher"));
41+
42+ qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Abstract Interface. Cannot be instantiated.");
43+ qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Abstract Interface. Cannot be instantiated.");
44+
45+ qmlRegisterSingletonType<LauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
46+ qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
47+}
plugins/Unity/Launcher/plugin.hnew file+34
@@ -0,0 +1,34 @@
1+/*
2+ * Copyright (C) 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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+#ifndef UNITY_LAUNCHER_PLUGIN_H
20+#define UNITY_LAUNCHER_PLUGIN_H
21+
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlExtensionPlugin>
24+
25+class UnityLauncherPlugin : public QQmlExtensionPlugin
26+{
27+ Q_OBJECT
28+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29+
30+public:
31+ void registerTypes(const char *uri);
32+};
33+
34+#endif
plugins/Unity/Launcher/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Unity.Launcher
2+plugin UnityLauncher-qml
3+typeinfo plugin.qmltypes
plugins/Unity/Launcher/quicklistmodel.cppnew file+60
@@ -0,0 +1,60 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "quicklistmodel.h"
21+
22+QuickListModel::QuickListModel(QObject *parent) :
23+ QuickListModelInterface(parent)
24+{
25+
26+}
27+
28+QuickListModel::~QuickListModel()
29+{
30+
31+}
32+
33+void QuickListModel::appendAction(const QuickListEntry &entry)
34+{
35+ beginInsertRows(QModelIndex(), m_list.count() - 1, m_list.count() -1);
36+ m_list.append(entry);
37+ endInsertRows();
38+}
39+
40+QuickListEntry QuickListModel::get(int index) const
41+{
42+ return m_list.at(index);
43+}
44+
45+int QuickListModel::rowCount(const QModelIndex &index) const
46+{
47+ Q_UNUSED(index)
48+ return m_list.count();
49+}
50+
51+QVariant QuickListModel::data(const QModelIndex &index, int role) const
52+{
53+ switch (role) {
54+ case RoleLabel:
55+ return m_list.at(index.row()).text();
56+ case RoleIcon:
57+ return m_list.at(index.row()).icon();
58+ }
59+ return QVariant();
60+}
plugins/Unity/Launcher/quicklistmodel.hnew file+48
@@ -0,0 +1,48 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef QUICKLISTMODEL_H
21+#define QUICKLISTMODEL_H
22+
23+#include "common/quicklistentry.h"
24+
25+#include <unity/shell/launcher/QuickListModelInterface.h>
26+
27+using namespace unity::shell::launcher;
28+
29+class QuickListModel: public QuickListModelInterface
30+{
31+ Q_OBJECT
32+
33+public:
34+ explicit QuickListModel(QObject *parent = 0);
35+
36+ ~QuickListModel();
37+
38+ void appendAction(const QuickListEntry &entry);
39+ QuickListEntry get(int index) const;
40+
41+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
42+ QVariant data(const QModelIndex &index, int role) const;
43+
44+private:
45+ QList<QuickListEntry> m_list;
46+};
47+
48+#endif // QUICKLISTMODEL_H
plugins/Unity/launchermodel.cppdeleted−153
@@ -1,153 +0,0 @@
1−/*
2− * Copyright (C) 2011 Canonical, Ltd.
3− *
4− * Authors:
5− * Michael Zanetti <michael.zanetti@canonical.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; version 3.
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
15− *
16− * You should have received a copy of the GNU General Public License
17− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18− */
19−
20−#include "launchermodel.h"
21−
22−LauncherModel::LauncherModel(QObject *parent): QAbstractListModel(parent)
23−{
24− // FIXME: Dummy data... Aggregate real data from backends
25−
26− // Fake favorites
27− LauncherItem *item = new LauncherItem("/usr/share/applications/phone-app.desktop", "Phone", "phone-app");
28− m_list.append(item);
29− item = new LauncherItem("/usr/share/applications/camera-app.desktop", "Camera", "camera");
30− m_list.append(item);
31− item = new LauncherItem("/usr/share/applications/gallery-app.desktop", "Gallery", "gallery");
32− m_list.append(item);
33− item = new LauncherItem("/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook");
34− m_list.append(item);
35− item = new LauncherItem("/usr/share/applications/webbrowser-app.desktop", "Browser", "browser");
36− m_list.append(item);
37− item = new LauncherItem("/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter");
38− m_list.append(item);
39− item = new LauncherItem("/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail");
40− m_list.append(item);
41− item = new LauncherItem("/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather");
42− m_list.append(item);
43− item = new LauncherItem("/usr/share/applications/notes-app.desktop", "Notepad", "notepad");
44− m_list.append(item);
45− item = new LauncherItem("/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar");
46− m_list.append(item);
47−}
48−
49−LauncherModel::~LauncherModel()
50−{
51− while (!m_list.empty()) {
52− m_list.takeFirst()->deleteLater();
53− }
54−}
55−
56−int LauncherModel::rowCount(const QModelIndex &parent) const
57−{
58− Q_UNUSED(parent)
59− return m_list.count();
60−}
61−
62−QVariant LauncherModel::data(const QModelIndex &index, int role) const
63−{
64− LauncherItem *item = m_list.at(index.row());
65− switch(role) {
66− case RoleName:
67− return item->name();
68− case RoleIcon:
69− return item->icon();
70− case RoleFavorite:
71− return item->favorite();
72− }
73−
74− return QVariant();
75−}
76−
77−LauncherItem *LauncherModel::get(int index) const
78−{
79− if (index < 0 || index >= m_list.count()) {
80− return 0;
81− }
82− return m_list.at(index);
83−}
84−
85−void LauncherModel::move(int oldIndex, int newIndex)
86−{
87− beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
88− m_list.move(oldIndex, newIndex);
89− endMoveRows();
90−}
91−
92−QHash<int, QByteArray> LauncherModel::roleNames() const
93−{
94− QHash<int, QByteArray> roles;
95− roles.insert(RoleDesktopFile, "desktopFile");
96− roles.insert(RoleName, "name");
97− roles.insert(RoleIcon, "icon");
98− roles.insert(RoleFavorite, "favorite");
99− roles.insert(RoleRunning, "runnng");
100− return roles;
101−}
102−
103−
104−LauncherItem::LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent):
105− QObject(parent),
106− m_desktopFile(desktopFile),
107− m_name(name),
108− m_icon(icon),
109− m_favorite(false)
110−{
111−
112−}
113−
114−QString LauncherItem::desktopFile() const
115−{
116− return m_desktopFile;
117−}
118−
119−QString LauncherItem::name() const
120−{
121− return m_name;
122−}
123−
124−QString LauncherItem::icon() const
125−{
126− return m_icon;
127−}
128−
129−bool LauncherItem::favorite() const
130−{
131− return m_favorite;
132−}
133−
134−void LauncherItem::setFavorite(bool favorite)
135−{
136− if (m_favorite != favorite) {
137− m_favorite = favorite;
138− Q_EMIT favoriteChanged(m_favorite);
139− }
140−}
141−
142−bool LauncherItem::running() const
143−{
144− return m_running;
145−}
146−
147−void LauncherItem::setRunning(bool running)
148−{
149− if (m_running != running) {
150− m_running = running;
151− Q_EMIT runningChanged(running);
152− }
153−}
plugins/Unity/launchermodel.hdeleted−86
@@ -1,86 +0,0 @@
1−/*
2− * Copyright (C) 2011 Canonical, Ltd.
3− *
4− * Authors:
5− * Michael Zanetti <michael.zanetti@canonical.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; version 3.
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
15− *
16− * You should have received a copy of the GNU General Public License
17− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18− */
19−
20−#include <QAbstractListModel>
21−
22−class LauncherItem;
23−
24−class LauncherModel: public QAbstractListModel
25−{
26− Q_OBJECT
27−
28−public:
29− enum Roles {
30− RoleDesktopFile = Qt::UserRole,
31− RoleName,
32− RoleIcon,
33− RoleFavorite,
34− RoleRunning
35− };
36−
37− LauncherModel(QObject *parent = 0);
38− ~LauncherModel();
39−
40− int rowCount(const QModelIndex &parent) const;
41−
42− QVariant data(const QModelIndex &index, int role) const;
43−
44− Q_INVOKABLE LauncherItem* get(int index) const;
45− Q_INVOKABLE void move(int oldIndex, int newIndex);
46−
47− QHash<int, QByteArray> roleNames() const;
48−
49−private:
50− QList<LauncherItem*> m_list;
51−};
52−
53−class LauncherItem: public QObject
54−{
55− Q_OBJECT
56− Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
57− Q_PROPERTY(QString name READ name CONSTANT)
58− Q_PROPERTY(QString icon READ icon CONSTANT)
59− Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
60− Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
61−
62−public:
63− LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent = 0);
64−
65− QString desktopFile() const;
66−
67− QString name() const;
68− QString icon() const;
69−
70− bool favorite() const;
71− void setFavorite(bool favorite);
72−
73− bool running() const;
74− void setRunning(bool running);
75−
76−Q_SIGNALS:
77− void favoriteChanged(bool favorite);
78− void runningChanged(bool running);
79−
80−private:
81− QString m_desktopFile;
82− QString m_name;
83− QString m_icon;
84− bool m_favorite;
85− bool m_running;
86−};
plugins/Unity/plugin.cpp−3
@@ -33,7 +33,6 @@
3333#include "categories.h"
3434#include "categoryresults.h"
3535#include "bottombarvisibilitycommunicatorshell.h"
36−#include "launchermodel.h"
3736
3837// libqtdee
3938#include "deelistmodel.h"
@@ -53,8 +52,6 @@ void UnityPlugin::registerTypes(const char *uri)
5352 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
5453 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create new Category Results in QML. Get them from Categories instance.");
5554 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");
56− qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
57− qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
5855 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
5956}
6057
plugins/Utils/CMakeLists.txt+3−1
@@ -5,6 +5,7 @@ include_directories(
55)
66
77set(QMLPLUGIN_SRC
8+ applicationpaths.h
89 qlimitproxymodelqml.cpp
910 qsortfilterproxymodelqml.cpp
1011 ubuntuwindow.cpp
@@ -22,5 +23,6 @@ set_target_properties(Utils-qml PROPERTIES COMPILE_FLAGS -fvisibility=default)
2223
2324qt5_use_modules(Utils-qml Qml Quick)
2425
25−# export the qmldir and qmltypes files
26+# export the qmldir qmltypes and plugin files
27+export_qmlfiles(Utils Utils)
2628export_qmlplugin(Utils 0.1 Utils TARGETS Utils-qml)
plugins/Utils/applicationpaths.hnew file+38
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (C) 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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authored by: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+
20+#ifndef APPLICATION_PATHS_H
21+#define APPLICATION_PATHS_H
22+
23+#include <QObject>
24+#include "paths.h"
25+
26+class ApplicationPaths : public QObject
27+{
28+ Q_OBJECT
29+public:
30+ Q_INVOKABLE bool isRunningInstalled() const { return ::isRunningInstalled(); }
31+ Q_INVOKABLE QString shellAppDirectory() const { return ::shellAppDirectory(); }
32+ Q_INVOKABLE QStringList overrideImportPaths() const { return ::overrideImportPaths(); }
33+ Q_INVOKABLE QStringList fallbackImportPaths() const { return ::fallbackImportPaths(); }
34+ Q_INVOKABLE QStringList shellDataDirs() const { return ::shellDataDirs(); }
35+ Q_INVOKABLE QString sourceDirectory() const { return ::sourceDirectory(); }
36+};
37+
38+#endif // APPLICATION_PATHS_H
plugins/Utils/plugin.cpp+8
@@ -24,10 +24,17 @@
2424#include "plugin.h"
2525
2626// local
27+#include "applicationpaths.h"
2728#include "qlimitproxymodelqml.h"
2829#include "qsortfilterproxymodelqml.h"
2930#include "ubuntuwindow.h"
3031
32+static QObject* applicationsPathsSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
33+ Q_UNUSED(engine);
34+ Q_UNUSED(scriptEngine);
35+ return new ApplicationPaths;
36+}
37+
3138void UtilsPlugin::registerTypes(const char *uri)
3239{
3340 Q_ASSERT(uri == QLatin1String("Utils"));
@@ -35,4 +42,5 @@ void UtilsPlugin::registerTypes(const char *uri)
3542 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
3643 qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
3744 qmlRegisterExtendedType<QQuickWindow, UbuntuWindow>(uri, 0, 1, "Window");
45+ qmlRegisterSingletonType<ApplicationPaths>(uri, 0, 1, "ApplicationPaths", applicationsPathsSingleton);
3846}
po/ar.po+3−27
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-22 16:15+0000\n"
11+"PO-Revision-Date: 2013-06-26 23:26+0000\n"
1212"Last-Translator: Ibrahim Saed <ibraheem5000@gmail.com>\n"
1313"Language-Team: Arabic <ar@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,27 +218,3 @@ msgstr "عذراً، لا يوجد ما يطابق بحثك."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "أشخاص"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "الشاشة الرئيسية"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "الأشخاص المفضلون"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "أشخاص كانوا على اتصال مؤخرا"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "A-Z"
236−
237−#~ msgid "Recently in touch"
238−#~ msgstr "على اتصال موخرا"
239−
240−#~ msgid "New Contacts"
241−#~ msgstr "أشخاص جدد"
242−
243−#~ msgid "Favourites"
244−#~ msgstr "المفضلات"
po/az.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-26 23:48+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Azerbaijani <az@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Bağışlayın, amma axtarışınıza heç bir nəticə uyğun gəlmir."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "İnsanlar"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Əsas Ekran"
po/bg.po+3−15
@@ -8,15 +8,15 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-19 15:47+0000\n"
11+"PO-Revision-Date: 2013-06-27 00:06+0000\n"
1212"Last-Translator: Miroslav E. Hadzhiev (Хаджиев) "
1313"<miroslav.hadzhiev@gmail.com>\n"
1414"Language-Team: Bulgarian <bg@li.org>\n"
1515"MIME-Version: 1.0\n"
1616"Content-Type: text/plain; charset=UTF-8\n"
1717"Content-Transfer-Encoding: 8bit\n"
18−"X-Launchpad-Export-Date: 2013-06-27 16:15+0000\n"
19−"X-Generator: Launchpad (build 16681)\n"
18+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
19+"X-Generator: Launchpad (build 16696)\n"
2020
2121#: Applications/applications.js:23
2222msgid "Phone"
@@ -219,15 +219,3 @@ msgstr "Съжаляваме, няма нищо, което да отговар
219219#, qt-format
220220msgid "Please enter %1"
221221msgstr ""
222−
223−#~ msgid "Favourites"
224−#~ msgstr "Любими"
225−
226−#~ msgid "People"
227−#~ msgstr "Хора"
228−
229−#~ msgid "A-Z"
230−#~ msgstr "А-Я"
231−
232−#~ msgid "Home screen"
233−#~ msgstr "Начален екран"
po/ca.po+4−16
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 00:24+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Catalan <ca@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,15 +218,3 @@ msgstr "No hi ha res que coincideixi amb la cerca"
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Gent"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Pantalla d'inici"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Gent preferida"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "Gent amb qui heu parlat"
po/de.po+5−29
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-29 12:53+0000\n"
12−"Last-Translator: Phillip Sz <Unknown>\n"
11+"PO-Revision-Date: 2013-06-27 00:37+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: German <de@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: 2013-06-30 07:12+0000\n"
18−"X-Generator: Launchpad (build 16692)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -217,28 +217,4 @@ msgstr "Entschuldigung, es wurden keine Treffer erzielt."
217217#: Shell.qml:383
218218#, qt-format
219219msgid "Please enter %1"
220−msgstr "Bitte geben Sie %1 ein"
221−
222−#~ msgid "People"
223−#~ msgstr "Personen"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Startseite"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Lieblingspersonen"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "Zuletzt kontaktierte Personen"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "A-Z"
236−
237−#~ msgid "Recently in touch"
238−#~ msgstr "Kürzlich im Gespräch"
239−
240−#~ msgid "New Contacts"
241−#~ msgstr "Neue Kontakte"
242−
243−#~ msgid "Favourites"
244−#~ msgstr "Favoriten"
220+msgstr ""
po/el.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 00:53+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Greek <el@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Λυπούμαστε, δεν υπάρχει τίποτα που να τ
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Πρόσωπα"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Αρχική οθόνη"
po/en_AU.po+3−27
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-18 20:36+0000\n"
11+"PO-Revision-Date: 2013-06-27 01:13+0000\n"
1212"Last-Translator: Jackson Doak <Doak.jackson@gmail.com>\n"
1313"Language-Team: English (Australia) <en_AU@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,27 +218,3 @@ msgstr "Sorry, there is nothing that matches your search."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "People"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Home screen"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Favourite People"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "People Recently in Touch"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "A-Z"
236−
237−#~ msgid "Recently in touch"
238−#~ msgstr "Recently in touch"
239−
240−#~ msgid "New Contacts"
241−#~ msgstr "New Contacts"
242−
243−#~ msgid "Favourites"
244−#~ msgstr "Favourites"
po/en_GB.po+4−28
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-27 00:22+0000\n"
12−"Last-Translator: Andi Chandler <Unknown>\n"
11+"PO-Revision-Date: 2013-06-27 08:53+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: English (United Kingdom) <en_GB@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,27 +218,3 @@ msgstr "Sorry, there is nothing that matches your search."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr "Please enter %1"
221−
222−#~ msgid "Favourite People"
223−#~ msgstr "Favourite People"
224−
225−#~ msgid "People Recently in Touch"
226−#~ msgstr "People Recently in Touch"
227−
228−#~ msgid "People"
229−#~ msgstr "People"
230−
231−#~ msgid "A-Z"
232−#~ msgstr "A-Z"
233−
234−#~ msgid "Recently in touch"
235−#~ msgstr "Recently in touch"
236−
237−#~ msgid "New Contacts"
238−#~ msgstr "New Contacts"
239−
240−#~ msgid "Favourites"
241−#~ msgstr "Favourites"
242−
243−#~ msgid "Home screen"
244−#~ msgstr "Home screen"
po/eo.po+3−3
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
11+"PO-Revision-Date: 2013-06-26 22:35+0000\n"
1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313"Language-Team: Esperanto <eo@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
po/es.po+1−1
@@ -14,7 +14,7 @@ msgstr ""
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: 2013-07-09 06:13+0000\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
1818"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
po/fi.po+4−25
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-10 16:19+0000\n"
12−"Last-Translator: Jiri Grönroos <Unknown>\n"
11+"PO-Revision-Date: 2013-06-27 02:43+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Finnish <fi@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,24 +218,3 @@ msgstr "Hakuun täsmääviä tuloksia ei löydy."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Ihmiset"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Kotinäyttö"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Suosikkihenkilöt"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "Viimeksi yhteydessä olleet henkilöt"
233−
234−#~ msgid "Favourites"
235−#~ msgstr "Suosikit"
236−
237−#~ msgid "Recently in touch"
238−#~ msgstr "Viimeksi yhteydessä"
239−
240−#~ msgid "New Contacts"
241−#~ msgstr "Uudet yhteystiedot"
po/fo.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 02:57+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Faroese <fo@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Tíanverri er tað einki sum hóskar til tína leiting."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Fólk"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Heimaskíggi"
po/fr.po+40−61
@@ -8,62 +8,62 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-26 15:11+0000\n"
12−"Last-Translator: Anne <anneonyme017@gmail.com>\n"
11+"PO-Revision-Date: 2013-06-27 03:21+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: French <fr@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
22−msgstr "Téléphone"
22+msgstr ""
2323
2424#: Applications/applications.js:29
2525msgid "Camera"
26−msgstr "Appareil photo"
26+msgstr ""
2727
2828#: Applications/applications.js:35
2929msgid "Gallery"
30−msgstr "Galerie"
30+msgstr ""
3131
3232#: Applications/applications.js:40
3333msgid "Facebook"
34−msgstr "Facebook"
34+msgstr ""
3535
3636#: Applications/applications.js:46
3737msgid "Browser"
38−msgstr "Navigateur"
38+msgstr ""
3939
4040#: Applications/applications.js:51
4141msgid "Twitter"
42−msgstr "Twitter"
42+msgstr ""
4343
4444#: Applications/applications.js:57
4545msgid "GMail"
46−msgstr "GMail"
46+msgstr ""
4747
4848#: Applications/applications.js:62
4949msgid "Weather"
50−msgstr "Météo"
50+msgstr ""
5151
5252#: Applications/applications.js:68
5353msgid "Notepad"
54−msgstr "Bloc-notes"
54+msgstr ""
5555
5656#: Applications/applications.js:74
5757msgid "Calendar"
58−msgstr "Agenda"
58+msgstr ""
5959
6060#: Applications/applications.js:80
6161msgid "Media Player"
62−msgstr "Lecteur multimédia"
62+msgstr ""
6363
6464#: Applications/applications.js:86
6565msgid "Evernote"
66−msgstr "Evernote"
66+msgstr ""
6767
6868#: Applications/applications.js:91
6969msgid "Map"
@@ -71,27 +71,27 @@ msgstr ""
7171
7272#: Applications/applications.js:96
7373msgid "Pinterest"
74−msgstr "Pinterest"
74+msgstr ""
7575
7676#: Applications/applications.js:101
7777msgid "SoundCloud"
78−msgstr "SoundCloud"
78+msgstr ""
7979
8080#: Applications/applications.js:106
8181msgid "Wikipedia"
82−msgstr "Wikipédia"
82+msgstr ""
8383
8484#: Applications/applications.js:111
8585msgid "YouTube"
86−msgstr "YouTube"
86+msgstr ""
8787
8888#: Components/PageHeader.qml:300
8989msgid "Recent searches"
90−msgstr "Recherches récentes"
90+msgstr ""
9191
9292#: Dash/DashApps.qml:65
9393msgid "Running apps"
94−msgstr "Applications en cours d’exécution"
94+msgstr ""
9595
9696#: Dash/DashApps.qml:68
9797msgid "Frequently used"
@@ -99,7 +99,7 @@ msgstr ""
9999
100100#: Dash/DashApps.qml:71
101101msgid "Installed"
102−msgstr "Installées"
102+msgstr ""
103103
104104#: Dash/DashApps.qml:74
105105msgid "Available for download"
@@ -111,19 +111,19 @@ msgstr "Applications"
111111
112112#: Dash/DashHome.qml:40
113113msgid "Frequent Apps"
114−msgstr "Applications fréquemment utilisées"
114+msgstr ""
115115
116116#: Dash/DashHome.qml:43
117117msgid "Recent Music"
118−msgstr "Musique récente"
118+msgstr ""
119119
120120#: Dash/DashHome.qml:46
121121msgid "Videos Popular Online"
122−msgstr "Vidéos populaires en ligne"
122+msgstr ""
123123
124124#: Dash/DashHome.qml:175
125125msgid "Home"
126−msgstr "Accueil"
126+msgstr ""
127127
128128#: Dash/DashMusic.qml:27 Dash/DashVideos.qml:28
129129msgid "Featured"
@@ -135,7 +135,7 @@ msgstr ""
135135
136136#: Dash/DashMusic.qml:29 Dash/DashVideos.qml:30
137137msgid "New Releases"
138−msgstr "Nouveautés"
138+msgstr ""
139139
140140#: Dash/DashMusic.qml:30
141141msgid "Top Charting"
@@ -155,15 +155,15 @@ msgstr "Vidéos"
155155
156156#: Dash/Video/VideoPreview.qml:98
157157msgid "Directed by:"
158−msgstr "Réalisé par :"
158+msgstr ""
159159
160160#: Dash/Video/VideoPreview.qml:121
161161msgid "Starring:"
162−msgstr "Acteurs :"
162+msgstr ""
163163
164164#: Dash/Video/VideoPreview.qml:144
165165msgid "Author:"
166−msgstr "Auteur :"
166+msgstr ""
167167
168168#: Greeter/Lockscreen.qml:133
169169msgid "Emergency call"
@@ -172,27 +172,27 @@ msgstr ""
172172#: Greeter/PassphraseLockscreen.qml:59
173173#, qt-format
174174msgid "Hello %1"
175−msgstr "Bonjour %1"
175+msgstr ""
176176
177177#: Greeter/PassphraseLockscreen.qml:59
178178msgid "Hello"
179−msgstr "Bonjour"
179+msgstr ""
180180
181181#: Hud/HudParametrizedActionsPage.qml:132
182182msgid "Confirm"
183−msgstr "Confirmer"
183+msgstr ""
184184
185185#: Hud/Hud.qml:61 Hud/Hud.qml:99 Hud/Hud.qml:372
186186msgid "Type or say a command"
187−msgstr "Entrez ou dictez une commande"
187+msgstr ""
188188
189189#: Hud/Hud.qml:84
190190msgid "Loading. Please Wait..."
191−msgstr "Chargement. Veuillez patienter..."
191+msgstr ""
192192
193193#: Hud/Hud.qml:89
194194msgid "Speak Now..."
195−msgstr "Parlez maintenant..."
195+msgstr ""
196196
197197#: Hud/Hud.qml:94
198198msgid "Speaking..."
@@ -204,38 +204,17 @@ msgstr ""
204204
205205#: Panel/Menus/Overview/FlightModeWidget.qml:42
206206msgid "Flight mode"
207−msgstr "Mode avion"
207+msgstr ""
208208
209209#: Panel/SearchIndicator.qml:26
210210msgid "Search"
211−msgstr "Rechercher"
211+msgstr ""
212212
213213#: plugins/Unity/scope.cpp:268
214214msgid "Sorry, there is nothing that matches your search."
215−msgstr "Désolé, aucun résultat ne correspond à votre recherche."
215+msgstr ""
216216
217217#: Shell.qml:383
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "Home screen"
223−#~ msgstr "Écran d’accueil"
224−
225−#~ msgid "People"
226−#~ msgstr "Contacts"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Contacts favoris"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "Contacts récents"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "A-Z"
236−
237−#~ msgid "New Contacts"
238−#~ msgstr "Nouveaux contacts"
239−
240−#~ msgid "Favourites"
241−#~ msgstr "Favoris"
po/gl.po+4−16
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 03:38+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,15 +218,3 @@ msgstr "Sentímolo, non hai nada que coincida con esta busca."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Persoas"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Pantalla de inicio"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Xente favorita"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "Xente contactada recentemente"
po/he.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 03:54+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Hebrew <he@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "שום דבר אינו תואם לחיפוש שלך, עמך הסליחה
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "אנשים"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "מסך הבית"
po/hr.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 04:14+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Croatian <hr@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Nažalost, ne postoji ništa što odgovara vašoj pretrazi."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Osobe"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Početni zaslon"
po/hu.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 04:28+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Hungarian <hu@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Elnézést, nincs találat a keresésre."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Emberek"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Kezdőképernyő"
po/hy.po+3−15
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-07 12:42+0000\n"
11+"PO-Revision-Date: 2013-06-27 04:43+0000\n"
1212"Last-Translator: iAbaS <sosabazyan@yandex.ru>\n"
1313"Language-Team: Armenian <hy@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,15 +218,3 @@ msgstr "Կներերք, բայց Ձեր հարցումով ոչինչ չկար"
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People Recently in Touch"
223−#~ msgstr "Վերջին մարդիկ"
224−
225−#~ msgid "Favourite People"
226−#~ msgstr "Ֆավորիտներ"
227−
228−#~ msgid "People"
229−#~ msgstr "Մարդիկ"
230−
231−#~ msgid "Home screen"
232−#~ msgstr "Տուն"
po/id.po+3−3
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
11+"PO-Revision-Date: 2013-06-26 22:35+0000\n"
1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313"Language-Team: Indonesian <id@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
po/it.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 05:14+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Italian <it@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Nessun risultato corrispondente alla ricerca."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Contatti"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Home"
po/ja.po+3−3
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-15 14:12+0000\n"
11+"PO-Revision-Date: 2013-06-26 22:36+0000\n"
1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313"Language-Team: Japanese <ja@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
po/kn.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 05:43+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Kannada <kn@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "ಕ್ಷಮಿಸಿ ನಿಮ್ಮ ಶೋಧನೆಗೆ ಸರಿಯ
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "ಜನರು"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "ಹೋಮ್ ಸ್ಕ್ರೀನ್"
po/ko.po+4−4
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 05:59+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Korean <ko@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
po/ky.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 06:17+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Kirghiz <ky@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Тилекке каршы, сиздин издөөңүзгө эч нер
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Адамдар"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Башкы экран"
po/lv.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 06:31+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Latvian <lv@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Diemžēl nekas neatbilst jūsu meklētajam."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Cilvēki"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Mājas ekrāns"
po/my.po+4−7
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 06:47+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Burmese <my@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,6 +218,3 @@ msgstr "ဆောရီး၊ သင်၏ရှာဖွေမူနှင့
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "လူ"
po/nb.po+3−9
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-17 09:10+0000\n"
11+"PO-Revision-Date: 2013-06-27 07:02+0000\n"
1212"Last-Translator: Joakim Langvand <jlangvand@gmail.com>\n"
1313"Language-Team: Norwegian Bokmal <nb@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Søket ga ingen treff."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Personer"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Hjemmeskjerm"
po/nl.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 07:19+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Dutch <nl@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: 2013-06-27 16:15+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Er is helaas niets dat met uw zoekopdracht overeenkomt."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Mensen"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Startscherm"
po/pl.po+8−32
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:43+0000\n"
12−"Last-Translator: Piotr Merski <Unknown>\n"
11+"PO-Revision-Date: 2013-06-27 08:52+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Polish <pl@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -167,16 +167,16 @@ msgstr "Autor:"
167167
168168#: Greeter/Lockscreen.qml:133
169169msgid "Emergency call"
170−msgstr ""
170+msgstr "Telefon alarmowy"
171171
172172#: Greeter/PassphraseLockscreen.qml:59
173173#, qt-format
174174msgid "Hello %1"
175−msgstr ""
175+msgstr "Witaj %1"
176176
177177#: Greeter/PassphraseLockscreen.qml:59
178178msgid "Hello"
179−msgstr ""
179+msgstr "Witaj"
180180
181181#: Hud/HudParametrizedActionsPage.qml:132
182182msgid "Confirm"
@@ -217,28 +217,4 @@ msgstr "Nie znaleziono pasujących wyników."
217217#: Shell.qml:383
218218#, qt-format
219219msgid "Please enter %1"
220−msgstr ""
221−
222−#~ msgid "Home screen"
223−#~ msgstr "Ekran domowy"
224−
225−#~ msgid "People"
226−#~ msgstr "Ludzie"
227−
228−#~ msgid "People Recently in Touch"
229−#~ msgstr "Osoby ostatnio w kontakcie"
230−
231−#~ msgid "Favourite People"
232−#~ msgstr "Ulubione kontakty"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "A-Z"
236−
237−#~ msgid "Recently in touch"
238−#~ msgstr "Ostatnio w kontakcie"
239−
240−#~ msgid "New Contacts"
241−#~ msgstr "Nowe kontakty"
242−
243−#~ msgid "Favourites"
244−#~ msgstr "Ulubione"
220+msgstr "Wprowadź %1"
po/pt_BR.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 07:39+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Brazilian Portuguese <pt_BR@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Desculpe, não há nada que corresponda à sua pesquisa."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Pessoas"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Tela inicial"
po/ro.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 07:53+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Romanian <ro@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -219,9 +219,3 @@ msgstr ""
219219#, qt-format
220220msgid "Please enter %1"
221221msgstr ""
222−
223−#~ msgid "People"
224−#~ msgstr "Persoane"
225−
226−#~ msgid "Home screen"
227−#~ msgstr "Ecran principal"
po/ru.po+22−37
@@ -8,58 +8,58 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-21 10:08+0000\n"
12−"Last-Translator: Andrey Dedikov <iamawesome.ndr@gmail.com>\n"
11+"PO-Revision-Date: 2013-06-28 06:40+0000\n"
12+"Last-Translator: Eugene Marshal <Unknown>\n"
1313"Language-Team: Russian <ru@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
22−msgstr ""
22+msgstr "Телефон"
2323
2424#: Applications/applications.js:29
2525msgid "Camera"
26−msgstr ""
26+msgstr "Камера"
2727
2828#: Applications/applications.js:35
2929msgid "Gallery"
30−msgstr ""
30+msgstr "Галерея"
3131
3232#: Applications/applications.js:40
3333msgid "Facebook"
34−msgstr ""
34+msgstr "Facebook"
3535
3636#: Applications/applications.js:46
3737msgid "Browser"
38−msgstr ""
38+msgstr "Обозреватель"
3939
4040#: Applications/applications.js:51
4141msgid "Twitter"
42−msgstr ""
42+msgstr "Twitter"
4343
4444#: Applications/applications.js:57
4545msgid "GMail"
46−msgstr ""
46+msgstr "GMail"
4747
4848#: Applications/applications.js:62
4949msgid "Weather"
50−msgstr ""
50+msgstr "Погода"
5151
5252#: Applications/applications.js:68
5353msgid "Notepad"
54−msgstr ""
54+msgstr "Блокнот"
5555
5656#: Applications/applications.js:74
5757msgid "Calendar"
58−msgstr ""
58+msgstr "Календарь"
5959
6060#: Applications/applications.js:80
6161msgid "Media Player"
62−msgstr ""
62+msgstr "Медиапроигрыватель"
6363
6464#: Applications/applications.js:86
6565msgid "Evernote"
@@ -67,7 +67,7 @@ msgstr "Evernote"
6767
6868#: Applications/applications.js:91
6969msgid "Map"
70−msgstr ""
70+msgstr "Карта"
7171
7272#: Applications/applications.js:96
7373msgid "Pinterest"
@@ -79,11 +79,11 @@ msgstr "SoundCloud"
7979
8080#: Applications/applications.js:106
8181msgid "Wikipedia"
82−msgstr ""
82+msgstr "Википедия"
8383
8484#: Applications/applications.js:111
8585msgid "YouTube"
86−msgstr ""
86+msgstr "YouTube"
8787
8888#: Components/PageHeader.qml:300
8989msgid "Recent searches"
@@ -131,7 +131,7 @@ msgstr ""
131131
132132#: Dash/DashMusic.qml:28 Dash/DashVideos.qml:29
133133msgid "Recent"
134−msgstr ""
134+msgstr "Недавние"
135135
136136#: Dash/DashMusic.qml:29 Dash/DashVideos.qml:30
137137msgid "New Releases"
@@ -163,11 +163,11 @@ msgstr "В главных ролях"
163163
164164#: Dash/Video/VideoPreview.qml:144
165165msgid "Author:"
166−msgstr ""
166+msgstr "Автор:"
167167
168168#: Greeter/Lockscreen.qml:133
169169msgid "Emergency call"
170−msgstr ""
170+msgstr "Экстренный вызов"
171171
172172#: Greeter/PassphraseLockscreen.qml:59
173173#, qt-format
@@ -217,19 +217,4 @@ msgstr "Извините, поиск не дал результатов."
217217#: Shell.qml:383
218218#, qt-format
219219msgid "Please enter %1"
220−msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Люди"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Главный экран"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Избранные контакты"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "Недавние контакты"
233−
234−#~ msgid "New Contacts"
235−#~ msgstr "Новые контакты"
220+msgstr "Пожалуйста, введите %1"
po/si.po+3−3
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
11+"PO-Revision-Date: 2013-06-26 22:36+0000\n"
1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313"Language-Team: Sinhalese <si@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
po/sl.po+1−1
@@ -14,7 +14,7 @@ msgstr ""
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: 2013-07-06 08:44+0000\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
1818"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
po/sr.po+4−10
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 09:19+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Serbian <sr@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,9 +218,3 @@ msgstr "Нажалост, претрага није наишла на икакв
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Људи"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Почетни екран"
po/sv.po+3−3
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
11+"PO-Revision-Date: 2013-06-26 22:36+0000\n"
1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313"Language-Team: Swedish <sv@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
po/te.po+4−4
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 09:57+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Telugu <te@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
po/tr.po+3−24
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-24 17:24+0000\n"
11+"PO-Revision-Date: 2013-06-27 10:08+0000\n"
1212"Last-Translator: Adar Cem EREN <adarcemeren34@gmail.com>\n"
1313"Language-Team: Turkish <tr@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,24 +218,3 @@ msgstr "Üzgünüz, aramanızla eşleşen hiçbir şey yok."
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "Kişiler"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Başlangıç ekranı"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Favori Kişiler"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "En Son Konuşulan Kişiler"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "A-Z"
236−
237−#~ msgid "New Contacts"
238−#~ msgstr "Yeni Kişiler"
239−
240−#~ msgid "Favourites"
241−#~ msgstr "Favoriler"
po/ug.po+6−27
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-28 04:36+0000\n"
12−"Last-Translator: Gheyret T.Kenji <Unknown>\n"
11+"PO-Revision-Date: 2013-06-27 11:02+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Uyghur <ug@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: 2013-06-30 07:12+0000\n"
18−"X-Generator: Launchpad (build 16692)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -172,7 +172,7 @@ msgstr "جىددىي تېلېفون"
172172#: Greeter/PassphraseLockscreen.qml:59
173173#, qt-format
174174msgid "Hello %1"
175−msgstr "سالام %1"
175+msgstr ""
176176
177177#: Greeter/PassphraseLockscreen.qml:59
178178msgid "Hello"
@@ -217,25 +217,4 @@ msgstr "كەچۈرۈڭ، ئىزدىگىنىڭىزگە ماس نەتىجە تېپ
217217#: Shell.qml:383
218218#, qt-format
219219msgid "Please enter %1"
220−msgstr "%1 نى كىرگۈزۈڭ"
221−
222−#~ msgid "Favourite People"
223−#~ msgstr "ھەمىشە ئالاقە قىلىدىغان كىشىلەر"
224−
225−#~ msgid "People Recently in Touch"
226−#~ msgstr "يېقىندا ئالاقە قىلغان كىشىلەر"
227−
228−#~ msgid "People"
229−#~ msgstr "كىشىلەر"
230−
231−#~ msgid "Home screen"
232−#~ msgstr "ماكان ئېكران"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "A-Z"
236−
237−#~ msgid "Recently in touch"
238−#~ msgstr "يېقىندا ئالاقە قىلغانلار"
239−
240−#~ msgid "New Contacts"
241−#~ msgstr "يېڭى ئالاقەداشلار"
220+msgstr ""
po/uk.po+5−29
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-29 14:27+0000\n"
12−"Last-Translator: Roman Koshkin <mar2008m@rambler.ru>\n"
11+"PO-Revision-Date: 2013-06-27 10:47+0000\n"
12+"Last-Translator: Yuri Chornoivan <yurchor@gmail.com>\n"
1313"Language-Team: Ukrainian <uk@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: 2013-06-30 07:12+0000\n"
18−"X-Generator: Launchpad (build 16692)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -217,28 +217,4 @@ msgstr "Вибачте, для вказаних вами ключових слі
217217#: Shell.qml:383
218218#, qt-format
219219msgid "Please enter %1"
220−msgstr "Будь ласка, введіть %1"
221−
222−#~ msgid "People"
223−#~ msgstr "Люди"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "Екран домівки"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "Вибрані контакти"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "Недавні контакти"
233−
234−#~ msgid "A-Z"
235−#~ msgstr "А-Я"
236−
237−#~ msgid "New Contacts"
238−#~ msgstr "Нові контакти"
239−
240−#~ msgid "Favourites"
241−#~ msgstr "Улюблене"
242−
243−#~ msgid "Recently in touch"
244−#~ msgstr "Нещодавні контакти"
220+msgstr ""
po/zh_CN.po+3−27
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-22 21:20+0000\n"
11+"PO-Revision-Date: 2013-06-27 10:33+0000\n"
1212"Last-Translator: Anthony Wong <anthony.wong@canonical.com>\n"
1313"Language-Team: Chinese (Simplified) <zh_CN@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,27 +218,3 @@ msgstr "对不起,没有找到您想要的结果。"
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "Home screen"
223−#~ msgstr "主页"
224−
225−#~ msgid "Favourite People"
226−#~ msgstr "常用联系人"
227−
228−#~ msgid "People Recently in Touch"
229−#~ msgstr "近期联系人"
230−
231−#~ msgid "People"
232−#~ msgstr "联系人"
233−
234−#~ msgid "Recently in touch"
235−#~ msgstr "最近联系"
236−
237−#~ msgid "New Contacts"
238−#~ msgstr "新建联系人"
239−
240−#~ msgid "Favourites"
241−#~ msgstr "最爱"
242−
243−#~ msgid "A-Z"
244−#~ msgstr "A-Z"
po/zh_TW.po+4−16
@@ -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: 2013-06-26 22:58+0200\n"
11−"PO-Revision-Date: 2013-06-05 22:20+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2013-06-27 10:24+0000\n"
12+"Last-Translator: Michał Sawicz <michal.sawicz@canonical.com>\n"
1313"Language-Team: Chinese (Traditional) <zh_TW@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: 2013-06-27 16:16+0000\n"
18−"X-Generator: Launchpad (build 16681)\n"
17+"X-Launchpad-Export-Date: 2013-07-17 07:49+0000\n"
18+"X-Generator: Launchpad (build 16696)\n"
1919
2020#: Applications/applications.js:23
2121msgid "Phone"
@@ -218,15 +218,3 @@ msgstr "很抱歉,找不到符合您想搜尋的結果。"
218218#, qt-format
219219msgid "Please enter %1"
220220msgstr ""
221−
222−#~ msgid "People"
223−#~ msgstr "朋友"
224−
225−#~ msgid "Home screen"
226−#~ msgstr "家屋畫面"
227−
228−#~ msgid "Favourite People"
229−#~ msgstr "喜歡的朋友"
230−
231−#~ msgid "People Recently in Touch"
232−#~ msgstr "最近接觸的朋友"
run+3−3
@@ -40,17 +40,17 @@ do
4040done
4141
4242if $FAKE; then
43− export QML2_IMPORT_PATH=$PWD/builddir/tests/mocks:$PWD/builddir/plugins
43+ export QML2_IMPORT_PATH=$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
4444 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single
4545fi
4646
4747if $PINLOCK; then
48− export QML2_IMPORT_PATH=$PWD/builddir/tests/mocks:$PWD/builddir/plugins
48+ export QML2_IMPORT_PATH=$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
4949 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-pin
5050fi
5151
5252if $KEYLOCK; then
53− export QML2_IMPORT_PATH=$PWD/builddir/tests/mocks:$PWD/builddir/plugins
53+ export QML2_IMPORT_PATH=$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
5454 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-passphrase
5555fi
5656
run_on_device+1−3
@@ -65,11 +65,9 @@ setup_adb_forwarding() {
6565}
6666
6767install_dependencies() {
68+ exec_with_adb apt-get update
6869 exec_with_adb apt-get -y install openssh-server
6970 exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb ninja-build devscripts equivs
70− exec_with_ssh $SUDO add-apt-repository -y ppa:canonical-qt5-edgers/qt5-proper
71− exec_with_ssh $SUDO add-apt-repository -s -y ppa:phablet-team/ppa
72− exec_with_ssh $SUDO apt-get update
7371}
7472
7573sync_code() {
src/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(Panel)
src/Panel/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(Indicators)
src/Panel/Indicators/CMakeLists.txtnew file+2
@@ -0,0 +1,2 @@
1+add_subdirectory(client)
2+add_subdirectory(servicefiles)
src/Panel/Indicators/client/CMakeLists.txtnew file+25
@@ -0,0 +1,25 @@
1+project(indicators_client)
2+set(INDICATORS_CLIENT_APP indicators-client)
3+
4+set(INDICATORS_CLIENT_SRC
5+ main.cpp
6+ indicatorsclient.cpp
7+)
8+
9+set(INDICATORS_CLIENT_HEADERS
10+ indicatorsclient.h
11+)
12+add_executable(${INDICATORS_CLIENT_APP}
13+ ${INDICATORS_CLIENT_SRC}
14+ ${INDICATORS_CLIENT_HEADERS}
15+)
16+
17+include_directories(
18+ ${CMAKE_BINARY_DIR}
19+)
20+
21+qt5_use_modules(${INDICATORS_CLIENT_APP} Core Widgets Quick)
22+set_target_properties(${INDICATORS_CLIENT_APP} PROPERTIES COMPILE_FLAGS -fPIC)
23+
24+install(TARGETS ${INDICATORS_CLIENT_APP}
25+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
src/Panel/Indicators/client/indicatorsclient.cppnew file+99
@@ -0,0 +1,99 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Nick Dedekind <nick.dedekind@canonical.com>
19+ */
20+
21+#include "indicatorsclient.h"
22+#include "paths.h"
23+
24+#include <QQuickView>
25+#include <QQmlContext>
26+#include <QQmlEngine>
27+#include <QDebug>
28+
29+void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
30+{
31+ QStringList importPathList = engine->importPathList();
32+ for (int i = paths.count()-1; i >= 0; i--) {
33+ importPathList.prepend(paths[i]);
34+ }
35+ engine->setImportPathList(importPathList);
36+}
37+
38+/* When you append and import path to the list of import paths it will be the *last*
39+ place where Qt will search for QML modules.
40+ The usual QQmlEngine::addImportPath() actually prepends the given path.*/
41+void appendImportPaths(QQmlEngine *engine, const QStringList &paths)
42+{
43+ QStringList importPathList = engine->importPathList();
44+ Q_FOREACH(const QString& path, paths) {
45+ // don't duplicate
46+ QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
47+ if (iter == importPathList.end()) {
48+ importPathList.append(path);
49+ }
50+ }
51+ engine->setImportPathList(importPathList);
52+}
53+
54+IndicatorsClient::IndicatorsClient(int &argc, char **argv)
55+ : QObject(0),
56+ m_view(0)
57+{
58+ m_application = new QApplication(argc, argv);
59+ QStringList args = m_application->arguments();
60+
61+ m_view = new QQuickView;
62+ m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
63+ prependImportPaths(m_view->engine(), ::overrideImportPaths());
64+ appendImportPaths(m_view->engine(), ::fallbackImportPaths());
65+
66+ m_view->setSource(QUrl("IndicatorsClient.qml"));
67+ m_view->setResizeMode(QQuickView::SizeRootObjectToView);
68+
69+ if (args.contains(QLatin1String("-geometry")) && args.size() > args.indexOf(QLatin1String("-geometry")) + 1) {
70+ QStringList geometryArg = args.at(args.indexOf(QLatin1String("-geometry")) + 1).split('x');
71+ if (geometryArg.size() == 2) {
72+ m_view->resize(geometryArg.at(0).toInt(), geometryArg.at(1).toInt());
73+ }
74+ }
75+ else {
76+ //Usable size on desktop
77+ m_view->setMinimumSize(QSize(480, 720));
78+ }
79+}
80+
81+IndicatorsClient::~IndicatorsClient()
82+{
83+ if (m_view != 0) {
84+ delete m_view;
85+ }
86+
87+ delete m_application;
88+}
89+
90+void IndicatorsClient::setupUI()
91+{
92+
93+}
94+
95+int IndicatorsClient::run()
96+{
97+ m_view->show();
98+ return m_application->exec();
99+}
src/Panel/Indicators/client/indicatorsclient.hnew file+45
@@ -0,0 +1,45 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ * Nick Dedekind <nick.dedekind@canonical.com>
19+ */
20+
21+#ifndef INDICATORS_CLIENT_H
22+#define INDICATORS_CLIENT_H
23+
24+#include <QApplication>
25+#include <QQuickView>
26+
27+class PluginManager;
28+
29+class IndicatorsClient : public QObject
30+{
31+ Q_OBJECT
32+public:
33+ IndicatorsClient(int &argc, char **argv);
34+ ~IndicatorsClient();
35+
36+ int run();
37+
38+private:
39+ QApplication *m_application;
40+ QQuickView *m_view;
41+
42+ void setupUI();
43+};
44+
45+#endif
src/Panel/Indicators/client/main.cppnew file+26
@@ -0,0 +1,26 @@
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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+#include "indicatorsclient.h"
21+
22+int main(int argc, char** argv)
23+{
24+ IndicatorsClient client(argc, argv);
25+ return client.run();
26+}
src/Panel/Indicators/servicefiles/CMakeLists.txtnew file+18
@@ -0,0 +1,18 @@
1+file(GLOB INDICATOR_SERVICE_FILES
2+ ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.indicator.battery
3+ ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.indicator.messages
4+ ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.indicator.time
5+ ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.settings.network
6+ ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.settings.sound
7+)
8+
9+# copy indicators files into build directory for shadow builds
10+add_custom_target(IndicatorsServiceFiles ALL
11+ COMMAND mkdir -p ${CMAKE_BINARY_DIR}/share/unity/indicators
12+ COMMAND cp ${INDICATOR_SERVICE_FILES} ${CMAKE_BINARY_DIR}/share/unity/indicators
13+ DEPENDS ${INDICATOR_SERVICE_FILES}
14+)
15+
16+install(FILES ${INDICATOR_SERVICE_FILES}
17+ DESTINATION ${SHELL_APP_DIR}/unity/indicators
18+)
src/Panel/Indicators/servicefiles/com.canonical.indicator.batterynew file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-battery
3+ObjectPath=/com/canonical/indicator/battery
4+
5+[phone]
6+ObjectPath=/com/canonical/indicator/battery/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/indicator/battery/phone
src/Panel/Indicators/servicefiles/com.canonical.indicator.messagesnew file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-messaging
3+ObjectPath=/com/canonical/indicator/messages
4+
5+[phone]
6+ObjectPath=/com/canonical/indicator/messages/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/indicator/messages/menu
src/Panel/Indicators/servicefiles/com.canonical.indicator.timenew file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-time
3+ObjectPath=/com/canonical/indicator/time
4+
5+[phone]
6+ObjectPath=/com/canonical/indicator/time/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/indicator/time/desktop
src/Panel/Indicators/servicefiles/com.canonical.settings.networknew file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-network
3+ObjectPath=/com/canonical/settings/network
4+
5+[phone]
6+ObjectPath=/com/canonical/settings/network/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/settings/network/desktop
src/Panel/Indicators/servicefiles/com.canonical.settings.soundnew file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-sound
3+ObjectPath=/com/canonical/settings/sound
4+
5+[phone]
6+ObjectPath=/com/canonical/settings/sound/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/settings/sound/desktop
tests/autopilot/unity8/indicators_client/__init__.pynew file+8
@@ -0,0 +1,8 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
7+
8+"""unity8 indicators-client autopilot tests and emulators - sub level package."""
tests/autopilot/unity8/indicators_client/emulators/__init__.pynew file+31
@@ -0,0 +1,31 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
7+
8+from autopilot.introspection.dbus import DBusIntrospectionObject
9+from autopilot.input import Mouse, Touch, Pointer
10+from autopilot.platform import model
11+
12+from time import sleep
13+
14+from autopilot.introspection.dbus import IntrospectableObjectMetaclass
15+
16+class IndicatorsIntrospectionObject(DBusIntrospectionObject):
17+
18+ """A common class that provides introspection and other helpers to indictors."""
19+
20+ if model() == 'Desktop':
21+ scenarios = [
22+ ('with mouse', dict(input_device_class=Mouse)),
23+ ]
24+ else:
25+ scenarios = [
26+ ('with touch', dict(input_device_class=Touch)),
27+ ]
28+
29+ def setUp(self):
30+ self.pointing_device = Pointer(self.input_device_class.create())
31+ super(IndicatorsTestCase, self).setUp()
tests/autopilot/unity8/indicators_client/emulators/common.pynew file+14
@@ -0,0 +1,14 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
7+
8+from indicators_client.emulators import IndicatorsIntrospectionObject
9+
10+class SwitchMenu(IndicatorsIntrospectionObject):
11+ """A switch menu control."""
12+
13+class Switch(IndicatorsIntrospectionObject):
14+ """A switch control."""
tests/autopilot/unity8/indicators_client/emulators/main_window.pynew file+27
@@ -0,0 +1,27 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
7+
8+class MainWindow(object):
9+ """An emulator class that makes it easy to interact with the shell"""
10+
11+ def __init__(self, app):
12+ self.app = app
13+
14+ def get_qml_view(self):
15+ """Get the main QML view"""
16+ return self.app.select_single("QQuickView")
17+
18+ def get_indicators_client(self):
19+ return self.app.select_single("IndicatorsClient")
20+
21+ def get_page_stack(self):
22+ """Get the page stack"""
23+ return self.app.select_single("PageStack")
24+
25+ def get_battery_menu(self):
26+ """Get the battery menu from the list"""
27+ return self.app.select_single("BasicMenuItem", objectName="indicator-battery");
tests/autopilot/unity8/indicators_client/tests/__init__.pynew file+87
@@ -0,0 +1,87 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
7+
8+"""qml-phone-shell autopilot tests."""
9+
10+import os.path
11+
12+from autopilot.input import Mouse, Touch, Pointer
13+from autopilot.testcase import AutopilotTestCase
14+from autopilot.matchers import Eventually
15+from autopilot.platform import model
16+from testtools.matchers import Equals
17+
18+from unity8.indicators_client.emulators.main_window import MainWindow
19+from logging import getLogger
20+import sys
21+from time import sleep
22+
23+log = getLogger(__name__)
24+
25+class FormFactors(object):
26+ Phone, Tablet, Desktop = range(3)
27+
28+class IndicatorsTestCase(AutopilotTestCase):
29+
30+ """A common test case class that provides several useful methods for indicator tests."""
31+
32+ if model() == 'Desktop':
33+ scenarios = [
34+ ('with mouse', dict(input_device_class=Mouse)),
35+ ]
36+ else:
37+ scenarios = [
38+ ('with touch', dict(input_device_class=Touch)),
39+ ]
40+
41+ def setUp(self, geometry, grid_size):
42+ self.pointing_device = Pointer(self.input_device_class.create())
43+ super(IndicatorsTestCase, self).setUp()
44+ if grid_size != "0":
45+ os.environ['GRID_UNIT_PX'] = grid_size
46+ self.grid_size = int(grid_size)
47+ else:
48+ self.grid_size = int(os.environ['GRID_UNIT_PX'])
49+
50+ if os.path.realpath(__file__).startswith("/usr/"):
51+ self.launch_test_installed(geometry)
52+ else:
53+ self.launch_test_local(geometry)
54+
55+ def launch_test_local(self, geometry):
56+ if geometry != "0x0":
57+ self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
58+ "-geometry", geometry, app_type='qt')
59+ else:
60+ self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
61+ app_type='qt')
62+
63+ def launch_test_installed(self, geometry):
64+ if geometry != "0x0":
65+ self.app = self.launch_test_application("indicators-client", "-geometry", geometry, app_type='qt')
66+ else:
67+ self.app = self.launch_test_application("indicators-client", app_type='qt')
68+
69+ def skipWrapper(*args, **kwargs):
70+ pass
71+
72+ def form_factor(self):
73+ return FormFactors.Desktop
74+
75+ def __getattribute__(self, attr_name):
76+ attr = object.__getattribute__(self, attr_name);
77+ if attr_name.startswith("test_"):
78+ try:
79+ if self.form_factor() in attr.blacklist:
80+ return self.skipWrapper
81+ except:
82+ pass
83+ return attr
84+
85+ @property
86+ def main_window(self):
87+ return MainWindow(self.app)
tests/autopilot/unity8/indicators_client/tests/test_battery.pynew file+99
@@ -0,0 +1,99 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
7+
8+"""Add tests here if you want to ensure the behaviour of the power indicator menus are correct"""
9+
10+from testtools.matchers import Equals, NotEquals
11+from autopilot.matchers import Eventually
12+
13+from unity8.indicators_client.tests import IndicatorsTestCase
14+from time import sleep
15+import random
16+import math
17+
18+class TestDisplayMenus(IndicatorsTestCase):
19+ def setUp(self):
20+ super(TestDisplayMenus, self).setUp("400x800", "12")
21+
22+ # This opens the messaging menu so you don't have to do that in
23+ # every test case
24+ self.assertThat(lambda: self.main_window.get_battery_menu(), Eventually(NotEquals(None)));
25+ self.pointing_device.move_to_object(self.main_window.get_battery_menu())
26+ self.pointing_device.click()
27+
28+ fn_loader = lambda: self.app.select_single("IndicatorsPage/QQuickLoader", objectName="page_loader");
29+ self.assertThat(fn_loader, Eventually(NotEquals(None)));
30+ page_loader = fn_loader();
31+ self.assertThat(page_loader.progress, Eventually(Equals(1.0)))
32+
33+ def tearDown(self):
34+ # self.main_window.get_indicators_client().reset()
35+ super(TestDisplayMenus, self).tearDown()
36+
37+ # START SECTION
38+ # We need to move these to emulators once autopilot supports emulators for
39+ # applications started with AutopilotTestCase.launch_test_application
40+
41+ def switch_auto_brightness(self, auto_brightness):
42+ ab_switch = auto_brightness.select_single("CheckBox");
43+ self.assertThat(ab_switch, NotEquals(None))
44+
45+ self.pointing_device.move_to_object(ab_switch)
46+ self.pointing_device.click()
47+
48+ def set_brightness_to_value(self, brightness_menu, new_value):
49+ brightness_slider = brightness_menu.select_single("Slider");
50+ self.assertThat(brightness_slider, NotEquals(None))
51+
52+ self.pointing_device.move_to_object(brightness_slider)
53+
54+ old_ab_value = brightness_slider.value
55+ pixel_ratio = brightness_slider.width / (brightness_slider.maximumValue - brightness_slider.minimumValue)
56+
57+ while True:
58+
59+ pixels_to_move = int(pixel_ratio * (new_value - old_ab_value) / 15)
60+ if pixels_to_move == 0:
61+ break;
62+
63+ self.pointing_device.drag(self.pointing_device.x, self.pointing_device.y, self.pointing_device.x + pixels_to_move, self.pointing_device.y)
64+
65+ old_ab_value = brightness_slider.value
66+
67+ def test_auto_bright_switch(self):
68+ """Test the auto-bright switch"""
69+
70+ # wait for the switch menu item
71+ fn_auto_brightness = lambda: self.app.select_single("SwitchMenuItem", objectName="auto-brightness");
72+ self.assertThat(fn_auto_brightness, Eventually(NotEquals(None)));
73+ auto_brightness = fn_auto_brightness();
74+
75+ old_ab_value = auto_brightness.checked
76+
77+ self.switch_auto_brightness(auto_brightness)
78+
79+ # TODO - should check backend when it's introspectable.
80+ self.assertThat(auto_brightness.checked, Eventually(NotEquals(old_ab_value)))
81+
82+ def test_brightness_slider(self):
83+ """Test the auto-bright switch"""
84+
85+ fn_brightness_menu = lambda: self.app.select_single("SliderMenuItem", objectName="brightness");
86+ self.assertThat(fn_brightness_menu, Eventually(NotEquals(None)));
87+ brightness_menu = fn_brightness_menu();
88+
89+ old_ab_value = brightness_menu.value
90+ # find a new value to do to. At least 1/4 distance away from current value
91+ while True:
92+ desired_value = random.uniform(brightness_menu.minimumValue, brightness_menu.maximumValue)
93+ if (abs(desired_value - old_ab_value) >= (brightness_menu.maximumValue - brightness_menu.minimumValue)/4):
94+ break;
95+
96+ self.set_brightness_to_value(brightness_menu, desired_value)
97+
98+ # TODO - should check backend when it's introspectable.
99+ self.assertThat(brightness_menu.value, Eventually(NotEquals(old_ab_value)))
tests/autopilot/unity8/shell/__init__.pynew file+8
@@ -0,0 +1,8 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+# Copyright 2013 Canonical
3+#
4+# This program is free software: you can redistribute it and/or modify it
5+# under the terms of the GNU General Public License version 3, as published
6+# by the Free Software Foundation.
7+
8+"""unity8 shell autopilot tests and emulators - sub level package."""
tests/autopilot/unity8/emulators/__init__.py → tests/autopilot/unity8/shell/emulators/__init__.pyrenamed

The content is the same.

tests/autopilot/unity8/emulators/main_window.py → tests/autopilot/unity8/shell/emulators/main_window.pyrenamed

The content is the same.

tests/autopilot/unity8/tests/__init__.py → tests/autopilot/unity8/shell/tests/__init__.pyrenamed+1−1
@@ -15,7 +15,7 @@ from autopilot.matchers import Eventually
1515from autopilot.platform import model
1616from testtools.matchers import Equals
1717
18−from unity8.emulators.main_window import MainWindow
18+from unity8.shell.emulators.main_window import MainWindow
1919
2020class FormFactors(object):
2121 Phone, Tablet, Desktop = range(3)
tests/autopilot/unity8/tests/helpers.py → tests/autopilot/unity8/shell/tests/helpers.pyrenamed

The content is the same.

tests/autopilot/unity8/tests/testbigscreen.py → tests/autopilot/unity8/shell/tests/testbigscreen.pyrenamed+1−1
@@ -10,7 +10,7 @@
1010from testtools.matchers import Equals
1111from autopilot.matchers import Eventually
1212
13−from unity8.tests import ShellTestCase
13+from unity8.shell.tests import ShellTestCase
1414
1515class TestBig(ShellTestCase):
1616 def setUp(self):
tests/autopilot/unity8/tests/testhud.py → tests/autopilot/unity8/shell/tests/testhud.pyrenamed+2−2
@@ -25,8 +25,8 @@
2525
2626from __future__ import absolute_import
2727
28−from unity8.tests import ShellTestCase, FormFactors
29−from unity8.tests.helpers import TestShellHelpers
28+from unity8.shell.tests import ShellTestCase, FormFactors
29+from unity8.shell.tests.helpers import TestShellHelpers
3030
3131from autopilot.input import Mouse, Touch, Pointer
3232from testtools.matchers import Equals, NotEquals, GreaterThan, MismatchError
tests/autopilot/unity8/tests/testlockscreen.py → tests/autopilot/unity8/shell/tests/testlockscreen.pyrenamed+2−2
@@ -25,8 +25,8 @@
2525
2626from __future__ import absolute_import
2727
28−from unity8.tests import ShellTestCase, FormFactors
29−from unity8.tests.helpers import TestShellHelpers
28+from unity8.shell.tests import ShellTestCase, FormFactors
29+from unity8.shell.tests.helpers import TestShellHelpers
3030
3131from autopilot.input import Mouse, Touch, Pointer
3232from testtools.matchers import Equals, NotEquals, GreaterThan, MismatchError
tests/data/unity/indicators/com.canonical.indicator.fake1new file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-fake1
3+ObjectPath=/com/canonical/indicator/fake1
4+
5+[phone]
6+ObjectPath=/com/canonical/indicator/fake1/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/indicator/fake1/desktop
tests/data/unity/indicators/com.canonical.indicator.fake2new file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-fake2
3+ObjectPath=/com/canonical/indicator/fake2
4+
5+[phone]
6+ObjectPath=/com/canonical/indicator/fake2/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/indicator/fake2/desktop
tests/data/unity/indicators/com.canonical.indicator.fake3new file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-fake3
3+ObjectPath=/com/canonical/indicator/fake3
4+
5+[phone]
6+ObjectPath=/com/canonical/indicator/fake3/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/indicator/fake3/desktop
tests/data/unity/indicators/com.canonical.indicator.fake4new file+9
@@ -0,0 +1,9 @@
1+[Indicator Service]
2+Name=indicator-fake4
3+ObjectPath=/com/canonical/indicator/fake4
4+
5+[phone]
6+ObjectPath=/com/canonical/indicator/fake4/phone
7+
8+[desktop]
9+ObjectPath=/com/canonical/indicator/fake4/desktop
tests/mocks/LightDM/demo/InfographicModelPrivate.cpp+3−3
@@ -54,7 +54,7 @@ void InfographicModelPrivate::generateFakeData()
5454 QSharedPointer<InfographicData> data(
5555 new InfographicData("<b>52km</b> travelled", yellowTheme, firstMonth,
5656 orangeTheme, secondMonth, this));
57− m_fakeData.insert("guest", data);
57+ m_fakeData.insert("phablet", data);
5858 }
5959
6060 {
@@ -69,7 +69,7 @@ void InfographicModelPrivate::generateFakeData()
6969 QSharedPointer<InfographicData> data(
7070 new InfographicData("<b>33</b> messages today", pinkTheme,
7171 firstMonth, orangeTheme, secondMonth, this));
72− m_fakeData.insert("guest", data);
72+ m_fakeData.insert("phablet", data);
7373 }
7474
7575 {
@@ -84,7 +84,7 @@ void InfographicModelPrivate::generateFakeData()
8484 QSharedPointer<InfographicData> data(
8585 new InfographicData("<b>69</b> minutes talk time", darkPurpleTheme,
8686 firstMonth, redTheme, secondMonth, this));
87− m_fakeData.insert("guest", data);
87+ m_fakeData.insert("phablet", data);
8888 }
8989}
9090
tests/mocks/LightDM/demo/UsersModelPrivate.cpp+1−1
@@ -26,7 +26,7 @@ UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
2626{
2727 entries =
2828 {
29− { "single", "Guest", 0, 0, false, false, 0, 0 },
29+ { "phablet", "Guest", 0, 0, false, false, 0, 0 },
3030 };
3131}
3232
tests/mocks/Ubuntu/CMakeLists.txt−1
@@ -1,2 +1 @@
11add_subdirectory(Application)
2−add_subdirectory(ChewieUI)
tests/mocks/Ubuntu/ChewieUI/CMakeLists.txtdeleted−33
@@ -1,33 +0,0 @@
1−set(CMAKE_AUTOMOC ON)
2−
3−include(FindPkgConfig)
4−find_package(Qt5Core REQUIRED)
5−find_package(Qt5Quick REQUIRED)
6−
7−set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wextra -std=c++11")
8−
9−include_directories(
10− ${CMAKE_CURRENT_BINARY_DIR}
11− ${Qt5Core_INCLUDE_DIRS}
12− ${Qt5Quick_INCLUDE_DIRS}
13−)
14−
15−add_definitions(-DQT_NO_KEYWORDS)
16−
17−set(ChewieUIQML_SOURCES
18− fake_chewie_plugin.cpp
19− fake_pluginmodel.cpp
20−)
21−
22−add_library(FakeChewieUIQml MODULE ${ChewieUIQML_SOURCES})
23−target_link_libraries(FakeChewieUIQml
24− ${Qt5Core_LIBRARIES}
25− ${Qt5Quick_LIBRARIES}
26−)
27−
28−qt5_use_modules(FakeChewieUIQml Qml)
29−
30−# copy qmldir file into build directory for shadow builds
31−file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
32− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
33− )
tests/mocks/Ubuntu/ChewieUI/fake_pluginmodel.cppdeleted−206
@@ -1,206 +0,0 @@
1−/*
2− * Copyright 2012 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− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−#include "fake_pluginmodel.h"
21−#include "paths.h"
22−
23−#include <QQmlContext>
24−#include <QQmlEngine>
25−#include <QDebug>
26−#include <QQmlComponent>
27−
28−struct Indicator {
29− Indicator(QString const& title, QString iconSource, QString label, QString description, QString componentSource)
30− : title(title)
31− , iconSource(iconSource)
32− , label(label)
33− , description(description)
34− , componentSource(componentSource)
35− , isValid(true)
36− {}
37−
38− QString title;
39− QString iconSource;
40− QString label;
41− QString description;
42− QString componentSource;
43− QMap<QString, QVariant> initialProperties;
44− bool isValid;
45−};
46−
47−const QList<Indicator> indicator_list = QList<Indicator>()
48− << Indicator("Menu1", sourceDirectory()+"Panel/graphics/Battery@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin1.qml")
49− << Indicator("Menu2", sourceDirectory()+"Panel/graphics/Bluetooth@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin2.qml")
50− << Indicator("Menu3", sourceDirectory()+"Panel/graphics/Clock@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin3.qml")
51− << Indicator("Menu4", sourceDirectory()+"Panel/graphics/Location@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin4.qml")
52− << Indicator("Menu5", sourceDirectory()+"Panel/graphics/Network@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin5.qml");
53−
54−
55−PluginModel::PluginModel(QObject *parent)
56− : QAbstractListModel(parent)
57−{
58− m_widgetsMap = new WidgetsMap;
59−
60− QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
61− QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
62− QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
63−}
64−
65−/*! \internal */
66−PluginModel::~PluginModel()
67−{
68− delete m_widgetsMap;
69−}
70−
71−/*!
72− \qmlmethod PluginModel::get(int)
73−
74− Returns the item at index in the model. This allows the item data to be accessed from JavaScript:
75− \b Note: methods should only be called after the Component has completed.
76−*/
77−QVariantMap PluginModel::get(int row) const
78−{
79− QVariantMap result;
80−
81− QModelIndex index = this->index(row);
82− if (index.isValid()) {
83− QMap<int, QVariant> data = itemData(index);
84− const QHash<int, QByteArray> roleNames = this->roleNames();
85− Q_FOREACH(int i, roleNames.keys()) {
86− result.insert(roleNames[i], data[i]);
87− }
88− }
89− return result;
90−}
91−
92−/*!
93− \qmlproperty PluginModel::count
94− The number of data entries in the model.
95−
96− \b Note: methods should only be called after the Component has completed.
97−*/
98−int PluginModel::count() const
99−{
100− return rowCount();
101−}
102−
103−/*!
104− \qmlproperty WidgetsMap PluginModel::widgetsMap
105− This property holds the map for all new widgets registered by dynamically loaded plugins.
106−*/
107−WidgetsMap* PluginModel::widgetsMap() const
108−{
109− return m_widgetsMap;
110−}
111−
112−/*!
113− \qmlmethod PluginModel::load()
114−
115− Load all plugin information available on baseDir.
116−*/
117−void PluginModel::load()
118−{
119−
120−}
121−
122−/*!
123− \qmlmethod PluginModel::unload()
124−
125− Unload all plugins.
126−*/
127−void PluginModel::unload()
128−{
129− m_widgetsMap->clear();
130−}
131−
132−/*! \internal */
133−QHash<int, QByteArray> PluginModel::roleNames() const
134−{
135− static QHash<int, QByteArray> roles;
136− if (roles.isEmpty()) {
137− roles[Title] = "title";
138− roles[IconSource] = "iconSource";
139− roles[Label] = "label";
140− roles[Description] = "description";
141− roles[QMLComponent] = "component";
142− roles[InitialProperties] = "initialProperties";
143− roles[IsValid] = "isValid";
144− }
145− return roles;
146−}
147−
148−/*! \internal */
149−int PluginModel::columnCount(const QModelIndex &) const
150−{
151− return 1;
152−}
153−
154−/*! \internal */
155−QVariant PluginModel::data(const QModelIndex &index, int role) const
156−{
157− QVariant attribute;
158−
159− if ((index.row() >= 0) && (index.row() < indicator_list.size())) {
160− Indicator indicator = (indicator_list[index.row()]);
161−
162− switch (role) {
163− case Title:
164− attribute = indicator.title;
165− break;
166− case IconSource:
167− attribute = indicator.iconSource;
168− break;
169− case Label:
170− attribute = indicator.label;
171− break;
172− case Description:
173− attribute = indicator.description;
174− break;
175− case QMLComponent:
176− {
177− QQmlContext *context = QQmlEngine::contextForObject(this);
178− if (context) {
179− QQmlComponent* component = new QQmlComponent(context->parentContext()->engine(), QUrl(indicator.componentSource), NULL);
180− attribute = QVariant::fromValue<QQmlComponent*>(component);
181− }
182− } break;
183− case InitialProperties:
184− attribute = indicator.initialProperties;
185− break;
186− case IsValid:
187− attribute = indicator.isValid;
188− break;
189− default:
190− break;
191− }
192− }
193− return attribute;
194−}
195−
196−/*! \internal */
197−QModelIndex PluginModel::parent(const QModelIndex&) const
198−{
199− return QModelIndex();
200−}
201−
202−/*! \internal */
203−int PluginModel::rowCount(const QModelIndex &) const
204−{
205− return indicator_list.size();
206−}
tests/mocks/Ubuntu/ChewieUI/qmldirdeleted−1
@@ -1 +0,0 @@
1−plugin FakeChewieUIQml
tests/mocks/Unity/CMakeLists.txt+4−1
@@ -1,5 +1,7 @@
11set(CMAKE_AUTOMOC ON)
22
3+add_subdirectory(Indicators)
4+
35include(FindPkgConfig)
46find_package(Qt5Core REQUIRED)
57find_package(Qt5Quick REQUIRED)
@@ -24,7 +26,6 @@ set(UnityQML_SOURCES
2426 fake_scopes.cpp
2527 fake_categories.cpp
2628 fake_unity_plugin.cpp
27− fake_launchermodel.cpp
2829)
2930
3031add_library(FakeUnityQml MODULE ${UnityQML_SOURCES})
@@ -41,3 +42,5 @@ qt5_use_modules(FakeUnityQml Qml)
4142file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
4243 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
4344 )
45+
46+add_subdirectory(Launcher)
tests/mocks/Unity/Indicators/CMakeLists.txtnew file+52
@@ -0,0 +1,52 @@
1+project(IndicatorsFakeQml)
2+
3+find_package(Qt5Core REQUIRED)
4+find_package(Qt5Quick REQUIRED)
5+
6+include_directories(
7+ ${CMAKE_CURRENT_SOURCE_DIR}
8+ ${CMAKE_CURRENT_BINARY_DIR}
9+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators
10+)
11+
12+set(IndicatorsFakeQml_SOURCES
13+ fakeplugin.cpp
14+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/indicators.h
15+)
16+
17+set(IndicatorsFakeQml_RESOURCES
18+ indicators_fake.qrc
19+)
20+
21+qt5_add_resources(IndicatorsFakeQml_RESOURCES_RCC
22+ ${IndicatorsFakeQml_RESOURCES}
23+)
24+
25+add_library(IndicatorsFakeQml SHARED
26+ ${IndicatorsFakeQml_RESOURCES_RCC}
27+ ${IndicatorsFakeQml_SOURCES}
28+)
29+# Because this is an internal support library, we want
30+# to expose all symbols in it. Consider changing this
31+# either to a static library or just using the
32+# files directly in targets.
33+set_target_properties(IndicatorsFakeQml PROPERTIES COMPILE_FLAGS -fvisibility=default)
34+
35+target_link_libraries(IndicatorsFakeQml)
36+
37+qt5_use_modules(IndicatorsFakeQml Core Qml Quick)
38+
39+file(GLOB IndicatorsFake_QMLFILES
40+ IndicatorsModel.qml
41+ qml/FakeMenuPage.qml
42+)
43+
44+# copy qmldir file into build directory for shadow builds
45+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
46+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
47+)
48+
49+# copy qmldir file into build directory for shadow builds
50+file(COPY ${IndicatorsFake_QMLFILES}
51+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
52+)
tests/mocks/Unity/Indicators/IndicatorsModel.qmlnew file+104
@@ -0,0 +1,104 @@
1+/*
2+ * Copyright (C) 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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Unity.Indicators 0.1 as Indicators
19+
20+ListModel {
21+
22+ property var indicatorData : undefined
23+
24+ function load() {}
25+
26+ ListElement {
27+ identifier: "indicator-fake1";
28+ priority: 0
29+ title: "Menu1";
30+ description: "";
31+ widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget1.qml";
32+ pageSource: "qrc:/tests/indciators/qml/fake_menu_page1.qml";
33+ indicatorProperties: "";
34+ isValid: "";
35+ }
36+ ListElement {
37+ identifier: "indicator-fake2";
38+ priority: 1
39+ title: "Menu2";
40+ description: "";
41+ widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget2.qml";
42+ pageSource: "qrc:/tests/indciators/qml/fake_menu_page2.qml";
43+ indicatorProperties: "";
44+ isValid: "";
45+ }
46+ ListElement {
47+ identifier: "indicator-fake3";
48+ priority: 2
49+ title: "Menu3";
50+ description: "";
51+ widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget3.qml";
52+ pageSource: "qrc:/tests/indciators/qml/fake_menu_page3.qml";
53+ indicatorProperties: "";
54+ isValid: "";
55+ }
56+ ListElement {
57+ identifier: "indicator-fake4";
58+ priority: 3
59+ title: "Menu4";
60+ description: "";
61+ widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget4.qml";
62+ pageSource: "qrc:/tests/indciators/qml/fake_menu_page4.qml";
63+ indicatorProperties: "";
64+ isValid: "";
65+ }
66+ ListElement {
67+ identifier: "indicator-fake4";
68+ priority: 4
69+ title: "Menu5";
70+ description: "";
71+ widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget5.qml";
72+ pageSource: "qrc:/tests/indciators/qml/fake_menu_page5.qml";
73+ indicatorProperties: "";
74+ isValid: "";
75+ }
76+
77+ function data(row, role) {
78+ if (role == Indicators.IndicatorsModelRole.Identifier) {
79+ return get(row).identifier;
80+ }
81+ else if (role == Indicators.IndicatorsModelRole.Priority) {
82+ return get(row).priority
83+ }
84+ else if (role == Indicators.IndicatorsModelRole.Title) {
85+ return get(row).title
86+ }
87+ else if (role == Indicators.IndicatorsModelRole.Description) {
88+ return get(row).description
89+ }
90+ else if (role == Indicators.IndicatorsModelRole.WidgetSource) {
91+ return get(row).widgetSource
92+ }
93+ else if (role == Indicators.IndicatorsModelRole.PageSource) {
94+ return get(row).pageSource
95+ }
96+ else if (role == Indicators.IndicatorsModelRole.IndicatorProperties) {
97+ return get(row).indicatorProperties
98+ }
99+ else if (role == Indicators.IndicatorsModelRole.IsValid) {
100+ return get(row).isValid
101+ }
102+ }
103+
104+}
tests/mocks/Unity/Indicators/fakeplugin.cppnew file+37
@@ -0,0 +1,37 @@
1+/*
2+ * Copyright (C) 2012 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Michał Sawicz <michal.sawicz@canonical.com>
17+ */
18+
19+// Qt
20+#include <QtQml>
21+
22+// self
23+#include "fakeplugin.h"
24+
25+// local
26+#include "indicators.h"
27+
28+void IndicatorsFakePlugin::registerTypes(const char * uri)
29+{
30+ Q_INIT_RESOURCE(indicators_fake);
31+
32+ qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", "Can't create ActionState class");
33+ qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", "Can't create NetworkActionState class");
34+ qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", "Can't create NetworkConnection class");
35+ qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", "Can't create IndicatorsModelRole class");
36+ qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", "Can't create FlatMenuProxyModelRole class");
37+}
tests/mocks/Unity/Indicators/fakeplugin.hnew file+32
@@ -0,0 +1,32 @@
1+/*
2+ * Copyright (C) 2012 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+#ifndef INDICATORS_FAKE_PLUGIN_H
20+#define INDICATORS_FAKE_PLUGIN_H
21+
22+#include <QtQml/QQmlExtensionPlugin>
23+
24+class IndicatorsFakePlugin : public QQmlExtensionPlugin
25+{
26+ Q_OBJECT
27+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28+public:
29+ void registerTypes(const char *uri);
30+};
31+
32+#endif // INDICATORS_FAKE_PLUGIN_H
tests/mocks/Unity/Indicators/indicators_fake.qrcnew file+14
@@ -0,0 +1,14 @@
1+<RCC>
2+ <qresource prefix="/tests/indciators">
3+ <file>qml/fake_menu_widget1.qml</file>
4+ <file>qml/fake_menu_widget2.qml</file>
5+ <file>qml/fake_menu_widget3.qml</file>
6+ <file>qml/fake_menu_widget4.qml</file>
7+ <file>qml/fake_menu_widget5.qml</file>
8+ <file>qml/fake_menu_page1.qml</file>
9+ <file>qml/fake_menu_page2.qml</file>
10+ <file>qml/fake_menu_page3.qml</file>
11+ <file>qml/fake_menu_page4.qml</file>
12+ <file>qml/fake_menu_page5.qml</file>
13+ </qresource>
14+</RCC>
tests/qmltests/Panel/qml/FakeMenuPlugin.qml → tests/mocks/Unity/Indicators/qml/FakeMenuPage.qmlrenamed

The content is the same.

tests/qmltests/Panel/qml/fake_menu_plugin1.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page1.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import Unity.Indicators 0.1 as Indicators
1819
19−FakeMenuPlugin {
20+Indicators.FakeMenuPage {
2021 id: menu_plugin1
21− objectName: "menu_plugin1"
22+ objectName: "menu_page1"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin2.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page2.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import Unity.Indicators 0.1 as Indicators
1819
19−FakeMenuPlugin {
20+Indicators.FakeMenuPage {
2021 id: menu_plugin2
21− objectName: "menu_plugin2"
22+ objectName: "menu_page2"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin3.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page3.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import Unity.Indicators 0.1 as Indicators
1819
19−FakeMenuPlugin {
20+Indicators.FakeMenuPage {
2021 id: menu_plugin3
21− objectName: "menu_plugin3"
22+ objectName: "menu_page3"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin4.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page4.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import Unity.Indicators 0.1 as Indicators
1819
19−FakeMenuPlugin {
20+Indicators.FakeMenuPage {
2021 id: menu_plugin4
21− objectName: "menu_plugin4"
22+ objectName: "menu_page4"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin5.qml → tests/mocks/Unity/Indicators/qml/fake_menu_page5.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import Unity.Indicators 0.1 as Indicators
1819
19−FakeMenuPlugin {
20+Indicators.FakeMenuPage {
2021 id: menu_plugin5
21− objectName: "menu_plugin5"
22+ objectName: "menu_page5"
2223
2324 Rectangle {
2425 id: contents
tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qmlnew file+23
@@ -0,0 +1,23 @@
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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+Rectangle {
20+ width: 40
21+ height: 40
22+ color : "red"
23+}
tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qmlnew file+23
@@ -0,0 +1,23 @@
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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+Rectangle {
20+ width: 40
21+ height: 40
22+ color : "yellow"
23+}
tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qmlnew file+23
@@ -0,0 +1,23 @@
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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+Rectangle {
20+ width: 40
21+ height: 40
22+ color : "blue"
23+}
tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qmlnew file+23
@@ -0,0 +1,23 @@
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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+Rectangle {
20+ width: 40
21+ height: 40
22+ color : "green"
23+}
tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qmlnew file+23
@@ -0,0 +1,23 @@
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 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 General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+Rectangle {
20+ width: 40
21+ height: 40
22+ color : "orange"
23+}
tests/mocks/Unity/Indicators/qmldirnew file+5
@@ -0,0 +1,5 @@
1+module Unity.Indicators
2+plugin IndicatorsFakeQml
3+
4+IndicatorsModel 0.1 IndicatorsModel.qml
5+FakeMenuPage 0.1 FakeMenuPage.qml
tests/mocks/Unity/Launcher/CMakeLists.txtnew file+26
@@ -0,0 +1,26 @@
1+include(FindPkgConfig)
2+pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=2)
3+
4+include_directories(
5+ ${CMAKE_CURRENT_SOURCE_DIR}
6+)
7+
8+set(MockLauncherModel_SOURCES
9+ ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherItemInterface.h
10+ ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherModelInterface.h
11+ ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/QuickListModelInterface.h
12+ plugin.cpp
13+ MockLauncherModel.cpp
14+ MockLauncherItem.cpp
15+ MockQuickListModel.cpp
16+)
17+
18+add_library(MockLauncherPlugin MODULE ${MockLauncherModel_SOURCES})
19+
20+qt5_use_modules(MockLauncherPlugin Core Quick)
21+
22+# copy files into build directory for shadow builds
23+add_custom_target(LauncherPluginQmlDirFile ALL
24+ COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" ${CMAKE_CURRENT_BINARY_DIR}
25+ DEPENDS qmldir
26+)
tests/mocks/Unity/Launcher/MockLauncherItem.cppnew file+134
@@ -0,0 +1,134 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "MockLauncherItem.h"
21+#include "MockQuickListModel.h"
22+
23+using namespace unity::shell::launcher;
24+
25+MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent):
26+ LauncherItemInterface(parent),
27+ m_appId(appId),
28+ m_desktopFile(desktopFile),
29+ m_name(name),
30+ m_icon(icon),
31+ m_pinned(false),
32+ m_running(false),
33+ m_recent(false),
34+ m_progress(8),
35+ m_count(8),
36+ m_quickList(new MockQuickListModel(this))
37+{
38+
39+}
40+
41+QString MockLauncherItem::appId() const
42+{
43+ return m_appId;
44+}
45+
46+QString MockLauncherItem::desktopFile() const
47+{
48+ return m_desktopFile;
49+}
50+
51+QString MockLauncherItem::name() const
52+{
53+ return m_name;
54+}
55+
56+QString MockLauncherItem::icon() const
57+{
58+ return m_icon;
59+}
60+
61+bool MockLauncherItem::pinned() const
62+{
63+ return m_pinned;
64+}
65+
66+void MockLauncherItem::setPinned(bool pinned)
67+{
68+ if (m_pinned != pinned)
69+ {
70+ m_pinned = pinned;
71+ Q_EMIT pinnedChanged(m_pinned);
72+ }
73+}
74+
75+bool MockLauncherItem::running() const
76+{
77+ return m_running;
78+}
79+
80+void MockLauncherItem::setRunning(bool running)
81+{
82+ if (m_running != running)
83+ {
84+ m_running = running;
85+ Q_EMIT runningChanged(running);
86+ }
87+}
88+
89+bool MockLauncherItem::recent() const
90+{
91+ return m_recent;
92+}
93+
94+void MockLauncherItem::setRecent(bool recent)
95+{
96+ if (m_recent != recent)
97+ {
98+ m_recent = recent;
99+ Q_EMIT recentChanged(recent);
100+ }
101+}
102+
103+int MockLauncherItem::progress() const
104+{
105+ return m_progress;
106+}
107+
108+void MockLauncherItem::setProgress(int progress)
109+{
110+ if (m_progress != progress)
111+ {
112+ m_progress = progress;
113+ Q_EMIT progressChanged(progress);
114+ }
115+}
116+
117+int MockLauncherItem::count() const
118+{
119+ return m_count;
120+}
121+
122+void MockLauncherItem::setCount(int count)
123+{
124+ if (m_count != count)
125+ {
126+ m_count = count;
127+ Q_EMIT countChanged(count);
128+ }
129+}
130+
131+unity::shell::launcher::QuickListModelInterface *MockLauncherItem::quickList() const
132+{
133+ return m_quickList;
134+}
tests/mocks/Unity/Launcher/MockLauncherItem.hnew file+70
@@ -0,0 +1,70 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef MOCKLAUNCHERITEM_H
21+#define MOCKLAUNCHERITEM_H
22+
23+#include <unity/shell/launcher/LauncherItemInterface.h>
24+
25+class MockQuickListModel;
26+
27+using namespace unity::shell::launcher;
28+
29+class MockLauncherItem: public LauncherItemInterface
30+{
31+ Q_OBJECT
32+public:
33+ MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent = 0);
34+
35+ QString appId() const;
36+ QString desktopFile() const;
37+ QString name() const;
38+ QString icon() const;
39+
40+ bool pinned() const;
41+ void setPinned(bool pinned);
42+
43+ bool running() const;
44+ void setRunning(bool running);
45+
46+ bool recent() const;
47+ void setRecent(bool recent);
48+
49+ int progress() const;
50+ void setProgress(int progress);
51+
52+ int count() const;
53+ void setCount(int count);
54+
55+ unity::shell::launcher::QuickListModelInterface *quickList() const;
56+
57+private:
58+ QString m_appId;
59+ QString m_desktopFile;
60+ QString m_name;
61+ QString m_icon;
62+ bool m_pinned;
63+ bool m_running;
64+ bool m_recent;
65+ int m_progress;
66+ int m_count;
67+ MockQuickListModel *m_quickList;
68+};
69+
70+#endif // MOCKLAUNCHERITEM_H
tests/mocks/Unity/Launcher/MockLauncherModel.cppnew file+152
@@ -0,0 +1,152 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "MockLauncherModel.h"
21+#include "MockLauncherItem.h"
22+
23+MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(parent)
24+{
25+ MockLauncherItem *item = new MockLauncherItem("phone-app", "/usr/share/applications/phone-app.desktop", "Phone", "phone-app");
26+ m_list.append(item);
27+ item = new MockLauncherItem("camera-app", "/usr/share/applications/camera-app.desktop", "Camera", "camera");
28+ m_list.append(item);
29+ item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery");
30+ m_list.append(item);
31+ item = new MockLauncherItem("facebook-webapp", "/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook");
32+ m_list.append(item);
33+ item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser");
34+ m_list.append(item);
35+ item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter");
36+ m_list.append(item);
37+ item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail");
38+ m_list.append(item);
39+ item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather");
40+ m_list.append(item);
41+ item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad");
42+ m_list.append(item);
43+ item = new MockLauncherItem("ubuntu-calendar-app", "/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar");
44+ m_list.append(item);
45+}
46+
47+MockLauncherModel::~MockLauncherModel()
48+{
49+ while (!m_list.empty())
50+ {
51+ m_list.takeFirst()->deleteLater();
52+ }
53+}
54+
55+int MockLauncherModel::rowCount(const QModelIndex& parent) const
56+{
57+ Q_UNUSED(parent)
58+ return m_list.count();
59+}
60+
61+QVariant MockLauncherModel::data(const QModelIndex& index, int role) const
62+{
63+ LauncherItemInterface *item = m_list.at(index.row());
64+ switch(role)
65+ {
66+ case RoleDesktopFile:
67+ return item->desktopFile();
68+ case RoleName:
69+ return item->name();
70+ case RoleIcon:
71+ return item->icon();
72+ case RolePinned:
73+ return item->pinned();
74+ case RoleRunning:
75+ return item->running();
76+ case RoleRecent:
77+ return item->recent();
78+ case RoleProgress:
79+ return item->progress();
80+ case RoleCount:
81+ return item->count();
82+ }
83+
84+ return QVariant();
85+}
86+
87+unity::shell::launcher::LauncherItemInterface *MockLauncherModel::get(int index) const
88+{
89+ if (index < 0 || index >= m_list.count())
90+ {
91+ return 0;
92+ }
93+ return m_list.at(index);
94+}
95+
96+void MockLauncherModel::move(int oldIndex, int newIndex)
97+{
98+ beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
99+ m_list.move(oldIndex, newIndex);
100+ endMoveRows();
101+}
102+
103+void MockLauncherModel::pin(const QString &appId, int index)
104+{
105+ int currentIndex = findApp(appId);
106+
107+ if (currentIndex >= 0) {
108+ if (index == -1 || index == currentIndex) {
109+ m_list.at(currentIndex)->setPinned(true);
110+ QModelIndex modelIndex = this->index(currentIndex);
111+ Q_EMIT dataChanged(modelIndex, modelIndex);
112+ } else {
113+ move(currentIndex, index);
114+ }
115+ } else {
116+ beginInsertRows(QModelIndex(), index, index);
117+ m_list.insert(index, new MockLauncherItem(appId,
118+ appId + ".desktop",
119+ appId,
120+ appId + ".png"));
121+ m_list.at(index)->setPinned(true);
122+ endInsertRows();
123+ }
124+}
125+
126+void MockLauncherModel::requestRemove(const QString &appId)
127+{
128+ int index = findApp(appId);
129+ if (index >= 0) {
130+ beginRemoveRows(QModelIndex(), index, 0);
131+ m_list.takeAt(index)->deleteLater();
132+ endRemoveRows();
133+ }
134+}
135+
136+void MockLauncherModel::quickListActionInvoked(const QString &appId, int actionIndex)
137+{
138+ Q_UNUSED(appId)
139+ Q_UNUSED(actionIndex)
140+ // Nothing to mock yet...
141+}
142+
143+int MockLauncherModel::findApp(const QString &appId)
144+{
145+ for (int i = 0; i < m_list.count(); ++i) {
146+ MockLauncherItem *item = m_list.at(i);
147+ if (item->appId() == appId) {
148+ return i;
149+ }
150+ }
151+ return -1;
152+}
tests/mocks/Unity/Launcher/MockLauncherModel.hnew file+54
@@ -0,0 +1,54 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef MOCKLAUNCHERMODEL_H
21+#define MOCKLAUNCHERMODEL_H
22+
23+#include <unity/shell/launcher/LauncherModelInterface.h>
24+
25+class MockLauncherItem;
26+
27+using namespace unity::shell::launcher;
28+
29+class MockLauncherModel: public LauncherModelInterface
30+{
31+ Q_OBJECT
32+
33+public:
34+ MockLauncherModel(QObject* parent = 0);
35+ ~MockLauncherModel();
36+
37+ int rowCount(const QModelIndex& parent) const;
38+
39+ QVariant data(const QModelIndex& index, int role) const;
40+
41+ Q_INVOKABLE unity::shell::launcher::LauncherItemInterface *get(int index) const;
42+ Q_INVOKABLE void move(int oldIndex, int newIndex);
43+ Q_INVOKABLE void pin(const QString &appId, int index = -1);
44+ Q_INVOKABLE void requestRemove(const QString &appId);
45+ Q_INVOKABLE void quickListActionInvoked(const QString &appId, int actionIndex);
46+
47+private:
48+ int findApp(const QString &appId);
49+
50+private:
51+ QList<MockLauncherItem*> m_list;
52+};
53+
54+#endif // MOCKLAUNCHERMODEL_H
tests/mocks/Unity/Launcher/MockQuickListModel.cppnew file+46
@@ -0,0 +1,46 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include <MockQuickListModel.h>
21+
22+using namespace unity::shell::launcher;
23+
24+MockQuickListModel::MockQuickListModel(QObject *parent) :
25+ QuickListModelInterface(parent)
26+{
27+
28+}
29+
30+QVariant MockQuickListModel::data(const QModelIndex &index, int role) const
31+{
32+ switch (role)
33+ {
34+ case RoleLabel:
35+ return QLatin1String("test menu entry ") + QString::number(index.row());
36+ case RoleIcon:
37+ return QLatin1String("copy.png");
38+ }
39+ return QVariant();
40+}
41+
42+int MockQuickListModel::rowCount(const QModelIndex &parent) const
43+{
44+ Q_UNUSED(parent)
45+ return 4;
46+}
tests/mocks/Unity/Launcher/MockQuickListModel.hnew file+38
@@ -0,0 +1,38 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#ifndef MOCKQUICKLISTMODEL_H
21+#define MOCKQUICKLISTMODEL_H
22+
23+#include <unity/shell/launcher/QuickListModelInterface.h>
24+
25+using namespace unity::shell::launcher;
26+
27+class MockQuickListModel: public QuickListModelInterface
28+{
29+ Q_OBJECT
30+public:
31+ MockQuickListModel(QObject *parent = 0);
32+
33+ QVariant data(const QModelIndex &index, int role) const;
34+
35+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
36+};
37+
38+#endif // MOCKQUICKLISTMODEL_H
tests/mocks/Unity/Launcher/plugin.cppnew file+45
@@ -0,0 +1,45 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+#include "plugin.h"
21+#include "MockLauncherModel.h"
22+#include "MockLauncherItem.h"
23+
24+#include <unity/shell/launcher/LauncherModelInterface.h>
25+#include <unity/shell/launcher/LauncherItemInterface.h>
26+
27+#include <QtQml/qqml.h>
28+
29+using namespace unity::shell::launcher;
30+
31+static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
32+{
33+ return new MockLauncherModel();
34+}
35+
36+// cppcheck-suppress unusedFunction
37+void TestLauncherPlugin::registerTypes(const char* uri)
38+{
39+ // @uri Unity.Launcher
40+ qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Abstract Interface. Cannot be instantiated.");
41+ qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Abstract Interface. Cannot be instantiated.");
42+
43+ qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
44+ qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel");
45+}
tests/mocks/Unity/Launcher/plugin.hnew file+35
@@ -0,0 +1,35 @@
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+ * Michael Zanetti <michael.zanetti@canonical.com>
18+ */
19+
20+
21+#ifndef TESTLAUNCHER_PLUGIN_H
22+#define TESTLAUNCHER_PLUGIN_H
23+
24+#include <QtQml/QQmlExtensionPlugin>
25+
26+class TestLauncherPlugin : public QQmlExtensionPlugin
27+{
28+ Q_OBJECT
29+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
30+
31+public:
32+ void registerTypes(const char* uri);
33+};
34+
35+#endif // TESTLAUNCHER_PLUGIN_H
tests/mocks/Unity/Launcher/qmldirnew file+2
@@ -0,0 +1,2 @@
1+module Unity.Launcher
2+plugin MockLauncherPlugin
tests/mocks/Unity/fake_launchermodel.cppdeleted−150
@@ -1,150 +0,0 @@
1−/*
2− * Copyright (C) 2011 Canonical, Ltd.
3− *
4− * Authors:
5− * Michael Zanetti <michael.zanetti@canonical.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; version 3.
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
15− *
16− * You should have received a copy of the GNU General Public License
17− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18− */
19−
20−#include "launchermodel.h"
21−
22−LauncherModel::LauncherModel(QObject *parent): QAbstractListModel(parent)
23−{
24− LauncherItem *item = new LauncherItem("/usr/share/applications/phone-app.desktop", "Phone", "phone-app");
25− m_list.append(item);
26− item = new LauncherItem("/usr/share/applications/camera-app.desktop", "Camera", "camera");
27− m_list.append(item);
28− item = new LauncherItem("/usr/share/applications/gallery-app.desktop", "Gallery", "gallery");
29− m_list.append(item);
30− item = new LauncherItem("/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook");
31− m_list.append(item);
32− item = new LauncherItem("/usr/share/applications/webbrowser-app.desktop", "Browser", "browser");
33− m_list.append(item);
34− item = new LauncherItem("/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter");
35− m_list.append(item);
36− item = new LauncherItem("/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail");
37− m_list.append(item);
38− item = new LauncherItem("/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather");
39− m_list.append(item);
40− item = new LauncherItem("/usr/share/applications/notes-app.desktop", "Notepad", "notepad");
41− m_list.append(item);
42− item = new LauncherItem("/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar");
43− m_list.append(item);
44−}
45−
46−LauncherModel::~LauncherModel()
47−{
48− while (!m_list.empty()) {
49− m_list.takeFirst()->deleteLater();
50− }
51−}
52−
53−int LauncherModel::rowCount(const QModelIndex &parent) const
54−{
55− Q_UNUSED(parent)
56− return m_list.count();
57−}
58−
59−QVariant LauncherModel::data(const QModelIndex &index, int role) const
60−{
61− LauncherItem *item = m_list.at(index.row());
62− switch(role) {
63− case RoleName:
64− return item->name();
65− case RoleIcon:
66− return item->icon();
67− case RoleFavorite:
68− return item->favorite();
69− }
70−
71− return QVariant();
72−}
73−
74−LauncherItem *LauncherModel::get(int index) const
75−{
76− if (index < 0 || index >= m_list.count()) {
77− return 0;
78− }
79− return m_list.at(index);
80−}
81−
82−void LauncherModel::move(int oldIndex, int newIndex)
83−{
84− beginMoveRows(QModelIndex(), oldIndex, oldIndex, QModelIndex(), newIndex);
85− m_list.move(oldIndex, newIndex);
86− endMoveRows();
87−}
88−
89−QHash<int, QByteArray> LauncherModel::roleNames() const
90−{
91− QHash<int, QByteArray> roles;
92− roles.insert(RoleDesktopFile, "desktopFile");
93− roles.insert(RoleName, "name");
94− roles.insert(RoleIcon, "icon");
95− roles.insert(RoleFavorite, "favorite");
96− roles.insert(RoleRunning, "runnng");
97− return roles;
98−}
99−
100−
101−LauncherItem::LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent):
102− QObject(parent),
103− m_desktopFile(desktopFile),
104− m_name(name),
105− m_icon(icon),
106− m_favorite(false)
107−{
108−
109−}
110−
111−QString LauncherItem::desktopFile() const
112−{
113− return m_desktopFile;
114−}
115−
116−QString LauncherItem::name() const
117−{
118− return m_name;
119−}
120−
121−QString LauncherItem::icon() const
122−{
123− return m_icon;
124−}
125−
126−bool LauncherItem::favorite() const
127−{
128− return m_favorite;
129−}
130−
131−void LauncherItem::setFavorite(bool favorite)
132−{
133− if (m_favorite != favorite) {
134− m_favorite = favorite;
135− Q_EMIT favoriteChanged(m_favorite);
136− }
137−}
138−
139−bool LauncherItem::running() const
140−{
141− return m_running;
142−}
143−
144−void LauncherItem::setRunning(bool running)
145−{
146− if (m_running != running) {
147− m_running = running;
148− Q_EMIT runningChanged(running);
149− }
150−}
tests/mocks/Unity/fake_launchermodel.hdeleted−86
@@ -1,86 +0,0 @@
1−/*
2− * Copyright (C) 2011 Canonical, Ltd.
3− *
4− * Authors:
5− * Michael Zanetti <michael.zanetti@canonical.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; version 3.
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
15− *
16− * You should have received a copy of the GNU General Public License
17− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18− */
19−
20−#include <QAbstractListModel>
21−
22−class LauncherItem;
23−
24−class LauncherModel: public QAbstractListModel
25−{
26− Q_OBJECT
27−
28−public:
29− enum Roles {
30− RoleDesktopFile = Qt::UserRole,
31− RoleName,
32− RoleIcon,
33− RoleFavorite,
34− RoleRunning
35− };
36−
37− LauncherModel(QObject *parent = 0);
38− ~LauncherModel();
39−
40− int rowCount(const QModelIndex &parent) const;
41−
42− QVariant data(const QModelIndex &index, int role) const;
43−
44− Q_INVOKABLE LauncherItem* get(int index) const;
45− Q_INVOKABLE void move(int oldIndex, int newIndex);
46−
47− QHash<int, QByteArray> roleNames() const;
48−
49−private:
50− QList<LauncherItem*> m_list;
51−};
52−
53−class LauncherItem: public QObject
54−{
55− Q_OBJECT
56− Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
57− Q_PROPERTY(QString name READ name CONSTANT)
58− Q_PROPERTY(QString icon READ icon CONSTANT)
59− Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
60− Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
61−
62−public:
63− LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent = 0);
64−
65− QString desktopFile() const;
66−
67− QString name() const;
68− QString icon() const;
69−
70− bool favorite() const;
71− void setFavorite(bool favorite);
72−
73− bool running() const;
74− void setRunning(bool running);
75−
76−Q_SIGNALS:
77− void favoriteChanged(bool favorite);
78− void runningChanged(bool running);
79−
80−private:
81− QString m_desktopFile;
82− QString m_name;
83− QString m_icon;
84− bool m_favorite;
85− bool m_running;
86−};
tests/mocks/Unity/fake_unity_plugin.cpp−3
@@ -23,7 +23,6 @@
2323#include "fake_scopes.h"
2424#include "fake_categories.h"
2525#include "categoryresults.h"
26−#include "fake_launchermodel.h"
2726
2827// External
2928#include <glib-object.h>
@@ -41,6 +40,4 @@ void FakeUnityPlugin::registerTypes(const char *uri)
4140 qmlRegisterType<Scope>(uri, 0, 1, "Scope");
4241 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
4342 qmlRegisterUncreatableType<CategoryResults>(uri, 0, 1, "CategoryResults", "Can't create");
44− qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
45− qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create");
4643}
tests/plugins/Unity/CMakeLists.txt+2
@@ -1,3 +1,5 @@
1+add_subdirectory(Indicators)
2+
13pkg_check_modules(UNITYCORE REQUIRED unity-core-6.0)
24pkg_check_modules(LIBUNITYPROTO REQUIRED unity-protocol-private)
35
tests/plugins/Unity/Indicators/CMakeLists.txtnew file+27
@@ -0,0 +1,27 @@
1+include_directories(
2+ ${CMAKE_CURRENT_BINARY_DIR}
3+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../plugins/Unity/Indicators
4+ )
5+
6+macro(run_tests)
7+ set(_test_list "")
8+ foreach(_test ${ARGN})
9+ set(testCommand ${CMAKE_CURRENT_BINARY_DIR}/${_test}Exec
10+ -o ${CMAKE_BINARY_DIR}/${_test}.xml,xunitxml
11+ -o -,txt)
12+ add_test(NAME ${_test} COMMAND ${testCommand})
13+ add_custom_target(${_test} ${testCommand})
14+ add_executable(${_test}Exec ${_test}.cpp
15+ )
16+ qt5_use_modules(${_test}Exec Test Core Qml)
17+ target_link_libraries(${_test}Exec
18+ IndicatorsQml
19+ )
20+ set(_test_list "${_test_list};${_test}")
21+ endforeach()
22+endmacro(run_tests)
23+
24+run_tests(
25+ indicatorsmanagertest
26+ indicatorsmodeltest
27+ )
tests/plugins/Unity/Indicators/indicatorsmanagertest.cppnew file+138
@@ -0,0 +1,138 @@
1+/*
2+ * Copyright 2012 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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+#include "indicatorsmanager.h"
21+#include "paths.h"
22+
23+#include <QtTest>
24+#include <QDebug>
25+
26+class IndicatorsManagerTest : public QObject
27+{
28+ Q_OBJECT
29+private Q_SLOTS:
30+
31+ void initTestCase()
32+ {
33+ setenv("UNITY_TEST_ENV", "1", 1);
34+ setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
35+ }
36+
37+ void cleanupTestCase()
38+ {
39+ unsetenv("UNITY_TEST_ENV");
40+ }
41+
42+ /*
43+ * Test if all plugins is loaded correct
44+ */
45+ void testLoad()
46+ {
47+ IndicatorsManager manager;
48+
49+ QVERIFY(!manager.isLoaded());
50+ QCOMPARE(manager.indicators().count(), 0);
51+
52+ manager.load();
53+
54+ QVERIFY(manager.isLoaded());
55+ QCOMPARE(manager.indicators().count(), 4);
56+
57+ manager.unload();
58+
59+ QVERIFY(!manager.isLoaded());
60+ QCOMPARE(manager.indicators().count(), 0);
61+ }
62+
63+ /*
64+ * Test the creation & initialising of the indicator data
65+ */
66+ void testPluginInterface()
67+ {
68+ IndicatorsManager manager;
69+ manager.load();
70+
71+ Indicator::Ptr indicator = manager.indicator("indicator-fake1");
72+ QVERIFY(indicator ? true : false);
73+
74+ QCOMPARE(indicator->identifier(), QString("indicator-fake1"));
75+
76+ // Check that the initial properties have been set.
77+ QVariantMap props = indicator->indicatorProperties().toMap();
78+ QCOMPARE(props.count(), 4);
79+ QCOMPARE(props["busType"].toInt(), 1);
80+ QCOMPARE(props["busName"].toString(), QString("com.canonical.indicator.fake1"));
81+ QCOMPARE(props["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake1"));
82+
83+ QVariantMap objectPaths = props["menuObjectPaths"].toMap();
84+ QCOMPARE(objectPaths["phone"].toString(), QString("/com/canonical/indicator/fake1/phone"));
85+ QCOMPARE(objectPaths["desktop"].toString(), QString("/com/canonical/indicator/fake1/desktop"));
86+ }
87+
88+ /*
89+ * Test if a new plugin object is create for each different plugin
90+ */
91+ void testPluginInstance()
92+ {
93+ IndicatorsManager manager;
94+ manager.load();
95+
96+ Indicator::Ptr i0 = manager.indicator("indicator-fake1");
97+ Indicator::Ptr i1 = manager.indicator("indicator-fake1");
98+ QVERIFY(i0?true:false);
99+ QVERIFY(i1?true:false);
100+ QCOMPARE(i0, i1);
101+
102+ Indicator::Ptr i2 = manager.indicator("indicator-fake2");
103+ QVERIFY(i2?true:false);
104+ QVERIFY(i2 != i1);
105+ QVERIFY(i2 != i1);
106+ }
107+
108+ /*
109+ * Test if a new plugin init function is called only once
110+ */
111+ void testPluginInitAndShutdown()
112+ {
113+ IndicatorsManager manager;
114+ manager.load();
115+
116+ QWeakPointer<Indicator> wp0;
117+ QWeakPointer<Indicator> wp1;
118+ {
119+ Indicator::Ptr i0 = manager.indicator("indicator-fake1");
120+ wp0 = i0.toWeakRef();
121+
122+ Indicator::Ptr i1 = manager.indicator("indicator-fake1");
123+ wp1 = i1.toWeakRef();
124+
125+ manager.unload();
126+ // still alive while we have the shared pointers.
127+ QVERIFY(!wp0.isNull());
128+ QVERIFY(!wp1.isNull());
129+ }
130+
131+ // no more smart pointers. should have been released.
132+ QVERIFY(wp0.isNull());
133+ QVERIFY(wp1.isNull());
134+ }
135+};
136+
137+QTEST_MAIN(IndicatorsManagerTest)
138+#include "indicatorsmanagertest.moc"
tests/plugins/Unity/Indicators/indicatorsmodeltest.cppnew file+102
@@ -0,0 +1,102 @@
1+/*
2+ * Copyright 2012 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+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18+ */
19+
20+#include "indicatorsmodel.h"
21+#include "indicators.h"
22+#include "paths.h"
23+
24+#include <QtTest>
25+#include <QDebug>
26+
27+class IndicatorsModelTest : public QObject
28+{
29+ Q_OBJECT
30+private Q_SLOTS:
31+
32+ void initTestCase()
33+ {
34+ setenv("UNITY_TEST_ENV", "1", 1);
35+ setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
36+ }
37+
38+ void cleanupTestCase()
39+ {
40+ unsetenv("UNITY_TEST_ENV");
41+ }
42+
43+ /*
44+ * Testa that all the plugins are loaded / unloaded correctly
45+ */
46+ void testLoad()
47+ {
48+ IndicatorsModel model;
49+
50+ QCOMPARE(model.property("count").toInt(), 0);
51+
52+ model.load();
53+
54+ QCOMPARE(model.property("count").toInt(), 4);
55+
56+ model.unload();
57+
58+ QCOMPARE(model.property("count").toInt(), 0);
59+
60+ }
61+
62+ /*
63+ * Testa that the plugin data was loaded correctly
64+ */
65+ void testDataAndOrder()
66+ {
67+ // Priority order. (2, 1, 4, 3)
68+ QVariantMap map;
69+ QVariantMap map1; map1["priority"] = 1; map1["title"] = "fake1";
70+ QVariantMap map2; map2["priority"] = 0; map2["title"] = "fake2";
71+ QVariantMap map3; map3["priority"] = 3; map3["title"] = "fake3";
72+ QVariantMap map4; map4["priority"] = 2; map4["title"] = "fake4";
73+ map["indicator-fake1"] = map1;
74+ map["indicator-fake2"] = map2;
75+ map["indicator-fake3"] = map3;
76+ map["indicator-fake4"] = map4;
77+
78+ IndicatorsModel model;
79+ model.setIndicatorData(map);
80+ model.load();
81+
82+ QCOMPARE(model.data(0, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake2"));
83+ QCOMPARE(model.data(0, IndicatorsModelRole::Title).toString(), QString("fake2"));
84+ QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake2"));
85+
86+ QCOMPARE(model.data(1, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake1"));
87+ QCOMPARE(model.data(1, IndicatorsModelRole::Title).toString(), QString("fake1"));
88+ QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake1"));
89+
90+ QCOMPARE(model.data(2, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake4"));
91+ QCOMPARE(model.data(2, IndicatorsModelRole::Title).toString(), QString("fake4"));
92+ QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake4"));
93+
94+ QCOMPARE(model.data(3, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake3"));
95+ QCOMPARE(model.data(3, IndicatorsModelRole::Title).toString(), QString("fake3"));
96+ QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake3"));
97+ }
98+};
99+
100+QTEST_MAIN(IndicatorsModelTest)
101+
102+#include "indicatorsmodeltest.moc"
tests/qmltests/Panel/tst_IndicatorItem.qml+13−28
@@ -29,54 +29,39 @@ Rectangle {
2929 IndicatorItem {
3030 id: indicatorItem
3131 anchors.fill: parent
32− iconSource: "../../../Panel/graphics/Clock.png"
33− label: "Clock"
3432 }
3533
3634 UT.UnityTestCase {
3735 name: "IndicatorItem"
3836
3937 function init_test() {
40− indicatorItem.iconSource = "../../../Panel/graphics/Clock.png"
41− indicatorItem.label = "Clock"
4238 }
4339
4440 function test_dimmed() {
4541 init_test()
4642
47− var itemRow = findChild(indicatorItem, "itemRow")
4843 indicatorItem.dimmed = true
49− compare(itemRow.opacity > 0, true, "IndicatorItem opacity should not be 0")
50− compare(itemRow.opacity < 1, true, "IndicatorItem opacity should not be 1")
44+ compare(indicatorItem.opacity > 0, true, "IndicatorItem opacity should not be 0")
45+ compare(indicatorItem.opacity < 1, true, "IndicatorItem opacity should not be 1")
5146 }
5247
53− function test_empty() {
54− init_test()
55−
56− indicatorItem.iconSource = ""
57− indicatorItem.label = ""
58− compare(indicatorItem.visible, false, "IndicatorItem should not be visible")
59− }
48+ function test_highlight() {
49+ var itemHighlight = findChild(indicatorItem, "highlight")
50+ verify(itemHighlight != undefined)
6051
61− function test_noLabel() {
62− init_test()
52+ indicatorItem.highlighted = true;
53+ compare(itemHighlight.visible, true, "Indicator should be highlighted")
6354
64− var itemImage = findChild(indicatorItem, "itemImage")
65− var itemLabel = findChild(indicatorItem, "itemLabel")
66− indicatorItem.label = ""
67− compare(itemImage.visible, true, "The image should be visible")
68− compare(itemImage.width > 0, true, "The image should have a positive width")
69− compare(itemLabel.width > 0, false, "The label should not have a positive width")
55+ indicatorItem.highlighted = false;
56+ compare(itemHighlight.visible, false, "Indicator should not be highlighted")
7057 }
7158
72− function test_noImage() {
59+ function test_empty() {
7360 init_test()
7461
75− var itemImage = findChild(indicatorItem, "itemImage")
76− var itemLabel = findChild(indicatorItem, "itemLabel")
77− indicatorItem.iconSource = ""
78− compare(itemImage.visible, false, "The image should not be visible")
79− compare(itemLabel.width > 0, true, "The label should have a positive width")
62+ compare(indicatorItem.visible, false, "IndicatorItem should not be visible.")
63+ indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml";
64+ tryCompare(indicatorItem, "visible", true)
8065 }
8166 }
8267}
tests/qmltests/Panel/tst_IndicatorRow.qml+4−3
@@ -19,7 +19,7 @@ import QtTest 1.0
1919import Unity.Test 0.1 as UT
2020import ".."
2121import "../../../Panel"
22−import Ubuntu.ChewieUI 0.1 as ChewieUI
22+import Unity.Indicators 0.1 as Indicators
2323
2424/*
2525 This tests the IndicatorRow component by using a fake model to stage data in the indicators
@@ -51,8 +51,9 @@ Item {
5151 indicatorsModel: indicatorModel
5252 }
5353
54− ChewieUI.PluginModel {
54+ Indicators.IndicatorsModel {
5555 id: indicatorModel
56+ Component.onCompleted: load()
5657 }
5758
5859 UT.UnityTestCase {
@@ -241,7 +242,7 @@ Item {
241242 compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in locked state");
242243 }
243244
244− function test_active_overview_() {
245+ function test_active_overview() {
245246 init_test();
246247
247248 indicatorRow.overviewActive = true;
tests/qmltests/Panel/tst_Indicators.qml+1−2
@@ -71,8 +71,7 @@ Item {
7171 if (!indicators.shown) {
7272 indicators.openOverview();
7373 indicators.show();
74− }
75− else {
74+ } else {
7675 indicators.hide();
7776 }
7877 }
tests/qmltests/Panel/tst_MenuContent.qml+11−10
@@ -19,7 +19,7 @@ import QtTest 1.0
1919import Unity.Test 0.1 as UT
2020import ".."
2121import "../../../Panel"
22−import Ubuntu.ChewieUI 0.1 as ChewieUI
22+import Unity.Indicators 0.1 as Indicators
2323
2424Item {
2525 id: shell
@@ -27,11 +27,11 @@ Item {
2727 height: units.gu(70)
2828
2929 property var indicator_status: {
30− 'menu_plugin1': { 'started': false, 'reset': 0 },
31− 'menu_plugin2': { 'started': false, 'reset': 0 },
32− 'menu_plugin3': { 'started': false, 'reset': 0 },
33− 'menu_plugin4': { 'started': false, 'reset': 0 },
34− 'menu_plugin5': { 'started': false, 'reset': 0 }
30+ 'menu_page1': { 'started': false, 'reset': 0 },
31+ 'menu_page2': { 'started': false, 'reset': 0 },
32+ 'menu_page3': { 'started': false, 'reset': 0 },
33+ 'menu_page4': { 'started': false, 'reset': 0 },
34+ 'menu_page5': { 'started': false, 'reset': 0 }
3535 }
3636
3737 // Dummy objects
@@ -39,8 +39,9 @@ Item {
3939 Item { id: handle }
4040
4141
42− ChewieUI.PluginModel {
42+ Indicators.IndicatorsModel {
4343 id: indicatorsModel
44+ Component.onCompleted: load()
4445 }
4546
4647 MenuContent {
@@ -123,20 +124,20 @@ Item {
123124 }
124125
125126 function get_test_menu_objecName(index) {
126− return "menu_plugin"+(index+1);
127+ return "menu_page"+(index+1);
127128 }
128129
129130 property string test_menu_objectName : ""
130131 function current_menu_equals_test_menu() {
131132 var current_loader = menu_content_test.findChild(menuContent, "menus").currentItem
132133 if (current_loader == undefined) {
133− console.log("current_loader undefined");
134+ console.log("current_loader 'menus' undefined");
134135 return false;
135136 }
136137
137138 var menu = menu_content_test.findChild(menuContent, test_menu_objectName);
138139 if (menu == undefined) {
139− console.log("test_menu undefined");
140+ console.log("test_menu " + test_menu_objectName + " undefined");
140141 return false;
141142 }
142143
tests/qmltests/Panel/tst_Overview.qml+5−17
@@ -20,6 +20,7 @@ import ".."
2020import "../../../Panel/Menus"
2121import "../../../Components"
2222import Unity.Test 0.1 as UT
23+import Unity.Indicators 0.1 as Indicators
2324
2425Rectangle {
2526 id: shell
@@ -47,9 +48,9 @@ Rectangle {
4748
4849 ListModel {
4950 id: mockModel
50− ListElement {title: "foo"; label: "foo"; iconSource: "graphics/sound_on_icon.png"}
51− ListElement {title: "bar"; label: ""; iconSource: "graphics/sound_on_icon.png"}
52− ListElement {title: "baz"; label: "baz"; iconSource: "graphics/sound_on_icon.png"}
51+ ListElement {title: "fake1"; widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget1.qml"; indicatorProperties: ""}
52+ ListElement {title: "fake2"; widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget2.qml"; indicatorProperties: ""}
53+ ListElement {title: "fake3"; widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget3.qml"; indicatorProperties: ""}
5354 }
5455
5556 ListModel {
@@ -98,7 +99,7 @@ Rectangle {
9899 button = findChild(overview, "overviewGridButton3");
99100 compare(button, undefined, "There should only be 3 buttons... found at least 4...");
100101
101− mockModel2.append({title: "humppa", label: "", iconSource: "graphics/sound_on_icon.png"})
102+ mockModel2.append({title: "humppa", widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget4.qml", indicatorProperties: ""})
102103 overviewGrid.forceLayout();
103104 waitForRendering(overviewGrid);
104105
@@ -106,19 +107,6 @@ Rectangle {
106107 verify(button !== undefined, "button3 wasn't found");
107108 }
108109
109− function test_text_or_icon_data() {
110− return [
111− {tag: "text", index: 0, imageVisible: false},
112− {tag: "image", index: 1, imageVisible: true}
113− ]
114− }
115−
116− function test_text_or_icon(data) {
117− var button = findChild(overview, "overviewGridButton" + data.index);
118− var image = findChild(button, "overviewGridButtonImage");
119− compare(image.visible, data.imageVisible)
120− }
121−
122110 function test_volume_slider_data() {
123111 return [
124112 {tag: "0%", sliderPos:0},
tests/qmltests/Panel/tst_Panel.qml−1
@@ -19,7 +19,6 @@ import QtTest 1.0
1919import Unity.Test 0.1 as UT
2020import ".."
2121import "../../../Panel"
22−import Ubuntu.ChewieUI 0.1 as ChewieUI
2322
2423/*
2524 This tests the Panel component using a fake model to stage data in the indicators
tests/qmltests/modules/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(Unity)
tests/qmltests/modules/Unity/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(Indicators)
unity8.qmlproject+1
@@ -18,6 +18,7 @@ Project {
1818 /* List of plugin directories passed to QML runtime */
1919 importPaths: [
2020 "builddir/plugins",
21+ "builddir/modules",
2122 "builddir/tests/plugins",
2223 "builddir/tests/utils/modules"
2324 ]