36 files changed, 238 insertions, 192 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO index 8e57405..7185dbe 100644 --- a/noncore/net/networksetup/TODO +++ b/noncore/net/networksetup/TODO @@ -1,8 +1,6 @@ CLEAN UP -Write a class that parses /proc and not ifconfig - udchcp needs to output the dhcp information so interfaces can read it interfacesetupimp really doesn't need a interface* pointer @@ -11,4 +9,5 @@ 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/addconnectionimp.cpp b/noncore/net/networksetup/addconnectionimp.cpp index 53db0fc..07545f7 100644 --- a/noncore/net/networksetup/addconnectionimp.cpp +++ b/noncore/net/networksetup/addconnectionimp.cpp @@ -16,18 +16,17 @@ AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f): * The current item changed, update the discription. */ void AddConnectionImp::changed(){ QListViewItem *item = registeredServicesList->currentItem(); - if(item){ + if(item) help->setText(list[item->text(0)]); - } } /** * Save a copy of newList for the discriptions and append them all to the view * @param newList the new list of possible interfaces */ -void AddConnectionImp::addConnections(QMap<QString, QString> newList){ +void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){ list = newList; QMap<QString, QString>::Iterator it; for( it = list.begin(); it != list.end(); ++it ) QListViewItem *item = new QListViewItem(registeredServicesList, it.key()); diff --git a/noncore/net/networksetup/addconnectionimp.h b/noncore/net/networksetup/addconnectionimp.h index 643cd9a..680a502 100644 --- a/noncore/net/networksetup/addconnectionimp.h +++ b/noncore/net/networksetup/addconnectionimp.h @@ -12,9 +12,9 @@ class AddConnectionImp : public AddConnection { Q_OBJECT public: AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0); - void addConnections(QMap<QString, QString> newList); + void addConnections(const QMap<QString, QString> &newList); private slots: void changed(); diff --git a/noncore/net/networksetup/interfaces/interface.cpp b/noncore/net/networksetup/interfaces/interface.cpp index e4f405e..4129b3d 100644 --- a/noncore/net/networksetup/interfaces/interface.cpp +++ b/noncore/net/networksetup/interfaces/interface.cpp @@ -41,9 +41,9 @@ void Interface::setAttached(bool isAttached){ * Set Hardware name * @param name - the new name * emit updateInterface */ -void Interface::setHardwareName(QString name){ +void Interface::setHardwareName(const QString &name){ hardwareName = name; emit(updateInterface(this)); }; diff --git a/noncore/net/networksetup/interfaces/interface.h b/noncore/net/networksetup/interfaces/interface.h index fc064fe..989d6d8 100644 --- a/noncore/net/networksetup/interfaces/interface.h +++ b/noncore/net/networksetup/interfaces/interface.h @@ -14,23 +14,22 @@ signals: void updateMessage(const QString &message); public: Interface(QObject * parent=0, const char * name= "unknown", bool status = false); - virtual ~Interface(){}; - virtual QString getInterfaceName(){ QString n(this->name()); return n; }; + QString getInterfaceName(){ QString n(this->name()); return n; }; - virtual bool getStatus(){ return status; }; - virtual void setStatus(bool newStatus); + bool getStatus(){ return status; }; + void setStatus(bool newStatus); - virtual bool isAttached(){ return attached; }; - virtual void setAttached(bool isAttached=false); + bool isAttached(){ return attached; }; + void setAttached(bool isAttached=false); - virtual QString getHardwareName(){ return hardwareName; }; - virtual void setHardwareName(QString name="Unknown"); + QString getHardwareName(){ return hardwareName; }; + void setHardwareName(const QString &name="Unknown"); - virtual Module* getModuleOwner(){ return moduleOwner; }; - virtual void setModuleOwner(Module *owner=NULL); + Module* getModuleOwner(){ return moduleOwner; }; + void setModuleOwner(Module *owner=NULL); // inet information. QString getMacAddress(){ return macAddress; }; QString getIp(){ return ip; }; diff --git a/noncore/net/networksetup/interfaces/interfaces.cpp b/noncore/net/networksetup/interfaces/interfaces.cpp index f1b8067..708f399 100644 --- a/noncore/net/networksetup/interfaces/interfaces.cpp +++ b/noncore/net/networksetup/interfaces/interfaces.cpp @@ -69,9 +69,9 @@ QStringList Interfaces::getInterfaceList(){ * 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(QString interface){ +bool Interfaces::isAuto(const QString &interface){ 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()); @@ -85,9 +85,9 @@ bool Interfaces::isAuto(QString interface){ * @param interface the interface to set * @param setAuto the value to set interface to. * @return false if already set to setAuto. * */ -bool Interfaces::setAuto(QString interface, bool setAuto){ +bool Interfaces::setAuto(const QString &interface, bool setAuto){ // Don't need to set it if it is already set. if(isAuto(interface) == setAuto) return false; @@ -155,24 +155,24 @@ bool Interfaces::isInterfaceSet(){ * 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(QString interface, QString family, QString method){ +bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ if(acceptedFamily.contains(family)==0) return false; - interface = interface.simplifyWhiteSpace(); - interface = interface.replace(QRegExp(" "), ""); + QString newInterface = interface.simplifyWhiteSpace(); + newInterface = newInterface.replace(QRegExp(" "), ""); interfaces.append(""); - interfaces.append(QString(IFACE " %1 %2 %3").arg(interface).arg(family).arg(method)); + 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 successfull */ -bool Interfaces::copyInterface(QString interface, QString newInterface){ +bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ if(!setInterface(interface)) return false; QStringList::Iterator it = currentIface; it++; @@ -279,15 +279,15 @@ QString Interfaces::getInterfaceMethod(bool &error){ * Sets the interface name to newName. * @param newName the new name of the interface. All whitespace is removed. * @return bool true if successfull. */ -bool Interfaces::setInterfaceName(QString newName){ +bool Interfaces::setInterfaceName(const QString &newName){ if(currentIface == interfaces.end()) return false; - newName = newName.simplifyWhiteSpace(); - newName = newName.replace(QRegExp(" "), ""); + QString name = newName.simplifyWhiteSpace(); + name = name.replace(QRegExp(" "), ""); bool returnValue = false; - (*currentIface) = QString("iface %1 %2 %3").arg(newName).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); + (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); return !returnValue; } /** @@ -295,9 +295,9 @@ bool Interfaces::setInterfaceName(QString 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 successfull. */ -bool Interfaces::setInterfaceFamily(QString newName){ +bool Interfaces::setInterfaceFamily(const QString &newName){ if(currentIface == interfaces.end()) return false; if(acceptedFamily.contains(newName)==0) return false; @@ -310,9 +310,9 @@ bool Interfaces::setInterfaceFamily(QString newName){ * Sets the interface method to newName * @param newName the new name of the interface * @return bool true if successfull. */ -bool Interfaces::setInterfaceMethod(QString newName){ +bool Interfaces::setInterfaceMethod(const QString &newName){ if(currentIface == interfaces.end()) return false; bool returnValue = false; (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName); @@ -328,9 +328,9 @@ bool Interfaces::setInterfaceMethod(QString newName){ * @param option the options to get the value. * @param error set to true if any error occurs, false otherwise. * @return QString the options value. QString::null if error == true */ -QString Interfaces::getInterfaceOption(QString option, bool &error){ +QString Interfaces::getInterfaceOption(const QString &option, bool &error){ return getOption(currentIface, option, error); } /** @@ -340,9 +340,9 @@ QString Interfaces::getInterfaceOption(QString option, bool &error){ * @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(QString option, QString value){ +bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ return setOption(currentIface, option, value); } /** @@ -351,9 +351,9 @@ bool Interfaces::setInterfaceOption(QString option, QString 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::removeInterfaceOption(QString option, QString value){ +bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){ return removeOption(currentIface, option, value); } /** @@ -370,19 +370,19 @@ bool Interfaces::removeAllInterfaceOptions(){ * @param interface the name of the interface to set. All whitespace is * removed from the interface name. * @return bool true if it is successfull. */ -bool Interfaces::setMapping(QString interface){ - interface = interface.simplifyWhiteSpace(); - interface = interface.replace(QRegExp(" "), ""); - return setStanza(MAPPING, interface, currentMapping); +bool Interfaces::setMapping(const QString &interface){ + QString interfaceName = interface.simplifyWhiteSpace(); + interfaceName = interfaceName.replace(QRegExp(" "), ""); + return setStanza(MAPPING, interfaceName, currentMapping); } /** * Adds a new Mapping to the interfaces file with interfaces. * @param interface the name(s) of the interfaces to set to this mapping */ -void Interfaces::addMapping(QString option){ +void Interfaces::addMapping(const QString &option){ interfaces.append(""); interfaces.append(QString(MAPPING " %1").arg(option)); } @@ -402,9 +402,9 @@ bool Interfaces::removeMapping(){ * @param map map to use * @param value value to go with map * @return bool true if it is successfull. */ -bool Interfaces::setMap(QString map, QString value){ +bool Interfaces::setMap(const QString &map, const QString &value){ return setOption(currentMapping, map, value); } /** @@ -412,9 +412,9 @@ bool Interfaces::setMap(QString map, QString value){ * @param map map to use * @param value value to go with map * @return bool true if it is successfull. */ -bool Interfaces::removeMap(QString map, QString value){ +bool Interfaces::removeMap(const QString &map, const QString &value){ return removeOption(currentMapping, map, value); } /** @@ -422,18 +422,18 @@ bool Interfaces::removeMap(QString map, QString value){ * @param map map to get value of * @param bool true if it is successfull. * @return value that goes to the map */ -QString Interfaces::getMap(QString map, bool &error){ +QString Interfaces::getMap(const QString &map, bool &error){ return getOption(currentMapping, map, error); } /** * Sets a script value of the current mapping to argument. * @param argument the script name. * @return true if successfull. */ -bool Interfaces::setScript(QString argument){ +bool Interfaces::setScript(const QString &argument){ return setOption(currentMapping, "script", argument); } /** @@ -443,17 +443,19 @@ bool Interfaces::setScript(QString argument){ QString Interfaces::getScript(bool &error){ return getOption(currentMapping, "script", error); } + + /** * Helper function used to parse through the QStringList and put pointers in * the correct place. * @param stanza The stanza (auto, iface, mapping) to look for. * @param option string that must be in the stanza's main line. * @param interator interator to place at location of stanza if successfull. * @return bool true if the stanza is found. */ -bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator &iterator){ +bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){ bool found = false; iterator = interfaces.end(); for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { QString line = (*it).simplifyWhiteSpace(); @@ -488,9 +490,9 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator * @param start the start of the stanza * @param option the option to use when setting value. * @return bool true if successfull, false otherwise. */ -bool Interfaces::setOption(QStringList::Iterator start, QString option, QString value){ +bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ if(start == interfaces.end()) return false; bool found = false; @@ -523,9 +525,9 @@ bool Interfaces::setOption(QStringList::Iterator start, QString option, QString * @param start the start of the stanza * @param option the option to use when setting value. * @return bool true if successfull, false otherwise. */ -bool Interfaces::removeOption(QStringList::Iterator start, QString option, QString value){ +bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){ if(start == interfaces.end()) return false; bool found = false; @@ -549,9 +551,9 @@ bool Interfaces::removeOption(QStringList::Iterator start, QString option, QStri * Removes all options in a stanza * @param start the start of the stanza * @return bool true if successfull, false otherwise. */ -bool Interfaces::removeAllOptions(QStringList::Iterator start){ +bool Interfaces::removeAllOptions(const QStringList::Iterator &start){ if(start == interfaces.end()) return false; QStringList::Iterator it = start; @@ -574,9 +576,9 @@ bool Interfaces::removeAllOptions(QStringList::Iterator start){ * @param option the option to use when getting the value. * @param bool true if errors false otherwise. * @return QString the value of option QString::null() if error == true. */ -QString Interfaces::getOption(QStringList::Iterator start, QString option, bool &error){ +QString Interfaces::getOption(const QStringList::Iterator &start, const QString &option, bool &error){ if(start == interfaces.end()){ error = false; return QString(); } diff --git a/noncore/net/networksetup/interfaces/interfaces.h b/noncore/net/networksetup/interfaces/interfaces.h index e09ea71..26abb73 100644 --- a/noncore/net/networksetup/interfaces/interfaces.h +++ b/noncore/net/networksetup/interfaces/interfaces.h @@ -24,44 +24,44 @@ class Interfaces { public: Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); QStringList getInterfaceList(); - bool isAuto(QString interface); - bool setAuto(QString interface, bool setAuto); + bool isAuto(const QString &interface); + bool setAuto(const QString &interface, bool setAuto); bool removeInterface(); - bool addInterface(QString interface, QString family, QString method); - bool copyInterface(QString oldInterface, QString newInterface); + 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(); + inline bool isInterfaceSet(); QString getInterfaceName(bool &error); - bool setInterfaceName(QString newName); + bool setInterfaceName(const QString &newName); QString getInterfaceFamily(bool &error); - bool setInterfaceFamily(QString newName); + bool setInterfaceFamily(const QString &newName); QString getInterfaceMethod(bool &error); - bool setInterfaceMethod(QString newName); - QString getInterfaceOption(QString option, bool &error); - bool setInterfaceOption(QString option, QString value); - bool removeInterfaceOption(QString option, QString value); - bool removeAllInterfaceOptions(); + bool setInterfaceMethod(const QString &newName); + inline QString getInterfaceOption(const QString &option, bool &error); + inline bool setInterfaceOption(const QString &option, const QString &value); + inline bool removeInterfaceOption(const QString &option, const QString &value); + inline bool removeAllInterfaceOptions(); - bool setMapping(QString interface); + bool setMapping(const QString &interface); bool removeMapping(); - void addMapping(QString options); - bool setMap(QString map, QString value); - bool removeMap(QString map, QString value); - QString getMap(QString map, bool &error); - bool setScript(QString); - QString getScript(bool &error); + inline void addMapping(const QString &options); + inline bool setMap(const QString &map, const QString &value); + inline bool removeMap(const QString &map, const QString &value); + inline QString getMap(const QString &map, bool &error); + inline bool setScript(const QString &argument); + inline QString getScript(bool &error); bool write(); private: - bool setStanza(QString stanza, QString option,QStringList::Iterator &iterator); - bool setOption(QStringList::Iterator start, QString option, QString value); - bool removeOption(QStringList::Iterator start, QString option, QString value); - QString getOption(QStringList::Iterator start, QString option, bool &error); - bool removeAllOptions(QStringList::Iterator start); + bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator); + bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value); + bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value); + QString getOption(const QStringList::Iterator &start, const QString &option, bool &error); + bool removeAllOptions(const QStringList::Iterator &start); QString interfacesFile; QStringList interfaces; QStringList::Iterator currentIface; diff --git a/noncore/net/networksetup/interfaces/interfacesetup.ui b/noncore/net/networksetup/interfaces/interfacesetup.ui index ab8e413..df55d25 100644 --- a/noncore/net/networksetup/interfaces/interfacesetup.ui +++ b/noncore/net/networksetup/interfaces/interfacesetup.ui @@ -98,8 +98,12 @@ <name>minValue</name> <number>1</number> </property> <property stdset="1"> + <name>lineStep</name> + <number>24</number> + </property> + <property stdset="1"> <name>value</name> <number>168</number> </property> </widget> @@ -250,8 +254,30 @@ </property> </spacer> </vbox> </widget> +<customwidgets> + <customwidget> + <class>QWidget</class> + <header location="local">qwidget.h</header> + <sizehint> + <width>100</width> + <height>100</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>7</hordata> + <verdata>7</verdata> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image> + <name>image0</name> + <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> +</images> <connections> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.h b/noncore/net/networksetup/interfaces/interfacesetupimp.h index a88e190..60933aa 100644 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.h +++ b/noncore/net/networksetup/interfaces/interfacesetupimp.h @@ -20,9 +20,8 @@ public slots: private: Interfaces *interfaces; Interface *interface; - }; #include <qlayout.h> diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 48ef9b3..7b93554 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp @@ -29,9 +29,9 @@ #include <sys/ioctl.h>
#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
-MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
+MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
@@ -188,9 +188,9 @@ void MainWindowImp::getAllInterfaces(){ * 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(QString path){
+void MainWindowImp::loadModules(const QString &path){
//qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
@@ -213,9 +213,9 @@ void MainWindowImp::loadModules(QString path){ * @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(QString pluginFileName, QString resolveString){
+Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){
//qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h index 382428c..4f09d6c 100644 --- a/noncore/net/networksetup/mainwindowimp.h +++ b/noncore/net/networksetup/mainwindowimp.h @@ -32,12 +32,12 @@ private slots: void updateInterface(Interface *i);
void newProfileChanged(const QString& newText);
private:
- void loadModules(QString path);
+ void loadModules(const QString &path);
- Module* loadPlugin(QString pluginFileName,
- QString resolveString = "create_plugin");
+ Module* loadPlugin(const QString &pluginFileName,
+ const QString &resolveString = "create_plugin");
// For our local list of names
QMap<QString, Interface*> interfaceNames;
diff --git a/noncore/net/networksetup/module.h b/noncore/net/networksetup/module.h index 92b125a..2e6272b 100644 --- a/noncore/net/networksetup/module.h +++ b/noncore/net/networksetup/module.h @@ -21,9 +21,9 @@ public: * The current profile has been changed and the module should do any * neccesary changes also. * @param newProfile what the profile should be changed to. */ - virtual void setProfile(QString newProfile) = 0; + virtual void setProfile(const QString &newProfile) = 0; /** * get the icon name for this device. * @param Interface* can be used in determining the icon. @@ -69,9 +69,9 @@ public: * Attempts to create a new interface from name * @return Interface* NULL if it was unable to be created. * @param name the type of interface to create */ - virtual Interface *addNewInterface(QString name) = 0; + virtual Interface *addNewInterface(const QString &name) = 0; /** * Attempts to remove the interface, doesn't delete i * @return bool true if successfull, false otherwise. diff --git a/noncore/net/networksetup/wlan/infoimp.h b/noncore/net/networksetup/wlan/infoimp.h index 5311bea..8f7f0d6 100644 --- a/noncore/net/networksetup/wlan/infoimp.h +++ b/noncore/net/networksetup/wlan/infoimp.h @@ -3,9 +3,9 @@ #include "info.h" class QTimer; -class WExtensions; +//class WExtensions; class WlanInfoImp : public WlanInfo { Q_OBJECT diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index eb6fc42..6335ebc 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp @@ -15,10 +15,9 @@ /** * Constructor. Sets hasWirelessExtensions */ -WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false){ - interface = interfaceName; +WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { fd = socket( AF_INET, SOCK_DGRAM, 0 ); if(fd == -1) return; diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 689eae2..d4b4af9 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp @@ -43,9 +43,9 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W /** * Change the profile for both wireless settings and network settings. */ -void WLANImp::setProfile(QString &profile){ +void WLANImp::setProfile(const QString &profile){ interfaceSetup->setProfile(profile); parseSettingFile(); } diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index f88e550..df599af 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h @@ -12,9 +12,9 @@ class WLANImp : public WLAN { Q_OBJECT public: WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); - void setProfile(QString &profile); + void setProfile(const QString &profile); protected: void accept(); diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index b14fc0a..3979e60 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp @@ -25,9 +25,9 @@ WLANModule::~WLANModule(){ /** * Change the current profile */ -void WLANModule::setProfile(QString newProfile){ +void WLANModule::setProfile(const QString &newProfile){ profile = newProfile; } /** @@ -93,9 +93,9 @@ QList<Interface> WLANModule::getInterfaces(){ * @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 *WLANModule::addNewInterface(QString ){ +Interface *WLANModule::addNewInterface(const QString &){ // We can't add a 802.11 interface, either the hardware will be there // or it wont. return NULL; } diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h index a81ccff..3a54de6 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.h +++ b/noncore/net/networksetup/wlan/wlanmodule.h @@ -11,17 +11,17 @@ signals: public: WLANModule(); ~WLANModule(); - virtual void setProfile(QString newProfile); - virtual bool isOwner(Interface *); - virtual QWidget *configure(Interface *i); - virtual QWidget *information(Interface *i); - virtual QList<Interface> getInterfaces(); - virtual void possibleNewInterfaces(QMap<QString, QString> &){}; - virtual Interface *addNewInterface(QString name); - virtual bool remove(Interface* i); - virtual QString getPixmapName(Interface* i); + void setProfile(const QString &newProfile); + bool isOwner(Interface *); + QWidget *configure(Interface *i); + QWidget *information(Interface *i); + QList<Interface> getInterfaces(); + void possibleNewInterfaces(QMap<QString, QString> &){}; + Interface *addNewInterface(const QString &name); + bool remove(Interface* i); + QString getPixmapName(Interface* i); private: QList<Interface> list; QString profile; diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO index 8e57405..7185dbe 100644 --- a/noncore/settings/networksettings/TODO +++ b/noncore/settings/networksettings/TODO @@ -1,8 +1,6 @@ CLEAN UP -Write a class that parses /proc and not ifconfig - udchcp needs to output the dhcp information so interfaces can read it interfacesetupimp really doesn't need a interface* pointer @@ -11,4 +9,5 @@ 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/addconnectionimp.cpp b/noncore/settings/networksettings/addconnectionimp.cpp index 53db0fc..07545f7 100644 --- a/noncore/settings/networksettings/addconnectionimp.cpp +++ b/noncore/settings/networksettings/addconnectionimp.cpp @@ -16,18 +16,17 @@ AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f): * The current item changed, update the discription. */ void AddConnectionImp::changed(){ QListViewItem *item = registeredServicesList->currentItem(); - if(item){ + if(item) help->setText(list[item->text(0)]); - } } /** * Save a copy of newList for the discriptions and append them all to the view * @param newList the new list of possible interfaces */ -void AddConnectionImp::addConnections(QMap<QString, QString> newList){ +void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){ list = newList; QMap<QString, QString>::Iterator it; for( it = list.begin(); it != list.end(); ++it ) QListViewItem *item = new QListViewItem(registeredServicesList, it.key()); diff --git a/noncore/settings/networksettings/addconnectionimp.h b/noncore/settings/networksettings/addconnectionimp.h index 643cd9a..680a502 100644 --- a/noncore/settings/networksettings/addconnectionimp.h +++ b/noncore/settings/networksettings/addconnectionimp.h @@ -12,9 +12,9 @@ class AddConnectionImp : public AddConnection { Q_OBJECT public: AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0); - void addConnections(QMap<QString, QString> newList); + void addConnections(const QMap<QString, QString> &newList); private slots: void changed(); diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp index e4f405e..4129b3d 100644 --- a/noncore/settings/networksettings/interfaces/interface.cpp +++ b/noncore/settings/networksettings/interfaces/interface.cpp @@ -41,9 +41,9 @@ void Interface::setAttached(bool isAttached){ * Set Hardware name * @param name - the new name * emit updateInterface */ -void Interface::setHardwareName(QString name){ +void Interface::setHardwareName(const QString &name){ hardwareName = name; emit(updateInterface(this)); }; diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h index fc064fe..989d6d8 100644 --- a/noncore/settings/networksettings/interfaces/interface.h +++ b/noncore/settings/networksettings/interfaces/interface.h @@ -14,23 +14,22 @@ signals: void updateMessage(const QString &message); public: Interface(QObject * parent=0, const char * name= "unknown", bool status = false); - virtual ~Interface(){}; - virtual QString getInterfaceName(){ QString n(this->name()); return n; }; + QString getInterfaceName(){ QString n(this->name()); return n; }; - virtual bool getStatus(){ return status; }; - virtual void setStatus(bool newStatus); + bool getStatus(){ return status; }; + void setStatus(bool newStatus); - virtual bool isAttached(){ return attached; }; - virtual void setAttached(bool isAttached=false); + bool isAttached(){ return attached; }; + void setAttached(bool isAttached=false); - virtual QString getHardwareName(){ return hardwareName; }; - virtual void setHardwareName(QString name="Unknown"); + QString getHardwareName(){ return hardwareName; }; + void setHardwareName(const QString &name="Unknown"); - virtual Module* getModuleOwner(){ return moduleOwner; }; - virtual void setModuleOwner(Module *owner=NULL); + Module* getModuleOwner(){ return moduleOwner; }; + void setModuleOwner(Module *owner=NULL); // inet information. QString getMacAddress(){ return macAddress; }; QString getIp(){ return ip; }; diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp index f1b8067..708f399 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces/interfaces.cpp @@ -69,9 +69,9 @@ QStringList Interfaces::getInterfaceList(){ * 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(QString interface){ +bool Interfaces::isAuto(const QString &interface){ 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()); @@ -85,9 +85,9 @@ bool Interfaces::isAuto(QString interface){ * @param interface the interface to set * @param setAuto the value to set interface to. * @return false if already set to setAuto. * */ -bool Interfaces::setAuto(QString interface, bool setAuto){ +bool Interfaces::setAuto(const QString &interface, bool setAuto){ // Don't need to set it if it is already set. if(isAuto(interface) == setAuto) return false; @@ -155,24 +155,24 @@ bool Interfaces::isInterfaceSet(){ * 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(QString interface, QString family, QString method){ +bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ if(acceptedFamily.contains(family)==0) return false; - interface = interface.simplifyWhiteSpace(); - interface = interface.replace(QRegExp(" "), ""); + QString newInterface = interface.simplifyWhiteSpace(); + newInterface = newInterface.replace(QRegExp(" "), ""); interfaces.append(""); - interfaces.append(QString(IFACE " %1 %2 %3").arg(interface).arg(family).arg(method)); + 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 successfull */ -bool Interfaces::copyInterface(QString interface, QString newInterface){ +bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ if(!setInterface(interface)) return false; QStringList::Iterator it = currentIface; it++; @@ -279,15 +279,15 @@ QString Interfaces::getInterfaceMethod(bool &error){ * Sets the interface name to newName. * @param newName the new name of the interface. All whitespace is removed. * @return bool true if successfull. */ -bool Interfaces::setInterfaceName(QString newName){ +bool Interfaces::setInterfaceName(const QString &newName){ if(currentIface == interfaces.end()) return false; - newName = newName.simplifyWhiteSpace(); - newName = newName.replace(QRegExp(" "), ""); + QString name = newName.simplifyWhiteSpace(); + name = name.replace(QRegExp(" "), ""); bool returnValue = false; - (*currentIface) = QString("iface %1 %2 %3").arg(newName).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); + (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); return !returnValue; } /** @@ -295,9 +295,9 @@ bool Interfaces::setInterfaceName(QString 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 successfull. */ -bool Interfaces::setInterfaceFamily(QString newName){ +bool Interfaces::setInterfaceFamily(const QString &newName){ if(currentIface == interfaces.end()) return false; if(acceptedFamily.contains(newName)==0) return false; @@ -310,9 +310,9 @@ bool Interfaces::setInterfaceFamily(QString newName){ * Sets the interface method to newName * @param newName the new name of the interface * @return bool true if successfull. */ -bool Interfaces::setInterfaceMethod(QString newName){ +bool Interfaces::setInterfaceMethod(const QString &newName){ if(currentIface == interfaces.end()) return false; bool returnValue = false; (*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName); @@ -328,9 +328,9 @@ bool Interfaces::setInterfaceMethod(QString newName){ * @param option the options to get the value. * @param error set to true if any error occurs, false otherwise. * @return QString the options value. QString::null if error == true */ -QString Interfaces::getInterfaceOption(QString option, bool &error){ +QString Interfaces::getInterfaceOption(const QString &option, bool &error){ return getOption(currentIface, option, error); } /** @@ -340,9 +340,9 @@ QString Interfaces::getInterfaceOption(QString option, bool &error){ * @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(QString option, QString value){ +bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ return setOption(currentIface, option, value); } /** @@ -351,9 +351,9 @@ bool Interfaces::setInterfaceOption(QString option, QString 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::removeInterfaceOption(QString option, QString value){ +bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){ return removeOption(currentIface, option, value); } /** @@ -370,19 +370,19 @@ bool Interfaces::removeAllInterfaceOptions(){ * @param interface the name of the interface to set. All whitespace is * removed from the interface name. * @return bool true if it is successfull. */ -bool Interfaces::setMapping(QString interface){ - interface = interface.simplifyWhiteSpace(); - interface = interface.replace(QRegExp(" "), ""); - return setStanza(MAPPING, interface, currentMapping); +bool Interfaces::setMapping(const QString &interface){ + QString interfaceName = interface.simplifyWhiteSpace(); + interfaceName = interfaceName.replace(QRegExp(" "), ""); + return setStanza(MAPPING, interfaceName, currentMapping); } /** * Adds a new Mapping to the interfaces file with interfaces. * @param interface the name(s) of the interfaces to set to this mapping */ -void Interfaces::addMapping(QString option){ +void Interfaces::addMapping(const QString &option){ interfaces.append(""); interfaces.append(QString(MAPPING " %1").arg(option)); } @@ -402,9 +402,9 @@ bool Interfaces::removeMapping(){ * @param map map to use * @param value value to go with map * @return bool true if it is successfull. */ -bool Interfaces::setMap(QString map, QString value){ +bool Interfaces::setMap(const QString &map, const QString &value){ return setOption(currentMapping, map, value); } /** @@ -412,9 +412,9 @@ bool Interfaces::setMap(QString map, QString value){ * @param map map to use * @param value value to go with map * @return bool true if it is successfull. */ -bool Interfaces::removeMap(QString map, QString value){ +bool Interfaces::removeMap(const QString &map, const QString &value){ return removeOption(currentMapping, map, value); } /** @@ -422,18 +422,18 @@ bool Interfaces::removeMap(QString map, QString value){ * @param map map to get value of * @param bool true if it is successfull. * @return value that goes to the map */ -QString Interfaces::getMap(QString map, bool &error){ +QString Interfaces::getMap(const QString &map, bool &error){ return getOption(currentMapping, map, error); } /** * Sets a script value of the current mapping to argument. * @param argument the script name. * @return true if successfull. */ -bool Interfaces::setScript(QString argument){ +bool Interfaces::setScript(const QString &argument){ return setOption(currentMapping, "script", argument); } /** @@ -443,17 +443,19 @@ bool Interfaces::setScript(QString argument){ QString Interfaces::getScript(bool &error){ return getOption(currentMapping, "script", error); } + + /** * Helper function used to parse through the QStringList and put pointers in * the correct place. * @param stanza The stanza (auto, iface, mapping) to look for. * @param option string that must be in the stanza's main line. * @param interator interator to place at location of stanza if successfull. * @return bool true if the stanza is found. */ -bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator &iterator){ +bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){ bool found = false; iterator = interfaces.end(); for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { QString line = (*it).simplifyWhiteSpace(); @@ -488,9 +490,9 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator * @param start the start of the stanza * @param option the option to use when setting value. * @return bool true if successfull, false otherwise. */ -bool Interfaces::setOption(QStringList::Iterator start, QString option, QString value){ +bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ if(start == interfaces.end()) return false; bool found = false; @@ -523,9 +525,9 @@ bool Interfaces::setOption(QStringList::Iterator start, QString option, QString * @param start the start of the stanza * @param option the option to use when setting value. * @return bool true if successfull, false otherwise. */ -bool Interfaces::removeOption(QStringList::Iterator start, QString option, QString value){ +bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){ if(start == interfaces.end()) return false; bool found = false; @@ -549,9 +551,9 @@ bool Interfaces::removeOption(QStringList::Iterator start, QString option, QStri * Removes all options in a stanza * @param start the start of the stanza * @return bool true if successfull, false otherwise. */ -bool Interfaces::removeAllOptions(QStringList::Iterator start){ +bool Interfaces::removeAllOptions(const QStringList::Iterator &start){ if(start == interfaces.end()) return false; QStringList::Iterator it = start; @@ -574,9 +576,9 @@ bool Interfaces::removeAllOptions(QStringList::Iterator start){ * @param option the option to use when getting the value. * @param bool true if errors false otherwise. * @return QString the value of option QString::null() if error == true. */ -QString Interfaces::getOption(QStringList::Iterator start, QString option, bool &error){ +QString Interfaces::getOption(const QStringList::Iterator &start, const QString &option, bool &error){ if(start == interfaces.end()){ error = false; return QString(); } diff --git a/noncore/settings/networksettings/interfaces/interfaces.h b/noncore/settings/networksettings/interfaces/interfaces.h index e09ea71..26abb73 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.h +++ b/noncore/settings/networksettings/interfaces/interfaces.h @@ -24,44 +24,44 @@ class Interfaces { public: Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); QStringList getInterfaceList(); - bool isAuto(QString interface); - bool setAuto(QString interface, bool setAuto); + bool isAuto(const QString &interface); + bool setAuto(const QString &interface, bool setAuto); bool removeInterface(); - bool addInterface(QString interface, QString family, QString method); - bool copyInterface(QString oldInterface, QString newInterface); + 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(); + inline bool isInterfaceSet(); QString getInterfaceName(bool &error); - bool setInterfaceName(QString newName); + bool setInterfaceName(const QString &newName); QString getInterfaceFamily(bool &error); - bool setInterfaceFamily(QString newName); + bool setInterfaceFamily(const QString &newName); QString getInterfaceMethod(bool &error); - bool setInterfaceMethod(QString newName); - QString getInterfaceOption(QString option, bool &error); - bool setInterfaceOption(QString option, QString value); - bool removeInterfaceOption(QString option, QString value); - bool removeAllInterfaceOptions(); + bool setInterfaceMethod(const QString &newName); + inline QString getInterfaceOption(const QString &option, bool &error); + inline bool setInterfaceOption(const QString &option, const QString &value); + inline bool removeInterfaceOption(const QString &option, const QString &value); + inline bool removeAllInterfaceOptions(); - bool setMapping(QString interface); + bool setMapping(const QString &interface); bool removeMapping(); - void addMapping(QString options); - bool setMap(QString map, QString value); - bool removeMap(QString map, QString value); - QString getMap(QString map, bool &error); - bool setScript(QString); - QString getScript(bool &error); + inline void addMapping(const QString &options); + inline bool setMap(const QString &map, const QString &value); + inline bool removeMap(const QString &map, const QString &value); + inline QString getMap(const QString &map, bool &error); + inline bool setScript(const QString &argument); + inline QString getScript(bool &error); bool write(); private: - bool setStanza(QString stanza, QString option,QStringList::Iterator &iterator); - bool setOption(QStringList::Iterator start, QString option, QString value); - bool removeOption(QStringList::Iterator start, QString option, QString value); - QString getOption(QStringList::Iterator start, QString option, bool &error); - bool removeAllOptions(QStringList::Iterator start); + bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator); + bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value); + bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value); + QString getOption(const QStringList::Iterator &start, const QString &option, bool &error); + bool removeAllOptions(const QStringList::Iterator &start); QString interfacesFile; QStringList interfaces; QStringList::Iterator currentIface; diff --git a/noncore/settings/networksettings/interfaces/interfacesetup.ui b/noncore/settings/networksettings/interfaces/interfacesetup.ui index ab8e413..df55d25 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetup.ui +++ b/noncore/settings/networksettings/interfaces/interfacesetup.ui @@ -98,8 +98,12 @@ <name>minValue</name> <number>1</number> </property> <property stdset="1"> + <name>lineStep</name> + <number>24</number> + </property> + <property stdset="1"> <name>value</name> <number>168</number> </property> </widget> @@ -250,8 +254,30 @@ </property> </spacer> </vbox> </widget> +<customwidgets> + <customwidget> + <class>QWidget</class> + <header location="local">qwidget.h</header> + <sizehint> + <width>100</width> + <height>100</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>7</hordata> + <verdata>7</verdata> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image> + <name>image0</name> + <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> +</images> <connections> <connection> <sender>dhcpCheckBox</sender> <signal>toggled(bool)</signal> diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.h b/noncore/settings/networksettings/interfaces/interfacesetupimp.h index a88e190..60933aa 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.h +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.h @@ -20,9 +20,8 @@ public slots: private: Interfaces *interfaces; Interface *interface; - }; #include <qlayout.h> diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 48ef9b3..7b93554 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -29,9 +29,9 @@ #include <sys/ioctl.h>
#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
-MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){
+MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false), scheme(DEFAULT_SCHEME){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
@@ -188,9 +188,9 @@ void MainWindowImp::getAllInterfaces(){ * 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(QString path){
+void MainWindowImp::loadModules(const QString &path){
//qDebug(path.latin1());
QDir d(path);
if(!d.exists())
return;
@@ -213,9 +213,9 @@ void MainWindowImp::loadModules(QString path){ * @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(QString pluginFileName, QString resolveString){
+Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){
//qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer ){
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h index 382428c..4f09d6c 100644 --- a/noncore/settings/networksettings/mainwindowimp.h +++ b/noncore/settings/networksettings/mainwindowimp.h @@ -32,12 +32,12 @@ private slots: void updateInterface(Interface *i);
void newProfileChanged(const QString& newText);
private:
- void loadModules(QString path);
+ void loadModules(const QString &path);
- Module* loadPlugin(QString pluginFileName,
- QString resolveString = "create_plugin");
+ Module* loadPlugin(const QString &pluginFileName,
+ const QString &resolveString = "create_plugin");
// For our local list of names
QMap<QString, Interface*> interfaceNames;
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h index 92b125a..2e6272b 100644 --- a/noncore/settings/networksettings/module.h +++ b/noncore/settings/networksettings/module.h @@ -21,9 +21,9 @@ public: * The current profile has been changed and the module should do any * neccesary changes also. * @param newProfile what the profile should be changed to. */ - virtual void setProfile(QString newProfile) = 0; + virtual void setProfile(const QString &newProfile) = 0; /** * get the icon name for this device. * @param Interface* can be used in determining the icon. @@ -69,9 +69,9 @@ public: * Attempts to create a new interface from name * @return Interface* NULL if it was unable to be created. * @param name the type of interface to create */ - virtual Interface *addNewInterface(QString name) = 0; + virtual Interface *addNewInterface(const QString &name) = 0; /** * Attempts to remove the interface, doesn't delete i * @return bool true if successfull, false otherwise. diff --git a/noncore/settings/networksettings/wlan/infoimp.h b/noncore/settings/networksettings/wlan/infoimp.h index 5311bea..8f7f0d6 100644 --- a/noncore/settings/networksettings/wlan/infoimp.h +++ b/noncore/settings/networksettings/wlan/infoimp.h @@ -3,9 +3,9 @@ #include "info.h" class QTimer; -class WExtensions; +//class WExtensions; class WlanInfoImp : public WlanInfo { Q_OBJECT diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index eb6fc42..6335ebc 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp @@ -15,10 +15,9 @@ /** * Constructor. Sets hasWirelessExtensions */ -WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false){ - interface = interfaceName; +WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { fd = socket( AF_INET, SOCK_DGRAM, 0 ); if(fd == -1) return; diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 689eae2..d4b4af9 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp @@ -43,9 +43,9 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W /** * Change the profile for both wireless settings and network settings. */ -void WLANImp::setProfile(QString &profile){ +void WLANImp::setProfile(const QString &profile){ interfaceSetup->setProfile(profile); parseSettingFile(); } diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h index f88e550..df599af 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.h +++ b/noncore/settings/networksettings/wlan/wlanimp.h @@ -12,9 +12,9 @@ class WLANImp : public WLAN { Q_OBJECT public: WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); - void setProfile(QString &profile); + void setProfile(const QString &profile); protected: void accept(); diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index b14fc0a..3979e60 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp @@ -25,9 +25,9 @@ WLANModule::~WLANModule(){ /** * Change the current profile */ -void WLANModule::setProfile(QString newProfile){ +void WLANModule::setProfile(const QString &newProfile){ profile = newProfile; } /** @@ -93,9 +93,9 @@ QList<Interface> WLANModule::getInterfaces(){ * @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 *WLANModule::addNewInterface(QString ){ +Interface *WLANModule::addNewInterface(const QString &){ // We can't add a 802.11 interface, either the hardware will be there // or it wont. return NULL; } diff --git a/noncore/settings/networksettings/wlan/wlanmodule.h b/noncore/settings/networksettings/wlan/wlanmodule.h index a81ccff..3a54de6 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.h +++ b/noncore/settings/networksettings/wlan/wlanmodule.h @@ -11,17 +11,17 @@ signals: public: WLANModule(); ~WLANModule(); - virtual void setProfile(QString newProfile); - virtual bool isOwner(Interface *); - virtual QWidget *configure(Interface *i); - virtual QWidget *information(Interface *i); - virtual QList<Interface> getInterfaces(); - virtual void possibleNewInterfaces(QMap<QString, QString> &){}; - virtual Interface *addNewInterface(QString name); - virtual bool remove(Interface* i); - virtual QString getPixmapName(Interface* i); + void setProfile(const QString &newProfile); + bool isOwner(Interface *); + QWidget *configure(Interface *i); + QWidget *information(Interface *i); + QList<Interface> getInterfaces(); + void possibleNewInterfaces(QMap<QString, QString> &){}; + Interface *addNewInterface(const QString &name); + bool remove(Interface* i); + QString getPixmapName(Interface* i); private: QList<Interface> list; QString profile; |