summaryrefslogtreecommitdiff
path: root/noncore/settings
Side-by-side diff
Diffstat (limited to 'noncore/settings') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/backup/backuprestore.cpp28
-rw-r--r--noncore/settings/netsystemtime/settingstabwidget.cpp2
-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
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp38
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/authwidget.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp10
-rw-r--r--noncore/settings/networksettings/ppp/devices.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp14
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp20
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp48
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp12
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp92
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp20
-rw-r--r--noncore/settings/networksettings/wlan/infoimp.cpp4
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp12
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp6
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp24
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp54
-rw-r--r--noncore/settings/sound/sound.pro1
-rw-r--r--noncore/settings/sound/soundsettings.cpp16
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp10
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp20
-rw-r--r--noncore/settings/usermanager/userdialog.cpp14
-rw-r--r--noncore/settings/usermanager/usermanager.cpp11
-rw-r--r--noncore/settings/usermanager/usermanager.pro1
30 files changed, 275 insertions, 272 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 58e5c71..2eccdfe 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,19 +1,20 @@
-
#include "backuprestore.h"
#include "errordialog.h"
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/ostorageinfo.h>
#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
/* QT */
#include <qapplication.h>
#include <qmultilineedit.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qheader.h>
#include <qpe/resource.h>
#include <qpe/config.h>
@@ -31,25 +32,24 @@
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#define HEADER_NAME 0
#define HEADER_BACKUP 1
#define BACKUP_LOCATION 2
#define EXTENSION ".bck"
const QString tempFileName = "/tmp/backup.err";
-
BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl)
: BackupAndRestoreBase(parent, name, fl)
{
backupList->header()->hide();
restoreList->header()->hide();
connect(backupButton, SIGNAL(clicked()),
this, SLOT(backup()));
connect(restoreButton, SIGNAL(clicked()),
this, SLOT(restore()));
connect(backupList, SIGNAL(clicked(QListViewItem*)),
this, SLOT(selectItem(QListViewItem*)));
connect(restoreSource, SIGNAL(activated(int)),
@@ -64,35 +64,35 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f
selectItem(applicationSettings);
documents= new QListViewItem(backupList, "Documents", "", "Documents/");
selectItem(documents);
scanForApplicationSettings();
Opie::Core::OStorageInfo storage;
backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" );
if ( storage.hasCf() )
{
backupLocations.insert( "CF", storage.cfPath() );
- qDebug( "Cf Path: " + storage.cfPath() );
+ odebug << "Cf Path: " + storage.cfPath() << oendl;
}
if ( storage.hasSd() )
{
backupLocations.insert( "SD", storage.sdPath() );
- qDebug( " Sd Path: " + storage.sdPath() );
+ odebug << " Sd Path: " + storage.sdPath() << oendl;
}
if ( storage.hasMmc() )
{
backupLocations.insert( "MMC", storage.mmcPath() );
- qDebug( "Mmc Path: " + storage.mmcPath() );
+ odebug << "Mmc Path: " + storage.mmcPath() << oendl;
}
Config config("BackupAndRestore");
//read last locations
config.setGroup("LastLocation");
QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" );
QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" );
int locationIndex = 0;
QMap<QString, QString>::Iterator it;
for( it = backupLocations.begin(); it != backupLocations.end(); ++it )
{
@@ -194,25 +194,25 @@ void BackupAndRestore::selectItem(QListViewItem *currentItem)
}
}
void BackupAndRestore::scanForApplicationSettings()
{
QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) );
d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
- //qDebug((d.path()+"/"+fi->fileName()).latin1());
+ //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl;
if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) )
{
QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName());
selectItem(newItem);
}
++it;
}
}
/**
* The "Backup" button has been pressed. Get a list of all of the files that
* should be backed up. If there are no files, emit and error and exit.
@@ -240,48 +240,48 @@ void BackupAndRestore::backup()
QString t = outputFile;
int c = 1;
while(QFile::exists(outputFile + EXTENSION))
{
outputFile = t + QString("%1").arg(c);
c++;
}
// We execute tar and compressing its output with gzip..
// The error output will be written into a temp-file which could be provided
// for debugging..
- qDebug( "Storing file: %s", outputFile.latin1() );
+ odebug << "Storing file: " << outputFile.latin1() << "" << oendl;
outputFile += EXTENSION;
QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() )
.arg( getExcludeFile() )
.arg( backupFiles )
.arg( outputFile.latin1() )
.arg( tempFileName.latin1() );
- qDebug( commandLine );
+ odebug << commandLine << oendl;
int r = system( commandLine );
if(r != 0)
{
perror("Error: ");
QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n"
+ errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) )
{
case 1:
- qWarning("Details pressed !");
+ owarn << "Details pressed !" << oendl;
ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
QFile errorFile( tempFileName );
if ( errorFile.open(IO_ReadOnly) )
{
QTextStream t( &errorFile );
QString s;
while ( !t.eof() )
{ // until end of file...
s += t.readLine(); // line of text excluding '\n'
}
errorFile.close();
@@ -350,37 +350,37 @@ int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent
}
return count;
}
void BackupAndRestore::sourceDirChanged(int selection)
{
restoreList->clear();
rescanFolder(backupLocations[restoreSource->text(selection)]);
}
void BackupAndRestore::fileListUpdate()
{
- qWarning("void BackupAndRestore::fileListUpdate()");
+ owarn << "void BackupAndRestore::fileListUpdate()" << oendl;
restoreList->clear();
rescanFolder( backupLocations[restoreSource->currentText()] );
}
/**
* Scans directory for any backup files. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
*/
void BackupAndRestore::rescanFolder(QString directory)
{
- //qDebug(QString("rescanFolder: ") + directory.latin1());
+ //odebug << QString("rescanFolder: ") + directory.latin1() << oendl;
QDir d(directory);
if(!d.exists())
return;
d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *file;
while ( (file=it.current()) )
{ // for each file...
// If it is a dir and not .. or . then add it as a tab and go down.
if(file->isDir())
@@ -410,60 +410,60 @@ void BackupAndRestore::restore()
if(!restoreItem)
{
QMessageBox::critical(this, tr( "Message" ),
tr( "Please select something to restore." ),QString( tr( "Ok") ) );
return;
}
setCaption(tr("Backup and Restore... working..."));
QString restoreFile = backupLocations[restoreSource->currentText()];
restoreFile += "/" + restoreItem->text(0);
- qDebug( restoreFile );
+ odebug << restoreFile << oendl;
//check if backup file come from opie 1.0.x
QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() );
int r = system( commandLine );
QString startDir;
if( r != 0 ) //Applications/backup/exclude not found - old backup file
{
startDir = QString( "/" );
} else
{
startDir = QDir::homeDirPath();
}
//unpack backup file
commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir )
.arg( restoreFile.latin1() )
.arg( tempFileName.latin1() );
- qDebug( commandLine );
+ odebug << commandLine << oendl;
r = system( commandLine );
//error handling
if(r != 0)
{
QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno );
switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n"
+ errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) )
{
case 1:
- qWarning("Details pressed !");
+ owarn << "Details pressed !" << oendl;
ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
QFile errorFile( tempFileName );
if ( errorFile.open(IO_ReadOnly) )
{
QTextStream t( &errorFile );
QString s;
while ( !t.eof() )
{ // until end of file...
s += t.readLine(); // line of text excluding '\n'
}
errorFile.close();
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp
index ad80e05..1307082 100644
--- a/noncore/settings/netsystemtime/settingstabwidget.cpp
+++ b/noncore/settings/netsystemtime/settingstabwidget.cpp
@@ -130,25 +130,25 @@ void SettingsTabWidget::saveSettings()
if ( serversChanged )
{
QString ntpSrvsFile = QPEApplication::qpeDir();
ntpSrvsFile.append( "etc/ntpservers" );
Config ntpSrvs( ntpSrvsFile, Config::File );
ntpSrvs.setGroup( "servers" );
ntpSrvs.writeEntry( "count", ++srvCount );
ntpSrvs.setGroup( "0" );
ntpSrvs.writeEntry( "name", edit );
curSrv = 0;
for ( int i = 1; i < srvCount; i++ )
{
-// qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() );
+// odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl;
ntpSrvs.setGroup( QString::number( i ) );
ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) );
}
}
Config config( "ntp", Config::User );
config.setGroup( "settings" );
config.writeEntry( "ntpServer", curSrv );
config.writeEntry( "minLookupDiff", sbPredictDelay->value() );
config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() );
config.writeEntry( "displayNtpTab", chNtpTab->isChecked() );
config.writeEntry( "displayPredictTab", chPredictTab->isChecked() );
}
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
@@ -128,31 +128,31 @@ bool Interface::refresh(){
broadcast = "";
dhcp = false;
dhcpServerIp = "";
leaseObtained = "";
leaseExpires = "";
emit(updateInterface(this));
return true;
}
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;
}
// Set to the defaults
macAddress = "";
ip = "0.0.0.0";
subnetMask = "0.0.0.0";
broadcast = "";
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
@@ -192,73 +192,73 @@ bool Interface::refresh(){
dhcpDirectory = "/var/run";
// See if we have
QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
// If there is no DHCP information then exit now with no errors.
if(!QFile::exists(dhcpFile)){
emit(updateInterface(this));
return true;
}
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;
}
// leaseTime and renewalTime and used if pid and deamon exe can be accessed.
int leaseTime = 0;
int renewalTime = 0;
stream.setDevice( &file );
while ( !stream.eof() ) {
line = stream.readLine();
if(line.contains("DHCPSIADDR="))
dhcpServerIp = line.mid(11, line.length());
if(line.contains("LEASETIME="))
leaseTime = line.mid(10, line.length()).toInt();
if(line.contains("RENEWALTIME="))
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;
}
int pid = -1;
stream.setDevice( &file );
while ( !stream.eof() ) {
line = stream.readLine();
pid = line.toInt();
}
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;
}
// Get the start running time of the deamon
fileName = (QString("/proc/%1/stat").arg(pid));
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() ) {
line = stream.readLine();
}
file.close();
long time = 0;
// Grab the start time
// pid com state ppid pgrp session tty_nr tpgid flags
sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u "
// minflt cminflt majflt cmajflt utime stime cutime cstime priority
"%*u %*u %*u %*u %*u %*u %*d %*d %*d "
@@ -269,30 +269,30 @@ bool Interface::refresh(){
QDateTime datetime(QDateTime::currentDateTime());
// Get the uptime of the computer.
QFile f("/proc/uptime");
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
int sec = 0;
t >> sec;
datetime = datetime.addSecs((-1*sec));
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();
// Calculate the start and renew times
datetime = datetime.addSecs(leaseTime);
leaseExpires = datetime.toString();
dhcp = true;
emit(updateInterface(this));
return true;
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
@@ -15,25 +15,25 @@
* the \n for interfaces variable.
* @param useInterfacesFile if an interface file other then the default is
* desired to be used it should be passed in.
*/
Interfaces::Interfaces(QString useInterfacesFile){
acceptedFamily.append(INTERFACES_FAMILY_INET);
acceptedFamily.append(INTERFACES_FAMILY_IPX);
acceptedFamily.append(INTERFACES_FAMILY_INET6);
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;
}
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
line += stream.readLine();
line += "\n";
}
file.close();
interfaces = QStringList::split("\n", line, true);
@@ -67,25 +67,25 @@ QStringList Interfaces::getInterfaceList(){
}
/**
* Find out if interface is in an "auto" group or not.
* Report any duplicates such as eth0 being in two differnt auto's
* @param interface interface to check to see if it is on or not.
* @return true is interface is in auto
*/
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;
}
/**
* Attempt to set the auto option for interface to setAuto.
* @param interface the interface to set
* @param setAuto the value to set interface to.
* @return false if already set to setAuto.
* */
bool Interfaces::setAuto(const QString &interface, bool setAuto){
// Don't need to set it if it is already set.
if(isAuto(interface) == setAuto)
@@ -143,41 +143,41 @@ bool Interfaces::isInterfaceSet() const {
}
/**
* Add a new interface of with the settings - family and method
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
* @param family the family of this interface inet or inet, ipx or inet6
* Must of one of the families defined in interfaces.h
* @param method for the family. see interfaces man page for family methods.
* @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();
newInterface = newInterface.replace(QRegExp(" "), "");
interfaces.append("");
interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
return true;
}
/**
* Copies interface with name interface to name newInterface
* @param newInterface name of the new interface.
* @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;
// Store the old interface and bump past the stanza line.
QStringList::Iterator it = currentIface;
it++;
// Add the new interface
bool error;
addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error));
if(!setInterface(newInterface))
return false;
@@ -266,32 +266,32 @@ QString Interfaces::getInterfaceMethod(bool &error){
line = line.mid(family.length()+1, line.length());
line = line.simplifyWhiteSpace();
error = false;
return line;
}
/**
* Sets the interface name to newName.
* @param newName the new name of the interface. All whitespace is removed.
* @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;
}
/**
* Sets the interface family to newName.
* @param newName the new name of the interface. Must be one of the families
* defined in the interfaces.h file.
* @return bool true if successful.
*/
bool Interfaces::setInterfaceFamily(const QString &newName){
@@ -336,25 +336,25 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){
* doesn't exist then it is added along with the value.
* If value isEmpty() then we will remove the option
*
* @param option the options to set the value.
* @param value the value that option should be set to.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
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);
}
/**
* Removes a value for an option in the currently selected interface.
* @param option the options to set the value.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
bool Interfaces::removeInterfaceOption(const QString &option){
return removeOption(currentIface, option);
}
@@ -477,84 +477,84 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
// There are more chars in the line. check +1
if(line.at(point-1) != ' ')
valid = false;
}
point += option.length();
if(point < line.length()-1){
// There are more chars in the line. check -1
if(line.at(point) != ' ')
valid = false;
}
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;
}
}
}
return found;
}
/**
* Sets a value of an option in a stanza
* @param start the start of the stanza
* @param option the option to use when setting value.
* @return bool true if successful, false otherwise.
*/
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)) ){
if (found) break;
// && 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;
}
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;
}
/**
* Removes a stanza and all of its options
* @param stanza the stanza to remove
* @return bool true if successful.
*/
bool Interfaces::removeStanza(QStringList::Iterator &stanza){
if(stanza == interfaces.end())
@@ -573,25 +573,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
if(start == interfaces.end())
return false;
bool found = false;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
// got to the end without finding it
break;
}
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
}
}
return found;
}
/**
* Removes a option in a stanza
* @param start the start of the stanza
* @param option the option to use when setting value.
@@ -601,25 +601,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
if(start == interfaces.end())
return false;
bool found = false;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
// got to the end without finding it
break;
}
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
}
}
return found;
}
/**
* Removes all options in a stanza
* @param start the start of the stanza
* @return bool true if successful, false otherwise.
@@ -654,59 +654,59 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
error = false;
return QString();
}
QString value;
bool found = false;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
break;
}
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());
if(space != -1){
value = line.mid(space+1, line.length());
break;
}
}
}
error = !found;
return value;
}
/**
* Write out the interfaces file to the file passed into the constructor.
* Removes any excess blank lines over 1 line long.
* @return bool true if successful, false if not.
*/
bool Interfaces::write(){
QFile::remove(interfacesFile);
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 );
int whiteSpaceCount = 0;
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
QString line = (*it).simplifyWhiteSpace();
line = line.replace(QRegExp(" "),"");
if(line.length() == 0)
whiteSpaceCount++;
else
whiteSpaceCount = 0;
if(whiteSpaceCount < 2){
- qDebug((*it).latin1());
+ odebug << (*it).latin1() << oendl;
stream << (*it) << '\n';
}
}
file.close();
return true;
}
// interfaces.cpp
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
@@ -37,25 +37,25 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac
InterfaceSetupImp::~InterfaceSetupImp(){
if(delInterfaces) {
delete interfaces;
}
}
/**
* Save the current settings, then write out the interfaces file and close.
*/
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;
interfaces->write();
if (interface->getStatus()) {
QString ifup;
ifup += "ifdown ";
ifup += iface;
ifup += "; ifup ";
ifup += iface;
ifup += ";";
@@ -63,25 +63,25 @@ bool InterfaceSetupImp::saveChanges(){
OProcess restart;
restart << "sh";
restart << "-c";
restart << ifup;
OWait *owait = new OWait();
Global::statusMessage( tr( "Restarting interface" ) );
owait->show();
qApp->processEvents();
if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
- qWarning("unstable to spawn ifdown/ifup");
+ owarn << "unstable to spawn ifdown/ifup" << oendl;
}
owait->hide();
delete owait;
interface->refresh();
}
return true;
}
/**
* Save the settings for the current Interface.
@@ -148,61 +148,61 @@ void InterfaceSetupImp::setProfile(const QString &profile){
QString newInterfaceName = interface->getInterfaceName();
if(profile.length() > 0)
newInterfaceName += "_" + profile;
// See if we have to make a interface.
if(!interfaces->setInterface(newInterfaceName)){
// Add making for this new interface if need too
if(profile != ""){
interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName);
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;
}
}
interfaces->setMap("map", newInterfaceName);
interfaces->setScript("getprofile.sh");
}
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;
}
}
}
// We must have a valid interface to get this far so read some settings.
// DHCP
bool error = false;
if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)
dhcpCheckBox->setChecked(true);
else
dhcpCheckBox->setChecked(false);
// 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()));
}else firstDNSLineEdit->setText(dns);
ipAddressEdit->setText(interfaces->getInterfaceOption("address", error));
subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error));
if (subnetMaskEdit->text().isEmpty())
subnetMaskEdit->setText( "255.255.255.0" );
gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
- 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;
}
// interfacesetup.cpp
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 1e16b97..3e1a650 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -70,25 +70,25 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi
Interfaces i;
QStringList list = i.getInterfaceList();
QMap<QString, Interface*>::Iterator it;
for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni )
{
/*
* we skipped it in getAllInterfaces now
* we need to ignore it as well
*/
if (m_handledIfaces.contains( *ni) )
{
- qDebug("Not up iface handled by module");
+ odebug << "Not up iface handled by module" << oendl;
continue;
}
bool found = false;
for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
{
if(it.key() == (*ni))
found = true;
}
if(!found)
{
if(!(*ni).contains("_"))
{
@@ -210,25 +210,25 @@ void MainWindowImp::getAllInterfaces()
if((loc = line.find(":")) != -1)
{
ifaces += line.left(loc);
}
}
}
for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
{
int flags = 0;
if ( m_handledIfaces.contains( (*it) ) )
{
- qDebug(" %s is handled by a module", (*it).latin1() );
+ odebug << " " << (*it).latin1() << " is handled by a module" << oendl;
continue;
}
// int family;
i = NULL;
strcpy(ifr.ifr_name, (*it).latin1());
struct ifreq ifcopy;
ifcopy = ifr;
result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
flags = ifcopy.ifr_flags;
i = new Interface(this, ifr.ifr_name, false);
@@ -240,141 +240,141 @@ void MainWindowImp::getAllInterfaces()
if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
i->setHardwareName("Ethernet");
else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
i->setHardwareName("Point to Point");
else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
i->setHardwareName("Multicast");
else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
i->setHardwareName("Loopback");
else
i->setHardwareName("Unknown");
- qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name);
+ owarn << "Adding interface " << ifr.ifr_name << " to interfaceNames\n" << oendl;
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
connect(i, SIGNAL(updateInterface(Interface*)),
this, SLOT(updateInterface(Interface*)));
}
// now lets ask the plugins too ;)
QMap<Module*, QLibrary*>::Iterator it;
QList<Interface> ilist;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
if(it.key())
{
ilist = it.key()->getInterfaces();
for( i = ilist.first(); i != 0; i = ilist.next() )
{
- qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() );
+ owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl;
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
connect(i, SIGNAL(updateInterface(Interface*)),
this, SLOT(updateInterface(Interface*)));
}
}
}
}
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void MainWindowImp::loadModules(const QString &path)
{
#ifdef DEBUG
- qDebug("MainWindowImp::loadModules: %s", path.latin1());
+ odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl;
#endif
QDir d(path);
if(!d.exists())
return;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
#ifdef QWS
if(fi->fileName().contains(".so"))
{
#else
if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_"))
{
#endif
loadPlugin(path + "/" + fi->fileName());
- qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1());
+ odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl;
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
{
#ifdef DEBUG
- qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1());
+ odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl;
#endif
#ifdef QWS
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer )
{
#ifdef DEBUG
- qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1());
+ odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl;
#endif
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL)
{
#ifdef DEBUG
- qDebug("MainWindowImp: Couldn't create object, but did load library!");
+ odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
#endif
delete lib;
return NULL;
}
m_handledIfaces += object->handledInterfaceNames();
// Store for deletion later
libraries.insert(object, lib);
return object;
#else
QLibrary *lib = loader->library(pluginFileName);
if( !lib || !lib->hasSymbol(resolveString) )
{
- qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
+ odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) lib->symbol(resolveString))();
if(object == NULL)
{
#ifdef DEBUG
- qDebug("MainWindowImp: Couldn't create object, but did load library!");
+ odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
#endif
return NULL;
}
#ifdef DEBUG
- qDebug("MainWindowImp::loadPlugin:: Found object, storing.");
+ odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl;
#endif
// Store for deletion later
libraries.insert(object, lib);
return object;
#endif
}
/**
* The Add button was clicked. Bring up the add dialog and if OK is hit
* load the plugin and append it to the list
*/
void MainWindowImp::addClicked()
@@ -402,25 +402,25 @@ void MainWindowImp::addClicked()
{
QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
if(!item)
return;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
if(it.key())
{
Interface *i = (it.key())->addNewInterface(item->text(0));
if(i)
{
- qDebug("iface name %s",i->getInterfaceName().latin1());
+ odebug << "iface name " << i->getInterfaceName().latin1() << "" << oendl;
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
}
}
}
}
}
/**
* Prompt the user to see if they really want to do this.
* If they do then remove from the list and unload.
*/
@@ -504,25 +504,25 @@ void MainWindowImp::informationClicked()
// if(!i->isAttached()){
// QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
// return;
// }
if(i->getModuleOwner())
{
QWidget *moduleInformation = i->getModuleOwner()->information(i);
if(moduleInformation != NULL)
{
QPEApplication::showWidget( moduleInformation );
#ifdef DEBUG
- qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed.");
+ odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl;
#endif
return;
}
}
InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp);
QPEApplication::showWidget( information );
}
/**
* Update this interface. If no QListViewItem exists create one.
* @param Interface* pointer to the interface that needs to be updated.
*/
@@ -641,25 +641,25 @@ void MainWindowImp::removeProfile()
profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
profilesList->clear();
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
// Remove any interface settings and mappings.
Interfaces interfaces;
// Go through them one by one
QMap<Interface*, QListViewItem*>::Iterator it;
for( it = items.begin(); it != items.end(); ++it )
{
QString interfaceName = it.key()->getInterfaceName();
- qDebug(interfaceName.latin1());
+ odebug << interfaceName.latin1() << oendl;
if(interfaces.setInterface(interfaceName + "_" + profileToRemove))
{
interfaces.removeInterface();
if(interfaces.setMapping(interfaceName))
{
if(profilesList->count() == 1)
interfaces.removeMapping();
else
{
interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
}
}
@@ -710,39 +710,39 @@ void MainWindowImp::changeProfile()
void MainWindowImp::makeChannel()
{
channel = new QCopChannel( "QPE/Application/networksettings", this );
connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(receive(const QCString&,const QByteArray&)) );
}
void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
{
bool found = false;
- qDebug("MainWindowImp::receive QCop msg >"+msg+"<");
+ odebug << "MainWindowImp::receive QCop msg >"+msg+"<" << oendl;
if (msg == "raise")
{
raise();
return;
}
QString dest = msg.left(msg.find("("));
QCString param = msg.right(msg.length() - msg.find("(") - 1);
param = param.left( param.length() - 1 );
- qDebug("dest >%s< param >"+param+"<",dest.latin1());
+ odebug << "dest >" << dest.latin1() << "< param >"+param+"<" << oendl;
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
- qDebug("plugin >%s<", it.key()->type().latin1() );
+ odebug << "plugin >" << it.key()->type().latin1() << "<" << oendl;
if(it.key()->type() == dest)
{
it.key()->receive( param, arg );
found = true;
}
}
if (found) QPEApplication::setKeepRunning();
- else qDebug("Huh what do ya want");
+ else odebug << "Huh what do ya want" << oendl;
}
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index b8a1925a..aedc0b9 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -109,25 +109,25 @@ void AccountWidget::edit()
void AccountWidget::create()
{
// if(listListbox->count() == MAX_ACCOUNTS) {
// QMessageBox::information(this, "sorry",
// tr("Maximum number of accounts reached."));
// return;
// }
int result;
if (_pppdata->newaccount() == -1)
{
- qDebug("_pppdata->newaccount() == -1");
+ odebug << "_pppdata->newaccount() == -1" << oendl;
return;
}
result = doTab();
if(result == QDialog::Accepted)
{
listListbox->insertItem(_pppdata->accname());
listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true);
_pppdata->save();
}
else
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp
index fa2b164..f3d842f 100644
--- a/noncore/settings/networksettings/ppp/authwidget.cpp
+++ b/noncore/settings/networksettings/ppp/authwidget.cpp
@@ -133,34 +133,34 @@ bool AuthWidget::check()
void AuthWidget::save()
{
_pppdata->setAuthMethod(auth->currentItem());
if (scriptWidget) scriptWidget->save();
_pppdata->setStoredUsername( userName->text() );
_pppdata->setStorePassword(store_password->isChecked());
if (store_password->isChecked())
_pppdata->setStoredPassword( passWord->text() );
}
void AuthWidget::authChanged( const QString &authStr )
{
- qDebug("AuthWidget::authChanged( %s )", authStr.latin1() );
+ odebug << "AuthWidget::authChanged( " << authStr.latin1() << " )" << oendl;
if ( authStr.contains( tr("Script-based") ) ){
showUsernamePassword( false );
showScriptWindow( true );
} else if ( authStr.contains( tr("PAP") ) ||
authStr.contains( tr("CHAP") ) ){
showUsernamePassword( true );
showScriptWindow( false );
} else {
- qDebug("do not really know how to handle");
+ odebug << "do not really know how to handle" << oendl;
showUsernamePassword( false );
showScriptWindow( false );
}
}
void AuthWidget::showUsernamePassword( bool show )
{
if (show){
user_l->show();
userName->show();
pw_l->show();
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index e3fab24..b75410c 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -463,25 +463,25 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
// execute the script
if(vmain == 2) {
if(!expecting && !pausing && !scanning) {
timeout_timer->stop();
timeout_timer->start(scriptTimeout);
if((unsigned) scriptindex < comlist->count()) {
scriptCommand = *(comlist->at(scriptindex));
scriptArgument = *(arglist->at(scriptindex));
} else {
- qDebug( "End of script" );
+ odebug << "End of script" << oendl;
vmain = 10;
return;
}
if (scriptCommand == "Scan") {
QString bm = QObject::tr("Scanning %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
setScan(scriptArgument);
scriptindex++;
return;
@@ -829,35 +829,35 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
// Close the tty. This prevents the QTimer::singleShot() in
// Modem::readtty() from re-enabling the socket notifier.
// The port is still held open by the helper process.
/* Er, there _is_ not QTimer::singleShot() in Modem::readtty(),
and closing the thing prevents pppd from using it later. */
//_ifaceppp->modem()->closetty();
killTimer( main_timer_ID );
if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000);
- qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000);
+ odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl;
// find out PPP interface and notify the stats module
// stats->setUnit(pppInterfaceNumber());
qApp->flushX();
semaphore = true;
result = execppp();
emit debugMessage(QObject::tr("Starting pppd..."));
- qDebug("execppp() returned with return-code %i", result );
+ odebug << "execppp() returned with return-code " << result << "" << oendl;
if(result) {
if(!_ifaceppp->data()->autoDNS())
adddns( _ifaceppp );
// O.K we are done here, let's change over to the if_waiting loop
// where we wait for the ppp if (interface) to come up.
emit if_waiting_signal();
} else {
// starting pppd wasn't successful. Error messages were
@@ -1055,25 +1055,25 @@ void ConnectWidget::setExpect(const QString &n) {
QString ts = QObject::tr("Expecting: %1").arg(n);
ts.replace(QRegExp("\n"), "<LF>");
emit debugMessage(ts);
// check if the expected string is in the read buffer already.
checkBuffers();
}
void ConnectWidget::if_waiting_timed_out() {
if_timer->stop();
if_timeout_timer->stop();
- qDebug("if_waiting_timed_out()");
+ odebug << "if_waiting_timed_out()" << oendl;
_ifaceppp->data()->setpppdError(E_IF_TIMEOUT);
// let's kill the stuck pppd
_ifaceppp->modem()->killPPPDaemon();
emit stopAccounting();
// p_kppp->con_win->stopClock();
// killing ppp will generate a SIGCHLD which will be caught in pppdie()
// in main.cpp what happens next will depend on the boolean
@@ -1262,25 +1262,25 @@ bool ConnectWidget::execppp() {
command += " call opie-kppp logfd 11";
if (command.length() > MAX_CMDLEN) {
QMessageBox::critical(this, "error", QObject::tr(
"pppd command + command-line arguments exceed "
"2024 characters in length."
));
return false; // nonsensically long command which would bust my buffer buf.
}
- qWarning("Command IS: %s",command.latin1() );
+ owarn << "Command IS: " << command.latin1() << "" << oendl;
qApp->flushX();
return _ifaceppp->modem()->execPPPDaemon(command);
}
void ConnectWidget::closeEvent( QCloseEvent *e ) {
e->ignore();
emit cancelbutton();
}
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp
index 9da090d..350ff32 100644
--- a/noncore/settings/networksettings/ppp/devices.cpp
+++ b/noncore/settings/networksettings/ppp/devices.cpp
@@ -63,29 +63,29 @@ DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *nam
tr("Makes a copy of the selected device. All\n"
"settings of the selected device are copied\n"
"to a new device, that you can modify to fit your\n"
"needs"));
QWhatsThis::add(delete_b,
tr("<p>Deletes the selected device\n\n"
"<font color=\"red\"><b>Use with care!</b></font>"));
copy_b->setEnabled( false ); //FIXME
// delete_b->setEnabled( false ); //FIXME
QStringList tmp = _pppdata->getDevicesNamesList();
- qDebug("DevicesWidget::DevicesWidget got devices %s",tmp.join("--").latin1());
+ odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl;
listListbox->insertStringList(tmp);
for (uint i = 0; i < listListbox->count(); i++){
- qDebug("listListbox->text(i) %s == _pppdata->devname() %s",listListbox->text(i).latin1(), _pppdata->devname().latin1());
+ odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl;
if ( listListbox->text(i) == _pppdata->devname() )
listListbox->setCurrentItem( i );
}
}
void DevicesWidget::slotListBoxSelect(int idx) {
bool ok = _pppdata->setDevice( listListbox->text(idx) );
delete_b->setEnabled((bool)(idx != -1));
edit_b->setEnabled((bool)(idx != -1));
//FIXME copy_b->setEnabled((bool)(idx != -1));
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index 81dab38..69bb682 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -326,25 +326,25 @@ ModemWidget::~ModemWidget()
// _pppdata->setModemTimeout(n);
// }
bool ModemWidget::save()
{
//first check to make sure that the device name is unique!
if(modemname->text().isEmpty() ||
!_pppdata->isUniqueDevname(modemname->text()))
return false;
- qDebug("ModemWidget::save saving modem1 data");
+ odebug << "ModemWidget::save saving modem1 data" << oendl;
_pppdata->setDevname( modemname->text() );
_pppdata->setModemDevice( modemdevice->currentText() );
_pppdata->setFlowcontrol(flowcontrol->currentText());
_pppdata->setFlowcontrol(flowcontrol->currentText());
_pppdata->setSpeed(baud_c->currentText());
_pppdata->setModemLockFile( modemlockfile->isChecked());
_pppdata->setModemTimeout( modemtimeout->value() );
return true;
}
ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent,
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
index 6b158b9..5a76293 100644
--- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
@@ -11,25 +11,25 @@
#ifdef QWS
#else
#define showMaximized show
#endif
/**
* Constructor for the InterfaceInformationImp class. This class pretty much
* just display's information about the interface that is passed to it.
*/
InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f)
:InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp)
{
- qDebug("InterfaceInformationPPP::InterfaceInformationPPP %s", name);
+ odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl;
con = new ConnectWidget( (InterfacePPP*)i, this, "con" );
con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Fixed) );
macAddressLabel->hide();
subnetMaskLabel->hide();
broadcastLabel->hide();
TextLabel23->hide();
TextLabel21->hide();
TextLabel24->hide();
InterfaceInformationLayout->addWidget( con, 1, 0 );
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
index f443f3c..5cc6f70 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -5,64 +5,64 @@
#include <qlabel.h>
#include "auth.h"
#include "interfaceppp.h"
#include "modem.h"
#include "pppdata.h"
InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
: Interface(parent, name, status),
_modemPtr(0),
_dataPtr(0)
{
- qDebug("InterfacePPP::InterfacePPP(");
+ odebug << "InterfacePPP::InterfacePPP(" << oendl;
}
PPPData* InterfacePPP::data()const
{
if (!_dataPtr){
- qDebug("creating new Data obj");
+ odebug << "creating new Data obj" << oendl;
_dataPtr = new PPPData();
_dataPtr->setDevice( getInterfaceName() );
_dataPtr->setAccount( getHardwareName() );
}
return _dataPtr;
}
Modem* InterfacePPP::modem()const
{
if (!_modemPtr){
- qDebug("creating new modem obj");
+ odebug << "creating new modem obj" << oendl;
_modemPtr = new Modem( data() );
}
return _modemPtr;
}
bool InterfacePPP::refresh()
{
- qDebug("InterfacePPP::refresh()");
+ odebug << "InterfacePPP::refresh()" << oendl;
QString old = getInterfaceName();
setInterfaceName( modem()->pppDevice() );
(void)Interface::refresh();
setInterfaceName( old );
emit updateInterface(this);
return true;
}
void InterfacePPP::start()
{
- qDebug("InterfacePPP::start");
+ odebug << "InterfacePPP::start" << oendl;
if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) {
QDialog mb( 0, "Dialog", true );
mb.setCaption( tr( "No password" ) );
QVBoxLayout layout( &mb );
QLabel text ( &mb );
text.setText( tr("Username defined but no password\n Please enter a password") );
QLineEdit lineedit( &mb );
lineedit.setEchoMode( QLineEdit::Password );
layout.addWidget( &text );
layout.addWidget( &lineedit );
@@ -134,30 +134,30 @@ void InterfacePPP::start()
if (data()->phonenumber().isEmpty()) {
QString s = QObject::tr("You must specify a telephone number!");
QMessageBox::warning(0, tr("Error"), s);
return;
}
// SEGFAULTS:
// setStatus( true );
// emit updateInterface((Interface*) this);
emit begin_connect();
- qDebug("InterfacePPP::start END");
+ odebug << "InterfacePPP::start END" << oendl;
}
void InterfacePPP::stop()
{
- qDebug("InterfacePPP::stop");
+ odebug << "InterfacePPP::stop" << oendl;
// emit hangup_now();
status = false; // not connected
setStatus( false );
emit hangup_now();
refresh();
}
void InterfacePPP::save()
{
data()->save();
emit updateInterface((Interface*) this);
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index e21bbc7..fd09332 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -65,31 +65,31 @@
#define execute_command system
KPPPWidget *p_kppp = 0;
KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl )
: QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd)
{
// tabWindow = 0;
p_kppp = this;
// before doing anything else, run a few tests
if (!_pppdata->setModemDevice( i->getInterfaceName() ))
_pppdata->setModemDevice("/dev/modem");
- qDebug("PPPConfigWidget::PPPConfigWidget");
- qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1());
+ odebug << "PPPConfigWidget::PPPConfigWidget" << oendl;
+ odebug << " interface->getHardwareName >" << i->getHardwareName().latin1() << "<" << oendl;
if (!_pppdata->setAccount( i->getHardwareName() ))
_pppdata->setAccount( 0 );
- qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1());
- qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID());
+ odebug << " _pppdata->accname >" << _pppdata->accname().latin1() << "<" << oendl;
+ odebug << " _pppdata->currentAccountID() >" << _pppdata->currentAccountID() << "<" << oendl;
int result = runTests();
if(result == TEST_CRITICAL)
exit(4);
// installEventFilter(this);
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
QGridLayout *l1 = new QGridLayout(3, 4);
tl->addLayout(l1);
l1->addColSpacing(0, 10);
@@ -296,25 +296,25 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
}
KPPPWidget::~KPPPWidget()
{
p_kppp = 0;
// delete stats;
}
// bool KPPPWidget::eventFilter(QObject *o, QEvent *e) {
// if(e->type() == QEvent::User) {
// switch(((SignalEvent*)e)->sigType()) {
// case SIGINT:
-// qDebug( "Received a SIGINT" );
+// odebug << "Received a SIGINT" << oendl;
// interruptConnection();
// break;
// case SIGCHLD:
// sigChld();
// break;
// case SIGUSR1:
// sigPPPDDied();
// break;
// }
// return true;
// }
@@ -414,44 +414,44 @@ void KPPPWidget::interruptConnection() {
//
if (con->isVisible())
emit con->cancelbutton();
// disconnect if online
if (_pppdata->pppdRunning())
emit disconnect();
}
void KPPPWidget::sigPPPDDied() {
- qDebug( "Received a SIGUSR1" );
+ odebug << "Received a SIGUSR1" << oendl;
// if we are not connected pppdpid is -1 so have have to check for that
// in the followin line to make sure that we don't raise a false alarm
// such as would be the case when the log file viewer exits.
if(_pppdata->pppdRunning() || _pppdata->pppdError()) {
- qDebug( "It was pppd that died" );
+ odebug << "It was pppd that died" << oendl;
// when we killpppd() on Cancel in ConnectWidget
// we set pppid to -1 so we won't
// enter this block
// just to be sure
Modem::modem->removeSecret(AUTH_PAP);
Modem::modem->removeSecret(AUTH_CHAP);
_pppdata->setpppdRunning(false);
- qDebug( "Executing command on disconnect since pppd has died." );
+ odebug << "Executing command on disconnect since pppd has died." << oendl;
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
// stopAccounting();
con_win->stopClock();
// DockWidget::dock_widget->stop_stats();
// DockWidget::dock_widget->hide();
if(!_pppdata->pppdError())
_pppdata->setpppdError(E_PPPD_DIED);
removedns();
@@ -480,47 +480,47 @@ void KPPPWidget::sigPPPDDied() {
msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus);
msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error "
"codes or take a look at the kppp FAQ on "
" <a href=http://devel-home.kde.org/~kppp/index.html>"
"http://devel-home.kde.org/~kppp/index.html</a></p>");
}
}
// if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No)
// // PPPL_ShowLog();
// } else { /* reconnect on disconnect */
if (false){
- qDebug( "Trying to reconnect... " );
+ odebug << "Trying to reconnect... " << oendl;
if(_pppdata->authMethod() == AUTH_PAP ||
_pppdata->authMethod() == AUTH_CHAP ||
_pppdata->authMethod() == AUTH_PAPCHAP)
Modem::modem->setSecret(_pppdata->authMethod(),
encodeWord(_pppdata->storedUsername()),
encodeWord(_pppdata->password()));
con_win->hide();
con_win->stopClock();
// stopAccounting();
_pppdata->setpppdRunning(false);
// not in a signal handler !!! KNotifyClient::beep();
emit cmdl_start();
}
}
_pppdata->setpppdError(0);
}
}
// void KPPPWidget::sigChld() {
-// qDebug( "sigchld()" );
+// odebug << "sigchld()" << oendl;
// // pid_t id = wait(0L);
// // if(id == helperPid && helperPid != -1) {
// // kdDebug(5002) << "It was the setuid child that died" << endl;
// // helperPid = -1;
// QString msg = QObject::tr("kppp's helper process just died.\n"
// "Since a further execution would be pointless, "
// "kppp will shut down now.");
// QMessageBox::warning(0L,"error", msg);
// //remove_pidfile();
// exit(1);
// // }
// }
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index 3dbc8c3..f3f2639 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -46,25 +46,25 @@
#ifndef _PATH_RESCONF
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
#define strlcpy strcpy
#include "auth.h"
#include "modem.h"
#include "pppdata.h"
#define qError qDebug
#define MY_ASSERT(x) if (!(x)) { \
- qFatal( "ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__); \
+ ofatal << "ASSERT: \"" << #x << "\" in " << __FILE__ << " (" << __LINE__ << ")\n" << oendl; \
exit(1); }
static sigjmp_buf jmp_buffer;
//Modem *Modem::modem = 0;
const char* pppdPath() {
// wasting a few bytes
static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)];
static char *pppdPath = 0L;
@@ -156,25 +156,25 @@ speed_t Modem::modemspeed() {
return B38400;
break;
}
}
bool Modem::opentty() {
// int flags;
//begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
close(modemfd);
device = _pppdata->modemDevice();
if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) {
- qDebug("error opening modem device !");
+ odebug << "error opening modem device !" << oendl;
errmsg = QObject::tr("Unable to open modem.");
return false;
}
//bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
//}
#if 0
if(_pppdata->UseCDLine()) {
if(ioctl(modemfd, TIOCMGET, &flags) == -1) {
errmsg = QObject::tr("Unable to detect state of CD line.");
::close(modemfd);
modemfd = -1;
@@ -297,56 +297,56 @@ void Modem::notify(const QObject *receiver, const char *member) {
void Modem::stop() {
disconnect(SIGNAL(charWaiting(unsigned char)));
stopNotifier();
}
void Modem::startNotifier() {
if(modemfd >= 0) {
if(sn == 0) {
sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, this);
connect(sn, SIGNAL(activated(int)), SLOT(readtty(int)));
- qDebug("QSocketNotifier started!");
+ odebug << "QSocketNotifier started!" << oendl;
} else {
- qDebug("QSocketNotifier re-enabled!");
+ odebug << "QSocketNotifier re-enabled!" << oendl;
sn->setEnabled(true);
}
}
}
void Modem::stopNotifier() {
if(sn != 0) {
sn->setEnabled(false);
disconnect(sn);
delete sn;
sn = 0;
- qDebug( "QSocketNotifier stopped!" );
+ odebug << "QSocketNotifier stopped!" << oendl;
}
}
void Modem::flush() {
char c;
while(read(modemfd, &c, 1) == 1);
}
bool Modem::writeChar(unsigned char c) {
int s;
do {
s = write(modemfd, &c, 1);
if (s < 0) {
- qError( "write() in Modem::writeChar failed" );
+ oerr << "write() in Modem::writeChar failed" << oendl;
return false;
}
} while(s == 0);
return true;
}
bool Modem::writeLine(const char *buf) {
int len = strlen(buf);
char *b = new char[len+2];
memcpy(b, buf, len);
@@ -356,25 +356,25 @@ bool Modem::writeLine(const char *buf) {
b[len++]='\n';
else if(term == "CR")
b[len++]='\r';
else if(term == "CR/LF") {
b[len++]='\r';
b[len++]='\n';
}
int l = len;
while(l) {
int wr = write(modemfd, &b[len-l], l);
if(wr < 0) {
// TODO do something meaningful with the error code (or ignore it
- qError( "write() in Modem::writeLine failed" );
+ oerr << "write() in Modem::writeLine failed" << oendl;
delete[] b;
return false;
}
l -= wr;
}
delete[] b;
return true;
}
bool Modem::hangup() {
// this should really get the modem to hang up and go into command mode
@@ -465,25 +465,25 @@ void Modem::escape_to_command_mode() {
const QString Modem::modemMessage() {
return errmsg;
}
QString Modem::parseModemSpeed(const QString &s) {
// this is a small (and bad) parser for modem speeds
int rx = -1;
int tx = -1;
int i;
QString result;
- qDebug( "Modem reported result string: %s", s.latin1());
+ odebug << "Modem reported result string: " << s.latin1() << "" << oendl;
const int RXMAX = 7;
const int TXMAX = 2;
QRegExp rrx[RXMAX] = {
QRegExp("[0-9]+[:/ ]RX", false),
QRegExp("[0-9]+RX", false),
QRegExp("[/: -][0-9]+[/: ]", false),
QRegExp("[/: -][0-9]+$", false),
QRegExp("CARRIER [^0-9]*[0-9]+", false),
QRegExp("CONNECT [^0-9]*[0-9]+", false),
QRegExp("[0-9]+") // panic mode
};
@@ -551,131 +551,131 @@ QString Modem::parseModemSpeed(const QString &s) {
}
}
if(rx == -1 && tx == -1)
result = QObject::tr("Unknown speed");
else if(tx == -1)
result.setNum(rx);
else if(rx == -1) // should not happen
result.setNum(tx);
else
result.sprintf("%d/%d", rx, tx);
- qDebug( "The parsed result is: %s", result.latin1());
+ odebug << "The parsed result is: " << result.latin1() << "" << oendl;
return result;
}
// Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if
// a lock file can't be created ( permission problem )
int Modem::lockdevice() {
int fd;
char newlock[80]=""; // safe
if(!_pppdata->modemLockFile()) {
- qDebug("The user doesn't want a lockfile.");
+ odebug << "The user doesn't want a lockfile." << oendl;
return 0;
}
if (modem_is_locked)
return 1;
QString lockfile = LOCK_DIR"/LCK..";
lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/
if(access(QFile::encodeName(lockfile), F_OK) == 0) {
// if ((fd = Requester::rq->
if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) {
// Mario: it's not necessary to read more than lets say 32 bytes. If
// file has more than 32 bytes, skip the rest
char oldlock[33]; // safe
int sz = read(fd, &oldlock, 32);
close (fd);
if (sz <= 0)
return 1;
oldlock[sz] = '\0';
- qDebug( "Device is locked by: %s", oldlock);
+ odebug << "Device is locked by: " << oldlock << "" << oendl;
int oldpid;
int match = sscanf(oldlock, "%d", &oldpid);
// found a pid in lockfile ?
if (match < 1 || oldpid <= 0)
return 1;
// check if process exists
if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH)
return 1;
- qDebug( "lockfile is stale" );
+ odebug << "lockfile is stale" << oendl;
}
}
fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT);
if(fd >= 0) {
sprintf(newlock,"%010d\n", getpid());
- qDebug("Locking Device: %s", newlock);
+ odebug << "Locking Device: " << newlock << "" << oendl;
write(fd, newlock, strlen(newlock));
close(fd);
modem_is_locked=true;
return 0;
}
return -1;
}
// UnLock modem device
void Modem::unlockdevice() {
if (modem_is_locked) {
- qDebug( "UnLocking Modem Device" );
+ odebug << "UnLocking Modem Device" << oendl;
close(modemfd);
modemfd = -1;
unlink(lockfile);
lockfile[0] = '\0';
modem_is_locked=false;
}
}
int Modem::openLockfile( QString lockfile, int flags)
{
int fd;
int mode;
flags = O_RDONLY;
if(flags == O_WRONLY|O_TRUNC|O_CREAT)
mode = 0644;
else
mode = 0;
lockfile = LOCK_DIR;
lockfile += "/LCK..";
lockfile += device.right( device.length() - device.findRev("/") -1 );
- qDebug("lockfile >%s<",lockfile.latin1());
+ odebug << "lockfile >" << lockfile.latin1() << "<" << oendl;
// TODO:
// struct stat st;
// if(stat(lockfile.data(), &st) == -1) {
// if(errno == EBADF)
// return -1;
// } else {
// // make sure that this is a regular file
// if(!S_ISREG(st.st_mode))
// return -1;
// }
if ((fd = open(lockfile, flags, mode)) == -1) {
- qDebug("error opening lockfile!");
+ odebug << "error opening lockfile!" << oendl;
lockfile = QString::null;
fd = open(DEVNULL, O_RDONLY);
} else
fchown(fd, 0, 0);
return fd;
}
void alarm_handler(int) {
// fprintf(stderr, "alarm_handler(): Received SIGALRM\n");
@@ -918,60 +918,60 @@ bool Modem::execpppd(const char *arguments) {
fprintf(stderr, "Kernel does not support ppp, oops.\n");
break;
case 0:
fprintf(stderr, "Kernel supports ppp alright.\n");
break;
}
execve(pppdPath(), args, 0L);
_exit(0);
break;
default:
- qDebug("In parent: pppd pid %d\n",pppdPid);
+ odebug << "In parent: pppd pid " << pppdPid << "\n" << oendl;
close(modemfd);
::close( m_pppdLOG[1] );
// set it to nonblocking io
int flag = ::fcntl( m_pppdLOG[0], F_GETFL );
if ( !(flag & O_NONBLOCK) ) {
- qDebug("Setting nonblocking io");
+ odebug << "Setting nonblocking io" << oendl;
flag |= O_NONBLOCK;
::fcntl(m_pppdLOG[0], F_SETFL, flag );
}
delete m_modemDebug;
m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this );
connect(m_modemDebug, SIGNAL(activated(int) ),
this, SLOT(slotModemDebug(int) ) );
modemfd = -1;
m_pppdDev = QString::fromLatin1("ppp0");
return true;
break;
}
}
bool Modem::killpppd() {
- qDebug("In killpppd and pid is %d", pppdPid );
+ odebug << "In killpppd and pid is " << pppdPid << "" << oendl;
if(pppdPid > 0) {
delete m_modemDebug;
m_modemDebug = 0;
- qDebug("In killpppd(): Sending SIGTERM to %d\n", pppdPid);
+ odebug << "In killpppd(): Sending SIGTERM to " << pppdPid << "\n" << oendl;
if(kill(pppdPid, SIGTERM) < 0) {
- qDebug("Error terminating %d. Sending SIGKILL\n", pppdPid);
+ odebug << "Error terminating " << pppdPid << ". Sending SIGKILL\n" << oendl;
if(kill(pppdPid, SIGKILL) < 0) {
- qDebug("Error killing %d\n", pppdPid);
+ odebug << "Error killing " << pppdPid << "\n" << oendl;
return false;
}
}
}
return true;
}
void Modem::parseargs(char* buf, char** args) {
int nargs = 0;
int quotes;
@@ -1026,46 +1026,46 @@ void Modem::killPPPDaemon()
killpppd();
}
int Modem::pppdExitStatus()
{
return _pppdExitStatus;
}
int Modem::openResolv(int flags)
{
int fd;
if ((fd = open(_PATH_RESCONF, flags)) == -1) {
- qDebug("error opening resolv.conf!");
+ odebug << "error opening resolv.conf!" << oendl;
fd = open(DEVNULL, O_RDONLY);
}
return fd;
}
bool Modem::setHostname(const QString & name)
{
return sethostname(name, name.length()) == 0;
}
QString Modem::pppDevice()const {
return m_pppdDev;
}
void Modem::setPPPDevice( const QString& dev ) {
m_pppdDev = dev;
}
pid_t Modem::pppPID()const {
return pppdPid;
}
void Modem::setPPPDPid( pid_t pid ) {
- qDebug("Modem setting pid");
+ odebug << "Modem setting pid" << oendl;
_pppdExitStatus = -1;
pppdPid = pid;
modemfd = -1;
}
void Modem::slotModemDebug(int fd) {
char buf[2049];
int len;
// read in pppd data look for Using interface
// then read the interface
// we limit to 10 device now 0-9
if((len = ::read(fd, buf, 2048)) > 0) {
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index 97baf31..a8c99fd 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -16,28 +16,28 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
const char *name,
bool modal, WFlags fl )
: QDialog(parent, name, modal, fl)
{
setCaption(tr("Configure Modem"));
int result = runTests();
if(result == TEST_CRITICAL){
QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") );
return;
}
interface = iface;
- qDebug("PPPConfigWidget::PPPConfigWidget");
- qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
+ odebug << "PPPConfigWidget::PPPConfigWidget" << oendl;
+ odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl;
- qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
+ odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl;
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setSpacing( 0 );
layout->setMargin( 1 );
tabWindow = new QTabWidget( this, "tabWidget" );
layout->addWidget( tabWindow );
accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp );
tabWindow->addTab( accounts, tr("&Accounts") );
devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp );
tabWindow->addTab( devices, tr("&Devices") );
@@ -49,27 +49,27 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
// tabWindow->addTab( modem2, tr("&Modem") );
}
PPPConfigWidget::~PPPConfigWidget()
{
}
void PPPConfigWidget::accept()
{
- qDebug("PPPConfigWidget::accept");
- qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
- qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
+ odebug << "PPPConfigWidget::accept" << oendl;
+ odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl;
+ odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl;
interface->setInterfaceName( interface->data()->devname() );
interface->setHardwareName( interface->data()->accname() );
interface->save();
QDialog::accept();
}
void PPPConfigWidget::reject()
{
interface->data()->cancel();
QDialog::reject();
}
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index f4727c1..567ccf8 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -47,26 +47,26 @@ PPPData::PPPData()
highcountdev(-1), // start out with no entries
// caccount(-1), // set the current account index also
suidprocessid(-1), // process ID of setuid child
pppdisrunning(false),
pppderror(0)
{
highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1;
Config cfg = config();
cfg.setGroup(GENERAL_GRP);
accountList = cfg.readListEntry(ACCOUNT_LIST, ',' );
deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' );
- qDebug("PPPData::PPPData has a accountList %s", accountList.join("---").latin1());
- qDebug("PPPData::PPPData has a deviceList %s", deviceList.join("---").latin1());
+ odebug << "PPPData::PPPData has a accountList " << accountList.join("---").latin1() << "" << oendl;
+ odebug << "PPPData::PPPData has a deviceList " << deviceList.join("---").latin1() << "" << oendl;
// if (highcount > MAX_ACCOUNTS)
// highcount = MAX_ACCOUNTS;
// if(highcount >= 0 && defaultAccount().isEmpty()) {
// setAccountbyIndex(0);
// setDefaultAccount(accname());
// } else if(!setAccount(defaultAccount()))
setDefaultAccount(accname());
// start out with internal debugging disabled
// the user is still free to specify `debug' on his own
@@ -77,81 +77,81 @@ PPPData::PPPData()
}
Config PPPData::config()
{
return Config("NetworkSetupPPP");
}
//
// save configuration
//
void PPPData::save()
{
- qDebug("PPPData saving data");
+ odebug << "PPPData saving data" << oendl;
writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1);
QString key;
QStringList keys;
Config cfg = config();
cfg.setGroup(GENERAL_GRP);
cfg.writeEntry(ACCOUNT_LIST, accountList, ',' );
cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' );
for( QMap<QString,QString>::Iterator it = stringEntries.begin();
it != stringEntries.end(); ++it ){
QString val = it.data();
key = it.key();
-// qDebug("saving %s -> %s", key.latin1(), val.latin1() );
+// odebug << "saving " << key.latin1() << " -> " << val.latin1() << "" << oendl;
keys = QStringList::split( "SEPARATOR", key );
- //qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
+ //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl;
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val);
}
for( QMap<QString,int>::Iterator it = intEntries.begin();
it != intEntries.end(); ++it ){
int val = it.data();
key = it.key();
-// qDebug("saving %s -> %i", key.latin1(), val );
+// odebug << "saving " << key.latin1() << " -> " << val << "" << oendl;
keys = QStringList::split( "SEPARATOR", key );
- //qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val );
+ //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< val " << val << "" << oendl;
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val);
}
for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
it != listEntries.end(); ++it ){
QStringList val = it.data();
key = it.key();
QChar sep = sepEntries[key];
-// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() );
+// odebug << "saving " << key.latin1() << " -> " << val.join(sep).latin1() << "" << oendl;
keys = QStringList::split( "SEPARATOR", key );
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val, sep);
}
}
//
// cancel changes
//
void PPPData::cancel() {
stringEntries.clear();
intEntries.clear();
listEntries.clear();
}
// functions to read/write date to configuration file
QString PPPData::readConfig(const QString &group, const QString &key,
const QString &defvalue = "")
{
-// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
+// odebug << "PPPData::readConfig key >" << key.latin1() << "< group >" << group.latin1() << "<" << oendl;
QString idx = SEP.arg(group).arg(key);
if (stringEntries.find(idx) != stringEntries.end())
return stringEntries[idx];
Config cfg = config();
cfg.setGroup(group);
return cfg.readEntry(key, defvalue);
}
int PPPData::readNumConfig(const QString &group, const QString &key,
int defvalue)
{
@@ -356,39 +356,39 @@ void PPPData::setpppdTimeout(int n) {
const QString PPPData::modemDevice() {
return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" );
}
// const QString PPPData::modemName()
// {
// return readConfig(modemGroup(), MODEMNAME_KEY);
// }
// bool PPPData::setModemName(const QString &n) {
-// qDebug("Setting modem name to >%s<", n.latin1());
+// odebug << "Setting modem name to >" << n.latin1() << "<" << oendl;
// _modemName = n;
// writeConfig(cgroup, MODEMNAME_KEY, n);
// return true; //FIXME
// }
// bool PPPData::changeModemName(const QString &n) {
-// qDebug("Setting modem name to >%s<", n.latin1());
+// odebug << "Setting modem name to >" << n.latin1() << "<" << oendl;
// _modemName = n;
// writeConfig(modemGroup(), MODEMNAME_KEY, n);
// return true; //FIXME
// }
bool PPPData::setModemDevice(const QString &n) {
- qDebug("Setting modem dev to >%s<", n.latin1());
+ odebug << "Setting modem dev to >" << n.latin1() << "<" << oendl;
writeConfig(modemGroup(), MODEMDEV_KEY, n);
return true; //FIXME
}
const QString PPPData::flowcontrol() {
return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS");
}
void PPPData::setFlowcontrol(const QString &n) {
writeConfig(modemGroup(), FLOWCONTROL_KEY, n);
@@ -730,80 +730,80 @@ void PPPData::setEnter(const QString &n) {
//
// functions to set/return account information
//
//returns number of accounts
int PPPData::count() const {
return highcount + 1;
}
bool PPPData::setAccount(const QString &aname) {
- qDebug("setting account to >%s<", aname.latin1());
+ odebug << "setting account to >" << aname.latin1() << "<" << oendl;
for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
cgroup = *it;
- qDebug("PPPData::setAccount %s", cgroup.latin1());
- qDebug( "iterator %s", (*it).latin1() );
+ odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl;
+ odebug << "iterator " << (*it).latin1() << "" << oendl;
if(accname() == aname) {
- qDebug("SUCCESS");
+ odebug << "SUCCESS" << oendl;
return true;
}
}
- qDebug("FAILURE");
+ odebug << "FAILURE" << oendl;
return false;
}
/*
bool PPPData::setAccountbyIndex(int i) {
if(i >= 0 && i <= highcount) {
QString tmp;
tmp.sprintf("%s%i", ACCOUNT_GRP, i);
if (_deleted.find(tmp)!=_deleted.end()) return false;
caccount = i;
cgroup = tmp;
return true;
}
return false;
}
*/
bool PPPData::isUniqueAccname(const QString &n) {
QString save_cgroup = cgroup;
for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
cgroup = *it;
- qDebug("PPPData::setAccount %s", cgroup.latin1());
- qDebug( "%s \n", (*it).latin1() );
+ odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl;
+ odebug << "" << (*it).latin1() << " \n" << oendl;
if(accname() == n && cgroup != save_cgroup) {
cgroup = save_cgroup;
- qDebug("SUCCESS");
+ odebug << "SUCCESS" << oendl;
return false;
}
}
cgroup = save_cgroup;
return true;
}
bool PPPData::isUniqueDevname(const QString &n) {
QString save_mName = _modemName;
- qDebug("PPPData::isUniqueDevname checking if %s is unique", n.latin1());
+ odebug << "PPPData::isUniqueDevname checking if " << n.latin1() << " is unique" << oendl;
for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
_modemName = *it;
- qDebug("PPPData::isUniqueDevname %s == %s", n.latin1() , devname().latin1());
+ odebug << "PPPData::isUniqueDevname " << n.latin1() << " == " << devname().latin1() << "" << oendl;
if(devname() == n && _modemName != save_mName) {
_modemName = save_mName;
- qDebug("NOT UNIQUE");
+ odebug << "NOT UNIQUE" << oendl;
return false;
}
}
_modemName = save_mName;
return true;
}
bool PPPData::deleteAccount() {
// FIXME: check if this account exists in a config...
Config cfg = PPPData::config();
@@ -811,74 +811,74 @@ bool PPPData::deleteAccount() {
cfg.clearGroup();
accountList.remove(cgroup);
QString key;
QStringList keys;
for( QMap<QString,QString>::Iterator it = stringEntries.begin();
it != stringEntries.end(); ++it ){
QString val = it.data();
key = it.key();
keys = QStringList::split( "SEPARATOR", key );
if(keys[0]==cgroup){
stringEntries.remove( it );
- qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
+ odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl;
}
}
for( QMap<QString,int>::Iterator it = intEntries.begin();
it != intEntries.end(); ++it ){
int val = it.data();
key = it.key();
keys = QStringList::split( "SEPARATOR", key );
if(keys[0]==cgroup){
intEntries.remove( it );
- qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val );
+ odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl;
}
}
for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
it != listEntries.end(); ++it ){
QStringList val = it.data();
key = it.key();
if(keys[0]==cgroup){
listEntries.remove( it );
sepEntries.remove( key );
- qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() );
+ odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl;
}
}
return true;
}
bool PPPData::deleteAccount(const QString &aname) {
if(!setAccount(aname))
return false;
deleteAccount();
return true;
}
int PPPData::newaccount() {
- qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS);
+ odebug << "PPPData::newaccount highcount " << highcount << "/" << MAX_ACCOUNTS << "" << oendl;
// if(!config) open();
// if (highcount >= MAX_ACCOUNTS) return -1;
QString tmp;
tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount);
cgroup = QString(tmp);
accountList << tmp;
- qDebug("PPPData::newaccount() Group: >%s<",cgroup.latin1());
+ odebug << "PPPData::newaccount() Group: >" << cgroup.latin1() << "<" << oendl;
setpppdArgumentDefaults();
return highcount;
}
int PPPData::copyaccount(const QString&) {
// FIXME: PPPData::copyaccount
// if(highcount >= MAX_ACCOUNTS)
return -1;
// setAccountbyIndex(i);
// QMap <QString, QString> map = config->entryMap(cgroup);
@@ -956,27 +956,27 @@ void PPPData::setAuthMethod(int value) {
const QString PPPData::storedUsername() {
return readConfig(cgroup, STORED_USERNAME_KEY, "");
}
void PPPData::setStoredUsername(const QString &b) {
writeConfig(cgroup, STORED_USERNAME_KEY, b);
}
const QString PPPData::storedPassword() {
- qDebug("getting stored pw");
- qDebug("g %s", cgroup.latin1() );
- qDebug("k %s", STORED_PASSWORD_KEY);
+ odebug << "getting stored pw" << oendl;
+ odebug << "g " << cgroup.latin1() << "" << oendl;
+ odebug << "k " << STORED_PASSWORD_KEY << "" << oendl;
return readConfig(cgroup, STORED_PASSWORD_KEY, "");
}
void PPPData::setStoredPassword(const QString &b) {
writeConfig(cgroup, STORED_PASSWORD_KEY, b);
}
bool PPPData::storePassword() {
return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1);
}
@@ -1320,28 +1320,28 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces()
return ifaces;
}
void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
{
QMap<QString,QString>::Iterator it;
int i = 0;
Config cfg = config();
for( it = ifaces.begin(); it != ifaces.end(); ++it ){
cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++));
cfg.writeEntry( ACOUNTS_DEV, it.key() );
cfg.writeEntry( ACOUNTS_ACC, it.data() );
- qDebug("I %i",i);
+ odebug << "I " << i << "" << oendl;
}
cfg.setGroup( ACCLIST_GRP );
- qDebug("saved %i account settings", i);
+ odebug << "saved " << i << " account settings" << oendl;
cfg.writeEntry( ACCOUNTS_COUNT, i );
}
/**
* pppd's getword() function knows about escape characters.
* If we write the username and password to the secrets file
* we'll therefore have to escape back slashes.
*/
QString PPPData::encodeWord(const QString &s) {
QString r = s;
r.replace(QRegExp("\\"), "\\\\");
@@ -1363,133 +1363,133 @@ QStringList PPPData::getAccountList()
for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
cgroup = *it;
list << accname();
}
cgroup = save_cgroup;
return list;
};
const QString PPPData::devname()
{
QString tmp = readConfig(modemGroup(), MODEMNAME_KEY );
- qDebug("PPPData::devname() of %s is %s", modemGroup().latin1(), tmp.latin1());
+ odebug << "PPPData::devname() of " << modemGroup().latin1() << " is " << tmp.latin1() << "" << oendl;
return tmp;
}
void PPPData::setDevname(const QString &n) {
// if(!cgroup.isNull()) {
// // are we manipulating the default account's name ? then change it, too.
// bool def = accname() == defaultAccount();
// writeConfig(cgroup, NAME_KEY, n);
// if (def)
// setDefaultAccount(n);
// }
writeConfig(modemGroup(), MODEMNAME_KEY, n );
}
bool PPPData::setDevice(const QString &dev )
{
- qDebug("setting device to >%s<", dev.latin1());
+ odebug << "setting device to >" << dev.latin1() << "<" << oendl;
QString save_mName = _modemName;
for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
_modemName = *it;
- qDebug("PPPData::setDevice %s is named %s", _modemName.latin1(), devname().latin1() );
- qDebug( "iterator %s", (*it).latin1() );
+ odebug << "PPPData::setDevice " << _modemName.latin1() << " is named " << devname().latin1() << "" << oendl;
+ odebug << "iterator " << (*it).latin1() << "" << oendl;
if(devname() == dev) {
- qDebug("SUCCESS");
+ odebug << "SUCCESS" << oendl;
return true;
}
}
_modemName = save_mName;
- qDebug("FAILURE");
+ odebug << "FAILURE" << oendl;
return false;
}
bool PPPData::deleteDevice()
{
// FIXME: check if this account exists in a config...
Config cfg = PPPData::config();
cfg.setGroup(modemGroup());
cfg.clearGroup();
deviceList.remove(modemGroup());
QString key;
QStringList keys;
for( QMap<QString,QString>::Iterator it = stringEntries.begin();
it != stringEntries.end(); ++it ){
QString val = it.data();
key = it.key();
keys = QStringList::split( "SEPARATOR", key );
if(keys[0]==modemGroup()){
stringEntries.remove( it );
- qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
+ odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl;
}
}
for( QMap<QString,int>::Iterator it = intEntries.begin();
it != intEntries.end(); ++it ){
int val = it.data();
key = it.key();
keys = QStringList::split( "SEPARATOR", key );
if(keys[0]==modemGroup()){
intEntries.remove( it );
- qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val );
+ odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl;
}
}
for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
it != listEntries.end(); ++it ){
QStringList val = it.data();
key = it.key();
if(keys[0]==modemGroup()){
listEntries.remove( it );
sepEntries.remove( key );
- qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() );
+ odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl;
}
}
return true;
}
bool PPPData::deleteDevice(const QString &dev)
{
if(!setDevice(dev))
return false;
return deleteDevice();
}
int PPPData::newdevice()
{
- qDebug("PPPData::newdevice highcount %i",highcountdev);
+ odebug << "PPPData::newdevice highcount " << highcountdev << "" << oendl;
QString tmp;
tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev);
_modemName = QString(tmp);
deviceList << tmp;
- qDebug("PPPData::newdevice() Group: >%s<",cgroup.latin1());
+ odebug << "PPPData::newdevice() Group: >" << cgroup.latin1() << "<" << oendl;
return highcountdev;
}
int PPPData::copydevice(const QString&)
{
return false;
}
QStringList PPPData::getDevicesNamesList()
{
QStringList list;
QString save_mName = _modemName;
- qDebug("PPPData::getDevicesNamesList has %s", deviceList.join("---").latin1());
+ odebug << "PPPData::getDevicesNamesList has " << deviceList.join("---").latin1() << "" << oendl;
for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
_modemName = *it;
- qDebug("PPPData::getDevicesNamesList adding %s as %s",_modemName.latin1(), devname().latin1());
+ odebug << "PPPData::getDevicesNamesList adding " << _modemName.latin1() << " as " << devname().latin1() << "" << oendl;
list << devname();
}
_modemName = save_mName;
return list;
};
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index a7caffe..2291e8a 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -51,62 +51,62 @@ namespace
* an interface was up while closing the application
* we need to be able to shut it down...
*/
PPPModule::PPPModule() : Module()
{
InterfaceKeeper inFace;
QMap<QString,Connection> running = inFace.interfaces();
QStringList handledInterfaceNames;
QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
QMap<QString,QString>::Iterator it;
InterfacePPP *iface;
- qDebug("getting interfaces");
+ odebug << "getting interfaces" << oendl;
for( it = ifaces.begin(); it != ifaces.end(); ++it )
{
- qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() );
+ odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl;
iface = new InterfacePPP( 0, it.key() );
iface->setHardwareName( it.data() );
list.append( (Interface*)iface );
// check if (*it) is one of the running ifaces
if ( running.contains( it.data() ) )
{
- qDebug("iface is running %s", it.key().latin1() );
+ odebug << "iface is running " << it.key().latin1() << "" << oendl;
handledInterfaceNames << running[it.data()].device;
iface->setStatus( true );
iface->setPPPDpid( running[it.data()].pid );
iface->modem()->setPPPDevice( running[it.data()].device );
iface->refresh();
}
}
setHandledInterfaceNames( handledInterfaceNames );
}
/**
* Delete any interfaces that we own.
*/
PPPModule::~PPPModule()
{
- qDebug("PPPModule::~PPPModule() " );
+ odebug << "PPPModule::~PPPModule() " << oendl;
QMap<QString,QString> ifaces;
InterfaceKeeper keeper;
Interface *i;
for ( i=list.first(); i != 0; i=list.next() )
{
/* if online save the state */
if ( i->getStatus() )
{
- qDebug("Iface %s is still up", i->getHardwareName().latin1() );
+ odebug << "Iface " << i->getHardwareName().latin1() << " is still up" << oendl;
InterfacePPP* ppp = static_cast<InterfacePPP*>(i);
keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() );
}
ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
delete i;
}
PPPData::setConfiguredInterfaces( ifaces );
}
/**
* Change the current profile
*/
@@ -132,25 +132,25 @@ QString PPPModule::getPixmapName(Interface* )
*/
bool PPPModule::isOwner(Interface *i)
{
return list.find( i ) != -1;
}
/**
* Create, and return the WLANConfigure Module
* @return QWidget* pointer to this modules configure.
*/
QWidget *PPPModule::configure(Interface *i)
{
- qDebug("return ModemWidget");
+ odebug << "return ModemWidget" << oendl;
PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
0, "PPPConfig", false,
(Qt::WDestructiveClose | Qt::WStyle_ContextHelp));
return pppconfig;
}
/**
* Create, and return the Information Module
* @return QWidget* pointer to this modules info.
*/
QWidget *PPPModule::information(Interface *i)
{
@@ -159,25 +159,25 @@ QWidget *PPPModule::information(Interface *i)
return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
}
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
QList<Interface> PPPModule::getInterfaces()
{
// List all of the files in the peer directory
- qDebug("PPPModule::getInterfaces");
+ odebug << "PPPModule::getInterfaces" << oendl;
return list;
}
/**
* Attempt to add a new interface as defined by name
* @param name the name of the type of interface that should be created given
* by possibleNewInterfaces();
* @return Interface* NULL if it was unable to be created.
*/
Interface *PPPModule::addNewInterface(const QString &newInterface)
{
@@ -252,32 +252,32 @@ namespace
QMap<QString, Connection> InterfaceKeeper::interfaces()const
{
Config cfg("ppp_plugin_keeper");
QMap<QString, Connection> ifaces;
QStringList lst = cfg.groupList();
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it )
{
Connection con;
cfg.setGroup( (*it) );
con.name = (*it);
con.pid = cfg.readNumEntry("pid");
con.device = cfg.readEntry("device");
- qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid );
+ odebug << " " << con.name.latin1() << " " << con.device.latin1() << " " << con.pid << "" << oendl;
if ( con.pid != -1 && isAvailable( con.pid ) )
ifaces.insert( con.name, con );
}
return ifaces;
}
bool InterfaceKeeper::isAvailable( pid_t p)const
{
if (::kill(p, 0 ) == 0 || errno != ESRCH )
{
- qDebug("isAvailable %d", p);
+ odebug << "isAvailable " << p << "" << oendl;
return true;
}
- qDebug("notAvailable %d", p);
+ odebug << "notAvailable " << p << "" << oendl;
return false;
}
}
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp
index bd56678..c558f5e 100644
--- a/noncore/settings/networksettings/wlan/infoimp.cpp
+++ b/noncore/settings/networksettings/wlan/infoimp.cpp
@@ -4,40 +4,40 @@
#include <qtimer.h>
#include <qprogressbar.h>
#include <qlabel.h>
/**
* Constructor. If wireless extensions are enabled on device name then
* start a timer that every second will update the information.
*/
WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){
WExtensions *wExtensions = new WExtensions(name);
if(!wExtensions->doesHaveWirelessExtensions()){
delete wExtensions;
- qDebug("WlanInfoImp::No wireless extension");
+ odebug << "WlanInfoImp::No wireless extension" << oendl;
return;
}
delete wExtensions;
timer = new QTimer( this );
connect( timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start( 1000, false );
}
/**
* Updates the information about the wireless device.
*/
void WlanInfoImp::update(){
WExtensions *wExtensions = new WExtensions(this->name());
if(!wExtensions->doesHaveWirelessExtensions()){
- qDebug("No extension");
+ odebug << "No extension" << oendl;
delete wExtensions;
timer->stop();
return;
}
essidLabel->setText(wExtensions->essid());
apLabel->setText(wExtensions->ap());
stationLabel->setText(wExtensions->station());
modeLabel->setText(wExtensions->mode());
channelLabel->setText(QString("%1").arg(wExtensions->channel()));
int signal = 0;
int noise = 0;
int quality = 0;
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp
index d1fff88..9c64323 100644
--- a/noncore/settings/networksettings/wlan/wextensions.cpp
+++ b/noncore/settings/networksettings/wlan/wextensions.cpp
@@ -103,25 +103,25 @@ int WExtensions::channel(){
// http://www.elanix.com/pdf/an137e.pdf
double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000);
double left = 2.401;
double right = 2.416;
for(int channel = 1; channel<= 15; channel++){
if( num >= left && num <= right )
return channel;
left += 0.005;
right += 0.005;
}
- qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1());
+ odebug << QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1() << oendl;
return -1;
}
/***
* Get the current rate that the card is transmiting at.
* @return double the rate, 0 if error.
*/
double WExtensions::rate(){
if(!hasWirelessExtensions)
return 0;
if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){
return ((double)iwr.u.bitrate.value)/1000000;
@@ -168,33 +168,33 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){
QFile wfile( PROCNETWIRELESS );
if(!wfile.open( IO_ReadOnly ))
return false;
QTextStream wstream( &wfile );
wstream.readLine(); // skip the first two lines
wstream.readLine(); // because they only contain headers
while(!wstream.atEnd()){
wstream >> name >> status >> quality >> c >> signal >> c >> noise;
if(name == QString("%1:").arg(interface)){
if ( quality > 92 )
- qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
+ odebug << "WIFIAPPLET: D'oh! Quality " << quality << " > estimated max!\n" << oendl;
if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
- qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
+ odebug << "WIFIAPPLET: Doh! Strength " << signal << " > estimated max!\n" << oendl;
if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
- qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
- //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1());
+ odebug << "WIFIAPPLET: Doh! Noise " << noise << " > estimated max!\n" << oendl;
+ //odebug << QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1() << oendl;
signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER;
noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
quality = ( quality*100 ) / 92;
return true;
}
}
- qDebug("WExtensions::statsCard no longer present.");
+ odebug << "WExtensions::statsCard no longer present." << oendl;
quality = -1;
signal = IW_LOWER;
noise = IW_LOWER;
return false;
}
// wextensions.cpp
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
index 80a9927..fe7941d 100644
--- a/noncore/settings/networksettings/wlan/wlanimp.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -36,25 +36,25 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W
if (file.open(IO_ReadOnly)){
QTextStream stream( &file );
QString line = "";
while ( !stream.eof() ) {
line += stream.readLine();
line += "\n";
}
file.close();
settingsFileText = QStringList::split("\n", line, true);
parseSettingFile();
}
else
- qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1());
+ odebug << QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1() << oendl;
connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
}
void WLANImp::typeChanged(int mod){
networkChannel->setEnabled(mod);
channelLabel->setEnabled(mod);
}
/**
* Change the profile for both wireless settings and network settings.
*/
void WLANImp::setProfile(const QString &profile){
@@ -137,25 +137,25 @@ void WLANImp::parseSettingFile(){
}
}
/**
* Saves settings to the wireless.opts file using the current profile
*/
void WLANImp::changeAndSaveSettingFile(){
QString wlanFile = WIRELESS_OPTS;
QFile::remove(wlanFile);
QFile file(wlanFile);
if (!file.open(IO_ReadWrite)){
- qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1());
+ odebug << QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1() << oendl;
return;
}
QTextStream stream( &file );
bool foundCase = false;
bool found = false;
bool output = true;
for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) {
QString line = (*it).simplifyWhiteSpace();
if(line.contains("case"))
foundCase = true;
// See if we found our scheme to write or the sceme couldn't be found
@@ -227,19 +227,19 @@ void WLANImp::accept(){
changeAndSaveSettingFile();
// Try to save the interfaces settings.
if(!interfaceSetup->saveChanges())
return;
OProcess insert;
insert << "sh";
insert << "-c";
insert << "cardctl eject && cardctl insert";
if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) {
- qWarning("could not start cardctl");
+ owarn << "could not start cardctl" << oendl;
}
// Close out the dialog
QDialog::accept();
}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index eeebe7f..e483efe 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -43,25 +43,25 @@
* Constructor, read in the wireless.opts file for parsing later.
*/
using namespace Opie::Net;
using namespace Opie::Core;
WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
interfaces = new Interfaces();
interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
tabWidget->insertTab(interfaceSetup, "TCP/IP");
// Check sanity - the existance of the wireless-tools if-pre-up script
QFile file(QString(PREUP));
if (file.exists()) {
- qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools"));
+ owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl;
}
connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) );
connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) );
netView->setColumnAlignment( col_chn, AlignCenter );
netView->setItemMargin( 3 );
netView->setAllColumnsShowFocus( true );
}
WLANImp::~WLANImp() {
//FIXME: delete interfaces;
@@ -224,25 +224,25 @@ void WLANImp::accept() {
// Close out the dialog
// FIXME: QDialog::accept();
}
void WLANImp::writeOpts() {
// eh can't really do anything about it other then return. :-D
if(!interfaces->isInterfaceSet()){
QMessageBox::warning(0,"Inface not set","should not happen!!!");
return;
}
bool error = false;
- qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() );
+ odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl;
if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!");
interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText());
interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText());
if (specifyAp->isChecked()) {
interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text());
} else {
interfaces->removeInterfaceOption(QString("wireless_ap"));
}
@@ -298,83 +298,83 @@ void WLANImp::writeOpts() {
QDialog::accept();
}
/*
* Scan for possible wireless networks around...
* ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org>
*/
void WLANImp::rescanNeighbourhood()
{
QString name = interface->getInterfaceName();
- qDebug( "rescanNeighbourhood via '%s'", (const char*) name );
+ odebug << "rescanNeighbourhood via '" << (const char*) name << "'" << oendl;
OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) );
assert( wiface );
// try to guess device type
QString devicetype;
QFile m( "/proc/modules" );
if ( m.open( IO_ReadOnly ) )
{
QString line;
QTextStream modules( &m );
while( !modules.atEnd() && !devicetype )
{
modules >> line;
if ( line.contains( "cisco" ) ) devicetype = "cisco";
else if ( line.contains( "hostap" ) ) devicetype = "hostap";
else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */
else if ( line.contains( "orinoco" ) ) devicetype = "orinoco";
}
}
if ( devicetype.isEmpty() )
{
- qWarning( "rescanNeighbourhood(): couldn't guess device type :(" );
+ owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl;
return;
}
else
{
- qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype );
+ odebug << "rescanNeighbourhood(): device type seems to be '" << (const char*) devicetype << "'" << oendl;
}
// configure interface to receive 802.11 management frames
wiface->setUp( true );
wiface->setPromiscuousMode( true );
if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) );
else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) );
else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) );
else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) );
else
{
- qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" );
+ odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl;
return;
}
wiface->setMode( "monitor" );
if ( wiface->mode() != "monitor" )
{
- qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) );
+ owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl;
return;
}
// open a packet capturer
OPacketCapturer* cap = new OPacketCapturer();
cap->open( name );
if ( !cap->isOpen() )
{
- qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) );
+ owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl;
return;
}
// display splash screen
QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize );
splash->setLineWidth( 2 );
splash->setFrameStyle( QFrame::Panel | QFrame::Raised );
QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 );
QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash );
QProgressBar* pb = new QProgressBar( wiface->channels(), splash );
vbox->addWidget( lab );
vbox->addWidget( pb );
@@ -389,33 +389,33 @@ void WLANImp::rescanNeighbourhood()
splash->show();
splash->raise();
qApp->processEvents();
// set capturer to non-blocking mode
cap->setBlocking( false );
for ( int i = 1; i <= wiface->channels(); ++i )
{
wiface->setChannel( i );
pb->setProgress( i );
qApp->processEvents();
- qDebug( "rescanNeighbourhood(): listening on channel %d...", i );
+ odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl;
OPacket* p = cap->next( 1000 );
if ( !p )
{
- qDebug( "rescanNeighbourhood(): nothing received on channel %d", i );
+ odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl;
}
else
{
- qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i );
+ odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl;
handlePacket( p );
}
}
cap->close();
wiface->setMode( "managed" ); // TODO: use previous mode
wiface->setPromiscuousMode( false );
splash->hide();
delete splash;
}
@@ -430,25 +430,25 @@ void WLANImp::handlePacket( OPacket* p )
QString type;
if ( beacon->canIBSS() )
{
type = "adhoc";
}
else if ( beacon->canESS() )
{
type = "managed";
}
else
{
- qWarning( "handlePacket(): invalid frame [possibly noise] detected!" );
+ owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl;
return;
}
OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
QString essid = ssid ? ssid->ID() : QString("<unknown>");
OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
int channel = ds ? ds->channel() : -1;
OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
displayFoundNetwork( type, channel, essid, header->macAddress2() );
}
}
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index 74d7f8e..886af10 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -113,71 +113,71 @@ Interface *WLANModule::addNewInterface(const QString &){
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successful, false otherwise.
*/
bool WLANModule::remove(Interface*){
// Can't remove a hardware device, you can stop it though.
return false;
}
void WLANModule::receive(const QCString &param, const QByteArray &arg)
{
- qDebug("WLANModule::receive "+param);
+ odebug << "WLANModule::receive "+param << oendl;
QStringList params = QStringList::split(",",param);
int count = params.count();
- qDebug("WLANModule got %i params", count );
+ odebug << "WLANModule got " << count << " params" << oendl;
if (count < 2){
- qDebug("Erorr less than 2 parameter");
- qDebug("RETURNING");
+ odebug << "Erorr less than 2 parameter" << oendl;
+ odebug << "RETURNING" << oendl;
return;
}
QDataStream stream(arg,IO_ReadOnly);
QString interface;
QString action;
int countMsgs = 0;
stream >> interface;
- qDebug("got count? >%s<",interface.latin1());
+ odebug << "got count? >" << interface.latin1() << "<" << oendl;
if (interface == "count"){
- qDebug("got count");
+ odebug << "got count" << oendl;
stream >> action;
- qDebug("Got count num >%s<", action.latin1());
+ odebug << "Got count num >" << action.latin1() << "<" << oendl;
countMsgs = action.toInt();
}
QDialog *toShow;
//while (! stream.atEnd() ){
for (int i = 0; i < countMsgs; i++){
- qDebug("start stream %d/%d",i,countMsgs);
+ odebug << "start stream " << i << "/" << countMsgs << "" << oendl;
if (stream.atEnd()){
- qDebug("end of stream");
+ odebug << "end of stream" << oendl;
return;
}
stream >> interface;
- qDebug("got iface");
+ odebug << "got iface" << oendl;
stream >> action;
- qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1());
+ odebug << "WLANModule got interface " << interface.latin1() << " and acion " << action.latin1() << "" << oendl;
// find interfaces
Interface *ifa=0;
for ( Interface *i=list.first(); i != 0; i=list.next() ){
if (i->getInterfaceName() == interface){
- qDebug("WLANModule found interface %s",interface.latin1());
+ odebug << "WLANModule found interface " << interface.latin1() << "" << oendl;
ifa = i;
}
}
if (ifa == 0){
- qDebug("WLANModule Did not find %s",interface.latin1());
- qDebug("skipping");
+ odebug << "WLANModule Did not find " << interface.latin1() << "" << oendl;
+ odebug << "skipping" << oendl;
count = 0;
}
if (count == 2){
// those should call the interface directly
QWidget *info = getInfo( ifa );
QPEApplication::showWidget( info );
if ( action.contains("start" ) ){
ifa->start();
} else if ( action.contains("restart" ) ){
ifa->restart();
@@ -186,70 +186,70 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
}else if ( action.contains("refresh" ) ){
ifa->refresh();
}
}else if (count == 3){
QString value;
if (!wlanconfigWiget){
//FIXME: what if it got closed meanwhile?
wlanconfigWiget = (WLANImp*) configure(ifa);
toShow = (QDialog*) wlanconfigWiget;
}
QPEApplication::showWidget( wlanconfigWiget );
stream >> value;
- qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() );
+ odebug << "WLANModule (build 4) is setting " << action.latin1() << " of " << interface.latin1() << " to " << value.latin1() << "" << oendl;
if (value.isEmpty()){
- qDebug("value is empty!!!\nreturning");
+ odebug << "value is empty!!!\nreturning" << oendl;
return;
}
if ( action.contains("ESSID") ){
QComboBox *combo = wlanconfigWiget->essid;
bool found = false;
for ( int i = 0; i < combo->count(); i++)
if ( combo->text( i ) == value ){
combo->setCurrentItem( i );
found = true;
}
if (!found) combo->insertItem( value, 0 );
}else if ( action.contains("Mode") ){
QComboBox *combo = wlanconfigWiget->mode;
for ( int i = 0; i < combo->count(); i++)
if ( combo->text( i ) == value ){
combo->setCurrentItem( i );
}
}else if (action.contains("Channel")){
bool ok;
- qDebug("converting channel");
+ odebug << "converting channel" << oendl;
int chan = value.toInt( &ok );
if (ok){
- qDebug("ok setting channel");
+ odebug << "ok setting channel" << oendl;
wlanconfigWiget->specifyChan->setChecked( true );
wlanconfigWiget->networkChannel->setValue( chan );
}
}else if (action.contains("MacAddr")){
wlanconfigWiget->specifyAp->setChecked( true );
wlanconfigWiget->macEdit->setText( value );
}else
- qDebug("wlan plugin has no clue");
+ odebug << "wlan plugin has no clue" << oendl;
}
- qDebug("next stream");
+ odebug << "next stream" << oendl;
}// while stream
- qDebug("end of stream");
+ odebug << "end of stream" << oendl;
if (toShow) toShow->exec();
- qDebug("returning");
+ odebug << "returning" << oendl;
}
QWidget *WLANModule::getInfo( Interface *i)
{
- qDebug("WLANModule::getInfo start");
+ odebug << "WLANModule::getInfo start" << oendl;
WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
info->tabWidget->insertTab(information, "TCP/IP", 0);
info->tabWidget->setCurrentPage( 0 );
info->tabWidget->showPage( information );
- if (info->tabWidget->currentPage() == information ) qDebug("infotab OK");
- else qDebug("infotab NOT OK");
- qDebug("current idx %d", info->tabWidget->currentPageIndex());
- qDebug("WLANModule::getInfo return");
+ if (info->tabWidget->currentPage() == information ) odebug << "infotab OK" << oendl;
+ else odebug << "infotab NOT OK" << oendl;
+ odebug << "current idx " << info->tabWidget->currentPageIndex() << "" << oendl;
+ odebug << "WLANModule::getInfo return" << oendl;
return info;
}
diff --git a/noncore/settings/sound/sound.pro b/noncore/settings/sound/sound.pro
index a3804c3..58e94f3 100644
--- a/noncore/settings/sound/sound.pro
+++ b/noncore/settings/sound/sound.pro
@@ -1,10 +1,9 @@
CONFIG += qt warn_on quick-app
HEADERS = soundsettings.h soundsettingsbase.h
SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp
-#INTERFACES = soundsettingsbase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopiecore2
TARGET = sound
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 8ad0a3f..d55a751 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -12,38 +12,42 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
// parts copyright 2002 L.J. Potter
#include "soundsettings.h"
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/storage.h>
+using namespace Opie::Core;
+/* QT */
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
+/* STD */
#include <sys/utsname.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
-#include <stdio.h>
#include <sys/stat.h>
SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
: SoundSettingsBase( parent, objname, TRUE, fl )
{
keyReset=FALSE;
noWarning=false;
Config config( "qpe");
config.setGroup( "Volume" );
Config cfg("Vmemo");
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
@@ -64,37 +68,37 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0));
//TODO hide if zaurus- mono only
#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
//since ipaq and zaurus have particular
//devices
bool systemZaurus=FALSE;
struct utsname name; /* check for embedix kernel running on the zaurus*/
if (uname(&name) != -1) {// TODO change this here,...
QString release=name.release;
if( release.find("embedix",0,TRUE) != -1) {
- qDebug("IS System Zaurus");
+ odebug << "IS System Zaurus" << oendl;
systemZaurus=TRUE;
}
}
if(!systemZaurus) {
stereoCheckBox->setChecked(TRUE);
}
stereoCheckBox->setEnabled(FALSE);
sixteenBitCheckBox->setEnabled(FALSE);
#else
#endif
int sRate=cfg.readNumEntry("SizeLimit", 30);
- qDebug("%d",sRate);
+ odebug << "" << sRate << "" << oendl;
if(sRate ==30)
timeLimitComboBox->setCurrentItem(0);
else if(sRate==20)
timeLimitComboBox->setCurrentItem(1);
else if(sRate == 15)
timeLimitComboBox->setCurrentItem(2);
else if(sRate == 10)
timeLimitComboBox->setCurrentItem(3);
else if(sRate == 5)
timeLimitComboBox->setCurrentItem(4);
else
@@ -134,42 +138,42 @@ void SoundSettings::updateStorageCombo() {
int set=0;
StorageInfo storageInfo;
QString sName, sPath;
QStringList list;
list << "Documents : "+QPEApplication::documentDir();
list << "tmp : /tmp";
const QList<FileSystem> &fs = storageInfo.fileSystems();
QListIterator<FileSystem> it ( fs );
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
- qDebug("storage name "+name +" storage path is "+path);
+ odebug << "storage name "+name +" storage path is "+path << oendl;
list << name + ": " +path;
if( loc.find( path,0,TRUE) != -1)
set = i;
// if(dit.current()->file().find(path) != -1 ) storage=name;
i++;
}
LocationComboBox->insertStringList(list);
- qDebug("set item %d", set);
+ odebug << "set item " << set << "" << oendl;
LocationComboBox->setCurrentItem(set);
}
void SoundSettings::setLocation(const QString & string) {
Config config( "Vmemo" );
config.setGroup( "System" );
config.writeEntry("RecLocation",string);
- qDebug("set location "+string);
+ odebug << "set location "+string << oendl;
config.write();
}
void SoundSettings::cleanUp() {
Config cfg("Vmemo");
cfg.writeEntry("Alert",AlertCheckBox->isChecked());
cfg.setGroup("Record");
cfg.writeEntry("SampleRate",sampleRate->currentText());
cfg.writeEntry("Stereo",stereoCheckBox->isChecked());
cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
if(keyReset && noWarning) {
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 96bcdfc..4163fb2 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -10,31 +10,34 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "benchmarkinfo.h"
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/ostorageinfo.h>
#include <opie2/olistview.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpedecoration_qws.h>
#include <qpe/resource.h>
#include <qpe/config.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
/* QT */
#include <qclipboard.h>
#include <qcolor.h>
#include <qcombobox.h>
#include <qdirectpainter_qws.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qfiledialog.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpainter.h>
@@ -42,28 +45,25 @@
#include <qtimer.h>
#include <qwhatsthis.h>
/* STD */
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#if defined (__GNUC__) && (__GNUC__ < 3)
#define round qRound
#endif
-using namespace Opie::Ui;
-using namespace Opie::Core;
extern "C"
-
{
void BenchFFT( void );
double dhry_main( int );
}
#define DHRYSTONE_RUNS 20000000
#define TEST_DURATION 3
#define BUFF_SIZE 8192
#define FILE_SIZE 1024 * 1024 // 1Mb
//===========================================================================
@@ -139,50 +139,50 @@ BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags )
vb->addWidget( tests, 2 );
QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" );
if ( f.open( IO_ReadOnly ) )
{
machineCombo = new QComboBox( this );
QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) );
QTextStream ts( &f );
while( !ts.eof() )
{
QString machline = ts.readLine();
- qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline );
+ odebug << "sysinfo: parsing benchmark results for '" << (const char*) machline << "'" << oendl;
QString resline = ts.readLine();
machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) );
machineCombo->insertItem( machline );
}
QHBoxLayout* hb = new QHBoxLayout( vb );
hb->addWidget( new QLabel( tr( "Compare To:" ), this ) );
hb->addWidget( machineCombo, 2 );
connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) );
}
vb->addWidget( startButton, 2 );
}
BenchmarkInfo::~BenchmarkInfo()
{}
void BenchmarkInfo::machineActivated( int index )
{
QStringList* results = machines[ machineCombo->text( index ) ];
if ( !results )
{
- qDebug( "sysinfo: no results available." );
+ odebug << "sysinfo: no results available." << oendl;
return;
}
QStringList::Iterator it = results->begin();
test_alu->setText( 2, *(it++) );
test_fpu->setText( 2, *(it++) );
test_txt->setText( 2, *(it++) );
test_gfx->setText( 2, *(it++) );
test_ram->setText( 2, *(it++) );
test_sd->setText( 2, *(it++) );
test_cf->setText( 2, *(it++) );
}
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index 15aeaf5..4274203 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -54,25 +54,25 @@ TabManager::~TabManager(){
e << link;
}
}
/**
* Scans root directory for any tabs or applications. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
* @param parent - the parent to place any new tabs or apps into. If parent is
* NULL then the item is a tab and should be placed as a child of the window.
*/
void TabManager::rescanFolder(QString directory, QListViewItem* parent){
- //qDebug(QString("rescanFolder: ") + directory.latin1());
+ //odebug << QString("rescanFolder: ") + directory.latin1() << oendl;
QDir d;
d.setPath(directory);
// Show hidden files for .directories
d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
// If it is a dir and not .. or . then add it as a tab and go down.
@@ -198,25 +198,25 @@ void TabManager::removeItem(){
if(item->parent() == NULL){
// Remove .directory file string
location = location.mid(0,location.length()-10);
QDir dir;
if(!dir.rmdir(location))
removeSuccessful = false;
else
removeSuccessful = true;
}
// If removing failed.
if(!removeSuccessful){
- qDebug((QString("removeItem: ") + location).latin1());
+ odebug << (QString("removeItem: ") + location).latin1() << oendl;
QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") );
return;
}
// Remove from the installer so it wont fail.
// Don't need to do this sense the current install uses rm -f so no error
// Remove from the gui list.
itemList.remove(item);
if(item->parent())
item->parent()->takeItem(item);
delete item;
@@ -235,25 +235,25 @@ void TabManager::editCurrentItem(){
/**
* Edit the item that is passed in.
* Show application dialog and if anything changed
* @param item the item to edit.
*/
void TabManager::editItem( QListViewItem * item){
if(!item)
return;
TabAppLnk app(itemList[item]);
if(!app.isValid()){
- qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1());
+ odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl;
return;
}
// Fill with all of the icons
if(!application){
Wait waitDialog(this, "Wait dialog");
waitDialog.waitLabel->setText(tr("Gathering icons..."));
waitDialog.show();
qApp->processEvents();
application = new AppEdit(this, "Application edit", true);
QDir d(QPEApplication::qpeDir() + "/pics/");
@@ -264,25 +264,25 @@ void TabManager::editItem( QListViewItem * item){
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png"){
fileName = fileName.mid(0,fileName.length()-4);
QPixmap imageOfFile(Resource::loadPixmap(fileName));
QImage foo = imageOfFile.convertToImage();
foo = foo.smoothScale(16,16);
imageOfFile.convertFromImage(foo);
application->iconLineEdit->insertItem(imageOfFile,fileName);
}
- //qDebug(fi->fileName().latin1());
+ //odebug << fi->fileName().latin1() << oendl;
++it;
}
waitDialog.hide();
}
int pixmap = -1;
QString pixmapText = app.pixmapString();
QComboBox *f = application->iconLineEdit;
for(int i = 0; i < application->iconLineEdit->count(); i++){
if(f->text(i) == pixmapText){
pixmap = i;
break;
}
@@ -393,38 +393,38 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){
QString desktopFile = itemList[item];
slash = desktopFile.findRev('/', -1);
desktopFile = desktopFile.mid(slash, desktopFile.length());
newFolder = newFolder + desktopFile;
// Move file
QDir r;
if(!r.rename(itemList[item], newFolder)){
QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") );
return;
}
- //qDebug((QString("moveApplication: ") + itemList[item]).latin1());
- //qDebug((QString("moveApplication: ") + newFolder).latin1());
+ //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl;
+ //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl;
// Move in the gui
item->parent()->takeItem(item);
newGroup->insertItem(item);
newGroup->setOpen(true);
// Move file in the installer
QString installedAppFile;
if(findInstalledApplication(desktopFile, installedAppFile))
swapInstalledLocation(installedAppFile, desktopFile, newFolder);
else
- qDebug("moveApplication: No installed app found for dekstop file");
+ odebug << "moveApplication: No installed app found for dekstop file" << oendl;
// Move application type
AppLnk app(newFolder);
app.setType(folderName);
app.writeLink();
// Move in our internal list
itemList.remove(item);
itemList.insert(item, newFolder);
// We have changed something.
changed = true;
@@ -455,54 +455,54 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe
QString line;
while ( !stream.eof() ) { // until end of file...
line = stream.readLine(); // line of text excluding '\n'
if(line.contains(desktopFile)){
installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName();
file.close();
return true;
}
}
file.close();
}
else
- qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1());
+ odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl;
++it; // goto next list element
}
return false;
}
/**
* Open a file and replace a file containing the old desktop file with the new.
* @param installedAppFile application installed list
* @param desktopFile old .desktop file
* @param newLocation new .desktop file
*/
void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){
QFile file(installedAppFile);
if ( !file.open(IO_ReadOnly) ){
- qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1());
+ odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl;
return;
}
QTextStream stream( &file ); // use a text stream
QString allLines;
while ( !stream.eof() ) { // until end of file...
QString line = stream.readLine(); // line of text excluding '\n'
if(line.contains(desktopFile))
allLines += newLocation;
else
allLines += line;
allLines += '\n';
}
file.close();
if ( !file.open(IO_ReadWrite) ){
- qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1());
+ odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl;
return;
}
QTextStream streamOut( &file );
streamOut << allLines;
file.close();
}
// tabmanager.cpp
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 5854fe0..3616507 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -2,48 +2,46 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "userdialog.h"
#include "passwd.h"
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/odevice.h>
#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
/* QT */
#include <qlayout.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <qfile.h>
/* STD */
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
-
-using namespace Opie::Core;
-
-
/**
* UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups.
*
*/
-using namespace Opie::Ui;
UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl)
{
vm=viewmode;
QVBoxLayout *layout = new QVBoxLayout(this);
myTabWidget=new QTabWidget(this,"User Tab Widget");
layout->addWidget(myTabWidget);
setupTab1();
setupTab2();
accounts->groupStringList.sort();
// And also fill the listview & the combobox with all available groups.
for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it)
@@ -236,25 +234,25 @@ bool UserDialog::addUser(int uid, int gid)
if (temp->text()=="power") temp->setOn(true);
if (temp->text()=="input") temp->setOn(true);
if (temp->text()=="sharp") temp->setOn(true);
if (temp->text()=="tty") temp->setOn(true);
}
}
// Show the dialog!
if(!(adduserDialog->exec())) return false;
if((adduserDialog->groupComboBox->currentItem()!=0))
{
accounts->findGroup(adduserDialog->groupComboBox->currentText());
adduserDialog->groupID=accounts->gr_gid;
- qWarning(QString::number(accounts->gr_gid));
+ owarn << QString::number(accounts->gr_gid) << oendl;
}
if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),
adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(),
QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText())))
{
QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user.");
return false;
}
// Add User to additional groups.
QListViewItemIterator it( adduserDialog->groupsListView );
for ( ; it.current(); ++it )
@@ -365,40 +363,40 @@ bool UserDialog::editUser(const char *username)
{
edituserDialog->groupComboBox->insertItem("<Undefined group>",0);
edituserDialog->groupComboBox->setCurrentItem(0);
}
// Select the groups in the listview, to which the user belongs.
QCheckListItem *temp;
// BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead.
QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant.
QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of.
for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it)
{ // Iterate over all of them.
- qWarning(*it);
+ owarn << *it << oendl;
QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
for ( ; lvit.current(); ++lvit )
{
if(lvit.current()->text(0)==(*it).left((*it).find(":")))
{
temp=(QCheckListItem*)lvit.current();
temp->setOn(true); // If we find a line with that groupname, select it.;
}
}
}
userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.)
tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of.
for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it)
{ // Iterate over all of them.
- qWarning(*it);
+ owarn << *it << oendl;
QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
for ( ; lvit.current(); ++lvit )
{
if(lvit.current()->text(0)==(*it).left((*it).find(":")))
{
temp=(QCheckListItem*)lvit.current();
temp->setOn(true); // If we find a line with that groupname, select it.;
}
}
}
if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG!
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index a1130d4..1d345ee 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -1,29 +1,32 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "usermanager.h"
-#include <qlayout.h>
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/resource.h>
+using namespace Opie::Core;
+/* QT */
+#include <qlayout.h>
#include <qmessagebox.h>
#include <qfile.h>
-#include <qpe/resource.h>
-
#include <qregexp.h>
/**
* The mainwindow constructor.
*
* @param QWidget *parent
* @param const char *name
* @ param WFlags fl
*
*/
UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
setCaption(tr("Opie User Manager"));
@@ -244,14 +247,14 @@ void UserConfig::delGroup() {
groupname=groupsListView->currentItem()->text(1); // Get the groupname from the listview.
if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) {
// If confirmed, try to delete the group.
if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted.
}
} else {
QMessageBox::information(this,"No selection","No group has been selected.");
}
}
void UserConfig::showUserMenu(QListViewItem *item) {
// userPopupMenu.exec(item->mapToGlobal(QPoint(0,0)));
- qWarning("Pressed!");
+ owarn << "Pressed!" << oendl;
}
diff --git a/noncore/settings/usermanager/usermanager.pro b/noncore/settings/usermanager/usermanager.pro
index d0647dd..31f52a6 100644
--- a/noncore/settings/usermanager/usermanager.pro
+++ b/noncore/settings/usermanager/usermanager.pro
@@ -1,10 +1,9 @@
-#CONFIG = qt warn_on
CONFIG = qt warn_on quick-app
HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h
SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt
TARGET = usermanager
include ( $(OPIEDIR)/include.pro )