author | simon <simon> | 2003-01-03 21:24:40 (UTC) |
---|---|---|
committer | simon <simon> | 2003-01-03 21:24:40 (UTC) |
commit | e483d88ee4158ba13d8c28b020d0e93b62e86d85 (patch) (side-by-side diff) | |
tree | 2c4ac27cf05428ad58257869c90a9ce51c4e43d3 | |
parent | 91395e6cd4d104b05f962ae8833767bbbd094163 (diff) | |
download | opie-e483d88ee4158ba13d8c28b020d0e93b62e86d85.zip opie-e483d88ee4158ba13d8c28b020d0e93b62e86d85.tar.gz opie-e483d88ee4158ba13d8c28b020d0e93b62e86d85.tar.bz2 |
- these have been renamed to networksettings
44 files changed, 0 insertions, 6404 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO deleted file mode 100644 index 6457836..0000000 --- a/noncore/net/networksetup/TODO +++ b/dev/null @@ -1,93 +0,0 @@ -Types: --Ethernet Connection (Done) --ISDN Connection --Modem COnnection (Started) --xDSL connection --Token Ring Connection --CIPE (VPN) connection (ipsec?) --Wireless Connection (Done) --Bluetooth --IPChains? - -test WEP -Add WEP transimtion rate -1 or 2 -5.5 -1 -Auto - -udchcp needs to output the dhcp information so interfaces can read it - -interfacesetupimp really doesn't need a interface* pointer - -PPP module needs to scan pppd.tdb to see what is currently active - -WLAN -- add possiblity to input text or hex without knowing "s:" -- Handle "any" and any the same way in config - -Interface setupimp needs to use kernel calls. - -Add a route/DNS editor under the ViewAdvancedInfo button - -Use a true TCP/IP widget - -Make it so that pcmcia doesn't need to be stopped/started for wlan - -Automaticly update the main list of interfaces: -> That would be me. :-D netlink, can you point me in the right -> direction where I can get more info on it? (I figured there was some -> kenel call) - -You can look up the meaning of the packets you receive, or you can just go -poll for changes you might be interested in each time you receive _any_ -packet. Anything's better than periodic polling. - -Note that you can't do this as non-root on some kernels. There's a patch -which can go into the hh.org kernel if it's not already there. -cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 - - -#include <asm/types.h> -#include <sys/socket.h> -#include <linux/netlink.h> -#include <linux/rtnetlink.h> - -int main(int argc, char **argv) -{ - int fd; - unsigned char buf[4096]; - int ret; - int i, j; - struct sockaddr_nl snl; - - fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); - if (fd < 0) { - perror("socket"); - exit(1); - } - - snl.nl_family = AF_NETLINK; - snl.nl_pad = 0; - snl.nl_pid = getpid(); - snl.nl_groups = RTM_NEWLINK|RTM_DELLINK; - - if (bind(fd, &snl, sizeof(snl)) < 0) { - perror("bind"); - exit(1); - } - while (1) { - ret = recv(fd, buf, 4096, 0); - if (ret < 0) { - perror("recv"); - exit(1); - } - for (i=0; i<ret; i++) { - printf("%02x ", buf[i]); - } - printf("\n"); - } - -} --- - diff --git a/noncore/net/networksetup/addconnection.ui b/noncore/net/networksetup/addconnection.ui deleted file mode 100644 index da6cf06..0000000 --- a/noncore/net/networksetup/addconnection.ui +++ b/dev/null @@ -1,158 +0,0 @@ -<!DOCTYPE UI><UI> -<class>AddConnection</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>AddConnection</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>229</width> - <height>268</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Add Network Connection</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="3" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>cancelButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Cancel</string> - </property> - </widget> - <widget row="3" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>addButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Add</string> - </property> - </widget> - <widget row="0" column="0" rowspan="1" colspan="2" > - <class>QListView</class> - <column> - <property> - <name>text</name> - <string>Services</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <property stdset="1"> - <name>name</name> - <cstring>registeredServicesList</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>3</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>minimumSize</name> - <size> - <width>0</width> - <height>75</height> - </size> - </property> - </widget> - <spacer row="2" column="1" > - <property> - <name>name</name> - <cstring>Spacer12</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="1" column="0" rowspan="1" colspan="2" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>help</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>4</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - <property stdset="1"> - <name>alignment</name> - <set>WordBreak|AlignTop|AlignLeft</set> - </property> - <property> - <name>vAlign</name> - </property> - <property> - <name>wordwrap</name> - </property> - </widget> - </grid> -</widget> -<connections> - <connection> - <sender>cancelButton</sender> - <signal>clicked()</signal> - <receiver>AddConnection</receiver> - <slot>reject()</slot> - </connection> - <connection> - <sender>addButton</sender> - <signal>clicked()</signal> - <receiver>AddConnection</receiver> - <slot>accept()</slot> - </connection> -</connections> -<tabstops> - <tabstop>registeredServicesList</tabstop> - <tabstop>addButton</tabstop> - <tabstop>cancelButton</tabstop> -</tabstops> -</UI> diff --git a/noncore/net/networksetup/addconnectionimp.cpp b/noncore/net/networksetup/addconnectionimp.cpp deleted file mode 100644 index 07545f7..0000000 --- a/noncore/net/networksetup/addconnectionimp.cpp +++ b/dev/null @@ -1,37 +0,0 @@ -#include "addconnectionimp.h" -#include <qlistview.h> -#include <qlist.h> -#include <qlabel.h> -#include <qheader.h> - -/** - * Constructor - */ -AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){ - connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed())); - registeredServicesList->header()->hide(); -}; - -/** - * The current item changed, update the discription. - */ -void AddConnectionImp::changed(){ - QListViewItem *item = registeredServicesList->currentItem(); - 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(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()); - registeredServicesList->setCurrentItem(registeredServicesList->firstChild()); -} - -// addserviceimp.cpp - diff --git a/noncore/net/networksetup/addconnectionimp.h b/noncore/net/networksetup/addconnectionimp.h deleted file mode 100644 index 680a502..0000000 --- a/noncore/net/networksetup/addconnectionimp.h +++ b/dev/null @@ -1,29 +0,0 @@ -#ifndef ADDCONNECTIONIMP_H -#define ADDCONNECTIONIMP_H - -#include "addconnection.h" -#include <qmap.h> -#include <qlist.h> - -class QListViewItem; - -class AddConnectionImp : public AddConnection { - -Q_OBJECT - -public: - AddConnectionImp(QWidget *parent=0, const char *name=0, WFlags f=0); - void addConnections(const QMap<QString, QString> &newList); - -private slots: - void changed(); - -private: - QMap<QString, QString> list; - -}; - -#endif - -// addconectionimp.h - diff --git a/noncore/net/networksetup/config.in b/noncore/net/networksetup/config.in deleted file mode 100644 index 0f2c878..0000000 --- a/noncore/net/networksetup/config.in +++ b/dev/null @@ -1,12 +0,0 @@ -config NETWORKSETUP - boolean "Networksetup" - default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE - -config NETWORKSETUP-CORE - boolean - default "y" if NETWORKSETUP - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && INTERFACES - - source noncore/net/networksetup/wlan/config.in - source noncore/net/networksetup/interfaces/config.in diff --git a/noncore/net/networksetup/defaultmodule.h b/noncore/net/networksetup/defaultmodule.h deleted file mode 100644 index c7791d5..0000000 --- a/noncore/net/networksetup/defaultmodule.h +++ b/dev/null @@ -1,26 +0,0 @@ -#ifndef MODULE_H -#define MODULE_H - -#include "module.h" - -class QWidget; - -class DefaultModule : Module{ - -public: - DefaultModule(){}; - - virtual bool isOwner(Interface *i); - virtual QWidget *configure(); - virtual QWidget *information()}; - virtual QList<Interface> getInterfaces(); - virtual QMap<QString, QString> possibleNewInterfaces(); - virtual Interface *addNewInterface(QString name); - virtual bool remove(Interface* i); - -}; - -#endif - -// module.h - diff --git a/noncore/net/networksetup/interfaces/config.in b/noncore/net/networksetup/interfaces/config.in deleted file mode 100644 index 6c21aeb..0000000 --- a/noncore/net/networksetup/interfaces/config.in +++ b/dev/null @@ -1,4 +0,0 @@ - config INTERFACES - boolean - default "y" if NETWORKSETUP - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/noncore/net/networksetup/interfaces/interface.cpp b/noncore/net/networksetup/interfaces/interface.cpp deleted file mode 100644 index d964961..0000000 --- a/noncore/net/networksetup/interfaces/interface.cpp +++ b/dev/null @@ -1,297 +0,0 @@ -#include "interface.h" -#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), 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(); - } -}; - -/** - * Set if attached or not (802.11 card pulled out for example) - * @param isAttached - if attached - * emit updateInterface - */ -void Interface::setAttached(bool isAttached){ - attached = isAttached; - emit(updateInterface(this)); -}; - -/** - * Set Hardware name - * @param name - the new name - * emit updateInterface - */ -void Interface::setHardwareName(const QString &name){ - hardwareName = name; - emit(updateInterface(this)); -}; - -/** - * Set Module owner - * @param owner - the new owner - * emit updateInterface - */ -void Interface::setModuleOwner(Module *owner){ - moduleOwner = owner; - emit(updateInterface(this)); -}; - - -/** - * 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... - if(ret != 0){ - emit (updateMessage("Starting interface failed")); - return; - } - - status = true; - refresh(); - emit (updateMessage("Start successfull")); -} - -/** - * 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")); -} - -/** - * 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. - */ -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 = ""; - emit(updateInterface(this)); - return true; - } - - QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); - int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); - if(ret != 0){ - qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); - return false; - } - - QFile file(fileName); - if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); - return false; - } - - // Set to the defaults - macAddress = ""; - ip = "0.0.0.0"; - subnetMask = "0.0.0.0"; - broadcast = ""; - - QTextStream stream( &file ); - QString line; - while ( !stream.eof() ) { - line = stream.readLine(); - if(line.contains("HWaddr")){ - int mac = line.find("HWaddr"); - macAddress = line.mid(mac+7, line.length()); - } - if(line.contains("inet addr")){ - int ipl = line.find("inet addr"); - int space = line.find(" ", ipl+10); - ip = line.mid(ipl+10, space-ipl-10); - } - if(line.contains("Mask")){ - int mask = line.find("Mask"); - subnetMask = line.mid(mask+5, line.length()); - } - if(line.contains("Bcast")){ - int mask = line.find("Bcast"); - int space = line.find(" ", mask+6); - broadcast = line.mid(mask+6, space-mask-6); - } - } - file.close(); - QFile::remove(fileName); - - // DHCP TESTING - // reset DHCP info - dhcpServerIp = ""; - leaseObtained = ""; - leaseExpires = ""; - dhcp = false; - - QString dhcpDirectory(DHCP_INFO_DIR); - QDir d(dhcpDirectory); - if(!d.exists(dhcpDirectory)) - dhcpDirectory = "/var/run"; - - // See if we have - QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); - // If there is no DHCP information then exit now with no errors. - if(!QFile::exists(dhcpFile)){ - emit(updateInterface(this)); - return true; - } - - file.setName(dhcpFile); - if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); - return false; - } - - // leaseTime and renewalTime and used if pid and deamon exe can be accessed. - int leaseTime = 0; - int renewalTime = 0; - - stream.setDevice( &file ); - while ( !stream.eof() ) { - line = stream.readLine(); - if(line.contains("DHCPSIADDR=")) - dhcpServerIp = line.mid(11, line.length()); - if(line.contains("LEASETIME=")) - leaseTime = line.mid(10, line.length()).toInt(); - if(line.contains("RENEWALTIME=")) - renewalTime = line.mid(12, line.length()).toInt(); - } - file.close(); - //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); - //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); - - // Get the pid of the deamond - dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name())); - file.setName(dhcpFile); - if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); - return false; - } - - int pid = -1; - stream.setDevice( &file ); - while ( !stream.eof() ) { - line = stream.readLine(); - pid = line.toInt(); - } - file.close(); - - if( pid == -1){ - qDebug("Interface: Could not get pid of dhcpc deamon."); - return false; - } - - // Get the start running time of the deamon - fileName = (QString("/proc/%1/stat").arg(pid)); - file.setName(fileName); - stream.setDevice( &file ); - if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); - return false; - } - while ( !stream.eof() ) { - line = stream.readLine(); - } - file.close(); - long time = 0; - // Grab the start time - // pid com state ppid pgrp session tty_nr tpgid flags - sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " - // minflt cminflt majflt cmajflt utime stime cutime cstime priority - "%*u %*u %*u %*u %*u %*u %*d %*d %*d " - // nice 0 itrealvalue starttime - "%*d %*d %*d %lu", (long*) &time); - time = time/100; - - QDateTime datetime(QDateTime::currentDateTime()); - - // Get the uptime of the computer. - QFile f("/proc/uptime"); - if ( f.open(IO_ReadOnly) ) { // file opened successfully - QTextStream t( &f ); // use a text stream - int sec = 0; - t >> sec; - datetime = datetime.addSecs((-1*sec)); - f.close(); - } - else{ - qDebug("Interface: Can't open /proc/uptime to retrive uptime."); - return false; - } - - datetime = datetime.addSecs(time); - //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1()); - - // Calculate the start and renew times - leaseObtained = datetime.toString(); - - // Calculate the start and renew times - datetime = datetime.addSecs(leaseTime); - leaseExpires = datetime.toString(); - - dhcp = true; - - emit(updateInterface(this)); - return true; -} - -// interface.cpp - diff --git a/noncore/net/networksetup/interfaces/interface.h b/noncore/net/networksetup/interfaces/interface.h deleted file mode 100644 index d37834a..0000000 --- a/noncore/net/networksetup/interfaces/interface.h +++ b/dev/null @@ -1,72 +0,0 @@ -#ifndef INTERFACE_H -#define INTERFACE_H - -#include <qstring.h> -#include <qobject.h> - -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() const { QString n(this->name()); return n; }; - - bool getStatus() const { return status; }; - void setStatus(bool newStatus); - - bool isAttached() const { return attached; }; - void setAttached(bool isAttached=false); - - QString getHardwareName() const { return hardwareName; }; - void setHardwareName(const QString &name="Unknown"); - - Module* getModuleOwner() const { return moduleOwner; }; - void setModuleOwner(Module *owner=NULL); - - // inet information. - 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 - QString hardwareName; - Module *moduleOwner; - bool status; - bool attached; - - // Network information - 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/interfaceadvanced.ui b/noncore/net/networksetup/interfaces/interfaceadvanced.ui deleted file mode 100644 index 9d9f98e..0000000 --- a/noncore/net/networksetup/interfaces/interfaceadvanced.ui +++ b/dev/null @@ -1,344 +0,0 @@ -<!DOCTYPE UI><UI> -<class>InterfaceAdvanced</class> -<widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>InterfaceAdvanced</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>214</width> - <height>290</height> - </rect> - </property> - <property stdset="1"> - <name>maximumSize</name> - <size> - <width>240</width> - <height>32767</height> - </size> - </property> - <property stdset="1"> - <name>caption</name> - <string>Advanced Interface Information</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>interfaceName</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>eth0</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>IP Address</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel7</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Interface</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>Subnet Mask</string> - </property> - </widget> - <widget row="1" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>ipAddressLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>0.0.0.0</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>subnetMaskLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>0.0.0.0</string> - </property> - </widget> - <spacer row="6" column="1" > - <property> - <name>name</name> - <cstring>Spacer2</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="5" column="0" rowspan="1" colspan="2" > - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>dhcpInformation</cstring> - </property> - <property stdset="1"> - <name>title</name> - <string>DHCP Information</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel6</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>DHCP Server</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>leaseExpiresLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - <widget row="1" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>leaseObtainedLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel9</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Lease Expires</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel8</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Lease Obtained</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>dhcpServerLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - </grid> - </widget> - <widget row="4" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Broadcast</string> - </property> - </widget> - <widget row="4" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>broadcastLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>MAC Address</string> - </property> - </widget> - <widget row="3" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>macAddressLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>00:00:00:00:00:00</string> - </property> - </widget> - </grid> -</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> -</UI> diff --git a/noncore/net/networksetup/interfaces/interfaceinformation.ui b/noncore/net/networksetup/interfaces/interfaceinformation.ui deleted file mode 100644 index e49e09f..0000000 --- a/noncore/net/networksetup/interfaces/interfaceinformation.ui +++ b/dev/null @@ -1,343 +0,0 @@ -<!DOCTYPE UI><UI> -<class>InterfaceInformation</class> -<widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>InterfaceInformation</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>219</width> - <height>255</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Interface Information</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="4" column="0" rowspan="1" colspan="2" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout1</cstring> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="1" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>refreshButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Refresh</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>stopButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>S&top</string> - </property> - </widget> - <widget row="1" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>restartButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>R&estart</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>startButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Start</string> - </property> - </widget> - </grid> - </widget> - <widget row="0" column="0" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>Line1</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel22</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>IP Address</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel23</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Subnet Mask</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel21</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>MAC Address</string> - </property> - </widget> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel24</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>MShape</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>MShadow</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>Broadcast</string> - </property> - </widget> - <widget row="1" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>subnetMaskLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>0.0.0.0</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>macAddressLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>00:00:00:00:00:00</string> - </property> - </widget> - <widget row="3" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>broadcastLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - <widget row="0" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>ipAddressLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>0.0.0.0</string> - </property> - </widget> - <spacer row="7" column="1" > - <property> - <name>name</name> - <cstring>Spacer18</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="6" column="0" rowspan="1" colspan="2" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout2</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <spacer> - <property> - <name>name</name> - <cstring>Spacer10</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>advancedButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&View Advanced Information</string> - </property> - </widget> - </hbox> - </widget> - <widget row="5" column="0" rowspan="1" colspan="2" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>Line5</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - </grid> -</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> -<tabstops> - <tabstop>startButton</tabstop> - <tabstop>stopButton</tabstop> - <tabstop>refreshButton</tabstop> - <tabstop>restartButton</tabstop> - <tabstop>advancedButton</tabstop> -</tabstops> -</UI> diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp deleted file mode 100644 index 1fa5d38..0000000 --- a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp +++ b/dev/null @@ -1,76 +0,0 @@ -#include "interfaceinformationimp.h" -#include "interfaceadvanced.h" - -#include <qpushbutton.h> -#include <qlabel.h> -#include <qgroupbox.h> -#include <qmessagebox.h> - -/** - * Constructor for the InterfaceInformationImp class. This class pretty much - * just display's information about the interface that is passed to it. - */ -InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ - connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); - connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); - updateInterface(interface); - connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); - connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); - connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); - connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); - connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); -} - -/** - * Update the interface information and buttons. - * @param Intarface *i the interface to update (should be the one we already - * know about). - */ -void InterfaceInformationImp::updateInterface(Interface *){ - if(interface->getStatus()){ - startButton->setEnabled(false); - stopButton->setEnabled(true); - restartButton->setEnabled(true); - } - else{ - startButton->setEnabled(true); - stopButton->setEnabled(false); - restartButton->setEnabled(false); - } - macAddressLabel->setText(interface->getMacAddress()); - ipAddressLabel->setText(interface->getIp()); - subnetMaskLabel->setText(interface->getSubnetMask()); - broadcastLabel->setText(interface->getBroadcast()); -} - -/** - * Create the advanced widget. Fill it with the current interface's information. - * Display it. - */ -void InterfaceInformationImp::advanced(){ - InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); - a->interfaceName->setText(interface->getInterfaceName()); - a->macAddressLabel->setText(interface->getMacAddress()); - a->ipAddressLabel->setText(interface->getIp()); - a->subnetMaskLabel->setText(interface->getSubnetMask()); - a->broadcastLabel->setText(interface->getBroadcast()); - a->dhcpServerLabel->setText(interface->getDhcpServerIp()); - a->leaseObtainedLabel->setText(interface->getLeaseObtained()); - a->leaseExpiresLabel->setText(interface->getLeaseExpires()); - a->dhcpInformation->setEnabled(interface->isDhcp()); - - a->showMaximized(); - a->show(); -} - -/** - * Messages from the interface if start/stop went as planned. - * Purly for user feedback. - * @param message the message to display. - */ -void InterfaceInformationImp::showMessage(const QString &message){ - QMessageBox::information(this, "Message", message, QMessageBox::Ok); -} - -// infoimp.cpp - diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.h b/noncore/net/networksetup/interfaces/interfaceinformationimp.h deleted file mode 100644 index 65cdfe0..0000000 --- a/noncore/net/networksetup/interfaces/interfaceinformationimp.h +++ b/dev/null @@ -1,28 +0,0 @@ -#ifndef INTERFACEINFORMATIONIMP_H -#define INTERFACEINFORMATIONIMP_H - -#include "interfaceinformation.h" -#include "interface.h" - -class InterfaceInformationImp : public InterfaceInformation { - -Q_OBJECT - -public: - InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0); - ~InterfaceInformationImp(){}; - -private slots: - void advanced(); - void updateInterface(Interface *i); - void showMessage(const QString &message); - -private: - Interface *interface; - -}; - -#endif - -// addserviceimp.h - diff --git a/noncore/net/networksetup/interfaces/interfaces.cpp b/noncore/net/networksetup/interfaces/interfaces.cpp deleted file mode 100644 index 8f685fe..0000000 --- a/noncore/net/networksetup/interfaces/interfaces.cpp +++ b/dev/null @@ -1,643 +0,0 @@ -#include "interfaces.h" - -#include <qfile.h> -#include <qtextstream.h> -#include <qregexp.h> - -// The three stanza's -#define AUTO "auto" -#define IFACE "iface" -#define MAPPING "mapping" - -/** - * Constructor. Reads in the interfaces file and then split the file up by - * the \n for interfaces variable. - * @param useInterfacesFile if an interface file other then the default is - * desired to be used it should be passed in. - */ -Interfaces::Interfaces(QString useInterfacesFile){ - acceptedFamily.append(INTERFACES_FAMILY_INET); - acceptedFamily.append(INTERFACES_FAMILY_IPX); - acceptedFamily.append(INTERFACES_FAMILY_INET6); - - interfacesFile = useInterfacesFile; - QFile file(interfacesFile); - if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interfaces: Can't open file: %1 for reading.").arg(interfacesFile).latin1()); - currentIface = interfaces.end(); - currentMapping = interfaces.end(); - return; - } - QTextStream stream( &file ); - QString line; - while ( !stream.eof() ) { - line += stream.readLine(); - line += "\n"; - } - file.close(); - interfaces = QStringList::split("\n", line, true); - - currentIface = interfaces.end(); - currentMapping = interfaces.end(); -} - - -/** - * Get a list of all interfaces in the interface file. Usefull 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(" "); - if( findSpace >= 0){ - line = line.mid(0, findSpace); - list.append(line); - } - } - } - 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) 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 - * @param setAuto the value to set interface to. - * @return false if already set to setAuto. - * */ -bool Interfaces::setAuto(const QString &interface, bool setAuto){ - // Don't need to set it if it is already set. - if(isAuto(interface) == setAuto) - return false; - - bool changed = false; - for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { - if((*it).contains(AUTO)){ - //We know that they are not in any group so let add to this auto. - if(setAuto){ - (*it) = (*it) += " " + interface; - // Don't care to have such thins as: auto eth0 lo usb0 - (*it) = (*it).simplifyWhiteSpace(); - changed = true; - break; - } - // else see if we need to remove from this one - else{ - if((*it).contains(interface)){ - (*it) = (*it).replace(QRegExp(interface), ""); - // if AUTO is the only thing left clear the line - if(((*it).simplifyWhiteSpace()).replace(QRegExp(" "),"") == AUTO) - (*it) = ""; - changed = true; - // Don't break because we want to make sure we remove all cases. - } - } - } - } - // 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. - */ -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. - */ -bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ - 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 - */ -bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ - if(!setInterface(interface)) - return false; - - // Store the old interface and bump past the stanza line. - QStringList::Iterator it = currentIface; - it++; - - // Add the new interface - bool error; - addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); - if(!setInterface(newInterface)) - return false; - - QStringList::Iterator newIface = currentIface; - newIface++; - - // 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. - */ -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()){ - error = true; - return QString(); - } - QString line = (*currentIface); - line = line.mid(QString(IFACE).length() +1, line.length()); - line = line.simplifyWhiteSpace(); - int findSpace = line.find(" "); - if( findSpace < 0){ - error = true; - return QString(); - } - error = false; - return line.mid(0, findSpace); -} - -/** - * Gets the family name of the interface that is currently selected. - * @return QString name of the family (inet, inet6, ipx). - * @param error set to true if any error occurs, false otherwise. - */ -QString Interfaces::getInterfaceFamily(bool &error){ - QString name = getInterfaceName(error); - if(error) - return QString(); - QString line = (*currentIface); - line = line.mid(QString(IFACE).length() +1, line.length()); - line = line.mid(name.length()+1, line.length()); - line = line.simplifyWhiteSpace(); - int findSpace = line.find(" "); - if( findSpace < 0){ - error = true; - return QString(); - } - error = false; - return line.mid(0, findSpace); -} - -/** - * Gets the method of the interface that is currently selected. - * @return QString name of the method such as staic or dhcp. - * See the man page of interfaces for possible methods depending on the family. - * @param error set to true if any error occurs, false otherwise. - */ -QString Interfaces::getInterfaceMethod(bool &error){ - QString name = getInterfaceName(error); - if(error) - return QString(); - QString family = getInterfaceFamily(error); - if(error) - return QString(); - 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. - */ -bool Interfaces::setInterfaceName(const QString &newName){ - if(currentIface == interfaces.end()) - return false; - QString name = newName.simplifyWhiteSpace(); - name = name.replace(QRegExp(" "), ""); - bool returnValue = false; - (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); - 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. - */ -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. - */ -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 - * return 192.168.1.1. - * iface eth0 static - * address 192.168.1.1 - * @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(const QString &option, bool &error){ - return getOption(currentIface, option, error); -} - -/** - * Set a value for an option in the currently selected interface. If option - * doesn't exist then it is added along with the value. - * @param option the options to set the value. - * @param value the value that option should be set to. - * @param error set to true if any error occurs, false otherwise. - * @return QString the options value. QString::null if error == true - */ -bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ - return setOption(currentIface, option, value); -} - -/** - * Removes a value for an option in the currently selected interface. - * @param option the options to set the value. - * @param 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 - */ -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. - */ -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. - */ -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. - */ -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. - */ -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. - * @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. - */ -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. - * @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 - if(line.at(point-1) != ' ') - valid = false; - } - point += option.length(); - if(point < line.length()-1){ - // There are more chars in the line. check -1 - if(line.at(point) != ' ') - valid = false; - } - if(valid){ - if(found == true){ - qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1()); - } - 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. - */ -bool Interfaces::setOption(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){ - if(!found && value != ""){ - // Got to the end of the stanza without finding it, so append it. - interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); - } - found = true; - break; - } - if((*it).contains(option) && it != start && (*it).at(0) != '#'){ - // Found it in stanza so replace it. - if(found) - qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); - found = true; - (*it) = QString("\t%1 %2").arg(option).arg(value); - } - } - if(!found){ - QStringList::Iterator p = start; - interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); - found = true; - } - return found; -} - -/** - * Removes a stanza and all of its options - * @param stanza the stanza to remove - * @return bool true if successfull. - */ -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 use when setting value. - * @return bool true if successfull, 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) != '#'){ - // Found it in stanza so replace it. - if(found) - qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); - found = true; - (*it) = ""; - } - } - return found; -} - -/** - * Removes all options in a stanza - * @param start the start of the stanza - * @return bool true if successfull, 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); - it = --it; - } - // Leave a space between this interface and the next. - interfaces.insert(it, QString("")); - return true; -} - -/** - * Gets a value of an option in a stanza - * @param start the start of the stanza - * @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(const QStringList::Iterator &start, const QString &option, bool &error){ - if(start == interfaces.end()){ - error = false; - return QString(); - } - - QString value; - bool found = false; - for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { - if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ - break; - } - if((*it).contains(option) && (*it).at(0) != '#'){ - if(found) - qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1()); - found = true; - QString line = (*it).simplifyWhiteSpace(); - int space = line.find(" ", option.length()); - if(space != -1){ - value = line.mid(space+1, line.length()); - break; - } - } - } - error = !found; - return value; -} - -/** - * Write out the interfaces file to the file passed into the constructor. - * Removes any excess blank lines over 1 line long. - * @return bool true if successfull, 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 ) { - QString line = (*it).simplifyWhiteSpace(); - line = line.replace(QRegExp(" "),""); - if(line.length() == 0) - whiteSpaceCount++; - else - whiteSpaceCount = 0; - if(whiteSpaceCount < 2){ - qDebug((*it).latin1()); - stream << (*it) << '\n'; - } - } - file.close(); - return true; -} - -// interfaces.cpp - diff --git a/noncore/net/networksetup/interfaces/interfaces.h b/noncore/net/networksetup/interfaces/interfaces.h deleted file mode 100644 index bac2a7e..0000000 --- a/noncore/net/networksetup/interfaces/interfaces.h +++ b/dev/null @@ -1,77 +0,0 @@ -#ifndef INTERFACES_H -#define INTERFACES_H - -#include <qstring.h> -#include <qstringlist.h> - -#define INTERFACES_LOOPBACK "loopback" - -#define INTERFACES_FAMILY_INET "inet" -#define INTERFACES_FAMILY_IPX "ipx" -#define INTERFACES_FAMILY_INET6 "inet6" - -#define INTERFACES_METHOD_DHCP "dhcp" -#define INTERFACES_METHOD_STATIC "static" -#define INTERFACES_METHOD_PPP "ppp" - -/** - * 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) 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() 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); - - 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 deleted file mode 100644 index 9a024f6..0000000 --- a/noncore/net/networksetup/interfaces/interfaces.pro +++ b/dev/null @@ -1,12 +0,0 @@ -TEMPLATE = lib -CONFIG += qt warn_on release -#CONFIG += qt warn_on debug -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/interfaces/interfacesetup.ui b/noncore/net/networksetup/interfaces/interfacesetup.ui deleted file mode 100644 index 2b45d49..0000000 --- a/noncore/net/networksetup/interfaces/interfacesetup.ui +++ b/dev/null @@ -1,242 +0,0 @@ -<!DOCTYPE UI><UI> -<class>InterfaceSetup</class> -<widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>InterfaceSetup</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>286</width> - <height>280</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Interface Configuration</string> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>autoStart</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Automatically bring up</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>dhcpCheckBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>DHCP</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>staticGroupBox</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Box</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>title</name> - <string>Static Ip Configuration</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel5</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Subnet Mask</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>gatewayEdit</cstring> - </property> - </widget> - <widget row="1" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>subnetMaskEdit</cstring> - </property> - </widget> - <widget row="0" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>ipAddressEdit</cstring> - </property> - </widget> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>First DNS</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>IP Address</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Gateway</string> - </property> - </widget> - <widget row="4" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Second DNS</string> - </property> - </widget> - <widget row="3" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>firstDNSLineEdit</cstring> - </property> - </widget> - <widget row="4" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>secondDNSLineEdit</cstring> - </property> - </widget> - </grid> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer9</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </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> - <receiver>staticGroupBox</receiver> - <slot>setDisabled(bool)</slot> - </connection> -</connections> -<tabstops> - <tabstop>autoStart</tabstop> - <tabstop>dhcpCheckBox</tabstop> - <tabstop>ipAddressEdit</tabstop> - <tabstop>subnetMaskEdit</tabstop> - <tabstop>gatewayEdit</tabstop> - <tabstop>firstDNSLineEdit</tabstop> - <tabstop>secondDNSLineEdit</tabstop> -</tabstops> -</UI> diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp deleted file mode 100644 index 56bbe93..0000000 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp +++ b/dev/null @@ -1,136 +0,0 @@ -#include "interfacesetupimp.h" -#include "interface.h" - -#include <qcheckbox.h> -#include <qlineedit.h> -#include <qspinbox.h> -#include <qgroupbox.h> -#include <qlabel.h> - -#include <qmessagebox.h> - -#define DNSSCRIPT "changedns" - -/** - * Constuctor. Set up the connection. A profile must be set. - */ -InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i){ -} - -/** - * Save the current settings, then write out the interfaces file and close. - */ -bool InterfaceSetupImp::saveChanges(){ - if(!saveSettings()) - return false; - interfaces.write(); - return true; -} - -/** - * Save the settings for the current Interface. - * @return bool true if successfull, 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; - } - - if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ - QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); - return false; - } - interfaces.removeAllInterfaceOptions(); - - // DHCP - if(dhcpCheckBox->isChecked()) - interfaces.setInterfaceMethod(INTERFACES_METHOD_DHCP); - else{ - interfaces.setInterfaceMethod("static"); - interfaces.setInterfaceOption("address", ipAddressEdit->text()); - interfaces.setInterfaceOption("netmask", subnetMaskEdit->text()); - interfaces.setInterfaceOption("gateway", gatewayEdit->text()); - if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ - QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); - interfaces.setInterfaceOption("up "DNSSCRIPT" -a ", dns); - interfaces.setInterfaceOption("down "DNSSCRIPT" -r ", dns); - } - } - - // IP Information - interfaces.setAuto(interface->getInterfaceName(), autoStart->isChecked()); - return true; -} - -/** - * The Profile has changed. - * @param QString profile the new profile. - */ -void InterfaceSetupImp::setProfile(const QString &profile){ - /* - bool error = false; - if(interfaces.getInterfaceMethod(error) == INTERFACES_LOOPBACK){ - staticGroupBox->hide(); - dhcpCheckBox->hide(); - leaseTime->hide(); - leaseHoursLabel->hide(); - } - */ - - QString newInterfaceName = interface->getInterfaceName(); - if(profile.length() > 0) - newInterfaceName += "_" + profile; - // See if we have to make a interface. - if(!interfaces.setInterface(newInterfaceName)){ - // Add making for this new interface if need too - if(profile != ""){ - interfaces.copyInterface(interface->getInterfaceName(), newInterfaceName); - if(!interfaces.setMapping(interface->getInterfaceName())){ - interfaces.addMapping(interface->getInterfaceName()); - if(!interfaces.setMapping(interface->getInterfaceName())){ - qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); - return; - } - } - interfaces.setMap("map", newInterfaceName); - interfaces.setScript("getprofile.sh"); - } - else{ - interfaces.addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); - if(!interfaces.setInterface(newInterfaceName)){ - qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); - return; - } - } - } - - // We must have a valid interface to get this far so read some settings. - - // DHCP - bool error = false; - if(interfaces.getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) - dhcpCheckBox->setChecked(true); - else - dhcpCheckBox->setChecked(false); - - // IP Information - autoStart->setChecked(interfaces.isAuto(interface->getInterfaceName())); - QString dns = interfaces.getInterfaceOption("up "DNSSCRIPT" -a", error); - if(dns.contains(" ")){ - firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); - secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); - } - ipAddressEdit->setText(interfaces.getInterfaceOption("address", error)); - subnetMaskEdit->setText(interfaces.getInterfaceOption("netmask", error)); - gatewayEdit->setText(interfaces.getInterfaceOption("gateway", error)); -} - -// interfacesetup.cpp - diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.h b/noncore/net/networksetup/interfaces/interfacesetupimp.h deleted file mode 100644 index 9ec526c..0000000 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.h +++ b/dev/null @@ -1,55 +0,0 @@ -#ifndef INTERFACESETUPIMP_H -#define INTERFACESETUPIMP_H - -#include "interfacesetup.h" -#include "interfaces.h" -#include <qdialog.h> - -class Interface; - -class InterfaceSetupImp : public InterfaceSetup { - Q_OBJECT - -public: - InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); - bool saveChanges(); - -public slots: - void setProfile(const QString &profile); - bool saveSettings(); - -private: - Interfaces interfaces; - Interface *interface; -}; - - -#include <qlayout.h> - -class InterfaceSetupImpDialog : public QDialog { -Q_OBJECT - -public: - InterfaceSetupImpDialog(QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = false, WFlags fl = 0) : QDialog(parent, name, modal, fl){ - QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); - setCaption("Interface Setup"); - interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); - InterfaceSetupLayout->addWidget( interfaceSetup ); - }; - void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; - -private: - InterfaceSetupImp *interfaceSetup; - -protected slots: - void accept(){ - if(interfaceSetup->saveChanges()) - QDialog::accept(); - }; - -}; - -#endif - -// interfacesetupimp.h - diff --git a/noncore/net/networksetup/main.cpp b/noncore/net/networksetup/main.cpp deleted file mode 100644 index a9d1a87..0000000 --- a/noncore/net/networksetup/main.cpp +++ b/dev/null @@ -1,13 +0,0 @@ -#include "mainwindowimp.h"
-#include <qpe/qpeapplication.h>
-
-int main(int argc, char **argv)
-{
- QPEApplication app(argc, argv);
- MainWindowImp window;
- app.showMainWidget(&window);
- return app.exec();
-}
-
-// main.cpp
-
diff --git a/noncore/net/networksetup/mainwindow.ui b/noncore/net/networksetup/mainwindow.ui deleted file mode 100644 index dcabc52..0000000 --- a/noncore/net/networksetup/mainwindow.ui +++ b/dev/null @@ -1,449 +0,0 @@ -<!DOCTYPE UI><UI> -<class>MainWindow</class> -<widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>MainWindow</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>240</width> - <height>289</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Network Settings</string> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QTabWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tabWidget</cstring> - </property> - <property> - <name>layoutMargin</name> - </property> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Widget3</cstring> - </property> - <attribute> - <name>title</name> - <string>Connections</string> - </attribute> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QListView</class> - <column> - <property> - <name>text</name> - <string>s</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <column> - <property> - <name>text</name> - <string>t</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <column> - <property> - <name>text</name> - <string>Name</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <column> - <property> - <name>text</name> - <string>in</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <column> - <property> - <name>text</name> - <string>IP</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <property stdset="1"> - <name>name</name> - <cstring>connectionList</cstring> - </property> - <property stdset="1"> - <name>allColumnsShowFocus</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout2</cstring> - </property> - <property> - <name>layoutMargin</name> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>5</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="1" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>addConnectionButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Add</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>informationConnectionButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Information</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>configureConnectionButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Configure</string> - </property> - </widget> - <widget row="1" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>removeConnectionButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Remove</string> - </property> - </widget> - </grid> - </widget> - </vbox> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Profiles</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <spacer row="7" column="2" > - <property> - <name>name</name> - <cstring>Spacer16</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="0" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>currentProfileLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>text</name> - <string>All</string> - </property> - </widget> - <widget row="3" column="2" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>setCurrentProfileButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Set Current</string> - </property> - </widget> - <widget row="5" column="0" rowspan="1" colspan="3" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>Line6</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="1" column="0" rowspan="1" colspan="3" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>Line1</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Current Profile</string> - </property> - </widget> - <widget row="4" column="2" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>removeProfileButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Remove</string> - </property> - </widget> - <widget row="3" column="0" rowspan="2" colspan="2" > - <class>QListBox</class> - <property stdset="1"> - <name>name</name> - <cstring>profilesList</cstring> - </property> - </widget> - <spacer row="0" column="2" > - <property> - <name>name</name> - <cstring>Spacer2</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Profiles</string> - </property> - </widget> - <widget row="6" column="0" rowspan="1" colspan="3" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout6</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>New Profile</string> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>newProfile</cstring> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>newProfileButton</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>&Add</string> - </property> - </widget> - </hbox> - </widget> - </grid> - </widget> - </widget> - </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> -<tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>connectionList</tabstop> - <tabstop>informationConnectionButton</tabstop> - <tabstop>configureConnectionButton</tabstop> - <tabstop>addConnectionButton</tabstop> - <tabstop>removeConnectionButton</tabstop> - <tabstop>profilesList</tabstop> - <tabstop>setCurrentProfileButton</tabstop> - <tabstop>removeProfileButton</tabstop> - <tabstop>newProfile</tabstop> - <tabstop>newProfileButton</tabstop> -</tabstops> -</UI> diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp deleted file mode 100644 index 9a17743..0000000 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/dev/null @@ -1,521 +0,0 @@ -#include "mainwindowimp.h"
-#include "addconnectionimp.h"
-#include "interfaceinformationimp.h"
-#include "interfacesetupimp.h"
-#include "interfaces.h"
-#include "module.h"
-
-#include <qpushbutton.h>
-#include <qlistbox.h>
-#include <qlineedit.h>
-#include <qlistview.h>
-#include <qheader.h>
-#include <qlabel.h>
-
-#include <qmainwindow.h>
-#include <qmessagebox.h>
-
-#include <qpe/config.h>
-#include <qpe/qlibrary.h>
-#include <qpe/resource.h>
-#include <qpe/qpeapplication.h>
-
-#include <qlist.h>
-#include <qdir.h>
-#include <qfile.h>
-#include <qtextstream.h>
-
-#include <net/if.h>
-#include <sys/ioctl.h>
-
-#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
-
-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()));
-
- connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
- connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
- connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
-
- connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
- // Load connections.
- loadModules(QPEApplication::qpeDir() + "/plugins/networksetup");
- getAllInterfaces();
-
- Interfaces i;
- QStringList list = i.getInterfaceList();
- QMap<QString, Interface*>::Iterator it;
- for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
- bool found = false;
- for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
- if(it.key() == (*ni))
- found = true;
- }
- if(!found){
- if(!(*ni).contains("_")){
- Interface *i = new Interface(this, *ni, false);
- i->setAttached(false);
- i->setHardwareName("Disconnected");
- interfaceNames.insert(i->getInterfaceName(), i);
- updateInterface(i);
- connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
- }
- }
- }
-
- //getInterfaceList();
- connectionList->header()->hide();
-
- Config cfg("NetworkSetup");
- profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
- for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
- profilesList->insertItem((*it));
- currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
- advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
- scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
-
- QFile file(scheme);
- if ( file.open(IO_ReadOnly) ) { // file opened successfully
- QTextStream stream( &file ); // use a text stream
- while ( !stream.eof() ) { // until end of file...
- QString line = stream.readLine(); // line of text excluding '\n'
- if(line.contains("SCHEME")){
- line = line.mid(7, line.length());
- currentProfileLabel->setText(line);
- break;
- }
- }
- file.close();
- }
-}
-
-/**
- * Deconstructor. Save profiles. Delete loaded libraries.
- */
-MainWindowImp::~MainWindowImp(){
- // Save profiles.
- Config cfg("NetworkSetup");
- cfg.setGroup("General");
- cfg.writeEntry("Profiles", profiles.join(" "));
-
- // Delete all interfaces that don't have owners.
- QMap<Interface*, QListViewItem*>::Iterator iIt;
- for( iIt = items.begin(); iIt != items.end(); ++iIt ){
- if(iIt.key()->getModuleOwner() == NULL)
- delete iIt.key();
- }
-
- // Delete Modules and Libraries
- QMap<Module*, QLibrary*>::Iterator it;
- for( it = libraries.begin(); it != libraries.end(); ++it ){
- delete it.key();
- // I wonder why I can't delete the libraries
- // What fucking shit this is.
- //delete it.data();
- }
-}
-
-/**
- * Query the kernel for all of the interfaces.
- */
-void MainWindowImp::getAllInterfaces(){
- int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
- if(sockfd == -1)
- return;
-
- char buf[8*1024];
- struct ifconf ifc;
- ifc.ifc_len = sizeof(buf);
- ifc.ifc_req = (struct ifreq *) buf;
- int result=ioctl(sockfd, SIOCGIFCONF, &ifc);
-
- for (char* ptr = buf; ptr < buf + ifc.ifc_len; ){
- struct ifreq *ifr =(struct ifreq *) ptr;
- int len = sizeof(struct sockaddr);
-#ifdef HAVE_SOCKADDR_SA_LEN
- if (ifr->ifr_addr.sa_len > len)
- len = ifr->ifr_addr.sa_len; /* length > 16 */
-#endif
- ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */
-
- int flags;
- struct sockaddr_in *sinptr;
- Interface *i = NULL;
- switch (ifr->ifr_addr.sa_family){
- case AF_INET:
- sinptr = (struct sockaddr_in *) &ifr->ifr_addr;
- flags=0;
-
- struct ifreq ifcopy;
- ifcopy=*ifr;
- result=ioctl(sockfd,SIOCGIFFLAGS,&ifcopy);
- flags=ifcopy.ifr_flags;
- i = new Interface(this, ifr->ifr_name, false);
- i->setAttached(true);
- if ((flags & IFF_UP) == IFF_UP)
- i->setStatus(true);
- else
- i->setStatus(false);
-
- if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
- i->setHardwareName("Ethernet");
- else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
- i->setHardwareName("Point to Point");
- else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
- i->setHardwareName("Multicast");
- else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
- i->setHardwareName("Loopback");
- else
- i->setHardwareName("Unknown");
-
- interfaceNames.insert(i->getInterfaceName(), i);
- updateInterface(i);
- connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
- break;
-
- default:
- qDebug(ifr->ifr_name);
- qDebug(QString("%1").arg(ifr->ifr_addr.sa_family).latin1());
- break;
- }
- }
-}
-
-/**
- * Load all modules that are found in the path
- * @param path a directory that is scaned for any plugins that can be loaded
- * and attempts to load them
- */
-void MainWindowImp::loadModules(const QString &path){
- //qDebug(path.latin1());
- QDir d(path);
- if(!d.exists())
- return;
-
- // Don't want sym links
- d.setFilter( QDir::Files | QDir::NoSymLinks );
- const QFileInfoList *list = d.entryInfoList();
- QFileInfoListIterator it( *list );
- QFileInfo *fi;
- while ( (fi=it.current()) ) {
- if(fi->fileName().contains(".so")){
- loadPlugin(path + "/" + fi->fileName());
- }
- ++it;
- }
-}
-
-/**
- * Attempt to load a function and resolve a function.
- * @param pluginFileName - the name of the file in which to attempt to load
- * @param resolveString - function pointer to resolve
- * @return pointer to the function with name resolveString or NULL
- */
-Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){
- //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1());
- QLibrary *lib = new QLibrary(pluginFileName);
- void *functionPointer = lib->resolve(resolveString);
- if( !functionPointer ){
- qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
- delete lib;
- return NULL;
- }
-
- // Try to get an object.
- Module *object = ((Module* (*)()) functionPointer)();
- if(object == NULL){
- qDebug("MainWindowImp: Couldn't create object, but did load library!");
- delete lib;
- return NULL;
- }
-
- // Store for deletion later
- libraries.insert(object, lib);
- return object;
-}
-
-/**
- * The Add button was clicked. Bring up the add dialog and if OK is hit
- * load the plugin and append it to the list
- */
-void MainWindowImp::addClicked(){
- QMap<Module*, QLibrary*>::Iterator it;
- QMap<QString, QString> list;
- QMap<QString, Module*> newInterfaceOwners;
- //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
- //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
- for( it = libraries.begin(); it != libraries.end(); ++it ){
- if(it.key()){
- (it.key())->possibleNewInterfaces(list);
- }
- }
- // See if the list has anything that we can add.
- if(list.count() == 0){
- QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok);
- return;
- }
- AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
- addNewConnection.addConnections(list);
- addNewConnection.showMaximized();
- if(QDialog::Accepted == addNewConnection.exec()){
- QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
- if(!item)
- return;
-
- for( it = libraries.begin(); it != libraries.end(); ++it ){
- if(it.key()){
- Interface *i = (it.key())->addNewInterface(item->text(0));
- if(i){
- interfaceNames.insert(i->getInterfaceName(), i);
- updateInterface(i);
- }
- }
- }
- }
-}
-
-/**
- * Prompt the user to see if they really want to do this.
- * If they do then remove from the list and unload.
- */
-void MainWindowImp::removeClicked(){
- QListViewItem *item = connectionList->currentItem();
- if(!item) {
- QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
- return;
- }
-
- Interface *i = interfaceItems[item];
- if(i->getModuleOwner() == NULL){
- QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
- }
- else{
- if(!i->getModuleOwner()->remove(i))
- QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok);
- else{
- QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
- // TODO memory managment....
- // who deletes the interface?
- }
- }
-}
-
-/**
- * Pull up the configure about the currently selected interface.
- * Report an error if no interface is selected.
- * If the interface has a module owner then request its configure.
- */
-void MainWindowImp::configureClicked(){
- QListViewItem *item = connectionList->currentItem();
- if(!item){
- QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
- return;
- }
-
- Interface *i = interfaceItems[item];
- if(i->getModuleOwner()){
- QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
- if(moduleConfigure != NULL){
- moduleConfigure->showMaximized();
- return;
- }
- }
-
- InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose);
- QString currentProfileText = currentProfileLabel->text();
- if(currentProfileText.upper() == "ALL");
- currentProfileText = "";
- configure->setProfile(currentProfileText);
- configure->showMaximized();
-}
-
-/**
- * Pull up the information about the currently selected interface.
- * Report an error if no interface is selected.
- * If the interface has a module owner then request its configure.
- */
-void MainWindowImp::informationClicked(){
- QListViewItem *item = connectionList->currentItem();
- if(!item){
- QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
- return;
- }
-
- Interface *i = interfaceItems[item];
- if(!i->isAttached()){
- QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
- return;
- }
-
- if(i->getModuleOwner()){
- QWidget *moduleInformation = i->getModuleOwner()->information(i);
- if(moduleInformation != NULL){
- moduleInformation->showMaximized();
- return;
- }
- }
- InterfaceInformationImp information(0, "InterfaceSetupImp", i);
- information.showMaximized();
-}
-
-/**
- * Update this interface. If no QListViewItem exists create one.
- * @param Interface* pointer to the interface that needs to be updated.
- */
-void MainWindowImp::updateInterface(Interface *i){
- if(!advancedUserMode){
- if(i->getInterfaceName() == "lo")
- return;
- }
-
- QListViewItem *item = NULL;
-
- // Find the interface, making it if needed.
- if(items.find(i) == items.end()){
- item = new QListViewItem(connectionList, "", "", "");
- // See if you can't find a module owner for this interface
- QMap<Module*, QLibrary*>::Iterator it;
- for( it = libraries.begin(); it != libraries.end(); ++it ){
- if(it.key()->isOwner(i))
- i->setModuleOwner(it.key());
- }
- items.insert(i, item);
- interfaceItems.insert(item, i);
- }
- else
- item = items[i];
-
- // Update the icons and information
- item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
-
- QString typeName = "lan";
- if(i->getHardwareName().contains("Local Loopback"))
- typeName = "lo";
- if(i->getInterfaceName().contains("irda"))
- typeName = "irda";
- if(i->getInterfaceName().contains("wlan"))
- typeName = "wlan";
- if(i->getInterfaceName().contains("usb"))
- typeName = "usb";
-
- if(!i->isAttached())
- typeName = "connect_no";
- // Actually try to use the Module
- if(i->getModuleOwner() != NULL)
- typeName = i->getModuleOwner()->getPixmapName(i);
-
- item->setPixmap(1, (Resource::loadPixmap(QString("networksetup/") + typeName)));
- item->setText(2, i->getHardwareName());
- item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
- item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
-}
-
-void MainWindowImp::newProfileChanged(const QString& newText){
- if(newText.length() > 0)
- newProfileButton->setEnabled(true);
- else
- newProfileButton->setEnabled(false);
-}
-
-/**
- * Adds a new profile to the list of profiles.
- * Don't add profiles that already exists.
- * Appends to the list and QStringList
- */
-void MainWindowImp::addProfile(){
- QString newProfileName = newProfile->text();
- if(profiles.grep(newProfileName).count() > 0){
- QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
- return;
- }
- profiles.append(newProfileName);
- profilesList->insertItem(newProfileName);
-}
-
-/**
- * Removes the currently selected profile in the combo.
- * Doesn't delete if there are less then 2 profiles.
- */
-void MainWindowImp::removeProfile(){
- if(profilesList->count() <= 1){
- QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
- return;
- }
- QString profileToRemove = profilesList->currentText();
- if(profileToRemove == "All"){
- QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok);
- return;
- }
- // Can't remove the curent profile
- if(profileToRemove == currentProfileLabel->text()){
- QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok);
- return;
-
- }
-
- if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
- profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
- profilesList->clear();
- for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
- profilesList->insertItem((*it));
-
- // Remove any interface settings and mappings.
- Interfaces interfaces;
- // Go through them one by one
- QMap<Interface*, QListViewItem*>::Iterator it;
- for( it = items.begin(); it != items.end(); ++it ){
- QString interfaceName = it.key()->getInterfaceName();
- qDebug(interfaceName.latin1());
- if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){
- interfaces.removeInterface();
- if(interfaces.setMapping(interfaceName)){
- if(profilesList->count() == 1)
- interfaces.removeMapping();
- else{
- interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
- }
- }
- interfaces.write();
- break;
- }
- }
- }
-}
-
-/**
- * A new profile has been selected, change.
- * @param newProfile the new profile.
- */
-void MainWindowImp::changeProfile(){
- if(profilesList->currentItem() == -1){
- QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
- return;
- }
- QString newProfile = profilesList->text(profilesList->currentItem());
- if(newProfile != currentProfileLabel->text()){
- currentProfileLabel->setText(newProfile);
- QFile::remove(scheme);
- QFile file(scheme);
- if ( file.open(IO_ReadWrite) ) {
- QTextStream stream( &file );
- stream << QString("SCHEME=%1").arg(newProfile);
- file.close();
- }
- // restart all up devices?
- if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){
- // Go through them one by one
- QMap<Interface*, QListViewItem*>::Iterator it;
- for( it = items.begin(); it != items.end(); ++it ){
- if(it.key()->getStatus() == true)
- it.key()->restart();
- }
- }
- }
- // TODO change the profile in the modules
-}
-
-// mainwindowimp.cpp
-
diff --git a/noncore/net/networksetup/mainwindowimp.h b/noncore/net/networksetup/mainwindowimp.h deleted file mode 100644 index 4f09d6c..0000000 --- a/noncore/net/networksetup/mainwindowimp.h +++ b/dev/null @@ -1,58 +0,0 @@ -#ifndef MAINWINOWIMP_H
-#define MAINWINOWIMP_H
-
-#include "mainwindow.h"
-#include <qmap.h>
-#include <qstringlist.h>
-
-class Module;
-class Interface;
-class QLibrary;
-class KProcess;
-
-class MainWindowImp : public MainWindow {
- Q_OBJECT
-
-public:
- MainWindowImp(QWidget *parent=0, const char *name=0);
- ~MainWindowImp();
-
-private slots:
- void getAllInterfaces();
-
- void addClicked();
- void removeClicked();
- void configureClicked();
- void informationClicked();
-
- void addProfile();
- void removeProfile();
- void changeProfile();
-
- void updateInterface(Interface *i);
- void newProfileChanged(const QString& newText);
-
-private:
- void loadModules(const QString &path);
-
- Module* loadPlugin(const QString &pluginFileName,
- const QString &resolveString = "create_plugin");
-
- // For our local list of names
- QMap<QString, Interface*> interfaceNames;
-
- QMap<Module*, QLibrary*> libraries;
- QMap<Interface*, QListViewItem*> items;
- QMap<QListViewItem*, Interface*> interfaceItems;
-
- QMap<KProcess*, QString> threads;
- QStringList profiles;
-
- bool advancedUserMode;
- QString scheme;
-};
-
-#endif
-
-// mainwindowimp.h
-
diff --git a/noncore/net/networksetup/module.h b/noncore/net/networksetup/module.h deleted file mode 100644 index 2e6272b..0000000 --- a/noncore/net/networksetup/module.h +++ b/dev/null @@ -1,86 +0,0 @@ -#ifndef NETCONF_MODULE_H -#define NETCONF_MODULE_H - -#include <qobject.h> -#include <qlist.h> -#include <qmap.h> -#include "interface.h" - -class QWidget; -class QTabWidget; - -class Module : QObject{ - -signals: - void updateInterface(Interface *i); - -public: - Module(){}; - - /** - * 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(const QString &newProfile) = 0; - - /** - * get the icon name for this device. - * @param Interface* can be used in determining the icon. - * @return QString the icon name (minus .png, .gif etc) - */ - virtual QString getPixmapName(Interface *) = 0; - - /** - * 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. - */ - virtual bool isOwner(Interface *){ return false; }; - - /** - * Create and return the WLANConfigure Module - * @param Interface *i the interface to configure. - * @return QWidget* pointer to this modules configure. - */ - virtual QWidget *configure(Interface *){ return NULL; } ; - - /** - * Create, and return the Information Module - * @param Interface *i the interface to get info on. - * @return QWidget* pointer to this modules info. - */ - virtual QWidget *information(Interface *){ return NULL; }; - - /** - * Get all active (up or down) interfaces - * @return QList<Interface> A list of interfaces that exsist that havn't - * been called by isOwner() - */ - virtual QList<Interface> getInterfaces() = 0; - - /** - * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp), - * modem ppp) - */ - 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. - */ - virtual bool remove(Interface* i) = 0; - -}; - -#endif - -// module.h - diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro deleted file mode 100644 index 3789464..0000000 --- a/noncore/net/networksetup/networksetup.pro +++ b/dev/null @@ -1,11 +0,0 @@ -DESTDIR = $(OPIEDIR)/bin -TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release -HEADERS = mainwindowimp.h addconnectionimp.h defaultmodule.h module.h -SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp -INCLUDEPATH += $(OPIEDIR)/include interfaces/ -DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan/ -LIBS += -lqpe -L$(OPIEDIR)/plugins/networksetup -Linterfaces/ -linterfaces -INTERFACES = mainwindow.ui addconnection.ui -TARGET = networksetup diff --git a/noncore/net/networksetup/opie-networksetup.control b/noncore/net/networksetup/opie-networksetup.control deleted file mode 100644 index 585e50e..0000000 --- a/noncore/net/networksetup/opie-networksetup.control +++ b/dev/null @@ -1,8 +0,0 @@ -Files: bin/networksetup apps/Settings/networksetup.desktop plugins/networksetup/* pics/networksetup/* pics/Network/PPPConnect.png $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 root/usr/bin/changedns bin/getprofile -Priority: optional -Section: opie/settings -Maintainer: Ben Meyer <meyerb@sharpsec.com> -Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION -Depends: opie-base ($QPE_VERSION) -Description: Network settings diff --git a/noncore/net/networksetup/ppp/ppp.pro b/noncore/net/networksetup/ppp/ppp.pro deleted file mode 100644 index 075cc5f..0000000 --- a/noncore/net/networksetup/ppp/ppp.pro +++ b/dev/null @@ -1,12 +0,0 @@ -TEMPLATE = lib -CONFIG += qt warn_on release -#CONFIG += qt warn_on debug -DESTDIR = $(OPIEDIR)/plugins/networksetup -HEADERS = pppimp.h pppmodule.h -SOURCES = pppimp.cpp pppmodule.cpp -INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -L../interfaces/ -linterfaces -INTERFACES = ppp.ui -TARGET = pppplugin -VERSION = 1.0.0 diff --git a/noncore/net/networksetup/ppp/ppp.ui b/noncore/net/networksetup/ppp/ppp.ui deleted file mode 100644 index 56e1621..0000000 --- a/noncore/net/networksetup/ppp/ppp.ui +++ b/dev/null @@ -1,770 +0,0 @@ -<!DOCTYPE UI><UI> -<class>PPP</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>PPP</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>277</width> - <height>340</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Dial-up </string> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>1</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>0</number> - </property> - <widget> - <class>QTabWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>TabWidget2</cstring> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Account</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>6</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>4</number> - </property> - <widget row="3" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>password</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="2" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>username</cstring> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Username</string> - </property> - </widget> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Password</string> - </property> - </widget> - <widget row="5" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Phone #</string> - </property> - </widget> - <widget row="5" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>phone</cstring> - </property> - </widget> - <widget row="4" column="0" rowspan="1" colspan="2" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>Line3</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="0" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>acname</cstring> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Name</string> - </property> - </widget> - <widget row="1" column="0" rowspan="1" colspan="2" > - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>Line4</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <spacer row="9" column="1" > - <property> - <name>name</name> - <cstring>Spacer4</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Modem</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>6</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>4</number> - </property> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3_2_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>AT-dial</string> - </property> - </widget> - <widget row="0" column="1" rowspan="1" colspan="3" > - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>ATDT</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>ATDP</string> - </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>atdial</cstring> - </property> - <property stdset="1"> - <name>editable</name> - <bool>true</bool> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_4</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Speed</string> - </property> - </widget> - <widget row="1" column="1" rowspan="1" colspan="3" > - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>4800</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>9600</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>19200</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>38400</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>57600</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>115200</string> - </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>speed</cstring> - </property> - <property stdset="1"> - <name>currentItem</name> - <number>5</number> - </property> - </widget> - <widget row="3" column="1" > - <class>QSlider</class> - <property stdset="1"> - <name>name</name> - <cstring>connectdelay</cstring> - </property> - <property stdset="1"> - <name>minValue</name> - <number>1</number> - </property> - <property stdset="1"> - <name>maxValue</name> - <number>180</number> - </property> - <property stdset="1"> - <name>value</name> - <number>6</number> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Wait time</string> - </property> - </widget> - <widget row="3" column="2" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>connectdelay_text</cstring> - </property> - <property stdset="1"> - <name>minimumSize</name> - <size> - <width>15</width> - <height>0</height> - </size> - </property> - <property stdset="1"> - <name>text</name> - <string>6</string> - </property> - <property stdset="1"> - <name>alignment</name> - <set>AlignVCenter|AlignRight</set> - </property> - <property> - <name>hAlign</name> - </property> - </widget> - <widget row="3" column="3" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel5</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>sec</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Flow control</string> - </property> - </widget> - <widget row="2" column="1" rowspan="1" colspan="3" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>crtscts</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Hardware flow control</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <spacer row="4" column="1" > - <property> - <name>name</name> - <cstring>Spacer5</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="5" column="0" rowspan="1" colspan="4" > - <class>QButtonGroup</class> - <property stdset="1"> - <name>name</name> - <cstring>dialmode</cstring> - </property> - <property stdset="1"> - <name>title</name> - <string>Demand Dialing</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" rowspan="1" colspan="2" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>dial_manual</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Manual connect and disconnect</string> - </property> - </widget> - <widget row="3" column="1" > - <class>QSpinBox</class> - <property stdset="1"> - <name>name</name> - <cstring>idletime</cstring> - </property> - <property stdset="1"> - <name>suffix</name> - <string> seconds</string> - </property> - <property stdset="1"> - <name>maxValue</name> - <number>3600</number> - </property> - <property stdset="1"> - <name>lineStep</name> - <number>30</number> - </property> - <property stdset="1"> - <name>value</name> - <number>120</number> - </property> - </widget> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_5</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>1</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>text</name> - <string>Idle timeout:</string> - </property> - <property stdset="1"> - <name>alignment</name> - <set>AlignVCenter|AlignRight</set> - </property> - <property> - <name>hAlign</name> - </property> - </widget> - <widget row="2" column="0" rowspan="1" colspan="2" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>dial_demand</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Automatic connect and disconnect</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>buttonGroupId</name> - <number>2</number> - </property> - </widget> - <widget row="1" column="0" rowspan="1" colspan="2" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>dial_idle</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Manual connect, automatic disconnect</string> - </property> - <property stdset="1"> - <name>buttonGroupId</name> - <number>1</number> - </property> - </widget> - </grid> - </widget> - </grid> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Network</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>6</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>4</number> - </property> - <spacer row="4" column="1" > - <property> - <name>name</name> - <cstring>Spacer8</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="2" column="0" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>usepeerdns</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Auto-detect name servers</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget row="1" column="0" rowspan="1" colspan="2" > - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>gatewaybox</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string></string> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Gateway</string> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>gateway</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - </hbox> - </widget> - <widget row="0" column="0" rowspan="1" colspan="2" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>defaultroute</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Auto-detect routing</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget row="3" column="0" rowspan="1" colspan="2" > - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>dnsbox</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string></string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>dns1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - <widget row="1" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>dns2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2_3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>First DNS</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2_2_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Second DNS</string> - </property> - </widget> - </grid> - </widget> - </grid> - </widget> - </widget> - </vbox> -</widget> -<connections> - <connection> - <sender>defaultroute</sender> - <signal>toggled(bool)</signal> - <receiver>gatewaybox</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>usepeerdns</sender> - <signal>toggled(bool)</signal> - <receiver>dnsbox</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>dial_manual</sender> - <signal>toggled(bool)</signal> - <receiver>idletime</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>connectdelay</sender> - <signal>valueChanged(int)</signal> - <receiver>connectdelay_text</receiver> - <slot>setNum(int)</slot> - </connection> -</connections> -<tabstops> - <tabstop>TabWidget2</tabstop> - <tabstop>acname</tabstop> - <tabstop>username</tabstop> - <tabstop>password</tabstop> - <tabstop>phone</tabstop> - <tabstop>atdial</tabstop> - <tabstop>speed</tabstop> - <tabstop>crtscts</tabstop> - <tabstop>connectdelay</tabstop> - <tabstop>dial_demand</tabstop> - <tabstop>idletime</tabstop> - <tabstop>defaultroute</tabstop> - <tabstop>gateway</tabstop> - <tabstop>usepeerdns</tabstop> - <tabstop>dns1</tabstop> - <tabstop>dns2</tabstop> - <tabstop>dial_manual</tabstop> - <tabstop>dial_idle</tabstop> -</tabstops> -</UI> diff --git a/noncore/net/networksetup/ppp/pppimp.cpp b/noncore/net/networksetup/ppp/pppimp.cpp deleted file mode 100644 index d3094fc..0000000 --- a/noncore/net/networksetup/ppp/pppimp.cpp +++ b/dev/null @@ -1,39 +0,0 @@ -#include "pppimp.h" - -PPPConfigureImp::PPPConfigureImp( QWidget* parent, const char* name, bool modal, WFlags fl) : PPP(parent, name, modal, fl) { - -} - -/** - * Open up the peers file and read any set settings - * @param peer the peer file to edit. - */ -void PPPConfigureImp::setPeer(const QString &newPeer){ - peer = newPeer; -} - -/** - * Save the settings for the current peer. - */ -void PPPConfigureImp::accept(){ - // Check to make sure that all of the inputs are valid. - - // Save settings. -/** -/dev/modem or just modem -<speed> any -defaultroute - automaticly add route -noipdefault - get an ip from the server -usepeerdns - automaticly add dns -crtscts - flow control enabled -name <name> - user name (and do secret file) -*/ - - // Make sure it is set in interfaces so pon/off can be used. - - // Close out the dialog - QDialog::accept(); -} - -// pppconfigureimp.h - diff --git a/noncore/net/networksetup/ppp/pppimp.h b/noncore/net/networksetup/ppp/pppimp.h deleted file mode 100644 index 1bc1fad..0000000 --- a/noncore/net/networksetup/ppp/pppimp.h +++ b/dev/null @@ -1,25 +0,0 @@ -#ifndef PPPIMP_H -#define PPPIMP_H - -#include "ppp.h" - -class PPPConfigureImp : public PPP { - -Q_OBJECT - -public: - PPPConfigureImp(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); - void setPeer(const QString &peer); - -protected: - void accept(); - -private: - QString peer; - -}; - -#endif - -// pppconfigureimp.h - diff --git a/noncore/net/networksetup/ppp/pppmodule.cpp b/noncore/net/networksetup/ppp/pppmodule.cpp deleted file mode 100644 index 72cd45e..0000000 --- a/noncore/net/networksetup/ppp/pppmodule.cpp +++ b/dev/null @@ -1,107 +0,0 @@ -#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(){ - Interface *i; - for ( i=list.first(); i != 0; i=list.next() ) - delete i; -} - -/** - * Change the current profile - */ -void PPPModule::setProfile(const QString &newProfile){ - profile = newProfile; -} - -/** - * get the icon name for this device. - * @param Interface* can be used in determining the icon. - * @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){ - 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){ - // 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){ - // 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; -} - -// pppmodule.cpp - diff --git a/noncore/net/networksetup/ppp/pppmodule.h b/noncore/net/networksetup/ppp/pppmodule.h deleted file mode 100644 index c8e77e2..0000000 --- a/noncore/net/networksetup/ppp/pppmodule.h +++ b/dev/null @@ -1,41 +0,0 @@ -#ifndef PPP_MODULE_H -#define PPP_MODULE_H - -#include "module.h" - -class PPPModule : Module { - -signals: - void updateInterface(Interface *i); - -public: - PPPModule(); - ~PPPModule(); - - virtual void setProfile(const 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(const QString &name); - virtual bool remove(Interface* i); - virtual QString getPixmapName(Interface* i); - -private: - QList<Interface> list; - QString profile; - -}; - -extern "C" -{ - void* create_plugin() { - return new PPPModule(); - } -}; - -#endif - -// pppmodule.h - diff --git a/noncore/net/networksetup/wlan/config.in b/noncore/net/networksetup/wlan/config.in deleted file mode 100644 index 36ced3a..0000000 --- a/noncore/net/networksetup/wlan/config.in +++ b/dev/null @@ -1,4 +0,0 @@ - config WLAN - boolean "Wireless LAN Module" - default "y" if NETWORKSETUP - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES diff --git a/noncore/net/networksetup/wlan/info.ui b/noncore/net/networksetup/wlan/info.ui deleted file mode 100644 index 7a5bf0b..0000000 --- a/noncore/net/networksetup/wlan/info.ui +++ b/dev/null @@ -1,321 +0,0 @@ -<!DOCTYPE UI><UI> -<class>WlanInfo</class> -<widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>WlanInfo</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>238</width> - <height>316</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Interface Information</string> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>0</number> - </property> - <widget> - <class>QTabWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tabWidget</cstring> - </property> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Widget2</cstring> - </property> - <attribute> - <name>title</name> - <string>802.11b</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="3" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Channel</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Mode</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>ESSID</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Station</string> - </property> - </widget> - <widget row="4" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel9</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>AP</string> - </property> - </widget> - <widget row="4" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>apLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="2" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>modeLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="1" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>essidLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="0" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>stationLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="3" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>channelLabel</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <spacer row="9" column="1" > - <property> - <name>name</name> - <cstring>Spacer7</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="5" column="1" > - <class>QProgressBar</class> - <property stdset="1"> - <name>name</name> - <cstring>signalProgressBar</cstring> - </property> - </widget> - <widget row="6" column="1" > - <class>QProgressBar</class> - <property stdset="1"> - <name>name</name> - <cstring>noiseProgressBar</cstring> - </property> - </widget> - <widget row="7" column="1" > - <class>QProgressBar</class> - <property stdset="1"> - <name>name</name> - <cstring>qualityProgressBar</cstring> - </property> - </widget> - <widget row="8" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>rateLabel</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>1</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - </widget> - <widget row="8" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Rate</string> - </property> - </widget> - <widget row="7" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Quality</string> - </property> - </widget> - <widget row="6" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Noise</string> - </property> - </widget> - <widget row="5" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Signal</string> - </property> - </widget> - </grid> - </widget> - </widget> - </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> -</UI> diff --git a/noncore/net/networksetup/wlan/infoimp.cpp b/noncore/net/networksetup/wlan/infoimp.cpp deleted file mode 100644 index bd56678..0000000 --- a/noncore/net/networksetup/wlan/infoimp.cpp +++ b/dev/null @@ -1,56 +0,0 @@ -#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("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(){ - WExtensions *wExtensions = new WExtensions(this->name()); - if(!wExtensions->doesHaveWirelessExtensions()){ - qDebug("No extension"); - delete wExtensions; - timer->stop(); - return; - } - essidLabel->setText(wExtensions->essid()); - apLabel->setText(wExtensions->ap()); - stationLabel->setText(wExtensions->station()); - modeLabel->setText(wExtensions->mode()); - channelLabel->setText(QString("%1").arg(wExtensions->channel())); - int signal = 0; - int noise = 0; - int quality = 0; - wExtensions->stats(signal, noise, quality); - if(signalProgressBar->progress() != signal) - signalProgressBar->setProgress(signal); - if(noiseProgressBar->progress() != noise) - noiseProgressBar->setProgress(noise); - if(qualityProgressBar->progress() != quality) - qualityProgressBar->setProgress(quality); - rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); - delete wExtensions; -} - -// infoimp.cpp - diff --git a/noncore/net/networksetup/wlan/infoimp.h b/noncore/net/networksetup/wlan/infoimp.h deleted file mode 100644 index 8f7f0d6..0000000 --- a/noncore/net/networksetup/wlan/infoimp.h +++ b/dev/null @@ -1,27 +0,0 @@ -#ifndef INFOIMP_H -#define INFOIMP_H - -#include "info.h" - -class QTimer; -//class WExtensions; - -class WlanInfoImp : public WlanInfo { - Q_OBJECT - -public: - WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - -private slots: - void update(); - -private: - //WExtensions *wExtensions; - QTimer *timer; - -}; - -#endif - -// infoimp.h - diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp deleted file mode 100644 index 827d075..0000000 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/dev/null @@ -1,200 +0,0 @@ -#include "wextensions.h" - -#include <qfile.h> -#include <qtextstream.h> - -#include <arpa/inet.h> -#include <sys/socket.h> -#include <sys/ioctl.h> - -#include <math.h> - -#define PROCNETWIRELESS "/proc/net/wireless" -#define IW_LOWER 0 -#define IW_UPPER 256 - -/** - * Constructor. Sets hasWirelessExtensions - */ -WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { - fd = socket( AF_INET, SOCK_DGRAM, 0 ); - if(fd == -1) - return; - - const char* buffer[200]; - memset( &iwr, 0, sizeof( iwr ) ); - iwr.u.essid.pointer = (caddr_t) buffer; - iwr.u.essid.length = IW_ESSID_MAX_SIZE; - iwr.u.essid.flags = 0; - - // check if it is an IEEE 802.11 standard conform - // wireless device by sending SIOCGIWESSID - // which also gives back the Extended Service Set ID - // (see IEEE 802.11 for more information) - - const char* iname = interface.latin1(); - strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); - if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) - hasWirelessExtensions = true; -} - -/** - * @return QString the station name of the access point. - */ -QString WExtensions::station(){ - if(!hasWirelessExtensions) - return QString(); - const char* buffer[200]; - iwr.u.data.pointer = (caddr_t) buffer; - iwr.u.data.length = IW_ESSID_MAX_SIZE; - iwr.u.data.flags = 0; - if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ - iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; - return QString(iwr.u.data.pointer); - } - return QString(); -} - -/** - * @return QString the essid of the host 802.11 access point. - */ -QString WExtensions::essid(){ - if(!hasWirelessExtensions) - return QString(); - if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ - iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length-1] = '\0'; - return QString(iwr.u.essid.pointer); - } - return QString(); -} - -/** - * @return QString the mode of interface - */ -QString WExtensions::mode(){ - if(!hasWirelessExtensions) - return QString(); - if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) - return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); - return QString(); -} - -/** - * Get the frequency that the interface is running at. - * @return int the frequency that the interfacae is running at. - */ -double WExtensions::frequency(){ - if(!hasWirelessExtensions) - return 0; - if ( 0 == ioctl( fd, SIOCGIWFREQ, &iwr )) - return (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); - return 0; -} - -/** - * Get the channel that the interface is running at. - * @return int the channel that the interfacae is running at. - */ -int WExtensions::channel(){ - if(!hasWirelessExtensions) - return 0; - if ( 0 != ioctl( fd, SIOCGIWFREQ, &iwr )) - return 0; - - // http://www.elanix.com/pdf/an137e.pdf - - double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); - double left = 2.401; - double right = 2.416; - for(int channel = 1; channel<= 15; channel++){ - if( num >= left && num <= right ) - return channel; - left += 0.005; - right += 0.005; - } - qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); - return -1; -} - -/*** - * Get the current rate that the card is transmiting at. - * @return double the rate, 0 if error. - */ -double WExtensions::rate(){ - if(!hasWirelessExtensions) - return 0; - if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ - return ((double)iwr.u.bitrate.value)/1000000; - } - return 0; -} - - -/** - * @return QString the AccessPoint that the interface is connected to. - */ -QString WExtensions::ap(){ - if(!hasWirelessExtensions) - return QString(); - if ( 0 == ioctl( fd, SIOCGIWAP, &iwr )){ - QString ap; - ap = ap.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", - iwr.u.ap_addr.sa_data[0]&0xff, - iwr.u.ap_addr.sa_data[1]&0xff, - iwr.u.ap_addr.sa_data[2]&0xff, - iwr.u.ap_addr.sa_data[3]&0xff, - 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 - */ -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 )) - return false; - - QTextStream wstream( &wfile ); - wstream.readLine(); // skip the first two lines - wstream.readLine(); // because they only contain headers - while(!wstream.atEnd()){ - wstream >> name >> status >> quality >> c >> signal >> c >> noise; - if(name == QString("%1:").arg(interface)){ - if ( quality > 92 ) - qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); - if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) - qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); - if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) - qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); - //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); - signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; - noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; - quality = ( quality*100 ) / 92; - return true; - } - } - - qDebug("WExtensions::statsCard no longer present."); - quality = -1; - signal = IW_LOWER; - noise = IW_LOWER; - return false; -} - -// wextensions.cpp diff --git a/noncore/net/networksetup/wlan/wextensions.h b/noncore/net/networksetup/wlan/wextensions.h deleted file mode 100644 index a89e33a..0000000 --- a/noncore/net/networksetup/wlan/wextensions.h +++ b/dev/null @@ -1,34 +0,0 @@ -#ifndef WEXTENSIONS_H -#define WEXTENSIONS_H - -#include <qstring.h> - -#include <netinet/ip.h> -#include <linux/wireless.h> - -class WExtensions { - -public: - WExtensions(QString interfaceName); - QString getInterfaceName(){return interface;}; - bool doesHaveWirelessExtensions(){return hasWirelessExtensions;}; - QString station(); - QString essid(); - QString mode(); - double frequency(); - int channel(); - double rate(); - QString ap(); - bool stats( int &signal, int &noise, int &quality); - -private: - bool hasWirelessExtensions; - QString interface; - - // Used in we calls - struct iwreq iwr; - int fd; - -}; - -#endif diff --git a/noncore/net/networksetup/wlan/wlan.pro b/noncore/net/networksetup/wlan/wlan.pro deleted file mode 100644 index 23fc39a..0000000 --- a/noncore/net/networksetup/wlan/wlan.pro +++ b/dev/null @@ -1,12 +0,0 @@ -TEMPLATE = lib -CONFIG += qt warn_on release -#CONFIG += qt warn_on debug -DESTDIR = $(OPIEDIR)/plugins/networksetup -HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h -SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp -INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -L../interfaces/ -linterfaces -INTERFACES = wlan.ui info.ui -TARGET = wlanplugin -VERSION = 1.0.0 diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui deleted file mode 100644 index 744c559..0000000 --- a/noncore/net/networksetup/wlan/wlan.ui +++ b/dev/null @@ -1,491 +0,0 @@ -<!DOCTYPE UI><UI> -<class>WLAN</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>WLAN</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>239</width> - <height>277</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Wireless LAN Setting</string> - </property> - <property stdset="1"> - <name>sizeGripEnabled</name> - <bool>true</bool> - </property> - <property> - <name>layoutMargin</name> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QTabWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tabWidget</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>ConfigPage</cstring> - </property> - <attribute> - <name>title</name> - <string>General</string> - </attribute> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>essAny</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Specify Access Point</string> - </property> - </widget> - <widget> - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>GroupBox1</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string>Specific &Access Point Settings</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>ESS-ID</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Network Type</string> - </property> - </widget> - <widget row="0" column="1" rowspan="1" colspan="2" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>essSpecificLineEdit</cstring> - </property> - </widget> - <widget row="1" column="1" rowspan="1" colspan="2" > - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>Infrastructure</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>Ad-Hoc</string> - </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>networkType</cstring> - </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>channelLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Channel</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QSpinBox</class> - <property stdset="1"> - <name>name</name> - <cstring>networkChannel</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>maxValue</name> - <number>15</number> - </property> - <property stdset="1"> - <name>minValue</name> - <number>1</number> - </property> - <property stdset="1"> - <name>value</name> - <number>6</number> - </property> - </widget> - <spacer row="2" column="2" > - <property> - <name>name</name> - <cstring>Spacer4</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer31</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </vbox> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>WepPage</cstring> - </property> - <attribute> - <name>title</name> - <string>Encryption</string> - </attribute> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>wepEnabled</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Enable WEP</string> - </property> - </widget> - <widget> - <class>QButtonGroup</class> - <property stdset="1"> - <name>name</name> - <cstring>ButtonGroup43</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string>&Authentication Type</string> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>authOpen</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Open System</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>authShared</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Shared Key</string> - </property> - </widget> - </hbox> - </widget> - <widget> - <class>QButtonGroup</class> - <property stdset="1"> - <name>name</name> - <cstring>KeyButtonGroup</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>title</name> - <string>&Key Setting</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit0</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="1" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit1</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="2" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit2</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="3" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>keyLineEdit3</cstring> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget row="0" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio0</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 1</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget row="1" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 2</string> - </property> - </widget> - <widget row="2" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 3</string> - </property> - </widget> - <widget row="3" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>keyRadio3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Key 4</string> - </property> - </widget> - </grid> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer30</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </vbox> - </widget> - </widget> - </vbox> -</widget> -<connections> - <connection> - <sender>wepEnabled</sender> - <signal>toggled(bool)</signal> - <receiver>ButtonGroup43</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>wepEnabled</sender> - <signal>toggled(bool)</signal> - <receiver>KeyButtonGroup</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>essAny</sender> - <signal>toggled(bool)</signal> - <receiver>GroupBox1</receiver> - <slot>setEnabled(bool)</slot> - </connection> -</connections> -<tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>essAny</tabstop> - <tabstop>essSpecificLineEdit</tabstop> - <tabstop>networkType</tabstop> - <tabstop>networkChannel</tabstop> - <tabstop>wepEnabled</tabstop> - <tabstop>authOpen</tabstop> - <tabstop>authShared</tabstop> - <tabstop>keyRadio0</tabstop> - <tabstop>keyLineEdit0</tabstop> - <tabstop>keyRadio1</tabstop> - <tabstop>keyLineEdit1</tabstop> - <tabstop>keyRadio2</tabstop> - <tabstop>keyLineEdit2</tabstop> - <tabstop>keyRadio3</tabstop> - <tabstop>keyLineEdit3</tabstop> -</tabstops> -</UI> diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp deleted file mode 100644 index 1782c22..0000000 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/dev/null @@ -1,247 +0,0 @@ -#include "wlanimp.h" -#include "interfacesetupimp.h" - -#include <qfile.h> -#include <qdir.h> -#include <qtextstream.h> -#include <qmessagebox.h> -#include <qlineedit.h> -#include <qlabel.h> -#include <qspinbox.h> -#include <qradiobutton.h> -#include <qcheckbox.h> -#include <qtabwidget.h> -#include <qcombobox.h> - -/* system() */ -#include <stdlib.h> - -#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" - -/** - * Constructor, read in the wireless.opts file for parsing later. - */ -WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { - interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); - tabWidget->insertTab(interfaceSetup, "TCP/IP"); - - // Read in the config file. - QString wlanFile = WIRELESS_OPTS; - QFile file(wlanFile); - if (file.open(IO_ReadOnly)){ - QTextStream stream( &file ); - QString line = ""; - while ( !stream.eof() ) { - line += stream.readLine(); - line += "\n"; - } - file.close(); - settingsFileText = QStringList::split("\n", line, true); - parseSettingFile(); - } - else - qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); - connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); -} - -void WLANImp::typeChanged(int mod){ - networkChannel->setEnabled(mod); - channelLabel->setEnabled(mod); -} - -/** - * Change the profile for both wireless settings and network settings. - */ -void WLANImp::setProfile(const QString &profile){ - interfaceSetup->setProfile(profile); - parseSettingFile(); -} - -/** - * Parses the settings file that was read in and gets any setting from it. - */ -void WLANImp::parseSettingFile(){ - bool foundCase = false; - bool found = false; - for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { - QString line = (*it).simplifyWhiteSpace(); - if(line.contains("case")) - foundCase = true; - // See if we found our scheme to write or the sceme couldn't be found - if((foundCase && line.contains("esac")) || - (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) - found = true; - - if(line.contains(";;")) - found = false; - if(found){ - // write out scheme - if(line.contains("ESSID=")){ - QString id = line.mid(line.find("ESSID=")+6, line.length()); - if(id == "any"){ - essAny->setChecked(false); - }else{ - essAny->setChecked(true); - essSpecificLineEdit->setText(id); - } - } - if(line.contains("MODE=")){ - QString mode = line.mid(line.find("MODE=")+5, line.length()); - if(mode == "Managed"){ - networkType->setCurrentItem(0); - channelLabel->setEnabled(false); - networkChannel->setEnabled(false); - } - else{ - networkType->setCurrentItem(1); - networkChannel->setEnabled(true); - channelLabel->setEnabled(true); - } - } - if(line.contains("#KEY0=")) - keyLineEdit0->setText(line.mid(6, line.length())); - if(line.contains("#KEY1=")) - keyLineEdit1->setText(line.mid(6, line.length())); - if(line.contains("#KEY2=")) - keyLineEdit2->setText(line.mid(6, line.length())); - if(line.contains("#KEY3=")) - keyLineEdit3->setText(line.mid(6, line.length())); - - if(line.contains("KEY=")){ - wepEnabled->setChecked(true); - QString key; - if(line.right(5) == (" open")){ - key = line.mid(4, line.length()-5); - authOpen->setChecked(true); - authShared->setChecked(false); - } - else{ - authOpen->setChecked(false); - authShared->setChecked(true); - key = line.mid(4, line.length()); - } - if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); - if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); - if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); - if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); - } - if(line.contains("CHANNEL=")){ - networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); - } - } - } -} - -/** - * Saves settings to the wireless.opts file using the current profile - */ -void WLANImp::changeAndSaveSettingFile(){ - QString wlanFile = WIRELESS_OPTS; - QFile::remove(wlanFile); - QFile file(wlanFile); - - if (!file.open(IO_ReadWrite)){ - qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); - return; - } - - QTextStream stream( &file ); - bool foundCase = false; - bool found = false; - bool output = true; - for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { - QString line = (*it).simplifyWhiteSpace(); - if(line.contains("case")) - foundCase = true; - // See if we found our scheme to write or the sceme couldn't be found - if((foundCase && line.contains("esac") && !found) || - (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ - // write out scheme - found = true; - output = false; - - if(!line.contains("esac")) - stream << line << "\n"; - if(!essAny->isChecked() == true){ - stream << "\tESSID=any\n"; - stream << "\tMODE=Managed\n"; - } - else{ - stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; - stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; - stream << "\tCHANNEL=" << networkChannel->value() << "\n"; - } - - stream << "\t#KEY0=" << keyLineEdit0->text() << "\n"; - stream << "\t#KEY1=" << keyLineEdit1->text() << "\n"; - stream << "\t#KEY2=" << keyLineEdit2->text() << "\n"; - stream << "\t#KEY3=" << keyLineEdit3->text() << "\n"; - - if(wepEnabled->isChecked()){ - stream << "\tKEY=\""; - if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); - if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); - if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); - if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); - if(authOpen->isChecked()) - stream << " open"; - else - stream << " restricted"; - stream << "\"\n"; - } - stream << "\tRATE=auto\n"; - if(line.contains("esac")) - stream << line << "\n"; - } - if(line.contains(";;")) - output = true; - if(output && (*it).length() ) - stream << (*it) << '\n'; - } - file.close(); -} - -/** - * Check to see if the current config is valid - * Save wireless.opts, save interfaces - */ -void WLANImp::accept(){ - if(wepEnabled->isChecked()){ - if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){ - QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); - return; - } - } - - if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ - QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); - return; - } - - // Ok settings are good here, save - changeAndSaveSettingFile(); - - // Try to save the interfaces settings. - if(!interfaceSetup->saveChanges()) - return; - - // Restart the device now that the settings have changed - QString initpath; - if( QDir("/etc/rc.d/init.d").exists() ) - initpath = "/etc/rc.d/init.d"; - else if( QDir("/etc/init.d").exists() ) - initpath = "/etc/init.d"; - - // It would be kinda cool if we didn't have to do this and could just to ifup/down - - if( initpath ) - system(QString("%1/pcmcia stop").arg(initpath)); - if( initpath ) - system(QString("%1/pcmcia start").arg(initpath)); - - // Close out the dialog - QDialog::accept(); -} - -// wlanimp.cpp - diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h deleted file mode 100644 index 310836c..0000000 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/dev/null @@ -1,34 +0,0 @@ -#ifndef WLANIMP_H -#define WLANIMP_H - -#include "wlan.h" -#include <qstringlist.h> - -class InterfaceSetupImp; -class Interface; -class Config; - -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(const QString &profile); - -protected: - void accept(); - -private slots: - void typeChanged(int); - -private: - void parseSettingFile(); - void changeAndSaveSettingFile(); - - InterfaceSetupImp *interfaceSetup; - QStringList settingsFileText; - QString currentProfile; -}; - -#endif - diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp deleted file mode 100644 index 3979e60..0000000 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/dev/null @@ -1,113 +0,0 @@ -#include "wlanmodule.h" -#include "wlanimp.h" -#include "infoimp.h" -#include "wextensions.h" -#include "interfaceinformationimp.h" - -#include <qlabel.h> -#include <qprogressbar.h> -#include <qtabwidget.h> - -/** - * Constructor, find all of the possible interfaces - */ -WLANModule::WLANModule() : Module() { -} - -/** - * Delete any interfaces that we own. - */ -WLANModule::~WLANModule(){ - Interface *i; - for ( i=list.first(); i != 0; i=list.next() ) - delete i; -} - -/** - * Change the current profile - */ -void WLANModule::setProfile(const QString &newProfile){ - profile = newProfile; -} - -/** - * get the icon name for this device. - * @param Interface* can be used in determining the icon. - * @return QString the icon name (minus .png, .gif etc) - */ -QString WLANModule::getPixmapName(Interface* ){ - return "wlan"; -} - -/** - * 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 WLANModule::isOwner(Interface *i){ - WExtensions we(i->getInterfaceName()); - if(!we.doesHaveWirelessExtensions()) - return false; - - i->setHardwareName("802.11b"); - list.append(i); - return true; -} - -/** - * Create, and return the WLANConfigure Module - * @return QWidget* pointer to this modules configure. - */ -QWidget *WLANModule::configure(Interface *i){ - WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); - wlanconfig->setProfile(profile); - return wlanconfig; -} - -/** - * Create, and return the Information Module - * @return QWidget* pointer to this modules info. - */ -QWidget *WLANModule::information(Interface *i){ - WExtensions we(i->getInterfaceName()); - if(!we.doesHaveWirelessExtensions()) - 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; -} - -/** - * 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> WLANModule::getInterfaces(){ - 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 *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. - */ -bool WLANModule::remove(Interface*){ - // Can't remove a hardware device, you can stop it though. - return false; -} - -// wlanmodule.cpp - diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h deleted file mode 100644 index 3a54de6..0000000 --- a/noncore/net/networksetup/wlan/wlanmodule.h +++ b/dev/null @@ -1,41 +0,0 @@ -#ifndef WLAN_MODULE_H -#define WLAN_MODULE_H - -#include "module.h" - -class WLANModule : Module{ - -signals: - void updateInterface(Interface *i); - -public: - WLANModule(); - ~WLANModule(); - - 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; - -}; - -extern "C" -{ - void* create_plugin() { - return new WLANModule(); - } -}; - -#endif - -// wlanmodule.h - |