summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 13954c5..58f97fa 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,82 +1,86 @@
/*
* 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 "forwarder.h"
#include "servicesdialog.h"
#include <termios.h>
#include <string.h>
#include <errno.h>
/* OPIE */
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <opie2/odebug.h>
+#ifdef Q_WS_QWS
+#include <qpe/qcopenvelope_qws.h>
+#endif
+
using namespace Opie::Core;
/* QT */
#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 <qcombobox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qdir.h>
#include <qpopupmenu.h>
#include <qtimer.h>
#include <qlist.h>
#include <qfile.h>
/* STD */
#include <remotedevice.h>
#include <services.h>
#include <stdlib.h>
using namespace OpieTooth;
//Array of possible speeds of the serial port
struct SerSpeed {
const char* str; //string value
int val; //value itself
} speeds[] = {
{ "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 },
{ "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 },
{ "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 },
{ "115200", B115200}
};
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() ) );
@@ -643,139 +647,155 @@ void BlueBase::deviceActive( const QString& device, bool connected )
it = m_deviceList.find( device );
if( it == m_deviceList.end() )
return;
BTDeviceItem* deviceItem = it.data();
if ( connected )
{
deviceItem->setPixmap( 1, m_onPix );
}
else
{
deviceItem->setPixmap( 1, m_offPix );
}
m_deviceList.remove( it );
}
/**
* Open the "scan for devices" dialog
*/
void BlueBase::startScan()
{
ScanDialog *scan = new ScanDialog( this, "ScanDialog",
true, WDestructiveClose );
QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ),
this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) );
QPEApplication::showDialog( scan );
}
/**
* Set the informations about the local device in information Tab
*/
void BlueBase::setInfo()
{
StatusLabel->setText( status() );
}
/**
* Decontructor
*/
BlueBase::~BlueBase()
{
writeSavedDevices();
+ if (forwarder) {
+#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+ QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
+ << QPEApplication::Enable;
+#endif
+ delete forwarder;
+ forwarder = NULL;
+ }
delete m_iconLoader;
}
/**
* find searches the ListView for a BTDeviceItem containig
* the same Device if found return true else false
* @param dev RemoteDevice to find
* @return returns true if found
*/
bool BlueBase::find( const RemoteDevice& rem )
{
QListViewItemIterator it( devicesView );
BTListItem* item;
BTDeviceItem* device;
for (; it.current(); ++it )
{
item = (BTListItem*) it.current();
if ( item->typeId() != BTListItem::Device )
continue;
device = (BTDeviceItem*)item;
if ( rem.equals( device->remoteDevice() ) )
return true;
}
return false; // not found
}
/**
* Start process of the cell phone forwarding
*/
void BlueBase::doForward()
{
if (forwarder && forwarder->isRunning()) {
runButton->setText("start gateway");
forwarder->stop();
delete forwarder;
forwarder = NULL;
return;
}
QString str = serDevName->text();
forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val);
connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT(forwardExited(Opie::Core::OProcess*)));
if (forwarder->start(OProcess::NotifyOnExit) < 0) {
QMessageBox::critical(this, tr("Forwarder Error"),
tr("Forwarder start error:") + tr(strerror(errno)));
return;
}
runButton->setText("stop gateway");
+#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+ QCopEnvelope("QPE/System", "setScreenSaverMode(int)")
+ << QPEApplication::DisableSuspend;
+#endif
}
/**
* React on the process end
*/
void BlueBase::forwardExit(Opie::Core::OProcess* proc)
{
+#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+ QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
+ << QPEApplication::Enable;
+#endif
if (proc->exitStatus() != 0)
QMessageBox::critical(this, tr("Forwarder Error"),
tr("Forwarder start error"));
delete proc;
forwarder = NULL;
runButton->setText("start gateway");
}
/**
* Encrypt entered passkey
* doit - do encryption of the key
*/
void BlueBase::doEncrypt(bool doit)
{
passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal);
}
/**
* Start services edit dialog
*/
void BlueBase::editServices()
{
QString conf = "/etc/default/bluetooth";
//// Use for debugging purposes
//// QString conf = "/mnt/net/opie/bin/bluetooth";
ServicesDialog svcEdit(conf, this, "ServicesDialog", true,
WStyle_ContextHelp);
if (QPEApplication::execDialog(&svcEdit) == QDialog::Accepted)
{
}
}
//eof