summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-20 23:36:42 (UTC)
committer harlekin <harlekin>2002-06-20 23:36:42 (UTC)
commit56649b4725b2e98d786d06f83d4b3281ea1090fb (patch) (unidiff)
treee490f77a30e9846fd4b65cdc214227cca71f7216
parent9a3833c28cf7488957abc9e67094ba8ea60f92cd (diff)
downloadopie-56649b4725b2e98d786d06f83d4b3281ea1090fb.zip
opie-56649b4725b2e98d786d06f83d4b3281ea1090fb.tar.gz
opie-56649b4725b2e98d786d06f83d4b3281ea1090fb.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 6caca70..5d742b7 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -107,256 +107,264 @@ namespace OpieTooth {
107 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); 107 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 );
108 108
109 } 109 }
110 110
111 /** 111 /**
112 * Writes all options to the config file 112 * Writes all options to the config file
113 */ 113 */
114 void BlueBase::writeConfig() { 114 void BlueBase::writeConfig() {
115 115
116 116
117 Config cfg( "bluetoothmanager" ); 117 Config cfg( "bluetoothmanager" );
118 cfg.setGroup( "bluezsettings" ); 118 cfg.setGroup( "bluezsettings" );
119 119
120 cfg.writeEntry( "name" , deviceName ); 120 cfg.writeEntry( "name" , deviceName );
121 cfg.writeEntryCrypt( "passkey" , defaultPasskey ); 121 cfg.writeEntryCrypt( "passkey" , defaultPasskey );
122 cfg.writeEntry( "useEncryption" , useEncryption ); 122 cfg.writeEntry( "useEncryption" , useEncryption );
123 cfg.writeEntry( "enableAuthentification" , enableAuthentification ); 123 cfg.writeEntry( "enableAuthentification" , enableAuthentification );
124 cfg.writeEntry( "enablePagescan" , enablePagescan ); 124 cfg.writeEntry( "enablePagescan" , enablePagescan );
125 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); 125 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan );
126} 126}
127 127
128 128
129 /** 129 /**
130 * Read the list of allready known devices 130 * Read the list of allready known devices
131 * 131 *
132 */ 132 */
133 void BlueBase::readSavedDevices() { 133 void BlueBase::readSavedDevices() {
134 134
135 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; 135 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>;
136 136
137 Config deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); 137 Config deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File );
138 138
139 139
140 // RemoteDevice *currentDevice = RemoteDevice( , ); 140 // RemoteDevice *currentDevice = RemoteDevice( , );
141 //loadedDevices->append( currentDevice ); 141 //loadedDevices->append( currentDevice );
142 142
143 addSearchedDevices( *loadedDevices ); 143 addSearchedDevices( *loadedDevices );
144 } 144 }
145 145
146 /** 146 /**
147 * Write the list of allready known devices 147 * Write the list of allready known devices
148 * 148 *
149 */ 149 */
150 void BlueBase::writeSavedDevices() { 150 void BlueBase::writeSavedDevices() {
151 151
152 QListViewItemIterator it( ListView2 ); 152 QListViewItemIterator it( ListView2 );
153 153
154 for ( ; it.current(); ++it ) { 154 for ( ; it.current(); ++it ) {
155 155
156 // seperate config file for each device, to store more information in future. 156 // seperate config file for each device, to store more information in future.
157 157
158 Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(3)) + ".conf", Config::File ); 158 Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(3)) + ".conf", Config::File );
159 conf.setGroup( "Info" ); 159 conf.setGroup( "Info" );
160 conf.writeEntry( "name", it.current()->text(0) ); 160 conf.writeEntry( "name", it.current()->text(0) );
161 } 161 }
162 } 162 }
163 163
164 164
165 /** 165 /**
166 * Set up the gui 166 * Set up the gui
167 */ 167 */
168 void BlueBase::initGui() { 168 void BlueBase::initGui() {
169 169
170 StatusLabel->setText( getStatus() ); // maybe move it to getStatus() 170 StatusLabel->setText( getStatus() ); // maybe move it to getStatus()
171 171
172 cryptCheckBox->setChecked( useEncryption ); 172 cryptCheckBox->setChecked( useEncryption );
173 authCheckBox->setChecked( enableAuthentification ); 173 authCheckBox->setChecked( enableAuthentification );
174 pagescanCheckBox->setChecked( enablePagescan ); 174 pagescanCheckBox->setChecked( enablePagescan );
175 inquiryscanCheckBox->setChecked( enableInquiryscan ); 175 inquiryscanCheckBox->setChecked( enableInquiryscan );
176 deviceNameLine->setText( deviceName ); 176 deviceNameLine->setText( deviceName );
177 passkeyLine->setText( defaultPasskey ); 177 passkeyLine->setText( defaultPasskey );
178 // set info tab 178 // set info tab
179 setInfo(); 179 setInfo();
180 } 180 }
181 181
182 182
183 /** 183 /**
184 * Get the status informations and returns it 184 * Get the status informations and returns it
185 * @return QString the status informations gathered 185 * @return QString the status informations gathered
186 */ 186 */
187 QString BlueBase::getStatus(){ 187 QString BlueBase::getStatus(){
188 188
189 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 189 QString infoString = tr( "<b>Device name : </b> Ipaq" );
190 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 190 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
191 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 191 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
192 192
193 return (infoString); 193 return (infoString);
194 194
195 } 195 }
196 196
197 197
198 /** 198 /**
199 * Read the current values from the gui and invoke writeConfig() 199 * Read the current values from the gui and invoke writeConfig()
200 */ 200 */
201 void BlueBase::applyConfigChanges() { 201 void BlueBase::applyConfigChanges() {
202 202
203 deviceName = deviceNameLine->text(); 203 deviceName = deviceNameLine->text();
204 defaultPasskey = passkeyLine->text(); 204 defaultPasskey = passkeyLine->text();
205 useEncryption = cryptCheckBox->isChecked(); 205 useEncryption = cryptCheckBox->isChecked();
206 enableAuthentification = authCheckBox->isChecked(); 206 enableAuthentification = authCheckBox->isChecked();
207 enablePagescan = pagescanCheckBox->isChecked(); 207 enablePagescan = pagescanCheckBox->isChecked();
208 enableInquiryscan = inquiryscanCheckBox->isChecked(); 208 enableInquiryscan = inquiryscanCheckBox->isChecked();
209 209
210 writeConfig(); 210 writeConfig();
211 211
212 QMessageBox* box = new QMessageBox( this, "Test" ); 212 QMessageBox* box = new QMessageBox( this, "Test" );
213 box->setText( tr( "Changes applied" ) ); 213 box->setText( tr( "Changes applied" ) );
214 box->show(); 214 box->show();
215 215
216 // falls nötig hcid killhupen - die funktionalität adden 216 // falls nötig hcid killhupen - die funktionalität adden
217 } 217 }
218 218
219 219
220 /** 220 /**
221 * Add fresh found devices from scan dialog to the listing 221 * Add fresh found devices from scan dialog to the listing
222 * 222 *
223 */ 223 */
224 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { 224 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) {
225 225
226 QListViewItem * deviceItem; 226 QListViewItem * deviceItem;
227 227
228 QListIterator<RemoteDevice> it( newDevices ); 228 QListIterator<RemoteDevice> it( newDevices );
229 229
230 for( ; it.current() ; ++it ) { 230 for( ; it.current() ; ++it ) {
231 231
232 232
233 RemoteDevice *dev = it.current(); 233 RemoteDevice *dev = it.current();
234 deviceItem = new QListViewItem( ListView2 , dev->name() ); 234 deviceItem = new QListViewItem( ListView2 , dev->name() );
235 deviceItem->setExpandable ( true );
235 236
236 if ( deviceActive( dev ) ) { 237 if ( deviceActive( dev ) ) {
237 deviceItem->setPixmap( 1 , onPix ); 238 deviceItem->setPixmap( 1 , onPix );
238 } else { 239 } else {
239 deviceItem->setPixmap( 1, offPix ); 240 deviceItem->setPixmap( 1, offPix );
240 } 241 }
241 242
242 deviceItem->setText( 3, dev->mac() ); 243 deviceItem->setText( 3, dev->mac() );
243 244
244 // ggf auch hier? 245 // ggf auch hier?
245 addServicesToDevice( deviceItem ); 246 addServicesToDevice( deviceItem );
246 } 247 }
247 } 248 }
248 249
249 250
250 /** 251 /**
251 * Action that is toggled on entrys on click 252 * Action that is toggled on entrys on click
252 */ 253 */
253 void BlueBase::startServiceActionClicked( QListViewItem *item ) { 254 void BlueBase::startServiceActionClicked( QListViewItem *item ) {
254 255
255 256
256 } 257 }
257 258
258 /** 259 /**
259 * Action that are toggled on hold (mostly QPopups i guess) 260 * Action that are toggled on hold (mostly QPopups i guess)
260 */ 261 */
261 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { 262 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) {
262 263
263 264
264 } 265 }
265 266
266 /** 267 /**
267 * Search and display avail. services for a device (on expand from device listing) 268 * Search and display avail. services for a device (on expand from device listing)
268 * 269 *
269 */ 270 */
270 void BlueBase::addServicesToDevice( QListViewItem * item ) { 271 void BlueBase::addServicesToDevice( QListViewItem * item ) {
271 272
272 qDebug("addServicesToDevice"); 273 qDebug("addServicesToDevice");
273 // row of mac adress 274 // row of mac adress
274 RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) ); 275 RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) );
275 276
276 deviceList.insert( item->text(3) , item ); 277 deviceList.insert( item->text(3) , item );
277 278
278 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 279 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
279 localDevice->searchServices( *device ); 280 localDevice->searchServices( *device );
280 281
281 // delete 282 // delete
282 } 283 }
283 284
284 285
285 /** 286 /**
286 * Overloaded. This one it the one that is connected to the foundServices signal 287 * Overloaded. This one it the one that is connected to the foundServices signal
287 * @param device the mac address of the remote device 288 * @param device the mac address of the remote device
288 * @param servicesList the list with the service the device has. 289 * @param servicesList the list with the service the device has.
289 */ 290 */
290 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 291 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
291 292
292 qDebug("fill services list"); 293 qDebug("fill services list");
293 294
294 295
295 QMap<QString,QListViewItem*>::Iterator it; 296 QMap<QString,QListViewItem*>::Iterator it;
296 297
297 QListViewItem* deviceItem; 298 QListViewItem* deviceItem;
298 299
299 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 300 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
300 if ( it.key() == device ) { 301 if ( it.key() == device ) {
301 deviceItem = it.data(); 302 deviceItem = it.data();
302 } 303 }
303 } 304 }
304 305
305 QValueList<OpieTooth::Services>::Iterator it2; 306 QValueList<OpieTooth::Services>::Iterator it2;
306 307
307 308
308 309
309 QListViewItem * serviceItem; 310 QListViewItem * serviceItem;
310 311
311 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 312 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
312 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); 313 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() );
313 } 314 }
314 } 315 }
315 316
316 317
317 /** 318 /**
318 * Add the existing connections (pairs) to the connections tab. 319 * Add the existing connections (pairs) to the connections tab.
319 * 320 *
320 */ 321 */
321 void BlueBase::addConnectedDevices() { 322 void BlueBase::addConnectedDevices() {
322 323
323 324
325 //mac address
326
324 } 327 }
325 328
326 /** 329 /**
327 * Find out if a device can currently be reached 330 * Find out if a device can currently be reached
328 */ 331 */
329 bool BlueBase::deviceActive( RemoteDevice *device ) { 332 bool BlueBase::deviceActive( RemoteDevice *device ) {
333
334 // search by mac
335 //
336 localDevice->isAvailable( device->mac() );
337
330 return true; 338 return true;
331 } 339 }
332 340
333 341
334 /** 342 /**
335 * Open the "scan for devices" dialog 343 * Open the "scan for devices" dialog
336 */ 344 */
337 void BlueBase::startScan() { 345 void BlueBase::startScan() {
338 346
339 ScanDialog *scan = new ScanDialog( this, "", true); 347 ScanDialog *scan = new ScanDialog( this, "", true);
340 QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ), 348 QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ),
341 this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) ); 349 this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) );
342 350
343 scan->showMaximized(); 351 scan->showMaximized();
344 } 352 }
345 353
346 354
347 /** 355 /**
348 * Set the informations about the local device in information Tab 356 * Set the informations about the local device in information Tab
349 */ 357 */
350 void BlueBase::setInfo() { 358 void BlueBase::setInfo() {
351 StatusLabel->setText( getStatus() ); 359 StatusLabel->setText( getStatus() );
352 } 360 }
353 361
354 /** 362 /**
355 * Decontructor 363 * Decontructor
356 */ 364 */
357 BlueBase::~BlueBase() { 365 BlueBase::~BlueBase() {
358 writeSavedDevices(); 366 writeSavedDevices();
359 } 367 }
360 368
361} 369}
362 370