summaryrefslogtreecommitdiff
authorkorovkin <korovkin>2006-05-09 12:38:24 (UTC)
committer korovkin <korovkin>2006-05-09 12:38:24 (UTC)
commit620d55ae3b94fa8d2fa696b6626893e4520c3a02 (patch) (unidiff)
treeca1296808dfac6fa6c74086f4dda6af525d7b151
parentdc719be35432469c24dd8d10136c1ea25c6861d2 (diff)
downloadopie-620d55ae3b94fa8d2fa696b6626893e4520c3a02.zip
opie-620d55ae3b94fa8d2fa696b6626893e4520c3a02.tar.gz
opie-620d55ae3b94fa8d2fa696b6626893e4520c3a02.tar.bz2
Instead of calling a process, do ::system on stop and use QCopEnvelope on start.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp56
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.h2
2 files changed, 16 insertions, 42 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 9c6c71d..90b0c6d 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -57,3 +57,3 @@ using namespace Opie::Core;
57 57
58// #define OPIE120 // undefine it fo the latest OPIE 58#define OPIE120 // undefine it fo the latest OPIE
59 59
@@ -85,12 +85,3 @@ namespace OpieTooth {
85 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); 85 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
86 86 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null");
87 OProcess* btstart = new OProcess();
88 *btstart << "/etc/init.d/bluetooth" << "stop";
89 btstart->setUseShell(true);
90 if (!btstart->start(OProcess::DontCare, OProcess::AllOutput))
91 delete btstart;
92 else {
93 connect(btstart, SIGNAL(processExited(Opie::Core::OProcess*)),
94 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
95 }
96 } 87 }
@@ -106,6 +97,6 @@ namespace OpieTooth {
106 97
107int BluezApplet::position() 98 int BluezApplet::position()
108{ 99 {
109 return 6; 100 return 6;
110} 101 }
111 102
@@ -115,4 +106,6 @@ int BluezApplet::position()
115 if (btDevice->isLoaded() ) { 106 if (btDevice->isLoaded() ) {
107 odebug << "btDevice isLoaded" << oendl;
116 return true; 108 return true;
117 } else { 109 } else {
110 odebug << "btDevice is NOT loaded" << oendl;
118 return false; 111 return false;
@@ -120,2 +113,3 @@ int BluezApplet::position()
120 } else { 113 } else {
114 odebug << "btDevice is ZERO" << oendl;
121 return false; 115 return false;
@@ -126,3 +120,2 @@ int BluezApplet::position()
126 120
127 OProcess* btstart = new OProcess();
128 if ( c == 1 ) { 121 if ( c == 1 ) {
@@ -147,18 +140,9 @@ int BluezApplet::position()
147 } 140 }
148 *btstart << "/etc/init.d/bluetooth" << "start"; 141 QCopEnvelope e("QPE/System", "execute(QString)");
149 btstart->setUseShell(true); 142 e << QString("/etc/init.d/bluetooth start");
150 if (!btstart->start(OProcess::DontCare, OProcess::AllOutput))
151 delete btstart;
152 else {
153 connect(btstart, SIGNAL(processExited(Opie::Core::OProcess*)),
154 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
155 }
156 } else { 143 } else {
157 *btstart << "/etc/init.d/bluetooth" << "stop"; 144 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null");
158 btstart->setUseShell(true); 145 if ( btManager ) {
159 if (!btstart->start(OProcess::DontCare, OProcess::AllOutput)) 146 delete btManager;
160 delete btstart; 147 btManager = 0;
161 else {
162 connect(btstart, SIGNAL(processExited(Opie::Core::OProcess*)),
163 this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
164 } 148 }
@@ -199,3 +183,3 @@ int BluezApplet::position()
199 doListDevice = false; 183 doListDevice = false;
200 } 184 }
201 else if ( str == "listDevices()") { 185 else if ( str == "listDevices()") {
@@ -264,2 +248,3 @@ int BluezApplet::position()
264 ret = menu->exec(p, 0); 248 ret = menu->exec(p, 0);
249 menu->hide();
265 250
@@ -350,11 +335,2 @@ int BluezApplet::position()
350 } 335 }
351
352/**
353 * Implementation of the process finish
354 * @param the finished process
355 */
356 void BluezApplet::slotProcessExited(OProcess* proc)
357 {
358 delete proc;
359 }
360}; 336};
diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h
index 85022bb..90bee3b 100644
--- a/noncore/net/opietooth/applet/bluezapplet.h
+++ b/noncore/net/opietooth/applet/bluezapplet.h
@@ -75,4 +75,2 @@ private slots:
75 void slotMessage( const QCString& , const QByteArray& ); 75 void slotMessage( const QCString& , const QByteArray& );
76 void slotProcessExited(Opie::Core::OProcess* proc);
77
78 }; 76 };