Merge lp:~mardy/signon-ui/remove-notification into lp:signon-ui

Proposed by Alberto Mardegan on 2012-09-14
Status: Merged
Approved by: David King on 2012-09-14
Approved revision: 60
Merged at revision: 60
Proposed branch: lp:~mardy/signon-ui/remove-notification
Merge into: lp:signon-ui
Diff against target: 138 lines (+9/-43)
3 files modified
src/indicator-service.cpp (+5/-38)
src/src.pro (+0/-1)
tests/unit/test.cpp (+4/-4)
To merge this branch: bzr merge lp:~mardy/signon-ui/remove-notification
Reviewer Review Type Date Requested Status
jenkins (community) continuous-integration Approve on 2012-09-14
David King (community) 2012-09-14 Approve on 2012-09-14
Review via email: mp+124352@code.launchpad.net

Description of the change

Don't emit an OSD notification when accounts fail to authenticate.

To post a comment you must log in.
David King (amigadave) :
review: Approve
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator-service.cpp'
2--- src/indicator-service.cpp 2012-03-06 13:54:30 +0000
3+++ src/indicator-service.cpp 2012-09-14 07:20:25 +0000
4@@ -24,11 +24,6 @@
5 #include "i18n.h"
6 #include "webcredentials_adaptor.h"
7
8-#include <QByteArray>
9-#undef signals
10-#include <libnotify/notification.h>
11-#include <libnotify/notify.h>
12-
13 using namespace SignOnUi;
14
15 QDBusArgument &operator<<(QDBusArgument &argument, const QSet<uint> &set)
16@@ -79,7 +74,7 @@
17 void ReportFailure(uint accountId, const QVariantMap &notification);
18
19 private:
20- void showNotification(const QVariantMap &parameters);
21+ void setErrorStatus();
22 void notifyPropertyChanged(const char *propertyName);
23
24 private:
25@@ -98,7 +93,6 @@
26 m_errorStatus(false)
27 {
28 qDBusRegisterMetaType< QSet<uint> >();
29- notify_init("webcredentials-indicator");
30 }
31
32 void IndicatorServicePrivate::ClearErrorStatus()
33@@ -118,13 +112,15 @@
34 void IndicatorServicePrivate::ReportFailure(uint accountId,
35 const QVariantMap &notification)
36 {
37+ Q_UNUSED(notification);
38+
39 m_failures.insert(accountId);
40 notifyPropertyChanged("Failures");
41
42- showNotification(notification);
43+ setErrorStatus();
44 }
45
46-void IndicatorServicePrivate::showNotification(const QVariantMap &parameters)
47+void IndicatorServicePrivate::setErrorStatus()
48 {
49 /* Don't show more than one notification, until the error status is
50 * cleared */
51@@ -132,35 +128,6 @@
52
53 m_errorStatus = true;
54 notifyPropertyChanged("ErrorStatus");
55-
56- QString applicationName = parameters.value("DisplayName").toString();
57-
58- QString summary;
59- if (applicationName.isEmpty()) {
60- summary = _("Applications can no longer access "
61- "some of your Web Accounts");
62- } else {
63- summary = _("Applications can no longer access "
64- "your %1 Web Account").arg(applicationName);
65- }
66-
67- QString message = _("Choose <b>Web Accounts</b> from the user "
68- "menu to reinstate access to this account.");
69-
70- QByteArray summaryUtf8 = summary.toUtf8();
71- QByteArray messageUtf8 = message.toUtf8();
72- NotifyNotification *notification =
73- notify_notification_new(summaryUtf8.constData(),
74- messageUtf8.constData(),
75- NULL);
76-
77- GError *error = NULL;
78- if (!notify_notification_show(notification, &error)) {
79- BLAME() << "Couldn't show notification:" << error->message;
80- g_clear_error(&error);
81- }
82-
83- g_object_unref(notification);
84 }
85
86 void IndicatorServicePrivate::notifyPropertyChanged(const char *propertyName)
87
88=== modified file 'src/src.pro'
89--- src/src.pro 2012-06-01 12:19:02 +0000
90+++ src/src.pro 2012-09-14 07:20:25 +0000
91@@ -21,7 +21,6 @@
92 PKGCONFIG += \
93 accounts-qt \
94 signon-plugins-common \
95- libnotify \
96 libsignon-qt
97
98 HEADERS = \
99
100=== modified file 'tests/unit/test.cpp'
101--- tests/unit/test.cpp 2012-03-29 05:54:19 +0000
102+++ tests/unit/test.cpp 2012-09-14 07:20:25 +0000
103@@ -160,7 +160,7 @@
104
105 // Report the first failure
106 service->reportFailure(firstFailure, QVariantMap());
107- QCOMPARE(FakeLibNotify::notificationCount(), 1);
108+ QCOMPARE(FakeLibNotify::notificationCount(), 0);
109 QCOMPARE(service->errorStatus(), true);
110 QCOMPARE(service->failures().count(), 1);
111 QVERIFY(service->failures().contains(firstFailure));
112@@ -171,7 +171,7 @@
113 foreach (uint id, moreFailures) {
114 service->reportFailure(id, QVariantMap());
115 }
116- QCOMPARE(FakeLibNotify::notificationCount(), 1);
117+ QCOMPARE(FakeLibNotify::notificationCount(), 0);
118 QCOMPARE(service->errorStatus(), true);
119 QCOMPARE(service->failures().count(), 1 + moreFailures.count());
120
121@@ -181,7 +181,7 @@
122 service->removeFailures(removedFailures);
123 QSet<uint> remainingFailures;
124 remainingFailures << 412 << 1 << 144;
125- QCOMPARE(FakeLibNotify::notificationCount(), 1);
126+ QCOMPARE(FakeLibNotify::notificationCount(), 0);
127 QCOMPARE(service->errorStatus(), true);
128 QCOMPARE(service->failures(), remainingFailures);
129
130@@ -192,7 +192,7 @@
131
132 // Send one more failure
133 service->reportFailure(3, QVariantMap());
134- QCOMPARE(FakeLibNotify::notificationCount(), 2);
135+ QCOMPARE(FakeLibNotify::notificationCount(), 0);
136 QCOMPARE(service->errorStatus(), true);
137
138 delete service;

Subscribers

People subscribed via source and target branches

to all changes: