aboutsummaryrefslogtreecommitdiffstats
path: root/packages/opie-bluetoothapplet/files/sysconfig-bluetooth.patch
blob: 83ee765b1243be8814659c354c666e360547dd67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- applet.org/bluezapplet.cpp.org	2007-02-11 16:48:06.000000000 +0000
+++ applet/bluezapplet.cpp	2007-02-11 16:56:57.000000000 +0000
@@ -52,6 +52,8 @@
 #include <qtimer.h>
 #include <qpopupmenu.h>
 #include <qmessagebox.h>
+#include <qfile.h>
+#include <qtextstream.h>
 
 /* STD */
 #include <device.h>
@@ -124,6 +126,28 @@
     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" );