1
commit 81839a1566d0c0209a308d71b03837f996a19c96
2
Author: Lukáš Tinkl <lukas@kde.org>
3
Date: Sat Sep 6 17:54:00 2014 +0200
5
delay the notifications and secret agent initializations until needed
10
Index: plasma-nm/kded/service.cpp
11
===================================================================
12
--- plasma-nm.orig/kded/service.cpp 2014-09-15 09:53:43.409980948 +0200
13
+++ plasma-nm/kded/service.cpp 2014-09-15 09:53:43.369982542 +0200
16
Q_D(NetworkManagementService);
18
- QDBusReply<bool> notificationsReply = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.freedesktop.Notifications");
19
- if (notificationsReply.value()) {
20
- initializeNotifications();
22
- QDBusServiceWatcher * watcher = new QDBusServiceWatcher("org.freedesktop.Notifications", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
23
- connect(watcher, SIGNAL(serviceRegistered()), this, SLOT(doInitializeNotifications()));
25
+ d->agent = Q_NULLPTR;
26
+ d->notification = Q_NULLPTR;
28
#if WITH_MODEMMANAGER_SUPPORT
29
- d->modemMonitor = new ModemMonitor(this);
30
+ d->modemMonitor = Q_NULLPTR;
32
- d->bluetoothMonitor = new BluetoothMonitor(this);
33
- d->agent = new SecretAgent(this);
34
+ d->bluetoothMonitor = Q_NULLPTR;
37
NetworkManagementService::~NetworkManagementService()
42
-void NetworkManagementService::doInitializeNotifications()
43
+void NetworkManagementService::init()
45
- QDBusServiceWatcher * watcher = static_cast<QDBusServiceWatcher*>(sender());
46
- watcher->deleteLater();
47
+ Q_D(NetworkManagementService);
49
- initializeNotifications();
52
+ d->agent = new SecretAgent(this);
55
-void NetworkManagementService::initializeNotifications()
57
- Q_D(NetworkManagementService);
58
+ if (!d->notification) {
59
+ d->notification = new Notification(this);
62
+#if WITH_MODEMMANAGER_SUPPORT
63
+ if (!d->modemMonitor) {
64
+ d->modemMonitor = new ModemMonitor(this);
68
- d->notification = new Notification(this);
69
+ if (!d->bluetoothMonitor) {
70
+ d->bluetoothMonitor = new BluetoothMonitor(this);
73
Index: plasma-nm/kded/service.h
74
===================================================================
75
--- plasma-nm.orig/kded/service.h 2014-09-15 09:53:43.409980948 +0200
76
+++ plasma-nm/kded/service.h 2014-09-15 09:53:43.369982542 +0200
79
class PLASMA_NM_EXPORT NetworkManagementService : public KDEDModule
81
+ Q_CLASSINFO("D-Bus Interface", "org.kde.plasmanetworkmanagement")
83
Q_DECLARE_PRIVATE(NetworkManagementService)
85
NetworkManagementService(QObject * parent, const QVariantList&);
86
virtual ~NetworkManagementService();
89
- void doInitializeNotifications();
90
+ Q_SCRIPTABLE void init();
93
NetworkManagementServicePrivate * d_ptr;
95
- void initializeNotifications();
98
#endif // PLASMANM_KDED_SERVICE_H
99
Index: plasma-nm/libs/handler.cpp
100
===================================================================
101
--- plasma-nm.orig/libs/handler.cpp 2014-09-15 09:53:43.409980948 +0200
102
+++ plasma-nm/libs/handler.cpp 2014-09-15 09:53:43.369982542 +0200
104
, m_tmpWimaxEnabled(NetworkManager::isWimaxEnabled())
105
, m_tmpWirelessEnabled(NetworkManager::isWirelessEnabled())
106
, m_tmpWwanEnabled(NetworkManager::isWwanEnabled())
107
+ , m_agentIface(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/networkmanagement"),
108
+ QStringLiteral("org.kde.plasmanetworkmanagement"))
110
+ m_agentIface.call(QStringLiteral("init"));
114
Index: plasma-nm/libs/handler.h
115
===================================================================
116
--- plasma-nm.orig/libs/handler.h 2014-09-15 09:53:43.409980948 +0200
117
+++ plasma-nm/libs/handler.h 2014-09-15 09:53:43.369982542 +0200
119
#ifndef PLASMA_NM_HANDLER_H
120
#define PLASMA_NM_HANDLER_H
122
+#include <QDBusInterface>
124
#include <NetworkManagerQt/Connection>
126
#include "plasmanm_export.h"
128
QString m_tmpSpecificPath;
131
+ QDBusInterface m_agentIface;
134
#endif // PLASMA_NM_HANDLER_H