Refactor option handling

This commit is contained in:
Ximi1970
2023-12-12 22:10:47 +01:00
parent 426a19794b
commit 9897d91240
14 changed files with 441 additions and 116 deletions

View File

@@ -9,7 +9,7 @@ The addon and system tray application can do:
- optional new mail indicator (icon or shading)
- run app on start or close
- show / hide Thunderbird (minimize)
- use a shortcut to show / hide
- use a shortcut to show / hide (not available for GNOME or Wayland)
- minimizing hides to tray (remove Thunderbird from taskbar, pager and switcher when minimized)
- minimize on startup
- minimize on close
@@ -52,7 +52,7 @@ Please press the reset button in the TB SysTray-X add-on preferences page to cle
This add-on / companion app will not work with flatpaks or snaps of Thunderbird. They do not allow native messaging hosts outside the packages.
You need to use a workaround for Wayland. In some distributions this is already applied.
The shortcut option does not work in GNOME or Wayland.
## Binaries (System)

View File

@@ -7,11 +7,14 @@ include( ../SysTray-X.pri )
# Defines
#
#DEFINES += NO_KDE_INTEGRATION
#DEFINES += NO_SHORTCUTS
!contains(DEFINES,NO_KDE_INTEGRATION) {
DEFINES += KDE_INTEGRATION
}
!contains(DEFINES,NO_SHORTCUTS) {
DEFINES += SHORTCUTS
}
#
# Set the Qt modules

View File

@@ -12,6 +12,7 @@
/*
* Qt includes
*/
#include <QGuiApplication>
/*
@@ -92,6 +93,137 @@ Preferences::Preferences( QObject *parent ) : QObject( parent )
m_close_app_args = "";
m_show_hide_shortcut = QKeySequence();
/*
* Initialize the system parameters
*/
m_platform = QGuiApplication::platformName();
m_xdg_session_desktop = getenv( "XDG_SESSION_DESKTOP" );
m_xdg_current_desktop = getenv( "XDG_CURRENT_DESKTOP" );
m_xdg_session_type = getenv( "XDG_SESSION_TYPE" );
/*
* Set the options
*/
#if ( defined( Q_OS_UNIX ) && defined( NO_KDE_INTEGRATION ) ) || defined( Q_OS_WIN )
m_kde_integration_option = false;
#else
m_kde_integration_option = true;
#endif
#if ( defined( Q_OS_UNIX ) && defined( NO_SHORTCUTS ) )
m_shortcuts_option = false;
#else
m_shortcuts_option = true;
#endif
/*
// XDG_SESSION_DESKTOP
// XDG_CURRENT_DESKTOP
// XDG_SESSION_TYPE
// Leap 15.4 "KDE", "default", "gnome-classic", "gnome-xorg", "icewm", "xfce"
// Leap 15.4 "KDE", "GNOME", "GNOME-Classic:GNOME", "GNOME", "ICEWM", "XFCE"
// Leap 15.4 "x11", "wayland", "x11", "x11", "x11", x11
// Leap 15.5 "KDE", "default", "gnome-classic", "gnome-xorg", "icewm", "xfce"
// Leap 15.5 "KDE", "GNOME", "GNOME-Classic:GNOME", "GNOME", "ICEWM", "XFCE"
// Leap 15.5 "x11", "wayland", "x11", "x11", "x11", x11
// Ubuntu 18.03: "ubuntu", "ubuntu-wayland"
// Ubuntu 18.03: "ubuntu:GNOME", "ubuntu:GNOME"
// Ubuntu 18.03: "x11", "wayland"
// Xubuntu 18.03: "xubuntu",
// Xubuntu 18.03: "XFCE",
// Xubuntu 18.03: "x11",
// Kubuntu 18.03: "KDE",
// Kubuntu 18.03: "KDE",
// Kubuntu 18.03: "x11",
// Lubuntu 18.03: "Lubuntu",
// Lubuntu 18.03: "LXDE",
// Lubuntu 18.03: "x11",
// Ubuntu 23.10: "ubuntu", "ubuntu-xorg"
// Ubuntu 23.10: "ubuntu:GNOME", "ubuntu:GNOME"
// Ubuntu 23.10: "wayland", "x11"
// Xubuntu 23.10: "xubuntu",
// Xubuntu 23.10: "XFCE",
// Xubuntu 23.10: "x11",
// Kubuntu 23.10: "KDE",
// Kubuntu 23.10: "KDE",
// Kubuntu 23.10: "x11",
// Lubuntu 23.10: "LXQt",
// Lubuntu 23.10: "LXQt",
// Lubuntu 23.10: "x11",
// Debian 10: "gnome", "KDE"
// Debian 10: "GNOME", "KDE"
// Debian 10: "wayland", "x11"
// Debian 12: "gnome", "KDE"
// Debian 12: "GNOME", "KDE"
// Debian 12: "wayland", "x11"
// Fedora 36: "gnome"
// Fedora 36: "GNOME"
// Fedora 36: "wayland"
// Fedora 38: "gnome", "gnome-xorg", "mate"
// Fedora 38: "GNOME", "GNOME", "MATE"
// Fedora 38: "wayland", "x11", "x11"
// Manjaro: "gnome", -
// Manjaro: "GNOME", "KDE"
// Manjaro: "wayland", -
// Arch: "gnome", "gnome-xorg", "xfce"
// Arch: "GNOME", "GNOME", "XFCE"
// Arch: "wayland", "x11", "x11"
// Mint: "xfce"
// Mint: "XFCE"
// Mint: "x11"
// Qt platform: "xcb", "wayland", "windows", ...
// Session desktop: "KDE", "gnome", ...
// Session type: "x11", "wayland", ...
if( m_session_type == "x11" && m_session_desktop == "KDE" )
{
m_kde_integration_option = true;
}
else
{
m_kde_integration_option = false;
}
if( m_platform == "wayland" || m_session_type == "wayland" || m_session_desktop == "GNOME" )
{
m_shortcuts_option = false;
}
else
{
m_shortcuts_option = true;
}
*/
}
/*
* Display some debug info
*/
void Preferences::displayDebug()
{
emit signalConsole( QString( "Platform: %1" ).arg( m_platform ) );
emit signalConsole( QString( "Session current desktop: %1" ).arg( m_xdg_current_desktop ) );
emit signalConsole( QString( "Session desktop: %1" ).arg( m_xdg_session_desktop ) );
emit signalConsole( QString( "Session type: %1" ).arg( m_xdg_session_type ) );
}
@@ -947,6 +1079,58 @@ void Preferences::setShowHideShortcut( QKeySequence key_seq )
}
/*
* Get the KDE integration option.
*/
bool Preferences::getKdeIntegrationOption() const
{
return m_kde_integration_option;
}
/*
* Get the KDE integration option.
*/
void Preferences::setKdeIntegrationOption( bool state )
{
if( m_kde_integration_option != state )
{
m_kde_integration_option = state;
/*
* Tell the world the new option
*/
//emit signalOptionChange();
}
}
/*
* Get the shortcuts option.
*/
bool Preferences::getShortcutsOption() const
{
return m_shortcuts_option;
}
/*
* Get the shortcuts option.
*/
void Preferences::setShortcutsOption( bool state )
{
if( m_shortcuts_option != state )
{
m_shortcuts_option = state;
/*
* Tell the world the new option
*/
//emit signalOptionChange();
}
}
/*
* Get the debug state.
*/

View File

@@ -127,6 +127,11 @@ class Preferences : public QObject
*/
Preferences( QObject *parent = nullptr );
/**
* @brief displayDebug. Display sone debug info.
*/
void displayDebug();
/**
* @brief setPlatformOs. Set the platform OS.
*
@@ -585,6 +590,34 @@ class Preferences : public QObject
*/
void setShowHideShortcut( QKeySequence key_seq );
/**
* @brief getKdeIntegrationOption. Get the KDE integration option.
*
* @return The state.
*/
bool getKdeIntegrationOption() const;
/**
* @brief setKdeIntegrationOption. Set the KDE integration option.
*
* @param state The state.
*/
void setKdeIntegrationOption( bool state );
/**
* @brief getShortcutsOption. Get the shortcuts option.
*
* @return The state.
*/
bool getShortcutsOption() const;
/**
* @brief setShortcutsOption. Set the shortcuts option.
*
* @param state The state.
*/
void setShortcutsOption( bool state );
/**
* @brief getDebug. Get the debug windows state.
*
@@ -778,6 +811,26 @@ class Preferences : public QObject
private:
/**
* @brief m_platform. Qt platform indication.
*/
QString m_platform;
/**
* @brief m_xdg_current_desktop. Environment current desktop setting (KDE, GNOME, xxx).
*/
QString m_xdg_current_desktop;
/**
* @brief m_xdg_session_desktop. Environment desktop setting (KDE, GNOME, xxx).
*/
QString m_xdg_session_desktop;
/**
* @brief m_xdg_session_type. Environment session type setting (x11, wayland).
*/
QString m_xdg_session_type;
/**
* @brief m_platform_xx. Platform description.
*/
@@ -967,6 +1020,16 @@ class Preferences : public QObject
*/
QKeySequence m_show_hide_shortcut;
/**
* @brief m_kde_integration_option. KDE integration option.
*/
bool m_kde_integration_option;
/**
* @brief m_shortcuts_option. Shortcut option.
*/
bool m_shortcuts_option;
/**
* @brief m_debug. Display debug window.
*/

View File

@@ -23,7 +23,7 @@
<iconset resource="SysTray-X.qrc">
<normaloff>:/files/icons/SysTray-X.png</normaloff>:/files/icons/SysTray-X.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<layout class="QGridLayout" name="gridLayout_14">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
@@ -594,7 +594,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="tabCount">
<attribute name="title">
<string>Count</string>
</attribute>
@@ -984,7 +984,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="tabApps">
<attribute name="title">
<string>Apps</string>
</attribute>
@@ -1133,78 +1133,85 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="tabShortcuts">
<attribute name="title">
<string>Shortcuts</string>
</attribute>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>11</x>
<y>10</y>
<width>571</width>
<height>58</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Current show / hide shortcut:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="currentShowHideShortcut"/>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>New show / hide shortcut:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="showHideKeySequenceEdit">
<property name="keySequence">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearShowHideShortcutPushButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Current show / hide shortcut:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="currentShowHideShortcut"/>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>New show / hide shortcut:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="showHideKeySequenceEdit">
<property name="keySequence">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearShowHideShortcutPushButton">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_11">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>297</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabDebug">
<attribute name="title">
@@ -1290,13 +1297,13 @@
</resources>
<connections/>
<buttongroups>
<buttongroup name="iconTypeGroup"/>
<buttongroup name="minimizeTypeGroup"/>
<buttongroup name="startupTypeGroup"/>
<buttongroup name="defaultIconTypeGroup"/>
<buttongroup name="newIndicatorTypeGroup"/>
<buttongroup name="countTypeGroup"/>
<buttongroup name="closeTypeGroup"/>
<buttongroup name="minimizeIconTypeGroup"/>
<buttongroup name="minimizeTypeGroup"/>
<buttongroup name="closeTypeGroup"/>
<buttongroup name="defaultIconTypeGroup"/>
<buttongroup name="countTypeGroup"/>
<buttongroup name="newIndicatorTypeGroup"/>
<buttongroup name="iconTypeGroup"/>
<buttongroup name="startupTypeGroup"/>
</buttongroups>
</ui>

View File

@@ -79,6 +79,21 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
m_ui->hideDefaultIconCheckBox->hide();
#endif
#if defined( Q_OS_UNIX ) && defined( NO_SHORTCUTS )
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
int index = m_ui->tabWidget->indexOf( m_ui->tabShortcuts );
m_ui->tabWidget->setTabVisible( index, false );
#else
int index = m_ui->tabWidget->indexOf( m_ui->tabShortcuts );
m_ui->tabWidget->setTabEnabled( index, false );
m_ui->tabWidget->setStyleSheet( "QTabBar::tab::disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }" );
#endif
#endif
/*

View File

@@ -147,10 +147,13 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
connect( m_pref_dialog, &PreferencesDialog::signalPreferencesChanged, m_link, &SysTrayXLink::slotPreferencesChanged );
connect( m_preferences, &Preferences::signalHideDefaultIconChange, this, &SysTrayX::slotSelectIconObjectPref );
connect( m_preferences, &Preferences::signalShowHideShortcutChange, this, &SysTrayX::slotShowHideShortcutChange );
connect( m_preferences, &Preferences::signalDebugChange, m_debug, &DebugWidget::slotDebugChange );
#if defined( SHORTCUTS )
connect( m_preferences, &Preferences::signalShowHideShortcutChange, this, &SysTrayX::slotShowHideShortcutChange );
#endif
/*
* Connect link signals
*/
@@ -184,6 +187,8 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
*/
getPreferences();
m_preferences->displayDebug();
/*
m_preferences->setBrowserVersion( "115.1.0" );
// m_preferences->setBrowserVersion( "102.2.3" );
@@ -479,12 +484,7 @@ void SysTrayX::hideKdeTrayIcon()
disconnect( this, &SysTrayX::signalMailCount, m_kde_tray_icon, &SysTrayXStatusNotifier::slotMailCount );
/*
* Remove the notifier icon#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
* Remove the notifier icon
*/
delete m_kde_tray_icon;
m_kde_tray_icon = nullptr;

View File

@@ -247,17 +247,21 @@ void SysTrayXLink::sendShutdown()
/*
* Send disable KDE integration to the add-on
* Send the options to the add-on
*/
void SysTrayXLink::sendDisableKdeIntegration()
void SysTrayXLink::sendOptions()
{
QJsonObject integrationObject;
integrationObject.insert("kdeIntegration", QJsonValue::fromVariant( "false" ) );
QJsonObject options_object;
options_object.insert("kdeIntegration", QJsonValue::fromVariant( m_pref->getKdeIntegrationOption() ) );
options_object.insert("shortcuts", QJsonValue::fromVariant( m_pref->getShortcutsOption() ) );
QJsonObject main_object;
main_object.insert("options", options_object);
/*
* Store the new document
*/
QJsonDocument json_doc = QJsonDocument( integrationObject );
QJsonDocument json_doc = QJsonDocument( main_object );
/*
* Send it to the add-on
@@ -421,6 +425,11 @@ void SysTrayXLink::DecodeMessage( const QByteArray& message )
}
}
if( jsonObject.contains( "optionsRequest" ) && jsonObject[ "optionsRequest" ].isBool() )
{
sendOptions();
}
if( jsonObject.contains( "hideDefaultIcon" ) && jsonObject[ "hideDefaultIcon" ].isBool() )
{
bool hide_default_icon = jsonObject[ "hideDefaultIcon" ].toBool();
@@ -429,12 +438,6 @@ void SysTrayXLink::DecodeMessage( const QByteArray& message )
* Signal the KDE integration or hide default icon
*/
emit signalKdeIntegration( hide_default_icon );
#if ( defined( Q_OS_UNIX ) && defined( NO_KDE_INTEGRATION ) ) || defined( Q_OS_WIN )
sendDisableKdeIntegration();
#endif
}
if( jsonObject.contains( "locale" ) && jsonObject[ "locale" ].isString() )

View File

@@ -116,9 +116,9 @@ class SysTrayXLink : public QObject
void sendShutdown();
/**
* @brief sendDisableKdeIntegration. Disable KDE integration.
* @brief sendOptions. Send the options to the add-on.
*/
void sendDisableKdeIntegration();
void sendOptions();
/**
* @brief sendPositions

View File

@@ -44,7 +44,7 @@ build() {
sed < app/config/linux/SysTray_X.json.template -e 's|SYSTRAY_X_PATH|/usr/bin/SysTray-X|' > SysTray_X.json
make OPTIONS="DEFINES+=NO_KDE_INTEGRATION" EXT_VERSION="DEFINES+=EXT_VERSION DEFINES+=APP_VERSION_MAJOR=\\\\\\\\\\\\\\\"$VERSION_MAJOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_MINOR=\\\\\\\\\\\\\\\"$VERSION_MINOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_PATCH=\\\\\\\\\\\\\\\"$VERSION_PATCH\\\\\\\\\\\\\\\" DEFINES+=APP_BUILD=\\\\\\\\\\\\\\\"$BUILD_NUMBER\\\\\\\\\\\\\\\" DEFINES+=APP_GITHASH=\\\\\\\\\\\\\\\"$GIT_HASH\\\\\\\\\\\\\\\" DEFINES+=APP_GITBRANCH=\\\\\\\\\\\\\\\"$GIT_BRANCH\\\\\\\\\\\\\\\""
make OPTIONS="DEFINES+=NO_KDE_INTEGRATION DEFINES+=NO_SWHORTCUTS" EXT_VERSION="DEFINES+=EXT_VERSION DEFINES+=APP_VERSION_MAJOR=\\\\\\\\\\\\\\\"$VERSION_MAJOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_MINOR=\\\\\\\\\\\\\\\"$VERSION_MINOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_PATCH=\\\\\\\\\\\\\\\"$VERSION_PATCH\\\\\\\\\\\\\\\" DEFINES+=APP_BUILD=\\\\\\\\\\\\\\\"$BUILD_NUMBER\\\\\\\\\\\\\\\" DEFINES+=APP_GITHASH=\\\\\\\\\\\\\\\"$GIT_HASH\\\\\\\\\\\\\\\" DEFINES+=APP_GITBRANCH=\\\\\\\\\\\\\\\"$GIT_BRANCH\\\\\\\\\\\\\\\""
}
package() {

View File

@@ -34,7 +34,7 @@ build-stamp:
# Add here commands to compile the package.
sed < app/config/linux/SysTray_X.json.template -e 's|SYSTRAY_X_PATH|/usr/bin/SysTray-X|' > SysTray_X.json
QT_SELECT=5 make OPTIONS="DEFINES+=NO_KDE_INTEGRATION" EXT_VERSION="DEFINES+=EXT_VERSION DEFINES+=APP_VERSION_MAJOR=\\\\\\\\\\\\\\\"$(VERSION_MAJOR)\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_MINOR=\\\\\\\\\\\\\\\"$(VERSION_MINOR)\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_PATCH=\\\\\\\\\\\\\\\"$(VERSION_PATCH)\\\\\\\\\\\\\\\" DEFINES+=APP_BUILD=\\\\\\\\\\\\\\\"$(BUILD_NUMBER)\\\\\\\\\\\\\\\" DEFINES+=APP_GITHASH=\\\\\\\\\\\\\\\"$(GIT_HASH)\\\\\\\\\\\\\\\" DEFINES+=APP_GITBRANCH=\\\\\\\\\\\\\\\"$(GIT_BRANCH)\\\\\\\\\\\\\\\""
QT_SELECT=5 make OPTIONS="DEFINES+=NO_KDE_INTEGRATION DEFINES+=NO_SHORTCUTS" EXT_VERSION="DEFINES+=EXT_VERSION DEFINES+=APP_VERSION_MAJOR=\\\\\\\\\\\\\\\"$(VERSION_MAJOR)\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_MINOR=\\\\\\\\\\\\\\\"$(VERSION_MINOR)\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_PATCH=\\\\\\\\\\\\\\\"$(VERSION_PATCH)\\\\\\\\\\\\\\\" DEFINES+=APP_BUILD=\\\\\\\\\\\\\\\"$(BUILD_NUMBER)\\\\\\\\\\\\\\\" DEFINES+=APP_GITHASH=\\\\\\\\\\\\\\\"$(GIT_HASH)\\\\\\\\\\\\\\\" DEFINES+=APP_GITBRANCH=\\\\\\\\\\\\\\\"$(GIT_BRANCH)\\\\\\\\\\\\\\\""
# --- end custom part for compiling

View File

@@ -73,7 +73,7 @@ export BUILD_NUMBER=`cat %{S:1} | grep BUILD_NUMBER | sed -e "s/BUILD_NUMBER=\(.
export GIT_HASH=`cat %{S:1} | grep GIT_HASH | sed -e "s/GIT_HASH=\(.*\)/\1/"`
export GIT_BRANCH=`cat %{S:1} | grep GIT_BRANCH | sed -e "s/GIT_BRANCH=\(.*\)/\1/"`
make %{?_smp_mflags} OPTIONS="DEFINES+=NO_KDE_INTEGRATION" EXT_VERSION="DEFINES+=EXT_VERSION DEFINES+=APP_VERSION_MAJOR=\\\\\\\\\\\\\\\"$VERSION_MAJOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_MINOR=\\\\\\\\\\\\\\\"$VERSION_MINOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_PATCH=\\\\\\\\\\\\\\\"$VERSION_PATCH\\\\\\\\\\\\\\\" DEFINES+=APP_BUILD=\\\\\\\\\\\\\\\"$BUILD_NUMBER\\\\\\\\\\\\\\\" DEFINES+=APP_GITHASH=\\\\\\\\\\\\\\\"$GIT_HASH\\\\\\\\\\\\\\\" DEFINES+=APP_GITBRANCH=\\\\\\\\\\\\\\\"$GIT_BRANCH\\\\\\\\\\\\\\\""
make %{?_smp_mflags} OPTIONS="DEFINES+=NO_KDE_INTEGRATION DEFINES+=NO_SHORTCUTS" EXT_VERSION="DEFINES+=EXT_VERSION DEFINES+=APP_VERSION_MAJOR=\\\\\\\\\\\\\\\"$VERSION_MAJOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_MINOR=\\\\\\\\\\\\\\\"$VERSION_MINOR\\\\\\\\\\\\\\\" DEFINES+=APP_VERSION_PATCH=\\\\\\\\\\\\\\\"$VERSION_PATCH\\\\\\\\\\\\\\\" DEFINES+=APP_BUILD=\\\\\\\\\\\\\\\"$BUILD_NUMBER\\\\\\\\\\\\\\\" DEFINES+=APP_GITHASH=\\\\\\\\\\\\\\\"$GIT_HASH\\\\\\\\\\\\\\\" DEFINES+=APP_GITBRANCH=\\\\\\\\\\\\\\\"$GIT_BRANCH\\\\\\\\\\\\\\\""
sed < app/config/linux/SysTray_X.json.template -e 's|SYSTRAY_X_PATH|%{_bindir}/SysTray-X|' > SysTray_X.json

View File

@@ -22,6 +22,8 @@ SysTrayX.Info = {
platformInfo: {},
browserInfo: {},
options: {},
displayInfo: function () {
console.debug("Info Addon version: " + this.version);
console.debug("Info Platform: " + JSON.stringify(this.platformInfo));
@@ -63,6 +65,9 @@ SysTrayX.Messaging = {
// Lookout for storage changes
browser.storage.onChanged.addListener(SysTrayX.Messaging.storageChanged);
// Request the options from app
SysTrayX.Messaging.requestOptions();
// Send the platform info to app
SysTrayX.Messaging.sendLocale();
@@ -571,6 +576,10 @@ SysTrayX.Messaging = {
SysTrayX.Messaging.folderTree = folderTree;
},
requestOptions: function () {
SysTrayX.Link.postSysTrayXMessage({ optionsRequest: true });
},
sendBrowserInfo: function () {
const info = SysTrayX.Info.browserInfo;
SysTrayX.Link.postSysTrayXMessage({ browserInfo: info });
@@ -770,10 +779,12 @@ SysTrayX.Link = {
SysTrayX.Link.postSysTrayXMessage({ shutdown: "true" });
}
const kdeIntegration = response["kdeIntegration"];
if (kdeIntegration !== undefined) {
const options = response["options"];
if (options !== undefined) {
SysTrayX.Info.options = options;
await storage().set({
kdeIntegration: kdeIntegration,
options: options,
});
}
@@ -1162,6 +1173,14 @@ async function start() {
// Init defaults before everything
// Reset the options
await storage().set({
options: {
kdeIntegration: true,
shortcuts: true,
},
});
// Reset KDE integration
await storage().set({
kdeIntegration: true,

View File

@@ -355,6 +355,16 @@ SysTrayX.RestoreOptions = {
SysTrayX.RestoreOptions.onDebugError
);
//
// Restore the options
//
await storage()
.get("options")
.then(
SysTrayX.RestoreOptions.setOptions,
SysTrayX.RestoreOptions.onOptionsError
);
//
// Restore filters
//
@@ -439,7 +449,7 @@ SysTrayX.RestoreOptions = {
// Restore hide default icon
//
await storage()
.get(["kdeIntegration", "hideDefaultIcon"])
.get("hideDefaultIcon")
.then(
SysTrayX.RestoreOptions.setHideDefaultIcon,
SysTrayX.RestoreOptions.onHideDefaultIconError
@@ -641,6 +651,22 @@ SysTrayX.RestoreOptions = {
console.log(`Debug Error: ${error}`);
},
//
// Restore options callbacks
//
setOptions: function (result) {
const options = result.options || {
kdeIntegration: true,
shortcuts: true,
};
SysTrayX.Info.options = options;
},
onOptionsError: function (error) {
console.log(`Options Error: ${error}`);
},
//
// Restore minimize type callbacks
//
@@ -828,12 +854,11 @@ SysTrayX.RestoreOptions = {
// Restore hide default icon callbacks
//
setHideDefaultIcon: function (result) {
const kdeIntegration = result.kdeIntegration || "true";
const hideDefaultIcon = result.hideDefaultIcon || "false";
const checkbox = document.querySelector(`input[name="hideDefaultIcon"]`);
if (kdeIntegration === "false") {
if (!SysTrayX.Info.options.kdeIntegration) {
checkbox.parentNode.setAttribute("style", "display: none;");
}
@@ -1477,10 +1502,6 @@ async function start() {
document.getElementById("defaultCustomIconImage").setAttribute("src","icons/Thunderbird115.png");
}
if (SysTrayX.Info.platformInfo.os !== "linux") {
document.getElementById("kdeintegration").style.display = "none";
}
if (SysTrayX.Info.browserInfo.majorVersion < 115) {
document.getElementById("apicountmethod").style.display = "none";
}
@@ -1492,7 +1513,17 @@ async function start() {
// Set the options
//document.addEventListener("DOMContentLoaded", SysTrayX.RestoreOptions.start);
SysTrayX.RestoreOptions.start();
await SysTrayX.RestoreOptions.start();
// Hide system depending options
if ( !SysTrayX.Info.options.shortcuts ) {
document.getElementById("Shortcuts").style.display = "none";
document.getElementById("ShortcutsContent").style.display = "none";
}
if ( !SysTrayX.Info.options.kdeIntegration || SysTrayX.Info.platformInfo.os !== "linux" ) {
document.getElementById("kdeintegration").style.display = "none";
}
// Enable save button
document