[PC-BSD Commits] r17614 - in pcbsd/current/src-qt4/pc-netmanager/src: NetworkManager ethernetconfig wificonfig

svn at pcbsd.org svn at pcbsd.org
Tue Jul 3 12:06:42 PDT 2012


Author: kris
Date: 2012-07-03 19:06:42 +0000 (Tue, 03 Jul 2012)
New Revision: 17614

Modified:
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h
   pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.cpp
   pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.h
   pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp
   pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.h
Log:

Use the new IPV4 validators in Utils for network utilities



Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp	2012-07-03 18:59:47 UTC (rev 17613)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp	2012-07-03 19:06:42 UTC (rev 17614)
@@ -558,52 +558,9 @@
 }
 
 
-
-
-bool NetworkMan::checkRange( QString IP )
-{
-    
-    int num;
-    
-    num = IP.section(".", 0,0).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-   num = IP.section(".", 1,1).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-    
-    num = IP.section(".", 2,2).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-   num = IP.section(".", 3,3).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-    return TRUE;
-    
-
-}
-
-
 void NetworkMan::restartNetwork()
 {
    Utils::restartNetworking();
-    
 }
 
 
@@ -847,20 +804,20 @@
         }
     }
   
-     if ( lineDNS1->text() != "..."  && ! checkRange(lineDNS1->text() ) ) {
+     if ( lineDNS1->text() != "..."  && ! Utils::validateIPV4(lineDNS1->text() ) ) {
 	 QMessageBox::warning( this, tr("Warning"),
 	  tr("DNS #1 is out of range! (") + lineDNS1->text() + tr(") Fields must be between 0-255.") );
 	 return;
      }
     
-    if ( lineDNS2->text() != "..."  && ! checkRange(lineDNS2->text() ) ) {
+    if ( lineDNS2->text() != "..."  && ! Utils::validateIPV4(lineDNS2->text() ) ) {
 	 QMessageBox::warning( this, tr("Warning"),
 	  tr("DNS #2 is out of range! (") + lineDNS2->text() + tr(") Fields must be between 0-255.") );
 	 return;
      }
     
     
-     if ( lineGateway->text() != "..."  && ! checkRange(lineGateway->text() ) ) {
+     if ( lineGateway->text() != "..."  && ! Utils::validateIPV4(lineGateway->text() ) ) {
 	 QMessageBox::warning( this, tr("Warning"),
 	  tr("Gateway is out of range! (") + lineGateway->text() + tr(") Fields must be between 0-255.") );
 	 return;

Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h	2012-07-03 18:59:47 UTC (rev 17613)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h	2012-07-03 19:06:42 UTC (rev 17614)
@@ -83,7 +83,6 @@
     bool checkWifiWlans( QString Key );
     void runCommand( QString command );
     QString getNetmaskForIdent( QString ident );
-    bool checkRange( QString IP );
     QString getTypeForIdent( QString ident );
     QString getUpStatusForIdent( QString ident );
     QString getNextAvailWlan();

Modified: pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.cpp	2012-07-03 18:59:47 UTC (rev 17613)
+++ pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.cpp	2012-07-03 19:06:42 UTC (rev 17614)
@@ -65,43 +65,6 @@
 		return false;
 }
 
-bool ethernetconfig::checkRange(QString IP)
-{
- int num;
-    
-    num = IP.section(".", 0,0).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-   num = IP.section(".", 1,1).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-    
-    num = IP.section(".", 2,2).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-   num = IP.section(".", 3,3).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-    return TRUE;
-
-}
-
 // Function which sets up the lagg0 interface, and returns the corrected string we'll be
 // saving to rc.conf
 void ethernetconfig::saveLaggLine(QString dev, QString config)
@@ -159,13 +122,13 @@
 	    return;
 	}
 	
-	if ( ! checkRange(lineIP->text() ) ) {
+	if ( ! Utils::validateIPV4(lineIP->text() ) ) {
 	    QMessageBox::warning( this, tr("Warning"),
 	    tr("IP Address is out of range! (") + lineIP->text() + tr(") Fields must be between 0-255.") );
 	   return;
                }
 	
-	if ( ! checkRange(lineNetmask->text() ) ) {
+	if ( ! Utils::validateIPV4(lineNetmask->text() ) ) {
 	    QMessageBox::warning( this, tr("Warning"),
 	    tr("Netmask is out of range! (") + lineNetmask->text() + tr(") Fields must be between 0-255.") );
 	   return;

Modified: pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.h	2012-07-03 18:59:47 UTC (rev 17613)
+++ pcbsd/current/src-qt4/pc-netmanager/src/ethernetconfig/ethernetconfig.h	2012-07-03 19:06:42 UTC (rev 17614)
@@ -42,7 +42,6 @@
     virtual void setDevice(QString Device);
     virtual void showInfo();
     virtual void programInit();
-    virtual bool checkRange(QString IP);
 
 public slots:
     virtual void slotIPCheckbox();

Modified: pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp	2012-07-03 18:59:47 UTC (rev 17613)
+++ pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp	2012-07-03 19:06:42 UTC (rev 17614)
@@ -137,13 +137,13 @@
 	    return;
 	}
 	
-	if ( ! checkRange(lineIP->text() ) ) {
+	if ( ! Utils::validateIPV4(lineIP->text()) ) {
 	    QMessageBox::warning( this, tr("Warning"),
 	    tr("IP Address is out of range! (") + lineIP->text() + tr(") Fields must be between 0-255.") );
 	   return;
                }
 	
-	if ( ! checkRange(lineNetmask->text() ) ) {
+	if ( ! Utils::validateIPV4(lineNetmask->text()) ) {
 	    QMessageBox::warning( this, tr("Warning"),
 	    tr("Netmask is out of range! (") + lineNetmask->text() + tr(") Fields must be between 0-255.") );
 	   return;
@@ -396,42 +396,6 @@
 
 }
 
-bool wificonfigwidgetbase::checkRange( QString IP )
-{
-int num;
-    
-    num = IP.section(".", 0,0).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-   num = IP.section(".", 1,1).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-    
-    num = IP.section(".", 2,2).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-   num = IP.section(".", 3,3).toInt();
-    
-    if ( num > 255 || num < 0)
-    {
-	return false;
-    }
-    
-    return TRUE;
-}
-
 // Slot which moves a SSID higher in the connection priority
 void wificonfigwidgetbase::slotMoveUp()
 {

Modified: pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.h	2012-07-03 18:59:47 UTC (rev 17613)
+++ pcbsd/current/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.h	2012-07-03 19:06:42 UTC (rev 17614)
@@ -71,7 +71,6 @@
     void slotWPAPSave(QString newkey);
 
 private:
-    bool checkRange( QString IP );
     void runCommand( QString Command );
     QString getLineFromCommandOutput( QString command );
     QString getNetmaskForIdent( QString ident );



More information about the Commits mailing list