summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces
authormickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
committer mickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
commit16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff)
tree0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/settings/networksettings/interfaces
parent8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff)
downloadopie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/settings/networksettings/interfaces') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp20
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp42
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp14
3 files changed, 38 insertions, 38 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index b00b899..d2b106a 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -137,13 +137,13 @@ bool Interface::refresh(){
QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
if(ret != 0){
- qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
+ odebug << QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1() << oendl;
return false;
}
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
- qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
+ odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl;
return false;
}
@@ -201,7 +201,7 @@ bool Interface::refresh(){
file.setName(dhcpFile);
if (!file.open(IO_ReadOnly)){
- qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
+ odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl;
return false;
}
@@ -220,14 +220,14 @@ bool Interface::refresh(){
renewalTime = line.mid(12, line.length()).toInt();
}
file.close();
- //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1());
- //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
+ //odebug << QString("Interface: leaseTime: %1").arg(leaseTime).latin1() << oendl;
+ //odebug << QString("Interface: renewalTime: %1").arg(renewalTime).latin1() << oendl;
// Get the pid of the deamond
dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
file.setName(dhcpFile);
if (!file.open(IO_ReadOnly)){
- qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
+ odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl;
return false;
}
@@ -240,7 +240,7 @@ bool Interface::refresh(){
file.close();
if( pid == -1){
- qDebug("Interface: Could not get pid of dhcpc deamon.");
+ odebug << "Interface: Could not get pid of dhcpc deamon." << oendl;
return false;
}
@@ -249,7 +249,7 @@ bool Interface::refresh(){
file.setName(fileName);
stream.setDevice( &file );
if (!file.open(IO_ReadOnly)){
- qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
+ odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl;
return false;
}
while ( !stream.eof() ) {
@@ -278,12 +278,12 @@ bool Interface::refresh(){
f.close();
}
else{
- qDebug("Interface: Can't open /proc/uptime to retrive uptime.");
+ odebug << "Interface: Can't open /proc/uptime to retrive uptime." << oendl;
return false;
}
datetime = datetime.addSecs(time);
- //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1());
+ //odebug << QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1() << oendl;
// Calculate the start and renew times
leaseObtained = datetime.toString();
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 6b161ae..e283926 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -24,7 +24,7 @@ Interfaces::Interfaces(QString useInterfacesFile){
interfacesFile = useInterfacesFile;
QFile file(interfacesFile);
if (!file.open(IO_ReadOnly)){
- qDebug("Interfaces: Can't open file: %s for reading.", interfacesFile.latin1() );
+ odebug << "Interfaces: Can't open file: " << interfacesFile.latin1() << " for reading." << oendl;
currentIface = interfaces.end();
currentMapping = interfaces.end();
return;
@@ -76,7 +76,7 @@ bool Interfaces::isAuto(const QString &interface) const {
QStringList autoLines = interfaces.grep(QRegExp(AUTO));
QStringList awi = autoLines.grep(QRegExp(interface));
if(awi.count() > 1)
- qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1());
+ odebug << QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1() << oendl;
return awi.count() > 0;
}
@@ -152,7 +152,7 @@ bool Interfaces::isInterfaceSet() const {
* @return true if successful.
*/
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
- qDebug("Interfaces::addInterface(%s)",interface.latin1());
+ odebug << "Interfaces::addInterface(" << interface.latin1() << ")" << oendl;
if(0 == acceptedFamily.contains(family))
return false;
QString newInterface = interface.simplifyWhiteSpace();
@@ -168,7 +168,7 @@ bool Interfaces::addInterface(const QString &interface, const QString &family, c
* @return bool true if successful
*/
bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
- qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
+ odebug << "copy interface " << interface.latin1() << " to " << newInterface.latin1() << "" << oendl;
if(!setInterface(interface))
return false;
@@ -275,14 +275,14 @@ QString Interfaces::getInterfaceMethod(bool &error){
* @return bool true if successful.
*/
bool Interfaces::setInterfaceName(const QString &newName){
- qDebug("setInterfaceName %s", newName.latin1());
+ odebug << "setInterfaceName " << newName.latin1() << "" << oendl;
if(currentIface == interfaces.end())
return false;
QString name = newName.simplifyWhiteSpace();
name = name.replace(QRegExp(" "), "");
bool returnValue = false;
QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
- qDebug("setting %s",tmp.latin1());
+ odebug << "setting " << tmp.latin1() << "" << oendl;
(*currentIface) = tmp;
return !returnValue;
@@ -345,7 +345,7 @@ bool Interfaces::setInterfaceOption(const QString &option, const QString &value)
if( value.stripWhiteSpace().isEmpty() )
return removeInterfaceOption( option );
- qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1());
+ odebug << "iface >" << (*currentIface).latin1() << "< option >" << option.latin1() << "< value >" << value.latin1() << "<" << oendl;
return setOption(currentIface, option, value);
}
@@ -486,7 +486,7 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
}
if(valid){
if(found == true){
- qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1());
+ odebug << QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1() << oendl;
}
found = true;
iterator = it;
@@ -505,12 +505,12 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
- qDebug("setting option");
+ odebug << "setting option" << oendl;
bool found = false;
bool replaced = false;
QStringList::Iterator insertAt = NULL;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
- qDebug(" Interfaces::setOption got line >%s<",(*it).latin1());
+ odebug << " Interfaces::setOption got line >" << (*it).latin1() << "<" << oendl;
// FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line
// but since it works with an empty interfaces file I (tille) will not do anything more
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){
@@ -518,10 +518,10 @@ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &op
// && it != start){
// if(!found && value != ""){
// // Got to the end of the stanza without finding it, so append it.
-// qDebug(" Got to the end of the stanza without finding it, so append it.");
+// odebug << " Got to the end of the stanza without finding it, so append it." << oendl;
// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
// }
- qDebug("found 1");
+ odebug << "found 1" << oendl;
// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value));
found = true;
insertAt = it;
@@ -529,23 +529,23 @@ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &op
}
if((*it).contains(option) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
- qDebug("found 2");
+ odebug << "found 2" << oendl;
if(found)
- qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
+ odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl;
found = true;
replaced = true;
(*it) = QString("\t%1 %2").arg(option).arg(value);
}
}
if(!found){
- qDebug("! found insert anyway");
+ odebug << "! found insert anyway" << oendl;
QStringList::Iterator p = start;
interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
found = true;
}
if(found && !replaced){
- qDebug("found iface but not the option so insert it here...");
+ odebug << "found iface but not the option so insert it here..." << oendl;
interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value));
}
return found;
@@ -582,7 +582,7 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
if((*it).contains(option) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
if(found)
- qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
+ odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl;
found = true;
it = interfaces.remove( it ); // we really want to remove the line
--it; // we do ++it later in the head of the for loop
@@ -610,7 +610,7 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
if(found)
- qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
+ odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl;
found = true;
it = interfaces.remove( it ); // we really want to remove the line
--it; // we do ++it later in the head of the for loop
@@ -663,7 +663,7 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
}
if((*it).contains(option) && (*it).at(0) != '#'){
if(found)
- qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1());
+ odebug << QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1() << oendl;
found = true;
QString line = (*it).simplifyWhiteSpace();
int space = line.find(" ", option.length());
@@ -687,7 +687,7 @@ bool Interfaces::write(){
QFile file(interfacesFile);
if (!file.open(IO_ReadWrite)){
- qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1());
+ odebug << QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1() << oendl;
return false;
}
QTextStream stream( &file );
@@ -700,7 +700,7 @@ bool Interfaces::write(){
else
whiteSpaceCount = 0;
if(whiteSpaceCount < 2){
- qDebug((*it).latin1());
+ odebug << (*it).latin1() << oendl;
stream << (*it) << '\n';
}
}
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index 7c2f85c..ec3bad3 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -46,7 +46,7 @@ InterfaceSetupImp::~InterfaceSetupImp(){
bool InterfaceSetupImp::saveChanges(){
bool error;
QString iface = interfaces->getInterfaceName(error);
- qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() );
+ odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl;
if(!saveSettings())
return false;
@@ -72,7 +72,7 @@ bool InterfaceSetupImp::saveChanges(){
qApp->processEvents();
if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
- qWarning("unstable to spawn ifdown/ifup");
+ owarn << "unstable to spawn ifdown/ifup" << oendl;
}
owait->hide();
@@ -157,7 +157,7 @@ void InterfaceSetupImp::setProfile(const QString &profile){
if(!interfaces->setMapping(interface->getInterfaceName())){
interfaces->addMapping(interface->getInterfaceName());
if(!interfaces->setMapping(interface->getInterfaceName())){
- qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface.");
+ odebug << "InterfaceSetupImp: Added Mapping, but still can't setInterface." << oendl;
return;
}
}
@@ -167,7 +167,7 @@ void InterfaceSetupImp::setProfile(const QString &profile){
else{
interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
if(!interfaces->setInterface(newInterfaceName)){
- qDebug("InterfaceSetupImp: Added interface, but still can't setInterface.");
+ odebug << "InterfaceSetupImp: Added interface, but still can't setInterface." << oendl;
return;
}
}
@@ -185,7 +185,7 @@ void InterfaceSetupImp::setProfile(const QString &profile){
// IP Information
autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName()));
QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error);
- qDebug("dns >%s<",dns.latin1());
+ odebug << "dns >" << dns.latin1() << "<" << oendl;
if(dns.contains(" ")){
firstDNSLineEdit->setText(dns.mid(0, dns.find(" ")));
secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length()));
@@ -199,8 +199,8 @@ void InterfaceSetupImp::setProfile(const QString &profile){
- qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1());
- qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1());
+ owarn << "InterfaceSetupImp::setProfile(" << profile.latin1() << ")\n" << oendl;
+ owarn << "InterfaceSetupImp::setProfile: iface is " << interfaces->getInterfaceName(error).latin1() << "\n" << oendl;
}