summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-11-13 16:25:04 (UTC)
committer benmeyer <benmeyer>2002-11-13 16:25:04 (UTC)
commitd3301ad9a74fdf693551bd70bc3cf34b311eaa49 (patch) (side-by-side diff)
treefdc7ee3650af3e7225e1a8966e12bc2c1007b986
parent2bc05c54b2ff1a9b2af7d6bd4d55428cfe0d8db3 (diff)
downloadopie-d3301ad9a74fdf693551bd70bc3cf34b311eaa49.zip
opie-d3301ad9a74fdf693551bd70bc3cf34b311eaa49.tar.gz
opie-d3301ad9a74fdf693551bd70bc3cf34b311eaa49.tar.bz2
code cleanup const's placed in code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/TODO6
-rw-r--r--noncore/net/networksetup/interfaces/interface.cpp2
-rw-r--r--noncore/net/networksetup/interfaces/interface.h41
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.cpp6
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.h8
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.pro2
-rw-r--r--noncore/net/networksetup/ppp/pppmodule.cpp23
-rw-r--r--noncore/net/networksetup/wlan/infoimp.cpp3
-rw-r--r--noncore/settings/networksettings/TODO6
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/interface.h41
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp6
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.h8
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.pro2
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp23
-rw-r--r--noncore/settings/networksettings/wlan/infoimp.cpp3
16 files changed, 94 insertions, 88 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO
index 04b3a7c..020339f 100644
--- a/noncore/net/networksetup/TODO
+++ b/noncore/net/networksetup/TODO
@@ -1,16 +1,14 @@
-AndyQ - Fixed a bug in wlanimp.cpp : accept method - put braces round key
- field if so that settings get saved if WEP is enabled
-
-CLEAN UP
+test WEP
+WEP key in file wireless.conf is not encrypted !, therefore it is very easy to get the key out of the zaurus..
udchcp needs to output the dhcp information so interfaces can read it
interfacesetupimp really doesn't need a interface* pointer
Possible other modules to write: ppp, ipsec, bluetooth, ipchains
PPP module needs to scan pppd.tdb to see what is currently active
WLAN - add possiblity to input text or hex without knowing "s:"
Interface setupimp needs to use kernel calls.
diff --git a/noncore/net/networksetup/interfaces/interface.cpp b/noncore/net/networksetup/interfaces/interface.cpp
index 4129b3d..7ffa76f 100644
--- a/noncore/net/networksetup/interfaces/interface.cpp
+++ b/noncore/net/networksetup/interfaces/interface.cpp
@@ -2,25 +2,25 @@
#include <qdatetime.h>
#include <qfile.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#define IFCONFIG "/sbin/ifconfig"
#define DHCP_INFO_DIR "/etc/dhcpc"
#include <stdio.h>
#include <stdlib.h>
-Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
+Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), hardwareName("Unknown"), moduleOwner(NULL), status(newSatus), attached(false), dhcp(false), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"){
refresh();
}
/**
* Set status
* @param newStatus - the new status
* emit updateInterface
*/
void Interface::setStatus(bool newStatus){
if(status != newStatus){
status = newStatus;
refresh();
diff --git a/noncore/net/networksetup/interfaces/interface.h b/noncore/net/networksetup/interfaces/interface.h
index 989d6d8..d37834a 100644
--- a/noncore/net/networksetup/interfaces/interface.h
+++ b/noncore/net/networksetup/interfaces/interface.h
@@ -7,65 +7,66 @@
class Module;
class Interface : public QObject{
Q_OBJECT
signals:
void updateInterface(Interface *i);
void updateMessage(const QString &message);
public:
Interface(QObject * parent=0, const char * name= "unknown", bool status = false);
- QString getInterfaceName(){ QString n(this->name()); return n; };
+ QString getInterfaceName() const { QString n(this->name()); return n; };
- bool getStatus(){ return status; };
+ bool getStatus() const { return status; };
void setStatus(bool newStatus);
- bool isAttached(){ return attached; };
+ bool isAttached() const { return attached; };
void setAttached(bool isAttached=false);
- QString getHardwareName(){ return hardwareName; };
+ QString getHardwareName() const { return hardwareName; };
void setHardwareName(const QString &name="Unknown");
- Module* getModuleOwner(){ return moduleOwner; };
+ Module* getModuleOwner() const { return moduleOwner; };
void setModuleOwner(Module *owner=NULL);
// inet information.
- QString getMacAddress(){ return macAddress; };
- QString getIp(){ return ip; };
- QString getSubnetMask(){ return subnetMask; };
- QString getBroadcast(){ return broadcast; };
- bool isDhcp(){ return dhcp; };
- QString getDhcpServerIp(){ return dhcpServerIp; };
- QString getLeaseObtained(){ return leaseObtained; };
- QString getLeaseExpires(){ return leaseExpires; };
+ QString getMacAddress() const { return macAddress; };
+ QString getIp() const { return ip; };
+ QString getSubnetMask() const { return subnetMask; };
+ QString getBroadcast() const { return broadcast; };
+ bool isDhcp() const { return dhcp; };
+ QString getDhcpServerIp() const { return dhcpServerIp; };
+ QString getLeaseObtained() const { return leaseObtained; };
+ QString getLeaseExpires() const { return leaseExpires; };
public slots:
bool refresh();
void start();
void stop();
void restart();
private:
// Interface information
- bool status;
- bool attached;
QString hardwareName;
Module *moduleOwner;
-
+ bool status;
+ bool attached;
+
// Network information
- QString macAddress;
- QString ip;
- QString broadcast;
- QString subnetMask;
bool dhcp;
QString dhcpServerIp;
QString leaseObtained;
QString leaseExpires;
+ QString macAddress;
+ QString ip;
+ QString broadcast;
+ QString subnetMask;
+
};
#endif
// interface.h
diff --git a/noncore/net/networksetup/interfaces/interfaces.cpp b/noncore/net/networksetup/interfaces/interfaces.cpp
index e49998e..8f685fe 100644
--- a/noncore/net/networksetup/interfaces/interfaces.cpp
+++ b/noncore/net/networksetup/interfaces/interfaces.cpp
@@ -62,25 +62,25 @@ QStringList Interfaces::getInterfaceList(){
}
}
}
return list;
}
/**
* 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){
+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());
if(awi.count() < 1)
return false;
return true;
}
/**
* Attempt to set the auto option for interface to setAuto.
* @param interface the interface to set
@@ -130,26 +130,26 @@ bool Interfaces::setAuto(const QString &interface, bool setAuto){
* @return bool true if it is successfull.
*/
bool Interfaces::setInterface(QString interface){
interface = interface.simplifyWhiteSpace();
interface = interface.replace(QRegExp(" "), "");
return setStanza(IFACE, interface, currentIface);
}
/**
* A quick helper funtion to see if the current interface is set.
* @return bool true if set, false otherwise.
*/
-bool Interfaces::isInterfaceSet(){
- return (currentIface != interfaces.end());
+bool Interfaces::isInterfaceSet() const {
+ return (interfaces.end() != currentIface);
}
/**
* 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 successfull.
*/
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
diff --git a/noncore/net/networksetup/interfaces/interfaces.h b/noncore/net/networksetup/interfaces/interfaces.h
index d662919..bac2a7e 100644
--- a/noncore/net/networksetup/interfaces/interfaces.h
+++ b/noncore/net/networksetup/interfaces/interfaces.h
@@ -16,61 +16,61 @@
/**
* This class provides a clean frontend for parsing the network interfaces file.
* It provides helper functions to minipulate the options within the file.
* See the interfaces man page for the syntax rules.
*/
class Interfaces {
public:
Interfaces(QString useInterfacesFile = "/etc/network/interfaces");
QStringList getInterfaceList();
- bool isAuto(const QString &interface);
+ bool isAuto(const QString &interface) const ;
bool setAuto(const QString &interface, bool setAuto);
bool removeInterface();
bool addInterface(const QString &interface, const QString &family, const QString &method);
bool copyInterface(const QString &oldInterface, const QString &newInterface);
bool setInterface(QString interface);
- bool isInterfaceSet();
+ bool isInterfaceSet() const ;
QString getInterfaceName(bool &error);
bool setInterfaceName(const QString &newName);
QString getInterfaceFamily(bool &error);
bool setInterfaceFamily(const QString &newName);
QString getInterfaceMethod(bool &error);
bool setInterfaceMethod(const QString &newName);
QString getInterfaceOption(const QString &option, bool &error);
bool setInterfaceOption(const QString &option, const QString &value);
bool removeInterfaceOption(const QString &option, const QString &value);
bool removeAllInterfaceOptions();
bool setMapping(const QString &interface);
bool removeMapping();
void addMapping(const QString &options);
bool setMap(const QString &map, const QString &value);
bool removeMap(const QString &map, const QString &value);
QString getMap(const QString &map, bool &error);
bool setScript(const QString &argument);
QString getScript(bool &error);
bool write();
private:
bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator);
+ bool removeStanza(QStringList::Iterator &stanza);
bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value);
+ bool removeAllOptions(const QStringList::Iterator &start);
bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value);
QString getOption(const QStringList::Iterator &start, const QString &option, bool &error);
- bool removeStanza(QStringList::Iterator &stanza);
- bool removeAllOptions(const QStringList::Iterator &start);
QString interfacesFile;
QStringList interfaces;
QStringList::Iterator currentIface;
QStringList::Iterator currentMapping;
QStringList acceptedFamily;
};
#endif
// interfaces
diff --git a/noncore/net/networksetup/interfaces/interfaces.pro b/noncore/net/networksetup/interfaces/interfaces.pro
index 9a024f6..d6b43fb 100644
--- a/noncore/net/networksetup/interfaces/interfaces.pro
+++ b/noncore/net/networksetup/interfaces/interfaces.pro
@@ -1,12 +1,12 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#CONFIG += qt warn_on debug
-DESTDIR = $(QTDIR)/lib$(PROJMAK)
+#DESTDIR = $(QTDIR)/lib$(PROJMAK)
HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h
SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp
INCLUDEPATH += $(OPIEDIR)/include ../
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
INTERFACES = interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui
TARGET = interfaces
VERSION = 1.0.0
diff --git a/noncore/net/networksetup/ppp/pppmodule.cpp b/noncore/net/networksetup/ppp/pppmodule.cpp
index 68bb0a0..72cd45e 100644
--- a/noncore/net/networksetup/ppp/pppmodule.cpp
+++ b/noncore/net/networksetup/ppp/pppmodule.cpp
@@ -1,13 +1,14 @@
#include "pppmodule.h"
+#include "pppimp.h"
#include "interfaceinformationimp.h"
/**
* Constructor, find all of the possible interfaces
*/
PPPModule::PPPModule() : Module() {
}
/**
* Delete any interfaces that we own.
*/
PPPModule::~PPPModule(){
@@ -29,74 +30,76 @@ void PPPModule::setProfile(const QString &newProfile){
* @return QString the icon name (minus .png, .gif etc)
*/
QString PPPModule::getPixmapName(Interface* ){
return "ppp";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool PPPModule::isOwner(Interface *i){
- // Scan the ppp database
- return false;
+ if(!i->getInterfaceName().upper().contains("PPP"))
+ return false;
i->setHardwareName("PPP");
list.append(i);
return true;
}
/**
* Create, and return the WLANConfigure Module
* @return QWidget* pointer to this modules configure.
*/
QWidget *PPPModule::configure(Interface *i){
return NULL;
//PPPConfigureImp *pppconfig = new PPPConfigureImp(0, "PPPConfig", i, false, Qt::WDestructiveClose);
//pppconfig->setProfile(profile);
//return wlanconfig;
}
/**
* Create, and return the Information Module
* @return QWidget* pointer to this modules info.
*/
QWidget *PPPModule::information(Interface *i){
- return NULL;
-
- //WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
- //InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
- //info->tabWidget->insertTab(information, "TCP/IP");
- //return info;
+ // We don't have any advanced pppd information widget yet :-D
+ // TODO ^
+ InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i);
+ return information;
}
/**
* 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
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){
- // We can't add a 802.11 interface, either the hardware will be there
- // or it wont.
+ // If the
+ PPPConfigureImp imp(0, "PPPConfigImp");
+ if(imp.exec() == QDialog::Accepted ){
+
+ }
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
bool PPPModule::remove(Interface*){
// Can't remove a hardware device, you can stop it though.
return false;
}
diff --git a/noncore/net/networksetup/wlan/infoimp.cpp b/noncore/net/networksetup/wlan/infoimp.cpp
index e1eef81..6d3e167 100644
--- a/noncore/net/networksetup/wlan/infoimp.cpp
+++ b/noncore/net/networksetup/wlan/infoimp.cpp
@@ -1,27 +1,28 @@
#include "infoimp.h"
#include "wextensions.h"
+
#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("No extension");
+ qDebug("WlanInfoImp::No wireless extension");
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(){
diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO
index 04b3a7c..020339f 100644
--- a/noncore/settings/networksettings/TODO
+++ b/noncore/settings/networksettings/TODO
@@ -1,16 +1,14 @@
-AndyQ - Fixed a bug in wlanimp.cpp : accept method - put braces round key
- field if so that settings get saved if WEP is enabled
-
-CLEAN UP
+test WEP
+WEP key in file wireless.conf is not encrypted !, therefore it is very easy to get the key out of the zaurus..
udchcp needs to output the dhcp information so interfaces can read it
interfacesetupimp really doesn't need a interface* pointer
Possible other modules to write: ppp, ipsec, bluetooth, ipchains
PPP module needs to scan pppd.tdb to see what is currently active
WLAN - add possiblity to input text or hex without knowing "s:"
Interface setupimp needs to use kernel calls.
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index 4129b3d..7ffa76f 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -2,25 +2,25 @@
#include <qdatetime.h>
#include <qfile.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#define IFCONFIG "/sbin/ifconfig"
#define DHCP_INFO_DIR "/etc/dhcpc"
#include <stdio.h>
#include <stdlib.h>
-Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
+Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), hardwareName("Unknown"), moduleOwner(NULL), status(newSatus), attached(false), dhcp(false), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"){
refresh();
}
/**
* Set status
* @param newStatus - the new status
* emit updateInterface
*/
void Interface::setStatus(bool newStatus){
if(status != newStatus){
status = newStatus;
refresh();
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h
index 989d6d8..d37834a 100644
--- a/noncore/settings/networksettings/interfaces/interface.h
+++ b/noncore/settings/networksettings/interfaces/interface.h
@@ -7,65 +7,66 @@
class Module;
class Interface : public QObject{
Q_OBJECT
signals:
void updateInterface(Interface *i);
void updateMessage(const QString &message);
public:
Interface(QObject * parent=0, const char * name= "unknown", bool status = false);
- QString getInterfaceName(){ QString n(this->name()); return n; };
+ QString getInterfaceName() const { QString n(this->name()); return n; };
- bool getStatus(){ return status; };
+ bool getStatus() const { return status; };
void setStatus(bool newStatus);
- bool isAttached(){ return attached; };
+ bool isAttached() const { return attached; };
void setAttached(bool isAttached=false);
- QString getHardwareName(){ return hardwareName; };
+ QString getHardwareName() const { return hardwareName; };
void setHardwareName(const QString &name="Unknown");
- Module* getModuleOwner(){ return moduleOwner; };
+ Module* getModuleOwner() const { return moduleOwner; };
void setModuleOwner(Module *owner=NULL);
// inet information.
- QString getMacAddress(){ return macAddress; };
- QString getIp(){ return ip; };
- QString getSubnetMask(){ return subnetMask; };
- QString getBroadcast(){ return broadcast; };
- bool isDhcp(){ return dhcp; };
- QString getDhcpServerIp(){ return dhcpServerIp; };
- QString getLeaseObtained(){ return leaseObtained; };
- QString getLeaseExpires(){ return leaseExpires; };
+ QString getMacAddress() const { return macAddress; };
+ QString getIp() const { return ip; };
+ QString getSubnetMask() const { return subnetMask; };
+ QString getBroadcast() const { return broadcast; };
+ bool isDhcp() const { return dhcp; };
+ QString getDhcpServerIp() const { return dhcpServerIp; };
+ QString getLeaseObtained() const { return leaseObtained; };
+ QString getLeaseExpires() const { return leaseExpires; };
public slots:
bool refresh();
void start();
void stop();
void restart();
private:
// Interface information
- bool status;
- bool attached;
QString hardwareName;
Module *moduleOwner;
-
+ bool status;
+ bool attached;
+
// Network information
- QString macAddress;
- QString ip;
- QString broadcast;
- QString subnetMask;
bool dhcp;
QString dhcpServerIp;
QString leaseObtained;
QString leaseExpires;
+ QString macAddress;
+ QString ip;
+ QString broadcast;
+ QString subnetMask;
+
};
#endif
// interface.h
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index e49998e..8f685fe 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -62,25 +62,25 @@ QStringList Interfaces::getInterfaceList(){
}
}
}
return list;
}
/**
* 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){
+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());
if(awi.count() < 1)
return false;
return true;
}
/**
* Attempt to set the auto option for interface to setAuto.
* @param interface the interface to set
@@ -130,26 +130,26 @@ bool Interfaces::setAuto(const QString &interface, bool setAuto){
* @return bool true if it is successfull.
*/
bool Interfaces::setInterface(QString interface){
interface = interface.simplifyWhiteSpace();
interface = interface.replace(QRegExp(" "), "");
return setStanza(IFACE, interface, currentIface);
}
/**
* A quick helper funtion to see if the current interface is set.
* @return bool true if set, false otherwise.
*/
-bool Interfaces::isInterfaceSet(){
- return (currentIface != interfaces.end());
+bool Interfaces::isInterfaceSet() const {
+ return (interfaces.end() != currentIface);
}
/**
* 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 successfull.
*/
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
diff --git a/noncore/settings/networksettings/interfaces/interfaces.h b/noncore/settings/networksettings/interfaces/interfaces.h
index d662919..bac2a7e 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.h
+++ b/noncore/settings/networksettings/interfaces/interfaces.h
@@ -16,61 +16,61 @@
/**
* This class provides a clean frontend for parsing the network interfaces file.
* It provides helper functions to minipulate the options within the file.
* See the interfaces man page for the syntax rules.
*/
class Interfaces {
public:
Interfaces(QString useInterfacesFile = "/etc/network/interfaces");
QStringList getInterfaceList();
- bool isAuto(const QString &interface);
+ bool isAuto(const QString &interface) const ;
bool setAuto(const QString &interface, bool setAuto);
bool removeInterface();
bool addInterface(const QString &interface, const QString &family, const QString &method);
bool copyInterface(const QString &oldInterface, const QString &newInterface);
bool setInterface(QString interface);
- bool isInterfaceSet();
+ bool isInterfaceSet() const ;
QString getInterfaceName(bool &error);
bool setInterfaceName(const QString &newName);
QString getInterfaceFamily(bool &error);
bool setInterfaceFamily(const QString &newName);
QString getInterfaceMethod(bool &error);
bool setInterfaceMethod(const QString &newName);
QString getInterfaceOption(const QString &option, bool &error);
bool setInterfaceOption(const QString &option, const QString &value);
bool removeInterfaceOption(const QString &option, const QString &value);
bool removeAllInterfaceOptions();
bool setMapping(const QString &interface);
bool removeMapping();
void addMapping(const QString &options);
bool setMap(const QString &map, const QString &value);
bool removeMap(const QString &map, const QString &value);
QString getMap(const QString &map, bool &error);
bool setScript(const QString &argument);
QString getScript(bool &error);
bool write();
private:
bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator);
+ bool removeStanza(QStringList::Iterator &stanza);
bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value);
+ bool removeAllOptions(const QStringList::Iterator &start);
bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value);
QString getOption(const QStringList::Iterator &start, const QString &option, bool &error);
- bool removeStanza(QStringList::Iterator &stanza);
- bool removeAllOptions(const QStringList::Iterator &start);
QString interfacesFile;
QStringList interfaces;
QStringList::Iterator currentIface;
QStringList::Iterator currentMapping;
QStringList acceptedFamily;
};
#endif
// interfaces
diff --git a/noncore/settings/networksettings/interfaces/interfaces.pro b/noncore/settings/networksettings/interfaces/interfaces.pro
index 9a024f6..d6b43fb 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.pro
+++ b/noncore/settings/networksettings/interfaces/interfaces.pro
@@ -1,12 +1,12 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#CONFIG += qt warn_on debug
-DESTDIR = $(QTDIR)/lib$(PROJMAK)
+#DESTDIR = $(QTDIR)/lib$(PROJMAK)
HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h
SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp
INCLUDEPATH += $(OPIEDIR)/include ../
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
INTERFACES = interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui
TARGET = interfaces
VERSION = 1.0.0
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index 68bb0a0..72cd45e 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,13 +1,14 @@
#include "pppmodule.h"
+#include "pppimp.h"
#include "interfaceinformationimp.h"
/**
* Constructor, find all of the possible interfaces
*/
PPPModule::PPPModule() : Module() {
}
/**
* Delete any interfaces that we own.
*/
PPPModule::~PPPModule(){
@@ -29,74 +30,76 @@ void PPPModule::setProfile(const QString &newProfile){
* @return QString the icon name (minus .png, .gif etc)
*/
QString PPPModule::getPixmapName(Interface* ){
return "ppp";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool PPPModule::isOwner(Interface *i){
- // Scan the ppp database
- return false;
+ if(!i->getInterfaceName().upper().contains("PPP"))
+ return false;
i->setHardwareName("PPP");
list.append(i);
return true;
}
/**
* Create, and return the WLANConfigure Module
* @return QWidget* pointer to this modules configure.
*/
QWidget *PPPModule::configure(Interface *i){
return NULL;
//PPPConfigureImp *pppconfig = new PPPConfigureImp(0, "PPPConfig", i, false, Qt::WDestructiveClose);
//pppconfig->setProfile(profile);
//return wlanconfig;
}
/**
* Create, and return the Information Module
* @return QWidget* pointer to this modules info.
*/
QWidget *PPPModule::information(Interface *i){
- return NULL;
-
- //WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
- //InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
- //info->tabWidget->insertTab(information, "TCP/IP");
- //return info;
+ // We don't have any advanced pppd information widget yet :-D
+ // TODO ^
+ InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i);
+ return information;
}
/**
* 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
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){
- // We can't add a 802.11 interface, either the hardware will be there
- // or it wont.
+ // If the
+ PPPConfigureImp imp(0, "PPPConfigImp");
+ if(imp.exec() == QDialog::Accepted ){
+
+ }
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
bool PPPModule::remove(Interface*){
// Can't remove a hardware device, you can stop it though.
return false;
}
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp
index e1eef81..6d3e167 100644
--- a/noncore/settings/networksettings/wlan/infoimp.cpp
+++ b/noncore/settings/networksettings/wlan/infoimp.cpp
@@ -1,27 +1,28 @@
#include "infoimp.h"
#include "wextensions.h"
+
#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("No extension");
+ qDebug("WlanInfoImp::No wireless extension");
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(){