author | zecke <zecke> | 2004-04-06 08:00:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-06 08:00:49 (UTC) |
commit | 1b7592f11a2499c3e7d6652dde1ee15fb661fce2 (patch) (unidiff) | |
tree | fc9998d8037473f7bfb27274f60fbcdb26cc9d50 | |
parent | 9aeac7cefc3c8baf32944e7275b57e0a0cde1515 (diff) | |
download | opie-1b7592f11a2499c3e7d6652dde1ee15fb661fce2.zip opie-1b7592f11a2499c3e7d6652dde1ee15fb661fce2.tar.gz opie-1b7592f11a2499c3e7d6652dde1ee15fb661fce2.tar.bz2 |
one include of odebug.h a day keeps my anger away... :}
Add odebug.h so that it compiles
4 files changed, 7 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp index d2b106a..46f3e19 100644 --- a/noncore/settings/networksettings/interfaces/interface.cpp +++ b/noncore/settings/networksettings/interfaces/interface.cpp | |||
@@ -1,102 +1,105 @@ | |||
1 | /** | 1 | /** |
2 | * $Author$ | 2 | * $Author$ |
3 | * $Date$ | 3 | * $Date$ |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "interface.h" | 6 | #include "interface.h" |
7 | |||
8 | #include <opie2/odebug.h> | ||
9 | |||
7 | #include <qdatetime.h> | 10 | #include <qdatetime.h> |
8 | #include <qfile.h> | 11 | #include <qfile.h> |
9 | #include <qdir.h> | 12 | #include <qdir.h> |
10 | #include <qfileinfo.h> | 13 | #include <qfileinfo.h> |
11 | #include <qtextstream.h> | 14 | #include <qtextstream.h> |
12 | 15 | ||
13 | #define IFCONFIG "/sbin/ifconfig" | 16 | #define IFCONFIG "/sbin/ifconfig" |
14 | #define DHCP_INFO_DIR "/etc/dhcpc" | 17 | #define DHCP_INFO_DIR "/etc/dhcpc" |
15 | 18 | ||
16 | #include <stdio.h> | 19 | #include <stdio.h> |
17 | #include <stdlib.h> | 20 | #include <stdlib.h> |
18 | 21 | ||
19 | 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"){ | 22 | 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"){ |
20 | refresh(); | 23 | refresh(); |
21 | } | 24 | } |
22 | 25 | ||
23 | /** | 26 | /** |
24 | * Set status | 27 | * Set status |
25 | * @param newStatus - the new status | 28 | * @param newStatus - the new status |
26 | * emit updateInterface | 29 | * emit updateInterface |
27 | */ | 30 | */ |
28 | void Interface::setStatus(bool newStatus){ | 31 | void Interface::setStatus(bool newStatus){ |
29 | if(status != newStatus){ | 32 | if(status != newStatus){ |
30 | status = newStatus; | 33 | status = newStatus; |
31 | refresh(); | 34 | refresh(); |
32 | } | 35 | } |
33 | }; | 36 | }; |
34 | 37 | ||
35 | /** | 38 | /** |
36 | * Set if attached or not (802.11 card pulled out for example) | 39 | * Set if attached or not (802.11 card pulled out for example) |
37 | * @param isAttached - if attached | 40 | * @param isAttached - if attached |
38 | * emit updateInterface | 41 | * emit updateInterface |
39 | */ | 42 | */ |
40 | void Interface::setAttached(bool isAttached){ | 43 | void Interface::setAttached(bool isAttached){ |
41 | attached = isAttached; | 44 | attached = isAttached; |
42 | emit(updateInterface(this)); | 45 | emit(updateInterface(this)); |
43 | }; | 46 | }; |
44 | 47 | ||
45 | /** | 48 | /** |
46 | * Set Hardware name | 49 | * Set Hardware name |
47 | * @param name - the new name | 50 | * @param name - the new name |
48 | * emit updateInterface | 51 | * emit updateInterface |
49 | */ | 52 | */ |
50 | void Interface::setHardwareName(const QString &name){ | 53 | void Interface::setHardwareName(const QString &name){ |
51 | hardwareName = name; | 54 | hardwareName = name; |
52 | emit(updateInterface(this)); | 55 | emit(updateInterface(this)); |
53 | }; | 56 | }; |
54 | 57 | ||
55 | /** | 58 | /** |
56 | * Set Module owner | 59 | * Set Module owner |
57 | * @param owner - the new owner | 60 | * @param owner - the new owner |
58 | * emit updateInterface | 61 | * emit updateInterface |
59 | */ | 62 | */ |
60 | void Interface::setModuleOwner(Module *owner){ | 63 | void Interface::setModuleOwner(Module *owner){ |
61 | moduleOwner = owner; | 64 | moduleOwner = owner; |
62 | emit(updateInterface(this)); | 65 | emit(updateInterface(this)); |
63 | }; | 66 | }; |
64 | 67 | ||
65 | 68 | ||
66 | /** | 69 | /** |
67 | * Try to start the interface. | 70 | * Try to start the interface. |
68 | */ | 71 | */ |
69 | void Interface::start(){ | 72 | void Interface::start(){ |
70 | // check to see if we are already running. | 73 | // check to see if we are already running. |
71 | if(true == status){ | 74 | if(true == status){ |
72 | emit (updateMessage("Unable to start interface,\n already started")); | 75 | emit (updateMessage("Unable to start interface,\n already started")); |
73 | return; | 76 | return; |
74 | } | 77 | } |
75 | 78 | ||
76 | int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); | 79 | int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); |
77 | // See if it was successful... | 80 | // See if it was successful... |
78 | if(ret != 0){ | 81 | if(ret != 0){ |
79 | emit (updateMessage("Starting interface failed")); | 82 | emit (updateMessage("Starting interface failed")); |
80 | return; | 83 | return; |
81 | } | 84 | } |
82 | 85 | ||
83 | status = true; | 86 | status = true; |
84 | refresh(); | 87 | refresh(); |
85 | emit (updateMessage("Start successful")); | 88 | emit (updateMessage("Start successful")); |
86 | } | 89 | } |
87 | 90 | ||
88 | /** | 91 | /** |
89 | * Try to stop the interface. | 92 | * Try to stop the interface. |
90 | */ | 93 | */ |
91 | void Interface::stop(){ | 94 | void Interface::stop(){ |
92 | // check to see if we are already stopped. | 95 | // check to see if we are already stopped. |
93 | if(false == status){ | 96 | if(false == status){ |
94 | emit (updateMessage("Unable to stop interface,\n already stopped")); | 97 | emit (updateMessage("Unable to stop interface,\n already stopped")); |
95 | return; | 98 | return; |
96 | } | 99 | } |
97 | 100 | ||
98 | int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); | 101 | int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); |
99 | if(ret != 0){ | 102 | if(ret != 0){ |
100 | emit (updateMessage("Stopping interface failed")); | 103 | emit (updateMessage("Stopping interface failed")); |
101 | return; | 104 | return; |
102 | } | 105 | } |
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp index e283926..5ce4b58 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces/interfaces.cpp | |||
@@ -1,98 +1,100 @@ | |||
1 | #include "interfaces.h" | 1 | #include "interfaces.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | ||
4 | |||
3 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
4 | #include <qfile.h> | 6 | #include <qfile.h> |
5 | #include <qtextstream.h> | 7 | #include <qtextstream.h> |
6 | #include <qregexp.h> | 8 | #include <qregexp.h> |
7 | 9 | ||
8 | // The three stanza's | 10 | // The three stanza's |
9 | #define AUTO "auto" | 11 | #define AUTO "auto" |
10 | #define IFACE "iface" | 12 | #define IFACE "iface" |
11 | #define MAPPING "mapping" | 13 | #define MAPPING "mapping" |
12 | 14 | ||
13 | /** | 15 | /** |
14 | * Constructor. Reads in the interfaces file and then split the file up by | 16 | * Constructor. Reads in the interfaces file and then split the file up by |
15 | * the \n for interfaces variable. | 17 | * the \n for interfaces variable. |
16 | * @param useInterfacesFile if an interface file other then the default is | 18 | * @param useInterfacesFile if an interface file other then the default is |
17 | * desired to be used it should be passed in. | 19 | * desired to be used it should be passed in. |
18 | */ | 20 | */ |
19 | Interfaces::Interfaces(QString useInterfacesFile){ | 21 | Interfaces::Interfaces(QString useInterfacesFile){ |
20 | acceptedFamily.append(INTERFACES_FAMILY_INET); | 22 | acceptedFamily.append(INTERFACES_FAMILY_INET); |
21 | acceptedFamily.append(INTERFACES_FAMILY_IPX); | 23 | acceptedFamily.append(INTERFACES_FAMILY_IPX); |
22 | acceptedFamily.append(INTERFACES_FAMILY_INET6); | 24 | acceptedFamily.append(INTERFACES_FAMILY_INET6); |
23 | 25 | ||
24 | interfacesFile = useInterfacesFile; | 26 | interfacesFile = useInterfacesFile; |
25 | QFile file(interfacesFile); | 27 | QFile file(interfacesFile); |
26 | if (!file.open(IO_ReadOnly)){ | 28 | if (!file.open(IO_ReadOnly)){ |
27 | odebug << "Interfaces: Can't open file: " << interfacesFile.latin1() << " for reading." << oendl; | 29 | odebug << "Interfaces: Can't open file: " << interfacesFile.latin1() << " for reading." << oendl; |
28 | currentIface = interfaces.end(); | 30 | currentIface = interfaces.end(); |
29 | currentMapping = interfaces.end(); | 31 | currentMapping = interfaces.end(); |
30 | return; | 32 | return; |
31 | } | 33 | } |
32 | QTextStream stream( &file ); | 34 | QTextStream stream( &file ); |
33 | QString line; | 35 | QString line; |
34 | while ( !stream.eof() ) { | 36 | while ( !stream.eof() ) { |
35 | line += stream.readLine(); | 37 | line += stream.readLine(); |
36 | line += "\n"; | 38 | line += "\n"; |
37 | } | 39 | } |
38 | file.close(); | 40 | file.close(); |
39 | interfaces = QStringList::split("\n", line, true); | 41 | interfaces = QStringList::split("\n", line, true); |
40 | 42 | ||
41 | currentIface = interfaces.end(); | 43 | currentIface = interfaces.end(); |
42 | currentMapping = interfaces.end(); | 44 | currentMapping = interfaces.end(); |
43 | } | 45 | } |
44 | 46 | ||
45 | 47 | ||
46 | /** | 48 | /** |
47 | * Get a list of all interfaces in the interface file. Useful for | 49 | * Get a list of all interfaces in the interface file. Useful for |
48 | * hardware that is not currently connected such as an 802.11b card | 50 | * hardware that is not currently connected such as an 802.11b card |
49 | * not plugged in, but configured for when it is plugged in. | 51 | * not plugged in, but configured for when it is plugged in. |
50 | * @return Return string list of interfaces. | 52 | * @return Return string list of interfaces. |
51 | **/ | 53 | **/ |
52 | QStringList Interfaces::getInterfaceList(){ | 54 | QStringList Interfaces::getInterfaceList(){ |
53 | QStringList list; | 55 | QStringList list; |
54 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { | 56 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { |
55 | QString line = (*it).simplifyWhiteSpace(); | 57 | QString line = (*it).simplifyWhiteSpace(); |
56 | if(line.contains(IFACE) && line.at(0) != '#'){ | 58 | if(line.contains(IFACE) && line.at(0) != '#'){ |
57 | line = line.mid(QString(IFACE).length() +1, line.length()); | 59 | line = line.mid(QString(IFACE).length() +1, line.length()); |
58 | line = line.simplifyWhiteSpace(); | 60 | line = line.simplifyWhiteSpace(); |
59 | int findSpace = line.find(" "); | 61 | int findSpace = line.find(" "); |
60 | if( findSpace >= 0){ | 62 | if( findSpace >= 0){ |
61 | line = line.mid(0, findSpace); | 63 | line = line.mid(0, findSpace); |
62 | list.append(line); | 64 | list.append(line); |
63 | } | 65 | } |
64 | } | 66 | } |
65 | } | 67 | } |
66 | return list; | 68 | return list; |
67 | } | 69 | } |
68 | 70 | ||
69 | /** | 71 | /** |
70 | * Find out if interface is in an "auto" group or not. | 72 | * Find out if interface is in an "auto" group or not. |
71 | * Report any duplicates such as eth0 being in two differnt auto's | 73 | * Report any duplicates such as eth0 being in two differnt auto's |
72 | * @param interface interface to check to see if it is on or not. | 74 | * @param interface interface to check to see if it is on or not. |
73 | * @return true is interface is in auto | 75 | * @return true is interface is in auto |
74 | */ | 76 | */ |
75 | bool Interfaces::isAuto(const QString &interface) const { | 77 | bool Interfaces::isAuto(const QString &interface) const { |
76 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); | 78 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); |
77 | QStringList awi = autoLines.grep(QRegExp(interface)); | 79 | QStringList awi = autoLines.grep(QRegExp(interface)); |
78 | if(awi.count() > 1) | 80 | if(awi.count() > 1) |
79 | odebug << QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1() << oendl; | 81 | odebug << QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1() << oendl; |
80 | return awi.count() > 0; | 82 | return awi.count() > 0; |
81 | } | 83 | } |
82 | 84 | ||
83 | /** | 85 | /** |
84 | * Attempt to set the auto option for interface to setAuto. | 86 | * Attempt to set the auto option for interface to setAuto. |
85 | * @param interface the interface to set | 87 | * @param interface the interface to set |
86 | * @param setAuto the value to set interface to. | 88 | * @param setAuto the value to set interface to. |
87 | * @return false if already set to setAuto. | 89 | * @return false if already set to setAuto. |
88 | * */ | 90 | * */ |
89 | bool Interfaces::setAuto(const QString &interface, bool setAuto){ | 91 | bool Interfaces::setAuto(const QString &interface, bool setAuto){ |
90 | // Don't need to set it if it is already set. | 92 | // Don't need to set it if it is already set. |
91 | if(isAuto(interface) == setAuto) | 93 | if(isAuto(interface) == setAuto) |
92 | return false; | 94 | return false; |
93 | 95 | ||
94 | bool changed = false; | 96 | bool changed = false; |
95 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { | 97 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { |
96 | if((*it).contains(AUTO)){ | 98 | if((*it).contains(AUTO)){ |
97 | //We know that they are not in any group so let add to this auto. | 99 | //We know that they are not in any group so let add to this auto. |
98 | if(setAuto){ | 100 | if(setAuto){ |
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index ec3bad3..8498759 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |||
@@ -1,111 +1,112 @@ | |||
1 | #include "interfacesetupimp.h" | 1 | #include "interfacesetupimp.h" |
2 | #include "interface.h" | 2 | #include "interface.h" |
3 | 3 | ||
4 | #include <qcheckbox.h> | 4 | #include <qcheckbox.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qspinbox.h> | 6 | #include <qspinbox.h> |
7 | #include <qgroupbox.h> | 7 | #include <qgroupbox.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | 9 | ||
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | 11 | ||
12 | #include <opie2/oprocess.h> | 12 | #include <opie2/oprocess.h> |
13 | 13 | ||
14 | #ifdef QWS | 14 | #ifdef QWS |
15 | #include <opie2/owait.h> | 15 | #include <opie2/owait.h> |
16 | #include <opie2/odebug.h> | ||
16 | #include <qpe/global.h> | 17 | #include <qpe/global.h> |
17 | #include <qapplication.h> | 18 | #include <qapplication.h> |
18 | #endif | 19 | #endif |
19 | 20 | ||
20 | #define DNSSCRIPT "changedns" | 21 | #define DNSSCRIPT "changedns" |
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Constuctor. Set up the connection. A profile must be set. | 24 | * Constuctor. Set up the connection. A profile must be set. |
24 | */ | 25 | */ |
25 | using namespace Opie::Ui; | 26 | using namespace Opie::Ui; |
26 | using namespace Opie::Core; | 27 | using namespace Opie::Core; |
27 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){ | 28 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){ |
28 | if (j == 0) { | 29 | if (j == 0) { |
29 | delInterfaces = true; | 30 | delInterfaces = true; |
30 | interfaces = new Interfaces; | 31 | interfaces = new Interfaces; |
31 | } | 32 | } |
32 | } | 33 | } |
33 | 34 | ||
34 | /** | 35 | /** |
35 | * Destructor | 36 | * Destructor |
36 | */ | 37 | */ |
37 | InterfaceSetupImp::~InterfaceSetupImp(){ | 38 | InterfaceSetupImp::~InterfaceSetupImp(){ |
38 | if(delInterfaces) { | 39 | if(delInterfaces) { |
39 | delete interfaces; | 40 | delete interfaces; |
40 | } | 41 | } |
41 | } | 42 | } |
42 | 43 | ||
43 | /** | 44 | /** |
44 | * Save the current settings, then write out the interfaces file and close. | 45 | * Save the current settings, then write out the interfaces file and close. |
45 | */ | 46 | */ |
46 | bool InterfaceSetupImp::saveChanges(){ | 47 | bool InterfaceSetupImp::saveChanges(){ |
47 | bool error; | 48 | bool error; |
48 | QString iface = interfaces->getInterfaceName(error); | 49 | QString iface = interfaces->getInterfaceName(error); |
49 | odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl; | 50 | odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl; |
50 | if(!saveSettings()) | 51 | if(!saveSettings()) |
51 | return false; | 52 | return false; |
52 | 53 | ||
53 | interfaces->write(); | 54 | interfaces->write(); |
54 | 55 | ||
55 | if (interface->getStatus()) { | 56 | if (interface->getStatus()) { |
56 | QString ifup; | 57 | QString ifup; |
57 | ifup += "ifdown "; | 58 | ifup += "ifdown "; |
58 | ifup += iface; | 59 | ifup += iface; |
59 | ifup += "; ifup "; | 60 | ifup += "; ifup "; |
60 | ifup += iface; | 61 | ifup += iface; |
61 | ifup += ";"; | 62 | ifup += ";"; |
62 | 63 | ||
63 | OProcess restart; | 64 | OProcess restart; |
64 | restart << "sh"; | 65 | restart << "sh"; |
65 | restart << "-c"; | 66 | restart << "-c"; |
66 | restart << ifup; | 67 | restart << ifup; |
67 | 68 | ||
68 | OWait *owait = new OWait(); | 69 | OWait *owait = new OWait(); |
69 | Global::statusMessage( tr( "Restarting interface" ) ); | 70 | Global::statusMessage( tr( "Restarting interface" ) ); |
70 | 71 | ||
71 | owait->show(); | 72 | owait->show(); |
72 | qApp->processEvents(); | 73 | qApp->processEvents(); |
73 | 74 | ||
74 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { | 75 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { |
75 | owarn << "unstable to spawn ifdown/ifup" << oendl; | 76 | owarn << "unstable to spawn ifdown/ifup" << oendl; |
76 | } | 77 | } |
77 | 78 | ||
78 | owait->hide(); | 79 | owait->hide(); |
79 | delete owait; | 80 | delete owait; |
80 | 81 | ||
81 | interface->refresh(); | 82 | interface->refresh(); |
82 | } | 83 | } |
83 | return true; | 84 | return true; |
84 | } | 85 | } |
85 | 86 | ||
86 | /** | 87 | /** |
87 | * Save the settings for the current Interface. | 88 | * Save the settings for the current Interface. |
88 | * @return bool true if successful, false otherwise | 89 | * @return bool true if successful, false otherwise |
89 | */ | 90 | */ |
90 | bool InterfaceSetupImp::saveSettings(){ | 91 | bool InterfaceSetupImp::saveSettings(){ |
91 | // eh can't really do anything about it other then return. :-D | 92 | // eh can't really do anything about it other then return. :-D |
92 | if(!interfaces->isInterfaceSet()) | 93 | if(!interfaces->isInterfaceSet()) |
93 | return true; | 94 | return true; |
94 | 95 | ||
95 | bool error = false; | 96 | bool error = false; |
96 | // Loopback case | 97 | // Loopback case |
97 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 98 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
98 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 99 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
99 | return true; | 100 | return true; |
100 | } | 101 | } |
101 | 102 | ||
102 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ | 103 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ |
103 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); | 104 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); |
104 | return false; | 105 | return false; |
105 | } | 106 | } |
106 | // DHCP | 107 | // DHCP |
107 | if(dhcpCheckBox->isChecked()) { | 108 | if(dhcpCheckBox->isChecked()) { |
108 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); | 109 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); |
109 | interfaces->removeInterfaceOption("address"); | 110 | interfaces->removeInterfaceOption("address"); |
110 | interfaces->removeInterfaceOption("netmask"); | 111 | interfaces->removeInterfaceOption("netmask"); |
111 | interfaces->removeInterfaceOption("gateway"); | 112 | interfaces->removeInterfaceOption("gateway"); |
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 3e1a650..5184630 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,105 +1,106 @@ | |||
1 | 1 | ||
2 | #include "mainwindowimp.h" | 2 | #include "mainwindowimp.h" |
3 | #include "addconnectionimp.h" | 3 | #include "addconnectionimp.h" |
4 | #include "interfaceinformationimp.h" | 4 | #include "interfaceinformationimp.h" |
5 | #include "interfacesetupimp.h" | 5 | #include "interfacesetupimp.h" |
6 | #include "interfaces.h" | 6 | #include "interfaces.h" |
7 | #include "module.h" | 7 | #include "module.h" |
8 | 8 | ||
9 | /* OPIE */ | 9 | /* OPIE */ |
10 | #include <opie2/odebug.h> | ||
10 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
11 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
12 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
13 | #include <qpe/qlibrary.h> | 14 | #include <qpe/qlibrary.h> |
14 | #include <qpe/resource.h> | 15 | #include <qpe/resource.h> |
15 | 16 | ||
16 | /* QT */ | 17 | /* QT */ |
17 | #include <qpushbutton.h> | 18 | #include <qpushbutton.h> |
18 | #include <qlistbox.h> | 19 | #include <qlistbox.h> |
19 | #include <qlineedit.h> | 20 | #include <qlineedit.h> |
20 | #include <qlistview.h> | 21 | #include <qlistview.h> |
21 | #include <qheader.h> | 22 | #include <qheader.h> |
22 | #include <qlabel.h> | 23 | #include <qlabel.h> |
23 | #include <qtabwidget.h> // in order to disable the profiles tab | 24 | #include <qtabwidget.h> // in order to disable the profiles tab |
24 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
25 | 26 | ||
26 | 27 | ||
27 | #if QT_VERSION < 300 | 28 | #if QT_VERSION < 300 |
28 | #include <qlist.h> | 29 | #include <qlist.h> |
29 | #else | 30 | #else |
30 | #include <qptrlist.h> | 31 | #include <qptrlist.h> |
31 | #endif | 32 | #endif |
32 | #include <qdir.h> | 33 | #include <qdir.h> |
33 | #include <qfile.h> | 34 | #include <qfile.h> |
34 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
35 | #include <qregexp.h> | 36 | #include <qregexp.h> |
36 | 37 | ||
37 | /* STD */ | 38 | /* STD */ |
38 | #include <net/if.h> | 39 | #include <net/if.h> |
39 | #include <sys/ioctl.h> | 40 | #include <sys/ioctl.h> |
40 | #include <sys/socket.h> | 41 | #include <sys/socket.h> |
41 | 42 | ||
42 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" | 43 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" |
43 | #define _PROCNETDEV "/proc/net/dev" | 44 | #define _PROCNETDEV "/proc/net/dev" |
44 | 45 | ||
45 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME) | 46 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME) |
46 | { | 47 | { |
47 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 48 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
48 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 49 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
49 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 50 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
50 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 51 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
51 | 52 | ||
52 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 53 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
53 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); | 54 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); |
54 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); | 55 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); |
55 | 56 | ||
56 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); | 57 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); |
57 | 58 | ||
58 | //FIXME: disable profiles for the moment: | 59 | //FIXME: disable profiles for the moment: |
59 | tabWidget->setTabEnabled( tab, false ); | 60 | tabWidget->setTabEnabled( tab, false ); |
60 | 61 | ||
61 | // Load connections. | 62 | // Load connections. |
62 | // /usr/local/kde/lib/libinterfaces.la | 63 | // /usr/local/kde/lib/libinterfaces.la |
63 | #ifdef QWS | 64 | #ifdef QWS |
64 | loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); | 65 | loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); |
65 | #else | 66 | #else |
66 | loader = KLibLoader::self(); | 67 | loader = KLibLoader::self(); |
67 | loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); | 68 | loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); |
68 | #endif | 69 | #endif |
69 | getAllInterfaces(); | 70 | getAllInterfaces(); |
70 | 71 | ||
71 | Interfaces i; | 72 | Interfaces i; |
72 | QStringList list = i.getInterfaceList(); | 73 | QStringList list = i.getInterfaceList(); |
73 | QMap<QString, Interface*>::Iterator it; | 74 | QMap<QString, Interface*>::Iterator it; |
74 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) | 75 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) |
75 | { | 76 | { |
76 | /* | 77 | /* |
77 | * we skipped it in getAllInterfaces now | 78 | * we skipped it in getAllInterfaces now |
78 | * we need to ignore it as well | 79 | * we need to ignore it as well |
79 | */ | 80 | */ |
80 | if (m_handledIfaces.contains( *ni) ) | 81 | if (m_handledIfaces.contains( *ni) ) |
81 | { | 82 | { |
82 | odebug << "Not up iface handled by module" << oendl; | 83 | odebug << "Not up iface handled by module" << oendl; |
83 | continue; | 84 | continue; |
84 | } | 85 | } |
85 | bool found = false; | 86 | bool found = false; |
86 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) | 87 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) |
87 | { | 88 | { |
88 | if(it.key() == (*ni)) | 89 | if(it.key() == (*ni)) |
89 | found = true; | 90 | found = true; |
90 | } | 91 | } |
91 | if(!found) | 92 | if(!found) |
92 | { | 93 | { |
93 | if(!(*ni).contains("_")) | 94 | if(!(*ni).contains("_")) |
94 | { | 95 | { |
95 | Interface *i = new Interface(this, *ni, false); | 96 | Interface *i = new Interface(this, *ni, false); |
96 | i->setAttached(false); | 97 | i->setAttached(false); |
97 | i->setHardwareName(tr("Disconnected")); | 98 | i->setHardwareName(tr("Disconnected")); |
98 | interfaceNames.insert(i->getInterfaceName(), i); | 99 | interfaceNames.insert(i->getInterfaceName(), i); |
99 | updateInterface(i); | 100 | updateInterface(i); |
100 | connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*))); | 101 | connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*))); |
101 | } | 102 | } |
102 | } | 103 | } |
103 | } | 104 | } |
104 | 105 | ||
105 | //getInterfaceList(); | 106 | //getInterfaceList(); |