mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kinit: cache the QDBusConnectionInterface
it will not change because the connection is persistent Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
5177126cc6
commit
ac048407c3
2 changed files with 7 additions and 4 deletions
|
@ -39,9 +39,11 @@ static const int s_sleeptime = 50;
|
|||
static const qint64 s_servicetimeout = 10000; // 10sec
|
||||
|
||||
KLauncherAdaptor::KLauncherAdaptor(QObject *parent)
|
||||
: QDBusAbstractAdaptor(parent)
|
||||
: QDBusAbstractAdaptor(parent),
|
||||
m_dbusconnectioninterface(nullptr)
|
||||
{
|
||||
m_environment = QProcessEnvironment::systemEnvironment();
|
||||
m_dbusconnectioninterface = QDBusConnection::sessionBus().interface();
|
||||
}
|
||||
|
||||
KLauncherAdaptor::~KLauncherAdaptor()
|
||||
|
@ -263,11 +265,10 @@ int KLauncherAdaptor::start_service_by_desktop_path(const QString &serviceName,
|
|||
dbusServiceName.append(QString::number(pid));
|
||||
}
|
||||
kDebug() << "waiting for" << pid << dbusServiceName;
|
||||
QDBusConnection session = QDBusConnection::sessionBus();
|
||||
QElapsedTimer elapsedtime;
|
||||
elapsedtime.start();
|
||||
while (true) {
|
||||
QDBusReply<bool> sessionreply = session.interface()->isServiceRegistered(dbusServiceName);
|
||||
QDBusReply<bool> sessionreply = m_dbusconnectioninterface->isServiceRegistered(dbusServiceName);
|
||||
if (!sessionreply.isValid()) {
|
||||
sendSIFinish();
|
||||
error = i18n("Invalid D-Bus reply for: %1", dbusServiceName);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <QDBusAbstractAdaptor>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusConnectionInterface>
|
||||
#include <QProcess>
|
||||
|
||||
// Adaptor class for interface org.kde.KLauncher
|
||||
|
@ -70,9 +71,10 @@ private:
|
|||
void sendSIUpdate();
|
||||
void sendSIFinish();
|
||||
|
||||
QProcessEnvironment m_environment;
|
||||
QDBusConnectionInterface* m_dbusconnectioninterface;
|
||||
KStartupInfoId m_kstartupinfoid;
|
||||
KStartupInfoData m_kstartupinfodata;
|
||||
QProcessEnvironment m_environment;
|
||||
QList<QProcess*> m_processes;
|
||||
QStringList m_autostart;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue