author | harlekin <harlekin> | 2002-07-21 20:58:37 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-21 20:58:37 (UTC) |
commit | 2fb3b8fdf9cb4e660e217ae563a1a49557864ca9 (patch) (side-by-side diff) | |
tree | 975738ed841eb216946191a12d5dd19585fd738d | |
parent | 99e354d845a38e5366d954c7f8f9c71b65ad0820 (diff) | |
download | opie-2fb3b8fdf9cb4e660e217ae563a1a49557864ca9.zip opie-2fb3b8fdf9cb4e660e217ae563a1a49557864ca9.tar.gz opie-2fb3b8fdf9cb4e660e217ae563a1a49557864ca9.tar.bz2 |
nicer connection state icons
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 18 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 1 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/rfcpopup.cpp | 4 |
4 files changed, 12 insertions, 13 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index ec05a95..f400ce6 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -49,66 +49,67 @@ #include <qpe/config.h> using namespace OpieTooth; BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { m_localDevice = new Manager( "hci0" ); connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); // not good since lib is async // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); connect( ListView2, SIGNAL( clicked( QListViewItem* )), this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), this, SLOT( deviceActive( const QString& , bool ) ) ); connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); // let hold be rightButtonClicked() QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); //Load all icons needed - m_offPix = Resource::loadPixmap( "editdelete" ); - m_onPix = Resource::loadPixmap( "installed" ); + m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); + m_onPix = Resource::loadPixmap( "opietooth/connected" ); + m_findPix = Resource::loadPixmap( "opietooth/find" ); QPalette pal = this->palette(); QColor col = pal.color( QPalette::Active, QColorGroup::Background ); pal.setColor( QPalette::Active, QColorGroup::Button, col ); pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); pal.setColor( QPalette::Normal, QColorGroup::Button, col ); pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); this->setPalette( pal ); setCaption( tr( "Bluetooth Manager" ) ); readConfig(); initGui(); //TESTING ListView2->setRootIsDecorated(true); BTDeviceItem *topLV2 = new BTDeviceItem( ListView2, RemoteDevice("xx:", "Siemens S45" ) ); topLV2->setPixmap( 1, m_onPix ); Services s1; s1.setServiceName( "Serial" ); s1.insertClassId(1, "BlueNic"); (void) new BTServiceItem( topLV2, s1 ); s1.setServiceName( "BlueNic" ); s1.insertClassId(2, "Obex"); (void) new BTServiceItem( topLV2, s1 ); writeToHciConfig(); // search conncetions addConnectedDevices(); m_iconLoader = new BTIconLoader(); readSavedDevices(); @@ -328,94 +329,87 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin /* * We got service sensitive PopupMenus in our factory * We will create one through the factory and will insert * our Separator + ShowInfo into the menu or create a new * one if the factory returns 0 * PopupMenu deletion is kind of weird. * If escaped( -1 ) or any of our items were chosen we'll * delete the PopupMenu otherwise it's the responsibility of * the PopupMenu to delete itself * */ else if ( ((BTListItem*)item)->type() == "service") { BTServiceItem* service = (BTServiceItem*)item; QMap<int, QString> list = service->services().classIdList(); QMap<int, QString>::Iterator it = list.begin(); QPopupMenu *popup =0l; if ( it != list.end() ) { qWarning("Searching id %d %s", it.key(), it.data().latin1() ); popup = m_popHelper.find( it.key() /*1*/, service->services(), (BTDeviceItem*)service->parent() ); }else { qWarning("Empty"); } if ( popup == 0l ) { qWarning("factory returned 0l"); popup = new QPopupMenu(); } int test1 = popup->insertItem( tr("Test1:"), 0); - int con = popup->insertItem( tr("connect"), 1); - int del = popup->insertItem( tr("delete"), 2); ret = popup->exec( point ); qWarning("returned from exec() "); - if ( ret == -1 ) + if ( ret == -1 ) { ; - else if ( ret == test1 ) + } else if ( ret == test1 ) { ; - else if ( ret == con ) - ; - else if ( ret == del ) { - // take item first? -zecke - delete item; } delete popup; } delete menu; } /** * Search and display avail. services for a device (on expand from device listing) * @param item the service item returned */ void BlueBase::addServicesToDevice( BTDeviceItem * item ) { qDebug("addServicesToDevice"); // row of mac adress text(3) RemoteDevice device = item->remoteDevice(); - m_deviceList.insert( item->mac() , item ); + m_deviceList.insert( item->mac() , item ); // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back m_localDevice->searchServices( device ); } /** * Overloaded. This one it the one that is connected to the foundServices signal * @param device the mac address of the remote device * @param servicesList the list with the service the device has. */ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { qDebug("fill services list"); QMap<QString,BTDeviceItem*>::Iterator it; BTDeviceItem* deviceItem = 0; // get the right devices which requested the search it = m_deviceList.find( device ); if( it == m_deviceList.end() ) return; deviceItem = it.data(); QValueList<OpieTooth::Services>::Iterator it2; BTServiceItem * serviceItem; if (!servicesList.isEmpty() ) { // add services QMap<int, QString> list; QMap<int, QString>::Iterator classIt; for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { serviceItem = new BTServiceItem( deviceItem , (*it2) ); list = (*it2).classIdList(); diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index a68a04b..0326daf 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -41,51 +41,52 @@ namespace OpieTooth { protected: private slots: void startScan(); private: bool find( const RemoteDevice& device ); void readConfig(); void writeConfig(); void readSavedDevices(); void writeSavedDevices(); void writeToHciConfig(); QString status()const; void initGui(); void setInfo(); PopupHelper m_popHelper; Manager *m_localDevice; QMap<QString,BTDeviceItem*> m_deviceList; void deviceActive( const RemoteDevice &device ); QString m_deviceName; QString m_defaultPasskey; bool m_useEncryption; bool m_enableAuthentification; bool m_enablePagescan; bool m_enableInquiryscan; QPixmap m_offPix; QPixmap m_onPix; + QPixmap m_findPix; BTIconLoader *m_iconLoader; private slots: void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); void addServicesToDevice( BTDeviceItem *item ); void addServicesToDevice( const QString& device, Services::ValueList ); void addConnectedDevices(); void addConnectedDevices( ConnectionState::ValueList ); void startServiceActionClicked( QListViewItem *item ); void startServiceActionHold( QListViewItem *, const QPoint &, int ); void deviceActive( const QString& mac, bool connected ); void applyConfigChanges(); }; } #endif diff --git a/noncore/net/opietooth/manager/pppdialog.h b/noncore/net/opietooth/manager/pppdialog.h index 6fdc90a..bb8b734 100644 --- a/noncore/net/opietooth/manager/pppdialog.h +++ b/noncore/net/opietooth/manager/pppdialog.h @@ -1,37 +1,37 @@ #ifndef PPPDIALOG_H #define PPPDIALOG_H #include <qdialog.h> #include <opie/oprocess.h> class QVBoxLayout; class QPushButton; class QMultiLineEdit; class QLineEdit; namespace OpieTooth { class PPPDialog : public QDialog { Q_OBJECT public: - PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0); + PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0, const QString& device = 0); ~PPPDialog(); private slots: void connectToDevice(); void fillOutPut( OProcess* pppDial, char* cha, int len ); protected: QVBoxLayout* layout; QLineEdit* cmdLine; QPushButton* connectButton; QMultiLineEdit* outPut; private: QString m_device; }; } #endif diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index 1b53f4b..cc87b6c 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp @@ -29,53 +29,57 @@ RfcCommPopup::RfcCommPopup() a->addTo( this ); connect( a, SIGNAL( activated() ) , this, SLOT( slotDisconnect() ) ); /* foo action */ a = new QAction( ); a->setText("Foo"); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotFoo() ) ); /* bar action */ a = new QAction( ); a->setText( "Bar" ); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotBar() ) ); }; RfcCommPopup::~RfcCommPopup() { /* delete m_con; delete m_dis; delete m_foo; delete m_bar; */ } void RfcCommPopup::slotConnect() { + qWarning("connect"); + + + PPPDialog pppDialog; pppDialog.showMaximized(); pppDialog.exec(); } void RfcCommPopup::slotDisconnect() { qWarning("slot disconnected"); } void RfcCommPopup::slotFoo() { qWarning("slotFoo"); } void RfcCommPopup::slotBar() { qWarning("slotBar"); }; |