Fix daemon

This commit is contained in:
Weixuan XIAO 2019-11-16 12:39:02 +01:00 committed by Nicolas Fella
parent 423e6e22f6
commit eb06c43bff
3 changed files with 10 additions and 9 deletions

View file

@ -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"));
}

View file

@ -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);

View file

@ -19,6 +19,7 @@
*/
#include <QApplication>
#include <QProcess>
#include <QThread>
#include <QMessageBox>
@ -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);