summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp8
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp44
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp2
-rw-r--r--noncore/settings/networksettings/module.h2
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp2
7 files changed, 31 insertions, 31 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index 69b55d1..b00b899 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -65,68 +65,68 @@ void Interface::setModuleOwner(Module *owner){
/**
* Try to start the interface.
*/
void Interface::start(){
// check to see if we are already running.
if(true == status){
emit (updateMessage("Unable to start interface,\n already started"));
return;
}
int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
- // See if it was successfull...
+ // See if it was successful...
if(ret != 0){
emit (updateMessage("Starting interface failed"));
return;
}
status = true;
refresh();
- emit (updateMessage("Start successfull"));
+ emit (updateMessage("Start successful"));
}
/**
* Try to stop the interface.
*/
void Interface::stop(){
// check to see if we are already stopped.
if(false == status){
emit (updateMessage("Unable to stop interface,\n already stopped"));
return;
}
int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
if(ret != 0){
emit (updateMessage("Stopping interface failed"));
return;
}
status = false;
refresh();
- emit (updateMessage("Stop successfull"));
+ emit (updateMessage("Stop successful"));
}
/**
* Try to restart the interface.
*/
void Interface::restart(){
stop();
start();
}
/**
* Try to refresh the information about the interface.
* First call ifconfig, then check the dhcp-info file
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interface::refresh(){
// See if we are up.
if(status == false){
macAddress = "";
ip = "0.0.0.0";
subnetMask = "0.0.0.0";
broadcast = "";
dhcp = false;
dhcpServerIp = "";
leaseObtained = "";
leaseExpires = "";
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 436e449..6b161ae 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -35,25 +35,25 @@ Interfaces::Interfaces(QString useInterfacesFile){
line += stream.readLine();
line += "\n";
}
file.close();
interfaces = QStringList::split("\n", line, true);
currentIface = interfaces.end();
currentMapping = interfaces.end();
}
/**
- * Get a list of all interfaces in the interface file. Usefull for
+ * Get a list of all interfaces in the interface file. Useful for
* hardware that is not currently connected such as an 802.11b card
* not plugged in, but configured for when it is plugged in.
* @return Return string list of interfaces.
**/
QStringList Interfaces::getInterfaceList(){
QStringList list;
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
QString line = (*it).simplifyWhiteSpace();
if(line.contains(IFACE) && line.at(0) != '#'){
line = line.mid(QString(IFACE).length() +1, line.length());
line = line.simplifyWhiteSpace();
int findSpace = line.find(" ");
@@ -117,64 +117,64 @@ bool Interfaces::setAuto(const QString &interface, bool setAuto){
}
// In the case where there is no AUTO field add one.
if(!changed && setAuto)
interfaces.append(QString(AUTO" %1").arg(interface));
return true;
}
/**
* Set the current interface to interface. This needs to be done before you
* can call getFamily(), getMethod, and get/setOption().
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
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() 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.
+ * @return true if successful.
*/
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
qDebug("Interfaces::addInterface(%s)",interface.latin1());
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 successfull
+ * @return bool true if successful
*/
bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
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;
@@ -188,25 +188,25 @@ bool Interfaces::copyInterface(const QString &interface, const QString &newInter
// Copy all of the lines
for ( ; it != interfaces.end(); ++it ){
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)))
break;
newIface = interfaces.insert(newIface, *it);
}
return true;
}
/**
* Remove the currently selected interface and all of its options.
- * @return bool if successfull or not.
+ * @return bool if successful or not.
*/
bool Interfaces::removeInterface(){
return removeStanza(currentIface);
}
/**
* Gets the hardware name of the interface that is currently selected.
* @return QString name of the hardware interface (eth0, usb2, wlan1...).
* @param error set to true if any error occurs, false otherwise.
*/
QString Interfaces::getInterfaceName(bool &error){
if(currentIface == interfaces.end()){
@@ -263,60 +263,60 @@ QString Interfaces::getInterfaceMethod(bool &error){
QString line = (*currentIface);
line = line.mid(QString(IFACE).length()+1, line.length());
line = line.mid(name.length()+1, line.length());
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 successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceName(const QString &newName){
qDebug("setInterfaceName %s", newName.latin1());
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());
(*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 successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceFamily(const QString &newName){
if(currentIface == interfaces.end())
return false;
if(acceptedFamily.contains(newName)==0)
return false;
bool returnValue = false;
(*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue));
return !returnValue;
}
/**
* Sets the interface method to newName
* @param newName the new name of the interface
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
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);
return !returnValue;
}
/**
* Get a value for an option in the currently selected interface. For example
* calling getInterfaceOption("address") on the following stanza would
@@ -363,115 +363,115 @@ bool Interfaces::removeInterfaceOption(const QString &option){
* Removes a value for an option in the currently selected interface.
* @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::removeInterfaceOption(const QString &option, const QString &value){
return removeOption(currentIface, option, value);
}
/**
* Removes all of the options from the currently selected interface.
- * @return bool error if if successfull
+ * @return bool error if if successful
*/
bool Interfaces::removeAllInterfaceOptions(){
return removeAllOptions(currentIface);
}
/**
* Set the current map to interface's map. This needs to be done before you
* can call addMapping(), set/getMap(), and get/setScript().
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
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(const QString &option){
interfaces.append("");
interfaces.append(QString(MAPPING " %1").arg(option));
}
/**
* Remove the currently selected map and all of its options.
- * @return bool if successfull or not.
+ * @return bool if successful or not.
*/
bool Interfaces::removeMapping(){
return removeStanza(currentMapping);
}
/**
* Set a map option within a mapping.
* @param map map to use
* @param value value to go with map
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::setMap(const QString &map, const QString &value){
return setOption(currentMapping, map, value);
}
/**
* Removes a map option within a mapping.
* @param map map to use
* @param value value to go with map
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::removeMap(const QString &map, const QString &value){
return removeOption(currentMapping, map, value);
}
/**
* Get a map value within a mapping.
* @param map map to get value of
- * @param bool true if it is successfull.
+ * @param bool true if it is successful.
* @return value that goes to the map
*/
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.
+ * @return true if successful.
*/
bool Interfaces::setScript(const QString &argument){
return setOption(currentMapping, "script", argument);
}
/**
* @param error true if could not retrieve the current script argument.
* @return QString the argument of the script for the current mapping.
*/
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.
+ * @param interator interator to place at location of stanza if successful.
* @return bool true if the stanza is found.
*/
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();
if(line.contains(stanza) && line.contains(option) && line.at(0) != '#'){
uint point = line.find(option);
bool valid = true;
if(point > 0){
// There are more chars in the line. check +1
@@ -491,25 +491,25 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
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 successfull, false otherwise.
+ * @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");
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());
// 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
@@ -545,38 +545,38 @@ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &op
}
if(found && !replaced){
qDebug("found iface but not the option so insert it here...");
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 successfull.
+ * @return bool true if successful.
*/
bool Interfaces::removeStanza(QStringList::Iterator &stanza){
if(stanza == interfaces.end())
return false;
(*stanza) = "";
return removeAllOptions(stanza);
}
/**
* Removes a option in a stanza
* @param start the start of the stanza
* @param option the option to remove
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option){
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) != '#'){
@@ -586,25 +586,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
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.
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
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) != '#'){
@@ -613,25 +613,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
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 successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
if(start == interfaces.end())
return false;
QStringList::Iterator it = start;
it = ++it;
for (; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
break;
}
it = interfaces.remove(it);
@@ -671,25 +671,25 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
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 successfull, false if not.
+ * @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());
return false;
}
QTextStream stream( &file );
int whiteSpaceCount = 0;
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index e844d8a..78466d0 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -74,25 +74,25 @@ bool InterfaceSetupImp::saveChanges(){
}
owait->hide();
delete owait;
interface->refresh();
}
return true;
}
/**
* Save the settings for the current Interface.
- * @return bool true if successfull, false otherwise
+ * @return bool true if successful, false otherwise
*/
bool InterfaceSetupImp::saveSettings(){
// eh can't really do anything about it other then return. :-D
if(!interfaces->isInterfaceSet())
return true;
bool error = false;
// Loopback case
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h
index f7d8046..5cc82cd 100644
--- a/noncore/settings/networksettings/module.h
+++ b/noncore/settings/networksettings/module.h
@@ -76,25 +76,25 @@ public:
*/
virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
/**
* 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(const QString &name) = 0;
/**
* Attempts to remove the interface, doesn't delete i
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
virtual bool remove(Interface* i) = 0;
/**
* get dcop calls
*/
virtual void receive(const QCString &msg, const QByteArray &arg) = 0;
QStringList handledInterfaceNames()const { return m_inter; }
protected:
/**
* set which interfaceNames should not be shown cause they're handled
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index af05eb7..2462fa4 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -171,25 +171,25 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){
iface->setModuleOwner( this );
list.append( iface );
return iface;
}else {
delete ifaceppp;
iface = NULL;
}
return iface;
}
/**
* Attempts to remove the interface, doesn't delete i
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool PPPModule::remove(Interface *i){
return list.remove(i);
}
void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
{
newIfaces.insert(QObject::tr("PPP") ,
QObject::tr("generic ppp device"));
}
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp
index bd7cf93..d1fff88 100644
--- a/noncore/settings/networksettings/wlan/wextensions.cpp
+++ b/noncore/settings/networksettings/wlan/wextensions.cpp
@@ -146,25 +146,25 @@ QString WExtensions::ap(){
iwr.u.ap_addr.sa_data[4]&0xff,
iwr.u.ap_addr.sa_data[5]&0xff );
return ap;
}
else return QString();
}
/**
* Get the stats for interfaces
* @param signal the signal strength of interface
* @param noise the noise level of the interface
* @param quality the quality level of the interface
- * @return bool true if successfull
+ * @return bool true if successful
*/
bool WExtensions::stats(int &signal, int &noise, int &quality){
// gather link quality from /proc/net/wireless
if(!QFile::exists(PROCNETWIRELESS))
return false;
char c;
QString status;
QString name;
QFile wfile( PROCNETWIRELESS );
if(!wfile.open( IO_ReadOnly ))
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index b4c3509..07bf73f 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -101,25 +101,25 @@ 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(const QString &){
// We can't add a 802.11 interface, either the hardware will be there
// or it wont.
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
- * @return bool true if successfull, false otherwise.
+ * @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);
QStringList params = QStringList::split(",",param);
int count = params.count();
qDebug("WLANModule got %i params", count );