Merge lp:~saviq/unity8/drop-network-agents into lp:unity8

Proposed by Michał Sawicz
Status: Superseded
Proposed branch: lp:~saviq/unity8/drop-network-agents
Merge into: lp:unity8
Diff against target: 1687 lines (+435/-1054)
22 files modified
Notifications/Notification.qml (+42/-1)
Notifications/NotificationMenuItemFactory.qml (+96/-0)
Panel/Indicators/NetworkIndicatorPage.qml (+0/-82)
Panel/IndicatorsDataModel.qml (+0/-2)
debian/control (+1/-6)
plugins/Unity/Indicators/Network/CMakeLists.txt (+0/-44)
plugins/Unity/Indicators/Network/networkagent.cpp (+0/-146)
plugins/Unity/Indicators/Network/networkagent.h (+0/-65)
plugins/Unity/Indicators/Network/plugin.cpp (+0/-31)
plugins/Unity/Indicators/Network/plugin.h (+0/-32)
plugins/Unity/Indicators/Network/qml/PasswordPage.qml (+0/-88)
plugins/Unity/Indicators/Network/qml/PasswordTextField.qml (+0/-68)
plugins/Unity/Indicators/Network/qml/qmldir (+0/-3)
plugins/Unity/Indicators/Network/secret-agent.c (+0/-382)
plugins/Unity/Indicators/Network/secret-agent.h (+0/-102)
plugins/Utils/CMakeLists.txt (+2/-1)
plugins/Utils/plugin.cpp (+2/-0)
plugins/Utils/unitymenumodelpaths.cpp (+182/-0)
plugins/Utils/unitymenumodelpaths.h (+82/-0)
tests/mocks/QMenuModel/UnityMenuModel.qml (+26/-0)
tests/mocks/QMenuModel/qmldir (+1/-0)
tests/qmltests/CMakeLists.txt (+1/-1)
To merge this branch: bzr merge lp:~saviq/unity8/drop-network-agents
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Nick Dedekind Pending
Review via email: mp+188700@code.launchpad.net

This proposal supersedes a proposal from 2013-10-01.

This proposal has been superseded by a proposal from 2013-10-03.

Commit message

Drop network agents now that they're in indicator-network instead.

To post a comment you must log in.
lp:~saviq/unity8/drop-network-agents updated
249. By Michał Sawicz

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:249
http://jenkins.qa.ubuntu.com/job/unity8-ci/1205/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4307
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2015
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/1981
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/228
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1205
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1205/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1204
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/597
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/176
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/176/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2017
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2017/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1705
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1722

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1205/rebuild

review: Needs Fixing (continuous-integration)
lp:~saviq/unity8/drop-network-agents updated
250. By Michał Sawicz

merge trunk

251. By Michał Sawicz

One more cleanup.

252. By Michał Sawicz

One more unneeded line.

253. By Michał Sawicz

Add Breaks: for indicator-network, so that we don't end up with no password agent on upgrade.

254. By Michał Sawicz

merge version bump

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'Greeter/PinLockscreen.qml' => 'Components/PinLockscreen.qml'
2=== renamed file 'Greeter/PinPadButton.qml' => 'Components/PinPadButton.qml'
3=== modified file 'Notifications/Notification.qml'
4--- Notifications/Notification.qml 2013-07-18 09:03:11 +0000
5+++ Notifications/Notification.qml 2013-10-01 19:26:43 +0000
6@@ -17,6 +17,8 @@
7 import QtQuick 2.0
8 import Ubuntu.Components 0.1
9 import Unity.Notifications 1.0
10+import QMenuModel 0.1
11+import Utils 0.1
12
13 UbuntuShape {
14 id: notification
15@@ -38,6 +40,24 @@
16
17 clip: true
18
19+ UnityMenuModelPaths {
20+ id: paths
21+
22+ source: hints["x-canonical-private-menu-model"]
23+
24+ busNameHint: "busName"
25+ actionsHint: "actions"
26+ menuObjectPathHint: "menuPath"
27+ }
28+
29+ UnityMenuModel {
30+ id: unityMenuModel
31+
32+ busName: paths.busName
33+ actions: paths.actions
34+ menuObjectPath: paths.menuObjectPath
35+ }
36+
37 Behavior on implicitHeight {
38 id: heightBehavior
39
40@@ -141,6 +161,27 @@
41 }
42 }
43
44+ Column {
45+ objectName: "dialogListView"
46+ spacing: units.gu(2)
47+
48+ visible: count > 0
49+
50+ anchors.left: parent.left; anchors.right: parent.right
51+
52+ Repeater {
53+ model: unityMenuModel
54+
55+ NotificationMenuItemFactory {
56+ anchors.left: parent.left; anchors.right: parent.right
57+
58+ menuModel: unityMenuModel
59+ menuData: model
60+ menuIndex: index
61+ }
62+ }
63+ }
64+
65 Item {
66 id: buttonRow
67
68@@ -195,7 +236,7 @@
69 top: parent.top
70 bottom: parent.bottom
71 }
72- gradient: notification.hints == Notification.ButtonTint ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
73+ gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
74 visible: width > 0
75 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
76 }
77
78=== added file 'Notifications/NotificationMenuItemFactory.qml'
79--- Notifications/NotificationMenuItemFactory.qml 1970-01-01 00:00:00 +0000
80+++ Notifications/NotificationMenuItemFactory.qml 2013-10-01 19:26:43 +0000
81@@ -0,0 +1,96 @@
82+/*
83+ * Copyright 2013 Canonical Ltd.
84+ *
85+ * This program is free software; you can redistribute it and/or modify
86+ * it under the terms of the GNU Lesser General Public License as published by
87+ * the Free Software Foundation; version 3.
88+ *
89+ * This program is distributed in the hope that it will be useful,
90+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
91+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92+ * GNU Lesser General Public License for more details.
93+ *
94+ * You should have received a copy of the GNU Lesser General Public License
95+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
96+ *
97+ * Authors:
98+ * Nick Dedekind <nick.dedekind@canonical.com>
99+ */
100+
101+import QtQuick 2.0
102+import Ubuntu.Components 0.1
103+import "../Components"
104+
105+Loader {
106+ id: menuFactory
107+
108+ property QtObject menuModel: null
109+ property QtObject menuData: null
110+ property int menuIndex
111+ property var notification
112+
113+ property var _map: {
114+ "com.canonical.snapdecision.textfield": textfield,
115+ "com.canonical.snapdecision.pinlock" : pinLock,
116+ }
117+
118+ sourceComponent: {
119+ if (menuData.type !== undefined) {
120+ var component = _map[menuData.type];
121+ if (component !== undefined) {
122+ return component;
123+ }
124+ } else {
125+ if (menuData.isSeparator) {
126+ return divMenu;
127+ }
128+ }
129+ return standardMenu;
130+ }
131+
132+ Component {
133+ id: textfield
134+
135+ Column {
136+ spacing: units.gu(.5)
137+
138+ anchors.left: parent.left; anchors.right: parent.right
139+
140+ Component.onCompleted: {
141+ menuModel.loadExtendedAttributes(menuIndex, {"x-echo-mode-password": "bool"});
142+ textfield.echoMode = menuData.ext.xEchoModePassword ? TextInput.Password : TextInput.Normal
143+ }
144+
145+ Label {
146+ fontSize: "medium"
147+ color: "white"
148+ text: menuData.label
149+ }
150+
151+ TextField {
152+ id: textfield
153+
154+ anchors.left: parent.left; anchors.right: parent.right
155+
156+ onTextChanged: {
157+ menuModel.changeState(menuIndex, text);
158+ }
159+ }
160+ }
161+ }
162+
163+ Component {
164+ id: pinLock
165+ PinLockscreen {
166+ anchors.left: parent.left; anchors.right: parent.right
167+
168+ onEntered: {
169+ menuModel.changeState(menuIndex, passphrase);
170+ }
171+
172+ onCancel: {
173+ menuModel.activate(menuIndex, false);
174+ }
175+ }
176+ }
177+}
178
179=== removed file 'Panel/Indicators/NetworkIndicatorPage.qml'
180--- Panel/Indicators/NetworkIndicatorPage.qml 2013-09-09 09:21:55 +0000
181+++ Panel/Indicators/NetworkIndicatorPage.qml 1970-01-01 00:00:00 +0000
182@@ -1,82 +0,0 @@
183-/*
184- * Copyright 2013 Canonical Ltd.
185- *
186- * This program is free software; you can redistribute it and/or modify
187- * it under the terms of the GNU Lesser General Public License as published by
188- * the Free Software Foundation; version 3.
189- *
190- * This program is distributed in the hope that it will be useful,
191- * but WITHOUT ANY WARRANTY; without even the implied warranty of
192- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
193- * GNU Lesser General Public License for more details.
194- *
195- * You should have received a copy of the GNU Lesser General Public License
196- * along with this program. If not, see <http://www.gnu.org/licenses/>.
197- *
198- * Authors:
199- * Renato Araujo Oliveira Filho <renato@canonical.com>
200- */
201-
202-import QtQuick 2.0
203-import Unity.Indicators 0.1 as Indicators
204-import Unity.Indicators.Network 0.1 as ICNetwork
205-import Ubuntu.Components 0.1
206-
207-PageStack {
208- id: networkPage
209- // Stops the search for a parent tree node.
210- // We don't want it going up to the indicator tabs.
211- // FIXME: need a better way of doing this.
212- // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1211704
213- __propagated: null
214-
215- property alias title: _mainPage.title
216- property alias emptyText: pluginItem.emptyText
217- property alias busName: pluginItem.busName
218- property alias actionsObjectPath : pluginItem.actionsObjectPath
219- property alias menuObjectPaths : pluginItem.menuObjectPaths
220-
221- anchors.fill: parent
222-
223- Page {
224- id: _mainPage
225-
226- Indicators.IndicatorPage {
227- id: pluginItem
228- anchors.fill: parent
229- }
230- }
231-
232- Component {
233- id: passwordPageComponent
234-
235- ICNetwork.PasswordPage {
236- agent: networkAgent
237- }
238- }
239-
240- ICNetwork.NetworkAgent {
241- id: networkAgent
242-
243- onSecretRequested: {
244- networkPage.push(passwordPageComponent, {"token": token});
245- }
246- }
247-
248- function start()
249- {
250- push(_mainPage);
251- pluginItem.start();
252- }
253-
254- function stop()
255- {
256- clear();
257- pluginItem.stop();
258- }
259-
260- function reset()
261- {
262- pluginItem.reset();
263- }
264-}
265
266=== modified file 'Panel/IndicatorsDataModel.qml'
267--- Panel/IndicatorsDataModel.qml 2013-09-09 09:21:55 +0000
268+++ Panel/IndicatorsDataModel.qml 2013-10-01 19:26:43 +0000
269@@ -46,8 +46,6 @@
270 'indicator-network' : {
271 'title': 'Networks',
272 'description' : '',
273- 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget.qml',
274- 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorPage.qml'
275 },
276 'indicator-power' : {
277 'title': 'Battery',
278
279=== modified file 'debian/control'
280--- debian/control 2013-09-26 15:23:37 +0000
281+++ debian/control 2013-10-01 19:26:43 +0000
282@@ -14,8 +14,6 @@
283 libjson-perl,
284 libnih-dbus-dev,
285 libnih-dev,
286- libnm-glib-dev,
287- libnm-util-dev,
288 libpulse-dev,
289 libqmenumodel-dev (>= 0.2.7),
290 libqt5v8-5-private-dev,
291@@ -80,10 +78,7 @@
292 unity8-private | unity-launcher-impl,
293 ${misc:Depends},
294 ${shlibs:Depends},
295-Recommends: indicator-battery,
296- indicator-messages,
297- indicator-time,
298- ${unity-default-masterscopes},
299+Recommends: ${unity-default-masterscopes},
300 Description: Unity 8 shell
301 The Unity 8 shell is the primary user interface for Ubuntu devices.
302
303
304=== modified file 'plugins/Unity/Indicators/Network/CMakeLists.txt'
305--- plugins/Unity/Indicators/Network/CMakeLists.txt 2013-08-20 19:50:07 +0000
306+++ plugins/Unity/Indicators/Network/CMakeLists.txt 2013-10-01 19:26:43 +0000
307@@ -1,45 +1,1 @@
308-# export_qmlplugin macro
309-include(Plugins)
310-
311-project(IndicatorsNetworkQml)
312-
313-pkg_check_modules(GLIB glib-2.0>=2.32)
314-pkg_check_modules(LIBNM_GLIB libnm-glib>=0.9.6)
315-pkg_check_modules(LIBNM_UTIL libnm-util>=0.9.6)
316-
317-if(LIBNM_GLIB_FOUND AND LIBNM_UTIL_FOUND AND GLIB_FOUND)
318- set(INDICATORS_NETWORK_SRC
319- networkagent.cpp
320- plugin.cpp
321- secret-agent.c
322- )
323-
324- add_library(IndicatorsNetworkQml MODULE
325- ${INDICATORS_NETWORK_SRC}
326- )
327-
328- qt5_use_modules(IndicatorsNetworkQml Core Qml Widgets)
329-
330- set_target_properties(IndicatorsNetworkQml PROPERTIES COMPILE_FLAGS -fPIC)
331-
332- include_directories(
333- ${CMAKE_CURRENT_SOURCE_DIR}
334- ${GLIB_INCLUDE_DIRS}
335- ${LIBNM_GLIB_INCLUDE_DIRS}
336- ${LIBNM_UTIL_INCLUDE_DIRS}
337- )
338-
339- target_link_libraries(IndicatorsNetworkQml
340- ${GLIB_LIBRARIES}
341- ${LIBNM_GLIB_LIBRARIES}
342- ${LIBNM_UTIL_LIBRARIES}
343- )
344-
345- # export the qmltypes and plugin files
346- export_qmlplugin(Unity.Indicators.Network 0.1 Unity/Indicators/Network TARGETS IndicatorsNetworkQml)
347-
348-else()
349- message(WARNING "Missing glib or libnm dependency for the network plugin, not building")
350-endif()
351-
352 add_subdirectory(qml)
353
354=== removed file 'plugins/Unity/Indicators/Network/networkagent.cpp'
355--- plugins/Unity/Indicators/Network/networkagent.cpp 2013-06-07 12:51:16 +0000
356+++ plugins/Unity/Indicators/Network/networkagent.cpp 1970-01-01 00:00:00 +0000
357@@ -1,146 +0,0 @@
358-/*
359- * Copyright 2013 Canonical Ltd.
360- *
361- * This program is free software; you can redistribute it and/or modify
362- * it under the terms of the GNU Lesser General Public License as published by
363- * the Free Software Foundation; version 3.
364- *
365- * This program is distributed in the hope that it will be useful,
366- * but WITHOUT ANY WARRANTY; without even the implied warranty of
367- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
368- * GNU Lesser General Public License for more details.
369- *
370- * You should have received a copy of the GNU Lesser General Public License
371- * along with this program. If not, see <http://www.gnu.org/licenses/>.
372- *
373- * Authors:
374- * Alberto Ruiz <alberto.ruiz@canonical.com>
375- * Renato Araujo Oliveira Filho <renato@canonical.com>
376- */
377-
378-#include "networkagent.h"
379-
380-#include <QVariant>
381-#include <QApplication>
382-#include <QDebug>
383-
384-class NetworkAgentToken
385-{
386-public:
387- NMConnection *connection;
388- NMSettingWirelessSecurity *wisec;
389- guint id;
390- QByteArray keyMgmt;
391-
392- NetworkAgentToken(NMConnection *connection,
393- NMSettingWirelessSecurity *wisec,
394- guint id,
395- QByteArray keyMgmt)
396- : connection(connection),
397- wisec(wisec),
398- id(id),
399- keyMgmt(keyMgmt)
400- {
401- if (connection) {
402- g_object_ref(connection);
403- } else {
404- qWarning() << "invalid connection object";
405- }
406- }
407-
408- ~NetworkAgentToken()
409- {
410- if (connection) {
411- g_object_unref(connection);
412- }
413- }
414-};
415-
416-NetworkAgent::NetworkAgent(QObject *parent)
417- : QObject(parent)
418-{
419- m_agent = unity_settings_secret_agent_new();
420- g_signal_connect(G_OBJECT(m_agent),
421- UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
422- G_CALLBACK(onSecretRequested),
423- this);
424-
425- g_signal_connect(G_OBJECT(m_agent),
426- UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
427- G_CALLBACK(onSecretRequestCancelled),
428- this);
429-}
430-
431-NetworkAgent::~NetworkAgent()
432-{
433- nm_secret_agent_unregister(NM_SECRET_AGENT(m_agent));
434- g_object_unref(m_agent);
435-}
436-
437-void NetworkAgent::authenticate(const QVariant &token, const QString &key)
438-{
439- NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
440- if (pToken == NULL) {
441- return;
442- }
443-
444- if ((pToken->keyMgmt == "wpa-none") || (pToken->keyMgmt == "wpa-psk")) {
445- g_object_set(G_OBJECT(pToken->wisec),
446- NM_SETTING_WIRELESS_SECURITY_PSK, qPrintable(key),
447- NULL);
448- } else if (pToken->keyMgmt == "none") {
449- g_object_set(G_OBJECT(pToken->wisec),
450- NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, qPrintable(key),
451- NULL);
452- }
453-
454- GHashTable *settings = nm_connection_to_hash(pToken->connection,
455- NM_SETTING_HASH_FLAG_ALL);
456-
457- unity_settings_secret_agent_provide_secret(m_agent,
458- pToken->id, settings);
459- g_hash_table_unref(settings);
460- delete pToken;
461-}
462-
463-void NetworkAgent::cancel(const QVariant &token)
464-{
465- NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
466- if (pToken != NULL) {
467- unity_settings_secret_agent_cancel_request(m_agent, pToken->id);
468- delete pToken;
469- }
470-}
471-
472-void NetworkAgent::onSecretRequested(UnitySettingsSecretAgent* /*agent*/,
473- guint id,
474- NMConnection* connection,
475- const char* /*setting_name*/,
476- const char** /*hints*/,
477- NMSecretAgentGetSecretsFlags /*flags*/,
478- NetworkAgent* self)
479-{
480- NetworkAgentToken *token = new NetworkAgentToken(connection,
481- NULL,
482- id,
483- NULL);
484-
485- token->wisec = nm_connection_get_setting_wireless_security(connection);
486- if (token->wisec) {
487- token->keyMgmt = nm_setting_wireless_security_get_key_mgmt(token->wisec);
488- }
489-
490- QVariant varToken = qVariantFromValue((void *) token);
491- Q_EMIT self->secretRequested(varToken);
492-}
493-
494-void NetworkAgent::onSecretRequestCancelled(UnitySettingsSecretAgent* /*agent*/,
495- guint /*id*/,
496- NMConnection* /*connection*/,
497- const char* /*setting_name*/,
498- const char** /*hints*/,
499- NMSecretAgentGetSecretsFlags /*flags*/,
500- NetworkAgent* /*self*/)
501-{
502- //Do nothing for now
503-}
504
505=== removed file 'plugins/Unity/Indicators/Network/networkagent.h'
506--- plugins/Unity/Indicators/Network/networkagent.h 2013-06-07 12:51:16 +0000
507+++ plugins/Unity/Indicators/Network/networkagent.h 1970-01-01 00:00:00 +0000
508@@ -1,65 +0,0 @@
509-/*
510- * Copyright 2013 Canonical Ltd.
511- *
512- * This program is free software; you can redistribute it and/or modify
513- * it under the terms of the GNU Lesser General Public License as published by
514- * the Free Software Foundation; version 3.
515- *
516- * This program is distributed in the hope that it will be useful,
517- * but WITHOUT ANY WARRANTY; without even the implied warranty of
518- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
519- * GNU Lesser General Public License for more details.
520- *
521- * You should have received a copy of the GNU Lesser General Public License
522- * along with this program. If not, see <http://www.gnu.org/licenses/>.
523- *
524- * Authors:
525- * Alberto Ruiz <alberto.ruiz@canonical.com>
526- * Renato Araujo Oliveira Filho <renato@canonical.com>
527- */
528-
529-#ifndef NETWORKAGENT_H
530-#define NETWORKAGENT_H
531-
532-#include "secret-agent.h"
533-
534-#include <QObject>
535-
536-class NetworkAgentToken;
537-
538-class NetworkAgent : public QObject
539-{
540- Q_OBJECT
541-public:
542- NetworkAgent(QObject *parent=0);
543- ~NetworkAgent();
544-
545- Q_INVOKABLE void authenticate(const QVariant &token, const QString &key);
546- Q_INVOKABLE void cancel(const QVariant &token);
547-
548-Q_SIGNALS:
549- void secretRequested(const QVariant &token);
550- void secretRequestCancelled();
551-
552-private:
553- UnitySettingsSecretAgent *m_agent;
554-
555- static void onSecretRequested(UnitySettingsSecretAgent *agent,
556- guint id,
557- NMConnection *connection,
558- const char *setting_name,
559- const char **hints,
560- NMSecretAgentGetSecretsFlags flags,
561- NetworkAgent *self);
562-
563- static void onSecretRequestCancelled(UnitySettingsSecretAgent *agent,
564- guint id,
565- NMConnection *connection,
566- const char *setting_name,
567- const char **hints,
568- NMSecretAgentGetSecretsFlags flags,
569- NetworkAgent *self);
570-
571-};
572-
573-#endif
574
575=== removed file 'plugins/Unity/Indicators/Network/plugin.cpp'
576--- plugins/Unity/Indicators/Network/plugin.cpp 2013-08-23 11:56:44 +0000
577+++ plugins/Unity/Indicators/Network/plugin.cpp 1970-01-01 00:00:00 +0000
578@@ -1,31 +0,0 @@
579-/*
580- * Copyright (C) 2012 Canonical, Ltd.
581- *
582- * This program is free software; you can redistribute it and/or modify
583- * it under the terms of the GNU General Public License as published by
584- * the Free Software Foundation; version 3.
585- *
586- * This program is distributed in the hope that it will be useful,
587- * but WITHOUT ANY WARRANTY; without even the implied warranty of
588- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
589- * GNU General Public License for more details.
590- *
591- * You should have received a copy of the GNU General Public License
592- * along with this program. If not, see <http://www.gnu.org/licenses/>.
593- *
594- * Author: Nick Dedekind <nick.dedekind@canonical.com>
595- */
596-
597-// Qt
598-#include <QtQml/qqml.h>
599-
600-// self
601-#include "plugin.h"
602-
603-// local
604-#include "networkagent.h"
605-
606-void IndicatorsNetworkPlugin::registerTypes(const char *uri)
607-{
608- qmlRegisterType<NetworkAgent>(uri, 0, 1, "NetworkAgent");
609-}
610
611=== removed file 'plugins/Unity/Indicators/Network/plugin.h'
612--- plugins/Unity/Indicators/Network/plugin.h 2013-06-17 08:14:24 +0000
613+++ plugins/Unity/Indicators/Network/plugin.h 1970-01-01 00:00:00 +0000
614@@ -1,32 +0,0 @@
615-/*
616- * Copyright (C) 2012 Canonical, Ltd.
617- *
618- * This program is free software; you can redistribute it and/or modify
619- * it under the terms of the GNU General Public License as published by
620- * the Free Software Foundation; version 3.
621- *
622- * This program is distributed in the hope that it will be useful,
623- * but WITHOUT ANY WARRANTY; without even the implied warranty of
624- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
625- * GNU General Public License for more details.
626- *
627- * You should have received a copy of the GNU General Public License
628- * along with this program. If not, see <http://www.gnu.org/licenses/>.
629- *
630- * Author: Nick Dedekind <nick.dedekind@canonical.com>
631- */
632-
633-#ifndef INDICATORS_NETWORK_PLUGIN_H
634-#define INDICATORS_NETWORK_PLUGIN_H
635-
636-#include <QtQml/QQmlExtensionPlugin>
637-
638-class IndicatorsNetworkPlugin : public QQmlExtensionPlugin
639-{
640- Q_OBJECT
641- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
642-public:
643- void registerTypes(const char *uri);
644-};
645-
646-#endif // INDICATORS_NETWORK_PLUGIN_H
647
648=== removed file 'plugins/Unity/Indicators/Network/qml/PasswordPage.qml'
649--- plugins/Unity/Indicators/Network/qml/PasswordPage.qml 2013-08-21 21:00:17 +0000
650+++ plugins/Unity/Indicators/Network/qml/PasswordPage.qml 1970-01-01 00:00:00 +0000
651@@ -1,88 +0,0 @@
652-/*
653- * Copyright 2013 Canonical Ltd.
654- *
655- * This program is free software; you can redistribute it and/or modify
656- * it under the terms of the GNU Lesser General Public License as published by
657- * the Free Software Foundation; version 3.
658- *
659- * This program is distributed in the hope that it will be useful,
660- * but WITHOUT ANY WARRANTY; without even the implied warranty of
661- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
662- * GNU Lesser General Public License for more details.
663- *
664- * You should have received a copy of the GNU Lesser General Public License
665- * along with this program. If not, see <http://www.gnu.org/licenses/>.
666- *
667- * Authors:
668- * Renato Araujo Oliveira Filho <renato@canonical.com>
669- */
670-
671-import QtQuick 2.0
672-import Ubuntu.Components 0.1
673-import Ubuntu.Components.ListItems 0.1 as ListItem
674-import Unity.Indicators 0.1 as Indicators
675-
676-Page {
677- id: pagePassword
678-
679- property variant agent
680- property variant token
681-
682- anchors.fill: parent
683- title: "Network Authentication"
684-
685- Column {
686- anchors {
687- left: parent.left
688- right: parent.right
689- }
690-
691- Indicators.SectionMenuItem {
692- text: "Authentication"
693- }
694-
695- Indicators.FramedMenuItem {
696- implicitHeight: password.height + units.gu(1)
697-
698- PasswordTextField {
699- id: password
700- anchors {
701- left: parent.left
702- right: parent.right
703- margins: units.gu(3)
704- verticalCenter: parent.verticalCenter
705- }
706- }
707- }
708-
709- Indicators.FramedMenuItem {
710- Row {
711- anchors {
712- right: parent.right
713- verticalCenter: parent.verticalCenter
714- margins: units.gu(3)
715- }
716-
717- spacing: units.gu(1)
718-
719- Button {
720- text: "Cancel"
721- width: units.gu(10)
722- onClicked: {
723- agent.cancel(token);
724- pageStack.pop();
725- }
726- }
727-
728- Button {
729- text: "OK"
730- width: units.gu(10)
731- onClicked: {
732- agent.authenticate(token, password.text);
733- pageStack.pop();
734- }
735- }
736- }
737- }
738- }
739-}
740
741=== removed file 'plugins/Unity/Indicators/Network/qml/PasswordTextField.qml'
742--- plugins/Unity/Indicators/Network/qml/PasswordTextField.qml 2013-07-05 15:05:28 +0000
743+++ plugins/Unity/Indicators/Network/qml/PasswordTextField.qml 1970-01-01 00:00:00 +0000
744@@ -1,68 +0,0 @@
745-/*
746- * Copyright 2013 Canonical Ltd.
747- *
748- * This program is free software; you can redistribute it and/or modify
749- * it under the terms of the GNU Lesser General Public License as published by
750- * the Free Software Foundation; version 3.
751- *
752- * This program is distributed in the hope that it will be useful,
753- * but WITHOUT ANY WARRANTY; without even the implied warranty of
754- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
755- * GNU Lesser General Public License for more details.
756- *
757- * You should have received a copy of the GNU Lesser General Public License
758- * along with this program. If not, see <http://www.gnu.org/licenses/>.
759- *
760- * Authors:
761- * Renato Araujo Oliveira Filho <renato@canonical.com>
762- */
763-
764-import QtQuick 2.0
765-import Ubuntu.Components 0.1
766-
767-Item {
768- id: textMenu
769-
770- property alias text: textField.text
771-
772- height: contentColumn.height
773-
774- Column {
775- id: contentColumn
776- spacing: units.gu(0.5)
777- anchors {
778- left: parent.left
779- right: parent.right
780- }
781-
782- TextField {
783- id: textField
784-
785- anchors {
786- left: parent.left
787- right: parent.right
788- }
789-
790- placeholderText: "Password"
791- echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
792- }
793-
794- Row {
795- anchors {
796- left: parent.left
797- right: parent.right
798- }
799-
800- spacing: units.gu(1)
801-
802- CheckBox {
803- id: showPassword
804- }
805-
806- Label {
807- text: "Show password"
808- anchors.verticalCenter: showPassword.verticalCenter
809- }
810- }
811- }
812-}
813
814=== modified file 'plugins/Unity/Indicators/Network/qml/qmldir'
815--- plugins/Unity/Indicators/Network/qml/qmldir 2013-08-21 21:00:17 +0000
816+++ plugins/Unity/Indicators/Network/qml/qmldir 2013-10-01 19:26:43 +0000
817@@ -2,7 +2,4 @@
818 plugin IndicatorsNetworkQml
819 typeinfo plugin.qmltypes
820
821-NetworkPage 0.1 NetworkPage.qml
822 AccessPoint 0.1 AccessPoint.qml
823-PasswordPage 0.1 PasswordPage.qml
824-PasswordTextField 0.1 PasswordTextField.qml
825\ No newline at end of file
826
827=== removed file 'plugins/Unity/Indicators/Network/secret-agent.c'
828--- plugins/Unity/Indicators/Network/secret-agent.c 2013-06-07 12:51:16 +0000
829+++ plugins/Unity/Indicators/Network/secret-agent.c 1970-01-01 00:00:00 +0000
830@@ -1,382 +0,0 @@
831-/*
832- * Copyright 2013 Canonical Ltd.
833- *
834- * This program is free software; you can redistribute it and/or modify
835- * it under the terms of the GNU Lesser General Public License as published by
836- * the Free Software Foundation; version 3.
837- *
838- * This program is distributed in the hope that it will be useful,
839- * but WITHOUT ANY WARRANTY; without even the implied warranty of
840- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
841- * GNU Lesser General Public License for more details.
842- *
843- * You should have received a copy of the GNU Lesser General Public License
844- * along with this program. If not, see <http://www.gnu.org/licenses/>.
845- *
846- * Authors:
847- * Alberto Ruiz <alberto.ruiz@canonical.com>
848- * Renato Araujo Oliveira Filho <renato@canonical.com>
849- */
850-
851-
852-#include <glib.h>
853-#include <glib-object.h>
854-#include <nm-secret-agent.h>
855-#include "secret-agent.h"
856-
857-#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
858-#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
859-#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
860-#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
861-#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
862-#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
863-#define UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentPrivate))
864-
865-#define AGENT_ID "com.canonical.settings.network.nm-agent"
866-
867-static gpointer unity_settings_secret_agent_parent_class = NULL;
868-
869-typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
870-
871-struct _UnitySettingsSecretAgentPrivate {
872- GQueue *requests;
873-};
874-
875-typedef struct _SecretRequest {
876- gint id;
877- NMSecretAgent *agent;
878- NMConnection *connection;
879- const char *connection_path;
880- const char *setting_name;
881- const char **hints;
882- NMSecretAgentGetSecretsFlags flags;
883- NMSecretAgentGetSecretsFunc callback;
884- gpointer callback_data;
885-} SecretRequest;
886-
887-GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
888-enum {
889- UNITY_SETTINGS_SECRET_AGENT_DUMMY_PROPERTY
890-};
891-
892-enum {
893- SECRET_REQUESTED,
894- REQUEST_CANCELLED,
895- LAST_SIGNAL
896-};
897-
898-static guint signals[LAST_SIGNAL] = { 0 };
899-
900-UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
901-UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
902-
903-int
904-secret_request_find (SecretRequest *req,
905- guint *id)
906-{
907- if (req->id > *id)
908- return -1;
909-
910- if (req->id < *id)
911- return 1;
912-
913- return 0;
914-}
915-
916-void
917-unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
918- guint request,
919- GHashTable *secrets)
920-{
921- GList *iter;
922- SecretRequest *req;
923- UnitySettingsSecretAgentPrivate *priv = agent->priv;
924-
925- iter = g_queue_find_custom (priv->requests,
926- &request,
927- (GCompareFunc)secret_request_find);
928-
929- if (iter == NULL || iter->data == NULL)
930- {
931- g_warning ("Secret request with id <%d> was not found", (int)request);
932- return;
933- }
934-
935- req = iter->data;
936-
937- req->callback (NM_SECRET_AGENT (agent),
938- req->connection,
939- secrets,
940- NULL,
941- req->callback_data);
942-
943- g_queue_remove_all (priv->requests, req);
944- g_free (req);
945- return;
946-}
947-
948-void
949-free_request (SecretRequest *req)
950-{
951- g_object_unref (req->connection);
952- g_free (req);
953-}
954-
955-void
956-unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
957- guint request)
958-{
959- GList *iter;
960- SecretRequest *req;
961- UnitySettingsSecretAgentPrivate *priv = agent->priv;
962- GError *error;
963-
964- iter = g_queue_find_custom (priv->requests,
965- &request,
966- (GCompareFunc)secret_request_find);
967-
968- if (iter == NULL || iter->data == NULL)
969- {
970- g_warning ("Secret request with id <%d> was not found", (int)request);
971- return;
972- }
973-
974- req = iter->data;
975- error = g_error_new (NM_SECRET_AGENT_ERROR,
976- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
977- "This secret request was canceled by the user.");
978-
979- req->callback (NM_SECRET_AGENT (agent),
980- req->connection,
981- NULL,
982- error,
983- req->callback_data);
984-
985- g_queue_remove_all (priv->requests, req);
986- free_request (req);
987- return;
988-}
989-
990-static void
991-delete_secrets (NMSecretAgent *agent,
992- NMConnection *connection,
993- const char *connection_path,
994- NMSecretAgentDeleteSecretsFunc callback,
995- gpointer callback_data)
996-{
997- g_debug ("delete secrets");
998-}
999-
1000-/* If it returns G_MAXUINT it's considered an error */
1001-static guint
1002-find_available_id (UnitySettingsSecretAgentPrivate *priv)
1003-{
1004- guint i = 0;
1005- guint candidate = 0;
1006-
1007- if (g_queue_get_length (priv->requests) == G_MAXUINT)
1008- return G_MAXUINT;
1009-
1010- while (i < g_queue_get_length (priv->requests))
1011- {
1012- SecretRequest *req = (SecretRequest*)g_queue_peek_nth (priv->requests, i);
1013-
1014- if (req->id == candidate)
1015- {
1016- candidate++;
1017- i = 0;
1018- }
1019- else
1020- {
1021- i++;
1022- }
1023- }
1024-
1025- return i;
1026-}
1027-
1028-static void
1029-get_secrets (NMSecretAgent *agent,
1030- NMConnection *connection,
1031- const char *connection_path,
1032- const char *setting_name,
1033- const char **hints,
1034- NMSecretAgentGetSecretsFlags flags,
1035- NMSecretAgentGetSecretsFunc callback,
1036- gpointer callback_data)
1037-{
1038- guint id;
1039- UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
1040- SecretRequest *req = NULL;
1041-
1042- if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)
1043- {
1044- GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
1045- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
1046- "No password found for this connection.");
1047- callback (agent, connection, NULL, error, callback_data);
1048- g_error_free (error);
1049- return;
1050- }
1051-
1052- id = find_available_id (priv);
1053- if (id == G_MAXUINT)
1054- {
1055- GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
1056- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
1057- "Reached maximum number of requests.");
1058- callback (agent, connection, NULL, error, callback_data);
1059- g_error_free (error);
1060- return;
1061- }
1062-
1063- /* Adding a request */
1064- req = (SecretRequest*) g_malloc0 (sizeof (SecretRequest));
1065- *req = ((SecretRequest)
1066- { id,
1067- agent,
1068- connection,
1069- connection_path,
1070- setting_name,
1071- hints,
1072- flags,
1073- callback,
1074- callback_data });
1075-
1076- g_object_ref (connection);
1077-
1078- g_queue_push_tail (priv->requests, req);
1079-
1080- g_signal_emit_by_name (agent,
1081- UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
1082- id,
1083- connection,
1084- setting_name,
1085- hints,
1086- flags);
1087-}
1088-
1089-static void
1090-save_secrets (NMSecretAgent *agent,
1091- NMConnection *connection,
1092- const char *connection_path,
1093- NMSecretAgentSaveSecretsFunc callback,
1094- gpointer callback_data)
1095-{
1096- g_debug ("save secrets");
1097-}
1098-
1099-static void
1100-cancel_get_secrets (NMSecretAgent *agent,
1101- const char *connection_path,
1102- const char *setting_name)
1103-{
1104- g_debug ("cancel get secrets");
1105-}
1106-
1107-UnitySettingsSecretAgent*
1108-unity_settings_secret_agent_construct (GType object_type)
1109-{
1110- UnitySettingsSecretAgent * self = NULL;
1111- self = (UnitySettingsSecretAgent*) g_object_new (object_type,
1112- NM_SECRET_AGENT_IDENTIFIER, AGENT_ID,
1113- NULL);
1114- return self;
1115-}
1116-
1117-
1118-UnitySettingsSecretAgent*
1119-unity_settings_secret_agent_new (void)
1120-{
1121- return unity_settings_secret_agent_construct (UNITY_SETTINGS_TYPE_SECRET_AGENT);
1122-}
1123-
1124-static void
1125-destroy_pending_request (gpointer data)
1126-{
1127- SecretRequest* req = (SecretRequest*)data;
1128- /* Reporting the cancellation of all pending requests */
1129- g_signal_emit_by_name (req->agent,
1130- UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
1131- req->id);
1132-
1133- free_request (req);
1134-}
1135-
1136-static void
1137-unity_settings_secret_agent_finalize (GObject *agent)
1138-{
1139- UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
1140-
1141- g_queue_free_full (priv->requests, destroy_pending_request);
1142-}
1143-
1144-static void
1145-unity_settings_secret_agent_class_init (UnitySettingsSecretAgentClass *klass)
1146-{
1147- unity_settings_secret_agent_parent_class = g_type_class_peek_parent (klass);
1148- NMSecretAgentClass *parent_class = NM_SECRET_AGENT_CLASS (klass);
1149- parent_class->get_secrets = get_secrets;
1150- parent_class->save_secrets = save_secrets;
1151- parent_class->delete_secrets = delete_secrets;
1152- parent_class->cancel_get_secrets = cancel_get_secrets;
1153-
1154- g_type_class_add_private (klass, sizeof(UnitySettingsSecretAgentPrivate));
1155- G_OBJECT_CLASS (klass)->finalize = unity_settings_secret_agent_finalize;
1156-
1157-
1158- signals[SECRET_REQUESTED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
1159- G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
1160- G_SIGNAL_RUN_FIRST,
1161- G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, secret_requested),
1162- NULL, NULL, NULL,
1163- G_TYPE_NONE, 5,
1164- G_TYPE_UINT, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT);
1165-
1166- signals[REQUEST_CANCELLED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
1167- G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
1168- G_SIGNAL_RUN_FIRST,
1169- G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, request_cancelled),
1170- NULL, NULL, NULL,
1171- G_TYPE_NONE, 1,
1172- G_TYPE_UINT);
1173-}
1174-
1175-
1176-static void
1177-unity_settings_secret_agent_instance_init (UnitySettingsSecretAgent *self)
1178-{
1179- self->priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (self);
1180- self->priv->requests = g_queue_new ();
1181-}
1182-
1183-GType
1184-unity_settings_secret_agent_get_type (void)
1185-{
1186- static volatile gsize unity_settings_secret_agent_type_id__volatile = 0;
1187- if (g_once_init_enter (&unity_settings_secret_agent_type_id__volatile))
1188- {
1189- static const GTypeInfo g_define_type_info =
1190- {
1191- sizeof (UnitySettingsSecretAgentClass),
1192- (GBaseInitFunc) NULL,
1193- (GBaseFinalizeFunc) NULL,
1194- (GClassInitFunc) unity_settings_secret_agent_class_init,
1195- (GClassFinalizeFunc) NULL,
1196- NULL,
1197- sizeof (UnitySettingsSecretAgent),
1198- 0,
1199- (GInstanceInitFunc) unity_settings_secret_agent_instance_init,
1200- NULL
1201- };
1202- GType unity_settings_secret_agent_type_id;
1203- unity_settings_secret_agent_type_id = g_type_register_static (NM_TYPE_SECRET_AGENT,
1204- "UnitySettingsSecretAgent",
1205- &g_define_type_info,
1206- 0);
1207- g_once_init_leave (&unity_settings_secret_agent_type_id__volatile,
1208- unity_settings_secret_agent_type_id);
1209- }
1210-
1211- return unity_settings_secret_agent_type_id__volatile;
1212-}
1213
1214=== removed file 'plugins/Unity/Indicators/Network/secret-agent.h'
1215--- plugins/Unity/Indicators/Network/secret-agent.h 2013-06-07 12:51:16 +0000
1216+++ plugins/Unity/Indicators/Network/secret-agent.h 1970-01-01 00:00:00 +0000
1217@@ -1,102 +0,0 @@
1218-/*
1219- * Copyright 2013 Canonical Ltd.
1220- *
1221- * This program is free software; you can redistribute it and/or modify
1222- * it under the terms of the GNU Lesser General Public License as published by
1223- * the Free Software Foundation; version 3.
1224- *
1225- * This program is distributed in the hope that it will be useful,
1226- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1227- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1228- * GNU Lesser General Public License for more details.
1229- *
1230- * You should have received a copy of the GNU Lesser General Public License
1231- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1232- *
1233- * Authors:
1234- * Alberto Ruiz <alberto.ruiz@canonical.com>
1235- * Renato Araujo Oliveira Filho <renato@canonical.com>
1236- */
1237-
1238-#ifndef __SECRET_AGENT_H__
1239-#define __SECRET_AGENT_H__
1240-
1241-#include <glib.h>
1242-#include <glib-object.h>
1243-#include <nm-secret-agent.h>
1244-
1245-/*
1246- * This class is a basic implementation of the NetworkManager SecretAgent base class.
1247- *
1248- * The purpose of this class is to handle credential requests from the network,
1249- * for example, from a WiFi hotspot or a VPN network.
1250- *
1251- * It queues requests objects (SecretRequest) on a GQueue in the private struct
1252- * of the class. And notifies the consumer of the class through the "secret-request"
1253- * and the "request-cancelled" signals with the following callback prototypes:
1254- *
1255- * void (*secret_requested) (UnitySettingsSecretAgent *self,
1256- * guint id,
1257- * NMConnection *connection,
1258- * const char *setting_name,
1259- * const char **hints,
1260- * NMSecretAgentGetSecretsFlags flags,
1261- * gpointer user_data);
1262- *
1263- * void (*request_cancelled) (UnitySettingsSecretAgent *self,
1264- * guint id,
1265- * gpointer user_data);
1266- *
1267- */
1268-
1269-
1270-G_BEGIN_DECLS
1271-
1272-
1273-#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
1274-#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
1275-#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
1276-#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
1277-#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
1278-#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
1279-
1280-#define UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED "secret-requested"
1281-#define UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED "request-cancelled"
1282-
1283-typedef struct _UnitySettingsSecretAgent UnitySettingsSecretAgent;
1284-typedef struct _UnitySettingsSecretAgentClass UnitySettingsSecretAgentClass;
1285-typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
1286-
1287-struct _UnitySettingsSecretAgent {
1288- NMSecretAgent parent_instance;
1289- UnitySettingsSecretAgentPrivate * priv;
1290-};
1291-
1292-struct _UnitySettingsSecretAgentClass {
1293- NMSecretAgentClass parent_class;
1294-
1295- void (*secret_requested) (UnitySettingsSecretAgent *self,
1296- guint id,
1297- NMConnection *connection,
1298- const char *setting_name,
1299- const char **hints,
1300- NMSecretAgentGetSecretsFlags flags);
1301-
1302- void (*request_cancelled) (UnitySettingsSecretAgent *self,
1303- guint id);
1304-};
1305-
1306-
1307-GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
1308-UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
1309-UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
1310-
1311-void unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
1312- guint request,
1313- GHashTable *secrets);
1314-void unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
1315- guint request);
1316-
1317-G_END_DECLS
1318-
1319-#endif
1320
1321=== modified file 'plugins/Utils/CMakeLists.txt'
1322--- plugins/Utils/CMakeLists.txt 2013-07-08 15:12:28 +0000
1323+++ plugins/Utils/CMakeLists.txt 2013-10-01 19:26:43 +0000
1324@@ -9,6 +9,7 @@
1325 qlimitproxymodelqml.cpp
1326 qsortfilterproxymodelqml.cpp
1327 ubuntuwindow.cpp
1328+ unitymenumodelpaths.cpp
1329 plugin.cpp
1330 )
1331
1332@@ -21,7 +22,7 @@
1333 # files directly in targets.
1334 set_target_properties(Utils-qml PROPERTIES COMPILE_FLAGS -fvisibility=default)
1335
1336-qt5_use_modules(Utils-qml Qml Quick)
1337+qt5_use_modules(Utils-qml Qml Quick DBus)
1338
1339 # export the qmldir qmltypes and plugin files
1340 export_qmlfiles(Utils Utils)
1341
1342=== modified file 'plugins/Utils/plugin.cpp'
1343--- plugins/Utils/plugin.cpp 2013-08-23 11:56:44 +0000
1344+++ plugins/Utils/plugin.cpp 2013-10-01 19:26:43 +0000
1345@@ -28,6 +28,7 @@
1346 #include "qlimitproxymodelqml.h"
1347 #include "qsortfilterproxymodelqml.h"
1348 #include "ubuntuwindow.h"
1349+#include "unitymenumodelpaths.h"
1350
1351 static QObject* applicationsPathsSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
1352 Q_UNUSED(engine);
1353@@ -41,6 +42,7 @@
1354 qmlRegisterType<QAbstractItemModel>();
1355 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
1356 qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
1357+ qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
1358 qmlRegisterExtendedType<QQuickWindow, UbuntuWindow>(uri, 0, 1, "Window");
1359 qmlRegisterSingletonType<ApplicationPaths>(uri, 0, 1, "ApplicationPaths", applicationsPathsSingleton);
1360 }
1361
1362=== added file 'plugins/Utils/unitymenumodelpaths.cpp'
1363--- plugins/Utils/unitymenumodelpaths.cpp 1970-01-01 00:00:00 +0000
1364+++ plugins/Utils/unitymenumodelpaths.cpp 2013-10-01 19:26:43 +0000
1365@@ -0,0 +1,182 @@
1366+/*
1367+ * Copyright (C) 2013 Canonical, Ltd.
1368+ *
1369+ * This program is free software; you can redistribute it and/or modify
1370+ * it under the terms of the GNU General Public License as published by
1371+ * the Free Software Foundation; version 3.
1372+ *
1373+ * This program is distributed in the hope that it will be useful,
1374+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1375+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1376+ * GNU General Public License for more details.
1377+ *
1378+ * You should have received a copy of the GNU General Public License
1379+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1380+ *
1381+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
1382+ */
1383+
1384+
1385+#include "unitymenumodelpaths.h"
1386+#include <QDBusArgument>
1387+
1388+static QVariant parseVariantData(const QVariant& var);
1389+
1390+const QDBusArgument &operator>>(const QDBusArgument &arg, QVariantMap &map)
1391+{
1392+ arg.beginMap();
1393+ map.clear();
1394+ while (!arg.atEnd()) {
1395+ QString key;
1396+ QVariant value;
1397+ arg.beginMapEntry();
1398+
1399+ arg >> key >> value;
1400+ map.insertMulti(key, parseVariantData(value)); // re-parse for qdbusargument
1401+
1402+ arg.endMapEntry();
1403+ }
1404+ arg.endMap();
1405+ return arg;
1406+}
1407+
1408+static QVariant parseVariantData(const QVariant& var) {
1409+ if ((int)var.type() == QMetaType::User && var.userType() == qMetaTypeId<QDBusArgument>()) {
1410+ QDBusArgument arg(var.value<QDBusArgument>());
1411+ if (arg.currentType() == QDBusArgument::MapType) {
1412+ QVariantMap map;
1413+ arg >> map;
1414+ return map;
1415+ }
1416+ return arg.asVariant();
1417+ }
1418+
1419+ return var;
1420+}
1421+
1422+UnityMenuModelPaths::UnityMenuModelPaths(QObject *parent)
1423+ : QObject(parent)
1424+{
1425+}
1426+
1427+QVariant UnityMenuModelPaths::source() const
1428+{
1429+ return m_sourceData;
1430+}
1431+
1432+void UnityMenuModelPaths::setSource(const QVariant& data)
1433+{
1434+ if (m_sourceData != data) {
1435+ m_sourceData = data;
1436+ Q_EMIT sourceChanged();
1437+
1438+ updateData();
1439+ }
1440+}
1441+
1442+void UnityMenuModelPaths::updateData()
1443+{
1444+ QVariantMap dataMap = parseVariantData(m_sourceData).toMap();
1445+
1446+ if (!m_busNameHint.isEmpty() && dataMap.contains(m_busNameHint)) {
1447+ setBusName(dataMap[m_busNameHint].toByteArray());
1448+ } else {
1449+ setBusName("");
1450+ }
1451+
1452+ if (!m_menuObjectPathHint.isEmpty() && dataMap.contains(m_menuObjectPathHint)) {
1453+ setMenuObjectPath(dataMap[m_menuObjectPathHint].toByteArray());
1454+ } else {
1455+ setMenuObjectPath("");
1456+ }
1457+
1458+ if (!m_actionsHint.isEmpty() && dataMap.contains(m_actionsHint)) {
1459+ setActions(dataMap[m_actionsHint].toMap());
1460+ } else {
1461+ setActions(QVariantMap());
1462+ }
1463+}
1464+
1465+QByteArray UnityMenuModelPaths::busName() const
1466+{
1467+ return m_busName;
1468+}
1469+
1470+void UnityMenuModelPaths::setBusName(const QByteArray &name)
1471+{
1472+ if (m_busName != name) {
1473+ m_busName = name;
1474+ Q_EMIT busNameChanged();
1475+ }
1476+}
1477+
1478+QVariantMap UnityMenuModelPaths::actions() const
1479+{
1480+ return m_actions;
1481+}
1482+
1483+void UnityMenuModelPaths::setActions(const QVariantMap &actions)
1484+{
1485+ if (m_actions != actions) {
1486+ m_actions = actions;
1487+ Q_EMIT actionsChanged();
1488+ }
1489+}
1490+
1491+QByteArray UnityMenuModelPaths::menuObjectPath() const
1492+{
1493+ return m_menuObjectPath;
1494+}
1495+
1496+void UnityMenuModelPaths::setMenuObjectPath(const QByteArray &path)
1497+{
1498+ if (m_menuObjectPath != path) {
1499+ m_menuObjectPath = path;
1500+ Q_EMIT menuObjectPathChanged();
1501+ }
1502+}
1503+
1504+QByteArray UnityMenuModelPaths::busNameHint() const
1505+{
1506+ return m_busNameHint;
1507+}
1508+
1509+void UnityMenuModelPaths::setBusNameHint(const QByteArray &nameHint)
1510+{
1511+ if (m_busNameHint != nameHint) {
1512+ m_busNameHint = nameHint;
1513+ Q_EMIT busNameHintChanged();
1514+
1515+ updateData();
1516+ }
1517+}
1518+
1519+QByteArray UnityMenuModelPaths::actionsHint() const
1520+{
1521+ return m_actionsHint;
1522+}
1523+
1524+void UnityMenuModelPaths::setActionsHint(const QByteArray &actionsHint)
1525+{
1526+ if (m_actionsHint != actionsHint) {
1527+ m_actionsHint = actionsHint;
1528+ Q_EMIT actionsHintChanged();
1529+
1530+ updateData();
1531+ }
1532+}
1533+
1534+QByteArray UnityMenuModelPaths::menuObjectPathHint() const
1535+{
1536+ return m_menuObjectPathHint;
1537+}
1538+
1539+void UnityMenuModelPaths::setMenuObjectPathHint(const QByteArray &pathHint)
1540+{
1541+ if (m_menuObjectPathHint != pathHint) {
1542+ m_menuObjectPathHint = pathHint;
1543+ Q_EMIT menuObjectPathHintChanged();
1544+
1545+ updateData();
1546+ }
1547+}
1548\ No newline at end of file
1549
1550=== added file 'plugins/Utils/unitymenumodelpaths.h'
1551--- plugins/Utils/unitymenumodelpaths.h 1970-01-01 00:00:00 +0000
1552+++ plugins/Utils/unitymenumodelpaths.h 2013-10-01 19:26:43 +0000
1553@@ -0,0 +1,82 @@
1554+/*
1555+ * Copyright (C) 2013 Canonical, Ltd.
1556+ *
1557+ * This program is free software; you can redistribute it and/or modify
1558+ * it under the terms of the GNU General Public License as published by
1559+ * the Free Software Foundation; version 3.
1560+ *
1561+ * This program is distributed in the hope that it will be useful,
1562+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1563+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1564+ * GNU General Public License for more details.
1565+ *
1566+ * You should have received a copy of the GNU General Public License
1567+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1568+ *
1569+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
1570+ */
1571+
1572+#ifndef UNITY_MENU_MODEL_PATHS_H
1573+#define UNITY_MENU_MODEL_PATHS_H
1574+
1575+#include <QVariant>
1576+
1577+class UnityMenuModelPaths : public QObject
1578+{
1579+ Q_OBJECT
1580+
1581+ Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged)
1582+ Q_PROPERTY(QByteArray busName READ busName NOTIFY busNameChanged)
1583+ Q_PROPERTY(QVariantMap actions READ actions NOTIFY actionsChanged)
1584+ Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath NOTIFY menuObjectPathChanged)
1585+
1586+ Q_PROPERTY(QByteArray busNameHint READ busNameHint WRITE setBusNameHint NOTIFY busNameHintChanged)
1587+ Q_PROPERTY(QByteArray actionsHint READ actionsHint WRITE setActionsHint NOTIFY actionsHintChanged)
1588+ Q_PROPERTY(QByteArray menuObjectPathHint READ menuObjectPathHint WRITE setMenuObjectPathHint NOTIFY menuObjectPathHintChanged)
1589+
1590+public:
1591+ explicit UnityMenuModelPaths(QObject *parent = 0);
1592+
1593+ QVariant source() const;
1594+ void setSource(const QVariant& data);
1595+
1596+ QByteArray busName() const;
1597+ QVariantMap actions() const;
1598+ QByteArray menuObjectPath() const;
1599+
1600+ QByteArray busNameHint() const;
1601+ QByteArray actionsHint() const;
1602+ QByteArray menuObjectPathHint() const;
1603+
1604+Q_SIGNALS:
1605+ void sourceChanged();
1606+ void busNameChanged();
1607+ void actionsChanged();
1608+ void menuObjectPathChanged();
1609+
1610+ void busNameHintChanged();
1611+ void actionsHintChanged();
1612+ void menuObjectPathHintChanged();
1613+
1614+private:
1615+ void setBusName(const QByteArray &name);
1616+ void setActions(const QVariantMap& actions);
1617+ void setMenuObjectPath(const QByteArray &path);
1618+
1619+ void setBusNameHint(const QByteArray& nameHint);
1620+ void setActionsHint(const QByteArray &actionsHint);
1621+ void setMenuObjectPathHint(const QByteArray &pathHint);
1622+
1623+ void updateData();
1624+
1625+ QVariant m_sourceData;
1626+ QByteArray m_busName;
1627+ QVariantMap m_actions;
1628+ QByteArray m_menuObjectPath;
1629+
1630+ QByteArray m_busNameHint;
1631+ QByteArray m_actionsHint;
1632+ QByteArray m_menuObjectPathHint;
1633+};
1634+
1635+#endif // UNITY_MENU_MODEL_PATHS_H
1636
1637=== added file 'tests/mocks/QMenuModel/UnityMenuModel.qml'
1638--- tests/mocks/QMenuModel/UnityMenuModel.qml 1970-01-01 00:00:00 +0000
1639+++ tests/mocks/QMenuModel/UnityMenuModel.qml 2013-10-01 19:26:43 +0000
1640@@ -0,0 +1,26 @@
1641+/*
1642+ * Copyright (C) 2013 Canonical, Ltd.
1643+ *
1644+ * Authors:
1645+ * Mirco Müller <mirco.mueller@canonical.com>
1646+ *
1647+ * This program is free software; you can redistribute it and/or modify
1648+ * it under the terms of the GNU General Public License as published by
1649+ * the Free Software Foundation; version 3.
1650+ *
1651+ * This program is distributed in the hope that it will be useful,
1652+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1653+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1654+ * GNU General Public License for more details.
1655+ *
1656+ * You should have received a copy of the GNU General Public License
1657+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1658+ */
1659+
1660+import QtQuick 2.0
1661+
1662+QtObject {
1663+ property variant busName
1664+ property variant actions
1665+ property variant menuObjectPath
1666+}
1667
1668=== modified file 'tests/mocks/QMenuModel/qmldir'
1669--- tests/mocks/QMenuModel/qmldir 2013-07-26 11:10:55 +0000
1670+++ tests/mocks/QMenuModel/qmldir 2013-10-01 19:26:43 +0000
1671@@ -1,2 +1,3 @@
1672 module QMenuModel
1673 QDBusActionGroup 0.1 QDBusActionGroup.qml
1674+UnityMenuModel 0.1 UnityMenuModel.qml
1675
1676=== modified file 'tests/qmltests/CMakeLists.txt'
1677--- tests/qmltests/CMakeLists.txt 2013-09-25 14:13:46 +0000
1678+++ tests/qmltests/CMakeLists.txt 2013-10-01 19:26:43 +0000
1679@@ -63,7 +63,7 @@
1680 add_qml_test(Hud Hud)
1681 add_qml_test(Hud Result)
1682 add_qml_test(Launcher Launcher IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
1683-add_qml_test(Notifications Notifications IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_SOURCE_DIR}/tests/mocks)
1684+add_qml_test(Notifications Notifications IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_SOURCE_DIR}/tests/mocks)
1685 add_qml_test(Panel IndicatorRow)
1686 add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
1687 add_qml_test(Panel MenuContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})

Subscribers

People subscribed via source and target branches