summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 787abc6..60fa4f8 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -43,24 +43,26 @@ using namespace Opie::Core;
/* QT */
#include <qapplication.h>
#include <qpoint.h>
#include <qpainter.h>
#include <qlayout.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qstring.h>
#include <qtimer.h>
#include <qpopupmenu.h>
#include <qmessagebox.h>
+#include <qfile.h>
+#include <qtextstream.h>
/* STD */
#include <device.h>
namespace OpieTooth {
BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) {
setFixedHeight( AppLnk::smallIconSize() );
setFixedWidth( AppLnk::smallIconSize() );
#if OPIE_VERSION < 102010
bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" );
bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" );
bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" );
@@ -115,24 +117,43 @@ namespace OpieTooth {
odebug << "btDevice is NOT loaded" << oendl;
return false;
}
} else {
odebug << "btDevice is ZERO" << oendl;
return false;
}
}
int BluezApplet::setBluezStatus(int c, bool sync) {
if ( c == 1 ) {
+ QFile cfg("/etc/sysconfig/bluetooth");
+ if ( cfg.open( IO_ReadOnly ) ) {
+ QTextStream stream( &cfg );
+ QString streamIn = stream.read();
+ QStringList list = QStringList::split( "\n", streamIn );
+ cfg.close();
+ if ( list.grep( "BLUETOOTH_PORT=" ).count() > 0 &&
+ list.grep( "BLUETOOTH_PROTOCOL=" ).count() > 0 &&
+ list.grep( "BLUETOOTH_SPEED=" ).count() > 0)
+ {
+ btDevice =
+ new Device( list.grep( "BLUETOOTH_PORT=" )[0].replace( QString( "BLUETOOTH_PORT=" ), ""),
+ list.grep( "BLUETOOTH_PROTOCOL=" )[0].replace( QString( "BLUETOOTH_PROTOCOL=" ), ""),
+ list.grep( "BLUETOOTH_SPEED=" )[0].replace( QString( "BLUETOOTH_SPEED=" ), "" ) );
+ return 0;
+ }
+ }
+
+ // Device-specific stuff - should be removed
switch ( ODevice::inst()->model() ) {
case Model_iPAQ_H39xx:
btDevice = new Device( "/dev/tts/1", "bcsp", "921600" );
break;
case Model_iPAQ_H5xxx:
btDevice = new Device( "/dev/tts/1", "any", "921600" );
break;
#if OPIE_VERSION >= 102010
case Model_MyPal_716:
btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" );