From 2d03aa73f2df6980658b8b3ce040c1af4a08a234 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Thu, 5 Mar 2020 20:46:11 +1000 Subject: [PATCH] Telegram: fix tray menu --- .../patches/telegram_desktop-1.9.19.patchset | 114 ++---------------- .../telegram_desktop-1.9.19.recipe | 2 +- 2 files changed, 14 insertions(+), 102 deletions(-) diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.9.19.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.9.19.patchset index 4d92d5af3..06b6d081e 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.9.19.patchset +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.9.19.patchset @@ -1,6 +1,6 @@ -From 22c5f614912e3254ee9fb8b4d1eb6ef5de97f2f3 Mon Sep 17 00:00:00 2001 +From 65b27689f360e7bb125aabc4e5c371bc00145957 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Wed, 4 Mar 2020 20:20:54 +1000 +Date: Thu, 5 Mar 2020 20:12:29 +1000 Subject: Add Haiku support @@ -697,17 +697,17 @@ index 0000000..45d4cf8 +} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp new file mode 100644 -index 0000000..c603575 +index 0000000..3fcfa02 --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -@@ -0,0 +1,134 @@ +@@ -0,0 +1,132 @@ +/* +This file is part of Telegram Desktop for Haiku, + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#include "platform/haiku/main_window_haiku.h" @@ -758,22 +758,20 @@ index 0000000..c603575 +} + +void MainWindow::psTrayMenuUpdated() { ++ if (trayIcon && trayIconMenu ++ && trayIcon->contextMenu() != trayIconMenu) { ++ trayIcon->setContextMenu(trayIconMenu); ++ } +} + +void MainWindow::psSetupTrayIcon() { + if (!trayIcon) { + trayIcon = new QSystemTrayIcon(this); -+ + auto icon = QIcon(App::pixmapFromImageInPlace(Core::App().logoNoMargin())); -+ + trayIcon->setIcon(icon); -+ trayIcon->setToolTip(AppName.utf8()); -+ connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray())); + attachToTrayIcon(trayIcon); -+ App::wnd()->updateTrayMenu(); + } + updateIconCounters(); -+ + trayIcon->show(); +} + @@ -837,22 +835,23 @@ index 0000000..c603575 +} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.h b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h new file mode 100644 -index 0000000..36ab559 +index 0000000..5134cad --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h -@@ -0,0 +1,69 @@ +@@ -0,0 +1,70 @@ +/* +This file is part of Telegram Desktop for Haiku, + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#pragma once + +#include "platform/platform_main_window.h" ++#include "ui/widgets/popup_menu.h" +#include "base/flags.h" + +#include @@ -4634,90 +4633,3 @@ index 3c71216..891d428 100644 -- 2.24.1 - -From d281bb0103254dd6ce94234780ceae101068ec08 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Wed, 4 Mar 2020 21:47:43 +1000 -Subject: Fix tray menu - - -diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -index c603575..20eaf46 100644 ---- a/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -@@ -52,12 +52,18 @@ void MainWindow::psStatusIconCheck() { - } - - void MainWindow::psShowTrayMenu() { -+ _trayIconMenuEmbed->popup(QCursor::pos()); - } - - void MainWindow::psTrayMenuUpdated() { - } - - void MainWindow::psSetupTrayIcon() { -+ if (!_trayIconMenuEmbed) { -+ _trayIconMenuEmbed = new Ui::PopupMenu(nullptr, trayIconMenu); -+ _trayIconMenuEmbed->deleteOnHide(false); -+ } -+ - if (!trayIcon) { - trayIcon = new QSystemTrayIcon(this); - -@@ -75,13 +81,14 @@ void MainWindow::psSetupTrayIcon() { - } - - void MainWindow::workmodeUpdated(DBIWorkMode mode) { -- psSetupTrayIcon(); - if (mode == dbiwmWindowOnly) { - if (trayIcon) { - trayIcon->setContextMenu(0); -- delete trayIcon; -- trayIcon = nullptr; -+ trayIcon->deleteLater(); - } -+ trayIcon = 0; -+ } else { -+ psSetupTrayIcon(); - } - } - -@@ -129,6 +136,7 @@ void MainWindow::psUpdateMargins() { - } - - MainWindow::~MainWindow() { -+ delete _trayIconMenuEmbed; - } - - } // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.h b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h -index 36ab559..90940c3 100644 ---- a/Telegram/SourceFiles/platform/haiku/main_window_haiku.h -+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h -@@ -4,12 +4,13 @@ This file is part of Telegram Desktop for Haiku, - For license and copyright information please follow this link: - https://github.com/desktop-app/legal/blob/master/LEGAL - --Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com - */ - - #pragma once - - #include "platform/platform_main_window.h" -+#include "ui/widgets/popup_menu.h" - #include "base/flags.h" - - #include -@@ -60,6 +61,8 @@ private: - void updateIconCounters(); - void psCreateTrayIcon(); - -+ Ui::PopupMenu *_trayIconMenuEmbed = nullptr; -+ - QTimer _psCheckStatusIconTimer; - int _psCheckStatusIconLeft = 100; - --- -2.24.1 - diff --git a/net-im/telegram-desktop/telegram_desktop-1.9.19.recipe b/net-im/telegram-desktop/telegram_desktop-1.9.19.recipe index bef50b3f4..be557b8da 100644 --- a/net-im/telegram-desktop/telegram_desktop-1.9.19.recipe +++ b/net-im/telegram-desktop/telegram_desktop-1.9.19.recipe @@ -3,7 +3,7 @@ DESCRIPTION="Unofficial build of the original Telegram client for Haiku." HOMEPAGE="https://www.telegram.org/" COPYRIGHT="2013-2020 Telegram" LICENSE="GNU GPL v3" -REVISION="1" +REVISION="2" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz" CHECKSUM_SHA256="d7bb9ad9e86d33333d733809e67daffc919d5dd32aeeaecd91c9ba9f5b3dfc22"