author | zecke <zecke> | 2004-05-18 20:57:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-18 20:57:35 (UTC) |
commit | 59c6451a16405f19b1d4bc97906bd5778b5b0cd3 (patch) (unidiff) | |
tree | 325a5e496a03304a99f224fa258b0cd2dabf2db9 | |
parent | eb5a5432d79083fdfefb7b9b0c0907abe8807a52 (diff) | |
download | opie-59c6451a16405f19b1d4bc97906bd5778b5b0cd3.zip opie-59c6451a16405f19b1d4bc97906bd5778b5b0cd3.tar.gz opie-59c6451a16405f19b1d4bc97906bd5778b5b0cd3.tar.bz2 |
Aye no (const char*)str where type(str) == QString please...
Now I can even scan non latin access points and don't need to reset stdout/stderr
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 9e8aa72..9e907d8 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -36,194 +36,194 @@ using namespace Opie::Net; | |||
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | 37 | ||
38 | /* STD */ | 38 | /* STD */ |
39 | #include <assert.h> | 39 | #include <assert.h> |
40 | 40 | ||
41 | const int col_type = 0; | 41 | const int col_type = 0; |
42 | const int col_essid = 0; | 42 | const int col_essid = 0; |
43 | const int col_sig = 1; | 43 | const int col_sig = 1; |
44 | const int col_ap = 2; | 44 | const int col_ap = 2; |
45 | const int col_channel = 3; | 45 | const int col_channel = 3; |
46 | const int col_wep = 4; | 46 | const int col_wep = 4; |
47 | const int col_traffic = 5; | 47 | const int col_traffic = 5; |
48 | const int col_ip = 6; | 48 | const int col_ip = 6; |
49 | const int col_manuf = 7; | 49 | const int col_manuf = 7; |
50 | const int col_firstseen = 8; | 50 | const int col_firstseen = 8; |
51 | const int col_lastseen = 9; | 51 | const int col_lastseen = 9; |
52 | const int col_location = 10; | 52 | const int col_location = 10; |
53 | 53 | ||
54 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 54 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
55 | :OListView( parent, name ) | 55 | :OListView( parent, name ) |
56 | { | 56 | { |
57 | setFrameShape( QListView::StyledPanel ); | 57 | setFrameShape( QListView::StyledPanel ); |
58 | setFrameShadow( QListView::Sunken ); | 58 | setFrameShadow( QListView::Sunken ); |
59 | 59 | ||
60 | addColumn( tr( "Net/Station" ) ); | 60 | addColumn( tr( "Net/Station" ) ); |
61 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); | 61 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); |
62 | addColumn( tr( "#" ) ); | 62 | addColumn( tr( "#" ) ); |
63 | setColumnAlignment( col_sig, AlignCenter ); | 63 | setColumnAlignment( col_sig, AlignCenter ); |
64 | addColumn( tr( "MAC" ) ); | 64 | addColumn( tr( "MAC" ) ); |
65 | setColumnAlignment( col_ap, AlignCenter ); | 65 | setColumnAlignment( col_ap, AlignCenter ); |
66 | addColumn( tr( "Chn" ) ); | 66 | addColumn( tr( "Chn" ) ); |
67 | setColumnAlignment( col_channel, AlignCenter ); | 67 | setColumnAlignment( col_channel, AlignCenter ); |
68 | addColumn( tr( "W" ) ); | 68 | addColumn( tr( "W" ) ); |
69 | setColumnAlignment( col_wep, AlignCenter ); | 69 | setColumnAlignment( col_wep, AlignCenter ); |
70 | addColumn( tr( "T" ) ); | 70 | addColumn( tr( "T" ) ); |
71 | setColumnAlignment( col_traffic, AlignCenter ); | 71 | setColumnAlignment( col_traffic, AlignCenter ); |
72 | addColumn( tr( "IP" ) ); | 72 | addColumn( tr( "IP" ) ); |
73 | setColumnAlignment( col_ip, AlignCenter ); | 73 | setColumnAlignment( col_ip, AlignCenter ); |
74 | addColumn( tr( "Manufacturer" ) ); | 74 | addColumn( tr( "Manufacturer" ) ); |
75 | setColumnAlignment( col_manuf, AlignCenter ); | 75 | setColumnAlignment( col_manuf, AlignCenter ); |
76 | addColumn( tr( "First Seen" ) ); | 76 | addColumn( tr( "First Seen" ) ); |
77 | setColumnAlignment( col_firstseen, AlignCenter ); | 77 | setColumnAlignment( col_firstseen, AlignCenter ); |
78 | addColumn( tr( "Last Seen" ) ); | 78 | addColumn( tr( "Last Seen" ) ); |
79 | setColumnAlignment( col_lastseen, AlignCenter ); | 79 | setColumnAlignment( col_lastseen, AlignCenter ); |
80 | addColumn( tr( "Location" ) ); | 80 | addColumn( tr( "Location" ) ); |
81 | setColumnAlignment( col_location, AlignCenter ); | 81 | setColumnAlignment( col_location, AlignCenter ); |
82 | setRootIsDecorated( true ); | 82 | setRootIsDecorated( true ); |
83 | setAllColumnsShowFocus( true ); | 83 | setAllColumnsShowFocus( true ); |
84 | 84 | ||
85 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | 85 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
86 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | 86 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
87 | 87 | ||
88 | #ifdef QWS | 88 | #ifdef QWS |
89 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 89 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | }; | 92 | }; |
93 | 93 | ||
94 | 94 | ||
95 | MScanListView::~MScanListView() | 95 | MScanListView::~MScanListView() |
96 | { | 96 | { |
97 | }; | 97 | }; |
98 | 98 | ||
99 | 99 | ||
100 | OListViewItem* MScanListView::childFactory() | 100 | OListViewItem* MScanListView::childFactory() |
101 | { | 101 | { |
102 | return new MScanListItem( this ); | 102 | return new MScanListItem( this ); |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | void MScanListView::serializeTo( QDataStream& s) const | 106 | void MScanListView::serializeTo( QDataStream& s) const |
107 | { | 107 | { |
108 | odebug << "serializing MScanListView" << oendl; | 108 | odebug << "serializing MScanListView" << oendl; |
109 | OListView::serializeTo( s ); | 109 | OListView::serializeTo( s ); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | void MScanListView::serializeFrom( QDataStream& s) | 113 | void MScanListView::serializeFrom( QDataStream& s) |
114 | { | 114 | { |
115 | odebug << "serializing MScanListView" << oendl; | 115 | odebug << "serializing MScanListView" << oendl; |
116 | OListView::serializeFrom( s ); | 116 | OListView::serializeFrom( s ); |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | void MScanListView::addNewItem( const QString& type, | 120 | void MScanListView::addNewItem( const QString& type, |
121 | const QString& essid, | 121 | const QString& essid, |
122 | const OMacAddress& mac, | 122 | const OMacAddress& mac, |
123 | bool wep, | 123 | bool wep, |
124 | int channel, | 124 | int channel, |
125 | int signal, | 125 | int signal, |
126 | const GpsLocation& loc, | 126 | const GpsLocation& loc, |
127 | bool probe ) | 127 | bool probe ) |
128 | { | 128 | { |
129 | QString macaddr = mac.toString(true); | 129 | QString macaddr = mac.toString(true); |
130 | 130 | ||
131 | #ifdef DEBUG | 131 | #ifdef DEBUG |
132 | odebug << "MScanList::addNewItem( " << (const char*) type << " / " | 132 | odebug << "MScanList::addNewItem( " << type << " / " |
133 | << (const char*) essid << " / " << (const char*) macaddr | 133 | << essid << " / " << macaddr |
134 | << " [" << channel << "]" << oendl; | 134 | << " [" << channel << "]" << oendl; |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | // search, if we already have seen this net | 137 | // search, if we already have seen this net |
138 | 138 | ||
139 | QString s; | 139 | QString s; |
140 | MScanListItem* network; | 140 | MScanListItem* network; |
141 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 141 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
142 | 142 | ||
143 | while ( item && ( item->text( col_essid ) != essid ) ) | 143 | while ( item && ( item->text( col_essid ) != essid ) ) |
144 | { | 144 | { |
145 | #ifdef DEBUG | 145 | #ifdef DEBUG |
146 | odebug << "itemtext: " << item->text( col_essid ) << "" << oendl; | 146 | odebug << "itemtext: " << item->text( col_essid ) << "" << oendl; |
147 | #endif | 147 | #endif |
148 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 148 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
149 | } | 149 | } |
150 | if ( item ) | 150 | if ( item ) |
151 | { | 151 | { |
152 | // we have already seen this net, check all childs if MAC exists | 152 | // we have already seen this net, check all childs if MAC exists |
153 | 153 | ||
154 | network = item; | 154 | network = item; |
155 | 155 | ||
156 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 156 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
157 | assert( item ); // this shouldn't fail | 157 | assert( item ); // this shouldn't fail |
158 | 158 | ||
159 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 159 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
160 | { | 160 | { |
161 | #ifdef DEBUG | 161 | #ifdef DEBUG |
162 | odebug << "subitemtext: " << item->text( col_ap ) << "" << oendl; | 162 | odebug << "subitemtext: " << item->text( col_ap ) << "" << oendl; |
163 | #endif | 163 | #endif |
164 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 164 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
165 | } | 165 | } |
166 | 166 | ||
167 | if ( item ) | 167 | if ( item ) |
168 | { | 168 | { |
169 | // we have already seen this item, it's a dupe | 169 | // we have already seen this item, it's a dupe |
170 | #ifdef DEBUG | 170 | #ifdef DEBUG |
171 | odebug << "" << macaddr << " is a dupe - ignoring..." << oendl; | 171 | odebug << "" << macaddr << " is a dupe - ignoring..." << oendl; |
172 | #endif | 172 | #endif |
173 | item->receivedBeacon(); | 173 | item->receivedBeacon(); |
174 | return; | 174 | return; |
175 | } | 175 | } |
176 | } | 176 | } |
177 | else | 177 | else |
178 | { | 178 | { |
179 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 179 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
180 | MLogWindow::logwindow()->log( s ); | 180 | MLogWindow::logwindow()->log( s ); |
181 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); | 181 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | // insert new station as child from network | 185 | // insert new station as child from network |
186 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 186 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
187 | 187 | ||
188 | #ifdef DEBUG | 188 | #ifdef DEBUG |
189 | odebug << "inserting new station " << macaddr << "" << oendl; | 189 | odebug << "inserting new station " << macaddr << "" << oendl; |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 192 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
193 | station->setManufacturer( mac.manufacturer() ); | 193 | station->setManufacturer( mac.manufacturer() ); |
194 | station->setLocation( loc.dmsPosition() ); | 194 | station->setLocation( loc.dmsPosition() ); |
195 | 195 | ||
196 | if ( type == "managed" ) | 196 | if ( type == "managed" ) |
197 | { | 197 | { |
198 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 198 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
199 | } | 199 | } |
200 | else | 200 | else |
201 | { | 201 | { |
202 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); | 202 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); |
203 | } | 203 | } |
204 | MLogWindow::logwindow()->log( s ); | 204 | MLogWindow::logwindow()->log( s ); |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) | 208 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) |
209 | { | 209 | { |
210 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 210 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
211 | 211 | ||
212 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) | 212 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) |
213 | { | 213 | { |
214 | #ifdef DEBUG | 214 | #ifdef DEBUG |
215 | odebug << "subitemtext: " << subitem->text( col_ap ) << "" << oendl; | 215 | odebug << "subitemtext: " << subitem->text( col_ap ) << "" << oendl; |
216 | #endif | 216 | #endif |
217 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 217 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
218 | } | 218 | } |
219 | 219 | ||
220 | if ( subitem ) | 220 | if ( subitem ) |
221 | { | 221 | { |
222 | // we have already seen this item, it's a dupe | 222 | // we have already seen this item, it's a dupe |
223 | #ifdef DEBUG | 223 | #ifdef DEBUG |
224 | odebug << "" << addr.toString(true) << " is a dupe - ignoring..." << oendl; | 224 | odebug << "" << addr.toString(true) << " is a dupe - ignoring..." << oendl; |
225 | #endif | 225 | #endif |
226 | subitem->receivedBeacon(); //FIXME: sent data bit | 226 | subitem->receivedBeacon(); //FIXME: sent data bit |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | 229 | ||