-rw-r--r-- | libopie2/opienet/onetwork.h | 181 | ||||
-rw-r--r-- | libopie2/opieui/odialog.h | 3 | ||||
-rw-r--r-- | libopie2/qt3/opiecore/ocompletion.h | 1 |
3 files changed, 161 insertions, 24 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index e249aee..10f52b8 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -27,230 +27,369 @@ | |||
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef ONETWORK_H | 34 | #ifndef ONETWORK_H |
35 | #define ONETWORK_H | 35 | #define ONETWORK_H |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | 38 | ||
39 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qdict.h> | 40 | #include <qdict.h> |
41 | #include <qmap.h> | 41 | #include <qmap.h> |
42 | #include <qobject.h> | 42 | #include <qobject.h> |
43 | #include <qhostaddress.h> | 43 | #include <qhostaddress.h> |
44 | 44 | ||
45 | /* OPIE */ | 45 | /* OPIE */ |
46 | 46 | ||
47 | #include <opie2/onetutils.h> | 47 | #include <opie2/onetutils.h> |
48 | 48 | ||
49 | #ifndef IFNAMSIZ | 49 | #ifndef IFNAMSIZ |
50 | #define IFNAMSIZ 16 | 50 | #define IFNAMSIZ 16 |
51 | #endif | 51 | #endif |
52 | #ifndef IW_MAX_PRIV_DEF | 52 | #ifndef IW_MAX_PRIV_DEF |
53 | #define IW_MAX_PRIV_DEF 128 | 53 | #define IW_MAX_PRIV_DEF 128 |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | // ML: Yeah, I hate to include kernel headers, but it's necessary here | 56 | // ML: Yeah, I hate to include kernel headers, but it's necessary here |
57 | // ML: Here comes an ugly hack to prevent <linux/wireless.h> including <linux/if.h> | 57 | // ML: Here comes an ugly hack to prevent <linux/wireless.h> including <linux/if.h> |
58 | // ML: which conflicts with the user header <net/if.h> | 58 | // ML: which conflicts with the user header <net/if.h> |
59 | // ML: We really a user header for the Wireless Extensions, something like <net/wireless.h> | 59 | // ML: We really a user header for the Wireless Extensions, something like <net/wireless.h> |
60 | // ML: I will drop Jean an mail on that subject | 60 | // ML: I will drop Jean an mail on that subject |
61 | 61 | ||
62 | #include <net/if.h> | 62 | #include <net/if.h> |
63 | #define _LINUX_IF_H | 63 | #define _LINUX_IF_H |
64 | #include <linux/wireless.h> | 64 | #include <linux/wireless.h> |
65 | 65 | ||
66 | class ONetworkInterface; | 66 | class ONetworkInterface; |
67 | class OWirelessNetworkInterface; | 67 | class OWirelessNetworkInterface; |
68 | class OChannelHopper; | 68 | class OChannelHopper; |
69 | class OMonitoringInterface; | 69 | class OMonitoringInterface; |
70 | 70 | ||
71 | /*====================================================================================== | 71 | /*====================================================================================== |
72 | * ONetwork | 72 | * ONetwork |
73 | *======================================================================================*/ | 73 | *======================================================================================*/ |
74 | 74 | ||
75 | /** | ||
76 | * @brief A container class for all network devices. | ||
77 | * | ||
78 | * This class provides access to all available network devices of your computer. | ||
79 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
80 | */ | ||
75 | class ONetwork : public QObject | 81 | class ONetwork : public QObject |
76 | { | 82 | { |
77 | Q_OBJECT | 83 | Q_OBJECT |
78 | 84 | ||
79 | public: | 85 | public: |
80 | typedef QDict<ONetworkInterface> InterfaceMap; | 86 | typedef QDict<ONetworkInterface> InterfaceMap; |
81 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 87 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
82 | 88 | ||
83 | public: | 89 | public: |
90 | /** | ||
91 | * @returns a pointer to the (one and only) @ref ONetwork instance. | ||
92 | */ | ||
84 | static ONetwork* instance(); | 93 | static ONetwork* instance(); |
94 | /** | ||
95 | * @returns an iterator usable for iterating through all network interfaces. | ||
96 | */ | ||
85 | InterfaceIterator iterator() const; | 97 | InterfaceIterator iterator() const; |
86 | bool isWirelessInterface( const char* ) const; | 98 | /** |
87 | ONetworkInterface* interface( QString ) const; | 99 | * @returns true, if the @p interface supports the wireless extension protocol. |
100 | */ | ||
101 | bool isWirelessInterface( const char* interface ) const; | ||
102 | /** | ||
103 | * @returns a pointer to the @ref ONetworkInterface object for the specified @p interface or 0, if not found | ||
104 | * @see ONetworkInterface | ||
105 | */ | ||
106 | ONetworkInterface* interface( QString interface ) const; | ||
88 | 107 | ||
89 | protected: | 108 | protected: |
90 | ONetwork(); | 109 | ONetwork(); |
91 | void synchronize(); | 110 | void synchronize(); |
92 | 111 | ||
93 | private: | 112 | private: |
94 | static ONetwork* _instance; | 113 | static ONetwork* _instance; |
95 | InterfaceMap _interfaces; | 114 | InterfaceMap _interfaces; |
96 | }; | 115 | }; |
97 | 116 | ||
98 | 117 | ||
99 | /*====================================================================================== | 118 | /*====================================================================================== |
100 | * ONetworkInterface | 119 | * ONetworkInterface |
101 | *======================================================================================*/ | 120 | *======================================================================================*/ |
102 | 121 | ||
122 | /** | ||
123 | * @brief A network interface wrapper. | ||
124 | * | ||
125 | * This class provides a wrapper for a network interface. All the cumbersume details of | ||
126 | * Linux ioctls are hidden under a convenient high-level interface. | ||
127 | * @warning Most of the setting methods contained in this class require the appropriate | ||
128 | * process permissions to work. | ||
129 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
130 | */ | ||
103 | class ONetworkInterface : public QObject | 131 | class ONetworkInterface : public QObject |
104 | { | 132 | { |
105 | friend class OMonitoringInterface; | 133 | friend class OMonitoringInterface; |
106 | friend class OCiscoMonitoringInterface; | 134 | friend class OCiscoMonitoringInterface; |
107 | friend class OWlanNGMonitoringInterface; | 135 | friend class OWlanNGMonitoringInterface; |
108 | friend class OHostAPMonitoringInterface; | 136 | friend class OHostAPMonitoringInterface; |
109 | friend class OOrinocoMonitoringInterface; | 137 | friend class OOrinocoMonitoringInterface; |
110 | 138 | ||
111 | public: | 139 | public: |
140 | /** | ||
141 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, | ||
142 | * but access them via @ref ONetwork::interface(). | ||
143 | */ | ||
112 | ONetworkInterface( QObject* parent, const char* name ); | 144 | ONetworkInterface( QObject* parent, const char* name ); |
145 | /** | ||
146 | * Destructor. | ||
147 | */ | ||
113 | virtual ~ONetworkInterface(); | 148 | virtual ~ONetworkInterface(); |
114 | 149 | /** | |
115 | void setMonitoring( OMonitoringInterface* ); | 150 | * Associates a @a monitoring interface with this network interface. |
151 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. | ||
152 | */ | ||
153 | void setMonitoring( OMonitoringInterface* monitoring ); | ||
154 | /** | ||
155 | * @returns the currently associated monitoring interface or 0, if no monitoring is associated. | ||
156 | */ | ||
116 | OMonitoringInterface* monitoring() const; | 157 | OMonitoringInterface* monitoring() const; |
158 | /** | ||
159 | * Setting an interface to promiscuous mode enables the device to receive | ||
160 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. | ||
161 | */ | ||
117 | bool setPromiscuousMode( bool ); | 162 | bool setPromiscuousMode( bool ); |
163 | /** | ||
164 | * @returns true if the interface is set to promiscuous mode. | ||
165 | */ | ||
118 | bool promiscuousMode() const; | 166 | bool promiscuousMode() const; |
167 | /** | ||
168 | * Setting an interface to up enables it to receive packets. | ||
169 | */ | ||
119 | bool setUp( bool ); | 170 | bool setUp( bool ); |
171 | /** | ||
172 | * @returns true if the interface is up. | ||
173 | */ | ||
120 | bool isUp() const; | 174 | bool isUp() const; |
175 | /* | ||
176 | * @returns true if the interface is a loopback interface. | ||
177 | */ | ||
121 | bool isLoopback() const; | 178 | bool isLoopback() const; |
179 | /* | ||
180 | * @returns true if the interface is featuring supports the wireless extension protocol. | ||
181 | */ | ||
122 | bool isWireless() const; | 182 | bool isWireless() const; |
183 | /* | ||
184 | * @returns the IPv4 address associated with this interface. | ||
185 | */ | ||
123 | QString ipV4Address() const; | 186 | QString ipV4Address() const; |
124 | void setMacAddress( const OMacAddress& ); | 187 | /* |
188 | * Associate the MAC address @a addr with the interface. | ||
189 | * @note It can be necessary to shut down the interface prior to calling this method. | ||
190 | * @warning This is not supported by all drivers. | ||
191 | */ | ||
192 | void setMacAddress( const OMacAddress& addr ); | ||
193 | /* | ||
194 | * @returns the MAC address associated with this interface. | ||
195 | */ | ||
125 | OMacAddress macAddress() const; | 196 | OMacAddress macAddress() const; |
197 | /* | ||
198 | * @returns the data link type currently associated with this interface. | ||
199 | * @see #include <net/if_arp.h> for possible values. | ||
200 | */ | ||
126 | int dataLinkType() const; | 201 | int dataLinkType() const; |
127 | 202 | ||
128 | protected: | 203 | protected: |
129 | const int _sfd; | 204 | const int _sfd; |
130 | mutable ifreq _ifr; | 205 | mutable ifreq _ifr; |
131 | OMonitoringInterface* _mon; | 206 | OMonitoringInterface* _mon; |
132 | 207 | ||
133 | protected: | 208 | protected: |
134 | struct ifreq& ifr() const; | 209 | struct ifreq& ifr() const; |
135 | virtual void init(); | 210 | virtual void init(); |
136 | bool ioctl( int call ) const; | 211 | bool ioctl( int call ) const; |
137 | bool ioctl( int call, struct ifreq& ) const; | 212 | bool ioctl( int call, struct ifreq& ) const; |
138 | }; | 213 | }; |
139 | 214 | ||
140 | /*====================================================================================== | 215 | /*====================================================================================== |
141 | * OChannelHopper | 216 | * OChannelHopper |
142 | *======================================================================================*/ | 217 | *======================================================================================*/ |
143 | 218 | ||
219 | /** | ||
220 | * @brief A radio frequency channel hopper. | ||
221 | * | ||
222 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | ||
223 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | ||
224 | * This is necessary when in monitoring mode and scanning for other devices, because | ||
225 | * the radio frequency hardware can only detect packets sent on the same frequency. | ||
226 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
227 | */ | ||
144 | class OChannelHopper : public QObject | 228 | class OChannelHopper : public QObject |
145 | { | 229 | { |
146 | public: | 230 | public: |
147 | OChannelHopper( OWirelessNetworkInterface* ); | 231 | OChannelHopper( OWirelessNetworkInterface* ); |
148 | virtual ~OChannelHopper(); | 232 | virtual ~OChannelHopper(); |
149 | bool isActive() const; | 233 | bool isActive() const; |
150 | int channel() const; | 234 | int channel() const; |
151 | virtual void timerEvent( QTimerEvent* ); | 235 | virtual void timerEvent( QTimerEvent* ); |
152 | void setInterval( int ); | 236 | void setInterval( int ); |
153 | int interval() const; | 237 | int interval() const; |
154 | 238 | ||
155 | private: | 239 | private: |
156 | OWirelessNetworkInterface* _iface; | 240 | OWirelessNetworkInterface* _iface; |
157 | int _interval; | 241 | int _interval; |
158 | int _tid; | 242 | int _tid; |
159 | QValueList<int> _channels; | 243 | QValueList<int> _channels; |
160 | QValueList<int>::Iterator _channel; | 244 | QValueList<int>::Iterator _channel; |
161 | |||
162 | }; | 245 | }; |
163 | 246 | ||
164 | 247 | ||
165 | /*====================================================================================== | 248 | /*====================================================================================== |
166 | * OWirelessNetworkInterface | 249 | * OWirelessNetworkInterface |
167 | *======================================================================================*/ | 250 | *======================================================================================*/ |
168 | 251 | ||
252 | /** | ||
253 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | ||
254 | * | ||
255 | * This class provides a high-level encapsulation of the Linux wireless extension API. | ||
256 | */ | ||
169 | class OWirelessNetworkInterface : public ONetworkInterface | 257 | class OWirelessNetworkInterface : public ONetworkInterface |
170 | { | 258 | { |
171 | friend class OMonitoringInterface; | 259 | friend class OMonitoringInterface; |
172 | friend class OCiscoMonitoringInterface; | 260 | friend class OCiscoMonitoringInterface; |
173 | friend class OWlanNGMonitoringInterface; | 261 | friend class OWlanNGMonitoringInterface; |
174 | friend class OHostAPMonitoringInterface; | 262 | friend class OHostAPMonitoringInterface; |
175 | friend class OOrinocoMonitoringInterface; | 263 | friend class OOrinocoMonitoringInterface; |
176 | 264 | ||
177 | friend class OPrivateIOCTL; | 265 | friend class OPrivateIOCTL; |
178 | 266 | ||
179 | public: | 267 | public: |
180 | enum Mode { AdHoc, Managed, Monitor }; | 268 | enum Mode { AdHoc, Managed, Monitor }; |
181 | 269 | ||
270 | /** | ||
271 | * Constructor. | ||
272 | */ | ||
182 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 273 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
274 | /** | ||
275 | * Destructor. | ||
276 | */ | ||
183 | virtual ~OWirelessNetworkInterface(); | 277 | virtual ~OWirelessNetworkInterface(); |
184 | 278 | /** | |
185 | virtual void setChannel( int ) const; | 279 | * Setting the @a channel of the interface changes the radio frequency (RF) |
280 | * of the corresponding wireless network device. | ||
281 | */ | ||
282 | virtual void setChannel( int channel ) const; | ||
283 | /** | ||
284 | * @returns the channel index of the current radio frequency. | ||
285 | */ | ||
186 | virtual int channel() const; | 286 | virtual int channel() const; |
287 | /** | ||
288 | * @returns the current radio frequency (in MHz). | ||
289 | */ | ||
187 | virtual double frequency() const; | 290 | virtual double frequency() const; |
291 | /** | ||
292 | * @returns the number of radio frequency channels for the | ||
293 | * corresponding wireless network device. | ||
294 | * @note European devices usually have 14 channels, while American typically feature 11 channels. | ||
295 | */ | ||
188 | virtual int channels() const; | 296 | virtual int channels() const; |
189 | //virtual double frequency(int) const; | 297 | //virtual double frequency(int) const; |
190 | 298 | ||
191 | virtual void setMode( Mode ) {}; | 299 | virtual void setMode( Mode ) {}; //FIXME: Implement and document this |
192 | virtual bool mode() const {}; | 300 | virtual bool mode() const {}; //FIXME: Implement and document this |
193 | 301 | ||
302 | /** | ||
303 | * Setting the monitor mode on a wireless network interface enables | ||
304 | * listening to IEEE 802.11 data and management frames which normally | ||
305 | * are handled by the device firmware. This can be used to detect | ||
306 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. | ||
307 | * @warning Standard wireless network drives don't support the monitor mode. | ||
308 | * @warning You need a patched driver for this to work. | ||
309 | * @note Enabling the monitor mode is highly driver dependent and requires | ||
310 | * the proper @ref OMonitoringInterface to be associated with the interface. | ||
311 | * @see OMonitoringInterface | ||
312 | */ | ||
194 | virtual void setMonitorMode( bool ); | 313 | virtual void setMonitorMode( bool ); |
314 | /** | ||
315 | * @returns true if the device is listening in IEEE 802.11 monitor mode | ||
316 | */ | ||
195 | virtual bool monitorMode() const; | 317 | virtual bool monitorMode() const; |
196 | 318 | /** | |
319 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. | ||
320 | * @see OChannelHopper | ||
321 | */ | ||
197 | virtual void setChannelHopping( int interval = 0 ); | 322 | virtual void setChannelHopping( int interval = 0 ); |
323 | /** | ||
324 | * @returns the channel hopping interval or 0, if channel hopping is disabled. | ||
325 | */ | ||
198 | virtual int channelHopping() const; | 326 | virtual int channelHopping() const; |
199 | 327 | /** | |
200 | virtual void setNickName( const QString& ) {}; | 328 | * Set the station @a nickname. |
329 | */ | ||
330 | virtual void setNickName( const QString& nickname ) {}; //FIXME: Implement this | ||
331 | /** | ||
332 | * @returns the current station nickname. | ||
333 | */ | ||
201 | virtual QString nickName() const; | 334 | virtual QString nickName() const; |
202 | 335 | /** | |
203 | virtual void setPrivate( const QString&, int, ... ); | 336 | * Invoke the private IOCTL @a command with a @number of parameters on the network interface. |
204 | virtual bool hasPrivate( const QString& ); | 337 | * @see OPrivateIOCTL |
205 | virtual void getPrivate( const QString& ); | 338 | */ |
206 | 339 | virtual void setPrivate( const QString& command, int number, ... ); | |
207 | virtual bool isAssociated() const {}; | 340 | /** |
208 | virtual QString associatedAP() const; | 341 | * @returns true if the interface is featuring the private IOCTL @command. |
342 | */ | ||
343 | virtual bool hasPrivate( const QString& command ); | ||
344 | virtual void getPrivate( const QString& command ); //FIXME: Implement and document this | ||
345 | |||
346 | virtual bool isAssociated() const {}; //FIXME: Implement and document this | ||
347 | virtual QString associatedAP() const; //FIXME: Implement and document this | ||
209 | 348 | ||
210 | virtual void setSSID( const QString& ); | 349 | virtual void setSSID( const QString& ); |
211 | virtual QString SSID() const; | 350 | virtual QString SSID() const; |
212 | 351 | ||
213 | protected: | 352 | protected: |
214 | void buildChannelList(); | 353 | void buildChannelList(); |
215 | void buildPrivateList(); | 354 | void buildPrivateList(); |
216 | virtual void init(); | 355 | virtual void init(); |
217 | struct iwreq& iwr() const; | 356 | struct iwreq& iwr() const; |
218 | bool wioctl( int call ) const; | 357 | bool wioctl( int call ) const; |
219 | bool wioctl( int call, struct iwreq& ) const; | 358 | bool wioctl( int call, struct iwreq& ) const; |
220 | 359 | ||
221 | protected: | 360 | protected: |
222 | mutable struct iwreq _iwr; | 361 | mutable struct iwreq _iwr; |
223 | QMap<int,int> _channels; | 362 | QMap<int,int> _channels; |
224 | 363 | ||
225 | private: | 364 | private: |
226 | OChannelHopper* _hopper; | 365 | OChannelHopper* _hopper; |
227 | }; | 366 | }; |
228 | 367 | ||
229 | 368 | ||
230 | /*====================================================================================== | 369 | /*====================================================================================== |
231 | * OMonitoringInterface | 370 | * OMonitoringInterface |
232 | *======================================================================================*/ | 371 | *======================================================================================*/ |
233 | 372 | ||
234 | 373 | ||
235 | class OMonitoringInterface | 374 | class OMonitoringInterface |
236 | { | 375 | { |
237 | public: | 376 | public: |
238 | OMonitoringInterface(); | 377 | OMonitoringInterface(); |
239 | OMonitoringInterface( ONetworkInterface* ); | 378 | OMonitoringInterface( ONetworkInterface* ); |
240 | virtual ~OMonitoringInterface(); | 379 | virtual ~OMonitoringInterface(); |
241 | 380 | ||
242 | public: | 381 | public: |
243 | virtual void setEnabled( bool ); | 382 | virtual void setEnabled( bool ); |
244 | virtual bool enabled() const; | 383 | virtual bool enabled() const; |
245 | virtual void setChannel( int ); | 384 | virtual void setChannel( int ); |
246 | 385 | ||
247 | virtual QString name() const = 0; | 386 | virtual QString name() const = 0; |
248 | 387 | ||
249 | protected: | 388 | protected: |
250 | OWirelessNetworkInterface* _if; | 389 | OWirelessNetworkInterface* _if; |
251 | 390 | ||
252 | }; | 391 | }; |
253 | 392 | ||
254 | 393 | ||
255 | /*====================================================================================== | 394 | /*====================================================================================== |
256 | * OCiscoMonitoring | 395 | * OCiscoMonitoring |
diff --git a/libopie2/opieui/odialog.h b/libopie2/opieui/odialog.h index 38f25e8..7947dfb 100644 --- a/libopie2/opieui/odialog.h +++ b/libopie2/opieui/odialog.h | |||
@@ -18,72 +18,71 @@ | |||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef ODIALOG_H | 32 | #ifndef ODIALOG_H |
33 | #define ODIALOG_H | 33 | #define ODIALOG_H |
34 | 34 | ||
35 | class QLayoutItem; | 35 | class QLayoutItem; |
36 | 36 | ||
37 | #include <qdialog.h> | 37 | #include <qdialog.h> |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Dialog with extended nonmodal support and methods for OPIE standard | 40 | * Dialog with extended nonmodal support and methods for OPIE standard |
41 | * compliance. | 41 | * compliance. |
42 | * | 42 | * |
43 | * The @ref marginHint() and @ref spacingHint() sizes shall be used | 43 | * The @ref marginHint() and @ref spacingHint() sizes shall be used |
44 | * whenever you layout the interior of a dialog. One special note. If | 44 | * whenever you layout the interior of a dialog. One special note. If |
45 | * you make your own action buttons (OK, Cancel etc), the space | 45 | * you make your own action buttons (OK, Cancel etc), the space |
46 | * beteween the buttons shall be @ref spacingHint(), whereas the space | 46 | * beteween the buttons shall be @ref spacingHint(), whereas the space |
47 | * above, below, to the right and to the left shall be @ref marginHint(). | 47 | * above, below, to the right and to the left shall be @ref marginHint(). |
48 | * If you add a separator line above the buttons, there shall be a | 48 | * If you add a separator line above the buttons, there shall be a |
49 | * @ref marginHint() between the buttons and the separator and a | 49 | * @ref marginHint() between the buttons and the separator and a |
50 | * @ref marginHint() above the separator as well. | 50 | * @ref marginHint() above the separator as well. |
51 | * | 51 | * |
52 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 52 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
53 | */ | 53 | */ |
54 | 54 | ||
55 | class ODialog : public QDialog | 55 | class ODialog : public QDialog |
56 | { | 56 | { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | 58 | ||
59 | public: | 59 | public: |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Constructor. | 62 | * Constructor. |
63 | * | 63 | * |
64 | * Takes the same arguments as @ref QDialog. | 64 | * Takes the same arguments as @ref QDialog. |
65 | */ | 65 | */ |
66 | ODialog(QWidget *parent = 0, const char *name = 0, | 66 | ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); |
67 | bool modal = false, WFlags f = 0); | ||
68 | 67 | ||
69 | /** | 68 | /** |
70 | * Return the number of pixels you shall use between a | 69 | * Return the number of pixels you shall use between a |
71 | * dialog edge and the outermost widget(s) according to the KDE standard. | 70 | * dialog edge and the outermost widget(s) according to the KDE standard. |
72 | **/ | 71 | **/ |
73 | static int marginHint(); | 72 | static int marginHint(); |
74 | 73 | ||
75 | /** | 74 | /** |
76 | * Return the number of pixels you shall use between | 75 | * Return the number of pixels you shall use between |
77 | * widgets inside a dialog according to the KDE standard. | 76 | * widgets inside a dialog according to the KDE standard. |
78 | */ | 77 | */ |
79 | static int spacingHint(); | 78 | static int spacingHint(); |
80 | 79 | ||
81 | private: | 80 | private: |
82 | static int mMarginSize; | 81 | static int mMarginSize; |
83 | static int mSpacingSize; | 82 | static int mSpacingSize; |
84 | 83 | ||
85 | //class ODialogPrivate; | 84 | //class ODialogPrivate; |
86 | //ODialogPrivate *d; | 85 | //ODialogPrivate *d; |
87 | 86 | ||
88 | }; | 87 | }; |
89 | #endif // ODIALOG_H | 88 | #endif // ODIALOG_H |
diff --git a/libopie2/qt3/opiecore/ocompletion.h b/libopie2/qt3/opiecore/ocompletion.h index 0317c1b..7f28182 100644 --- a/libopie2/qt3/opiecore/ocompletion.h +++ b/libopie2/qt3/opiecore/ocompletion.h | |||
@@ -105,97 +105,96 @@ public: | |||
105 | * | 105 | * |
106 | * @li shell completion works like how shells complete filenames: | 106 | * @li shell completion works like how shells complete filenames: |
107 | * when multiple matches are available, the longest possible string of all | 107 | * when multiple matches are available, the longest possible string of all |
108 | * matches is returned (i.e. only a partial item). | 108 | * matches is returned (i.e. only a partial item). |
109 | * Iterating over all matching items (complete, not partial) is possible | 109 | * Iterating over all matching items (complete, not partial) is possible |
110 | * via @ref nextMatch() and @ref previousMatch(). | 110 | * via @ref nextMatch() and @ref previousMatch(). |
111 | * | 111 | * |
112 | * You don't have to worry much about that though, OCompletion handles | 112 | * You don't have to worry much about that though, OCompletion handles |
113 | * that for you, according to the setting @ref setCompletionMode(). | 113 | * that for you, according to the setting @ref setCompletionMode(). |
114 | * The default setting is globally configured by the user and read | 114 | * The default setting is globally configured by the user and read |
115 | * from @ref OGlobalSettings::completionMode(). | 115 | * from @ref OGlobalSettings::completionMode(). |
116 | * | 116 | * |
117 | * A short example: | 117 | * A short example: |
118 | * <pre> | 118 | * <pre> |
119 | * OCompletion completion; | 119 | * OCompletion completion; |
120 | * completion.setOrder( OCompletion::Sorted ); | 120 | * completion.setOrder( OCompletion::Sorted ); |
121 | * completion.addItem( "pfeiffer@kde.org" ); | 121 | * completion.addItem( "pfeiffer@kde.org" ); |
122 | * completion.addItem( "coolo@kde.org" ); | 122 | * completion.addItem( "coolo@kde.org" ); |
123 | * completion.addItem( "carpdjih@sp.zrz.tu-berlin.de" ); | 123 | * completion.addItem( "carpdjih@sp.zrz.tu-berlin.de" ); |
124 | * completion.addItem( "carp@cs.tu-berlin.de" ); | 124 | * completion.addItem( "carp@cs.tu-berlin.de" ); |
125 | * | 125 | * |
126 | * cout << completion.makeCompletion( "ca" ).latin1() << endl; | 126 | * cout << completion.makeCompletion( "ca" ).latin1() << endl; |
127 | * </pre> | 127 | * </pre> |
128 | * In shell-completion-mode, this will be "carp"; in auto-completion- | 128 | * In shell-completion-mode, this will be "carp"; in auto-completion- |
129 | * mode it will be "carp@cs.tu-berlin.de", as that is alphabetically | 129 | * mode it will be "carp@cs.tu-berlin.de", as that is alphabetically |
130 | * smaller. | 130 | * smaller. |
131 | * If setOrder was set to Insertion, "carpdjih@sp.zrz.tu-berlin.de" | 131 | * If setOrder was set to Insertion, "carpdjih@sp.zrz.tu-berlin.de" |
132 | * would be completed in auto-completion-mode, as that was inserted before | 132 | * would be completed in auto-completion-mode, as that was inserted before |
133 | * "carp@cs.tu-berlin.de". | 133 | * "carp@cs.tu-berlin.de". |
134 | * | 134 | * |
135 | * You can dynamically update the completable items by removing and adding them | 135 | * You can dynamically update the completable items by removing and adding them |
136 | * whenever you want. | 136 | * whenever you want. |
137 | * For advanced usage, you could even use multiple OCompletion objects. E.g. | 137 | * For advanced usage, you could even use multiple OCompletion objects. E.g. |
138 | * imagine an editor like kwrite with multiple open files. You could store | 138 | * imagine an editor like kwrite with multiple open files. You could store |
139 | * items of each file in a different OCompletion object, so that you know (and | 139 | * items of each file in a different OCompletion object, so that you know (and |
140 | * tell the user) where a completion comes from. | 140 | * tell the user) where a completion comes from. |
141 | * | 141 | * |
142 | * Note: OCompletion does not work with strings that contain 0x0 characters | 142 | * Note: OCompletion does not work with strings that contain 0x0 characters |
143 | * (unicode nul), as this is used internally as a delimiter. | 143 | * (unicode nul), as this is used internally as a delimiter. |
144 | * | 144 | * |
145 | * You may inherit from OCompletion and override @ref makeCompletion() in | 145 | * You may inherit from OCompletion and override @ref makeCompletion() in |
146 | * special cases (like reading directories/urls and then supplying the | 146 | * special cases (like reading directories/urls and then supplying the |
147 | * contents to OCompletion, as OURLCompletion does), but generally, this is | 147 | * contents to OCompletion, as OURLCompletion does), but generally, this is |
148 | * not necessary. | 148 | * not necessary. |
149 | * | 149 | * |
150 | * | 150 | * |
151 | * @short A generic class for completing QStrings | 151 | * @short A generic class for completing QStrings |
152 | * @author Carsten Pfeiffer <pfeiffer@kde.org> | 152 | * @author Carsten Pfeiffer <pfeiffer@kde.org> |
153 | * @version $Id$ | ||
154 | */ | 153 | */ |
155 | 154 | ||
156 | class OCompletion : public QObject | 155 | class OCompletion : public QObject |
157 | { | 156 | { |
158 | Q_ENUMS( CompOrder ) | 157 | Q_ENUMS( CompOrder ) |
159 | Q_PROPERTY( CompOrder order READ order WRITE setOrder ) | 158 | Q_PROPERTY( CompOrder order READ order WRITE setOrder ) |
160 | Q_PROPERTY( bool ignoreCase READ ignoreCase WRITE setIgnoreCase ) | 159 | Q_PROPERTY( bool ignoreCase READ ignoreCase WRITE setIgnoreCase ) |
161 | Q_PROPERTY( QStringList items READ items WRITE setItems ) | 160 | Q_PROPERTY( QStringList items READ items WRITE setItems ) |
162 | Q_OBJECT | 161 | Q_OBJECT |
163 | 162 | ||
164 | public: | 163 | public: |
165 | /** | 164 | /** |
166 | * Constants that represent the order in which OCompletion performs | 165 | * Constants that represent the order in which OCompletion performs |
167 | * completion-lookups. | 166 | * completion-lookups. |
168 | */ | 167 | */ |
169 | enum CompOrder { Sorted, Insertion, Weighted }; | 168 | enum CompOrder { Sorted, Insertion, Weighted }; |
170 | 169 | ||
171 | /** | 170 | /** |
172 | * Constructor, nothing special here :) | 171 | * Constructor, nothing special here :) |
173 | */ | 172 | */ |
174 | OCompletion(); | 173 | OCompletion(); |
175 | 174 | ||
176 | // FIXME: copy constructor, assignment constructor... | 175 | // FIXME: copy constructor, assignment constructor... |
177 | 176 | ||
178 | /** | 177 | /** |
179 | * Destructor, nothing special here, either. | 178 | * Destructor, nothing special here, either. |
180 | */ | 179 | */ |
181 | virtual ~OCompletion(); | 180 | virtual ~OCompletion(); |
182 | 181 | ||
183 | /** | 182 | /** |
184 | * Attempts to find an item in the list of available completions, | 183 | * Attempts to find an item in the list of available completions, |
185 | * that begins with @p string. Will either return the first matching item | 184 | * that begins with @p string. Will either return the first matching item |
186 | * (if there is more than one match) or QString::null, if no match was | 185 | * (if there is more than one match) or QString::null, if no match was |
187 | * found. | 186 | * found. |
188 | * | 187 | * |
189 | * In the latter case, a sound will be issued, depending on | 188 | * In the latter case, a sound will be issued, depending on |
190 | * @ref isSoundsEnabled(). | 189 | * @ref isSoundsEnabled(). |
191 | * If a match was found, it will also be emitted via the signal | 190 | * If a match was found, it will also be emitted via the signal |
192 | * @ref match(). | 191 | * @ref match(). |
193 | * | 192 | * |
194 | * If this is called twice or more often with the same string while no | 193 | * If this is called twice or more often with the same string while no |
195 | * items were added or removed in the meantime, all available completions | 194 | * items were added or removed in the meantime, all available completions |
196 | * will be emitted via the signal @ref matches(). | 195 | * will be emitted via the signal @ref matches(). |
197 | * This happens only in shell-completion-mode. | 196 | * This happens only in shell-completion-mode. |
198 | * | 197 | * |
199 | * @returns the matching item, or QString::null if there is no matching | 198 | * @returns the matching item, or QString::null if there is no matching |
200 | * item. | 199 | * item. |
201 | * @see #slotMakeCompletion | 200 | * @see #slotMakeCompletion |