-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 8 | ||||
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 90b0c6d..6351d4e 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -113,13 +113,13 @@ namespace OpieTooth { | |||
113 | } else { | 113 | } else { |
114 | odebug << "btDevice is ZERO" << oendl; | 114 | odebug << "btDevice is ZERO" << oendl; |
115 | return false; | 115 | return false; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | int BluezApplet::setBluezStatus(int c) { | 119 | int BluezApplet::setBluezStatus(int c, bool sync) { |
120 | 120 | ||
121 | if ( c == 1 ) { | 121 | if ( c == 1 ) { |
122 | switch ( ODevice::inst()->model() ) { | 122 | switch ( ODevice::inst()->model() ) { |
123 | case Model_iPAQ_H39xx: | 123 | case Model_iPAQ_H39xx: |
124 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); | 124 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); |
125 | break; | 125 | break; |
@@ -135,14 +135,18 @@ namespace OpieTooth { | |||
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | default: | 137 | default: |
138 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); | 138 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | if (sync) { | ||
142 | ::system("/etc/init.d/bluetooth start >/dev/null 2>/dev/null"); | ||
143 | } else { | ||
141 | QCopEnvelope e("QPE/System", "execute(QString)"); | 144 | QCopEnvelope e("QPE/System", "execute(QString)"); |
142 | e << QString("/etc/init.d/bluetooth start"); | 145 | e << QString("/etc/init.d/bluetooth start"); |
146 | } | ||
143 | } else { | 147 | } else { |
144 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); | 148 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); |
145 | if ( btManager ) { | 149 | if ( btManager ) { |
146 | delete btManager; | 150 | delete btManager; |
147 | btManager = 0; | 151 | btManager = 0; |
148 | } | 152 | } |
@@ -166,13 +170,13 @@ namespace OpieTooth { | |||
166 | // receiver for QCopChannel("QPE/Bluetooth") messages. | 170 | // receiver for QCopChannel("QPE/Bluetooth") messages. |
167 | void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) | 171 | void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) |
168 | { | 172 | { |
169 | if ( str == "enableBluetooth()") { | 173 | if ( str == "enableBluetooth()") { |
170 | m_wasOn = checkBluezStatus(); | 174 | m_wasOn = checkBluezStatus(); |
171 | if (!m_wasOn) { | 175 | if (!m_wasOn) { |
172 | setBluezStatus(1); | 176 | setBluezStatus(1, true); |
173 | sleep(2); | 177 | sleep(2); |
174 | } | 178 | } |
175 | } | 179 | } |
176 | else if ( str == "disableBluetooth()") { | 180 | else if ( str == "disableBluetooth()") { |
177 | /* | 181 | /* |
178 | * We can down BT only if it was started by qcop. We don't want | 182 | * We can down BT only if it was started by qcop. We don't want |
diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h index 90bee3b..1937934 100644 --- a/noncore/net/opietooth/applet/bluezapplet.h +++ b/noncore/net/opietooth/applet/bluezapplet.h | |||
@@ -52,13 +52,13 @@ public slots: | |||
52 | 52 | ||
53 | private: | 53 | private: |
54 | void mousePressEvent( QMouseEvent * ); | 54 | void mousePressEvent( QMouseEvent * ); |
55 | void paintEvent( QPaintEvent* ); | 55 | void paintEvent( QPaintEvent* ); |
56 | void launchManager(); | 56 | void launchManager(); |
57 | bool checkBluezStatus(); | 57 | bool checkBluezStatus(); |
58 | int setBluezStatus(int); | 58 | int setBluezStatus(int, bool sync = false); |
59 | int checkBluezDiscoveryStatus(); | 59 | int checkBluezDiscoveryStatus(); |
60 | int setBluezDiscoveryStatus(int); | 60 | int setBluezDiscoveryStatus(int); |
61 | 61 | ||
62 | private: | 62 | private: |
63 | Device* btDevice; | 63 | Device* btDevice; |
64 | Manager *btManager; | 64 | Manager *btManager; |