[PC-BSD Commits] r9855 - pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray

svn at pcbsd.org svn at pcbsd.org
Thu Mar 31 14:39:03 PDT 2011


Author: kris
Date: 2011-03-31 14:39:03 -0700 (Thu, 31 Mar 2011)
New Revision: 9855

Modified:
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h
Log:

Updated the network tray to use sudo



Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2011-03-31 21:38:23 UTC (rev 9854)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2011-03-31 21:39:03 UTC (rev 9855)
@@ -95,38 +95,8 @@
   trayIconMenu->addAction( tr("Start the Network Manager"), this, SLOT(openNetManager()));
   trayIconMenu->addSeparator();
   trayIconMenu->addAction( tr("Restart the Network"), this, SLOT(slotRestartNetwork()));
+  trayIconMenu->addSeparator();
 
-  // Check if we are on a ethernet device and PPPOE is enabled
-  if ( DeviceType == "Ethernet" )
-  {
-     // Check for PPPOE configuration
-     tmp = getValue( "/etc/rc.conf", "ppp_enable=", 1 );
-     if ( tmp == "YES") {
-        QFile filein( "/etc/ppp/ppp.conf" );
-    	QString ProfileName = "internet";
-          
-	// Now load the ppp.conf file
-	if ( filein.open( QIODevice::ReadOnly ) ) {
-        QTextStream stream( &filein );
-        QString line;
-        while ( !stream.atEnd() ) {
-          line = stream.readLine(); // line of text excluding '\n'
-
-          // Check if we are on a profile line
-	  if ( line.indexOf(":") == line.length() -1 && line.indexOf(ProfileName) != -1  ) {
-	    // If we find the existing profile for this device, add the context menu shortcuts
-	    trayIconMenu->addSeparator();
-  	    trayIconMenu->addAction( tr("Connect to PPPoE service."), this, SLOT(slotEnablePPPOE()));
-	    trayIconMenu->addAction( tr("Disconnect from PPPoE service."), this, SLOT(slotDisablePPPOE()));
-	  }
-	}
-       filein.close();
-     }
-
-     } // end of TMP = YES line
-
-   } // End of PPPOE check
-
   trayIconMenu->addAction( tr("Close the Network Monitor"), this, SLOT(slotQuit()));
 
   trayIcon = new QSystemTrayIcon(this);
@@ -329,15 +299,15 @@
 
   if ( DeviceType == "Ethernet" )
   {
-    QString program = "pc-su";
+    QString program = "sudo";
     QStringList arguments;
-    arguments << "--noignorebutton" << "-d" << "pc-ethernetconfig " + DeviceName;
+    arguments << "pc-ethernetconfig" << DeviceName;
     QProcess *runCommandProc = new QProcess(this);
     runCommandProc->start(program, arguments);
   } else {
-    QString program = "pc-su";
+    QString program = "sudo";
     QStringList arguments;
-    arguments << "--noignorebutton" << "-d" << "pc-wificonfig " + DeviceName;
+    arguments << "pc-wificonfig" << DeviceName;
     QProcess *runCommandProc = new QProcess(this);
     runCommandProc->start(program, arguments);
   }
@@ -521,33 +491,17 @@
 
 // If the user wants to restart the network, do so
 void NetworkTray::slotRestartNetwork() {
-  QString program = "pc-su";
+  QString program = "sudo";
   QStringList arguments;
-  arguments << "--noignorebutton" << "-d" << "/etc/rc.d/netif restart ; /etc/rc.d/routing restart ; /etc/rc.d/ppp restart";
+  arguments << "/etc/rc.d/netif restart ; /etc/rc.d/routing restart ; /etc/rc.d/ppp restart";
   QProcess *runCommandProc = new QProcess(this);
   runCommandProc->start(program, arguments);
 }
 
-void NetworkTray::slotEnablePPPOE() {
-  QString ProfileName = "internet";
-  QString program = "pc-su";
-  QStringList arguments;
-  arguments << "--noignorebutton" << "-d" << "ppp -background " + ProfileName;
-  QProcess *runCommandProc = new QProcess(this);
-  runCommandProc->start(program, arguments);
-}
-void NetworkTray::slotDisablePPPOE() {
-  QString program = "pc-su";
-  QStringList arguments;
-  arguments << "--noignorebutton" << "-d" << "kilalll ppp";
-  QProcess *runCommandProc = new QProcess(this);
-  runCommandProc->start(program, arguments);
-}
-
 void NetworkTray::openNetManager() {
-  QString program = "kcmshell4";
+  QString program = "sudo";
   QStringList arguments;
-  arguments << "pcnetwork";
+  arguments << "pc-netmanager";
   QProcess *runCommandProc = new QProcess(this);
   runCommandProc->start(program, arguments);
 }
@@ -585,13 +539,13 @@
 
 void  NetworkTray::openDeviceInfo() {
 
-  QString program = "pc-su";
+  QString program = "sudo";
   QStringList arguments;
   if ( DeviceType == "Ethernet" )
   {
-    arguments << "--noignorebutton" << "-d" << "pc-ethernetconfig info " + DeviceName;
+    arguments << "pc-ethernetconfig" << "info" << DeviceName;
   } else {
-    arguments << "--noignorebutton" << "-d" << "pc-wificonfig info " + DeviceName;
+    arguments << "pc-wificonfig" << "info" << DeviceName;
   }
 
   QProcess *runCommandProc = new QProcess(this);

Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h	2011-03-31 21:38:23 UTC (rev 9854)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h	2011-03-31 21:39:03 UTC (rev 9855)
@@ -28,8 +28,6 @@
    void openConfigDlg();
    void monitorStatus();
    void slotRestartNetwork();
-   void slotEnablePPPOE();
-   void slotDisablePPPOE();
    void slotTrayActivated(QSystemTrayIcon::ActivationReason);
    void slotQuit();
 



More information about the Commits mailing list