summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-07-21 20:02:13 (UTC)
committer harlekin <harlekin>2002-07-21 20:02:13 (UTC)
commit086b00610edfb25fb25cf54a0f8da8a16b55246a (patch) (side-by-side diff)
treee16de393854040440ebc5ceeb6cbd48b27aff605
parent8abe7e0604c930cbb46308febeec67d5bf70d255 (diff)
downloadopie-086b00610edfb25fb25cf54a0f8da8a16b55246a.zip
opie-086b00610edfb25fb25cf54a0f8da8a16b55246a.tar.gz
opie-086b00610edfb25fb25cf54a0f8da8a16b55246a.tar.bz2
connection to popups on services
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp15
-rw-r--r--noncore/net/opietooth/manager/btdeviceitem.h4
-rw-r--r--noncore/net/opietooth/manager/manager.pro5
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/obexdialog.h5
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp2
-rw-r--r--noncore/net/opietooth/manager/popuphelper.h4
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/pppdialog.h5
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp11
-rw-r--r--noncore/net/opietooth/manager/stdpopups.h7
11 files changed, 39 insertions, 23 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index c81d4d1..ec05a95 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -256,149 +256,152 @@ void BlueBase::applyConfigChanges() {
void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
BTDeviceItem * deviceItem;
QValueList<RemoteDevice>::ConstIterator it;
for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
if (find( (*it) )) // is already inserted
continue;
deviceItem = new BTDeviceItem( ListView2 , (*it) );
deviceItem->setExpandable ( true );
// look if device is avail. atm, async
deviceActive( (*it) );
// 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*/ ) {
+ if (!item )
+ return;
QPopupMenu *menu = new QPopupMenu();
int ret=0;
if ( ((BTListItem*)item)->type() == "device") {
QPopupMenu *groups = new QPopupMenu();
menu->insertItem( tr("rescan sevices:"), 0);
menu->insertItem( tr("to group"), groups , 1);
// menu->insertItem( tr("bound device"), 2);
menu->insertItem( tr("delete"), 3);
ret = menu->exec( point , 0);
switch(ret) {
case -1:
break;
case 0:
addServicesToDevice( (BTDeviceItem*)item );
break;
case 1:
break;
// NO need to, since hcid does that on the fly
// case 2:
// make connection
//m_localDevice->connectTo( ((BTDeviceItem*)item)->mac() );
//break;
case 3:
// deletes childs too
delete item;
break;
}
delete groups;
}
/*
* 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(),
+ popup = m_popHelper.find( it.key() /*1*/,
service->services(),
- service->parent() );
+ (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 )
- delete popup;
+ ;
else if ( ret == test1 )
- delete popup;
+ ;
else if ( ret == con )
- delete popup;
+ ;
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 );
// 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 );
diff --git a/noncore/net/opietooth/manager/btdeviceitem.h b/noncore/net/opietooth/manager/btdeviceitem.h
index ae51483..e4c6ce7 100644
--- a/noncore/net/opietooth/manager/btdeviceitem.h
+++ b/noncore/net/opietooth/manager/btdeviceitem.h
@@ -1,26 +1,26 @@
-#ifndef OPIE_TOOTH_BT_DEVIVE_ITEM
-#define OPIE_TOOTH_BT_DEVIVE_ITEM
+#ifndef OPIE_TOOTH_BT_DEVICE_ITEM
+#define OPIE_TOOTH_BT_DEVICE_ITEM
#include <remotedevice.h>
#include "btlistitem.h"
namespace OpieTooth {
class BTDeviceItem : public BTListItem {
public:
BTDeviceItem( QListView* parent, const RemoteDevice& dev );
~BTDeviceItem();
RemoteDevice remoteDevice() const;
QString type()const;
int typeId()const;
QString mac()const;
QString name() const;
private:
RemoteDevice m_device;
};
};
#endif
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 762b028..121c069 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,40 +1,41 @@
TEMPLATE = app
CONFIG = qt warn_on debug
#CONFIG = qt warn_on release
HEADERS = btconnectionitem.h btdeviceitem.h \
btserviceitem.h stdpopups.h \
popuphelper.h bluebase.h \
scandialog.h btlistitem.h \
hciconfwrapper.h bticonloader.h \
pppdialog.h obexdialog.h \
- devicehandler.h
+ devicehandler.h rfcpopup.h
SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
btserviceitem.cpp stdpopups.cpp \
popuphelper.cpp main.cpp \
bluebase.cpp scandialog.cpp \
btlistitem.cpp hciconfwrapper.cpp \
bticonloader.cpp pppdialog.cpp \
- obexdialog.cpp devicehandler.cpp
+ obexdialog.cpp devicehandler.cpp \
+ rfcpopup.cpp
INCLUDEPATH += $(OPIEDIR)/include
INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopietooth -lopie
INTERFACES = bluetoothbase.ui devicedialog.ui
DESTDIR = $(OPIEDIR)/bin
TARGET = bluetooth-manager
TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \
../../../../i18n/en/bluetooth-manager.ts \
../../../../i18n/es/bluetooth-manager.ts \
../../../../i18n/fr/bluetooth-manager.ts \
../../../../i18n/hu/bluetooth-manager.ts \
../../../../i18n/ja/bluetooth-manager.ts \
../../../../i18n/ko/bluetooth-manager.ts \
../../../../i18n/no/bluetooth-manager.ts \
../../../../i18n/pl/bluetooth-manager.ts \
../../../../i18n/pt/bluetooth-manager.ts \
../../../../i18n/pt_BR/bluetooth-manager.ts \
../../../../i18n/sl/bluetooth-manager.ts \
../../../../i18n/zh_CN/bluetooth-manager.ts \
../../../../i18n/zh_TW/bluetooth-manager.ts
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp
index cb142eb..15973d4 100644
--- a/noncore/net/opietooth/manager/obexdialog.cpp
+++ b/noncore/net/opietooth/manager/obexdialog.cpp
@@ -1,46 +1,48 @@
#include "obexdialog.h"
#include <qpushbutton.h>
#include <qmultilineedit.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qfileinfo.h>
#include <qpe/resource.h>
#include <opie/oprocess.h>
#include <opie/ofiledialog.h>
+using namespace OpieTooth;
+
ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
: QDialog( parent, name, modal, fl ) {
if ( !name )
setName( "ObexDialog" );
setCaption( tr( "beam files " ) ) ;
m_device = device;
layout = new QVBoxLayout( this );
QLabel* info = new QLabel( this );
info->setText( tr("Which file should be beamed?") );
cmdLine = new QLineEdit( this );
QPushButton *browserButton;
browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) );
chNameLine = new QLineEdit( this );
sendButton = new QPushButton( this );
sendButton->setText( tr( "Send" ) );
layout->addWidget(info);
layout->addWidget(cmdLine);
layout->addWidget(browserButton);
layout->addWidget(chNameLine);
layout->addWidget(sendButton);
connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) );
diff --git a/noncore/net/opietooth/manager/obexdialog.h b/noncore/net/opietooth/manager/obexdialog.h
index 1a73b57..28d2be2 100644
--- a/noncore/net/opietooth/manager/obexdialog.h
+++ b/noncore/net/opietooth/manager/obexdialog.h
@@ -1,36 +1,39 @@
#ifndef OBEXDIALOG_H
#define OBEXDIALOG_H
#include <qdialog.h>
#include <opie/oprocess.h>
class QVBoxLayout;
class QPushButton;
class QMultiLineEdit;
class QLineEdit;
+
+namespace OpieTooth {
+
class ObexDialog : public QDialog {
Q_OBJECT
public:
ObexDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0);
~ObexDialog();
private slots:
void browse();
void sendData();
protected:
QVBoxLayout* layout;
QLineEdit* cmdLine;
QLineEdit* chNameLine;
QPushButton* sendButton;
private:
// Device that is used
QString m_device;
};
-
+}
#endif
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
index ba91e04..4a4daf2 100644
--- a/noncore/net/opietooth/manager/popuphelper.cpp
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -1,35 +1,35 @@
#include "stdpopups.h"
#include "popuphelper.h"
using namespace OpieTooth;
PopupHelper::PopupHelper() {
init();
}
PopupHelper::~PopupHelper() {
}
void PopupHelper::insert( int id, popupFactory fact ) {
m_map.insert(id, fact );
}
-QPopupMenu* PopupHelper::find( int id, const Services& ser, QListViewItem* item ) {
+QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) {
//qWarning("find");
FactoryMap::Iterator it = m_map.find(id );
if ( it != m_map.end() ) {
//qWarning("found");
popupFactory fact = it.data();
return (*fact)(ser, item);
}
return 0l;
}
void PopupHelper::init() {
insert( 4355, newRfcComPopup );
insert( 4353, newRfcComPopup );
insert( 3, newObexPushPopup );
}
diff --git a/noncore/net/opietooth/manager/popuphelper.h b/noncore/net/opietooth/manager/popuphelper.h
index 7541ac5..6d4d413 100644
--- a/noncore/net/opietooth/manager/popuphelper.h
+++ b/noncore/net/opietooth/manager/popuphelper.h
@@ -1,27 +1,27 @@
#ifndef OPIE_TOOTH_POPUP_HELPER
#define OPIE_TOOTH_POPUP_HELPER
#include <qlistview.h>
#include <qpopupmenu.h>
#include <qmap.h>
#include <services.h>
namespace OpieTooth {
- typedef QPopupMenu* (*popupFactory)(const Services&, QListViewItem*);
+ typedef QPopupMenu* (*popupFactory)(const Services&, BTDeviceItem*);
typedef QMap<int, popupFactory> FactoryMap;
class PopupHelper {
public:
PopupHelper();
~PopupHelper();
void insert( int id, popupFactory fact );
- QPopupMenu* find( int id, const Services&, QListViewItem* );
+ QPopupMenu* find( int id, const Services&, BTDeviceItem* );
private:
void init();
FactoryMap m_map;
};
};
#endif
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
index 4d926a5..1f347ce 100644
--- a/noncore/net/opietooth/manager/pppdialog.cpp
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -1,41 +1,43 @@
#include "pppdialog.h"
#include <qpushbutton.h>
#include <qmultilineedit.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qlabel.h>
#include <opie/oprocess.h>
+using namespace OpieTooth;
+
PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
: QDialog( parent, name, modal, fl ) {
if ( !name )
setName( "PPPDialog" );
setCaption( tr( "ppp connection " ) ) ;
m_device = device;
layout = new QVBoxLayout( this );
QLabel* info = new QLabel( this );
info->setText( tr("Enter an ppp script name:") );
cmdLine = new QLineEdit( this );
outPut = new QMultiLineEdit( this );
QFont outPut_font( outPut->font() );
outPut_font.setPointSize( 8 );
outPut->setFont( outPut_font );
outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
connectButton = new QPushButton( this );
connectButton->setText( tr( "Connect" ) );
layout->addWidget(info);
layout->addWidget(cmdLine);
layout->addWidget(outPut);
layout->addWidget(connectButton);
connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
diff --git a/noncore/net/opietooth/manager/pppdialog.h b/noncore/net/opietooth/manager/pppdialog.h
index b80b73d..6fdc90a 100644
--- a/noncore/net/opietooth/manager/pppdialog.h
+++ b/noncore/net/opietooth/manager/pppdialog.h
@@ -1,34 +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();
-
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/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp
index 2290b9a..750365e 100644
--- a/noncore/net/opietooth/manager/stdpopups.cpp
+++ b/noncore/net/opietooth/manager/stdpopups.cpp
@@ -1,16 +1,15 @@
-//#include "rfccompopup.h"
+#include "rfcpopup.h"
#include "stdpopups.h"
extern "C" {
- QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, QListViewItem* item ) {
- // return OpieTooth::RfcComPopup( servive, item );
- return 0l;
+ QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, OpieTooth::BTDeviceItem* item ) {
+ return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters
+ //return 0l;
}
- QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ) {
+ QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) {
return 0l;
}
-
}
diff --git a/noncore/net/opietooth/manager/stdpopups.h b/noncore/net/opietooth/manager/stdpopups.h
index 185d68d..b57d4de 100644
--- a/noncore/net/opietooth/manager/stdpopups.h
+++ b/noncore/net/opietooth/manager/stdpopups.h
@@ -1,15 +1,18 @@
#ifndef OPIE_TOOTH_STD_POPUPS
#define OPIE_TOOTH_STD_POPUPS
#include <qlistview.h>
#include <qpopupmenu.h>
#include <services.h>
+#include "btdeviceitem.h"
+
extern "C" {
-QPopupMenu* newRfcComPopup( const OpieTooth::Services&, QListViewItem* );
-QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* );
+
+ QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
+ QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
}
#endif