-rw-r--r-- | noncore/settings/networksettings/interfaces/interface.h | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/module.h | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h index ec82851..83ab088 100644 --- a/noncore/settings/networksettings/interfaces/interface.h +++ b/noncore/settings/networksettings/interfaces/interface.h | |||
@@ -1,72 +1,79 @@ | |||
1 | #ifndef INTERFACE_H | 1 | #ifndef INTERFACE_H |
2 | #define INTERFACE_H | 2 | #define INTERFACE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | 6 | ||
7 | class Module; | 7 | class Module; |
8 | 8 | ||
9 | /** | ||
10 | * A Interface represents a physical device. You can | ||
11 | * inherit it and create also virtual devices. Like saved | ||
12 | * ppp dial ups or vpn. Interface is used for representing | ||
13 | * your interface to the User and its actions. | ||
14 | * | ||
15 | */ | ||
9 | class Interface : public QObject{ | 16 | class Interface : public QObject{ |
10 | Q_OBJECT | 17 | Q_OBJECT |
11 | 18 | ||
12 | signals: | 19 | signals: |
13 | void updateInterface(Interface *i); | 20 | void updateInterface(Interface *i); |
14 | void updateMessage(const QString &message); | 21 | void updateMessage(const QString &message); |
15 | 22 | ||
16 | public: | 23 | public: |
17 | Interface(QObject * parent=0, const char * name= "unknown", bool status = false); | 24 | Interface(QObject * parent=0, const char * name= "unknown", bool status = false); |
18 | 25 | ||
19 | QString getInterfaceName() const { QString n(this->name()); return n; }; | 26 | QString getInterfaceName() const { QString n(this->name()); return n; }; |
20 | void setInterfaceName( const QString &n ) { this->setName(n); }; | 27 | void setInterfaceName( const QString &n ) { this->setName(n); }; |
21 | 28 | ||
22 | bool getStatus() const { return status; }; | 29 | bool getStatus() const { return status; }; |
23 | void setStatus(bool newStatus); | 30 | void setStatus(bool newStatus); |
24 | 31 | ||
25 | bool isAttached() const { return attached; }; | 32 | bool isAttached() const { return attached; }; |
26 | void setAttached(bool isAttached=false); | 33 | void setAttached(bool isAttached=false); |
27 | 34 | ||
28 | QString getHardwareName() const { return hardwareName; }; | 35 | QString getHardwareName() const { return hardwareName; }; |
29 | void setHardwareName(const QString &name="Unknown"); | 36 | void setHardwareName(const QString &name="Unknown"); |
30 | 37 | ||
31 | Module* getModuleOwner() const { return moduleOwner; }; | 38 | Module* getModuleOwner() const { return moduleOwner; }; |
32 | void setModuleOwner(Module *owner=NULL); | 39 | void setModuleOwner(Module *owner=NULL); |
33 | 40 | ||
34 | // inet information. | 41 | // inet information. |
35 | QString getMacAddress() const { return macAddress; }; | 42 | QString getMacAddress() const { return macAddress; }; |
36 | QString getIp() const { return ip; }; | 43 | QString getIp() const { return ip; }; |
37 | QString getSubnetMask() const { return subnetMask; }; | 44 | QString getSubnetMask() const { return subnetMask; }; |
38 | QString getBroadcast() const { return broadcast; }; | 45 | QString getBroadcast() const { return broadcast; }; |
39 | bool isDhcp() const { return dhcp; }; | 46 | bool isDhcp() const { return dhcp; }; |
40 | QString getDhcpServerIp() const { return dhcpServerIp; }; | 47 | QString getDhcpServerIp() const { return dhcpServerIp; }; |
41 | QString getLeaseObtained() const { return leaseObtained; }; | 48 | QString getLeaseObtained() const { return leaseObtained; }; |
42 | QString getLeaseExpires() const { return leaseExpires; }; | 49 | QString getLeaseExpires() const { return leaseExpires; }; |
43 | 50 | ||
44 | public slots: | 51 | public slots: |
45 | virtual bool refresh(); | 52 | virtual bool refresh(); |
46 | virtual void start(); | 53 | virtual void start(); |
47 | virtual void stop(); | 54 | virtual void stop(); |
48 | virtual void restart(); | 55 | virtual void restart(); |
49 | 56 | ||
50 | protected: | 57 | protected: |
51 | // Interface information | 58 | // Interface information |
52 | QString hardwareName; | 59 | QString hardwareName; |
53 | Module *moduleOwner; | 60 | Module *moduleOwner; |
54 | bool status; | 61 | bool status; |
55 | bool attached; | 62 | bool attached; |
56 | 63 | ||
57 | // Network information | 64 | // Network information |
58 | bool dhcp; | 65 | bool dhcp; |
59 | QString dhcpServerIp; | 66 | QString dhcpServerIp; |
60 | QString leaseObtained; | 67 | QString leaseObtained; |
61 | QString leaseExpires; | 68 | QString leaseExpires; |
62 | 69 | ||
63 | QString macAddress; | 70 | QString macAddress; |
64 | QString ip; | 71 | QString ip; |
65 | QString broadcast; | 72 | QString broadcast; |
66 | QString subnetMask; | 73 | QString subnetMask; |
67 | 74 | ||
68 | }; | 75 | }; |
69 | 76 | ||
70 | #endif | 77 | #endif |
71 | 78 | ||
72 | // interface.h | 79 | // interface.h |
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h index 3ef823c..9dc913e 100644 --- a/noncore/settings/networksettings/module.h +++ b/noncore/settings/networksettings/module.h | |||
@@ -25,152 +25,164 @@ class QTabWidget; | |||
25 | * for activation. You need to provide the following function yourself. | 25 | * for activation. You need to provide the following function yourself. |
26 | * | 26 | * |
27 | * A module needs to provide Name, Images, and methods for | 27 | * A module needs to provide Name, Images, and methods for |
28 | * claiming interfaces. For example you can claim physicla | 28 | * claiming interfaces. For example you can claim physicla |
29 | * interfaces like wlan0, ppp0 or virtual like a VPN | 29 | * interfaces like wlan0, ppp0 or virtual like a VPN |
30 | * connection and hide the real ppp device or ethernet device | 30 | * connection and hide the real ppp device or ethernet device |
31 | * behind your VPN plugin. | 31 | * behind your VPN plugin. |
32 | * | 32 | * |
33 | * During start up. The main application searches for network devices | 33 | * During start up. The main application searches for network devices |
34 | * and then looks for an owner under the plugins for them. | 34 | * and then looks for an owner under the plugins for them. |
35 | * For example the WLAN Plugin looks if there is a WLAN Extension | 35 | * For example the WLAN Plugin looks if there is a WLAN Extension |
36 | * on that interface and then claims it by returning true from isOwner() | 36 | * on that interface and then claims it by returning true from isOwner() |
37 | * | 37 | * |
38 | * \code | 38 | * \code |
39 | * extern "C" | 39 | * extern "C" |
40 | * { | 40 | * { |
41 | * void* create_plugin() { | 41 | * void* create_plugin() { |
42 | * return new WLANModule(); | 42 | * return new WLANModule(); |
43 | * } | 43 | * } |
44 | * }; | 44 | * }; |
45 | * \endcode | 45 | * \endcode |
46 | * @see isOwner(Interface*) | 46 | * @see isOwner(Interface*) |
47 | */ | 47 | */ |
48 | class Module : private QObject{ | 48 | class Module : private QObject{ |
49 | 49 | ||
50 | signals: | 50 | signals: |
51 | /** | 51 | /** |
52 | * Emit this Signal once you change the Interface | 52 | * Emit this Signal once you change the Interface |
53 | * you're operating on | 53 | * you're operating on |
54 | * | 54 | * |
55 | * @param i The Interface | 55 | * @param i The Interface |
56 | */ | 56 | */ |
57 | void updateInterface(Interface *i); | 57 | void updateInterface(Interface *i); |
58 | 58 | ||
59 | 59 | ||
60 | public: | 60 | public: |
61 | Module(){}; | 61 | Module(){}; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * The type of the plugin | 64 | * The type of the plugin |
65 | * and the name of the qcop call | 65 | * and the name of the qcop call |
66 | */ | 66 | */ |
67 | virtual const QString type() = 0; | 67 | virtual const QString type() = 0; |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * The current profile has been changed and the module should do any | 70 | * The current profile has been changed and the module should do any |
71 | * neccesary changes also. | 71 | * neccesary changes also. |
72 | * As of Opie1.0 profiles are disabled. | 72 | * As of Opie1.0 profiles are disabled. |
73 | * | 73 | * |
74 | * @param newProfile what the profile should be changed to. | 74 | * @param newProfile what the profile should be changed to. |
75 | */ | 75 | */ |
76 | virtual void setProfile(const QString &newProfile) = 0; | 76 | virtual void setProfile(const QString &newProfile) = 0; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * get the icon name for this device. | 79 | * get the icon name for this device. |
80 | * @param Interface* can be used in determining the icon. | 80 | * @param Interface* can be used in determining the icon. |
81 | * @return QString the icon name (minus .png, .gif etc) | 81 | * @return QString the icon name (minus .png, .gif etc) |
82 | */ | 82 | */ |
83 | virtual QString getPixmapName(Interface *) = 0; | 83 | virtual QString getPixmapName(Interface *) = 0; |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Check to see if the interface i is owned by this module. | 86 | * Check to see if the interface i is owned by this module. |
87 | * See if you can handle it. And if you can claim ownership | 87 | * See if you can handle it. And if you can claim ownership |
88 | * by returning true. | 88 | * by returning true. |
89 | * For physical devices you will be asked if you want to own the | ||
90 | * device. But you can also create new \sa Interface Implementations. | ||
91 | * | ||
92 | * If you want to own the Interface add it to your internal interface | ||
93 | * list | ||
94 | * | ||
89 | * @param Interface* interface to check against | 95 | * @param Interface* interface to check against |
90 | * @return bool true if i is owned by this module, false otherwise. | 96 | * @return bool true if i is owned by this module, false otherwise. |
97 | * | ||
98 | * @see getInterfaces | ||
91 | */ | 99 | */ |
92 | virtual bool isOwner(Interface *){ return false; }; | 100 | virtual bool isOwner(Interface *){ return false; }; |
93 | 101 | ||
94 | /** | 102 | /** |
95 | * Create and return the Configure Module | 103 | * Create and return the Configure Module |
96 | * @param Interface *i the interface to configure. | 104 | * @param Interface *i the interface to configure. |
97 | * @return QWidget* pointer to this modules configure. | 105 | * @return QWidget* pointer to this modules configure. |
98 | * | 106 | * |
99 | * @see InterfaceSetupImp | 107 | * @see InterfaceSetupImp |
100 | */ | 108 | */ |
101 | virtual QWidget *configure(Interface *){ return NULL; } ; | 109 | virtual QWidget *configure(Interface *){ return NULL; } ; |
102 | 110 | ||
103 | /** | 111 | /** |
104 | * Create, and return the Information Module. | 112 | * Create, and return the Information Module. |
105 | * | 113 | * |
106 | * An default Implementation is InterfaceInformationImp | 114 | * An default Implementation is InterfaceInformationImp |
107 | * | 115 | * |
108 | * @param Interface *i the interface to get info on. | 116 | * @param Interface *i the interface to get info on. |
109 | * @return QWidget* pointer to this modules info. | 117 | * @return QWidget* pointer to this modules info. |
110 | * | 118 | * |
111 | * @see InterfaceInformationImp | 119 | * @see InterfaceInformationImp |
112 | * | 120 | * |
113 | */ | 121 | */ |
114 | virtual QWidget *information(Interface *){ return NULL; }; | 122 | virtual QWidget *information(Interface *){ return NULL; }; |
115 | 123 | ||
116 | /** | 124 | /** |
117 | * Get all active (up or down) interfaces managed by this | 125 | * Get all active (up or down) interfaces managed by this |
118 | * module. | 126 | * module. |
127 | * At the end of initialisation you will be asked to return your interfaces | ||
128 | * Return all of your interfaces even the ones you claimed by isOnwer. | ||
129 | * Here you can also return your 'virtual' Interface Objects | ||
130 | * | ||
119 | * @return QList<Interface> A list of interfaces that exsist that havn't | 131 | * @return QList<Interface> A list of interfaces that exsist that havn't |
120 | * been called by isOwner() | 132 | * been called by isOwner() |
121 | */ | 133 | */ |
122 | virtual QList<Interface> getInterfaces() = 0; | 134 | virtual QList<Interface> getInterfaces() = 0; |
123 | 135 | ||
124 | /** | 136 | /** |
125 | * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp), | 137 | * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp), |
126 | * modem ppp) | 138 | * modem ppp) |
127 | * Both strings need to be translated. The first string is a Shortcut | 139 | * Both strings need to be translated. The first string is a Shortcut |
128 | * like PPP and the second argument is a description. | 140 | * like PPP and the second argument is a description. |
129 | * | 141 | * |
130 | * <code> | 142 | * <code> |
131 | * list.insert( | 143 | * list.insert( |
132 | * | 144 | * |
133 | * </code> | 145 | * </code> |
134 | * | 146 | * |
135 | * @param list A reference to the list of supported additionns. | 147 | * @param list A reference to the list of supported additionns. |
136 | */ | 148 | */ |
137 | virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0; | 149 | virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0; |
138 | 150 | ||
139 | /** | 151 | /** |
140 | * Attempts to create a new interface from name you gave | 152 | * Attempts to create a new interface from name you gave |
141 | * possibleNewInterfaces() | 153 | * possibleNewInterfaces() |
142 | * @return Interface* NULL if it was unable to be created. | 154 | * @return Interface* NULL if it was unable to be created. |
143 | * @param name the type of interface to create | 155 | * @param name the type of interface to create |
144 | * | 156 | * |
145 | * @see possibleNewInterfaces | 157 | * @see possibleNewInterfaces |
146 | */ | 158 | */ |
147 | virtual Interface *addNewInterface(const QString &name) = 0; | 159 | virtual Interface *addNewInterface(const QString &name) = 0; |
148 | 160 | ||
149 | /** | 161 | /** |
150 | * Attempts to remove the interface, doesn't delete i | 162 | * Attempts to remove the interface, doesn't delete i |
151 | * @return bool true if successful, false otherwise. | 163 | * @return bool true if successful, false otherwise. |
152 | */ | 164 | */ |
153 | virtual bool remove(Interface* i) = 0; | 165 | virtual bool remove(Interface* i) = 0; |
154 | 166 | ||
155 | /** | 167 | /** |
156 | * get dcop calls | 168 | * get dcop calls |
157 | */ | 169 | */ |
158 | virtual void receive(const QCString &msg, const QByteArray &arg) = 0; | 170 | virtual void receive(const QCString &msg, const QByteArray &arg) = 0; |
159 | 171 | ||
160 | QStringList handledInterfaceNames()const { return m_inter; } | 172 | QStringList handledInterfaceNames()const { return m_inter; } |
161 | protected: | 173 | protected: |
162 | /** | 174 | /** |
163 | * set which interfaceNames should not be shown cause they're handled | 175 | * set which interfaceNames should not be shown cause they're handled |
164 | * internally of this module.. An already running ppp link or | 176 | * internally of this module.. An already running ppp link or |
165 | * a tunnel... VPN an such | 177 | * a tunnel... VPN an such |
166 | */ | 178 | */ |
167 | void setHandledInterfaceNames( const QStringList& in) { m_inter = in; } | 179 | void setHandledInterfaceNames( const QStringList& in) { m_inter = in; } |
168 | 180 | ||
169 | private: | 181 | private: |
170 | QStringList m_inter; | 182 | QStringList m_inter; |
171 | }; | 183 | }; |
172 | 184 | ||
173 | #endif | 185 | #endif |
174 | 186 | ||
175 | // module.h | 187 | // module.h |
176 | 188 | ||