[PC-BSD Commits] r2290 - pcbsd/trunk/NetworkTray

svn at pcbsd.org svn at pcbsd.org
Mon Jul 7 08:38:56 PDT 2008


Author: kris
Date: 2008-07-07 08:38:55 -0700 (Mon, 07 Jul 2008)
New Revision: 2290

Modified:
   pcbsd/trunk/NetworkTray/NetworkTray.cpp
   pcbsd/trunk/NetworkTray/NetworkTray.h
Log:

Fixed several bugs with the Network Tray, it now exits properly, and also
works when you double-click it to bring up the Network Manager



Modified: pcbsd/trunk/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/trunk/NetworkTray/NetworkTray.cpp	2008-07-07 15:26:38 UTC (rev 2289)
+++ pcbsd/trunk/NetworkTray/NetworkTray.cpp	2008-07-07 15:38:55 UTC (rev 2290)
@@ -41,6 +41,9 @@
 
 void NetworkTray::programInit(QString Type, QString Device)
 {
+    // Connect our double-click slot
+    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)));
+
     QString tmp;
     QIcon Icon;
     DeviceName = Device;
@@ -325,8 +328,8 @@
 	return name;	
 }
 
-void NetworkTray::mouseDoubleClickEvent(QMouseEvent *e) {
-   if(e != NULL) {
+void NetworkTray::slotTrayActivated(QSystemTrayIcon::ActivationReason reason) {
+   if(reason == QSystemTrayIcon::DoubleClick) {
       openNetManager();
    }
 }
@@ -413,9 +416,10 @@
 
 
   // First run a check to see if this applet has been disabled in the network manager
-  if ( ! QFile::exists( filename ) )
+  QFile testFile(filename);
+  if ( ! testFile.exists() )
   {
-    close(0);
+    exit(0);
   }
 
   // Check the media status of this device

Modified: pcbsd/trunk/NetworkTray/NetworkTray.h
===================================================================
--- pcbsd/trunk/NetworkTray/NetworkTray.h	2008-07-07 15:26:38 UTC (rev 2289)
+++ pcbsd/trunk/NetworkTray/NetworkTray.h	2008-07-07 15:38:55 UTC (rev 2290)
@@ -26,11 +26,9 @@
    void slotRestartNetwork();
    void slotEnablePPPOE();
    void slotDisablePPPOE();
+   void slotTrayActivated(QSystemTrayIcon::ActivationReason);
 
    
-protected:
-   virtual void mouseDoubleClickEvent(QMouseEvent *e);
-   
 private:
    void displayTooltip();
    QString getLineFromCommandOutput( QString command );



More information about the Commits mailing list