@@ -279,13 +279,17 @@ ControlBox::ControlBox(const QCommandLineParser& parser, QWidget *parent)
279279  connect (ui.pushButton_provisioning_editor , SIGNAL  (clicked ()), this , SLOT (provisionService ()));
280280  connect (socketserver, SIGNAL (newConnection ()), this , SLOT (socketConnectionDetected ()));
281281
282+   //  turn network cards on or off globally based on checkbox
283+   toggleOfflineMode (ui.checkBox_devicesoff ->isChecked () );   
284+   
282285  //  tray icon - disable it if we specifiy that option on the commandline
283286  //  otherwise set a singleshot timer to create the tray icon and showMinimized
284287  //  or showMaximized.  The startSystemTray slots are inline functions and
285288  //  both point to createSystemTrayIcon.
286289  trayicon = 0 ;
287290  if  (parser.isSet (" disable-tray-icon" 
288291    ui.checkBox_hideIcon ->setDisabled (true );
292+     this ->updateDisplayWidgets ();
289293    this ->showNormal (); //  no place to minimize to, so showMaximized
290294  } //  if
291295  else  {
@@ -302,10 +306,7 @@ ControlBox::ControlBox(const QCommandLineParser& parser, QWidget *parent)
302306      this ->showNormal ();
303307      QTimer::singleShot (timeout, this , SLOT (startSystemTrayNormal ()));
304308    }	//  else showNormal
305-    } //  else 
306-   
307-   //  turn network cards on or off globally based on checkbox
308-   toggleOfflineMode (ui.checkBox_devicesoff ->isChecked () );      
309+    } //  else      
309310}  
310311
311312// //////////////////////////////////////////////// Public Functions //////////////////////////////////
@@ -1701,7 +1702,7 @@ void ControlBox::createSystemTrayIcon(bool b_startminimized)
17011702
17021703		//  Create the systemtrayicon
17031704		trayicon = new  QSystemTrayIcon (this );
1704- 
1705+ 		 
17051706		//  Create a context menu.  Menu contents is defined in the
17061707		//  assembletrayIcon() function.
17071708    trayiconmenu = new  QMenu (this );  
@@ -1711,13 +1712,22 @@ void ControlBox::createSystemTrayIcon(bool b_startminimized)
17111712    //  Assemble the tray icon (set the icon to display)
17121713		assembleTrayIcon (); 
17131714
1715+ 		//  This code block I found several places on how to work around tray icons
1716+ 		//  not showing properly with GTK based trays.  May not be necessary with
1717+ 		//  QT5.4 but leave it in if it does not hurt anything.
1718+ 		trayicon->setVisible (true );
1719+ 		trayicon->setVisible (false );
1720+ 		qApp->processEvents ();		
1721+ 		
17141722    //  QT5.3 and XFCE don't play nicely.  Hammer the XFCE tray up to
1715- 		//  maxtries to get a valid icon geometry
1723+ 		//  maxtries to get a valid icon geometry.
1724+ 		//  QT5.4 update, may be fixed but leave option in for now
17161725		if  (b_usexfce) { 
17171726			const  int  maxtries = 125 ;
17181727			int  i = 0 ;
17191728			for  (i; i < maxtries; ++i) {
17201729				trayicon->setVisible (true );
1730+ 				qDebug () << " icon geometry: " geometry ();				
17211731				if  (trayicon->geometry ().left () > 0  || trayicon->geometry ().top () > 0 ) break ;
17221732				trayicon->setVisible (false );
17231733			}   //  hammer loop
@@ -1730,7 +1740,8 @@ void ControlBox::createSystemTrayIcon(bool b_startminimized)
17301740
17311741		//  Sync the visibility to the checkbox
17321742    ui.checkBox_hideIcon ->setEnabled (true );
1733-     trayicon->setVisible (true ); 
1743+     trayicon->setVisible (true );
1744+         
17341745  } //  if there is a systemtray available
17351746
17361747  //  else no systemtray available
0 commit comments