4343#include < QAction>
4444#include < QApplication>
4545#include < QComboBox>
46+ #include < QCursor>
4647#include < QDateTime>
4748#include < QDragEnterEvent>
4849#include < QListWidget>
@@ -199,8 +200,19 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
199200 // Subscribe to notifications from core
200201 subscribeToCoreSignals ();
201202
202- connect (connectionsControl, &GUIUtil::ClickableLabel::clicked, [this ] {
203- m_node.setNetworkActive (!m_node.getNetworkActive ());
203+ auto network_context_menu = new QMenu (this );
204+ network_context_menu->addAction (
205+ // : A context menu item. The "Peers tab" is an element of the "Node window".
206+ tr (" Show Peers tab" ),
207+ [this ] {
208+ rpcConsole->setTabFocus (RPCConsole::TabTypes::PEERS);
209+ showDebugWindow ();
210+ });
211+ m_toggle_network_activity = network_context_menu->addAction (
212+ QString (),
213+ [this ] { m_node.setNetworkActive (!m_node.getNetworkActive ()); });
214+ connect (connectionsControl, &GUIUtil::ClickableLabel::clicked, [menu = network_context_menu] {
215+ GUIUtil::PopupMenu (menu, QCursor::pos ());
204216 });
205217 connect (labelProxyIcon, &GUIUtil::ClickableLabel::clicked, [this ] {
206218 openOptionsDialogWithTab (OptionsDialog::TAB_NETWORK);
@@ -586,7 +598,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
586598 createTrayIconMenu ();
587599
588600 // Keep up to date with client
589- updateNetworkState ( );
601+ setNetworkActive (m_node. getNetworkActive () );
590602 connect (_clientModel, &ClientModel::numConnectionsChanged, this , &BitcoinGUI::setNumConnections);
591603 connect (_clientModel, &ClientModel::networkActiveChanged, this , &BitcoinGUI::setNetworkActive);
592604
@@ -915,14 +927,18 @@ void BitcoinGUI::updateNetworkState()
915927 QString tooltip;
916928
917929 if (m_node.getNetworkActive ()) {
918- tooltip = tr (" %n active connection(s) to Bitcoin network" , " " , count) + QString (" .<br>" ) + tr (" Click to disable network activity." );
930+ // : A substring of the tooltip.
931+ tooltip = tr (" %n active connection(s) to Bitcoin network." , " " , count);
919932 } else {
920- tooltip = tr (" Network activity disabled." ) + QString (" <br>" ) + tr (" Click to enable network activity again." );
933+ // : A substring of the tooltip.
934+ tooltip = tr (" Network activity disabled." );
921935 icon = " :/icons/network_disabled" ;
922936 }
923937
924938 // Don't word-wrap this (fixed-width) tooltip
925- tooltip = QString (" <nobr>" ) + tooltip + QString (" </nobr>" );
939+ tooltip = QLatin1String (" <nobr>" ) + tooltip + QLatin1String (" <br>" ) +
940+ // : A substring of the tooltip. "More actions" are available via the context menu.
941+ tr (" Click for more actions." ) + QLatin1String (" </nobr>" );
926942 connectionsControl->setToolTip (tooltip);
927943
928944 connectionsControl->setPixmap (platformStyle->SingleColorIcon (icon).pixmap (STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
@@ -936,6 +952,12 @@ void BitcoinGUI::setNumConnections(int count)
936952void BitcoinGUI::setNetworkActive (bool networkActive)
937953{
938954 updateNetworkState ();
955+ m_toggle_network_activity->setText (
956+ networkActive ?
957+ // : A context menu item.
958+ tr (" Disable network activity" ) :
959+ // : A context menu item. The network activity was disabled previously.
960+ tr (" Enable network activity" ));
939961}
940962
941963void BitcoinGUI::updateHeadersSyncProgressLabel ()
0 commit comments