diff --git a/src/util/externalcommand.h b/src/util/externalcommand.h --- a/src/util/externalcommand.h +++ b/src/util/externalcommand.h @@ -104,6 +104,9 @@ void emitReport(const QVariantMap& report) { emit reportSignal(report); } + /**< Dummy function for QTimer when needed. */ + void quit(); + // KAuth /**< start ExternalCommand Helper */ bool startHelper(); diff --git a/src/util/externalcommand.cpp b/src/util/externalcommand.cpp --- a/src/util/externalcommand.cpp +++ b/src/util/externalcommand.cpp @@ -119,13 +119,12 @@ */ bool ExternalCommand::start(int timeout) { - Q_UNUSED(timeout) - if (command().isEmpty()) return false; if (!QDBusConnection::systemBus().isConnected()) { qWarning() << QDBusConnection::systemBus().lastError().message(); + QTimer::singleShot(timeout, this, &ExternalCommand::quit); return false; } @@ -168,6 +167,8 @@ connect(watcher, &QDBusPendingCallWatcher::finished, exitLoop); loop.exec(); + QTimer::singleShot(timeout, this, &ExternalCommand::quit); + return rval; } @@ -339,6 +340,12 @@ d->m_ExitCode = i; } +/**< Dummy function for QTimer when needed. */ +void ExternalCommand::quit() +{ + +} + bool ExternalCommand::startHelper() { if (!QDBusConnection::systemBus().isConnected()) {