author | mickeyl <mickeyl> | 2004-07-06 19:12:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-07-06 19:12:40 (UTC) |
commit | ea22af9ff9febc92ae5aa4e57cf09bf4ba16250a (patch) (unidiff) | |
tree | ec229932d73c6fe9eb7a82a5bd4bd6654024771d /noncore/settings/networksettings/interfaces/module.h | |
parent | e7d66cefc040241f97dc726aaf9004efa6c853cd (diff) | |
download | opie-ea22af9ff9febc92ae5aa4e57cf09bf4ba16250a.zip opie-ea22af9ff9febc92ae5aa4e57cf09bf4ba16250a.tar.gz opie-ea22af9ff9febc92ae5aa4e57cf09bf4ba16250a.tar.bz2 |
move module.h
Diffstat (limited to 'noncore/settings/networksettings/interfaces/module.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces/module.h | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/interfaces/module.h b/noncore/settings/networksettings/interfaces/module.h new file mode 100644 index 0000000..9dc913e --- a/dev/null +++ b/noncore/settings/networksettings/interfaces/module.h | |||
@@ -0,0 +1,188 @@ | |||
1 | #ifndef NETCONF_MODULE_H | ||
2 | #define NETCONF_MODULE_H | ||
3 | |||
4 | #include <qobject.h> | ||
5 | #if QT_VERSION < 300 | ||
6 | #include <qlist.h> | ||
7 | #else | ||
8 | #include <qptrlist.h> | ||
9 | #endif | ||
10 | #include <qmap.h> | ||
11 | #include "interface.h" | ||
12 | |||
13 | class QWidget; | ||
14 | class QTabWidget; | ||
15 | |||
16 | |||
17 | /** | ||
18 | * \brief The basis of all plugins | ||
19 | * | ||
20 | * This is the way to extend networksettings with | ||
21 | * extra functionality. | ||
22 | * | ||
23 | * | ||
24 | * Networksettings in the 1.0 release does not use QCOM | ||
25 | * for activation. You need to provide the following function yourself. | ||
26 | * | ||
27 | * A module needs to provide Name, Images, and methods for | ||
28 | * claiming interfaces. For example you can claim physicla | ||
29 | * interfaces like wlan0, ppp0 or virtual like a VPN | ||
30 | * connection and hide the real ppp device or ethernet device | ||
31 | * behind your VPN plugin. | ||
32 | * | ||
33 | * During start up. The main application searches for network devices | ||
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 | ||
36 | * on that interface and then claims it by returning true from isOwner() | ||
37 | * | ||
38 | * \code | ||
39 | * extern "C" | ||
40 | * { | ||
41 | * void* create_plugin() { | ||
42 | * return new WLANModule(); | ||
43 | * } | ||
44 | * }; | ||
45 | * \endcode | ||
46 | * @see isOwner(Interface*) | ||
47 | */ | ||
48 | class Module : private QObject{ | ||
49 | |||
50 | signals: | ||
51 | /** | ||
52 | * Emit this Signal once you change the Interface | ||
53 | * you're operating on | ||
54 | * | ||
55 | * @param i The Interface | ||
56 | */ | ||
57 | void updateInterface(Interface *i); | ||
58 | |||
59 | |||
60 | public: | ||
61 | Module(){}; | ||
62 | |||
63 | /** | ||
64 | * The type of the plugin | ||
65 | * and the name of the qcop call | ||
66 | */ | ||
67 | virtual const QString type() = 0; | ||
68 | |||
69 | /** | ||
70 | * The current profile has been changed and the module should do any | ||
71 | * neccesary changes also. | ||
72 | * As of Opie1.0 profiles are disabled. | ||
73 | * | ||
74 | * @param newProfile what the profile should be changed to. | ||
75 | */ | ||
76 | virtual void setProfile(const QString &newProfile) = 0; | ||
77 | |||
78 | /** | ||
79 | * get the icon name for this device. | ||
80 | * @param Interface* can be used in determining the icon. | ||
81 | * @return QString the icon name (minus .png, .gif etc) | ||
82 | */ | ||
83 | virtual QString getPixmapName(Interface *) = 0; | ||
84 | |||
85 | /** | ||
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 | ||
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 | * | ||
95 | * @param Interface* interface to check against | ||
96 | * @return bool true if i is owned by this module, false otherwise. | ||
97 | * | ||
98 | * @see getInterfaces | ||
99 | */ | ||
100 | virtual bool isOwner(Interface *){ return false; }; | ||
101 | |||
102 | /** | ||
103 | * Create and return the Configure Module | ||
104 | * @param Interface *i the interface to configure. | ||
105 | * @return QWidget* pointer to this modules configure. | ||
106 | * | ||
107 | * @see InterfaceSetupImp | ||
108 | */ | ||
109 | virtual QWidget *configure(Interface *){ return NULL; } ; | ||
110 | |||
111 | /** | ||
112 | * Create, and return the Information Module. | ||
113 | * | ||
114 | * An default Implementation is InterfaceInformationImp | ||
115 | * | ||
116 | * @param Interface *i the interface to get info on. | ||
117 | * @return QWidget* pointer to this modules info. | ||
118 | * | ||
119 | * @see InterfaceInformationImp | ||
120 | * | ||
121 | */ | ||
122 | virtual QWidget *information(Interface *){ return NULL; }; | ||
123 | |||
124 | /** | ||
125 | * Get all active (up or down) interfaces managed by this | ||
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 | * | ||
131 | * @return QList<Interface> A list of interfaces that exsist that havn't | ||
132 | * been called by isOwner() | ||
133 | */ | ||
134 | virtual QList<Interface> getInterfaces() = 0; | ||
135 | |||
136 | /** | ||
137 | * Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp), | ||
138 | * modem ppp) | ||
139 | * Both strings need to be translated. The first string is a Shortcut | ||
140 | * like PPP and the second argument is a description. | ||
141 | * | ||
142 | * <code> | ||
143 | * list.insert( | ||
144 | * | ||
145 | * </code> | ||
146 | * | ||
147 | * @param list A reference to the list of supported additionns. | ||
148 | */ | ||
149 | virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0; | ||
150 | |||
151 | /** | ||
152 | * Attempts to create a new interface from name you gave | ||
153 | * possibleNewInterfaces() | ||
154 | * @return Interface* NULL if it was unable to be created. | ||
155 | * @param name the type of interface to create | ||
156 | * | ||
157 | * @see possibleNewInterfaces | ||
158 | */ | ||
159 | virtual Interface *addNewInterface(const QString &name) = 0; | ||
160 | |||
161 | /** | ||
162 | * Attempts to remove the interface, doesn't delete i | ||
163 | * @return bool true if successful, false otherwise. | ||
164 | */ | ||
165 | virtual bool remove(Interface* i) = 0; | ||
166 | |||
167 | /** | ||
168 | * get dcop calls | ||
169 | */ | ||
170 | virtual void receive(const QCString &msg, const QByteArray &arg) = 0; | ||
171 | |||
172 | QStringList handledInterfaceNames()const { return m_inter; } | ||
173 | protected: | ||
174 | /** | ||
175 | * set which interfaceNames should not be shown cause they're handled | ||
176 | * internally of this module.. An already running ppp link or | ||
177 | * a tunnel... VPN an such | ||
178 | */ | ||
179 | void setHandledInterfaceNames( const QStringList& in) { m_inter = in; } | ||
180 | |||
181 | private: | ||
182 | QStringList m_inter; | ||
183 | }; | ||
184 | |||
185 | #endif | ||
186 | |||
187 | // module.h | ||
188 | |||