@@ -784,33 +784,16 @@ void BitcoinGUI::createTrayIcon()
784
784
void BitcoinGUI::createTrayIconMenu ()
785
785
{
786
786
#ifndef Q_OS_MAC
787
- // return if trayIcon is unset (only on non-macOSes)
788
- if (!trayIcon)
789
- return ;
790
-
791
- trayIcon->setContextMenu (trayIconMenu.get ());
792
- connect (trayIcon, &QSystemTrayIcon::activated, [this ](QSystemTrayIcon::ActivationReason reason) {
793
- if (reason == QSystemTrayIcon::Trigger) {
794
- // Click on system tray icon triggers show/hide of the main window
795
- toggleHidden ();
796
- }
797
- });
798
- #else
799
- // Note: On macOS, the Dock icon is used to provide the tray's functionality.
800
- MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance ();
801
- connect (dockIconHandler, &MacDockIconHandler::dockIconClicked, [this ] {
802
- show ();
803
- activateWindow ();
804
- });
805
- trayIconMenu->setAsDockMenu ();
806
- #endif
787
+ if (!trayIcon) return ;
788
+ #endif // Q_OS_MAC
807
789
808
- // Configuration of the tray icon (or Dock icon) menu
790
+ // Configuration of the tray icon (or Dock icon) menu.
809
791
#ifndef Q_OS_MAC
810
792
// Note: On macOS, the Dock icon's menu already has Show / Hide action.
811
793
trayIconMenu->addAction (toggleHideAction);
812
794
trayIconMenu->addSeparator ();
813
- #endif
795
+ #endif // Q_OS_MAC
796
+
814
797
if (enableWallet) {
815
798
trayIconMenu->addAction (sendCoinsMenuAction);
816
799
trayIconMenu->addAction (receiveCoinsMenuAction);
@@ -821,10 +804,27 @@ void BitcoinGUI::createTrayIconMenu()
821
804
}
822
805
trayIconMenu->addAction (optionsAction);
823
806
trayIconMenu->addAction (openRPCConsoleAction);
824
- #ifndef Q_OS_MAC // This is built-in on macOS
807
+ #ifndef Q_OS_MAC
808
+ // Note: On macOS, the Dock icon's menu already has Quit action.
825
809
trayIconMenu->addSeparator ();
826
810
trayIconMenu->addAction (quitAction);
827
- #endif
811
+
812
+ trayIcon->setContextMenu (trayIconMenu.get ());
813
+ connect (trayIcon, &QSystemTrayIcon::activated, [this ](QSystemTrayIcon::ActivationReason reason) {
814
+ if (reason == QSystemTrayIcon::Trigger) {
815
+ // Click on system tray icon triggers show/hide of the main window
816
+ toggleHidden ();
817
+ }
818
+ });
819
+ #else
820
+ // Note: On macOS, the Dock icon is used to provide the tray's functionality.
821
+ MacDockIconHandler* dockIconHandler = MacDockIconHandler::instance ();
822
+ connect (dockIconHandler, &MacDockIconHandler::dockIconClicked, [this ] {
823
+ show ();
824
+ activateWindow ();
825
+ });
826
+ trayIconMenu->setAsDockMenu ();
827
+ #endif // Q_OS_MAC
828
828
}
829
829
830
830
void BitcoinGUI::optionsClicked ()
0 commit comments