indicatorhelper: move terminateProcess calls to IndicatorHelper dtor
This commit is contained in:
parent
f012610ba4
commit
7b56c1d340
3 changed files with 22 additions and 12 deletions
|
@ -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
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue