author | mickeyl <mickeyl> | 2003-06-26 10:34:59 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-06-26 10:34:59 (UTC) |
commit | 8168239a5b1ff80abc02f93ed831c088ca5f2f3d (patch) (unidiff) | |
tree | d19069b730eeb82f02754955366569d52d088248 | |
parent | 3c5746daa26d8353fde9ba84c6183517e26a625a (diff) | |
download | opie-8168239a5b1ff80abc02f93ed831c088ca5f2f3d.zip opie-8168239a5b1ff80abc02f93ed831c088ca5f2f3d.tar.gz opie-8168239a5b1ff80abc02f93ed831c088ca5f2f3d.tar.bz2 |
first bunch of fixes for Qt 3.x compilation
-rw-r--r-- | libopie2/opieui/olistview.h | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 9 |
4 files changed, 12 insertions, 2 deletions
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h index 1bbdd5b..109e309 100644 --- a/libopie2/opieui/olistview.h +++ b/libopie2/opieui/olistview.h | |||
@@ -1,341 +1,343 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OLISTVIEW_H | 31 | #ifndef OLISTVIEW_H |
32 | #define OLISTVIEW_H | 32 | #define OLISTVIEW_H |
33 | 33 | ||
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <qpen.h> | 36 | #include <qpen.h> |
37 | #include <qdatastream.h> | 37 | #include <qdatastream.h> |
38 | #include <qstringlist.h> | ||
38 | 39 | ||
39 | class OListViewItem; | 40 | class OListViewItem; |
40 | 41 | ||
42 | |||
41 | /*====================================================================================== | 43 | /*====================================================================================== |
42 | * OListView | 44 | * OListView |
43 | *======================================================================================*/ | 45 | *======================================================================================*/ |
44 | 46 | ||
45 | /** | 47 | /** |
46 | * @brief A list/tree widget. | 48 | * @brief A list/tree widget. |
47 | * | 49 | * |
48 | * A @ref QListView variant featuring visual and functional enhancements | 50 | * A @ref QListView variant featuring visual and functional enhancements |
49 | * like an alternate background for odd rows, an autostretch mode | 51 | * like an alternate background for odd rows, an autostretch mode |
50 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. | 52 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. |
51 | * | 53 | * |
52 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 54 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
53 | */ | 55 | */ |
54 | class OListView: public QListView | 56 | class OListView: public QListView |
55 | { | 57 | { |
56 | public: | 58 | public: |
57 | /** | 59 | /** |
58 | * Constructor. | 60 | * Constructor. |
59 | * | 61 | * |
60 | * The parameters @a parent and @a name are handled by | 62 | * The parameters @a parent and @a name are handled by |
61 | * @ref QListView, as usual. | 63 | * @ref QListView, as usual. |
62 | */ | 64 | */ |
63 | OListView( QWidget* parent = 0, const char* name = 0 ); | 65 | OListView( QWidget* parent = 0, const char* name = 0 ); |
64 | /** | 66 | /** |
65 | * Destructor. | 67 | * Destructor. |
66 | */ | 68 | */ |
67 | virtual ~OListView(); | 69 | virtual ~OListView(); |
68 | /** | 70 | /** |
69 | * Let the last column fit exactly all the available width. | 71 | * Let the last column fit exactly all the available width. |
70 | */ | 72 | */ |
71 | void setFullWidth( bool fullWidth ); | 73 | void setFullWidth( bool fullWidth ); |
72 | /** | 74 | /** |
73 | * Returns whether the last column is set to fit the available width. | 75 | * Returns whether the last column is set to fit the available width. |
74 | */ | 76 | */ |
75 | bool fullWidth() const; | 77 | bool fullWidth() const; |
76 | /** | 78 | /** |
77 | * Reimplemented for full width support | 79 | * Reimplemented for full width support |
78 | */ | 80 | */ |
79 | virtual int addColumn( const QString& label, int width = -1 ); | 81 | virtual int addColumn( const QString& label, int width = -1 ); |
80 | /** | 82 | /** |
81 | * Reimplemented for full width support | 83 | * Reimplemented for full width support |
82 | */ | 84 | */ |
83 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); | 85 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); |
84 | /** | 86 | /** |
85 | * Reimplemented for full width support | 87 | * Reimplemented for full width support |
86 | */ | 88 | */ |
87 | virtual void removeColumn(int index); | 89 | virtual void removeColumn(int index); |
88 | /** | 90 | /** |
89 | * Set the alternate background background @a color. | 91 | * Set the alternate background background @a color. |
90 | * Set to an invalid color to disable alternate colors. | 92 | * Set to an invalid color to disable alternate colors. |
91 | * This only has an effect if the items are OListViewItems | 93 | * This only has an effect if the items are OListViewItems |
92 | */ | 94 | */ |
93 | void setAlternateBackground( const QColor& color ); | 95 | void setAlternateBackground( const QColor& color ); |
94 | /** | 96 | /** |
95 | * Sets the column separator @a pen. | 97 | * Sets the column separator @a pen. |
96 | */ | 98 | */ |
97 | void setColumnSeparator( const QPen& pen ); | 99 | void setColumnSeparator( const QPen& pen ); |
98 | 100 | ||
99 | /** | 101 | /** |
100 | * @returns the alternate background color | 102 | * @returns the alternate background color |
101 | */ | 103 | */ |
102 | const QColor& alternateBackground() const; | 104 | const QColor& alternateBackground() const; |
103 | /** | 105 | /** |
104 | * @return the column separator pen | 106 | * @return the column separator pen |
105 | */ | 107 | */ |
106 | const QPen& columnSeparator() const; | 108 | const QPen& columnSeparator() const; |
107 | /** | 109 | /** |
108 | * Create a list view item as child of this object | 110 | * Create a list view item as child of this object |
109 | * @returns the new object | 111 | * @returns the new object |
110 | */ | 112 | */ |
111 | virtual OListViewItem* childFactory(); | 113 | virtual OListViewItem* childFactory(); |
112 | #ifndef QT_NO_DATASTREAM | 114 | #ifndef QT_NO_DATASTREAM |
113 | /** | 115 | /** |
114 | * Serialize this object to @ref QDataStream @a stream | 116 | * Serialize this object to @ref QDataStream @a stream |
115 | */ | 117 | */ |
116 | virtual void serializeTo( QDataStream& stream ) const; | 118 | virtual void serializeTo( QDataStream& stream ) const; |
117 | /** | 119 | /** |
118 | * Serialize this object from a @ref QDataStream @a stream | 120 | * Serialize this object from a @ref QDataStream @a stream |
119 | */ | 121 | */ |
120 | virtual void serializeFrom( QDataStream& s ); | 122 | virtual void serializeFrom( QDataStream& s ); |
121 | #endif | 123 | #endif |
122 | 124 | ||
123 | private: | 125 | private: |
124 | QColor m_alternateBackground; | 126 | QColor m_alternateBackground; |
125 | bool m_fullWidth; | 127 | bool m_fullWidth; |
126 | QPen m_columnSeparator; | 128 | QPen m_columnSeparator; |
127 | }; | 129 | }; |
128 | 130 | ||
129 | #ifndef QT_NO_DATASTREAM | 131 | #ifndef QT_NO_DATASTREAM |
130 | /** | 132 | /** |
131 | * @relates OListView | 133 | * @relates OListView |
132 | * Writes @a listview to the @a stream and returns a reference to the stream. | 134 | * Writes @a listview to the @a stream and returns a reference to the stream. |
133 | */ | 135 | */ |
134 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); | 136 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); |
135 | /** | 137 | /** |
136 | * @relates OListView | 138 | * @relates OListView |
137 | * Reads @a listview from the @a stream and returns a reference to the stream. | 139 | * Reads @a listview from the @a stream and returns a reference to the stream. |
138 | */ | 140 | */ |
139 | QDataStream& operator>>( QDataStream& stream, OListView& listview ); | 141 | QDataStream& operator>>( QDataStream& stream, OListView& listview ); |
140 | #endif // QT_NO_DATASTREAM | 142 | #endif // QT_NO_DATASTREAM |
141 | 143 | ||
142 | /*====================================================================================== | 144 | /*====================================================================================== |
143 | * OListViewItem | 145 | * OListViewItem |
144 | *======================================================================================*/ | 146 | *======================================================================================*/ |
145 | 147 | ||
146 | class OListViewItem: public QListViewItem | 148 | class OListViewItem: public QListViewItem |
147 | { | 149 | { |
148 | public: | 150 | public: |
149 | /** | 151 | /** |
150 | * Constructors. | 152 | * Constructors. |
151 | */ | 153 | */ |
152 | OListViewItem( QListView * parent ); | 154 | OListViewItem( QListView * parent ); |
153 | OListViewItem( QListViewItem * parent ); | 155 | OListViewItem( QListViewItem * parent ); |
154 | OListViewItem( QListView * parent, QListViewItem * after ); | 156 | OListViewItem( QListView * parent, QListViewItem * after ); |
155 | OListViewItem( QListViewItem * parent, QListViewItem * after ); | 157 | OListViewItem( QListViewItem * parent, QListViewItem * after ); |
156 | 158 | ||
157 | OListViewItem( QListView * parent, | 159 | OListViewItem( QListView * parent, |
158 | QString, QString = QString::null, | 160 | QString, QString = QString::null, |
159 | QString = QString::null, QString = QString::null, | 161 | QString = QString::null, QString = QString::null, |
160 | QString = QString::null, QString = QString::null, | 162 | QString = QString::null, QString = QString::null, |
161 | QString = QString::null, QString = QString::null ); | 163 | QString = QString::null, QString = QString::null ); |
162 | 164 | ||
163 | OListViewItem( QListViewItem * parent, | 165 | OListViewItem( QListViewItem * parent, |
164 | QString, QString = QString::null, | 166 | QString, QString = QString::null, |
165 | QString = QString::null, QString = QString::null, | 167 | QString = QString::null, QString = QString::null, |
166 | QString = QString::null, QString = QString::null, | 168 | QString = QString::null, QString = QString::null, |
167 | QString = QString::null, QString = QString::null ); | 169 | QString = QString::null, QString = QString::null ); |
168 | 170 | ||
169 | OListViewItem( QListView * parent, QListViewItem * after, | 171 | OListViewItem( QListView * parent, QListViewItem * after, |
170 | QString, QString = QString::null, | 172 | QString, QString = QString::null, |
171 | QString = QString::null, QString = QString::null, | 173 | QString = QString::null, QString = QString::null, |
172 | QString = QString::null, QString = QString::null, | 174 | QString = QString::null, QString = QString::null, |
173 | QString = QString::null, QString = QString::null ); | 175 | QString = QString::null, QString = QString::null ); |
174 | 176 | ||
175 | OListViewItem( QListViewItem * parent, QListViewItem * after, | 177 | OListViewItem( QListViewItem * parent, QListViewItem * after, |
176 | QString, QString = QString::null, | 178 | QString, QString = QString::null, |
177 | QString = QString::null, QString = QString::null, | 179 | QString = QString::null, QString = QString::null, |
178 | QString = QString::null, QString = QString::null, | 180 | QString = QString::null, QString = QString::null, |
179 | QString = QString::null, QString = QString::null ); | 181 | QString = QString::null, QString = QString::null ); |
180 | /** | 182 | /** |
181 | * Destructor. | 183 | * Destructor. |
182 | */ | 184 | */ |
183 | virtual ~OListViewItem(); | 185 | virtual ~OListViewItem(); |
184 | /** | 186 | /** |
185 | * @returns the background color of the list item. | 187 | * @returns the background color of the list item. |
186 | */ | 188 | */ |
187 | const QColor& backgroundColor(); | 189 | const QColor& backgroundColor(); |
188 | /** | 190 | /** |
189 | * @returns true, if the item is at an odd position and | 191 | * @returns true, if the item is at an odd position and |
190 | * thus have to be painted with the alternate background color. | 192 | * thus have to be painted with the alternate background color. |
191 | */ | 193 | */ |
192 | bool isAlternate(); | 194 | bool isAlternate(); |
193 | /** | 195 | /** |
194 | * @note: Reimplemented for internal purposes - the API is not affected | 196 | * @note: Reimplemented for internal purposes - the API is not affected |
195 | * | 197 | * |
196 | */ | 198 | */ |
197 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); | 199 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); |
198 | /** | 200 | /** |
199 | * Perform object initialization. | 201 | * Perform object initialization. |
200 | */ | 202 | */ |
201 | void init(); | 203 | void init(); |
202 | /** | 204 | /** |
203 | * create a list view item as child of this object | 205 | * create a list view item as child of this object |
204 | * @returns the new object | 206 | * @returns the new object |
205 | */ | 207 | */ |
206 | virtual OListViewItem* childFactory(); | 208 | virtual OListViewItem* childFactory(); |
207 | #ifndef QT_NO_DATASTREAM | 209 | #ifndef QT_NO_DATASTREAM |
208 | /** | 210 | /** |
209 | * serialize this object to or from a @ref QDataStream | 211 | * serialize this object to or from a @ref QDataStream |
210 | * @param s the stream used to serialize this object. | 212 | * @param s the stream used to serialize this object. |
211 | */ | 213 | */ |
212 | virtual void serializeTo( QDataStream& s ) const; | 214 | virtual void serializeTo( QDataStream& s ) const; |
213 | 215 | ||
214 | /** | 216 | /** |
215 | * serialize this object to or from a @ref QDataStream | 217 | * serialize this object to or from a @ref QDataStream |
216 | * @param s the stream used to serialize this object. | 218 | * @param s the stream used to serialize this object. |
217 | */ | 219 | */ |
218 | virtual void serializeFrom( QDataStream& s ); | 220 | virtual void serializeFrom( QDataStream& s ); |
219 | #endif | 221 | #endif |
220 | 222 | ||
221 | private: | 223 | private: |
222 | bool m_known; | 224 | bool m_known; |
223 | bool m_odd; | 225 | bool m_odd; |
224 | }; | 226 | }; |
225 | 227 | ||
226 | #ifndef QT_NO_DATASTREAM | 228 | #ifndef QT_NO_DATASTREAM |
227 | /** | 229 | /** |
228 | * @relates QListViewItem | 230 | * @relates QListViewItem |
229 | * Writes listview @a item and all subitems recursively to @a stream | 231 | * Writes listview @a item and all subitems recursively to @a stream |
230 | * and returns a reference to the stream. | 232 | * and returns a reference to the stream. |
231 | */ | 233 | */ |
232 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); | 234 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); |
233 | /** | 235 | /** |
234 | * @relates QListViewItem | 236 | * @relates QListViewItem |
235 | * Reads listview @a item from @a stream and returns a reference to the stream. | 237 | * Reads listview @a item from @a stream and returns a reference to the stream. |
236 | */ | 238 | */ |
237 | QDataStream& operator>>( QDataStream& stream, OListViewItem& item ); | 239 | QDataStream& operator>>( QDataStream& stream, OListViewItem& item ); |
238 | #endif // QT_NO_DATASTREAM | 240 | #endif // QT_NO_DATASTREAM |
239 | 241 | ||
240 | /*====================================================================================== | 242 | /*====================================================================================== |
241 | * ONamedListView | 243 | * ONamedListView |
242 | *======================================================================================*/ | 244 | *======================================================================================*/ |
243 | 245 | ||
244 | class ONamedListViewItem; | 246 | class ONamedListViewItem; |
245 | 247 | ||
246 | /** | 248 | /** |
247 | * @brief An OListView variant with named columns. | 249 | * @brief An OListView variant with named columns. |
248 | * | 250 | * |
249 | * This class provides a higher-level interface to an OListView. | 251 | * This class provides a higher-level interface to an OListView. |
250 | * | 252 | * |
251 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 253 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
252 | */ | 254 | */ |
253 | class ONamedListView: public OListView | 255 | class ONamedListView: public OListView |
254 | { | 256 | { |
255 | public: | 257 | public: |
256 | /** | 258 | /** |
257 | * Constructor. | 259 | * Constructor. |
258 | * | 260 | * |
259 | * The parameters @a parent and @a name are handled by | 261 | * The parameters @a parent and @a name are handled by |
260 | * @ref OListView, as usual. | 262 | * @ref OListView, as usual. |
261 | */ | 263 | */ |
262 | ONamedListView( QWidget* parent = 0, const char* name = 0 ); | 264 | ONamedListView( QWidget* parent = 0, const char* name = 0 ); |
263 | /** | 265 | /** |
264 | * Destructor. | 266 | * Destructor. |
265 | */ | 267 | */ |
266 | virtual ~ONamedListView(); | 268 | virtual ~ONamedListView(); |
267 | /** | 269 | /** |
268 | * Add a number of @a columns to the listview. | 270 | * Add a number of @a columns to the listview. |
269 | */ | 271 | */ |
270 | virtual void addColumns( const QStringList& columns ); | 272 | virtual void addColumns( const QStringList& columns ); |
271 | /** | 273 | /** |
272 | * @returns the column index matching to @a text or -1 if not found. | 274 | * @returns the column index matching to @a text or -1 if not found. |
273 | */ | 275 | */ |
274 | virtual int findColumn( const QString& text ) const; | 276 | virtual int findColumn( const QString& text ) const; |
275 | /** | 277 | /** |
276 | * @returns the first item which has a @a text in column @a column. | 278 | * @returns the first item which has a @a text in column @a column. |
277 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> | 279 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> |
278 | * <li>set it to 0 to search only among direct childs, | 280 | * <li>set it to 0 to search only among direct childs, |
279 | * <li>set it to 1 to search direct childs and all 1st order subchilds | 281 | * <li>set it to 1 to search direct childs and all 1st order subchilds |
280 | * <li>set it to -1 for maximum recursion. | 282 | * <li>set it to -1 for maximum recursion. |
281 | * </ul> | 283 | * </ul> |
282 | * @sa ONamedListViewItem::find() | 284 | * @sa ONamedListViewItem::find() |
283 | */ | 285 | */ |
284 | virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; | 286 | virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; |
285 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; | 287 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; |
286 | 288 | ||
287 | virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; | 289 | virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; |
288 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; | 290 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; |
289 | }; | 291 | }; |
290 | 292 | ||
291 | /*====================================================================================== | 293 | /*====================================================================================== |
292 | * ONamedListViewItem | 294 | * ONamedListViewItem |
293 | *======================================================================================*/ | 295 | *======================================================================================*/ |
294 | 296 | ||
295 | /** | 297 | /** |
296 | * @brief An OListView variant with named columns. | 298 | * @brief An OListView variant with named columns. |
297 | * | 299 | * |
298 | * This class provides a higher-level interface to an OListViewItem. | 300 | * This class provides a higher-level interface to an OListViewItem. |
299 | * | 301 | * |
300 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 302 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
301 | */ | 303 | */ |
302 | class ONamedListViewItem: public OListViewItem | 304 | class ONamedListViewItem: public OListViewItem |
303 | { | 305 | { |
304 | public: | 306 | public: |
305 | /** | 307 | /** |
306 | * Constructor. Accepts the same parameters as a @ref OListViewItem, | 308 | * Constructor. Accepts the same parameters as a @ref OListViewItem, |
307 | * plus a @ref QStringList which holds an arbitrary number of @a texts. | 309 | * plus a @ref QStringList which holds an arbitrary number of @a texts. |
308 | */ | 310 | */ |
309 | ONamedListViewItem( QListView* parent, const QStringList& texts ); | 311 | ONamedListViewItem( QListView* parent, const QStringList& texts ); |
310 | ONamedListViewItem( QListViewItem* parent, const QStringList& texts ); | 312 | ONamedListViewItem( QListViewItem* parent, const QStringList& texts ); |
311 | ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ); | 313 | ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ); |
312 | ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ); | 314 | ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ); |
313 | /** | 315 | /** |
314 | * Destructor. | 316 | * Destructor. |
315 | */ | 317 | */ |
316 | virtual ~ONamedListViewItem(); | 318 | virtual ~ONamedListViewItem(); |
317 | /** | 319 | /** |
318 | * Sets the text in column @a column to @a text. | 320 | * Sets the text in column @a column to @a text. |
319 | * This method differs from @ref QListViewItem::setText() in that it | 321 | * This method differs from @ref QListViewItem::setText() in that it |
320 | * accepts a string as column indicator instead of an int. | 322 | * accepts a string as column indicator instead of an int. |
321 | */ | 323 | */ |
322 | virtual void setText( const QString& column, const QString& text ); | 324 | virtual void setText( const QString& column, const QString& text ); |
323 | /** | 325 | /** |
324 | * Sets a number of @a texts for this item. | 326 | * Sets a number of @a texts for this item. |
325 | */ | 327 | */ |
326 | virtual void setText( const QStringList& texts ); | 328 | virtual void setText( const QStringList& texts ); |
327 | /** | 329 | /** |
328 | * @returns the first child which has a @a text in column @a column. | 330 | * @returns the first child which has a @a text in column @a column. |
329 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> | 331 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> |
330 | * <li>set it to 0 to search only among direct childs, | 332 | * <li>set it to 0 to search only among direct childs, |
331 | * <li>set it to 1 to search direct childs and all 1st order subchilds | 333 | * <li>set it to 1 to search direct childs and all 1st order subchilds |
332 | * <li>set it to -1 for maximum recursion. | 334 | * <li>set it to -1 for maximum recursion. |
333 | * </ul> | 335 | * </ul> |
334 | * @sa ONamedListView::find() | 336 | * @sa ONamedListView::find() |
335 | */ | 337 | */ |
336 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; | 338 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; |
337 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; | 339 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; |
338 | }; | 340 | }; |
339 | 341 | ||
340 | 342 | ||
341 | #endif // OLISTVIEW_H | 343 | #endif // OLISTVIEW_H |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 5bec7ed..11394d7 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -1,192 +1,192 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | /* LOCAL */ | 16 | /* LOCAL */ |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "mainwindow.h" | 18 | #include "mainwindow.h" |
19 | 19 | ||
20 | /* QT */ | 20 | /* QT */ |
21 | #include <qapplication.h> | 21 | #include <qapplication.h> |
22 | #include <qcheckbox.h> | 22 | #include <qcheckbox.h> |
23 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
24 | #include <qfile.h> | 24 | #include <qfile.h> |
25 | #include <qlineedit.h> | 25 | #include <qlineedit.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qmap.h> | 27 | #include <qmap.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qspinbox.h> | 30 | #include <qspinbox.h> |
31 | #include <qtextstream.h> | 31 | #include <qtextstream.h> |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/onetwork.h> | 34 | #include <opie2/onetwork.h> |
35 | 35 | ||
36 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | 36 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; |
37 | 37 | ||
38 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 38 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
39 | :WellenreiterConfigBase( parent, name, true, f ) | 39 | :WellenreiterConfigBase( parent, name, true, f ) |
40 | { | 40 | { |
41 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; | 41 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; |
42 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; | 42 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; |
43 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; | 43 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; |
44 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; | 44 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; |
45 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; | 45 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; |
46 | _devicetype[ "<file>" ] = DEVTYPE_FILE; | 46 | _devicetype[ "<file>" ] = DEVTYPE_FILE; |
47 | 47 | ||
48 | // gather possible interface names from ONetwork | 48 | // gather possible interface names from ONetwork |
49 | ONetwork* net = ONetwork::instance(); | 49 | ONetwork* net = ONetwork::instance(); |
50 | ONetwork::InterfaceIterator it = net->iterator(); | 50 | ONetwork::InterfaceIterator it = net->iterator(); |
51 | while ( it.current() ) | 51 | while ( it.current() ) |
52 | { | 52 | { |
53 | if ( it.current()->isWireless() ) | 53 | if ( it.current()->isWireless() ) |
54 | interfaceName->insertItem( it.current()->name() ); | 54 | interfaceName->insertItem( it.current()->name() ); |
55 | ++it; | 55 | ++it; |
56 | } | 56 | } |
57 | 57 | ||
58 | // try to guess device type | 58 | // try to guess device type |
59 | QFile m( "/proc/modules" ); | 59 | QFile m( "/proc/modules" ); |
60 | if ( m.open( IO_ReadOnly ) ) | 60 | if ( m.open( IO_ReadOnly ) ) |
61 | { | 61 | { |
62 | int devicetype(0); | 62 | int devicetype(0); |
63 | QString line; | 63 | QString line; |
64 | QTextStream modules( &m ); | 64 | QTextStream modules( &m ); |
65 | while( !modules.atEnd() && !devicetype ) | 65 | while( !modules.atEnd() && !devicetype ) |
66 | { | 66 | { |
67 | modules >> line; | 67 | modules >> line; |
68 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; | 68 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; |
69 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; | 69 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; |
70 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; | 70 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; |
71 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; | 71 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; |
72 | } | 72 | } |
73 | if ( devicetype ) | 73 | if ( devicetype ) |
74 | { | 74 | { |
75 | deviceType->setCurrentItem( devicetype ); | 75 | deviceType->setCurrentItem( devicetype ); |
76 | _guess = devicetype; | 76 | _guess = devicetype; |
77 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); | 77 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | 81 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here |
82 | QPushButton* okButton = new QPushButton( "ok", this ); | 82 | QPushButton* okButton = new QPushButton( "ok", this ); |
83 | okButton->show(); | 83 | okButton->show(); |
84 | Layout5_2->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui | 84 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui |
85 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | 85 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | WellenreiterConfigWindow::_instance = this; | 88 | WellenreiterConfigWindow::_instance = this; |
89 | 89 | ||
90 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); | 90 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); |
91 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); | 91 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); |
92 | 92 | ||
93 | // make the checkbox 'channelAll' control all other channels | 93 | // make the checkbox 'channelAll' control all other channels |
94 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); | 94 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); |
95 | }; | 95 | }; |
96 | 96 | ||
97 | 97 | ||
98 | int WellenreiterConfigWindow::driverType() const | 98 | int WellenreiterConfigWindow::driverType() const |
99 | { | 99 | { |
100 | QString name = deviceType->currentText(); | 100 | QString name = deviceType->currentText(); |
101 | if ( _devicetype.contains( name ) ) | 101 | if ( _devicetype.contains( name ) ) |
102 | { | 102 | { |
103 | return _devicetype[name]; | 103 | return _devicetype[name]; |
104 | } | 104 | } |
105 | else | 105 | else |
106 | { | 106 | { |
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | }; | 109 | }; |
110 | 110 | ||
111 | 111 | ||
112 | int WellenreiterConfigWindow::hoppingInterval() const | 112 | int WellenreiterConfigWindow::hoppingInterval() const |
113 | { | 113 | { |
114 | return hopInterval->cleanText().toInt(); | 114 | return hopInterval->cleanText().toInt(); |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | bool WellenreiterConfigWindow::usePrismHeader() const | 118 | bool WellenreiterConfigWindow::usePrismHeader() const |
119 | { | 119 | { |
120 | return prismHeader->isOn(); | 120 | return prismHeader->isOn(); |
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | bool WellenreiterConfigWindow::isChannelChecked( int channel ) const | 124 | bool WellenreiterConfigWindow::isChannelChecked( int channel ) const |
125 | { | 125 | { |
126 | switch ( channel ) | 126 | switch ( channel ) |
127 | { | 127 | { |
128 | case 1: return channel1->isOn(); | 128 | case 1: return channel1->isOn(); |
129 | case 2: return channel2->isOn(); | 129 | case 2: return channel2->isOn(); |
130 | case 3: return channel3->isOn(); | 130 | case 3: return channel3->isOn(); |
131 | case 4: return channel4->isOn(); | 131 | case 4: return channel4->isOn(); |
132 | case 5: return channel5->isOn(); | 132 | case 5: return channel5->isOn(); |
133 | case 6: return channel6->isOn(); | 133 | case 6: return channel6->isOn(); |
134 | case 7: return channel7->isOn(); | 134 | case 7: return channel7->isOn(); |
135 | case 8: return channel8->isOn(); | 135 | case 8: return channel8->isOn(); |
136 | case 9: return channel9->isOn(); | 136 | case 9: return channel9->isOn(); |
137 | case 10: return channel10->isOn(); | 137 | case 10: return channel10->isOn(); |
138 | case 11: return channel11->isOn(); | 138 | case 11: return channel11->isOn(); |
139 | case 12: return channel12->isOn(); | 139 | case 12: return channel12->isOn(); |
140 | case 13: return channel13->isOn(); | 140 | case 13: return channel13->isOn(); |
141 | case 14: return channel14->isOn(); | 141 | case 14: return channel14->isOn(); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void WellenreiterConfigWindow::changedDeviceType(int t) | 146 | void WellenreiterConfigWindow::changedDeviceType(int t) |
147 | { | 147 | { |
148 | if ( t != DEVTYPE_FILE ) return; | 148 | if ( t != DEVTYPE_FILE ) return; |
149 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); | 149 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); |
150 | if ( !name.isEmpty() && QFile::exists( name ) ) | 150 | if ( !name.isEmpty() && QFile::exists( name ) ) |
151 | { | 151 | { |
152 | interfaceName->insertItem( name ); | 152 | interfaceName->insertItem( name ); |
153 | interfaceName->setCurrentItem( interfaceName->count()-1 ); | 153 | interfaceName->setCurrentItem( interfaceName->count()-1 ); |
154 | } | 154 | } |
155 | else | 155 | else |
156 | { | 156 | { |
157 | deviceType->setCurrentItem( _guess ); | 157 | deviceType->setCurrentItem( _guess ); |
158 | } | 158 | } |
159 | 159 | ||
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | void WellenreiterConfigWindow::getCaptureFileNameClicked() | 163 | void WellenreiterConfigWindow::getCaptureFileNameClicked() |
164 | { | 164 | { |
165 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); | 165 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); |
166 | qDebug( "name = %s", (const char*) name ); | 166 | qDebug( "name = %s", (const char*) name ); |
167 | if ( !name.isEmpty() ) | 167 | if ( !name.isEmpty() ) |
168 | { | 168 | { |
169 | captureFileName->setText( name ); | 169 | captureFileName->setText( name ); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | void WellenreiterConfigWindow::channelAllClicked(int state) | 174 | void WellenreiterConfigWindow::channelAllClicked(int state) |
175 | { | 175 | { |
176 | bool b = state; | 176 | bool b = state; |
177 | channel1->setChecked( b ); | 177 | channel1->setChecked( b ); |
178 | channel2->setChecked( b ); | 178 | channel2->setChecked( b ); |
179 | channel3->setChecked( b ); | 179 | channel3->setChecked( b ); |
180 | channel4->setChecked( b ); | 180 | channel4->setChecked( b ); |
181 | channel5->setChecked( b ); | 181 | channel5->setChecked( b ); |
182 | channel6->setChecked( b ); | 182 | channel6->setChecked( b ); |
183 | channel7->setChecked( b ); | 183 | channel7->setChecked( b ); |
184 | channel8->setChecked( b ); | 184 | channel8->setChecked( b ); |
185 | channel9->setChecked( b ); | 185 | channel9->setChecked( b ); |
186 | channel10->setChecked( b ); | 186 | channel10->setChecked( b ); |
187 | channel11->setChecked( b ); | 187 | channel11->setChecked( b ); |
188 | channel12->setChecked( b ); | 188 | channel12->setChecked( b ); |
189 | channel13->setChecked( b ); | 189 | channel13->setChecked( b ); |
190 | channel14->setChecked( b ); | 190 | channel14->setChecked( b ); |
191 | } | 191 | } |
192 | 192 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 085eec4..f4cfe52 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -1,494 +1,495 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "logwindow.h" | 18 | #include "logwindow.h" |
19 | 19 | ||
20 | #include <assert.h> | 20 | #include <assert.h> |
21 | #include <qcursor.h> | ||
21 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
22 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
23 | #include <qpopupmenu.h> | 24 | #include <qpopupmenu.h> |
24 | 25 | ||
25 | #ifdef QWS | 26 | #ifdef QWS |
26 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
27 | #include <opie/odevice.h> | 28 | #include <opie/odevice.h> |
28 | using namespace Opie; | 29 | using namespace Opie; |
29 | #endif | 30 | #endif |
30 | 31 | ||
31 | 32 | ||
32 | #ifdef QWS | 33 | #ifdef QWS |
33 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
34 | #else | 35 | #else |
35 | #include "resource.h" | 36 | #include "resource.h" |
36 | #endif | 37 | #endif |
37 | 38 | ||
38 | const int col_type = 0; | 39 | const int col_type = 0; |
39 | const int col_essid = 0; | 40 | const int col_essid = 0; |
40 | const int col_sig = 1; | 41 | const int col_sig = 1; |
41 | const int col_ap = 2; | 42 | const int col_ap = 2; |
42 | const int col_channel = 3; | 43 | const int col_channel = 3; |
43 | const int col_wep = 4; | 44 | const int col_wep = 4; |
44 | const int col_traffic = 5; | 45 | const int col_traffic = 5; |
45 | const int col_ip = 6; | 46 | const int col_ip = 6; |
46 | const int col_manuf = 7; | 47 | const int col_manuf = 7; |
47 | const int col_firstseen = 8; | 48 | const int col_firstseen = 8; |
48 | const int col_lastseen = 9; | 49 | const int col_lastseen = 9; |
49 | 50 | ||
50 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 51 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
51 | :OListView( parent, name ) | 52 | :OListView( parent, name ) |
52 | { | 53 | { |
53 | 54 | ||
54 | setFrameShape( QListView::StyledPanel ); | 55 | setFrameShape( QListView::StyledPanel ); |
55 | setFrameShadow( QListView::Sunken ); | 56 | setFrameShadow( QListView::Sunken ); |
56 | 57 | ||
57 | addColumn( tr( "Net/Station" ) ); | 58 | addColumn( tr( "Net/Station" ) ); |
58 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); | 59 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); |
59 | addColumn( tr( "#" ) ); | 60 | addColumn( tr( "#" ) ); |
60 | setColumnAlignment( col_sig, AlignCenter ); | 61 | setColumnAlignment( col_sig, AlignCenter ); |
61 | addColumn( tr( "MAC" ) ); | 62 | addColumn( tr( "MAC" ) ); |
62 | setColumnAlignment( col_ap, AlignCenter ); | 63 | setColumnAlignment( col_ap, AlignCenter ); |
63 | addColumn( tr( "Chn" ) ); | 64 | addColumn( tr( "Chn" ) ); |
64 | setColumnAlignment( col_channel, AlignCenter ); | 65 | setColumnAlignment( col_channel, AlignCenter ); |
65 | addColumn( tr( "W" ) ); | 66 | addColumn( tr( "W" ) ); |
66 | setColumnAlignment( col_wep, AlignCenter ); | 67 | setColumnAlignment( col_wep, AlignCenter ); |
67 | addColumn( tr( "T" ) ); | 68 | addColumn( tr( "T" ) ); |
68 | setColumnAlignment( col_traffic, AlignCenter ); | 69 | setColumnAlignment( col_traffic, AlignCenter ); |
69 | addColumn( tr( "IP" ) ); | 70 | addColumn( tr( "IP" ) ); |
70 | setColumnAlignment( col_ip, AlignCenter ); | 71 | setColumnAlignment( col_ip, AlignCenter ); |
71 | addColumn( tr( "Manufacturer" ) ); | 72 | addColumn( tr( "Manufacturer" ) ); |
72 | setColumnAlignment( col_manuf, AlignCenter ); | 73 | setColumnAlignment( col_manuf, AlignCenter ); |
73 | addColumn( tr( "First Seen" ) ); | 74 | addColumn( tr( "First Seen" ) ); |
74 | setColumnAlignment( col_firstseen, AlignCenter ); | 75 | setColumnAlignment( col_firstseen, AlignCenter ); |
75 | addColumn( tr( "Last Seen" ) ); | 76 | addColumn( tr( "Last Seen" ) ); |
76 | setColumnAlignment( col_lastseen, AlignCenter ); | 77 | setColumnAlignment( col_lastseen, AlignCenter ); |
77 | setRootIsDecorated( true ); | 78 | setRootIsDecorated( true ); |
78 | setAllColumnsShowFocus( true ); | 79 | setAllColumnsShowFocus( true ); |
79 | 80 | ||
80 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | 81 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
81 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | 82 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
82 | 83 | ||
83 | #ifdef QWS | 84 | #ifdef QWS |
84 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 85 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
85 | #endif | 86 | #endif |
86 | 87 | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | 90 | ||
90 | MScanListView::~MScanListView() | 91 | MScanListView::~MScanListView() |
91 | { | 92 | { |
92 | }; | 93 | }; |
93 | 94 | ||
94 | 95 | ||
95 | OListViewItem* MScanListView::childFactory() | 96 | OListViewItem* MScanListView::childFactory() |
96 | { | 97 | { |
97 | return new MScanListItem( this ); | 98 | return new MScanListItem( this ); |
98 | } | 99 | } |
99 | 100 | ||
100 | 101 | ||
101 | void MScanListView::serializeTo( QDataStream& s) const | 102 | void MScanListView::serializeTo( QDataStream& s) const |
102 | { | 103 | { |
103 | qDebug( "serializing MScanListView" ); | 104 | qDebug( "serializing MScanListView" ); |
104 | OListView::serializeTo( s ); | 105 | OListView::serializeTo( s ); |
105 | } | 106 | } |
106 | 107 | ||
107 | 108 | ||
108 | void MScanListView::serializeFrom( QDataStream& s) | 109 | void MScanListView::serializeFrom( QDataStream& s) |
109 | { | 110 | { |
110 | qDebug( "serializing MScanListView" ); | 111 | qDebug( "serializing MScanListView" ); |
111 | OListView::serializeFrom( s ); | 112 | OListView::serializeFrom( s ); |
112 | } | 113 | } |
113 | 114 | ||
114 | 115 | ||
115 | void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal ) | 116 | void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal ) |
116 | { | 117 | { |
117 | QString macaddr = mac.toString(true); | 118 | QString macaddr = mac.toString(true); |
118 | 119 | ||
119 | #ifdef DEBUG | 120 | #ifdef DEBUG |
120 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, | 121 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, |
121 | (const char*) essid, (const char*) macaddr, channel ); | 122 | (const char*) essid, (const char*) macaddr, channel ); |
122 | #endif | 123 | #endif |
123 | 124 | ||
124 | // search, if we already have seen this net | 125 | // search, if we already have seen this net |
125 | 126 | ||
126 | QString s; | 127 | QString s; |
127 | MScanListItem* network; | 128 | MScanListItem* network; |
128 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 129 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
129 | 130 | ||
130 | while ( item && ( item->text( col_essid ) != essid ) ) | 131 | while ( item && ( item->text( col_essid ) != essid ) ) |
131 | { | 132 | { |
132 | #ifdef DEBUG | 133 | #ifdef DEBUG |
133 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); | 134 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); |
134 | #endif | 135 | #endif |
135 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 136 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
136 | } | 137 | } |
137 | if ( item ) | 138 | if ( item ) |
138 | { | 139 | { |
139 | // we have already seen this net, check all childs if MAC exists | 140 | // we have already seen this net, check all childs if MAC exists |
140 | 141 | ||
141 | network = item; | 142 | network = item; |
142 | 143 | ||
143 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 144 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
144 | assert( item ); // this shouldn't fail | 145 | assert( item ); // this shouldn't fail |
145 | 146 | ||
146 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 147 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
147 | { | 148 | { |
148 | #ifdef DEBUG | 149 | #ifdef DEBUG |
149 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); | 150 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); |
150 | #endif | 151 | #endif |
151 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 152 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
152 | } | 153 | } |
153 | 154 | ||
154 | if ( item ) | 155 | if ( item ) |
155 | { | 156 | { |
156 | // we have already seen this item, it's a dupe | 157 | // we have already seen this item, it's a dupe |
157 | #ifdef DEBUG | 158 | #ifdef DEBUG |
158 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 159 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
159 | #endif | 160 | #endif |
160 | item->receivedBeacon(); | 161 | item->receivedBeacon(); |
161 | return; | 162 | return; |
162 | } | 163 | } |
163 | } | 164 | } |
164 | else | 165 | else |
165 | { | 166 | { |
166 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 167 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
167 | MLogWindow::logwindow()->log( s ); | 168 | MLogWindow::logwindow()->log( s ); |
168 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); | 169 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | // insert new station as child from network | 173 | // insert new station as child from network |
173 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 174 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
174 | 175 | ||
175 | #ifdef DEBUG | 176 | #ifdef DEBUG |
176 | qDebug( "inserting new station %s", (const char*) macaddr ); | 177 | qDebug( "inserting new station %s", (const char*) macaddr ); |
177 | #endif | 178 | #endif |
178 | 179 | ||
179 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 180 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
180 | station->setManufacturer( mac.manufacturer() ); | 181 | station->setManufacturer( mac.manufacturer() ); |
181 | 182 | ||
182 | if ( type == "managed" ) | 183 | if ( type == "managed" ) |
183 | { | 184 | { |
184 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 185 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
185 | } | 186 | } |
186 | else | 187 | else |
187 | { | 188 | { |
188 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); | 189 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); |
189 | } | 190 | } |
190 | MLogWindow::logwindow()->log( s ); | 191 | MLogWindow::logwindow()->log( s ); |
191 | 192 | ||
192 | } | 193 | } |
193 | 194 | ||
194 | 195 | ||
195 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) | 196 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) |
196 | { | 197 | { |
197 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 198 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
198 | 199 | ||
199 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) | 200 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) |
200 | { | 201 | { |
201 | #ifdef DEBUG | 202 | #ifdef DEBUG |
202 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 203 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
203 | #endif | 204 | #endif |
204 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 205 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
205 | } | 206 | } |
206 | 207 | ||
207 | if ( subitem ) | 208 | if ( subitem ) |
208 | { | 209 | { |
209 | // we have already seen this item, it's a dupe | 210 | // we have already seen this item, it's a dupe |
210 | #ifdef DEBUG | 211 | #ifdef DEBUG |
211 | qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); | 212 | qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); |
212 | #endif | 213 | #endif |
213 | subitem->receivedBeacon(); //FIXME: sent data bit | 214 | subitem->receivedBeacon(); //FIXME: sent data bit |
214 | return; | 215 | return; |
215 | } | 216 | } |
216 | 217 | ||
217 | // Hey, it seems to be a new item :-D | 218 | // Hey, it seems to be a new item :-D |
218 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); | 219 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); |
219 | station->setManufacturer( addr.manufacturer() ); | 220 | station->setManufacturer( addr.manufacturer() ); |
220 | 221 | ||
221 | QString s; | 222 | QString s; |
222 | if ( type == "station" ) | 223 | if ( type == "station" ) |
223 | { | 224 | { |
224 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 225 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
225 | } | 226 | } |
226 | else | 227 | else |
227 | { | 228 | { |
228 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 229 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
229 | } | 230 | } |
230 | MLogWindow::logwindow()->log( s ); | 231 | MLogWindow::logwindow()->log( s ); |
231 | } | 232 | } |
232 | 233 | ||
233 | 234 | ||
234 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) | 235 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) |
235 | { | 236 | { |
236 | QString s; | 237 | QString s; |
237 | MScanListItem* network; | 238 | MScanListItem* network; |
238 | 239 | ||
239 | QListViewItemIterator it( this ); | 240 | QListViewItemIterator it( this ); |
240 | while ( it.current() && | 241 | while ( it.current() && |
241 | it.current()->text( col_ap ) != viaFrom.toString(true) && | 242 | it.current()->text( col_ap ) != viaFrom.toString(true) && |
242 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; | 243 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; |
243 | 244 | ||
244 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 245 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
245 | 246 | ||
246 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations | 247 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
247 | { | 248 | { |
248 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 249 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
249 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); | 250 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); |
250 | } | 251 | } |
251 | else | 252 | else |
252 | { | 253 | { |
253 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); | 254 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); |
254 | MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); | 255 | MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); |
255 | } | 256 | } |
256 | } | 257 | } |
257 | 258 | ||
258 | 259 | ||
259 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 260 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
260 | { | 261 | { |
261 | QString s; | 262 | QString s; |
262 | MScanListItem* network; | 263 | MScanListItem* network; |
263 | 264 | ||
264 | QListViewItemIterator it( this ); | 265 | QListViewItemIterator it( this ); |
265 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 266 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
266 | 267 | ||
267 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 268 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
268 | 269 | ||
269 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 270 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
270 | { | 271 | { |
271 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); | 272 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); |
272 | } | 273 | } |
273 | else | 274 | else |
274 | { | 275 | { |
275 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 276 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
276 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); | 277 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); |
277 | 278 | ||
278 | } | 279 | } |
279 | } | 280 | } |
280 | 281 | ||
281 | 282 | ||
282 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 283 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
283 | { | 284 | { |
284 | QString s; | 285 | QString s; |
285 | MScanListItem* network; | 286 | MScanListItem* network; |
286 | 287 | ||
287 | QListViewItemIterator it( this ); | 288 | QListViewItemIterator it( this ); |
288 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 289 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
289 | 290 | ||
290 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 291 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
291 | 292 | ||
292 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 293 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
293 | { | 294 | { |
294 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); | 295 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); |
295 | } | 296 | } |
296 | else | 297 | else |
297 | { | 298 | { |
298 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 299 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
299 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); | 300 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); |
300 | } | 301 | } |
301 | } | 302 | } |
302 | 303 | ||
303 | 304 | ||
304 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 305 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
305 | { | 306 | { |
306 | qWarning( "D'oh! Not yet implemented..." ); | 307 | qWarning( "D'oh! Not yet implemented..." ); |
307 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); | 308 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); |
308 | } | 309 | } |
309 | 310 | ||
310 | 311 | ||
311 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | 312 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) |
312 | { | 313 | { |
313 | qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); | 314 | qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); |
314 | 315 | ||
315 | QListViewItemIterator it( this ); | 316 | QListViewItemIterator it( this ); |
316 | for ( ; it.current(); ++it ) | 317 | for ( ; it.current(); ++it ) |
317 | { | 318 | { |
318 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 319 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
319 | { | 320 | { |
320 | it.current()->setText( col_ip, ip ); | 321 | it.current()->setText( col_ip, ip ); |
321 | return; | 322 | return; |
322 | } | 323 | } |
323 | } | 324 | } |
324 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 325 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); |
325 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", | 326 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", |
326 | (const char*) macaddr.toString(), (const char*) ip ) ); | 327 | (const char*) macaddr.toString(), (const char*) ip ) ); |
327 | } | 328 | } |
328 | 329 | ||
329 | 330 | ||
330 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 331 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
331 | { | 332 | { |
332 | if ( !item ) return; | 333 | if ( !item ) return; |
333 | 334 | ||
334 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 335 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
335 | 336 | ||
336 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 337 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", |
337 | (const char*) itm->text(0), (const char*) itm->type, col ); | 338 | (const char*) itm->text(0), (const char*) itm->type, col ); |
338 | 339 | ||
339 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 340 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
340 | { | 341 | { |
341 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 342 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); |
342 | 343 | ||
343 | QPopupMenu m( this ); | 344 | QPopupMenu m( this ); |
344 | m.insertItem( entry, 37773, 0 ); | 345 | m.insertItem( entry, 37773, 0 ); |
345 | int result = m.exec( QCursor::pos() ); | 346 | int result = m.exec( QCursor::pos() ); |
346 | if ( result == 37773 ) | 347 | if ( result == 37773 ) |
347 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); | 348 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); |
348 | } | 349 | } |
349 | } | 350 | } |
350 | 351 | ||
351 | //============================================================ | 352 | //============================================================ |
352 | // MScanListItem | 353 | // MScanListItem |
353 | //============================================================ | 354 | //============================================================ |
354 | 355 | ||
355 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 356 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
356 | bool wep, int channel, int signal ) | 357 | bool wep, int channel, int signal ) |
357 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 358 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
358 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 359 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
359 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 360 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
360 | { | 361 | { |
361 | #ifdef DEBUG | 362 | #ifdef DEBUG |
362 | qDebug( "creating scanlist item" ); | 363 | qDebug( "creating scanlist item" ); |
363 | #endif | 364 | #endif |
364 | if ( WellenreiterConfigWindow::instance() && type == "network" ) | 365 | if ( WellenreiterConfigWindow::instance() && type == "network" ) |
365 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | 366 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); |
366 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 367 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
367 | } | 368 | } |
368 | 369 | ||
369 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 370 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
370 | bool wep, int channel, int signal ) | 371 | bool wep, int channel, int signal ) |
371 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 372 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
372 | { | 373 | { |
373 | #ifdef DEBUG | 374 | #ifdef DEBUG |
374 | qDebug( "creating scanlist item" ); | 375 | qDebug( "creating scanlist item" ); |
375 | #endif | 376 | #endif |
376 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 377 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
377 | } | 378 | } |
378 | 379 | ||
379 | const QString& MScanListItem::essid() const | 380 | const QString& MScanListItem::essid() const |
380 | { | 381 | { |
381 | if ( type == "network" ) | 382 | if ( type == "network" ) |
382 | return _essid; | 383 | return _essid; |
383 | else | 384 | else |
384 | return ( (MScanListItem*) parent() )->essid(); | 385 | return ( (MScanListItem*) parent() )->essid(); |
385 | } | 386 | } |
386 | 387 | ||
387 | OListViewItem* MScanListItem::childFactory() | 388 | OListViewItem* MScanListItem::childFactory() |
388 | { | 389 | { |
389 | return new MScanListItem( this ); | 390 | return new MScanListItem( this ); |
390 | } | 391 | } |
391 | 392 | ||
392 | void MScanListItem::serializeTo( QDataStream& s ) const | 393 | void MScanListItem::serializeTo( QDataStream& s ) const |
393 | { | 394 | { |
394 | #ifdef DEBUG | 395 | #ifdef DEBUG |
395 | qDebug( "serializing MScanListItem" ); | 396 | qDebug( "serializing MScanListItem" ); |
396 | #endif | 397 | #endif |
397 | OListViewItem::serializeTo( s ); | 398 | OListViewItem::serializeTo( s ); |
398 | 399 | ||
399 | s << _type; | 400 | s << _type; |
400 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 401 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
401 | } | 402 | } |
402 | 403 | ||
403 | void MScanListItem::serializeFrom( QDataStream& s ) | 404 | void MScanListItem::serializeFrom( QDataStream& s ) |
404 | { | 405 | { |
405 | #ifdef DEBUG | 406 | #ifdef DEBUG |
406 | qDebug( "serializing MScanListItem" ); | 407 | qDebug( "serializing MScanListItem" ); |
407 | #endif | 408 | #endif |
408 | OListViewItem::serializeFrom( s ); | 409 | OListViewItem::serializeFrom( s ); |
409 | 410 | ||
410 | char wep; | 411 | char wep; |
411 | s >> _type; | 412 | s >> _type; |
412 | s >> (Q_UINT8) wep; | 413 | s >> (Q_UINT8) wep; |
413 | _wep = (wep == 'y'); | 414 | _wep = (wep == 'y'); |
414 | 415 | ||
415 | QString name; | 416 | QString name; |
416 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 417 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
417 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 418 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
418 | if ( _wep ) | 419 | if ( _wep ) |
419 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 420 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
420 | listView()->triggerUpdate(); | 421 | listView()->triggerUpdate(); |
421 | } | 422 | } |
422 | 423 | ||
423 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 424 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
424 | { | 425 | { |
425 | #ifdef DEBUG | 426 | #ifdef DEBUG |
426 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 427 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
427 | (const char*) type, | 428 | (const char*) type, |
428 | (const char*) essid, | 429 | (const char*) essid, |
429 | (const char*) macaddr, | 430 | (const char*) macaddr, |
430 | channel ); | 431 | channel ); |
431 | #endif | 432 | #endif |
432 | 433 | ||
433 | // set icon for managed or adhoc mode | 434 | // set icon for managed or adhoc mode |
434 | QString name; | 435 | QString name; |
435 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 436 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
436 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 437 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
437 | 438 | ||
438 | // set icon for wep (wireless encryption protocol) | 439 | // set icon for wep (wireless encryption protocol) |
439 | if ( wep ) | 440 | if ( wep ) |
440 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 441 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
441 | 442 | ||
442 | // set channel and signal text | 443 | // set channel and signal text |
443 | 444 | ||
444 | if ( signal != -1 ) | 445 | if ( signal != -1 ) |
445 | setText( col_sig, QString::number( signal ) ); | 446 | setText( col_sig, QString::number( signal ) ); |
446 | if ( channel != -1 ) | 447 | if ( channel != -1 ) |
447 | setText( col_channel, QString::number( channel ) ); | 448 | setText( col_channel, QString::number( channel ) ); |
448 | 449 | ||
449 | setText( col_firstseen, QTime::currentTime().toString() ); | 450 | setText( col_firstseen, QTime::currentTime().toString() ); |
450 | //setText( col_lastseen, QTime::currentTime().toString() ); | 451 | //setText( col_lastseen, QTime::currentTime().toString() ); |
451 | 452 | ||
452 | listView()->triggerUpdate(); | 453 | listView()->triggerUpdate(); |
453 | 454 | ||
454 | this->type = type; | 455 | this->type = type; |
455 | _type = type; | 456 | _type = type; |
456 | _essid = essid; | 457 | _essid = essid; |
457 | _macaddr = macaddr; | 458 | _macaddr = macaddr; |
458 | _channel = channel; | 459 | _channel = channel; |
459 | _beacons = 1; | 460 | _beacons = 1; |
460 | _signal = 0; | 461 | _signal = 0; |
461 | } | 462 | } |
462 | 463 | ||
463 | 464 | ||
464 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 465 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
465 | { | 466 | { |
466 | setText( col_manuf, manufacturer ); | 467 | setText( col_manuf, manufacturer ); |
467 | } | 468 | } |
468 | 469 | ||
469 | 470 | ||
470 | void MScanListItem::playSound( const QString& sound ) const | 471 | void MScanListItem::playSound( const QString& sound ) const |
471 | { | 472 | { |
472 | #ifdef QWS | 473 | #ifdef QWS |
473 | if ( sound == "Ignore" ) return; | 474 | if ( sound == "Ignore" ) return; |
474 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | 475 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); |
475 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | 476 | else if ( sound == "Key" ) ODevice::inst()->keySound(); |
476 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | 477 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); |
477 | #endif | 478 | #endif |
478 | } | 479 | } |
479 | 480 | ||
480 | 481 | ||
481 | void MScanListItem::receivedBeacon() | 482 | void MScanListItem::receivedBeacon() |
482 | { | 483 | { |
483 | _beacons++; | 484 | _beacons++; |
484 | #ifdef DEBUG | 485 | #ifdef DEBUG |
485 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 486 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); |
486 | #endif | 487 | #endif |
487 | setText( col_sig, QString::number( _beacons ) ); | 488 | setText( col_sig, QString::number( _beacons ) ); |
488 | setText( col_lastseen, QTime::currentTime().toString() ); | 489 | setText( col_lastseen, QTime::currentTime().toString() ); |
489 | 490 | ||
490 | MScanListItem* p = (MScanListItem*) parent(); | 491 | MScanListItem* p = (MScanListItem*) parent(); |
491 | if ( p ) p->receivedBeacon(); | 492 | if ( p ) p->receivedBeacon(); |
492 | 493 | ||
493 | } | 494 | } |
494 | 495 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index dcf796f..96733ff 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -1,530 +1,537 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Local | 16 | // Local |
17 | 17 | ||
18 | #include "wellenreiter.h" | 18 | #include "wellenreiter.h" |
19 | #include "scanlist.h" | 19 | #include "scanlist.h" |
20 | #include "logwindow.h" | 20 | #include "logwindow.h" |
21 | #include "hexwindow.h" | 21 | #include "hexwindow.h" |
22 | #include "configwindow.h" | 22 | #include "configwindow.h" |
23 | #include "statwindow.h" | 23 | #include "statwindow.h" |
24 | #include "graphwindow.h" | 24 | #include "graphwindow.h" |
25 | #include "protolistview.h" | 25 | #include "protolistview.h" |
26 | 26 | ||
27 | // Opie | 27 | // Opie |
28 | 28 | ||
29 | #ifdef QWS | 29 | #ifdef QWS |
30 | #include <opie/odevice.h> | 30 | #include <opie/odevice.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | using namespace Opie; | 32 | using namespace Opie; |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | #include <opie2/oapplication.h> | 36 | #include <opie2/oapplication.h> |
37 | #else | 37 | #else |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #endif | 39 | #endif |
40 | #include <opie2/onetwork.h> | 40 | #include <opie2/onetwork.h> |
41 | #include <opie2/opcap.h> | 41 | #include <opie2/opcap.h> |
42 | 42 | ||
43 | // Qt | 43 | // Qt |
44 | 44 | ||
45 | #include <qcheckbox.h> | 45 | #include <qcheckbox.h> |
46 | #include <qcombobox.h> | 46 | #include <qcombobox.h> |
47 | #include <qdatetime.h> | 47 | #include <qdatetime.h> |
48 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
49 | #include <qlineedit.h> | 49 | #include <qlineedit.h> |
50 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qobjectlist.h> | 51 | #include <qobjectlist.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qspinbox.h> | 53 | #include <qspinbox.h> |
54 | #include <qtoolbutton.h> | 54 | #include <qtoolbutton.h> |
55 | #include <qmainwindow.h> | 55 | #include <qmainwindow.h> |
56 | 56 | ||
57 | // Standard | 57 | // Standard |
58 | 58 | ||
59 | #include <assert.h> | 59 | #include <assert.h> |
60 | #include <errno.h> | 60 | #include <errno.h> |
61 | #include <unistd.h> | 61 | #include <unistd.h> |
62 | #include <string.h> | 62 | #include <string.h> |
63 | #include <sys/types.h> | 63 | #include <sys/types.h> |
64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
65 | 65 | ||
66 | Wellenreiter::Wellenreiter( QWidget* parent ) | 66 | Wellenreiter::Wellenreiter( QWidget* parent ) |
67 | : WellenreiterBase( parent, 0, 0 ), | 67 | : WellenreiterBase( parent, 0, 0 ), |
68 | sniffing( false ), iface( 0 ), configwindow( 0 ) | 68 | sniffing( false ), iface( 0 ), configwindow( 0 ) |
69 | { | 69 | { |
70 | 70 | ||
71 | logwindow->log( "(i) Wellenreiter has been started." ); | 71 | logwindow->log( "(i) Wellenreiter has been started." ); |
72 | 72 | ||
73 | // | 73 | // |
74 | // detect operating system | 74 | // detect operating system |
75 | // | 75 | // |
76 | 76 | ||
77 | #ifdef QWS | 77 | #ifdef QWS |
78 | QString sys; | 78 | QString sys; |
79 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 79 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
80 | _system = ODevice::inst()->system(); | 80 | _system = ODevice::inst()->system(); |
81 | logwindow->log( sys ); | 81 | logwindow->log( sys ); |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | netview->setColumnWidthMode( 1, QListView::Manual ); | 84 | netview->setColumnWidthMode( 1, QListView::Manual ); |
85 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), | 85 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), |
86 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); | 86 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); |
87 | pcap = new OPacketCapturer(); | 87 | pcap = new OPacketCapturer(); |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | Wellenreiter::~Wellenreiter() | 91 | Wellenreiter::~Wellenreiter() |
92 | { | 92 | { |
93 | delete pcap; | 93 | delete pcap; |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 97 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
98 | { | 98 | { |
99 | configwindow = cw; | 99 | configwindow = cw; |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | void Wellenreiter::channelHopped(int c) | 103 | void Wellenreiter::channelHopped(int c) |
104 | { | 104 | { |
105 | QString title = "Wellenreiter II -scan- ["; | 105 | QString title = "Wellenreiter II -scan- ["; |
106 | QString left; | 106 | QString left; |
107 | if ( c > 1 ) left.fill( '.', c-1 ); | 107 | if ( c > 1 ) left.fill( '.', c-1 ); |
108 | title.append( left ); | 108 | title.append( left ); |
109 | title.append( '|' ); | 109 | title.append( '|' ); |
110 | if ( c < iface->channels() ) | 110 | if ( c < iface->channels() ) |
111 | { | 111 | { |
112 | QString right; | 112 | QString right; |
113 | right.fill( '.', iface->channels()-c ); | 113 | right.fill( '.', iface->channels()-c ); |
114 | title.append( right ); | 114 | title.append( right ); |
115 | } | 115 | } |
116 | title.append( "]" ); | 116 | title.append( "]" ); |
117 | //title.append( QString().sprintf( " %02d", c ) ); | 117 | //title.append( QString().sprintf( " %02d", c ) ); |
118 | assert( parent() ); | 118 | assert( parent() ); |
119 | ( (QMainWindow*) parent() )->setCaption( title ); | 119 | ( (QMainWindow*) parent() )->setCaption( title ); |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | void Wellenreiter::handleNotification( OPacket* p ) | 123 | void Wellenreiter::handleNotification( OPacket* p ) |
124 | { | 124 | { |
125 | QObjectList* l = p->queryList(); | 125 | QObjectList* l = p->queryList(); |
126 | QObjectListIt it( *l ); | 126 | QObjectListIt it( *l ); |
127 | QObject* o; | 127 | QObject* o; |
128 | 128 | ||
129 | while ( (o = it.current()) != 0 ) | 129 | while ( (o = it.current()) != 0 ) |
130 | { | 130 | { |
131 | QString name = it.current()->name(); | 131 | QString name = it.current()->name(); |
132 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | 132 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) |
133 | { | 133 | { |
134 | QString action = configwindow->parsePackets->protocolAction( name ); | 134 | QString action = configwindow->parsePackets->protocolAction( name ); |
135 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 135 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); |
136 | doAction( action, name, p ); | 136 | doAction( action, name, p ); |
137 | } | 137 | } |
138 | else | 138 | else |
139 | { | 139 | { |
140 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 140 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); |
141 | } | 141 | } |
142 | ++it; | 142 | ++it; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 147 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
148 | { | 148 | { |
149 | QString type; | 149 | QString type; |
150 | if ( beacon->canIBSS() ) | 150 | if ( beacon->canIBSS() ) |
151 | { | 151 | { |
152 | type = "adhoc"; | 152 | type = "adhoc"; |
153 | } | 153 | } |
154 | else if ( beacon->canESS() ) | 154 | else if ( beacon->canESS() ) |
155 | { | 155 | { |
156 | type = "managed"; | 156 | type = "managed"; |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 160 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | 163 | ||
164 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 164 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
165 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 165 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
166 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 166 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
167 | int channel = ds ? ds->channel() : -1; | 167 | int channel = ds ? ds->channel() : -1; |
168 | 168 | ||
169 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 169 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
170 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); | 170 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); |
171 | 171 | ||
172 | // update graph window | 172 | // update graph window |
173 | if ( ds ) | 173 | if ( ds ) |
174 | { | 174 | { |
175 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 175 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
176 | if ( prism ) | 176 | if ( prism ) |
177 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 177 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
178 | else | 178 | else |
179 | graphwindow->traffic( ds->channel(), 95 ); | 179 | graphwindow->traffic( ds->channel(), 95 ); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | 184 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) |
185 | { | 185 | { |
186 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 186 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
187 | if ( wlan->fromDS() && !wlan->toDS() ) | 187 | if ( wlan->fromDS() && !wlan->toDS() ) |
188 | { | 188 | { |
189 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 189 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
190 | } | 190 | } |
191 | else if ( !wlan->fromDS() && wlan->toDS() ) | 191 | else if ( !wlan->fromDS() && wlan->toDS() ) |
192 | { | 192 | { |
193 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); | 193 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
194 | } | 194 | } |
195 | else if ( wlan->fromDS() && wlan->toDS() ) | 195 | else if ( wlan->fromDS() && wlan->toDS() ) |
196 | { | 196 | { |
197 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 197 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
198 | } | 198 | } |
199 | else | 199 | else |
200 | { | 200 | { |
201 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); | 201 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
202 | } | 202 | } |
203 | 203 | ||
204 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 204 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
205 | if ( arp ) | 205 | if ( arp ) |
206 | { | 206 | { |
207 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 207 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); |
208 | if ( arp->type() == "REQUEST" ) | 208 | if ( arp->type() == "REQUEST" ) |
209 | { | 209 | { |
210 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 210 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
211 | } | 211 | } |
212 | else if ( arp->type() == "REPLY" ) | 212 | else if ( arp->type() == "REPLY" ) |
213 | { | 213 | { |
214 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 214 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
215 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 215 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); | 219 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); |
220 | if ( ip ) | 220 | if ( ip ) |
221 | { | 221 | { |
222 | qDebug( "Received IP packet." ); | 222 | qDebug( "Received IP packet." ); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | 227 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) |
228 | { | 228 | { |
229 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) | 229 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) |
230 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) | 230 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) |
231 | return 0; | 231 | return 0; |
232 | 232 | ||
233 | return p->child( protocol ); | 233 | return p->child( protocol ); |
234 | } | 234 | } |
235 | 235 | ||
236 | 236 | ||
237 | bool Wellenreiter::checkDumpPacket( OPacket* p ) | 237 | bool Wellenreiter::checkDumpPacket( OPacket* p ) |
238 | { | 238 | { |
239 | // go through all child packets and see if one is inside the child hierarchy for p | 239 | // go through all child packets and see if one is inside the child hierarchy for p |
240 | // if so, do what the user requested (protocolAction), e.g. pass or discard | 240 | // if so, do what the user requested (protocolAction), e.g. pass or discard |
241 | if ( !configwindow->writeCaptureFile->isOn() ) | 241 | if ( !configwindow->writeCaptureFile->isOn() ) |
242 | return false; | 242 | return false; |
243 | 243 | ||
244 | QObjectList* l = p->queryList(); | 244 | QObjectList* l = p->queryList(); |
245 | QObjectListIt it( *l ); | 245 | QObjectListIt it( *l ); |
246 | QObject* o; | 246 | QObject* o; |
247 | 247 | ||
248 | while ( (o = it.current()) != 0 ) | 248 | while ( (o = it.current()) != 0 ) |
249 | { | 249 | { |
250 | QString name = it.current()->name(); | 250 | QString name = it.current()->name(); |
251 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) | 251 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) |
252 | { | 252 | { |
253 | QString action = configwindow->capturePackets->protocolAction( name ); | 253 | QString action = configwindow->capturePackets->protocolAction( name ); |
254 | qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 254 | qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); |
255 | if ( action == "Discard" ) | 255 | if ( action == "Discard" ) |
256 | { | 256 | { |
257 | logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); | 257 | logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); |
258 | return false; | 258 | return false; |
259 | } | 259 | } |
260 | } | 260 | } |
261 | else | 261 | else |
262 | { | 262 | { |
263 | qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); | 263 | qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); |
264 | } | 264 | } |
265 | ++it; | 265 | ++it; |
266 | } | 266 | } |
267 | return true; | 267 | return true; |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | void Wellenreiter::receivePacket( OPacket* p ) | 271 | void Wellenreiter::receivePacket( OPacket* p ) |
272 | { | 272 | { |
273 | hexWindow()->log( p->dump( 8 ) ); | 273 | hexWindow()->log( p->dump( 8 ) ); |
274 | 274 | ||
275 | if ( checkDumpPacket( p ) ) | 275 | if ( checkDumpPacket( p ) ) |
276 | { | 276 | { |
277 | pcap->dump( p ); | 277 | pcap->dump( p ); |
278 | } | 278 | } |
279 | 279 | ||
280 | // check if we received a beacon frame | 280 | // check if we received a beacon frame |
281 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); | 281 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); |
282 | if ( beacon && beacon->managementType() == "Beacon" ) | 282 | if ( beacon && beacon->managementType() == "Beacon" ) |
283 | { | 283 | { |
284 | handleBeacon( p, beacon ); | 284 | handleBeacon( p, beacon ); |
285 | return; | 285 | return; |
286 | } | 286 | } |
287 | 287 | ||
288 | //TODO: WEP check here | 288 | //TODO: WEP check here |
289 | 289 | ||
290 | // check for a data frame | 290 | // check for a data frame |
291 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); | 291 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); |
292 | if ( data ) | 292 | if ( data ) |
293 | { | 293 | { |
294 | handleData( p, data ); | 294 | handleData( p, data ); |
295 | } | 295 | } |
296 | 296 | ||
297 | handleNotification( p ); | 297 | handleNotification( p ); |
298 | 298 | ||
299 | } | 299 | } |
300 | 300 | ||
301 | 301 | ||
302 | void Wellenreiter::stopClicked() | 302 | void Wellenreiter::stopClicked() |
303 | { | 303 | { |
304 | if ( iface ) | 304 | if ( iface ) |
305 | { | 305 | { |
306 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 306 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
307 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 307 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
308 | iface->setChannelHopping(); // stop hopping channels | 308 | iface->setChannelHopping(); // stop hopping channels |
309 | } | 309 | } |
310 | else | 310 | else |
311 | killTimers(); | 311 | killTimers(); |
312 | 312 | ||
313 | pcap->close(); | 313 | pcap->close(); |
314 | sniffing = false; | 314 | sniffing = false; |
315 | 315 | ||
316 | if ( iface ) | 316 | if ( iface ) |
317 | { | 317 | { |
318 | // switch off monitor mode | 318 | // switch off monitor mode |
319 | iface->setMonitorMode( false ); | 319 | iface->setMonitorMode( false ); |
320 | // switch off promisc flag | 320 | // switch off promisc flag |
321 | iface->setPromiscuousMode( false ); | 321 | iface->setPromiscuousMode( false ); |
322 | 322 | ||
323 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 323 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
324 | } | 324 | } |
325 | 325 | ||
326 | logwindow->log( "(i) Stopped Scanning." ); | 326 | logwindow->log( "(i) Stopped Scanning." ); |
327 | assert( parent() ); | 327 | assert( parent() ); |
328 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 328 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
329 | 329 | ||
330 | // message the user | 330 | // message the user |
331 | QMessageBox::information( this, "Wellenreiter II", | 331 | QMessageBox::information( this, "Wellenreiter II", |
332 | tr( "Your wireless card\nshould now be usable again." ) ); | 332 | tr( "Your wireless card\nshould now be usable again." ) ); |
333 | 333 | ||
334 | sniffing = false; | 334 | sniffing = false; |
335 | emit( stoppedSniffing() ); | 335 | emit( stoppedSniffing() ); |
336 | 336 | ||
337 | // print out statistics | 337 | // print out statistics |
338 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 338 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
339 | statwindow->updateCounter( it.key(), it.data() ); | 339 | statwindow->updateCounter( it.key(), it.data() ); |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | void Wellenreiter::startClicked() | 343 | void Wellenreiter::startClicked() |
344 | { | 344 | { |
345 | // get configuration from config window | 345 | // get configuration from config window |
346 | 346 | ||
347 | const QString& interface = configwindow->interfaceName->currentText(); | 347 | const QString& interface = configwindow->interfaceName->currentText(); |
348 | const int cardtype = configwindow->driverType(); | 348 | const int cardtype = configwindow->driverType(); |
349 | const int interval = configwindow->hoppingInterval(); | 349 | const int interval = configwindow->hoppingInterval(); |
350 | 350 | ||
351 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 351 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
352 | { | 352 | { |
353 | QMessageBox::information( this, "Wellenreiter II", | 353 | QMessageBox::information( this, "Wellenreiter II", |
354 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 354 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | 357 | ||
358 | // configure device | 358 | // configure device |
359 | ONetwork* net = ONetwork::instance(); | 359 | ONetwork* net = ONetwork::instance(); |
360 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 360 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
361 | 361 | ||
362 | // bring device UP | 362 | // bring device UP |
363 | iface->setUp( true ); | 363 | iface->setUp( true ); |
364 | if ( !iface->isUp() ) | 364 | if ( !iface->isUp() ) |
365 | { | 365 | { |
366 | QMessageBox::warning( this, "Wellenreiter II", | 366 | QMessageBox::warning( this, "Wellenreiter II", |
367 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 367 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
368 | return; | 368 | return; |
369 | } | 369 | } |
370 | 370 | ||
371 | // set monitor mode | 371 | // set monitor mode |
372 | bool usePrism = configwindow->usePrismHeader(); | 372 | bool usePrism = configwindow->usePrismHeader(); |
373 | 373 | ||
374 | switch ( cardtype ) | 374 | switch ( cardtype ) |
375 | { | 375 | { |
376 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 376 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
377 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 377 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
378 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 378 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
379 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 379 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
380 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 380 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
381 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 381 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
382 | default: assert( 0 ); // shouldn't reach this | 382 | default: assert( 0 ); // shouldn't reach this |
383 | } | 383 | } |
384 | 384 | ||
385 | // switch device into monitor mode | 385 | // switch device into monitor mode |
386 | if ( cardtype < DEVTYPE_FILE ) | 386 | if ( cardtype < DEVTYPE_FILE ) |
387 | { | 387 | { |
388 | if ( cardtype != DEVTYPE_MANUAL ) | 388 | if ( cardtype != DEVTYPE_MANUAL ) |
389 | iface->setMonitorMode( true ); | 389 | iface->setMonitorMode( true ); |
390 | if ( !iface->monitorMode() ) | 390 | if ( !iface->monitorMode() ) |
391 | { | 391 | { |
392 | QMessageBox::warning( this, "Wellenreiter II", | 392 | QMessageBox::warning( this, "Wellenreiter II", |
393 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); | 393 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | // open pcap and start sniffing | 398 | // open pcap and start sniffing |
399 | if ( cardtype != DEVTYPE_FILE ) | 399 | if ( cardtype != DEVTYPE_FILE ) |
400 | { | 400 | { |
401 | pcap->open( interface ); | 401 | pcap->open( interface ); |
402 | 402 | ||
403 | if ( configwindow->writeCaptureFile->isOn() ) | 403 | if ( configwindow->writeCaptureFile->isOn() ) |
404 | { | 404 | { |
405 | QString dumpname( configwindow->captureFileName->text() ); | 405 | QString dumpname( configwindow->captureFileName->text() ); |
406 | dumpname.append( '-' ); | 406 | dumpname.append( '-' ); |
407 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 407 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
408 | dumpname.append( ".wellenreiter" ); | 408 | dumpname.append( ".wellenreiter" ); |
409 | pcap->openDumpFile( dumpname ); | 409 | pcap->openDumpFile( dumpname ); |
410 | } | 410 | } |
411 | else | 411 | else |
412 | { | 412 | { |
413 | pcap->open( interface ); | 413 | pcap->open( interface ); |
414 | } | 414 | } |
415 | } | 415 | } |
416 | else | 416 | else |
417 | { | 417 | { |
418 | pcap->open( QFile( interface ) ); | 418 | pcap->open( QFile( interface ) ); |
419 | } | 419 | } |
420 | 420 | ||
421 | if ( !pcap->isOpen() ) | 421 | if ( !pcap->isOpen() ) |
422 | { | 422 | { |
423 | QMessageBox::warning( this, "Wellenreiter II", | 423 | QMessageBox::warning( this, "Wellenreiter II", |
424 | tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) )); | 424 | tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) )); |
425 | return; | 425 | return; |
426 | } | 426 | } |
427 | 427 | ||
428 | // set capturer to non-blocking mode | 428 | // set capturer to non-blocking mode |
429 | pcap->setBlocking( false ); | 429 | pcap->setBlocking( false ); |
430 | 430 | ||
431 | // start channel hopper | 431 | // start channel hopper |
432 | if ( cardtype != DEVTYPE_FILE ) | 432 | if ( cardtype != DEVTYPE_FILE ) |
433 | iface->setChannelHopping( 1000 ); //use interval from config window | 433 | iface->setChannelHopping( 1000 ); //use interval from config window |
434 | 434 | ||
435 | if ( cardtype != DEVTYPE_FILE ) | 435 | if ( cardtype != DEVTYPE_FILE ) |
436 | { | 436 | { |
437 | // connect socket notifier and start channel hopper | 437 | // connect socket notifier and start channel hopper |
438 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 438 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
439 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 439 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
440 | } | 440 | } |
441 | else | 441 | else |
442 | { | 442 | { |
443 | // start timer for reading packets | 443 | // start timer for reading packets |
444 | startTimer( 100 ); | 444 | startTimer( 100 ); |
445 | } | 445 | } |
446 | 446 | ||
447 | logwindow->log( "(i) Started Scanning." ); | 447 | logwindow->log( "(i) Started Scanning." ); |
448 | sniffing = true; | 448 | sniffing = true; |
449 | emit( startedSniffing() ); | 449 | emit( startedSniffing() ); |
450 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 450 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
451 | else | 451 | else |
452 | { | 452 | { |
453 | assert( parent() ); | 453 | assert( parent() ); |
454 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 454 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | 457 | ||
458 | 458 | ||
459 | void Wellenreiter::timerEvent( QTimerEvent* ) | 459 | void Wellenreiter::timerEvent( QTimerEvent* ) |
460 | { | 460 | { |
461 | qDebug( "Wellenreiter::timerEvent()" ); | 461 | qDebug( "Wellenreiter::timerEvent()" ); |
462 | OPacket* p = pcap->next(); | 462 | OPacket* p = pcap->next(); |
463 | if ( !p ) // no more packets available | 463 | if ( !p ) // no more packets available |
464 | { | 464 | { |
465 | stopClicked(); | 465 | stopClicked(); |
466 | } | 466 | } |
467 | else | 467 | else |
468 | { | 468 | { |
469 | receivePacket( p ); | 469 | receivePacket( p ); |
470 | delete p; | 470 | delete p; |
471 | } | 471 | } |
472 | } | 472 | } |
473 | 473 | ||
474 | 474 | ||
475 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) | 475 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) |
476 | { | 476 | { |
477 | #ifdef QWS | ||
477 | if ( action == "TouchSound" ) | 478 | if ( action == "TouchSound" ) |
478 | ODevice::inst()->touchSound(); | 479 | ODevice::inst()->touchSound(); |
479 | else if ( action == "AlarmSound" ) | 480 | else if ( action == "AlarmSound" ) |
480 | ODevice::inst()->alarmSound(); | 481 | ODevice::inst()->alarmSound(); |
481 | else if ( action == "KeySound" ) | 482 | else if ( action == "KeySound" ) |
482 | ODevice::inst()->keySound(); | 483 | ODevice::inst()->keySound(); |
483 | else if ( action == "LedOn" ) | 484 | else if ( action == "LedOn" ) |
484 | ODevice::inst()->setLedState( Led_Mail, Led_On ); | 485 | ODevice::inst()->setLedState( Led_Mail, Led_On ); |
485 | else if ( action == "LedOff" ) | 486 | else if ( action == "LedOff" ) |
486 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | 487 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); |
487 | else if ( action == "LogMessage" ) | 488 | else if ( action == "LogMessage" ) |
488 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 489 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
489 | else if ( action == "MessageBox" ) | 490 | else if ( action == "MessageBox" ) |
490 | QMessageBox::information( this, "Notification!", | 491 | QMessageBox::information( this, "Notification!", |
491 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 492 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
493 | #else | ||
494 | #warning Actions do not work with Qt/X11 yet | ||
495 | #endif | ||
492 | } | 496 | } |
493 | 497 | ||
494 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) | 498 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) |
495 | { | 499 | { |
500 | #ifdef QWS | ||
496 | if ( !iface ) | 501 | if ( !iface ) |
497 | { | 502 | { |
498 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); | 503 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); |
499 | return; | 504 | return; |
500 | } | 505 | } |
501 | 506 | ||
502 | if ( sniffing ) | 507 | if ( sniffing ) |
503 | { | 508 | { |
504 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); | 509 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); |
505 | return; | 510 | return; |
506 | } | 511 | } |
507 | 512 | ||
508 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", | 513 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", |
509 | (const char*) iface->name(), | 514 | (const char*) iface->name(), |
510 | (const char*) type, | 515 | (const char*) type, |
511 | (const char*) essid, | 516 | (const char*) essid, |
512 | channel, | 517 | channel, |
513 | (const char*) macaddr ); | 518 | (const char*) macaddr ); |
514 | 519 | ||
515 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 520 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
516 | int count = 3; | 521 | int count = 3; |
517 | qDebug("sending %d messages",count); | 522 | qDebug("sending %d messages",count); |
518 | msg << QString("count") << QString::number(count); | 523 | msg << QString("count") << QString::number(count); |
519 | qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); | 524 | qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); |
520 | msg << QString(iface->name()) << QString("Mode") << type; | 525 | msg << QString(iface->name()) << QString("Mode") << type; |
521 | qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); | 526 | qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); |
522 | msg << QString(iface->name()) << QString("ESSID") << essid; | 527 | msg << QString(iface->name()) << QString("ESSID") << essid; |
523 | qDebug("msg >%s< channel >%d<", iface->name(),channel); | 528 | qDebug("msg >%s< channel >%d<", iface->name(),channel); |
524 | msg << QString(iface->name()) << QString("Channel") << channel; | 529 | msg << QString(iface->name()) << QString("Channel") << channel; |
525 | // qDebug("msg >%s< mac >%s<", iface->name(),macaddr); | 530 | // qDebug("msg >%s< mac >%s<", iface->name(),macaddr); |
526 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; | 531 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; |
527 | 532 | #else | |
533 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); | ||
534 | #endif | ||
528 | 535 | ||
529 | } | 536 | } |
530 | 537 | ||