@@ -261,21 +261,13 @@ void BitcoinGUI::createActions()
261
261
sendCoinsAction->setShortcut (QKeySequence (Qt::ALT + Qt::Key_2));
262
262
tabGroup->addAction (sendCoinsAction);
263
263
264
- sendCoinsMenuAction = new QAction (sendCoinsAction->text (), this );
265
- sendCoinsMenuAction->setStatusTip (sendCoinsAction->statusTip ());
266
- sendCoinsMenuAction->setToolTip (sendCoinsMenuAction->statusTip ());
267
-
268
264
receiveCoinsAction = new QAction (platformStyle->SingleColorIcon (" :/icons/receiving_addresses" ), tr (" &Receive" ), this );
269
265
receiveCoinsAction->setStatusTip (tr (" Request payments (generates QR codes and bitcoin: URIs)" ));
270
266
receiveCoinsAction->setToolTip (receiveCoinsAction->statusTip ());
271
267
receiveCoinsAction->setCheckable (true );
272
268
receiveCoinsAction->setShortcut (QKeySequence (Qt::ALT + Qt::Key_3));
273
269
tabGroup->addAction (receiveCoinsAction);
274
270
275
- receiveCoinsMenuAction = new QAction (receiveCoinsAction->text (), this );
276
- receiveCoinsMenuAction->setStatusTip (receiveCoinsAction->statusTip ());
277
- receiveCoinsMenuAction->setToolTip (receiveCoinsMenuAction->statusTip ());
278
-
279
271
historyAction = new QAction (platformStyle->SingleColorIcon (" :/icons/history" ), tr (" &Transactions" ), this );
280
272
historyAction->setStatusTip (tr (" Browse transaction history" ));
281
273
historyAction->setToolTip (historyAction->statusTip ());
@@ -290,12 +282,8 @@ void BitcoinGUI::createActions()
290
282
connect (overviewAction, &QAction::triggered, this , &BitcoinGUI::gotoOverviewPage);
291
283
connect (sendCoinsAction, &QAction::triggered, [this ]{ showNormalIfMinimized (); });
292
284
connect (sendCoinsAction, &QAction::triggered, [this ]{ gotoSendCoinsPage (); });
293
- connect (sendCoinsMenuAction, &QAction::triggered, [this ]{ showNormalIfMinimized (); });
294
- connect (sendCoinsMenuAction, &QAction::triggered, [this ]{ gotoSendCoinsPage (); });
295
285
connect (receiveCoinsAction, &QAction::triggered, [this ]{ showNormalIfMinimized (); });
296
286
connect (receiveCoinsAction, &QAction::triggered, this , &BitcoinGUI::gotoReceiveCoinsPage);
297
- connect (receiveCoinsMenuAction, &QAction::triggered, [this ]{ showNormalIfMinimized (); });
298
- connect (receiveCoinsMenuAction, &QAction::triggered, this , &BitcoinGUI::gotoReceiveCoinsPage);
299
287
connect (historyAction, &QAction::triggered, [this ]{ showNormalIfMinimized (); });
300
288
connect (historyAction, &QAction::triggered, this , &BitcoinGUI::gotoHistoryPage);
301
289
#endif // ENABLE_WALLET
@@ -747,9 +735,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
747
735
{
748
736
overviewAction->setEnabled (enabled);
749
737
sendCoinsAction->setEnabled (enabled);
750
- sendCoinsMenuAction->setEnabled (enabled);
751
738
receiveCoinsAction->setEnabled (enabled);
752
- receiveCoinsMenuAction->setEnabled (enabled);
753
739
historyAction->setEnabled (enabled);
754
740
encryptWalletAction->setEnabled (enabled);
755
741
backupWalletAction->setEnabled (enabled);
@@ -790,9 +776,11 @@ void BitcoinGUI::createTrayIconMenu()
790
776
trayIconMenu->addSeparator ();
791
777
#endif // Q_OS_MAC
792
778
779
+ QAction* send_action{nullptr };
780
+ QAction* receive_action{nullptr };
793
781
if (enableWallet) {
794
- trayIconMenu->addAction (sendCoinsMenuAction );
795
- trayIconMenu->addAction (receiveCoinsMenuAction );
782
+ send_action = trayIconMenu->addAction (sendCoinsAction-> text (), sendCoinsAction, &QAction::trigger );
783
+ receive_action = trayIconMenu->addAction (receiveCoinsAction-> text (), receiveCoinsAction, &QAction::trigger );
796
784
trayIconMenu->addSeparator ();
797
785
trayIconMenu->addAction (signMessageAction);
798
786
trayIconMenu->addAction (verifyMessageAction);
@@ -826,11 +814,15 @@ void BitcoinGUI::createTrayIconMenu()
826
814
// Using QSystemTrayIcon::Context is not reliable.
827
815
// See https://bugreports.qt.io/browse/QTBUG-91697
828
816
trayIconMenu.get (), &QMenu::aboutToShow,
829
- [this , show_hide_action] {
817
+ [this , show_hide_action, send_action, receive_action ] {
830
818
if (show_hide_action) show_hide_action->setText (
831
819
(!isHidden () && !isMinimized () && !GUIUtil::isObscured (this )) ?
832
820
tr (" &Hide" ) :
833
821
tr (" S&how" ));
822
+ if (enableWallet) {
823
+ send_action->setEnabled (sendCoinsAction->isEnabled ());
824
+ receive_action->setEnabled (receiveCoinsAction->isEnabled ());
825
+ }
834
826
});
835
827
}
836
828
0 commit comments