diff --git a/indicator/indicatorhelper.cpp b/indicator/indicatorhelper.cpp index 55fa4cd1a..e6da952c5 100644 --- a/indicator/indicatorhelper.cpp +++ b/indicator/indicatorhelper.cpp @@ -68,7 +68,7 @@ void MacOSIndicatorHelper::iconPathHook() } } -void MacOSIndicatorHelper::dbusHook() +void MacOSIndicatorHelper::daemonHook(QProcess &kdeconnectd) { // Unset launchctl env, avoid block @@ -76,11 +76,11 @@ void MacOSIndicatorHelper::dbusHook() // Start kdeconnectd m_splashScreen->showMessage(i18n("Launching daemon") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::white); - QProcess kdeconnectdProcess; + QProcess kdeconnectd; if (QFile::exists(QCoreApplication::applicationDirPath() + QStringLiteral("/kdeconnectd"))) { - kdeconnectdProcess.startDetached(QCoreApplication::applicationDirPath() + QStringLiteral("/kdeconnectd")); + kdeconnectd.startDetached(QCoreApplication::applicationDirPath() + QStringLiteral("/kdeconnectd")); } else if (QFile::exists(QString::fromLatin1(qgetenv("craftRoot")) + QStringLiteral("/../lib/libexec/kdeconnectd"))) { - kdeconnectdProcess.startDetached(QString::fromLatin1(qgetenv("craftRoot")) + QStringLiteral("/../lib/libexec/kdeconnectd")); + kdeconnectd.startDetached(QString::fromLatin1(qgetenv("craftRoot")) + QStringLiteral("/../lib/libexec/kdeconnectd")); } else { QMessageBox::critical(nullptr, i18n("KDE Connect"), i18n("Cannot find kdeconnectd"), @@ -139,9 +139,8 @@ void MacOSIndicatorHelper::kStatusNotifierItemHook(KStatusNotifierItem &systray) WindowsIndicatorHelper::WindowsIndicatorHelper() {} WindowsIndicatorHelper::~WindowsIndicatorHelper() {} -void WindowsIndicatorHelper::dbusHook() +void WindowsIndicatorHelper::daemonHook(QProcess &kdeconnectd) { - QProcess kdeconnectd; kdeconnectd.start(QStringLiteral("kdeconnectd.exe")); } diff --git a/indicator/indicatorhelper.h b/indicator/indicatorhelper.h index 660c91f4c..78342d6e0 100644 --- a/indicator/indicatorhelper.h +++ b/indicator/indicatorhelper.h @@ -38,7 +38,7 @@ public: virtual void iconPathHook(); - virtual void dbusHook(); + virtual void daemonHook(QProcess &kdeconnectd); virtual void qSystemTrayIconHook(QSystemTrayIcon &systray); virtual void kStatusNotifierItemHook(KStatusNotifierItem &systray); diff --git a/indicator/main.cpp b/indicator/main.cpp index 9f64c9b64..57d08f7d8 100644 --- a/indicator/main.cpp +++ b/indicator/main.cpp @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -64,8 +65,9 @@ int main(int argc, char** argv) helper->preInit(); - // Run D-Bus initilization step - helper->dbusHook(); + // Run Daemon initilization step + QProcess kdeconnectd; + helper->daemonHook(kdeconnectd); KDBusService dbusService(KDBusService::Unique);