summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-23 16:18:52 (UTC)
committer harlekin <harlekin>2002-06-23 16:18:52 (UTC)
commit5cf97227889d00e366782d466eef5eafe1d73e5c (patch) (side-by-side diff)
tree3a89e3db99b1ec45f69ec4bf6688fdb45eeab9a7
parent6382b7352205a71557bd87b4f43d7f19f7f3330e (diff)
downloadopie-5cf97227889d00e366782d466eef5eafe1d73e5c.zip
opie-5cf97227889d00e366782d466eef5eafe1d73e5c.tar.gz
opie-5cf97227889d00e366782d466eef5eafe1d73e5c.tar.bz2
little update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp69
-rw-r--r--noncore/net/opietooth/manager/bluebase.h2
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp3
3 files changed, 66 insertions, 8 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index cc51405..772dbd1 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -22,81 +22,85 @@
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qtabwidget.h>
#include <qscrollview.h>
#include <qvbox.h>
#include <qmessagebox.h>
#include <qapplication.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qdir.h>
+#include <qpopupmenu.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <remotedevice.h>
namespace OpieTooth {
BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
: BluetoothBase( parent, name, fl ) {
localDevice = new Manager( "hci0" );
connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
- connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
- this, SLOT( addServicesToDevice( QListViewItem * ) ) );
+ // 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( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
//Load all icons needed
-
offPix = Resource::loadPixmap( "editdelete" );
onPix = Resource::loadPixmap( "installed" );
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);
QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" );
topLV2->setPixmap( 1, onPix );
+ topLV2->setText(4, "device" );
(void) new QListViewItem( topLV2, "Serial" );
(void) new QListViewItem( topLV2, "BlueNiC" );
}
/**
* Reads all options from the config file
*/
void BlueBase::readConfig() {
Config cfg( "bluetoothmanager" );
cfg.setGroup( "bluezsettings" );
deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
@@ -238,99 +242,150 @@ namespace OpieTooth {
QListIterator<RemoteDevice> it( newDevices );
for( ; it.current() ; ++it ) {
RemoteDevice *dev = it.current();
deviceItem = new QListViewItem( ListView2 , dev->name() );
deviceItem->setExpandable ( true );
if ( deviceActive( dev ) ) {
deviceItem->setPixmap( 1 , onPix );
} else {
deviceItem->setPixmap( 1, offPix );
}
deviceItem->setText( 3, dev->mac() );
+ // what kind of entry is it.
+ deviceItem->setText( 4, "device");
// ggf auch hier?
addServicesToDevice( deviceItem );
}
}
/**
* Action that is toggled on entrys on click
*/
void BlueBase::startServiceActionClicked( QListViewItem *item ) {
}
/**
* Action that are toggled on hold (mostly QPopups i guess)
*/
void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) {
+ QPopupMenu *menu = new QPopupMenu();
+ QPopupMenu *groups = new QPopupMenu();
+ int ret=0;
+
+ //QSize s = menu->sizeHint ( );
+
+ if ( item->text(4) == "device") {
+ menu->insertItem( tr("rescan sevices:"), 0);
+ menu->insertItem( tr("to group"), groups , 1);
+ menu->insertItem( tr("delete"), 2);
+ } else if ( item->text(4) == "service") {
+ menu->insertItem( tr("Test1:"), 0);
+ menu->insertItem( tr("connect"), 1);
+ menu->insertItem( tr("delete"), 2);
+ }
+
+ ret = menu->exec( point , 0);
+
+// noch differenzieren
+ switch(ret) {
+ case 0:
+ break;
+ case 1:
+ break;
+ case 2:
+ // delete childs too
+ delete item;
+ break;
+ }
+
+ delete menu;
+ delete groups;
}
/**
* Search and display avail. services for a device (on expand from device listing)
*
*/
void BlueBase::addServicesToDevice( QListViewItem * item ) {
qDebug("addServicesToDevice");
- // row of mac adress
+ // row of mac adress text(3)
RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) );
deviceList.insert( item->text(3) , item );
// and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
localDevice->searchServices( *device );
// delete
}
/**
* 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,QListViewItem*>::Iterator it;
QListViewItem* deviceItem;
+ // get the right devices which requested the search
for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
if ( it.key() == device ) {
deviceItem = it.data();
}
}
+
+ // empty entries
+ // QListViewItem * myChild = deviceItem->firstChild();
+ //QList<QListViewItem*> tmpList;
+ //while( myChild ) {
+ // tmpList.append(myChild);
+ // myChild = myChild->nextSibling();
+ // }
+
+
QValueList<OpieTooth::Services>::Iterator it2;
QListViewItem * serviceItem;
- for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
- serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() );
+ if (!servicesList.isEmpty() ) {
+ // add services
+ for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
+ serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() );
+ serviceItem->setText(4, "service");
+ }
+ } else {
+ serviceItem = new QListViewItem( deviceItem , tr("no services found") );
+ serviceItem->setText(4, "service");
}
}
/**
* Add the existing connections (pairs) to the connections tab.
*
*/
void BlueBase::addConnectedDevices() {
//mac address
}
/**
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 99d2fa6..bc48bb3 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -58,24 +58,24 @@ namespace OpieTooth {
QString deviceName;
QString defaultPasskey;
int useEncryption;
int enableAuthentification;
int enablePagescan;
int enableInquiryscan;
QPixmap offPix;
QPixmap onPix;
private slots:
void addSearchedDevices( QList<RemoteDevice> &newDevices );
void addServicesToDevice( QListViewItem *item );
void addServicesToDevice( const QString& device, Services::ValueList );
void addConnectedDevices();
void startServiceActionClicked( QListViewItem *item );
- void startServiceActionHold( QListViewItem *item, const QPoint &point, int column);
+ void startServiceActionHold( QListViewItem *, const QPoint &, int );
void applyConfigChanges();
};
}
#endif
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index 9520e73..0e6e93b 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -104,32 +104,35 @@ namespace OpieTooth {
QTimer::singleShot( 2000, this, SLOT(progressTimer() ) );
}
progress->setProgress(progressStat++);
}
void ScanDialog::accept() {
emitToManager();
QDialog::accept();
}
void ScanDialog::startSearch() {
progress->setProgress(0);
progressStat = 0;
+ // empty list before a new scan
+ ListView1->clear();
+
QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox );
deviceItem2->setText(1, "BLAH" );
progressTimer();
// when finished, it emmite foundDevices()
// checken ob initialisiert , qcop ans applet.
localDevice->searchDevices();
}
void ScanDialog::stopSearch() {
}
void ScanDialog::fillList(const QString& device, RemoteDevice::ValueList deviceList) {