Commit be9260fc authored by Weixuan Xiao's avatar Weixuan Xiao Committed by Nicolas Fella

Add return code

parent a8f08096
......@@ -41,9 +41,11 @@ void IndicatorHelper::postInit() {}
void IndicatorHelper::iconPathHook() {}
void IndicatorHelper::daemonHook(QProcess &kdeconnectd)
int IndicatorHelper::daemonHook(QProcess &kdeconnectd)
{
Q_UNUSED(kdeconnectd);
return 0;
}
#ifdef QSYSTRAY
......@@ -80,7 +82,7 @@ void MacOSIndicatorHelper::iconPathHook()
}
}
void MacOSIndicatorHelper::daemonHook(QProcess &kdeconnectd)
int MacOSIndicatorHelper::daemonHook(QProcess &kdeconnectd)
{
// Unset launchctl env, avoid block
......@@ -97,6 +99,7 @@ void MacOSIndicatorHelper::daemonHook(QProcess &kdeconnectd)
i18n("Cannot find kdeconnectd"),
QMessageBox::Abort,
QMessageBox::Abort);
return -1;
}
// Wait for dbus daemon env
......@@ -125,6 +128,7 @@ void MacOSIndicatorHelper::daemonHook(QProcess &kdeconnectd)
"KDE Connect will quit"),
QMessageBox::Abort,
QMessageBox::Abort);
return -2;
} else {
QThread::sleep(3); // Retry after 3s
retry++;
......@@ -132,6 +136,8 @@ void MacOSIndicatorHelper::daemonHook(QProcess &kdeconnectd)
} while(true);
m_splashScreen->showMessage(i18n("Loading modules") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::white);
return 0;
}
#ifdef QSYSTRAY
......@@ -155,9 +161,10 @@ void MacOSIndicatorHelper::systrayIconHook(KStatusNotifierItem &systray)
WindowsIndicatorHelper::WindowsIndicatorHelper() {}
WindowsIndicatorHelper::~WindowsIndicatorHelper() {}
void WindowsIndicatorHelper::daemonHook(QProcess &kdeconnectd)
int WindowsIndicatorHelper::daemonHook(QProcess &kdeconnectd)
{
kdeconnectd.start(QStringLiteral("kdeconnectd.exe"));
return 0;
}
#ifdef QSYSTRAY
......
......@@ -38,7 +38,7 @@ public:
virtual void iconPathHook();
virtual void daemonHook(QProcess &kdeconnectd);
virtual int daemonHook(QProcess &kdeconnectd);
#ifdef QSYSTRAY
virtual void systrayIconHook(QSystemTrayIcon &systray);
......@@ -56,7 +56,7 @@ public:
void iconPathHook();
void daemonHook(QProcess &kdeconnectd);
int daemonHook(QProcess &kdeconnectd);
#ifdef QSYSTRAY
void systrayIconHook(QSystemTrayIcon &systray);
......@@ -74,7 +74,7 @@ public:
WindowsIndicatorHelper();
~WindowsIndicatorHelper();
void daemonHook(QProcess &kdeconnectd);
int daemonHook(QProcess &kdeconnectd);
#ifdef QSYSTRAY
void systrayIconHook(QSystemTrayIcon &systray);
......
......@@ -66,7 +66,10 @@ int main(int argc, char** argv)
// Run Daemon initilization step
QProcess kdeconnectd;
helper->daemonHook(kdeconnectd);
if (helper->daemonHook(kdeconnectd)) {
delete helper;
return -1;
}
KDBusService dbusService(KDBusService::Unique);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment