Merge lp:~mardy/ubuntu-system-settings-online-accounts/window-raising into lp:~mardy/ubuntu-system-settings-online-accounts/master

Proposed by Alberto Mardegan
Status: Merged
Merged at revision: 120
Proposed branch: lp:~mardy/ubuntu-system-settings-online-accounts/window-raising
Merge into: lp:~mardy/ubuntu-system-settings-online-accounts/master
Diff against target: 100 lines (+35/-3)
3 files modified
src/panel-request.cpp (+6/-0)
src/provider-request.cpp (+10/-0)
system-settings-plugin/plugin.cpp (+19/-3)
To merge this branch: bzr merge lp:~mardy/ubuntu-system-settings-online-accounts/window-raising
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Justin McPherson Pending
Alberto Mardegan Pending
Review via email: mp+221528@code.launchpad.net

Description of the change

When processing completes, raise the caller application

Under unity8, use QDesktopServices to raise the application which invoked OA. Also, avoid queuing requests to open OA from the System Settings.

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

The workarounds are fine. Hopefully they won't be needed for long.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/panel-request.cpp'
2--- src/panel-request.cpp 2014-05-09 10:52:01 +0000
3+++ src/panel-request.cpp 2014-05-30 11:54:13 +0000
4@@ -23,6 +23,8 @@
5 #include "globals.h"
6 #include "panel-request.h"
7
8+#include <QDesktopServices>
9+#include <QGuiApplication>
10 #include <QStandardPaths>
11 #include <QQmlContext>
12 #include <QQmlEngine>
13@@ -101,6 +103,10 @@
14
15 if (!visible) {
16 q->setResult(QVariantMap());
17+ /* FIXME HACK: remove when window reparenting is implemented */
18+ if (QGuiApplication::platformName().startsWith("ubuntu")) {
19+ QDesktopServices::openUrl(QUrl("application:///ubuntu-system-settings.desktop"));
20+ }
21 }
22 }
23
24
25=== modified file 'src/provider-request.cpp'
26--- src/provider-request.cpp 2014-02-03 10:27:39 +0000
27+++ src/provider-request.cpp 2014-05-30 11:54:13 +0000
28@@ -24,6 +24,8 @@
29 #include "globals.h"
30 #include "provider-request.h"
31
32+#include <QDesktopServices>
33+#include <QGuiApplication>
34 #include <QQmlContext>
35 #include <QQmlEngine>
36 #include <QQuickItem>
37@@ -133,6 +135,14 @@
38
39 if (!visible) {
40 q->setResult(QVariantMap());
41+ /* FIXME HACK: remove when window reparenting is implemented */
42+ QString profile =
43+ m_applicationInfo.value(QStringLiteral("profile")).toString();
44+ if (QGuiApplication::platformName().startsWith("ubuntu") &&
45+ !profile.isEmpty()) {
46+ QDesktopServices::openUrl(
47+ QUrl(QString("application:///%1.desktop").arg(profile)));
48+ }
49 }
50 }
51
52
53=== modified file 'system-settings-plugin/plugin.cpp'
54--- system-settings-plugin/plugin.cpp 2013-09-09 10:56:53 +0000
55+++ system-settings-plugin/plugin.cpp 2014-05-30 11:54:13 +0000
56@@ -36,13 +36,20 @@
57 QQmlComponent *pageComponent(QQmlEngine *engine,
58 QObject *parent = 0) Q_DECL_OVERRIDE;
59
60+private Q_SLOTS:
61+ void onFinished();
62+
63 private:
64 OnlineAccountsClient::Setup m_setup;
65+ bool m_isOpen;
66 };
67
68 Item::Item(const QVariantMap &staticData, QObject *parent):
69- ItemBase(staticData, parent)
70+ ItemBase(staticData, parent),
71+ m_isOpen(false)
72 {
73+ QObject::connect(&m_setup, SIGNAL(finished()),
74+ this, SLOT(onFinished()));
75 }
76
77 Item::~Item()
78@@ -54,11 +61,20 @@
79 {
80 Q_UNUSED(engine);
81 Q_UNUSED(parent);
82- qDebug() << "Opening Online Accounts";
83- m_setup.exec();
84+
85+ if (!m_isOpen) {
86+ qDebug() << "Opening Online Accounts";
87+ m_isOpen = true;
88+ m_setup.exec();
89+ }
90 return 0;
91 }
92
93+void Item::onFinished()
94+{
95+ m_isOpen = false;
96+}
97+
98 Plugin::Plugin():
99 QObject()
100 {

Subscribers

People subscribed via source and target branches

to all changes: