Changeset View
Changeset View
Standalone View
Standalone View
src/util/externalcommand.cpp
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Line(s) | |||||
349 | bool ExternalCommand::startHelper() | 349 | bool ExternalCommand::startHelper() | ||
350 | { | 350 | { | ||
351 | if (!QDBusConnection::systemBus().isConnected()) { | 351 | if (!QDBusConnection::systemBus().isConnected()) { | ||
352 | qWarning() << QDBusConnection::systemBus().lastError().message(); | 352 | qWarning() << QDBusConnection::systemBus().lastError().message(); | ||
353 | return false; | 353 | return false; | ||
354 | } | 354 | } | ||
355 | 355 | | |||
356 | QDBusInterface iface(QStringLiteral("org.kde.kpmcore.helperinterface"), QStringLiteral("/Helper"), QStringLiteral("org.kde.kpmcore.externalcommand"), QDBusConnection::systemBus()); | 356 | QDBusInterface iface(QStringLiteral("org.kde.kpmcore.helperinterface"), QStringLiteral("/Helper"), QStringLiteral("org.kde.kpmcore.externalcommand"), QDBusConnection::systemBus()); | ||
357 | | ||||
357 | if (iface.isValid()) { | 358 | if (iface.isValid()) { | ||
358 | exit(0); | 359 | exit(0); | ||
359 | } | 360 | } | ||
360 | 361 | | |||
361 | d->m_thread = new DBusThread; | 362 | d->m_thread = new DBusThread; | ||
362 | d->m_thread->start(); | 363 | d->m_thread->start(); | ||
363 | 364 | | |||
364 | KAuth::Action action = KAuth::Action(QStringLiteral("org.kde.kpmcore.externalcommand.init")); | 365 | KAuth::Action action = KAuth::Action(QStringLiteral("org.kde.kpmcore.externalcommand.init")); | ||
Show All 14 Lines | |||||
379 | QObject::disconnect(conn); | 380 | QObject::disconnect(conn); | ||
380 | 381 | | |||
381 | helperStarted = true; | 382 | helperStarted = true; | ||
382 | return true; | 383 | return true; | ||
383 | } | 384 | } | ||
384 | 385 | | |||
385 | void ExternalCommand::stopHelper() | 386 | void ExternalCommand::stopHelper() | ||
386 | { | 387 | { | ||
387 | auto *interface = new org::kde::kpmcore::externalcommand(QStringLiteral("org.kde.kpmcore.externalcommand"), | 388 | auto interface = new org::kde::kpmcore::externalcommand(QStringLiteral("org.kde.kpmcore.externalcommand"), | ||
388 | QStringLiteral("/Helper"), QDBusConnection::systemBus()); | 389 | QStringLiteral("/Helper"), QDBusConnection::systemBus()); | ||
389 | interface->exit(); | 390 | interface->exit(); | ||
390 | | ||||
391 | } | 391 | } | ||
392 | 392 | | |||
393 | void DBusThread::run() | 393 | void DBusThread::run() | ||
394 | { | 394 | { | ||
395 | if (!QDBusConnection::systemBus().registerService(QStringLiteral("org.kde.kpmcore.applicationinterface")) || | 395 | if (!QDBusConnection::systemBus().registerService(QStringLiteral("org.kde.kpmcore.applicationinterface")) || | ||
396 | !QDBusConnection::systemBus().registerObject(QStringLiteral("/Application"), this, QDBusConnection::ExportAllSlots)) { | 396 | !QDBusConnection::systemBus().registerObject(QStringLiteral("/Application"), this, QDBusConnection::ExportAllSlots)) { | ||
397 | qWarning() << QDBusConnection::systemBus().lastError().message(); | 397 | qWarning() << QDBusConnection::systemBus().lastError().message(); | ||
398 | return; | 398 | return; | ||
399 | } | 399 | } | ||
400 | 400 | | |||
401 | QEventLoop loop; | 401 | QEventLoop loop; | ||
402 | loop.exec(); | 402 | loop.exec(); | ||
403 | } | 403 | } |