Changeset View
Changeset View
Standalone View
Standalone View
src/util/externalcommand.cpp
Show First 20 Lines • Show All 372 Lines • ▼ Show 20 Line(s) | 350 | { | |||
---|---|---|---|---|---|
373 | 373 | | |||
374 | auto authResult = m_authJob->actionStatus(QStringLiteral("org.kde.kpmcore.externalcommand.init"), m_authJob->callerID()); | 374 | auto authResult = m_authJob->actionStatus(QStringLiteral("org.kde.kpmcore.externalcommand.init"), m_authJob->callerID()); | ||
375 | 375 | | |||
376 | 376 | | |||
377 | // Wait until ExternalCommand Helper is ready and sends signal | 377 | // Wait until ExternalCommand Helper is ready and sends signal | ||
378 | QEventLoop loop; | 378 | QEventLoop loop; | ||
379 | auto exitLoop = [&] () { loop.exit(); }; | 379 | auto exitLoop = [&] () { loop.exit(); }; | ||
380 | 380 | | |||
381 | 381 | | |||
382 | loop.exec(); | 382 | loop.exec(); | ||
stikonas: Fix this, this will give you infinite recursion. | |||||
383 | 383 | | |||
384 | if (!isActionAuthorized || authResult == PolkitQt1::Authority::No || authResult == PolkitQt1::Authority::Unknown) { | 384 | if (!isActionAuthorized || authResult == PolkitQt1::Authority::No || authResult == PolkitQt1::Authority::Unknown) { | ||
385 | qDebug() << "Unable to obtain Administrative privileges, the action can not be executed!!"; | 385 | qDebug() << "Unable to obtain Administrative privileges, the action can not be executed!!"; | ||
386 | } | 386 | } | ||
387 | 387 | | |||
388 | helperStarted = true; | 388 | helperStarted = true; | ||
389 | return true; | 389 | return true; | ||
390 | } | 390 | } | ||
391 | 391 | | |||
392 | void ExternalCommand::stopHelper() | 392 | void ExternalCommand::stopHelper() | ||
393 | { | 393 | { | ||
394 | auto interface = new org::kde::kpmcore::externalcommand(QStringLiteral("org.kde.kpmcore.externalcommand"), | 394 | auto interface = new org::kde::kpmcore::externalcommand(QStringLiteral("org.kde.kpmcore.externalcommand"), | ||
395 | QStringLiteral("/Helper"), QDBusConnection::systemBus()); | 395 | QStringLiteral("/Helper"), QDBusConnection::systemBus()); | ||
396 | interface->exit(); | 396 | interface->exit(); | ||
397 | 397 | | |||
398 | } | 398 | } | ||
399 | 399 | | |||
400 | void ExternalCommand::emitNewData(int percent) | ||||
401 | { | ||||
402 | // emmit signal indicating new data and later connect to that signal | ||||
403 | emit newData(); | ||||
404 | } | ||||
405 | | ||||
406 | void ExternalCommand::emitNewData(QString& message) | ||||
407 | { | ||||
408 | // emmit signal indicating new data and later connect to that signal | ||||
409 | emit newData(); | ||||
410 | } | ||||
411 | | ||||
400 | void DBusThread::run() | 412 | void DBusThread::run() | ||
401 | { | 413 | { | ||
402 | if (!QDBusConnection::systemBus().registerService(QStringLiteral("org.kde.kpmcore.applicationinterface")) || | 414 | if (!QDBusConnection::systemBus().registerService(QStringLiteral("org.kde.kpmcore.applicationinterface")) || | ||
403 | !QDBusConnection::systemBus().registerObject(QStringLiteral("/Application"), this, QDBusConnection::ExportAllSlots)) { | 415 | !QDBusConnection::systemBus().registerObject(QStringLiteral("/Application"), this, QDBusConnection::ExportAllSlots)) { | ||
404 | qWarning() << QDBusConnection::systemBus().lastError().message(); | 416 | qWarning() << QDBusConnection::systemBus().lastError().message(); | ||
405 | return; | 417 | return; | ||
406 | } | 418 | } | ||
407 | 419 | | |||
408 | QEventLoop loop; | 420 | QEventLoop loop; | ||
409 | loop.exec(); | 421 | loop.exec(); | ||
410 | } | 422 | } |
Fix this, this will give you infinite recursion.