summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 54808fa..2e68984 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,86 +1,89 @@
/*
* 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 "rfcommassigndialogimpl.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 <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 <qlist.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#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( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
+// 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 ) ) );
connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ),
this, SLOT( addSignalStrength( const QString&, const QString& ) ) );
// let hold be rightButtonClicked()
QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold);
QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold);
//Load all icons needed
m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
m_onPix = Resource::loadPixmap( "opietooth/connected" );
m_findPix = Resource::loadPixmap( "opietooth/find" );
@@ -201,71 +204,85 @@ void BlueBase::writeSavedDevices() {
/**
* Set up the gui
*/
void BlueBase::initGui() {
StatusLabel->setText( status() ); // maybe move it to getStatus()
cryptCheckBox->setChecked( m_useEncryption );
authCheckBox->setChecked( m_enableAuthentification );
pagescanCheckBox->setChecked( m_enablePagescan );
inquiryscanCheckBox->setChecked( m_enableInquiryscan );
deviceNameLine->setText( m_deviceName );
passkeyLine->setText( m_defaultPasskey );
// set info tab
setInfo();
}
/**
* Get the status informations and returns it
* @return QString the status informations gathered
*/
QString BlueBase::status()const{
QString infoString = tr( "<b>Device name : </b> Ipaq" );
infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
- infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
+ infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
return (infoString);
}
/**
* Read the current values from the gui and invoke writeConfig()
*/
void BlueBase::applyConfigChanges() {
m_deviceName = deviceNameLine->text();
m_defaultPasskey = passkeyLine->text();
m_useEncryption = cryptCheckBox->isChecked();
m_enableAuthentification = authCheckBox->isChecked();
m_enablePagescan = pagescanCheckBox->isChecked();
m_enableInquiryscan = inquiryscanCheckBox->isChecked();
writeConfig();
QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
}
/**
+ * Launch Rfcomm Bind dialog
+ *
+ */
+void BlueBase::rfcommDialog() {
+ RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
+
+ rfcommAssign.showMaximized();
+
+ if ( rfcommAssign.exec() == QDialog::Accepted ) {
+ rfcommAssign.saveConfig();
+ }
+}
+
+/**
* Add fresh found devices from scan dialog to the listing
*
*/
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->setPixmap( 1, m_findPix );
deviceItem->setExpandable ( true );
// look if device is avail. atm, async
deviceActive( (*it) );
// ggf auch hier?
addServicesToDevice( deviceItem );
}
}