Commit 7b56c1d3 authored by Piyush Aggarwal's avatar Piyush Aggarwal 🎮
Browse files

indicatorhelper: move terminateProcess calls to IndicatorHelper dtor

parent f012610b
Pipeline #63396 passed with stage
in 4 minutes and 20 seconds
......@@ -27,7 +27,11 @@
class IndicatorHelper
{
public:
#ifdef Q_OS_WIN
IndicatorHelper(const QUrl& indicatorUrl);
#else
IndicatorHelper();
#endif
~IndicatorHelper();
void preInit();
......@@ -43,6 +47,11 @@ public:
void systrayIconHook(KStatusNotifierItem &systray);
#endif
private:
#ifdef Q_OS_MAC
QSplashScreen *m_splashScreen;
#endif
#ifdef Q_OS_WIN
/**
* Terminate processes of KDE Connect like kdeconnectd.exe and dbus-daemon.exe
......@@ -51,12 +60,9 @@ public:
*/
bool terminateProcess(const QString &processName, const QUrl &indicatorUrl) const;
QUrl m_indicatorUrl;
#endif
private:
#ifdef Q_OS_MAC
QSplashScreen *m_splashScreen;
#endif
};
#endif
......@@ -17,8 +17,13 @@
#include "indicatorhelper.h"
#include "indicator_debug.h"
IndicatorHelper::IndicatorHelper() {}
IndicatorHelper::~IndicatorHelper() {}
IndicatorHelper::IndicatorHelper(const QUrl& indicatorUrl)
: m_indicatorUrl(indicatorUrl) {}
IndicatorHelper::~IndicatorHelper() {
this->terminateProcess(processes::dbus_daemon, m_indicatorUrl);
this->terminateProcess(processes::kdeconnect_daemon, m_indicatorUrl);
}
void IndicatorHelper::preInit() {}
......
......@@ -41,7 +41,11 @@ int main(int argc, char** argv)
i18n("(C) 2016 Aleix Pol Gonzalez"));
KAboutData::setApplicationData(about);
#ifdef Q_OS_WIN
IndicatorHelper helper(QUrl::fromLocalFile(qApp->applicationDirPath()));
#else
IndicatorHelper helper;
#endif
helper.preInit();
......@@ -109,12 +113,7 @@ int main(int argc, char** argv)
});
#elif defined Q_OS_WIN
menu->addAction(i18n("Quit"), [&helper](){
const QUrl indicatorUrl = QUrl::fromLocalFile(qApp->applicationDirPath());
helper.terminateProcess(processes::dbus_daemon, indicatorUrl);
helper.terminateProcess(processes::kdeconnect_daemon, indicatorUrl);
qApp->quit();
});
menu->addAction(i18n("Quit"), [](){qApp->quit();});
#endif
};
......
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