From f0fd37f1ce97e2fb773cce3d60c96acd5e7f06c6 Mon Sep 17 00:00:00 2001 From: Ximi1970 Date: Sun, 21 Sep 2025 20:35:53 +0200 Subject: [PATCH] Restart TB base setup --- app/SysTray-X/SysTray-X-app/SysTray-X.qrc | 2 ++ app/SysTray-X/SysTray-X-app/files/restart.bat | 1 + app/SysTray-X/SysTray-X-app/files/restart.sh | 3 ++ app/SysTray-X/SysTray-X-app/preferences.cpp | 11 +++++- app/SysTray-X/SysTray-X-app/preferences.h | 7 ++++ app/SysTray-X/SysTray-X-app/systrayx.cpp | 36 +++++++++++++++++++ app/SysTray-X/SysTray-X-app/systrayx.h | 5 +++ 7 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 app/SysTray-X/SysTray-X-app/files/restart.bat create mode 100755 app/SysTray-X/SysTray-X-app/files/restart.sh diff --git a/app/SysTray-X/SysTray-X-app/SysTray-X.qrc b/app/SysTray-X/SysTray-X-app/SysTray-X.qrc index 36d84d2..c6c7e43 100644 --- a/app/SysTray-X/SysTray-X-app/SysTray-X.qrc +++ b/app/SysTray-X/SysTray-X-app/SysTray-X.qrc @@ -25,5 +25,7 @@ files/icons/new-indicator-star-open.png languages/SysTray-X.el.qm languages/SysTray-X.fr.qm + files/restart.sh + files/restart.bat diff --git a/app/SysTray-X/SysTray-X-app/files/restart.bat b/app/SysTray-X/SysTray-X-app/files/restart.bat new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/app/SysTray-X/SysTray-X-app/files/restart.bat @@ -0,0 +1 @@ + diff --git a/app/SysTray-X/SysTray-X-app/files/restart.sh b/app/SysTray-X/SysTray-X-app/files/restart.sh new file mode 100755 index 0000000..1b2cc4d --- /dev/null +++ b/app/SysTray-X/SysTray-X-app/files/restart.sh @@ -0,0 +1,3 @@ + #/bin/sh + + diff --git a/app/SysTray-X/SysTray-X-app/preferences.cpp b/app/SysTray-X/SysTray-X-app/preferences.cpp index 05b2e3d..06c6864 100644 --- a/app/SysTray-X/SysTray-X-app/preferences.cpp +++ b/app/SysTray-X/SysTray-X-app/preferences.cpp @@ -237,12 +237,21 @@ void Preferences::displayDebug() } +/* + * Set the platform os + */ +const QString& Preferences::getPlatformOs() const +{ + return m_platform_os; +} + + /* * Set the platform os */ void Preferences::setPlatformOs( const QString os ) { - m_platform_os = os; + m_platform_os = os; } diff --git a/app/SysTray-X/SysTray-X-app/preferences.h b/app/SysTray-X/SysTray-X-app/preferences.h index 6cf77a1..11b47c6 100644 --- a/app/SysTray-X/SysTray-X-app/preferences.h +++ b/app/SysTray-X/SysTray-X-app/preferences.h @@ -141,6 +141,13 @@ class Preferences : public QObject */ void displayDebug(); + /** + * @brief getPlatformOs. Get the platform OS. + * + * @return The platform os. + */ + const QString& getPlatformOs() const; + /** * @brief setPlatformOs. Set the platform OS. * diff --git a/app/SysTray-X/SysTray-X-app/systrayx.cpp b/app/SysTray-X/SysTray-X-app/systrayx.cpp index e5ce6c6..fe30ec0 100644 --- a/app/SysTray-X/SysTray-X-app/systrayx.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayx.cpp @@ -674,6 +674,11 @@ void SysTrayX::slotErrorAddOnShutdown() */ slotCloseApp(); + /* + * Restart Thunderbird? + */ + restartThunderbird(); + /* * Let's quit */ @@ -706,6 +711,11 @@ void SysTrayX::slotShutdown() */ emit signalClose(); + /* + * Restart Thunderbird? + */ + restartThunderbird(); + /* * Let's quit */ @@ -725,6 +735,32 @@ void SysTrayX::slotShutdown() } +/* + * Show the about dialog + */ +void SysTrayX::restartThunderbird() +{ + QString platform = QGuiApplication::platformName(); + QString os = m_preferences->getPlatformOs(); + + return; + + + QString app = m_preferences->getCloseApp(); + QString args = m_preferences->getCloseAppArgs(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QStringList args_list = args.split( ' ', Qt::SkipEmptyParts ); +#else + QStringList args_list = args.split( ' ', QString::SkipEmptyParts ); +#endif + + if( !app.isEmpty() ) + { + QProcess::startDetached( app, args_list ); + } +} + + /* * Show the about dialog */ diff --git a/app/SysTray-X/SysTray-X-app/systrayx.h b/app/SysTray-X/SysTray-X-app/systrayx.h index bfb7314..91abfb4 100644 --- a/app/SysTray-X/SysTray-X-app/systrayx.h +++ b/app/SysTray-X/SysTray-X-app/systrayx.h @@ -97,6 +97,11 @@ class SysTrayX : public QObject */ void resendMailCount(); + /** + * @brief restartThunderbird. restart thunderbird. + */ + void restartThunderbird(); + signals: /**