summaryrefslogtreecommitdiff
authorzecke <zecke>2002-07-13 12:53:59 (UTC)
committer zecke <zecke>2002-07-13 12:53:59 (UTC)
commit8be0a8e108eaf8ff99301aa175298ddeb48eae67 (patch) (unidiff)
tree0fbe4d10476cb39d290fa4a3d6e8bdf76390c30c
parent6337e3836497ede8bb47aea5c7b65f4f8c08c4cd (diff)
downloadopie-8be0a8e108eaf8ff99301aa175298ddeb48eae67.zip
opie-8be0a8e108eaf8ff99301aa175298ddeb48eae67.tar.gz
opie-8be0a8e108eaf8ff99301aa175298ddeb48eae67.tar.bz2
Icon loader updates
and LIB updates
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp10
-rw-r--r--noncore/net/opietooth/manager/bticonloader.cpp61
-rw-r--r--noncore/net/opietooth/manager/bticonloader.h8
-rw-r--r--noncore/net/opietooth/manager/btserviceitem.cpp3
-rw-r--r--noncore/net/opietooth/manager/btserviceitem.h1
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp5
6 files changed, 52 insertions, 36 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 9cfeaa2..189001d 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -293,48 +293,49 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
293 293
294 menu->insertItem( tr("rescan sevices:"), 0); 294 menu->insertItem( tr("rescan sevices:"), 0);
295 menu->insertItem( tr("to group"), groups , 1); 295 menu->insertItem( tr("to group"), groups , 1);
296 menu->insertItem( tr("bound device"), 2); 296 menu->insertItem( tr("bound device"), 2);
297 menu->insertItem( tr("delete"), 3); 297 menu->insertItem( tr("delete"), 3);
298 298
299 ret = menu->exec( point , 0); 299 ret = menu->exec( point , 0);
300 300
301 switch(ret) { 301 switch(ret) {
302 case 0: 302 case 0:
303 break; 303 break;
304 case 1: 304 case 1:
305 break; 305 break;
306 case 2: 306 case 2:
307 // make connection 307 // make connection
308 break; 308 break;
309 case 3: 309 case 3:
310 // delete childs too 310 // delete childs too
311 delete item; 311 delete item;
312 break; 312 break;
313 } 313 }
314 delete groups; 314 delete groups;
315 315
316 } else if ( ((BTListItem*)item)->type() == "service") { 316 } else if ( ((BTListItem*)item)->type() == "service") {
317
317 menu->insertItem( tr("Test1:"), 0); 318 menu->insertItem( tr("Test1:"), 0);
318 menu->insertItem( tr("connect"), 1); 319 menu->insertItem( tr("connect"), 1);
319 menu->insertItem( tr("delete"), 2); 320 menu->insertItem( tr("delete"), 2);
320 321
321 ret = menu->exec( point , 0); 322 ret = menu->exec( point , 0);
322 323
323 switch(ret) { 324 switch(ret) {
324 case 0: 325 case 0:
325 break; 326 break;
326 case 1: 327 case 1:
327 break; 328 break;
328 case 2: 329 case 2:
329 // delete childs too 330 // delete childs too
330 delete item; 331 delete item;
331 break; 332 break;
332 } 333 }
333 } 334 }
334 delete menu; 335 delete menu;
335} 336}
336 337
337 /** 338 /**
338 * Search and display avail. services for a device (on expand from device listing) 339 * Search and display avail. services for a device (on expand from device listing)
339 * 340 *
340 */ 341 */
@@ -349,51 +350,58 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
349 350
350 351
351 /** 352 /**
352 * Overloaded. This one it the one that is connected to the foundServices signal 353 * Overloaded. This one it the one that is connected to the foundServices signal
353 * @param device the mac address of the remote device 354 * @param device the mac address of the remote device
354 * @param servicesList the list with the service the device has. 355 * @param servicesList the list with the service the device has.
355 */ 356 */
356 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 357 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
357 qDebug("fill services list"); 358 qDebug("fill services list");
358 359
359 QMap<QString,BTDeviceItem*>::Iterator it; 360 QMap<QString,BTDeviceItem*>::Iterator it;
360 BTDeviceItem* deviceItem = 0; 361 BTDeviceItem* deviceItem = 0;
361 362
362 // get the right devices which requested the search 363 // get the right devices which requested the search
363 it = m_deviceList.find( device ); 364 it = m_deviceList.find( device );
364 if( it == m_deviceList.end() ) 365 if( it == m_deviceList.end() )
365 return; 366 return;
366 deviceItem = it.data(); 367 deviceItem = it.data();
367 368
368 QValueList<OpieTooth::Services>::Iterator it2; 369 QValueList<OpieTooth::Services>::Iterator it2;
369 BTServiceItem * serviceItem; 370 BTServiceItem * serviceItem;
370 371
371 if (!servicesList.isEmpty() ) { 372 if (!servicesList.isEmpty() ) {
372 // add services 373 // add services
374 QMap<int, QString> list;
375 QMap<int, QString>::Iterator classIt;
373 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 376 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
374 serviceItem = new BTServiceItem( deviceItem , (*it2) ); 377 serviceItem = new BTServiceItem( deviceItem , (*it2) );
375 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( (*it2).classIdList() ) ); 378 list = (*it2).classIdList();
379 classIt = list.begin();
380 int classId;
381 if ( classIt != list.end() )
382 classId = classIt.key();
383 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
376 } 384 }
377 } else { 385 } else {
378 Services s1; 386 Services s1;
379 s1.setServiceName( tr("no serives found") ); 387 s1.setServiceName( tr("no serives found") );
380 serviceItem = new BTServiceItem( deviceItem, s1 ); 388 serviceItem = new BTServiceItem( deviceItem, s1 );
381 } 389 }
382 // now remove them from the list 390 // now remove them from the list
383 m_deviceList.remove( it ); 391 m_deviceList.remove( it );
384 } 392 }
385 393
386 394
387 /** 395 /**
388 * Add the existing connections (pairs) to the connections tab. 396 * Add the existing connections (pairs) to the connections tab.
389 * This one triggers the search 397 * This one triggers the search
390 */ 398 */
391 void BlueBase::addConnectedDevices() { 399 void BlueBase::addConnectedDevices() {
392 m_localDevice->searchConnections(); 400 m_localDevice->searchConnections();
393 } 401 }
394 402
395 403
396 void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 404 void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
397 QValueList<OpieTooth::ConnectionState>::Iterator it; 405 QValueList<OpieTooth::ConnectionState>::Iterator it;
398 BTConnectionItem * connectionItem; 406 BTConnectionItem * connectionItem;
399 407
diff --git a/noncore/net/opietooth/manager/bticonloader.cpp b/noncore/net/opietooth/manager/bticonloader.cpp
index 3fb0edd..f299117 100644
--- a/noncore/net/opietooth/manager/bticonloader.cpp
+++ b/noncore/net/opietooth/manager/bticonloader.cpp
@@ -1,77 +1,78 @@
1 1
2#include "bticonloader.h" 2#include "bticonloader.h"
3 3
4#include <qpixmap.h> 4#include <qpixmap.h>
5#include <qpe/resource.h> 5#include <qpe/resource.h>
6 6
7namespace OpieTooth { 7namespace OpieTooth {
8 8
9 9
10 BTIconLoader::BTIconLoader() { 10 BTIconLoader::BTIconLoader() {
11 11
12 // still need to find out real ids 12 // still need to find out real ids
13 deviceIcons.insert( "100" , "computer_16" ); 13 deviceIcons.insert( 100 , "computer_16" );
14 deviceIcons.insert( "101" , "phone_16" ); 14 deviceIcons.insert( 101 , "phone_16" );
15 deviceIcons.insert( "102" , "brain_16" ); 15 deviceIcons.insert( 102 , "brain_16" );
16 deviceIcons.insert( "103" , "conduit_16" ); 16 deviceIcons.insert( 103 , "conduit_16" );
17 17
18 18
19 serviceIcons.insert( "0x1105" , "obex_16" ); //OBEXObjectPush 19 serviceIcons.insert( 4357 , "obex_16" ); //OBEXObjectPush
20 serviceIcons.insert( "0x1106" , "obex_16" ); //OBEXFileTransfer 20 serviceIcons.insert( 4358 , "obex_16" ); //OBEXFileTransfer
21 serviceIcons.insert( "0x1111" , "print_16" ); //Fax 21 serviceIcons.insert( 4369 , "print_16" ); //Fax
22 serviceIcons.insert( "0x1101" , "serial_16" ); //SerialPort 22 serviceIcons.insert( 4353 , "serial_16" ); //SerialPort
23 serviceIcons.insert( "0x1104" , "sync_16" ); //IrMCSync 23 serviceIcons.insert( 4356 , "sync_16" ); //IrMCSync
24 serviceIcons.insert( "0x1107" , "sync_16" ); //IrMCSyncCommand 24 serviceIcons.insert( 4359 , "sync_16" ); //IrMCSyncCommand
25 serviceIcons.insert( "0x1102" , "network_16" ); //LANAccessUsingPPP 25 serviceIcons.insert( 4354 , "network_16" ); //LANAccessUsingPPP
26 serviceIcons.insert( "0x1103" , "network_16"); //DialupNetworking 26 serviceIcons.insert( 4355 , "network_16"); //DialupNetworking
27 serviceIcons.insert( "0x1108" , "phone_16"); // Headset 27 serviceIcons.insert( 4360 , "phone_16"); // Headset
28 serviceIcons.insert( "0x1112" , "audio_16"); //HeadsetAudioGateway 28 serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway
29 serviceIcons.insert( "0x1109" , "phone_16"); // CordlessTelephony 29 serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony
30 serviceIcons.insert( "0x110A" , "audio_16"); // AudioSource 30 serviceIcons.insert( 4362 , "audio_16"); // AudioSource
31 serviceIcons.insert( "0x110B" , "audio_16"); // AudioSink 31 serviceIcons.insert( 4363 , "audio_16"); // AudioSink
32 serviceIcons.insert( "0x1126" , "print_16" ); //HCR_Print 32 serviceIcons.insert( 4390 , "print_16" ); //HCR_Print
33 serviceIcons.insert( "0x1128" , "phone_16" ); //Common_ISDN_Access 33 serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access
34 34
35 serviceIcons.insert( "0x1201" , "network_16" ); //GenericNetworking 35 serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking
36 serviceIcons.insert( "0x1202" , "folder_16" ); //GenericFileTransfer 36 serviceIcons.insert( 4610 , "folder_16" ); //GenericFileTransfer
37 serviceIcons.insert( "0x1128" , "audio_16" ); //GenericAudio 37 serviceIcons.insert( 4392 , "audio_16" ); //GenericAudio
38 serviceIcons.insert( "0x1128" , "phone_16" ); //GenericTelephony 38 // serviceIcons.insert( 4392 , "phone_16" ); //GenericTelephony
39 // the above is duplicated? -zecke
39 40
40 //serviceIcons.insert( "106" , "link_16" ); 41 //serviceIcons.insert( "106" , "link_16" );
41 //serviceIcons.insert( "107" , "misc_16" ); 42 //serviceIcons.insert( "107" , "misc_16" );
42 } 43 }
43 44
44 BTIconLoader::~BTIconLoader() { 45 BTIconLoader::~BTIconLoader() {
45 } 46 }
46 47
47 QPixmap BTIconLoader::deviceIcon( const QString &deviceClass ) { 48 QPixmap BTIconLoader::deviceIcon( int deviceClass ) {
48 49
49 QString iconName; 50 QString iconName;
50 51
51 QMap<QString, QString>::Iterator it; 52 QMap<int, QString>::Iterator it;
52 53
53 it = deviceIcons.find( deviceClass ); 54 it = deviceIcons.find( deviceClass );
54 iconName = it.data(); 55 iconName = it.data();
55 56
56 if ( iconName.isEmpty() ) { 57 if ( iconName.isEmpty() ) {
57 iconName = "unknown_16"; 58 iconName = "unknown_16";
58 } 59 }
59 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); 60 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) );
60 } 61 }
61 62
62 QPixmap BTIconLoader::serviceIcon( const QString &serviceClass ) { 63 QPixmap BTIconLoader::serviceIcon( int serviceClass ) {
63 64
64 QString iconName; 65 QString iconName;
65 66
66 QMap<QString, QString>::Iterator it; 67 QMap<int, QString>::Iterator it;
67 68
68 it = deviceIcons.find( serviceClass ); 69 it = deviceIcons.find( serviceClass );
69 iconName = it.data(); 70 iconName = it.data();
70 71
71 if ( iconName.isEmpty() ) { 72 if ( iconName.isEmpty() ) {
72 iconName = "unknown_16"; 73 iconName = "unknown_16";
73 } 74 }
74 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); 75 return( Resource::loadPixmap( "opietooth/icons/" + iconName ) );
75 } 76 }
76 77
77} 78}
diff --git a/noncore/net/opietooth/manager/bticonloader.h b/noncore/net/opietooth/manager/bticonloader.h
index 1b48009..9951c4c 100644
--- a/noncore/net/opietooth/manager/bticonloader.h
+++ b/noncore/net/opietooth/manager/bticonloader.h
@@ -1,37 +1,37 @@
1#ifndef BTICONLOADER_H 1#ifndef BTICONLOADER_H
2#define BTICONLOADER_H 2#define BTICONLOADER_H
3 3
4#include <qpixmap.h> 4#include <qpixmap.h>
5#include <qmap.h> 5#include <qmap.h>
6 6
7namespace OpieTooth { 7namespace OpieTooth {
8 8
9 class BTIconLoader { 9 class BTIconLoader {
10 10
11 public: 11 public:
12 12
13 BTIconLoader(); 13 BTIconLoader();
14 ~BTIconLoader(); 14 ~BTIconLoader();
15 15
16 /** 16 /**
17 * Returns an icon depending on device class 17 * Returns an icon depending on device class
18 * @param deviceClass the device class id 18 * @param deviceClass the device class id
19 * @return the pixmap 19 * @return the pixmap
20 */ 20 */
21 QPixmap deviceIcon( const QString &deviceClass ); 21 QPixmap deviceIcon( int );
22 22
23 /** 23 /**
24 * Returns an icon depending on service id 24 * Returns an icon depending on service id
25 * @param serviceClass the service id 25 * @param serviceClass the service id
26 * @return the pixmap 26 * @return the pixmap
27 */ 27 */
28 QPixmap serviceIcon( const QString &serviceClass ); 28 QPixmap serviceIcon( int );
29 29
30 private: 30 private:
31 // first ist id, second is icon name 31 // first ist id, second is icon name
32 QMap<QString,QString> deviceIcons; 32 QMap<int,QString> deviceIcons;
33 QMap<QString,QString> serviceIcons; 33 QMap<int,QString> serviceIcons;
34 }; 34 };
35} 35}
36 36
37#endif 37#endif
diff --git a/noncore/net/opietooth/manager/btserviceitem.cpp b/noncore/net/opietooth/manager/btserviceitem.cpp
index 352e793..7db93c9 100644
--- a/noncore/net/opietooth/manager/btserviceitem.cpp
+++ b/noncore/net/opietooth/manager/btserviceitem.cpp
@@ -1,23 +1,26 @@
1 1
2#include <qobject.h> 2#include <qobject.h>
3#include "btserviceitem.h" 3#include "btserviceitem.h"
4 4
5using namespace OpieTooth; 5using namespace OpieTooth;
6 6
7BTServiceItem::BTServiceItem( QListViewItem* item, const Services& serv ) 7BTServiceItem::BTServiceItem( QListViewItem* item, const Services& serv )
8 : BTListItem( item ) { 8 : BTListItem( item ) {
9 m_service = serv; 9 m_service = serv;
10 setText(0, QObject::tr(serv.serviceName() ) ); 10 setText(0, QObject::tr(serv.serviceName() ) );
11} 11}
12BTServiceItem::~BTServiceItem() { 12BTServiceItem::~BTServiceItem() {
13 13
14} 14}
15QString BTServiceItem::type() const { 15QString BTServiceItem::type() const {
16 return QString::fromLatin1("service"); 16 return QString::fromLatin1("service");
17} 17}
18int BTServiceItem::typeId() const { 18int BTServiceItem::typeId() const {
19 return Service; 19 return Service;
20} 20}
21Services BTServiceItem::services() const { 21Services BTServiceItem::services() const {
22 return m_service; 22 return m_service;
23} 23}
24int BTServiceItem::serviceId() const {
25 return m_service.recHandle();
26};
diff --git a/noncore/net/opietooth/manager/btserviceitem.h b/noncore/net/opietooth/manager/btserviceitem.h
index 6dbd8f1..625a5f7 100644
--- a/noncore/net/opietooth/manager/btserviceitem.h
+++ b/noncore/net/opietooth/manager/btserviceitem.h
@@ -1,26 +1,27 @@
1 1
2 2
3#ifndef OPIE_TOOTH_BT_SERVICE_ITEM 3#ifndef OPIE_TOOTH_BT_SERVICE_ITEM
4#define OPIE_TOOTH_BT_SERVICE_ITEM 4#define OPIE_TOOTH_BT_SERVICE_ITEM
5 5
6#include <services.h> 6#include <services.h>
7 7
8#include "btlistitem.h" 8#include "btlistitem.h"
9 9
10namespace OpieTooth { 10namespace OpieTooth {
11 11
12 class BTServiceItem : public BTListItem { 12 class BTServiceItem : public BTListItem {
13 public: 13 public:
14 BTServiceItem( QListViewItem* item, const Services& ); 14 BTServiceItem( QListViewItem* item, const Services& );
15 ~BTServiceItem(); 15 ~BTServiceItem();
16 QString type() const; 16 QString type() const;
17 int typeId() const; 17 int typeId() const;
18 Services services() const; 18 Services services() const;
19 int serviceId() const;
19 private: 20 private:
20 Services m_service; 21 Services m_service;
21 22
22 }; 23 };
23}; 24};
24 25
25 26
26#endif 27#endif
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp
index 43a0f62..f462368 100644
--- a/noncore/net/opietooth/manager/stdpopups.cpp
+++ b/noncore/net/opietooth/manager/stdpopups.cpp
@@ -1,10 +1,13 @@
1 1
2//#include "rfccompopup.h"
3
2#include "stdpopups.h" 4#include "stdpopups.h"
3 5
4 6
5QPopupMenu* newRfcComPopup( const OpieTooth::Services&, QListViewItem* ) { 7QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, QListViewItem* item ) {
8 // return OpieTooth::RfcComPopup( servive, item );
6 return 0l; 9 return 0l;
7} 10}
8QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ) { 11QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ) {
9 return 0l; 12 return 0l;
10} 13}