[PC-BSD Commits] r2057 - pcbsd/trunk/NetworkManager
svn at pcbsd.org
svn at pcbsd.org
Mon Jun 9 03:59:27 PDT 2008
Author: tim
Date: 2008-06-09 03:59:27 -0700 (Mon, 09 Jun 2008)
New Revision: 2057
Modified:
pcbsd/trunk/NetworkManager/networkman.ui.h
Log:
Refactored for libpcbsd
Modified: pcbsd/trunk/NetworkManager/networkman.ui.h
===================================================================
--- pcbsd/trunk/NetworkManager/networkman.ui.h 2008-06-09 10:59:06 UTC (rev 2056)
+++ pcbsd/trunk/NetworkManager/networkman.ui.h 2008-06-09 10:59:27 UTC (rev 2057)
@@ -125,19 +125,8 @@
QString NetworkMan::getIpForIdent( QString ident )
{
- QString command = "ifconfig " +ident + " | grep \"inet \"";
- QString inputLine = getLineFromCommandOutput(command);
- QString ip= "";
-
- if (inputLine != "" && inputLine.find("inet ") != -1){
-
- ip = inputLine.remove(0, inputLine.find("inet ") + 5);
- ip.truncate(ip.find(" "));
-
-
- }
-
- return ip;
+ NetworkInterface ifr(ident);
+ return ifr.ipAsString();
}
@@ -516,41 +505,8 @@
QString NetworkMan::getNetmaskForIdent( QString ident )
{
-
- int num;
- QString RealIP, tmp;
-
- QString command = "ifconfig " +ident + " | grep \"netmask\"";
- QString inputLine = getLineFromCommandOutput(command);
- QString net= "";
-
- if (inputLine != "" && inputLine.find("netmask ") != -1){
-
- net = inputLine.remove(0, inputLine.find("netmask ") + 8);
- net.truncate(net.find(" "));
-
- num = net.mid(2, 2).toInt(0, 16);
- tmp.setNum(num);
- RealIP = tmp;
-
- num = net.mid(4, 2).toInt(0, 16);
- tmp.setNum(num);
- RealIP = RealIP + "." + tmp ;
-
- num = net.mid(6, 2).toInt(0, 16);
- tmp.setNum(num);
- RealIP = RealIP + "." + tmp ;
-
- num = net.mid(8, 2).toInt(0, 16);
- tmp.setNum(num);
- RealIP = RealIP + "." + tmp ;
-
- //QMessageBox::information( this, "Application name", "IP: " + RealIP );
-
- }
-
- return RealIP;
-
+ NetworkInterface ifr(ident);
+ return ifr.netmaskAsString();
}
More information about the Commits
mailing list