author | benmeyer <benmeyer> | 2002-11-13 16:25:04 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-11-13 16:25:04 (UTC) |
commit | d3301ad9a74fdf693551bd70bc3cf34b311eaa49 (patch) (unidiff) | |
tree | fdc7ee3650af3e7225e1a8966e12bc2c1007b986 /noncore/settings/networksettings/interfaces | |
parent | 2bc05c54b2ff1a9b2af7d6bd4d55428cfe0d8db3 (diff) | |
download | opie-d3301ad9a74fdf693551bd70bc3cf34b311eaa49.zip opie-d3301ad9a74fdf693551bd70bc3cf34b311eaa49.tar.gz opie-d3301ad9a74fdf693551bd70bc3cf34b311eaa49.tar.bz2 |
code cleanup const's placed in code
Diffstat (limited to 'noncore/settings/networksettings/interfaces') (more/less context) (show whitespace changes)
5 files changed, 29 insertions, 28 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp index 4129b3d..7ffa76f 100644 --- a/noncore/settings/networksettings/interfaces/interface.cpp +++ b/noncore/settings/networksettings/interfaces/interface.cpp | |||
@@ -8,13 +8,13 @@ | |||
8 | #define IFCONFIG "/sbin/ifconfig" | 8 | #define IFCONFIG "/sbin/ifconfig" |
9 | #define DHCP_INFO_DIR "/etc/dhcpc" | 9 | #define DHCP_INFO_DIR "/etc/dhcpc" |
10 | 10 | ||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
13 | 13 | ||
14 | Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ | 14 | 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"){ |
15 | refresh(); | 15 | refresh(); |
16 | } | 16 | } |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Set status | 19 | * Set status |
20 | * @param newStatus - the new status | 20 | * @param newStatus - the new status |
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h index 989d6d8..d37834a 100644 --- a/noncore/settings/networksettings/interfaces/interface.h +++ b/noncore/settings/networksettings/interfaces/interface.h | |||
@@ -13,59 +13,60 @@ signals: | |||
13 | void updateInterface(Interface *i); | 13 | void updateInterface(Interface *i); |
14 | void updateMessage(const QString &message); | 14 | void updateMessage(const QString &message); |
15 | 15 | ||
16 | public: | 16 | public: |
17 | Interface(QObject * parent=0, const char * name= "unknown", bool status = false); | 17 | Interface(QObject * parent=0, const char * name= "unknown", bool status = false); |
18 | 18 | ||
19 | QString getInterfaceName(){ QString n(this->name()); return n; }; | 19 | QString getInterfaceName() const { QString n(this->name()); return n; }; |
20 | 20 | ||
21 | bool getStatus(){ return status; }; | 21 | bool getStatus() const { return status; }; |
22 | void setStatus(bool newStatus); | 22 | void setStatus(bool newStatus); |
23 | 23 | ||
24 | bool isAttached(){ return attached; }; | 24 | bool isAttached() const { return attached; }; |
25 | void setAttached(bool isAttached=false); | 25 | void setAttached(bool isAttached=false); |
26 | 26 | ||
27 | QString getHardwareName(){ return hardwareName; }; | 27 | QString getHardwareName() const { return hardwareName; }; |
28 | void setHardwareName(const QString &name="Unknown"); | 28 | void setHardwareName(const QString &name="Unknown"); |
29 | 29 | ||
30 | Module* getModuleOwner(){ return moduleOwner; }; | 30 | Module* getModuleOwner() const { return moduleOwner; }; |
31 | void setModuleOwner(Module *owner=NULL); | 31 | void setModuleOwner(Module *owner=NULL); |
32 | 32 | ||
33 | // inet information. | 33 | // inet information. |
34 | QString getMacAddress(){ return macAddress; }; | 34 | QString getMacAddress() const { return macAddress; }; |
35 | QString getIp(){ return ip; }; | 35 | QString getIp() const { return ip; }; |
36 | QString getSubnetMask(){ return subnetMask; }; | 36 | QString getSubnetMask() const { return subnetMask; }; |
37 | QString getBroadcast(){ return broadcast; }; | 37 | QString getBroadcast() const { return broadcast; }; |
38 | bool isDhcp(){ return dhcp; }; | 38 | bool isDhcp() const { return dhcp; }; |
39 | QString getDhcpServerIp(){ return dhcpServerIp; }; | 39 | QString getDhcpServerIp() const { return dhcpServerIp; }; |
40 | QString getLeaseObtained(){ return leaseObtained; }; | 40 | QString getLeaseObtained() const { return leaseObtained; }; |
41 | QString getLeaseExpires(){ return leaseExpires; }; | 41 | QString getLeaseExpires() const { return leaseExpires; }; |
42 | 42 | ||
43 | public slots: | 43 | public slots: |
44 | bool refresh(); | 44 | bool refresh(); |
45 | void start(); | 45 | void start(); |
46 | void stop(); | 46 | void stop(); |
47 | void restart(); | 47 | void restart(); |
48 | 48 | ||
49 | private: | 49 | private: |
50 | // Interface information | 50 | // Interface information |
51 | bool status; | ||
52 | bool attached; | ||
53 | QString hardwareName; | 51 | QString hardwareName; |
54 | Module *moduleOwner; | 52 | Module *moduleOwner; |
53 | bool status; | ||
54 | bool attached; | ||
55 | 55 | ||
56 | // Network information | 56 | // Network information |
57 | QString macAddress; | ||
58 | QString ip; | ||
59 | QString broadcast; | ||
60 | QString subnetMask; | ||
61 | bool dhcp; | 57 | bool dhcp; |
62 | QString dhcpServerIp; | 58 | QString dhcpServerIp; |
63 | QString leaseObtained; | 59 | QString leaseObtained; |
64 | QString leaseExpires; | 60 | QString leaseExpires; |
65 | 61 | ||
62 | QString macAddress; | ||
63 | QString ip; | ||
64 | QString broadcast; | ||
65 | QString subnetMask; | ||
66 | |||
66 | }; | 67 | }; |
67 | 68 | ||
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | // interface.h | 71 | // interface.h |
71 | 72 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp index e49998e..8f685fe 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces/interfaces.cpp | |||
@@ -68,13 +68,13 @@ QStringList Interfaces::getInterfaceList(){ | |||
68 | /** | 68 | /** |
69 | * Find out if interface is in an "auto" group or not. | 69 | * Find out if interface is in an "auto" group or not. |
70 | * Report any duplicates such as eth0 being in two differnt auto's | 70 | * Report any duplicates such as eth0 being in two differnt auto's |
71 | * @param interface interface to check to see if it is on or not. | 71 | * @param interface interface to check to see if it is on or not. |
72 | * @return true is interface is in auto | 72 | * @return true is interface is in auto |
73 | */ | 73 | */ |
74 | bool Interfaces::isAuto(const QString &interface){ | 74 | bool Interfaces::isAuto(const QString &interface) const { |
75 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); | 75 | QStringList autoLines = interfaces.grep(QRegExp(AUTO)); |
76 | QStringList awi = autoLines.grep(QRegExp(interface)); | 76 | QStringList awi = autoLines.grep(QRegExp(interface)); |
77 | if(awi.count() > 1) | 77 | if(awi.count() > 1) |
78 | qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); | 78 | qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); |
79 | if(awi.count() < 1) | 79 | if(awi.count() < 1) |
80 | return false; | 80 | return false; |
@@ -136,14 +136,14 @@ bool Interfaces::setInterface(QString interface){ | |||
136 | } | 136 | } |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * A quick helper funtion to see if the current interface is set. | 139 | * A quick helper funtion to see if the current interface is set. |
140 | * @return bool true if set, false otherwise. | 140 | * @return bool true if set, false otherwise. |
141 | */ | 141 | */ |
142 | bool Interfaces::isInterfaceSet(){ | 142 | bool Interfaces::isInterfaceSet() const { |
143 | return (currentIface != interfaces.end()); | 143 | return (interfaces.end() != currentIface); |
144 | } | 144 | } |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * Add a new interface of with the settings - family and method | 147 | * Add a new interface of with the settings - family and method |
148 | * @param interface the name of the interface to set. All whitespace is | 148 | * @param interface the name of the interface to set. All whitespace is |
149 | * removed from the interface name. | 149 | * removed from the interface name. |
diff --git a/noncore/settings/networksettings/interfaces/interfaces.h b/noncore/settings/networksettings/interfaces/interfaces.h index d662919..bac2a7e 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.h +++ b/noncore/settings/networksettings/interfaces/interfaces.h | |||
@@ -22,20 +22,20 @@ | |||
22 | class Interfaces { | 22 | class Interfaces { |
23 | 23 | ||
24 | public: | 24 | public: |
25 | Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); | 25 | Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); |
26 | QStringList getInterfaceList(); | 26 | QStringList getInterfaceList(); |
27 | 27 | ||
28 | bool isAuto(const QString &interface); | 28 | bool isAuto(const QString &interface) const ; |
29 | bool setAuto(const QString &interface, bool setAuto); | 29 | bool setAuto(const QString &interface, bool setAuto); |
30 | 30 | ||
31 | bool removeInterface(); | 31 | bool removeInterface(); |
32 | bool addInterface(const QString &interface, const QString &family, const QString &method); | 32 | bool addInterface(const QString &interface, const QString &family, const QString &method); |
33 | bool copyInterface(const QString &oldInterface, const QString &newInterface); | 33 | bool copyInterface(const QString &oldInterface, const QString &newInterface); |
34 | bool setInterface(QString interface); | 34 | bool setInterface(QString interface); |
35 | bool isInterfaceSet(); | 35 | bool isInterfaceSet() const ; |
36 | QString getInterfaceName(bool &error); | 36 | QString getInterfaceName(bool &error); |
37 | bool setInterfaceName(const QString &newName); | 37 | bool setInterfaceName(const QString &newName); |
38 | QString getInterfaceFamily(bool &error); | 38 | QString getInterfaceFamily(bool &error); |
39 | bool setInterfaceFamily(const QString &newName); | 39 | bool setInterfaceFamily(const QString &newName); |
40 | QString getInterfaceMethod(bool &error); | 40 | QString getInterfaceMethod(bool &error); |
41 | bool setInterfaceMethod(const QString &newName); | 41 | bool setInterfaceMethod(const QString &newName); |
@@ -54,17 +54,17 @@ public: | |||
54 | QString getScript(bool &error); | 54 | QString getScript(bool &error); |
55 | 55 | ||
56 | bool write(); | 56 | bool write(); |
57 | 57 | ||
58 | private: | 58 | private: |
59 | bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator); | 59 | bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator); |
60 | bool removeStanza(QStringList::Iterator &stanza); | ||
60 | bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value); | 61 | bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value); |
62 | bool removeAllOptions(const QStringList::Iterator &start); | ||
61 | bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value); | 63 | bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value); |
62 | QString getOption(const QStringList::Iterator &start, const QString &option, bool &error); | 64 | QString getOption(const QStringList::Iterator &start, const QString &option, bool &error); |
63 | bool removeStanza(QStringList::Iterator &stanza); | ||
64 | bool removeAllOptions(const QStringList::Iterator &start); | ||
65 | 65 | ||
66 | QString interfacesFile; | 66 | QString interfacesFile; |
67 | QStringList interfaces; | 67 | QStringList interfaces; |
68 | QStringList::Iterator currentIface; | 68 | QStringList::Iterator currentIface; |
69 | QStringList::Iterator currentMapping; | 69 | QStringList::Iterator currentMapping; |
70 | 70 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfaces.pro b/noncore/settings/networksettings/interfaces/interfaces.pro index 9a024f6..d6b43fb 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.pro +++ b/noncore/settings/networksettings/interfaces/interfaces.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #CONFIG += qt warn_on debug | 3 | #CONFIG += qt warn_on debug |
4 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 4 | #DESTDIR = $(QTDIR)/lib$(PROJMAK) |
5 | HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h | 5 | HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h |
6 | SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp | 6 | SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include ../ | 7 | INCLUDEPATH+= $(OPIEDIR)/include ../ |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui | 10 | INTERFACES= interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui |