-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 19 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/popuphelper.cpp | 9 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/stdpopups.cpp | 3 |
3 files changed, 21 insertions, 10 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index af64663..c81d4d1 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -1,98 +1,103 @@ /* * bluebase.cpp * * --------------------- * * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "bluebase.h" #include "scandialog.h" #include "hciconfwrapper.h" +#include "devicehandler.h" +#include "btconnectionitem.h" + +#include <remotedevice.h> +#include <services.h> #include <stdlib.h> #include <qframe.h> #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 <qcheckbox.h> #include <qlineedit.h> #include <qlistview.h> #include <qdir.h> #include <qpopupmenu.h> #include <qtimer.h> +#include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> -#include <remotedevice.h> -#include <services.h> - -#include "devicehandler.h" -#include "btconnectionitem.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" ); 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" ); @@ -141,63 +146,61 @@ void BlueBase::writeConfig() { cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); writeToHciConfig(); } /** * Modify the hcid.conf file to our needs */ void BlueBase::writeToHciConfig() { qWarning("writeToHciConfig"); HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); hciconf.load(); hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); hciconf.setName( m_deviceName ); hciconf.setEncrypt( m_useEncryption ); hciconf.setAuth( m_enableAuthentification ); hciconf.setPscan( m_enablePagescan ); hciconf.setIscan( m_enableInquiryscan ); hciconf.save(); } /** * Read the list of allready known devices - * */ void BlueBase::readSavedDevices() { QValueList<RemoteDevice> loadedDevices; DeviceHandler handler; loadedDevices = handler.load(); addSearchedDevices( loadedDevices ); } /** * Write the list of allready known devices - * */ void BlueBase::writeSavedDevices() { QListViewItemIterator it( ListView2 ); BTListItem* item; BTDeviceItem* device; RemoteDevice::ValueList list; for ( ; it.current(); ++it ) { item = (BTListItem*)it.current(); if(item->typeId() != BTListItem::Device ) continue; device = (BTDeviceItem*)item; list.append( device->remoteDevice() ); } /* * if not empty save the List through DeviceHandler */ if ( list.isEmpty() ) return; DeviceHandler handler; handler.save( list ); } diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp index 4ef1ed5..ba91e04 100644 --- a/noncore/net/opietooth/manager/popuphelper.cpp +++ b/noncore/net/opietooth/manager/popuphelper.cpp @@ -1,30 +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 ) { //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( 1, newRfcComPopup ); - insert(2, newObexPushPopup ); + insert( 4355, newRfcComPopup ); + insert( 4353, newRfcComPopup ); + insert( 3, newObexPushPopup ); } diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp index f462368..2290b9a 100644 --- a/noncore/net/opietooth/manager/stdpopups.cpp +++ b/noncore/net/opietooth/manager/stdpopups.cpp @@ -1,13 +1,16 @@ //#include "rfccompopup.h" #include "stdpopups.h" +extern "C" { QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, QListViewItem* item ) { // return OpieTooth::RfcComPopup( servive, item ); return 0l; } QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ) { return 0l; } + +} |