Merge lp:~diegosarmentero/ubuntu-system-settings/click-notifications into lp:ubuntu-system-settings

Proposed by Diego Sarmentero
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 698
Merged at revision: 703
Proposed branch: lp:~diegosarmentero/ubuntu-system-settings/click-notifications
Merge into: lp:ubuntu-system-settings
Diff against target: 161 lines (+103/-13)
2 files modified
plugins/system-update/plugin/CMakeLists.txt (+8/-4)
plugins/system-update/plugin/update-plugin.cpp (+95/-9)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntu-system-settings/click-notifications
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+218644@code.launchpad.net

Commit message

- Show click updates notifications in main page.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, I've built that one but the settings happen fails to start with it

system-settings: symbol lookup error: /usr/lib/i386-linux-gnu/ubuntu-system-settings/libupdate-plugin.so: undefined symbol: _ZN12UpdatePlugin13UpdateManagerC1EP7QObject

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> Thanks, I've built that one but the settings happen fails to start with it
>
> system-settings: symbol lookup error: /usr/lib/i386-linux-gnu/ubuntu-system-
> settings/libupdate-plugin.so: undefined symbol:
> _ZN12UpdatePlugin13UpdateManagerC1EP7QObject

Have you installed both of these files?
libsystemsettings1_0.1+14.04.20140411-0ubuntu2_armhf.deb
ubuntu-system-settings_0.1+14.04.20140411-0ubuntu2_armhf.deb

I'm testing it in the phone installing those and it works.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

current version works fine for me, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/system-update/plugin/CMakeLists.txt'
2--- plugins/system-update/plugin/CMakeLists.txt 2014-01-31 15:07:01 +0000
3+++ plugins/system-update/plugin/CMakeLists.txt 2014-05-12 14:36:49 +0000
4@@ -1,9 +1,13 @@
5+SET (CMAKE_AUTOMOC ON)
6 include_directories(${CMAKE_CURRENT_BINARY_DIR})
7
8-add_definitions(-DQT_NO_KEYWORDS)
9+add_library(update-plugin SHARED update-plugin.h update-plugin.cpp ../update.cpp ../update.h
10+../system_update.cpp ../system_update.h ../network/network.h ../network/network.cpp)
11
12-add_library(update-plugin SHARED update-plugin.h update-plugin.cpp ../update.cpp ../update.h ../system_update.cpp ../system_update.h)
13-qt5_use_modules(update-plugin Core Qml Quick DBus)
14+qt5_use_modules(update-plugin Core Qml Quick Network DBus)
15 include_directories(/usr/include/apt-pkg/)
16-target_link_libraries(update-plugin SystemSettings apt-pkg)
17+pkg_check_modules(UBUNTUONEAUTH REQUIRED ubuntuoneauth-2.0)
18+add_definitions(${UBUNTUONEAUTH_CFLAGS} ${UBUNTUONEAUTH_CFLAGS_OTHER})
19+
20+target_link_libraries(update-plugin SystemSettings apt-pkg ${UBUNTUONEAUTH_LDFLAGS})
21 install(TARGETS update-plugin DESTINATION ${PLUGIN_MODULE_DIR})
22
23=== modified file 'plugins/system-update/plugin/update-plugin.cpp'
24--- plugins/system-update/plugin/update-plugin.cpp 2014-02-20 12:22:22 +0000
25+++ plugins/system-update/plugin/update-plugin.cpp 2014-05-12 14:36:49 +0000
26@@ -24,9 +24,20 @@
27 #include <QStringList>
28 #include <SystemSettings/ItemBase>
29
30+#include <token.h>
31+#include <ssoservice.h>
32+#include <QProcess>
33+#include <QJsonDocument>
34+#include <QJsonObject>
35+#include <QJsonArray>
36+#include <QJsonValue>
37+#include <QHash>
38 #include "../system_update.h"
39+#include "../update.h"
40+#include "../network/network.h"
41
42 using namespace SystemSettings;
43+using namespace UbuntuOne;
44 using namespace UpdatePlugin;
45
46 class UpdateItem: public ItemBase
47@@ -38,11 +49,34 @@
48 void setVisibility(bool visible);
49 ~UpdateItem();
50
51+Q_SIGNALS:
52+ void checkFinished();
53+ void modelChanged();
54+ void updatesNotFound();
55+ void credentialsNotFound();
56+ void updateAvailableFound(bool downloading);
57+ void errorFound();
58+ void downloadModeChanged();
59+ void systemUpdateDownloaded();
60+ void updateProcessFailed(QString message);
61+ void systemUpdateFailed(int consecutiveFailureCount, QString lastReason);
62+
63 private Q_SLOTS:
64- void changeVisibility(const QString& package, Update* update);
65+ void changeVisibility(const QString&, Update*);
66+ void systemUpdatePaused(int value);
67+ void processOutput();
68+ void processUpdates();
69+ void downloadUrlObtained(const QString &packagename, const QString &url);
70+ void handleCredentialsFound(Token token);
71+ void clickTokenReceived(Update *app, const QString &clickToken);
72
73 private:
74 SystemUpdate m_systemUpdate;
75+ Token m_token;
76+ UpdatePlugin::Network m_network;
77+ QProcess m_process;
78+ SSOService m_service;
79+ QHash<QString, Update*> m_apps;
80 };
81
82 UpdateItem::UpdateItem(const QVariantMap &staticData, QObject *parent):
83@@ -50,18 +84,70 @@
84 m_systemUpdate(this)
85 {
86 setVisibility(false);
87+ // SYSTEM UPDATE
88 QObject::connect(&m_systemUpdate, SIGNAL(updateAvailable(const QString&, Update*)),
89 this, SLOT(changeVisibility(const QString&, Update*)));
90
91+ // SSO SERVICE
92+ QObject::connect(&m_service, SIGNAL(credentialsFound(const Token&)),
93+ this, SLOT(handleCredentialsFound(Token)));
94+ // PROCESS
95+ QObject::connect(&m_process, SIGNAL(finished(int)),
96+ this, SLOT(processOutput()));
97+ // NETWORK
98+ QObject::connect(&m_network, SIGNAL(updatesFound()),
99+ this, SLOT(processUpdates()));
100+
101 m_systemUpdate.checkForUpdate();
102-}
103-
104-void UpdateItem::changeVisibility(const QString& package, Update* update)
105-{
106- Q_UNUSED(package);
107- if (update->updateRequired()) {
108- setVisibility(true);
109- }
110+ m_service.getCredentials();
111+}
112+
113+void UpdateItem::handleCredentialsFound(Token token)
114+{
115+ m_token = token;
116+ QStringList args("list");
117+ args << "--manifest";
118+ QString command("click");
119+ m_process.start(command, args);
120+}
121+
122+void UpdateItem::processOutput()
123+{
124+ QString output(m_process.readAllStandardOutput());
125+
126+ QJsonDocument document = QJsonDocument::fromJson(output.toUtf8());
127+
128+ QJsonArray array = document.array();
129+
130+ int i;
131+ for (i = 0; i < array.size(); i++) {
132+ QJsonObject object = array.at(i).toObject();
133+ QString name = object.value("name").toString();
134+ QString title = object.value("title").toString();
135+ QString version = object.value("version").toString();
136+ Update *app = new Update();
137+ app->initializeApplication(name, title, version);
138+ m_apps[app->getPackageName()] = app;
139+ }
140+
141+ m_network.checkForNewVersions(m_apps);
142+}
143+
144+
145+void UpdateItem::processUpdates()
146+{
147+ foreach (QString id, m_apps.keys()) {
148+ Update *app = m_apps.value(id);
149+ if(app->updateRequired()) {
150+ setVisibility(true);
151+ break;
152+ }
153+ }
154+}
155+
156+void UpdateItem::changeVisibility(const QString&, Update*)
157+{
158+ setVisibility(true);
159 }
160
161 void UpdateItem::setVisibility(bool visible)

Subscribers

People subscribed via source and target branches