diff --git a/dist/rpm/minimal/systray-x-minimal.spec b/dist/rpm/minimal/systray-x-minimal.spec
index bbc1fac..6a741cf 100644
--- a/dist/rpm/minimal/systray-x-minimal.spec
+++ b/dist/rpm/minimal/systray-x-minimal.spec
@@ -26,19 +26,40 @@ Source0: %{name}-%{version}.tar.xz
Source1: VERSION
BuildRequires: unzip
BuildRequires: zip
+%if 0%{?suse_version} > 1600 || 0%{?fedora_version} > 39
+BuildRequires: pkgconfig(Qt6Core)
+BuildRequires: pkgconfig(Qt6Widgets)
+%else
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5DBus)
BuildRequires: pkgconfig(Qt5X11Extras)
-BuildRequires: pkgconfig(x11)
%if 0%{?fedora_version} || 0%{?centos_version}
BuildRequires: qt5-qtx11extras-devel
-Requires: thunderbird >= 91
-Requires: thunderbird < 121
%else
BuildRequires: libqt5-qtx11extras-devel
+%endif
+%endif
+BuildRequires: pkgconfig(x11)
+%if 0%{?fedora_version} || 0%{?centos_version}
+Requires: thunderbird >= 91
+Requires: thunderbird < 129
+%else
Requires: MozillaThunderbird >= 91
-Requires: MozillaThunderbird < 121
+Requires: MozillaThunderbird < 129
+%endif
+%if 0%{?suse_version} > 1600 || 0%{?fedora_version} > 39
+%if 0%{?fedora_version}
+Requires: qt6-qtwayland
+%else
+Requires: qt6-wayland
+%endif
+%else
+%if 0%{?fedora_version}
+Requires: qt5-qtwayland
+%else
+Requires: libqt5-qtwayland
+%endif
%endif
%description
diff --git a/update_version.sh b/update_version.sh
index a542ad5..dcbbea1 100755
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,24 +1,62 @@
#!/bin/bash
+if [[ -z $2 ]] ; then
+ RELEASE=1
+else
+ RELEASE=$2
+fi
+
VERSION=$1
+echo $VERSION-$RELEASE
+
VERSION_AR=(${VERSION//./ })
VERSION_MAJOR=${VERSION_AR[0]}
VERSION_MINOR=${VERSION_AR[1]}
VERSION_BUILD=${VERSION_AR[2]}
SERVICE_FILE="./dist/rpm/kde/_service"
-sed -i -e "s?\(^.*\"revision\">\).*\(\)?\1$VERSION\2?" $SERVICE_FILE
+sed -i -e "s?\(^.*\"revision\">\).*\(\)?\1release-$VERSION\2?" $SERVICE_FILE
sed -i -e "s?\(^.*\"versionformat\">\).*\(\)?\1$VERSION\2?" $SERVICE_FILE
SERVICE_FILE="./dist/rpm/gnome/_service"
-sed -i -e "s?\(^.*\"revision\">\).*\(\)?\1$VERSION\2?" $SERVICE_FILE
+sed -i -e "s?\(^.*\"revision\">\).*\(\)?\1release-$VERSION\2?" $SERVICE_FILE
sed -i -e "s?\(^.*\"versionformat\">\).*\(\)?\1$VERSION\2?" $SERVICE_FILE
SERVICE_FILE="./dist/rpm/minimal/_service"
-sed -i -e "s?\(^.*\"revision\">\).*\(\)?\1$VERSION\2?" $SERVICE_FILE
+sed -i -e "s?\(^.*\"revision\">\).*\(\)?\1release-$VERSION\2?" $SERVICE_FILE
sed -i -e "s?\(^.*\"versionformat\">\).*\(\)?\1$VERSION\2?" $SERVICE_FILE
+
+SERVICE_FILE="./dist/deb/kde/debian.changelog"
+sed -i -e "0,/systray-x/{s?\(^systray-x \).*\( unstable.*\)?\1($VERSION-$RELEASE)\2?}" $SERVICE_FILE
+SERVICE_FILE="./dist/deb/kde/systray-x.dsc"
+sed -i -e "s?\(^Version: \).*?\1$VERSION-$RELEASE?" $SERVICE_FILE
+
+SERVICE_FILE="./dist/deb/gnome/debian.changelog"
+sed -i -e "0,/systray-x/{s?\(^systray-x-gnome \).*\( unstable.*\)?\1($VERSION-$RELEASE)\2?}" $SERVICE_FILE
+SERVICE_FILE="./dist/deb/gnome/systray-x-gnome.dsc"
+sed -i -e "s?\(^Version: \).*?\1$VERSION-$RELEASE?" $SERVICE_FILE
+
+SERVICE_FILE="./dist/deb/minimal/debian.changelog"
+sed -i -e "0,/systray-x/{s?\(^systray-x-minimal \).*\( unstable.*\)?\1($VERSION-$RELEASE)\2?}" $SERVICE_FILE
+SERVICE_FILE="./dist/deb/minimal/systray-x-minimal.dsc"
+sed -i -e "s?\(^Version: \).*?\1$VERSION-$RELEASE?" $SERVICE_FILE
+
+
+SERVICE_FILE="./dist/arch/kde/PKGBUILD"
+sed -i -e "s?\(^pkgver=\).*?\1$VERSION?" $SERVICE_FILE
+sed -i -e "s?\(^pkgrel=\).*?\1$RELEASE?" $SERVICE_FILE
+
+SERVICE_FILE="./dist/arch/gnome/PKGBUILD"
+sed -i -e "s?\(^pkgver=\).*?\1$VERSION?" $SERVICE_FILE
+sed -i -e "s?\(^pkgrel=\).*?\1$RELEASE?" $SERVICE_FILE
+
+SERVICE_FILE="./dist/arch/minimal/PKGBUILD"
+sed -i -e "s?\(^pkgver=\).*?\1$VERSION?" $SERVICE_FILE
+sed -i -e "s?\(^pkgrel=\).*?\1$RELEASE?" $SERVICE_FILE
+
+
MANIFEST_FILE="./webext/manifest.json"
sed -i -e "s?\(^.*\"version\": \"\).*\(\",\)?\1$VERSION\2?" $MANIFEST_FILE
diff --git a/webext/_locales/de/messages.json b/webext/_locales/de/messages.json
index 6c628e1..4f28721 100644
--- a/webext/_locales/de/messages.json
+++ b/webext/_locales/de/messages.json
@@ -154,6 +154,31 @@
"description": "Start application in tray"
},
+ "windows_positions_correction_options": {
+ "message": "Position",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "Corriegere fensterpositionen",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "Keine Korrektur mit Titelleiste",
+ "description": "No titlebar correction"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "Größe der Titelleiste hinzufügen",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "Größe der Titelleiste hinzufügen subtrahieren",
+ "description": "Subtract titlebar size"
+ },
+
"restore_positions_on_startup": {
"message": "Fensterpositionen wiederherstellen beim Start",
"description": "Restore the window positions on startup"
diff --git a/webext/_locales/el/messages.json b/webext/_locales/el/messages.json
index 7879664..cddda6d 100644
--- a/webext/_locales/el/messages.json
+++ b/webext/_locales/el/messages.json
@@ -154,6 +154,31 @@
"description": "Start application in tray"
},
+ "windows_positions_correction_options": {
+ "message": "Τοποθεσία",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "Προσαρμόστε τις θέσεις των παραθύρων",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "Καμία διόρθωση γραμμής τίτλου",
+ "description": "No titlebar correction"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "Προσθήκη μεγέθους γραμμής τίτλου",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "Αφαιρέστε το μέγεθος της γραμμής τίτλου",
+ "description": "Subtract titlebar size"
+ },
+
"restore_positions_on_startup": {
"message": "Επαναφορά θέσεων παραθύρου κατά την εκκίνηση",
"description": "Restore the window positions on startup"
diff --git a/webext/_locales/en-US/messages.json b/webext/_locales/en-US/messages.json
index f4621ec..64d8458 100644
--- a/webext/_locales/en-US/messages.json
+++ b/webext/_locales/en-US/messages.json
@@ -154,6 +154,31 @@
"description": "Start application in tray"
},
+ "windows_positions_correction_options": {
+ "message": "Position",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "Correct window positions",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "No titlebar correction",
+ "description": "No titlebar correction"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "Add titlebar size",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "Subtract titlebar size",
+ "description": "Subtract titlebar size"
+ },
+
"restore_positions_on_startup": {
"message": "Restore window positions on startup",
"description": "Restore the window positions on startup"
diff --git a/webext/_locales/it/messages.json b/webext/_locales/it/messages.json
index 15cab54..9875c2a 100644
--- a/webext/_locales/it/messages.json
+++ b/webext/_locales/it/messages.json
@@ -154,6 +154,31 @@
"description": "Start application in tray"
},
+ "windows_positions_correction_options": {
+ "message": "Posizione",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "Posizioni corrette delle finestre",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "Nessuna correzione della barra del titolo",
+ "description": "No titlebar correction"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "Aggiungi la dimensione della barra del titolo",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "Sottrai la dimensione della barra del titolo",
+ "description": "Subtract titlebar size"
+ },
+
"restore_positions_on_startup": {
"message": "Ripristina le posizioni della finestra all'avvio",
"description": "Restore the window positions on startup"
diff --git a/webext/_locales/nl/messages.json b/webext/_locales/nl/messages.json
index 4af130b..6b644c3 100644
--- a/webext/_locales/nl/messages.json
+++ b/webext/_locales/nl/messages.json
@@ -154,6 +154,31 @@
"description": "Start application in tray"
},
+ "windows_positions_correction_options": {
+ "message": "Positie",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "Corrigeer vensterposities",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "Geen titelbalk correctie",
+ "description": "No titlebar correction"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "Titlebalk grootte toevoegen",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "Titlebalk grootte aftrekken",
+ "description": "Subtract titlebar size"
+ },
+
"restore_positions_on_startup": {
"message": "Herstel vensterposities bij opstarten",
"description": "Restore the window positions on startup"
diff --git a/webext/_locales/pt-BR/messages.json b/webext/_locales/pt-BR/messages.json
index 357f23c..35127b5 100644
--- a/webext/_locales/pt-BR/messages.json
+++ b/webext/_locales/pt-BR/messages.json
@@ -154,6 +154,31 @@
"description": "Start application in tray"
},
+ "windows_positions_correction_options": {
+ "message": "Posição",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "Posições corretas da janela",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "Nenhuma correção na barra de título",
+ "description": "No titlebar correction"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "Adicionar tamanho da barra de título",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "Subtraia o tamanho da barra de título",
+ "description": "Subtract titlebar size"
+ },
+
"restore_positions_on_startup": {
"message": "Restaurar posições da janela na inicialização",
"description": "Restore the window positions on startup"
diff --git a/webext/_locales/ru/messages.json b/webext/_locales/ru/messages.json
index 57f0e5a..8b6d68a 100644
--- a/webext/_locales/ru/messages.json
+++ b/webext/_locales/ru/messages.json
@@ -154,6 +154,31 @@
"description": "Start application in tray"
},
+ "windows_positions_correction_options": {
+ "message": "Позиция",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "Правильное расположение окон",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "No titlebar correction",
+ "description": "Без исправления названия"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "Добавить размер заголовка",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "Вычтите размер строки заголовка",
+ "description": "Subtract titlebar size"
+ },
+
"restore_positions_on_startup": {
"message": "Восстановить положение окон при запуске",
"description": "Restore the window positions on startup"
diff --git a/webext/_locales/zh-CN/messages.json b/webext/_locales/zh-CN/messages.json
new file mode 100644
index 0000000..7543550
--- /dev/null
+++ b/webext/_locales/zh-CN/messages.json
@@ -0,0 +1,581 @@
+{
+ "extension_name": {
+ "message": "SysTray-X",
+ "description": "Name of the webextension"
+ },
+
+ "extension_description": {
+ "message": "系统托盘控制插件,请下载安装配套应用。",
+ "description": "Webextension descriptions"
+ },
+
+ "preferences": {
+ "message": "SysTray-X 首选项",
+ "description": "Title of preferences page"
+ },
+
+ "intro_line_1": {
+ "message": "该插件需要和外部应用配合工作,请在这里获取:",
+ "description": "Introduction line 1"
+ },
+
+ "intro_link": {
+ "message": "下载 SysTray-X 配套应用",
+ "description": "Link description"
+ },
+
+ "tab_windows": {
+ "message": "窗口",
+ "description": "Tab for Window options"
+ },
+
+ "tab_icon": {
+ "message": "图标",
+ "description": "Tab for Icon options"
+ },
+
+ "tab_count": {
+ "message": "计数",
+ "description": "Tab for Count options"
+ },
+
+ "tab_apps": {
+ "message": "应用",
+ "description": "Tab for Apps options"
+ },
+
+ "tab_mail": {
+ "message": "邮件",
+ "description": "Tab for Mail options"
+ },
+
+ "tab_shortcuts": {
+ "message": "快捷键",
+ "description": "Tab for Shortcuts options"
+ },
+
+ "tab_debug": {
+ "message": "调试",
+ "description": "Tab for Debug options"
+ },
+
+ "windows": {
+ "message": "窗口",
+ "description": "Title for Windows options"
+ },
+
+ "windows_min_options": {
+ "message": "最小化按钮",
+ "description": "Caption for Minimize options"
+ },
+
+ "windows_min_default": {
+ "message": "最小化",
+ "description": "Minimize option 0"
+ },
+
+ "windows_min_to_tray": {
+ "message": "收回托盘",
+ "description": "Minimize to tray"
+ },
+
+ "windows_min_icon_options": {
+ "message": "托盘图标",
+ "description": "Caption for Icon options"
+ },
+
+ "windows_min_default_icon": {
+ "message": "最小化",
+ "description": "Minimize option 0"
+ },
+
+ "windows_min_to_tray_icon": {
+ "message": "收回托盘",
+ "description": "Minimize to tray"
+ },
+
+ "windows_min_to_tray_1": {
+ "message": "收回托盘,方法 1",
+ "description": "Minimize option 1"
+ },
+
+ "windows_min_to_tray_2": {
+ "message": "收回托盘,方法 2",
+ "description": "Minimize option 2"
+ },
+
+ "windows_close_options": {
+ "message": "关闭按钮",
+ "description": "Caption for Close options"
+ },
+
+ "windows_close_default": {
+ "message": "普通关闭",
+ "description": "Close option 0"
+ },
+
+ "windows_close_1": {
+ "message": "主窗口最小化,子窗口关闭",
+ "description": "Close option 1"
+ },
+
+ "windows_close_2": {
+ "message": "所有窗口最小化",
+ "description": "Close option 2"
+ },
+
+ "windows_close_tray_1": {
+ "message": "主窗口收回托盘,子窗口关闭",
+ "description": "Close option 3"
+ },
+
+ "windows_close_tray_2": {
+ "message": "所有窗口收回托盘",
+ "description": "Close option 4"
+ },
+
+ "windows_startup_options": {
+ "message": "启动方式",
+ "description": "Startup"
+ },
+
+ "windows_default_startup": {
+ "message": "普通启动",
+ "description": "Default startup"
+ },
+
+ "windows_minimized_startup": {
+ "message": "最小化启动",
+ "description": "Start application minimized"
+ },
+
+ "windows_docked_startup": {
+ "message": "启动至托盘",
+ "description": "Start application in tray"
+ },
+
+ "windows_positions_correction_options": {
+ "message": "位置",
+ "description": "Position"
+ },
+
+ "windows_positions_correction": {
+ "message": "正确的窗口位置",
+ "description": "Correct window positions"
+ },
+
+ "windows_no_correction": {
+ "message": "没有标题栏修正",
+ "description": "No titlebar correction"
+ },
+
+ "windows_add_titlebar_size": {
+ "message": "添加标题栏大小",
+ "description": "Add titlebar size"
+ },
+
+ "windows_subtract_titlebar_size": {
+ "message": "减去标题栏大小",
+ "description": "Subtract titlebar size"
+ },
+
+ "restore_positions_on_startup": {
+ "message": "启动时恢复窗口位置",
+ "description": "Restore the window positions on startup"
+ },
+
+ "icons": {
+ "message": "图标",
+ "description": "Title for Icons options"
+ },
+
+ "icons_default_options": {
+ "message": "默认",
+ "description": "Caption for Default Icon options"
+ },
+
+ "icons_default_tb": {
+ "message": "Thunderbird 默认",
+ "description": "Default icon option 1"
+ },
+
+ "icons_default_lookthrough": {
+ "message": "透明",
+ "description": "Default icon option 2"
+ },
+
+ "icons_default_custom": {
+ "message": "自定义",
+ "description": "Default icon option 3"
+ },
+
+ "icons_default_custom_choose": {
+ "message": "选择图标...",
+ "description": "Default icon option 3 button"
+ },
+
+ "icons_default_kde_integration": {
+ "message": "KDE 集成(隐藏)",
+ "description": "Default icon KDE integration"
+ },
+
+ "icons_unread_options": {
+ "message": "有未读邮件时",
+ "description": "Caption for Unread Icon options"
+ },
+
+ "icons_unread_blank": {
+ "message": "空白",
+ "description": "Unread Icon option 1"
+ },
+
+ "icons_unread_new": {
+ "message": "新邮件",
+ "description": "Unread Icon option 2"
+ },
+
+ "icons_unread_custom": {
+ "message": "自定义",
+ "description": "Unread Icon option 3"
+ },
+
+ "icons_unread_custom_choose": {
+ "message": "选择图标...",
+ "description": "Unread Icon option 3 button"
+ },
+
+ "icons_unread_no": {
+ "message": "无",
+ "description": "Unread Icon option 4"
+ },
+
+ "icons_invert_icon": {
+ "message": "反色",
+ "description": "Invert icon"
+ },
+
+ "count": {
+ "message": "计数",
+ "description": "Title for Count options"
+ },
+
+ "count_number_display": {
+ "message": "显示消息计数",
+ "description": "Show message count"
+ },
+
+ "count_new_indicator_display": {
+ "message": "显示新消息提示",
+ "description": "Show the new message indicator"
+ },
+
+ "count_startup_delay": {
+ "message": "启动延迟秒数",
+ "description": "Startup delay"
+ },
+
+ "count_number_count_type": {
+ "message": "计数类型",
+ "description": "Count type options"
+ },
+
+ "count_number_count_unread": {
+ "message": "未读消息",
+ "description": "Count unread mails"
+ },
+
+ "count_number_count_new": {
+ "message": "新消息",
+ "description": "Count new mails"
+ },
+
+ "count_api_count_method": {
+ "message": "由 API 提供计数方法",
+ "description": "API count method"
+ },
+
+ "count_number_options": {
+ "message": "数字",
+ "description": "Caption for Number options"
+ },
+
+ "count_number_color": {
+ "message": "颜色:",
+ "description": "Color of the number"
+ },
+
+ "count_number_size": {
+ "message": "字号:",
+ "description": "Size of the number"
+ },
+
+ "count_number_alignment": {
+ "message": "位置:",
+ "description": "Number alignment"
+ },
+
+ "count_number_top_left": {
+ "message": "左上",
+ "description": "Number alignment top left"
+ },
+
+ "count_number_top_center": {
+ "message": "中上",
+ "description": "Number alignment top center"
+ },
+
+ "count_number_top_right": {
+ "message": "右上",
+ "description": "Number alignment top right"
+ },
+
+ "count_number_middle_left": {
+ "message": "左中",
+ "description": "Number alignment middle left"
+ },
+
+ "count_number_middle_center": {
+ "message": "正中",
+ "description": "Number alignment middle center"
+ },
+
+ "count_number_middle_right": {
+ "message": "右中",
+ "description": "Number alignment middle right"
+ },
+
+ "count_number_bottom_left": {
+ "message": "左下",
+ "description": "Number alignment bottom left"
+ },
+
+ "count_number_bottom_center": {
+ "message": "中下",
+ "description": "Number alignment bottom center"
+ },
+
+ "count_number_bottom_right": {
+ "message": "右下",
+ "description": "Number alignment bottom right"
+ },
+
+ "count_number_margins": {
+ "message": "边距(左,上,中,下)",
+ "description": "Number margins (left, top, right, bottom)"
+ },
+
+ "count_new_indicator": {
+ "message": "新消息提示",
+ "description": "New indicator type"
+ },
+
+ "count_new_indicator_round": {
+ "message": "圆点",
+ "description": "Round indicator"
+ },
+
+ "count_new_indicator_star": {
+ "message": "星形",
+ "description": "Star indicator"
+ },
+
+ "count_new_shade_color": {
+ "message": "背景色:",
+ "description": "Shade the icon"
+ },
+
+ "apps": {
+ "message": "应用",
+ "description": "Title for Apps options"
+ },
+
+ "apps_start_application": {
+ "message": "启动应用时",
+ "description": "The start application parameters"
+ },
+
+ "apps_start_app": {
+ "message": "应用:",
+ "description": "The start application"
+ },
+
+ "apps_start_app_args": {
+ "message": "参数:",
+ "description": "Arguments for a start application"
+ },
+
+ "apps_close_application": {
+ "message": "关闭应用时",
+ "description": "The close application parameters"
+ },
+
+ "apps_close_app": {
+ "message": "应用:",
+ "description": "The close application"
+ },
+
+ "apps_close_app_args": {
+ "message": "参数:",
+ "description": "Arguments for a close application"
+ },
+
+ "accounts": {
+ "message": "账户",
+ "description": "Title for Accounts options"
+ },
+
+ "shortcuts": {
+ "message": "快捷键",
+ "description": "Title for Shortcuts options"
+ },
+
+ "shortcuts_showhide_shortcut": {
+ "message": "显示 / 隐藏 Thunderbird:",
+ "description": "Label for the show / hide shortcut edit box"
+ },
+
+ "shortcuts_clear_button": {
+ "message": "清空",
+ "description": "Clear"
+ },
+
+ "debug": {
+ "message": "调试",
+ "description": "Title for Debug options"
+ },
+
+ "debug_display": {
+ "message": "显示调试窗口",
+ "description": "Display the debug window"
+ },
+
+ "save_preferences": {
+ "message": "保存首选项",
+ "description": "Save preferences"
+ },
+
+ "save_preferences_button": {
+ "message": "保存",
+ "description": "Save preferences button"
+ },
+
+ "reset_preferences": {
+ "message": "重置首选项",
+ "description": "Reset preferences"
+ },
+
+ "reset_preferences_button": {
+ "message": "重置",
+ "description": "Reset preferences button"
+ },
+
+ "about_title": {
+ "message": "关于 SysTray-X",
+ "description": "About box title"
+ },
+
+ "about_line_1": {
+ "message": "SysTray-X 配套应用,作者 Ximi1970",
+ "description": "Line 1"
+ },
+
+ "about_version": {
+ "message": "版本:",
+ "description": "Version"
+ },
+
+ "about_build": {
+ "message": "构建:",
+ "description": "Build"
+ },
+
+ "about_hash": {
+ "message": "Hash:",
+ "description": "Hash"
+ },
+
+ "about_branch": {
+ "message": "分支:",
+ "description": "Branch"
+ },
+
+ "debug_title": {
+ "message": "SysTray-X 调试",
+ "description": "Debug window title"
+ },
+
+ "debug_test_1": {
+ "message": "测试 1",
+ "description": "Button 1"
+ },
+
+ "debug_test_2": {
+ "message": "测试 2",
+ "description": "Button 2"
+ },
+
+ "debug_test_3": {
+ "message": "测试 3",
+ "description": "Button 3"
+ },
+
+ "debug_unread": {
+ "message": "未读邮件:",
+ "description": "Unread label"
+ },
+
+ "menu_showhide": {
+ "message": "显示 / 隐藏(&S)",
+ "description": "Show Hide menu entry"
+ },
+
+ "menu_preferences": {
+ "message": "首选项(&P)",
+ "description": "Preferences menu entry"
+ },
+
+ "menu_about": {
+ "message": "关于(&A)",
+ "description": "About menu entry"
+ },
+
+ "menu_quit": {
+ "message": "退出(&Q)",
+ "description": "Quit menu entry"
+ },
+
+ "menu_close": {
+ "message": "关闭",
+ "description": "Close button"
+ },
+
+ "mail_notification_icon": {
+ "message": "邮件提示图标",
+ "description": "Mail icon selection title"
+ },
+
+ "number_properties": {
+ "message": "数字属性",
+ "description": "Number properties title"
+ },
+
+ "image_open": {
+ "message": "打开图片",
+ "description": "File image dialog"
+ },
+
+ "image_files": {
+ "message": "图片文件(*.png *.jpg *.bmp)",
+ "description": "File image selection"
+ },
+
+ "image_save": {
+ "message": "保存",
+ "description": "File image save"
+ },
+
+ "image_cancel": {
+ "message": "取消",
+ "description": "File image cancel"
+ }
+}
diff --git a/webext/background.html b/webext/background.html
index 4c357a7..caf8b87 100644
--- a/webext/background.html
+++ b/webext/background.html
@@ -8,7 +8,6 @@
-
Background
Background HTML
diff --git a/webext/background.js b/webext/background.js
index e35fc3a..1299447 100644
--- a/webext/background.js
+++ b/webext/background.js
@@ -34,7 +34,6 @@ SysTrayX.Info = {
SysTrayX.Messaging = {
startupDelayFinished: false,
accounts: [],
- folderTree: {},
countType: "0",
showNewIndicator: "false",
closeType: "1",
@@ -102,17 +101,8 @@ SysTrayX.Messaging = {
browser.accounts.onDeleted.addListener(SysTrayX.Messaging.accountDeleted);
}
- // Get all accounts
- SysTrayX.Messaging.accounts = await browser.accounts.list(false);
-
- // Fill the sub folders using the folders API, they are not same...
- for (let i = 0; i < SysTrayX.Messaging.accounts.length; ++i) {
- const subFolders = await browser.folders.getSubFolders(
- SysTrayX.Messaging.accounts[i],
- true
- );
- SysTrayX.Messaging.accounts[i].folders = subFolders;
- }
+ // Get the accounts and subfolders
+ SysTrayX.Messaging.accounts = await browser.accounts.list();
console.debug("Accounts: " + JSON.stringify(SysTrayX.Messaging.accounts));
@@ -318,26 +308,46 @@ SysTrayX.Messaging = {
// Count the initial unread messages
for (const filter of SysTrayX.Messaging.filters) {
- for (const path of filter.folders) {
- const folder = {
- accountId: filter.accountId,
- path: path,
- };
-
+ const accountId = filter.accountId;
+ for (const storedFolder of filter.folders) {
+ let path;
+ let folderParam;
+ if (typeof(storedFolder) === "string") {
+ // Filters pre TB 121
+ path = storedFolder;
+ folderParam = {
+ accountId: accountId,
+ path: storedFolder,
+ };
+ } else {
+ // Filters TB 121
+ if (storedFolder.mailFolderId === undefined) {
+ // TB 121 filter setup but older TB
+ path = storedFolder.path;
+ folderParam = {
+ accountId: accountId,
+ path: path,
+ };
+ } else {
+ path = storedFolder.path;
+ folderParam = storedFolder.mailFolderId;
+ }
+ }
+
let mailFolderInfo = {};
try {
- mailFolderInfo = await browser.folders.getFolderInfo(folder);
+ mailFolderInfo = await browser.folders.getFolderInfo(folderParam);
} catch (err) {
console.debug("Filter error: " + err);
console.debug("Filter error: " + JSON.stringify(folder));
}
-
+
if (mailFolderInfo.unreadMessageCount !== undefined) {
- if (SysTrayX.Messaging.unread[folder.accountId] === undefined) {
- SysTrayX.Messaging.unread[folder.accountId] = {};
+ if (SysTrayX.Messaging.unread[accountId] === undefined) {
+ SysTrayX.Messaging.unread[accountId] = {};
}
- SysTrayX.Messaging.unread[folder.accountId][folder.path] =
+ SysTrayX.Messaging.unread[accountId][path] =
mailFolderInfo.unreadMessageCount;
}
}
@@ -472,110 +482,6 @@ SysTrayX.Messaging = {
}
},
- //
- // Callback for folder changes
- //
- updateFilters: function (rootFolder, parentFolder, folder, added) {
- const oldFolders = SysTrayX.Messaging.folderTree[rootFolder];
- const oldPaths = getFolderPaths(oldFolders);
-
- browser.accounts.list().then(
- (accounts) => {
- this.updateFiltersCallback(
- rootFolder,
- parentFolder,
- folder,
- added,
- oldFolders,
- oldPaths,
- accounts
- );
- },
- () => console.log("Failed to get the accounts")
- );
- },
-
- updateFiltersCallback: async function (
- rootFolder,
- parentFolder,
- folder,
- added,
- oldFolders,
- oldPaths,
- accounts
- ) {
- // Get new folder tree
- const folderTree = getFolderTree(accounts, SysTrayX.Info.browserInfo);
- const newFolders = folderTree[rootFolder];
- const newPaths = getFolderPaths(newFolders);
- const changes = findFolderPathsDiff(oldPaths, newPaths).filter((change) =>
- change.endsWith(parentFolder + "/" + folder)
- );
-
- if (changes.length === 1 && added) {
- // Folder has beeen added
-
- const addedFolder = changes[0];
-
- // Is parent selected?
- const parentAddedFolder = addedFolder.substring(
- 0,
- addedFolder.lastIndexOf("/")
- );
-
- const parentSelected = findFolderPath(
- SysTrayX.Messaging.filters,
- parentAddedFolder
- );
-
- if (parentSelected) {
- // Add the new folder to the filters
-
- const newFilter = {
- ...parentSelected,
- folder: {
- ...parentSelected.folder,
- path: changes[0],
- name: changes[0].substring(changes[0].lastIndexOf("/") + 1),
- },
- };
-
- if (
- SysTrayX.Messaging.filters.filter(
- (filter) => filter.folder.path === newFilter.folder.path
- ).length === 0
- ) {
- SysTrayX.Messaging.filters.push(newFilter);
-
- // Store the new filters
- await storage().set({
- filters: SysTrayX.Messaging.filters,
- });
- }
- }
- } else if (changes.length === 1 && !added) {
- // Folder has been removed, remove also all children
-
- const filters = SysTrayX.Messaging.filters.filter(
- (filter) => !filter.folder.path.startsWith(changes[0])
- );
-
- if (filters.length !== SysTrayX.Messaging.filters.length) {
- // Remove found filters (and children) from the filters
- SysTrayX.Messaging.filters = filters;
-
- // Store the new filters
- await storage().set({
- filters: SysTrayX.Messaging.filters,
- });
- }
- }
-
- // Store the new accounts and folder tree
- SysTrayX.Messaging.accounts = accounts;
- SysTrayX.Messaging.folderTree = folderTree;
- },
-
requestOptions: function () {
SysTrayX.Link.postSysTrayXMessage({ optionsRequest: true });
},
@@ -629,6 +535,8 @@ SysTrayX.Messaging = {
"minimizeIconType",
"closeType",
"startupType",
+ "windowPosCor",
+ "windowPosCorType",
"restorePositions",
"defaultIconType",
"defaultIconMime",
@@ -667,6 +575,8 @@ SysTrayX.Messaging = {
const minimizeIconType = result.minimizeIconType || "1";
const closeType = result.closeType || "1";
const startupType = result.startupType || "0";
+ const windowPosCor = result.windowPosCor || "false";
+ const windowPosCorType = result.windowPosCorType || "0";
const restorePositions = result.restorePositions || "false";
const defaultIconType = result.defaultIconType || "0";
const defaultIconMime = result.defaultIconMime || "image/png";
@@ -706,6 +616,8 @@ SysTrayX.Messaging = {
minimizeIconType,
closeType,
startupType,
+ windowPosCor,
+ windowPosCorType,
restorePositions,
defaultIconType,
defaultIconMime,
@@ -825,6 +737,20 @@ SysTrayX.Link = {
});
}
+ const windowPosCor = response["preferences"].windowPosCor;
+ if (windowPosCor) {
+ await storage().set({
+ windowPosCor: windowPosCor,
+ });
+ }
+
+ const windowPosCorType = response["preferences"].windowPosCorType;
+ if (windowPosCorType) {
+ await storage().set({
+ windowPosCorType: windowPosCorType,
+ });
+ }
+
const restorePositions = response["preferences"].restorePositions;
if (restorePositions) {
await storage().set({
diff --git a/webext/css/options.css b/webext/css/options.css
index 85a78eb..c15c723 100644
--- a/webext/css/options.css
+++ b/webext/css/options.css
@@ -78,6 +78,7 @@ body {
#minimizeiconselect,
#closeselect,
#startupselect,
+#positionscorrectionselect,
#defaulticonselect,
#iconselect,
#numberprops,
diff --git a/webext/js/defaults.js b/webext/js/defaults.js
index 7f0c3b0..263c884 100644
--- a/webext/js/defaults.js
+++ b/webext/js/defaults.js
@@ -219,11 +219,44 @@ async function getIcon() {
}
}
+
+//
+// Find a path in the account folder tree
+//
+function findFolder(rootFolder, path) {
+ function traverse(folder) {
+ if (folder === undefined) {
+ return undefined;
+ }
+
+ if (folder.path === path) {
+ return folder;
+ }
+
+ if (folder.subFolders === undefined) {
+ return undefined;
+ }
+
+ for (let sub of folder.subFolders) {
+ const found = traverse(sub);
+ if( found !== undefined ) {
+ return found;
+ }
+ }
+
+ return undefined;
+ }
+
+ const found = traverse(rootFolder);
+
+ return found;
+}
+
//
// Get filters
//
async function getFilters() {
- function resolve(result) {
+ async function resolve(result) {
let filters = result.filters || undefined;
if (filters === undefined || filters.length === 0) {
@@ -234,19 +267,22 @@ async function getFilters() {
filters = [];
for (const account of SysTrayX.Messaging.accounts) {
- const inbox = account.folders.filter(
- (folder) => folder.type === "inbox"
- );
+ let inbox;
+ if (account.rootFolder !== undefined) {
+ inbox = account.rootFolder.subFolders.filter(
+ (folder) => folder.type === "inbox"
+ );
+ } else {
+ inbox = account.folders.filter(
+ (folder) => folder.type === "inbox"
+ );
+ }
if (inbox.length > 0) {
- let folder = {};
-
- // console.debug("Folder 91+: " + JSON.stringify(inbox[0]));
-
filters.push({
accountId: inbox[0].accountId,
version: SysTrayX.Info.version,
- folders: [inbox[0].path],
+ folders: [{mailFolderId: inbox[0].id, path: inbox[0].path}],
});
}
}
@@ -254,6 +290,109 @@ async function getFilters() {
console.debug("Force new filters: " + JSON.stringify(filters));
} else {
console.debug("Stored filters: " + JSON.stringify(filters));
+
+ if (filters[0].folders.length > 0) {
+ if (typeof(filters[0].folders[0]) === "string") {
+
+ console.debug("Conversion needed");
+
+ // Convert the filter folder path list to an object
+ // containing at least the path and if available the mail folder id (TB 121 and newer)
+
+ const newFilters = [];
+ for (const account of SysTrayX.Messaging.accounts) {
+ let rootFolder = account.rootFolder
+ if( rootFolder === undefined ) {
+ rootFolder = {
+ path: "",
+ subFolders: account.folders
+ };
+ }
+
+ const filter = filters.filter(
+ (filter) => filter.accountId === account.id
+ );
+
+ console.debug("Found filters: " + filter.length);
+ console.debug("Found filter: " + JSON.stringify(filter));
+
+ if (filter.length === 1) {
+ let newFilter = {
+ accountId: filter[0].accountId,
+ version: SysTrayX.Info.version,
+ folders: []
+ };
+
+ for (const path of filter[0].folders) {
+ const accountFolder = findFolder(rootFolder, path);
+
+ if (accountFolder !== undefined)
+ {
+ newFilter.folders.push({mailFolderId: accountFolder.id, path: accountFolder.path});
+ }
+ }
+
+ newFilters.push(newFilter);
+ }
+ }
+
+ filters = newFilters;
+
+ console.debug("Force new filters: " + JSON.stringify(filters));
+
+ // Save the new filters
+ await storage().set({
+ filters: filters,
+ });
+ } else {
+ if (filters[0].folders[0].mailFolderId === undefined &&
+ SysTrayX.Info.browserInfo.majorVersion >= 121) {
+
+ console.debug("Update needed");
+
+ // Update filter folder object
+ // with the the mail folder id
+
+ const newFilters = [];
+ for (const account of SysTrayX.Messaging.accounts) {
+ const filter = filters.filter(
+ (filter) => filter.accountId === account.id
+ );
+
+ console.debug("Found filters: " + filter.length);
+ console.debug("Found filter: " + JSON.stringify(filter));
+
+ if (filter.length === 1) {
+ let newFilter = {
+ accountId: filter[0].accountId,
+ version: SysTrayX.Info.version,
+ folders: []
+ };
+
+ for (const folder of filter[0].folders) {
+ const accountFolder = findFolder(account.rootFolder, folder.path)
+
+ if (accountFolder !== undefined)
+ {
+ newFilter.folders.push({mailFolderId: accountFolder.id, path: accountFolder.path});
+ }
+ }
+
+ newFilters.push(newFilter);
+ }
+ }
+
+ filters = newFilters;
+
+ console.debug("Force new filters: " + JSON.stringify(filters));
+
+ // Save the new filters
+ await storage().set({
+ filters: filters,
+ });
+ }
+ }
+ }
}
return filters;
@@ -328,11 +467,23 @@ function isFolderInFilters(folder) {
);
if (accountIndex !== -1) {
- return (
- SysTrayX.Messaging.filters[accountIndex].folders.filter(
- (path) => path === folder.path
- ).length > 0
- );
+ const folders = SysTrayX.Messaging.filters[accountIndex].folders;
+
+ if (folders[0] === "string") {
+ // Filters pre TB 121
+ return (
+ folders.filter(
+ (path) => path === folder.path
+ ).length > 0
+ );
+ } else {
+ // Filters TB 121
+ return (
+ folders.map(f => f.path).filter(
+ (path) => path === folder.path
+ ).length > 0
+ );
+ }
} else {
return false;
}
@@ -347,11 +498,23 @@ function isParentFolderInFilters(folder) {
);
if (accountIndex !== -1) {
- return (
- SysTrayX.Messaging.filters[accountIndex].folders.filter(
- (path) => path === parentPath
- ).length > 0
- );
+ const folders = SysTrayX.Messaging.filters[accountIndex].folders;
+
+ if (folders[0] === "string") {
+ // Filters pre TB 121
+ return (
+ folders.filter(
+ (path) => path === parentPath
+ ).length > 0
+ );
+ } else {
+ // Filters TB 121
+ return (
+ folders.map(f => f.path).filter(
+ (path) => path === parentPath
+ ).length > 0
+ );
+ }
} else {
return false;
}
@@ -365,7 +528,14 @@ async function deleteFolderFromFilters(folder) {
if (accountIndex !== -1) {
const account = SysTrayX.Messaging.filters[accountIndex];
- account.folders = account.folders.filter((path) => path !== folder.path);
+
+ if (account.folders[0] === "string" ) {
+ // Filters pre TB 121
+ account.folders = account.folders.filter((path) => path !== folder.path);
+ } else {
+ // Filters TB 121
+ account.folders = account.folders.filter((f) => f.path !== folder.path);
+ }
// Store the new filters
await storage().set({
@@ -391,7 +561,12 @@ async function addFolderToFilters(newFolder) {
if (accountIndex !== -1) {
const account = SysTrayX.Messaging.filters[accountIndex];
- account.folders.push(newFolder.path);
+
+ if (account.folders[0] === "string" ) {
+ account.folders.push(newFolder.path);
+ } else {
+ account.folders.push({mailFolderId: newFolder.id, path: newFolder.path});
+ }
// Store the new filter
await storage().set({
@@ -403,42 +578,65 @@ async function addFolderToFilters(newFolder) {
// Collect unread mail
const collectUnreadMail = async () => {
for (const filter of SysTrayX.Messaging.filters) {
- for (const path of filter.folders) {
- const folder = {
- accountId: filter.accountId,
- path: path,
- };
-
+
+ const accountId = filter.accountId;
+ for (const storedFolder of filter.folders) {
let mailFolderInfo = {};
- try {
- mailFolderInfo = await browser.folders.getFolderInfo(folder);
- } catch (err) {
- //console.debug("Filter error: " + err);
- //console.debug("Filter error: " + JSON.stringify(folder));
- // Get all accounts
- SysTrayX.Messaging.accounts = await browser.accounts.list(false);
+ let path;
+ if (typeof(storedFolder) === "string") {
+ // Filters pre TB 121
+ path = storedFolder;
- // Check the filters for the accounts
- SysTrayX.Messaging.accountFilterCheck();
+ try {
+ mailFolderInfo = await browser.folders.getFolderInfo({
+ accountId: accountId,
+ path: storedFolder,
+ });
+ } catch (err) {
+ //console.debug("Filter error: " + err);
+ //console.debug("Filter error: " + JSON.stringify(folder));
+
+ // Get all accounts
+ SysTrayX.Messaging.accounts = await browser.accounts.list();
+
+ // Check the filters for the accounts
+ SysTrayX.Messaging.accountFilterCheck();
+ }
+ } else {
+ // Filters TB 121
+ path = storedFolder.path;
+
+ try {
+ mailFolderInfo = await browser.folders.getFolderInfo(storedFolder.mailFolderId);
+ } catch (err) {
+ //console.debug("Filter error: " + err);
+ //console.debug("Filter error: " + JSON.stringify(folder));
+
+ // Get all accounts
+ SysTrayX.Messaging.accounts = await browser.accounts.list();
+
+ // Check the filters for the accounts
+ SysTrayX.Messaging.accountFilterCheck();
+ }
}
if (mailFolderInfo.unreadMessageCount !== undefined) {
- if (SysTrayX.Messaging.unread[folder.accountId] === undefined) {
- SysTrayX.Messaging.unread[folder.accountId] = {};
+ if (SysTrayX.Messaging.unread[accountId] === undefined) {
+ SysTrayX.Messaging.unread[accountId] = {};
}
- if (SysTrayX.Messaging.new[folder.accountId] === undefined) {
- SysTrayX.Messaging.new[folder.accountId] = {};
+ if (SysTrayX.Messaging.new[accountId] === undefined) {
+ SysTrayX.Messaging.new[accountId] = {};
}
if (
- SysTrayX.Messaging.new[folder.accountId][folder.path] === undefined
+ SysTrayX.Messaging.new[accountId][path] === undefined
) {
- SysTrayX.Messaging.new[folder.accountId][folder.path] = [];
+ SysTrayX.Messaging.new[accountId][path] = [];
}
- SysTrayX.Messaging.unread[folder.accountId][folder.path] =
+ SysTrayX.Messaging.unread[accountId][path] =
mailFolderInfo.unreadMessageCount;
}
}
@@ -457,7 +655,16 @@ const sendMailCountPre115 = () => {
let newCount = 0;
SysTrayX.Messaging.filters.forEach((filter) => {
const accountId = filter.accountId;
- filter.folders.forEach((path) => {
+ filter.folders.forEach((storedFolder) => {
+ let path;
+ if (typeof(storedFolder) === "string") {
+ // Filters pre TB 121
+ path = storedFolder;
+ } else {
+ // Filters TB 121
+ path = storedFolder.path;
+ }
+
if (SysTrayX.Messaging.unread[accountId] !== undefined) {
if (SysTrayX.Messaging.unread[accountId][path] !== undefined) {
unreadCount = unreadCount + SysTrayX.Messaging.unread[accountId][path];
@@ -495,37 +702,78 @@ const sendMailCount = async () => {
// Get both unread and new message count
- for (const filter of SysTrayX.Messaging.filters) {
- for (const path of filter.folders) {
- const folder = {
- accountId: filter.accountId,
- path: path,
- };
-
- async function* listMessages(folder) {
- let page = await messenger.messages.list(folder);
- for (let message of page.messages) {
- yield message;
+ if (SysTrayX.Info.browserInfo.majorVersion < 121) {
+ for (const filter of SysTrayX.Messaging.filters) {
+ for (const storedFolder of filter.folders) {
+ let listParam;
+ if (typeof(storedFolder) === "string") {
+ // Filters pre TB 121
+ listParam = {
+ accountId: filter.accountId,
+ path: storedFolder,
+ };
+ } else {
+ // Filters TB 121
+ listParam = {
+ accountId: filter.accountId,
+ path: storedFolder.path,
+ };
}
-
- while (page.id) {
- page = await messenger.messages.continueList(page.id);
+
+ async function* listMessages(listParam) {
+ let page = await messenger.messages.list(listParam);
for (let message of page.messages) {
yield message;
}
+
+ while (page.id) {
+ page = await messenger.messages.continueList(page.id);
+ for (let message of page.messages) {
+ yield message;
+ }
+ }
+ }
+
+ let messages = listMessages(listParam);
+ for await (let message of messages) {
+ if( message.new )
+ {
+ newCount = newCount + 1;
+ }
+
+ if( !message.read )
+ {
+ unreadCount = unreadCount + 1;
+ }
}
}
-
- let messages = listMessages(folder);
- for await (let message of messages) {
- if( message.new )
- {
- newCount = newCount + 1;
+ }
+ } else {
+
+ // Unread and new count TB 121 and newer
+
+ for (const filter of SysTrayX.Messaging.filters) {
+ for (const folder of filter.folders) {
+ let mailFolderInfo = {};
+ try {
+ mailFolderInfo = await browser.folders.getFolderInfo(folder.mailFolderId);
+ } catch (err) {
+ //console.debug("Filter error: " + err);
+ //console.debug("Filter error: " + JSON.stringify(folder));
+
+ // Get all accounts
+ SysTrayX.Messaging.accounts = await browser.accounts.list();
+
+ // Check the filters for the accounts
+ SysTrayX.Messaging.accountFilterCheck();
}
- if( !message.read )
- {
- unreadCount = unreadCount + 1;
+ if (mailFolderInfo.unreadMessageCount !== undefined) {
+ unreadCount = unreadCount + mailFolderInfo.unreadMessageCount;
+ }
+
+ if (mailFolderInfo.newMessageCount !== undefined) {
+ newCount = newCount + mailFolderInfo.newMessageCount;
}
}
}
@@ -535,11 +783,18 @@ const sendMailCount = async () => {
// Only unread count
for (const filter of SysTrayX.Messaging.filters) {
- for (const path of filter.folders) {
- const folder = {
- accountId: filter.accountId,
- path: path,
- };
+ for (const storedFolder of filter.folders) {
+ let folderParam;
+ if (typeof(storedFolder) === "string") {
+ // Filters pre TB 121
+ folderParam = {
+ accountId: filter.accountId,
+ path: storedFolder,
+ };
+ } else {
+ // Filters TB 121
+ folderParam = storedFolder.mailFolderId;
+ }
let mailFolderInfo = {};
try {
@@ -549,7 +804,7 @@ const sendMailCount = async () => {
//console.debug("Filter error: " + JSON.stringify(folder));
// Get all accounts
- SysTrayX.Messaging.accounts = await browser.accounts.list(false);
+ SysTrayX.Messaging.accounts = await browser.accounts.list();
// Check the filters for the accounts
SysTrayX.Messaging.accountFilterCheck();
diff --git a/webext/js/folderTree.js b/webext/js/folderTree.js
deleted file mode 100644
index 676795a..0000000
--- a/webext/js/folderTree.js
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// Create folder tree from accounts
-//
-function getFolderTree(mailAccounts, browserInfo) {
- function traverse(accountName, path, folders) {
- if (!folders) {
- return;
- }
- for (let f of folders) {
- f.accountName = accountName;
- f.path = path + "/" + f.name;
- traverse(accountName, path + "/" + f.name, f.subFolders);
- }
- }
-
- function createFolderTree(accountName, folders) {
- traverse(accountName, "", folders);
- return folders;
- }
-
- let accounts = new Object();
-
- for (let i = 0; i < mailAccounts.length; i++) {
- if (false) {
- console.debug("Accounts id: " + mailAccounts[i].id);
- console.debug("Accounts name: " + mailAccounts[i].name);
- console.debug("Accounts type: " + mailAccounts[i].type);
- for (let j = 0; j < mailAccounts[i].folders.length; j++) {
- console.debug(
- "Accounts folder path: " + mailAccounts[i].folders[j].path
- );
- console.debug(
- "Accounts folder name: " + mailAccounts[i].folders[j].name
- );
- console.debug(
- "Accounts folder type: " + mailAccounts[i].folders[j].type
- );
- }
- }
-
- if (!accounts[mailAccounts[i].type]) {
- accounts[mailAccounts[i].type] = [];
- }
- accounts[mailAccounts[i].type].push({
- id: mailAccounts[i].id,
- name: mailAccounts[i].name,
- folders: mailAccounts[i].folders,
- });
- }
-
- /*
- * Build tree
- */
- let folderTree = {};
- for (let prop in accounts) {
- if (accounts[prop]) {
- for (let i = 0; i < accounts[prop].length; ++i) {
- // Create a usable folder tree
- const folders = createFolderTree(
- accounts[prop][i].name,
- accounts[prop][i].folders
- );
-
- // Store the tree
- folderTree[accounts[prop][i].name] = folders;
- }
- }
- }
-
- return folderTree;
-}
-
-//
-// Create a paths array from the folder tree
-//
-function getFolderPaths(folders) {
- function traverse(folders) {
- if (!folders) {
- return;
- }
- for (let f of folders) {
- paths.push(f.path);
- traverse(f.subFolders);
- }
- }
-
- let paths = [];
- traverse(folders);
-
- return paths;
-}
-
-//
-// Find the difference between two path arrays
-//
-function findFolderPathsDiff(paths1, paths2) {
- let diff = [];
-
- paths1.forEach((path) => {
- if (paths2.includes(path) === false) {
- diff.push(path);
- }
- });
-
- paths2.forEach((path) => {
- if (paths1.includes(path) === false) {
- diff.push(path);
- }
- });
-
- return diff;
-}
-
-//
-// Is the path in the filter folder list?
-//
-function findFolderPath(filters, path) {
- for (const filter of filters) {
- if (filter.folder.path === path) {
- return filter;
- }
- }
- return undefined;
-}
diff --git a/webext/js/options_accounts.js b/webext/js/options_accounts.js
index 818fa48..ee55539 100644
--- a/webext/js/options_accounts.js
+++ b/webext/js/options_accounts.js
@@ -8,20 +8,34 @@ SysTrayX.Accounts = {
},
getAccounts: async function () {
- let accounts;
+ if (SysTrayX.Info.browserInfo.majorVersion < 121) {
+ let accounts;
- accounts = await browser.accounts.list(false);
+ accounts = await browser.accounts.list(false);
- // Fill the sub folders using the folders API, they are not same...
- for (let i = 0; i < accounts.length; ++i) {
- const subFolders = await browser.folders.getSubFolders(
- accounts[i],
- true
- );
- accounts[i].folders = subFolders;
+ // Fill the sub folders using the folders API, they are not same...
+ for (let i = 0; i < accounts.length; ++i) {
+ const subFolders = await browser.folders.getSubFolders(
+ accounts[i],
+ true
+ );
+ accounts[i].folders = subFolders;
+ }
+
+ return accounts;
+ } else {
+ let accounts = await browser.accounts.list();
+
+ for (let i = 0; i < accounts.length; ++i) {
+ const subFolders = await browser.folders.getSubFolders(
+ accounts[i].id,
+ true
+ );
+ accounts[i].folders = subFolders;
+ }
+
+ return accounts;
}
-
- return accounts;
},
buildTree: function (mailAccount) {
@@ -36,7 +50,7 @@ SysTrayX.Accounts = {
}
}
- traverse("", folders);
+ traverse(folders);
return folders;
}
@@ -150,6 +164,7 @@ SysTrayX.Accounts = {
JSON.stringify({
accountName: element.accountName,
accountId: element.accountId,
+ mailFolderId: element.id,
type: element.type !== undefined ? element.type : "",
path: element.path,
name: element.originalName
diff --git a/webext/js/windowEvent.js b/webext/js/windowEvent.js
index 47c3de7..e2393a2 100644
--- a/webext/js/windowEvent.js
+++ b/webext/js/windowEvent.js
@@ -9,11 +9,12 @@
var { ExtensionCommon } = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm");
// You probably already know what this does.
- var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+// var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
// A helpful class for listening to windows opening and closing.
var { ExtensionSupport } = ChromeUtils.import("resource:///modules/ExtensionSupport.jsm");
+
/**
* This object is just what we're using to listen for toolbar clicks. The implementation
* isn't what this example is about, but you might be interested as it's a common pattern.
diff --git a/webext/manifest.json b/webext/manifest.json
index dfe72f3..35fa08a 100644
--- a/webext/manifest.json
+++ b/webext/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extension_name__",
"description": "__MSG_extension_description__",
- "version": "0.9.8",
+ "version": "0.9.9",
"author": "Maxime Rijnders",
"homepage_url": "https://github.com/Ximi1970/systray-x",
@@ -10,7 +10,7 @@
"gecko": {
"id": "systray-x@Ximi1970",
"strict_min_version": "91.0",
- "strict_max_version": "120.*"
+ "strict_max_version": "128.*"
}
},
diff --git a/webext/options.html b/webext/options.html
index 4b620f0..6b51149 100644
--- a/webext/options.html
+++ b/webext/options.html
@@ -188,6 +188,63 @@
+
+
{
const mailFolderExt = JSON.parse(folder.value);
- filters[filters.length - 1].folders.push(mailFolderExt.path);
+ filters[filters.length - 1].folders.push({
+ mailFolderId: mailFolderExt.mailFolderId, path: mailFolderExt.path});
});
}
}
@@ -106,6 +107,26 @@ SysTrayX.SaveOptions = {
startupType: startupType,
});
+ //
+ // Save window positions correction state
+ //
+ const windowPosCor = document.querySelector(
+ 'input[name="positionsCorrection"]'
+ ).checked;
+ await storage().set({
+ windowPosCor: `${windowPosCor}`,
+ });
+
+ //
+ // Save window positions correction preferences
+ //
+ const windowPosCorType = document.querySelector(
+ 'input[name="positionsCorrectionType"]:checked'
+ ).value;
+ await storage().set({
+ windowPosCorType: windowPosCorType,
+ });
+
//
// Save restore window positions state
//
@@ -415,6 +436,26 @@ SysTrayX.RestoreOptions = {
SysTrayX.RestoreOptions.onStartupTypeError
);
+ //
+ // Restore window positions correction state
+ //
+ await storage()
+ .get("windowPosCor")
+ .then(
+ SysTrayX.RestoreOptions.setWindowPosCor,
+ SysTrayX.RestoreOptions.onWindowPosCorError
+ );
+
+ //
+ // Restore window positions correction type
+ //
+ await storage()
+ .get("windowPosCorType")
+ .then(
+ SysTrayX.RestoreOptions.setWindowPosCorType,
+ SysTrayX.RestoreOptions.onWindowPosCorTypeError
+ );
+
//
// Restore restore position state
//
@@ -741,7 +782,37 @@ SysTrayX.RestoreOptions = {
},
onStartupTypeError: function (error) {
- console.log(`startupType Error: ${error}`);
+ console.log(`StartupType Error: ${error}`);
+ },
+
+ //
+ // Restore window positions correction state callbacks
+ //
+ setWindowPosCor: function (result) {
+ const windowPosCor = result.windowPosCor || "false";
+
+ const checkbox = document.querySelector(`input[name="positionsCorrection"]`);
+ checkbox.checked = windowPosCor === "true";
+ },
+
+ onWindowPosCorError: function (error) {
+ console.log(`WindowPosCor Error: ${error}`);
+ },
+
+ //
+ // Restore start minimized callbacks
+ //
+ setWindowPosCorType: function (result) {
+ const windowPosCorType = result.windowPosCorType || "0";
+
+ const radioButton = document.querySelector(
+ `input[name="positionsCorrectionType"][value="${windowPosCorType}"]`
+ );
+ radioButton.checked = true;
+ },
+
+ onWindowPosCorTypeError: function (error) {
+ console.log(`WindowPosCorType Error: ${error}`);
},
//
@@ -1232,7 +1303,16 @@ SysTrayX.RestoreOptions = {
)
);
- filter.folders.forEach((path) => {
+ filter.folders.forEach((storedFolder) => {
+
+ if (typeof(storedFolder) === "string") {
+ // Filters pre TB 121
+ path = storedFolder;
+ } else {
+ // Filters TB 121
+ path = storedFolder.path;
+ }
+
checkboxes.forEach((checkbox) => {
const value = JSON.parse(checkbox.value);
if (value.path === path) {
@@ -1305,6 +1385,16 @@ SysTrayX.StorageChanged = {
startupType: changes[item].newValue,
});
}
+ if (item === "windowPosCor") {
+ SysTrayX.RestoreOptions.setWindowPosCor({
+ windowPosCor: changes[item].newValue,
+ });
+ }
+ if (item === "windowPosCorType") {
+ SysTrayX.RestoreOptions.setWindowPosCorType({
+ windowPosCorType: changes[item].newValue,
+ });
+ }
if (item === "restorePositions") {
SysTrayX.RestoreOptions.setRestorePositions({
restorePositions: changes[item].newValue,
@@ -1525,6 +1615,10 @@ async function start() {
document.getElementById("kdeintegration").style.display = "none";
}
+ if ( SysTrayX.Info.platformInfo.os !== "linux" ) {
+ document.getElementById("positionscorrectionselect").style.display = "none";
+ }
+
// Enable save button
document
.querySelector('[name="saveform"]')
@@ -1538,8 +1632,8 @@ async function start() {
browser.storage.onChanged.addListener(SysTrayX.StorageChanged.changed);
document.addEventListener("visibilitychange", function () {
- if (document.visibilityState === "hidden") {
- browser.storage.onChanged.removeListener(SysTrayX.StorageChanged.changed);
+ if ( browser.storage.onChanged.hasListener(SysTrayX.StorageChanged.changed) ) {
+ browser.storage.onChanged.removeListener(SysTrayX.StorageChanged.changed);
}
});
}