[PC-BSD Commits] r8093 - in pcbsd: current/src-qt4/pc-netmanager/src/NetworkManager stable/pcbsd-netmanager/src/NetworkManagerAdmin
svn at pcbsd.org
svn at pcbsd.org
Tue Nov 30 09:43:22 PST 2010
Author: kris
Date: 2010-11-30 09:43:22 -0800 (Tue, 30 Nov 2010)
New Revision: 8093
Modified:
pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h
pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.cpp
pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.h
Log:
Improve the network manager admin tools for current/stable to use the conf file functions from libpcbsd
Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp 2010-11-30 17:28:36 UTC (rev 8092)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp 2010-11-30 17:43:22 UTC (rev 8093)
@@ -524,172 +524,18 @@
}
-QString NetworkMan::getValue( QString File, QString Key, int occur )
-{
- int found = 1;
-
- QFile file( File );
- if ( file.open( QIODevice::ReadOnly ) ) {
- QTextStream stream( &file );
- QString line;
- while ( !stream.atEnd() ) {
- line = stream.readLine(); // line of text excluding '\n'
-
- // If the KEY is found in the line, continue processing
- if ( line.indexOf(Key, 0) != -1 && line.indexOf("#", 0) != 0)
- {
- if ( found == occur) {
-
- line.remove(line.indexOf(Key, 0), Key.length());
-
-
- // Remove any quotes
- if ( line.indexOf('"') == 0 )
- {
- line = line.remove(0, 1);
- }
-
- if ( line.indexOf('"') != -1 )
- {
- line.truncate(line.indexOf('"'));
- }
-
- return line;
-
- } else {
- found++;
- }
-
-
- }
-
-
-
- }
- file.close();
- }
-
- return "";
-
-}
-
-
-void NetworkMan::saveValue( QString File, QString oldKey, QString newKey, int occur )
-{
- // Lets the dev save a value into a specified config file. The occur value tells which occurance of "oldKey" to replace
- // If occur is set to -1, it will remove any duplicates of "oldKey"
-
-
- QString SavedFile;
-
- int found = 1;
- int wroteKey = 0;
-
- int firstLine = 0;
-
- if ( occur == -1 && newKey.isEmpty() )
- {
-
- }
-
-
- // Load the old file, find the oldKey, remove it and replace with newKey
- QFile file( File );
- if ( file.open( QIODevice::ReadOnly ) ) {
- QTextStream stream( &file );
- QString line;
- while ( !stream.atEnd() ) {
- line = stream.readLine(); // line of text excluding '\n'
-
- // If the KEY is found in the line and this matches the occurance that must be processed
- if ( line.indexOf(oldKey, 0) != -1 && wroteKey == 0 && found == occur && line.indexOf("#", 0) != 0)
- {
- if ( firstLine == 0) {
-
- SavedFile = SavedFile + newKey;
- found++;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + newKey;
- found++;
- wroteKey = 1;
- }
-
- // If the KEY is found, and we are just on wrong occurance, save it and continue to search
- } else if (line.indexOf(oldKey, 0) != -1 && occur != -1 && found != occur && line.indexOf("#", 0) != 0 ) {
- if ( firstLine == 0) {
- SavedFile = SavedFile + line ;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + line ;
- }
-
- found++;
-
-
- // if we are trying to remove the key, don't save it
- } else if (line.indexOf(oldKey, 0) != -1 && occur == -1 && newKey.isEmpty() && line.indexOf("#", 0) != 0 ) {
-
- // We just want one occurance of the key
- } else if (line.indexOf(oldKey, 0) != -1 && occur == -1 && ! newKey.isEmpty() && line.indexOf("#", 0) != 0 ) {
- if ( firstLine == 0) {
- SavedFile = SavedFile + newKey;
- found++;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + newKey;
- found++;
- wroteKey = 1;
- }
-
-
- // String not found at all
- } else {
-
- if ( firstLine == 0) {
- SavedFile = SavedFile + line ;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + line ;
- }
- }
-
-
-
- }
- // Didnt find the key? Write it!
- if ( wroteKey == 0 && ! newKey.isEmpty())
- {
- SavedFile = SavedFile + "\n" + newKey;
- }
-
- file.close();
- }
-
-
- // Save the new file
- QFile fileout( File );
- if ( fileout.open( QIODevice::WriteOnly ) ) {
- QTextStream streamout( &fileout );
- streamout << SavedFile;
- fileout.close();
- }
-
-}
-
-
void NetworkMan::loadGlobals()
{
QString tmp;
- lineHostname->setText(getValue("/etc/rc.conf", "hostname=", 1));
- lineGateway->setText(getValue("/etc/rc.conf", "defaultrouter=", 1) );
- lineDNS1->setText(getValue("/etc/resolv.conf", "nameserver", 1) );
- lineDNS2->setText(getValue("/etc/resolv.conf", "nameserver", 2) );
- lineSearchDomain->setText(getValue("/etc/resolv.conf", "search", 1) );
+ lineHostname->setText(Utils::getConfFileValue("/etc/rc.conf", "hostname=", 1));
+ lineGateway->setText(Utils::getConfFileValue("/etc/rc.conf", "defaultrouter=", 1) );
+ lineDNS1->setText(Utils::getConfFileValue("/etc/resolv.conf", "nameserver", 1) );
+ lineDNS2->setText(Utils::getConfFileValue("/etc/resolv.conf", "nameserver", 2) );
+ lineSearchDomain->setText(Utils::getConfFileValue("/etc/resolv.conf", "search", 1) );
// Check for IPv6 settings
- lineIPv6Gateway->setText(getValue("/etc/rc.conf", "ipv6_defaultrouter=", 1) );
- tmp = getValue("/etc/rc.conf", "ipv6_activate_all_interfaces=", 1) ;
+ lineIPv6Gateway->setText(Utils::getConfFileValue("/etc/rc.conf", "ipv6_defaultrouter=", 1) );
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ipv6_activate_all_interfaces=", 1) ;
if ( tmp == "YES" )
groupIPv6->setChecked(TRUE);
else
@@ -882,7 +728,7 @@
QString tmp, tmp2;
// Check to see if PPPoE is enabled
- tmp = getValue( "/etc/rc.conf", "ppp_enable=", 1 );
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ppp_enable=", 1 );
if ( tmp != "YES" ) {
groupBoxPPPOE->setChecked(false);
return;
@@ -893,10 +739,10 @@
// Start loading the rc.conf information
- tmp = getValue( "/etc/rc.conf", "ppp_mode=", 1 );
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ppp_mode=", 1 );
if ( tmp == "ddial" )
checkPPPAlwaysOn->setChecked(TRUE);
- tmp = getValue( "/etc/rc.conf", "ppp_nat=", 1 );
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ppp_nat=", 1 );
if ( tmp == "YES" )
checkPPPNat->setChecked(TRUE);
@@ -1164,37 +1010,37 @@
{
if ( lineHostname->text().isEmpty() ) {
- saveValue("/etc/rc.conf", "hostname=", "hostname=\"" + lineHostname->text() + "\"", -1);
- saveValue("/etc/hosts", "::1", "::1\t\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
- saveValue("/etc/hosts", "127.0.0.1", "127.0.0.1\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
+ Utils::setConfFileValue("/etc/rc.conf", "hostname=", "hostname=\"" + lineHostname->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/hosts", "::1", "::1\t\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
+ Utils::setConfFileValue("/etc/hosts", "127.0.0.1", "127.0.0.1\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
}
if ( lineGateway->text() == "..." ) {
- saveValue("/etc/rc.conf", "defaultrouter=", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "defaultrouter=", "", -1);
} else {
- saveValue("/etc/rc.conf", "defaultrouter=", "defaultrouter=\"" + lineGateway->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "defaultrouter=", "defaultrouter=\"" + lineGateway->text() + "\"", -1);
}
int DNSline = 1;
if ( lineDNS1->text() == "..." ) {
- saveValue("/etc/resolv.conf", "nameserver", "", DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "", DNSline);
} else {
- saveValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS1->text(), DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS1->text(), DNSline);
DNSline++;
}
if ( lineDNS2->text() == "..." ) {
- saveValue("/etc/resolv.conf", "nameserver", "", DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "", DNSline);
} else {
- saveValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS2->text(), DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS2->text(), DNSline);
}
if ( lineSearchDomain->text().isEmpty() ) {
- saveValue("/etc/resolv.conf", "search", "", 1);
+ Utils::setConfFileValue("/etc/resolv.conf", "search", "", 1);
} else {
- saveValue("/etc/resolv.conf", "search", "search " + lineSearchDomain->text(), 1);
+ Utils::setConfFileValue("/etc/resolv.conf", "search", "search " + lineSearchDomain->text(), 1);
}
@@ -1205,11 +1051,11 @@
// Save the IPv6 stuff
if ( groupIPv6->isChecked() ) {
- saveValue("/etc/rc.conf", "ipv6_activate_all_interfaces=", "ipv6_activate_all_interfaces=\"YES\"", -1);
- saveValue("/etc/rc.conf", "ipv6_defaultrouter=", "ipv6_defaultrouter=\"" + lineIPv6Gateway->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_activate_all_interfaces=", "ipv6_activate_all_interfaces=\"YES\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_defaultrouter=", "ipv6_defaultrouter=\"" + lineIPv6Gateway->text() + "\"", -1);
} else {
- saveValue("/etc/rc.conf", "ipv6_activate_all_interfaces=", "", -1);
- saveValue("/etc/rc.conf", "ipv6_defaultrouter=", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_activate_all_interfaces=", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_defaultrouter=", "", -1);
}
// Save the lagg preference
@@ -1230,19 +1076,19 @@
// Make or update the entry in the /etc/ppp.conf file
updatePPPconf();
- saveValue( "/etc/rc.conf", "ppp_enable", "ppp_enable=\"YES\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_enable", "ppp_enable=\"YES\"", -1);
if ( checkPPPAlwaysOn->isChecked() ) {
- saveValue( "/etc/rc.conf", "ppp_mode", "ppp_mode=\"ddial\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_mode", "ppp_mode=\"ddial\"", -1);
} else {
- saveValue( "/etc/rc.conf", "ppp_mode", "ppp_mode=\"background\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_mode", "ppp_mode=\"background\"", -1);
}
if ( checkPPPNat->isChecked() ) {
- saveValue( "/etc/rc.conf", "ppp_nat", "ppp_nat=\"YES\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_nat", "ppp_nat=\"YES\"", -1);
} else {
- saveValue( "/etc/rc.conf", "ppp_nat", "ppp_nat=\"NO\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_nat", "ppp_nat=\"NO\"", -1);
}
- saveValue( "/etc/rc.conf", "ppp_profile", "ppp_profile=\"" + linePPPService->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_profile", "ppp_profile=\"" + linePPPService->text() + "\"", -1);
}
@@ -1294,10 +1140,10 @@
{
// Update the ppp.conf file to remove any old profile information
updatePPPconf();
- saveValue( "/etc/rc.conf", "ppp_enable", "", -1);
- saveValue( "/etc/rc.conf", "ppp_mode", "", -1);
- saveValue( "/etc/rc.conf", "ppp_nat", "", -1);
- saveValue( "/etc/rc.conf", "ppp_profile", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_enable", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_mode", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_nat", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_profile", "", -1);
}
Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h 2010-11-30 17:28:36 UTC (rev 8092)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h 2010-11-30 17:43:22 UTC (rev 8093)
@@ -78,8 +78,6 @@
bool checkValue( QString File, QString Key, QString Value );
bool checkWifiWlans( QString Key );
void runCommand( QString command );
- QString getValue( QString File, QString Key, int occur );
- void saveValue( QString File, QString oldKey, QString newKey, int occur );
QString getNetmaskForIdent( QString ident );
bool checkRange( QString IP );
QString getTypeForIdent( QString ident );
Modified: pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.cpp
===================================================================
--- pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.cpp 2010-11-30 17:28:36 UTC (rev 8092)
+++ pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.cpp 2010-11-30 17:43:22 UTC (rev 8093)
@@ -113,171 +113,17 @@
}
-QString NetworkManAdmin::getValue( QString File, QString Key, int occur )
-{
- int found = 1;
-
- QFile file( File );
- if ( file.open( QIODevice::ReadOnly ) ) {
- QTextStream stream( &file );
- QString line;
- while ( !stream.atEnd() ) {
- line = stream.readLine(); // line of text excluding '\n'
-
- // If the KEY is found in the line, continue processing
- if ( line.indexOf(Key, 0) != -1 && line.indexOf("#", 0) != 0)
- {
- if ( found == occur) {
-
- line.remove(line.indexOf(Key, 0), Key.length());
-
-
- // Remove any quotes
- if ( line.indexOf('"') == 0 )
- {
- line = line.remove(0, 1);
- }
-
- if ( line.indexOf('"') != -1 )
- {
- line.truncate(line.indexOf('"'));
- }
-
- return line;
-
- } else {
- found++;
- }
-
-
- }
-
-
-
- }
- file.close();
- }
-
- return "";
-
-}
-
-
-void NetworkManAdmin::saveValue( QString File, QString oldKey, QString newKey, int occur )
-{
- // Lets the dev save a value into a specified config file. The occur value tells which occurance of "oldKey" to replace
- // If occur is set to -1, it will remove any duplicates of "oldKey"
-
-
- QString SavedFile;
-
- int found = 1;
- int wroteKey = 0;
-
- int firstLine = 0;
-
- if ( occur == -1 && newKey.isEmpty() )
- {
-
- }
-
-
- // Load the old file, find the oldKey, remove it and replace with newKey
- QFile file( File );
- if ( file.open( QIODevice::ReadOnly ) ) {
- QTextStream stream( &file );
- QString line;
- while ( !stream.atEnd() ) {
- line = stream.readLine(); // line of text excluding '\n'
-
- // If the KEY is found in the line and this matches the occurance that must be processed
- if ( line.indexOf(oldKey, 0) != -1 && wroteKey == 0 && found == occur && line.indexOf("#", 0) != 0)
- {
- if ( firstLine == 0) {
-
- SavedFile = SavedFile + newKey;
- found++;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + newKey;
- found++;
- wroteKey = 1;
- }
-
- // If the KEY is found, and we are just on wrong occurance, save it and continue to search
- } else if (line.indexOf(oldKey, 0) != -1 && occur != -1 && found != occur && line.indexOf("#", 0) != 0 ) {
- if ( firstLine == 0) {
- SavedFile = SavedFile + line ;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + line ;
- }
-
- found++;
-
-
- // if we are trying to remove the key, don't save it
- } else if (line.indexOf(oldKey, 0) != -1 && occur == -1 && newKey.isEmpty() && line.indexOf("#", 0) != 0 ) {
-
- // We just want one occurance of the key
- } else if (line.indexOf(oldKey, 0) != -1 && occur == -1 && ! newKey.isEmpty() && line.indexOf("#", 0) != 0 ) {
- if ( firstLine == 0) {
- SavedFile = SavedFile + newKey;
- found++;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + newKey;
- found++;
- wroteKey = 1;
- }
-
-
- // String not found at all
- } else {
-
- if ( firstLine == 0) {
- SavedFile = SavedFile + line ;
- firstLine = 1;
- } else {
- SavedFile = SavedFile + "\n" + line ;
- }
- }
-
-
-
- }
- // Didnt find the key? Write it!
- if ( wroteKey == 0 && ! newKey.isEmpty())
- {
- SavedFile = SavedFile + "\n" + newKey;
- }
-
- file.close();
- }
-
-
- // Save the new file
- QFile fileout( File );
- if ( fileout.open( QIODevice::WriteOnly ) ) {
- QTextStream streamout( &fileout );
- streamout << SavedFile;
- fileout.close();
- }
-
-}
-
-
void NetworkManAdmin::loadGlobals()
{
QString tmp;
- lineHostname->setText(getValue("/etc/rc.conf", "hostname=", 1));
- lineGateway->setText(getValue("/etc/rc.conf", "defaultrouter=", 1) );
- lineDNS1->setText(getValue("/etc/resolv.conf", "nameserver", 1) );
- lineDNS2->setText(getValue("/etc/resolv.conf", "nameserver", 2) );
- lineSearchDomain->setText(getValue("/etc/resolv.conf", "search", 1) );
+ lineHostname->setText(Utils::getConfFileValue("/etc/rc.conf", "hostname=", 1));
+ lineGateway->setText(Utils::getConfFileValue("/etc/rc.conf", "defaultrouter=", 1) );
+ lineDNS1->setText(Utils::getConfFileValue("/etc/resolv.conf", "nameserver", 1) );
+ lineDNS2->setText(Utils::getConfFileValue("/etc/resolv.conf", "nameserver", 2) );
+ lineSearchDomain->setText(Utils::getConfFileValue("/etc/resolv.conf", "search", 1) );
// Check for IPv6 settings
- tmp = getValue("/etc/rc.conf", "ipv6_enable=", 1) ;
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ipv6_enable=", 1) ;
if ( tmp == "YES" ) {
checkIPv6Enable->setChecked(TRUE);
lineIPv6Gateway->setEnabled(TRUE);
@@ -286,7 +132,7 @@
lineIPv6Gateway->setEnabled(FALSE);
}
- lineIPv6Gateway->setText(getValue("/etc/rc.conf", "ipv6_defaultrouter=", 1) );
+ lineIPv6Gateway->setText(Utils::getConfFileValue("/etc/rc.conf", "ipv6_defaultrouter=", 1) );
// Check if we want to use the lagg interface
@@ -348,36 +194,36 @@
void NetworkManAdmin::save()
{
- saveValue("/etc/rc.conf", "hostname=", "hostname=\"" + lineHostname->text() + "\"", -1);
- saveValue("/etc/hosts", "::1", "::1\t\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
- saveValue("/etc/hosts", "127.0.0.1", "127.0.0.1\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
+ Utils::setConfFileValue("/etc/rc.conf", "hostname=", "hostname=\"" + lineHostname->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/hosts", "::1", "::1\t\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
+ Utils::setConfFileValue("/etc/hosts", "127.0.0.1", "127.0.0.1\t\tlocalhost localhost.localdomain " + lineHostname->text() + ".localhost " + lineHostname->text(), -1);
if ( lineGateway->text() == "..." ) {
- saveValue("/etc/rc.conf", "defaultrouter=", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "defaultrouter=", "", -1);
} else {
- saveValue("/etc/rc.conf", "defaultrouter=", "defaultrouter=\"" + lineGateway->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "defaultrouter=", "defaultrouter=\"" + lineGateway->text() + "\"", -1);
}
int DNSline = 1;
if ( lineDNS1->text() == "..." ) {
- saveValue("/etc/resolv.conf", "nameserver", "", DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "", DNSline);
} else {
- saveValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS1->text(), DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS1->text(), DNSline);
DNSline++;
}
if ( lineDNS2->text() == "..." ) {
- saveValue("/etc/resolv.conf", "nameserver", "", DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "", DNSline);
} else {
- saveValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS2->text(), DNSline);
+ Utils::setConfFileValue("/etc/resolv.conf", "nameserver", "nameserver " + lineDNS2->text(), DNSline);
}
if ( lineSearchDomain->text().isEmpty() ) {
- saveValue("/etc/resolv.conf", "search", "", 1);
+ Utils::setConfFileValue("/etc/resolv.conf", "search", "", 1);
} else {
- saveValue("/etc/resolv.conf", "search", "search " + lineSearchDomain->text(), 1);
+ Utils::setConfFileValue("/etc/resolv.conf", "search", "search " + lineSearchDomain->text(), 1);
}
// Save the lagg preference
@@ -394,11 +240,11 @@
// Save the IPv6 stuff
if ( checkIPv6Enable->isChecked() ) {
- saveValue("/etc/rc.conf", "ipv6_enable=", "ipv6_enable=\"YES\"", -1);
- saveValue("/etc/rc.conf", "ipv6_defaultrouter=", "ipv6_defaultrouter=\"" + lineIPv6Gateway->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_enable=", "ipv6_enable=\"YES\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_defaultrouter=", "ipv6_defaultrouter=\"" + lineIPv6Gateway->text() + "\"", -1);
} else {
- saveValue("/etc/rc.conf", "ipv6_enable=", "", -1);
- saveValue("/etc/rc.conf", "ipv6_defaultrouter=", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_enable=", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ipv6_defaultrouter=", "", -1);
}
restartNetwork();
@@ -495,7 +341,7 @@
QString tmp, tmp2;
// Check to see if PPPoE is enabled
- tmp = getValue( "/etc/rc.conf", "ppp_enable=", 1 );
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ppp_enable=", 1 );
if ( tmp == "YES" ) {
checkPPPOE->setChecked(TRUE);
}
@@ -503,11 +349,11 @@
// Start loading the rc.conf information
- tmp = getValue( "/etc/rc.conf", "ppp_mode=", 1 );
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ppp_mode=", 1 );
if ( tmp == "ddial" ) {
checkPPPAlwaysOn->setChecked(TRUE);
}
- tmp = getValue( "/etc/rc.conf", "ppp_nat=", 1 );
+ tmp = Utils::getConfFileValue("/etc/rc.conf", "ppp_nat=", 1 );
if ( tmp == "YES" ) {
checkPPPNat->setChecked(TRUE);
}
@@ -574,19 +420,19 @@
// Make or update the entry in the /etc/ppp.conf file
updatePPPconf();
- saveValue( "/etc/rc.conf", "ppp_enable", "ppp_enable=\"YES\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_enable", "ppp_enable=\"YES\"", -1);
if ( checkPPPAlwaysOn->isChecked() ) {
- saveValue( "/etc/rc.conf", "ppp_mode", "ppp_mode=\"ddial\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_mode", "ppp_mode=\"ddial\"", -1);
} else {
- saveValue( "/etc/rc.conf", "ppp_mode", "ppp_mode=\"background\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_mode", "ppp_mode=\"background\"", -1);
}
if ( checkPPPNat->isChecked() ) {
- saveValue( "/etc/rc.conf", "ppp_nat", "ppp_nat=\"YES\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_nat", "ppp_nat=\"YES\"", -1);
} else {
- saveValue( "/etc/rc.conf", "ppp_nat", "ppp_nat=\"NO\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_nat", "ppp_nat=\"NO\"", -1);
}
- saveValue( "/etc/rc.conf", "ppp_profile", "ppp_profile=\"" + linePPPService->text() + "\"", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_profile", "ppp_profile=\"" + linePPPService->text() + "\"", -1);
}
@@ -619,10 +465,10 @@
{
// Update the ppp.conf file to remove any old profile information
updatePPPconf();
- saveValue( "/etc/rc.conf", "ppp_enable", "", -1);
- saveValue( "/etc/rc.conf", "ppp_mode", "", -1);
- saveValue( "/etc/rc.conf", "ppp_nat", "", -1);
- saveValue( "/etc/rc.conf", "ppp_profile", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_enable", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_mode", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_nat", "", -1);
+ Utils::setConfFileValue("/etc/rc.conf", "ppp_profile", "", -1);
}
Modified: pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.h
===================================================================
--- pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.h 2010-11-30 17:28:36 UTC (rev 8092)
+++ pcbsd/stable/pcbsd-netmanager/src/NetworkManagerAdmin/netmanadmin.h 2010-11-30 17:43:22 UTC (rev 8093)
@@ -31,8 +31,6 @@
void runCommand( QString command );
void restartNetwork();
QString getLineFromCommandOutput(QString command);
- QString getValue( QString File, QString Key, int occur );
- void saveValue( QString File, QString oldKey, QString newKey, int occur );
void loadGlobals();
bool checkRange( QString IP );
bool checkValue( QString File, QString Key, QString Value );
More information about the Commits
mailing list