2019-12-11 15:00:39 +00:00
|
|
|
/*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2019 Weixuan XIAO <veyx.shaw@gmail.com>
|
2019-12-11 15:00:39 +00:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2019-12-11 15:00:39 +00:00
|
|
|
*/
|
|
|
|
|
2019-12-22 07:49:55 +00:00
|
|
|
#ifndef INDICATORHELPER_H
|
|
|
|
#define INDICATORHELPER_H
|
|
|
|
|
2019-12-11 15:00:39 +00:00
|
|
|
#include <QProcess>
|
|
|
|
#include <QSplashScreen>
|
|
|
|
|
|
|
|
#ifdef QSYSTRAY
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
#else
|
|
|
|
#include <KStatusNotifierItem>
|
|
|
|
#endif
|
|
|
|
|
2020-10-23 06:55:36 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
#include <QUrl>
|
2022-09-10 22:23:52 +01:00
|
|
|
namespace processes
|
|
|
|
{
|
|
|
|
const QString dbus_daemon = QStringLiteral("dbus-daemon.exe");
|
|
|
|
const QString kdeconnect_daemon = QStringLiteral("kdeconnectd.exe");
|
|
|
|
const QString kdeconnect_app = QStringLiteral("kdeconnect-app.exe");
|
|
|
|
const QString kdeconnect_handler = QStringLiteral("kdeconnect-handler.exe");
|
|
|
|
const QString kdeconnect_settings = QStringLiteral("kdeconnect-settings.exe");
|
|
|
|
const QString kdeconnect_sms = QStringLiteral("kdeconnect-sms.exe");
|
|
|
|
};
|
2020-10-23 06:55:36 +01:00
|
|
|
#endif
|
|
|
|
|
2019-12-11 15:00:39 +00:00
|
|
|
class IndicatorHelper
|
|
|
|
{
|
|
|
|
public:
|
2021-05-28 19:42:26 +01:00
|
|
|
#ifdef Q_OS_WIN
|
2022-09-10 22:23:52 +01:00
|
|
|
IndicatorHelper(const QUrl &indicatorUrl);
|
2021-05-28 19:42:26 +01:00
|
|
|
#else
|
2019-12-11 15:00:39 +00:00
|
|
|
IndicatorHelper();
|
2021-05-28 19:42:26 +01:00
|
|
|
#endif
|
2019-12-11 15:00:39 +00:00
|
|
|
~IndicatorHelper();
|
|
|
|
|
|
|
|
void preInit();
|
|
|
|
void postInit();
|
|
|
|
|
|
|
|
void iconPathHook();
|
|
|
|
|
|
|
|
int daemonHook(QProcess &kdeconnectd);
|
|
|
|
|
|
|
|
#ifdef QSYSTRAY
|
|
|
|
void systrayIconHook(QSystemTrayIcon &systray);
|
|
|
|
#else
|
|
|
|
void systrayIconHook(KStatusNotifierItem &systray);
|
|
|
|
#endif
|
|
|
|
|
2021-05-28 19:42:26 +01:00
|
|
|
private:
|
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
QSplashScreen *m_splashScreen;
|
|
|
|
#endif
|
|
|
|
|
2020-10-23 06:55:36 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
/**
|
|
|
|
* Terminate processes of KDE Connect like kdeconnectd.exe and dbus-daemon.exe
|
|
|
|
*
|
|
|
|
* @return True if termination was successful, false otherwise
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool terminateProcess(const QString &processName, const QUrl &indicatorUrl) const;
|
2021-05-28 19:42:26 +01:00
|
|
|
QUrl m_indicatorUrl;
|
2020-10-23 06:55:36 +01:00
|
|
|
#endif
|
2019-12-11 15:00:39 +00:00
|
|
|
};
|
2019-12-22 07:49:55 +00:00
|
|
|
|
|
|
|
#endif
|