summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2006-05-04 08:54:33 (UTC)
committer mickeyl <mickeyl>2006-05-04 08:54:33 (UTC)
commitb5d4d3425bc7f9d2518a15159f4a7b01071a68d7 (patch) (unidiff)
tree2cb1b9f7051cd06123c36eb8b75a9b6b7e49db0f
parent9e9148941974ce65fb733b14dd8bb15fe099ec2c (diff)
downloadopie-b5d4d3425bc7f9d2518a15159f4a7b01071a68d7.zip
opie-b5d4d3425bc7f9d2518a15159f4a7b01071a68d7.tar.gz
opie-b5d4d3425bc7f9d2518a15159f4a7b01071a68d7.tar.bz2
destroys all child processes on the window closure. patch courtesy Dmitriy Korovkin
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/btobex.cpp3
-rw-r--r--core/obex/obexsend.cpp39
2 files changed, 26 insertions, 16 deletions
diff --git a/core/obex/btobex.cpp b/core/obex/btobex.cpp
index b8556da..886f3dc 100644
--- a/core/obex/btobex.cpp
+++ b/core/obex/btobex.cpp
@@ -1,134 +1,133 @@
1 1
2#include "btobex.h" 2#include "btobex.h"
3#include <opietooth/manager.h> 3#include <opietooth/manager.h>
4#include <opietooth/services.h> 4#include <opietooth/services.h>
5 5
6/* OPIE */ 6/* OPIE */
7#include <opie2/oprocess.h> 7#include <opie2/oprocess.h>
8#include <opie2/odebug.h> 8#include <opie2/odebug.h>
9 9
10/* QT */ 10/* QT */
11#include <qfileinfo.h> 11#include <qfileinfo.h>
12#include <qstring.h> 12#include <qstring.h>
13#include <qmap.h> 13#include <qmap.h>
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15 15
16using namespace OpieObex; 16using namespace OpieObex;
17 17
18using namespace Opie::Core; 18using namespace Opie::Core;
19/* TRANSLATOR OpieObex::Obex */ 19/* TRANSLATOR OpieObex::Obex */
20using namespace OpieTooth; 20using namespace OpieTooth;
21 21
22BtObex::BtObex( QObject *parent, const char* name ) 22BtObex::BtObex( QObject *parent, const char* name )
23 : QObject(parent, name ) 23 : QObject(parent, name )
24{ 24{
25 m_rec = 0; 25 m_rec = 0;
26 m_send=0; 26 m_send=0;
27 m_count = 0; 27 m_count = 0;
28 m_receive = false; 28 m_receive = false;
29 connect( this, SIGNAL(error(int) ), // for recovering to receive 29 connect( this, SIGNAL(error(int) ), // for recovering to receive
30 SLOT(slotError() ) ); 30 SLOT(slotError() ) );
31 connect( this, SIGNAL(sent(bool) ), 31 connect( this, SIGNAL(sent(bool) ),
32 SLOT(slotError() ) ); 32 SLOT(slotError() ) );
33 btManager = NULL; 33 btManager = NULL;
34}; 34};
35 35
36BtObex::~BtObex() { 36BtObex::~BtObex() {
37 if (btManager) 37 delete btManager;
38 delete btManager;
39 delete m_rec; 38 delete m_rec;
40 delete m_send; 39 delete m_send;
41} 40}
42 41
43void BtObex::receive() { 42void BtObex::receive() {
44 m_receive = true; 43 m_receive = true;
45 m_outp = QString::null; 44 m_outp = QString::null;
46 m_rec = new OProcess(); 45 m_rec = new OProcess();
47 46
48 // TODO mbhaynie: No idea if this actually works -- maybe opd is better. 47 // TODO mbhaynie: No idea if this actually works -- maybe opd is better.
49 *m_rec << "obexftpd" << "-b"; 48 *m_rec << "obexftpd" << "-b";
50 // connect to the necessary slots 49 // connect to the necessary slots
51 connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), 50 connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ),
52 this, SLOT(slotExited(Opie::Core::OProcess*) ) ); 51 this, SLOT(slotExited(Opie::Core::OProcess*) ) );
53 52
54 connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), 53 connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
55 this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); 54 this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
56 55
57 if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 56 if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
58 emit done( false ); 57 emit done( false );
59 delete m_rec; 58 delete m_rec;
60 m_rec = 0; 59 m_rec = 0;
61 } 60 }
62} 61}
63 62
64void BtObex::send( const QString& fileName, const QString& bdaddr) { 63void BtObex::send( const QString& fileName, const QString& bdaddr) {
65 // if currently receiving stop it send receive 64 // if currently receiving stop it send receive
66 m_count = 0; 65 m_count = 0;
67 m_file = fileName; 66 m_file = fileName;
68 m_bdaddr = bdaddr; 67 m_bdaddr = bdaddr;
69 if (m_rec != 0 ) { 68 if (m_rec != 0 ) {
70 if (m_rec->isRunning() ) { 69 if (m_rec->isRunning() ) {
71 emit error(-1 ); 70 emit error(-1 );
72 delete m_rec; 71 delete m_rec;
73 m_rec = 0; 72 m_rec = 0;
74 73
75 }else{ 74 }else{
76 emit error( -1 ); // we did not delete yet but it's not running slotExited is pending 75 emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
77 return; 76 return;
78 } 77 }
79 } 78 }
80 //Now we need to find out if the OBEX push is supported for this device 79 //Now we need to find out if the OBEX push is supported for this device
81 //And get the port number 80 //And get the port number
82 if (!btManager) { 81 if (!btManager) {
83 btManager = new Manager("hci0"); 82 btManager = new Manager("hci0");
84 connect(btManager, 83 connect(btManager,
85 SIGNAL(foundServices(const QString&, Services::ValueList)), 84 SIGNAL(foundServices(const QString&, Services::ValueList)),
86 this, SLOT(slotFoundServices(const QString&, Services::ValueList))); 85 this, SLOT(slotFoundServices(const QString&, Services::ValueList)));
87 } 86 }
88 btManager->searchServices(bdaddr); 87 btManager->searchServices(bdaddr);
89} 88}
90 89
91/** 90/**
92 * This function reacts on the service discovery finish 91 * This function reacts on the service discovery finish
93 */ 92 */
94void BtObex::slotFoundServices(const QString&, Services::ValueList svcList) 93void BtObex::slotFoundServices(const QString&, Services::ValueList svcList)
95{ 94{
96 QValueList<OpieTooth::Services>::Iterator it; 95 QValueList<OpieTooth::Services>::Iterator it;
97 QMap<int, QString> classList; //The classes list 96 QMap<int, QString> classList; //The classes list
98 QMap<int, QString>::Iterator classIt; //Iterator in the class list 97 QMap<int, QString>::Iterator classIt; //Iterator in the class list
99 int portNum = -1; //The desired port number 98 int portNum = -1; //The desired port number
100 odebug << "BtObex slotFoundServices" << oendl; 99 odebug << "BtObex slotFoundServices" << oendl;
101 if (svcList.isEmpty()) { 100 if (svcList.isEmpty()) {
102 QMessageBox::critical(NULL, tr("Object send"), tr("No services found")); 101 QMessageBox::critical(NULL, tr("Object send"), tr("No services found"));
103 emit error(-1); 102 emit error(-1);
104 return; 103 return;
105 } 104 }
106 for (it = svcList.begin(); it != svcList.end(); it++) { 105 for (it = svcList.begin(); it != svcList.end(); it++) {
107 classList = (*it).classIdList(); 106 classList = (*it).classIdList();
108 classIt = classList.begin(); 107 classIt = classList.begin();
109 if (classIt == classList.end()) 108 if (classIt == classList.end())
110 continue; 109 continue;
111////We really need symbolic names for service IDs 110////We really need symbolic names for service IDs
112 //Ok, we have found the object push service 111 //Ok, we have found the object push service
113 if (classIt.key() == 4357) { 112 if (classIt.key() == 4357) {
114 portNum = (*it).protocolDescriptorList().last().port(); 113 portNum = (*it).protocolDescriptorList().last().port();
115 break; 114 break;
116 } 115 }
117 } 116 }
118 if (portNum == -1) { 117 if (portNum == -1) {
119 QMessageBox::critical(NULL, tr("Object send"), 118 QMessageBox::critical(NULL, tr("Object send"),
120 tr("No OBEX Push service")); 119 tr("No OBEX Push service"));
121 emit error(-1); 120 emit error(-1);
122 return; 121 return;
123 } 122 }
124 m_port = portNum; 123 m_port = portNum;
125 sendNow(); 124 sendNow();
126} 125}
127 126
128void BtObex::sendNow(){ 127void BtObex::sendNow(){
129 if ( m_count >= 25 ) { // could not send 128 if ( m_count >= 25 ) { // could not send
130 emit error(-1 ); 129 emit error(-1 );
131 emit sent(false); 130 emit sent(false);
132 return; 131 return;
133 } 132 }
134 // OProcess inititialisation 133 // OProcess inititialisation
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index dbbb7b3..8432d16 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -1,241 +1,252 @@
1// 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one 1// 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one
2// generated via QT2 Designer. The new form supports 2// generated via QT2 Designer. The new form supports
3// selection of target devices, as opposed to sending to 3// selection of target devices, as opposed to sending to
4// all. 4// all.
5 5
6#include "obex.h" 6#include "obex.h"
7#include "btobex.h" 7#include "btobex.h"
8#include "obexsend.h" 8#include "obexsend.h"
9using namespace OpieObex; 9using namespace OpieObex;
10 10
11/* OPIE */ 11/* OPIE */
12#include <opie2/odebug.h> 12#include <opie2/odebug.h>
13#include <qpe/qcopenvelope_qws.h> 13#include <qpe/qcopenvelope_qws.h>
14#include <qpe/resource.h> 14#include <qpe/resource.h>
15 15
16using namespace Opie::Core; 16using namespace Opie::Core;
17 17
18/* QT */ 18/* QT */
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qpushbutton.h> 20#include <qpushbutton.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include <qlistview.h> 22#include <qlistview.h>
23 23
24#include <unistd.h> 24#include <unistd.h>
25/* TRANSLATOR OpieObex::SendWidget */ 25/* TRANSLATOR OpieObex::SendWidget */
26 26
27SendWidget::SendWidget( QWidget* parent, const char* name ) 27SendWidget::SendWidget( QWidget* parent, const char* name )
28 : obexSendBase( parent, name ) { 28 : obexSendBase( parent, name ) {
29 initUI(); 29 initUI();
30} 30}
31SendWidget::~SendWidget() { 31SendWidget::~SendWidget() {
32} 32}
33void SendWidget::initUI() { 33void SendWidget::initUI() {
34 m_obex = new Obex(this, "obex"); 34 m_obex = new Obex(this, "obex");
35 connect(m_obex, SIGNAL(error(int) ), 35 connect(m_obex, SIGNAL(error(int) ),
36 this, SLOT(slotIrError(int) ) ); 36 this, SLOT(slotIrError(int) ) );
37 connect(m_obex, SIGNAL(sent(bool) ), 37 connect(m_obex, SIGNAL(sent(bool) ),
38 this, SLOT(slotIrSent(bool) ) ); 38 this, SLOT(slotIrSent(bool) ) );
39 connect(m_obex, SIGNAL(currentTry(unsigned int) ), 39 connect(m_obex, SIGNAL(currentTry(unsigned int) ),
40 this, SLOT(slotIrTry(unsigned int) ) ); 40 this, SLOT(slotIrTry(unsigned int) ) );
41 41
42 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this ); 42 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
43 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 43 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
44 this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) ); 44 this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) );
45 45
46 m_btobex = new BtObex(this, "btobex"); 46 m_btobex = new BtObex(this, "btobex");
47 connect(m_btobex, SIGNAL(error(int) ), 47 connect(m_btobex, SIGNAL(error(int) ),
48 this, SLOT(slotBtError(int) ) ); 48 this, SLOT(slotBtError(int) ) );
49 connect(m_btobex, SIGNAL(sent(bool) ), 49 connect(m_btobex, SIGNAL(sent(bool) ),
50 this, SLOT(slotBtSent(bool) ) ); 50 this, SLOT(slotBtSent(bool) ) );
51 connect(m_btobex, SIGNAL(currentTry(unsigned int) ), 51 connect(m_btobex, SIGNAL(currentTry(unsigned int) ),
52 this, SLOT(slotBtTry(unsigned int) ) ); 52 this, SLOT(slotBtTry(unsigned int) ) );
53 53
54 chan = new QCopChannel("QPE/BluetoothBack", this ); 54 chan = new QCopChannel("QPE/BluetoothBack", this );
55 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 55 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
56 this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) ); 56 this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) );
57 57
58} 58}
59 59
60/* 60/*
61 * in send we'll first set everything up 61 * in send we'll first set everything up
62 * and then wait for a list of devices. 62 * and then wait for a list of devices.
63 */ 63 */
64void SendWidget::send( const QString& file, const QString& desc ) { 64void SendWidget::send( const QString& file, const QString& desc ) {
65 m_file = file; 65 m_file = file;
66 m_irDa.clear(); 66 m_irDa.clear();
67 m_start = 0; 67 m_start = 0;
68 68
69 fileToSend->setText(desc.isEmpty() ? file : desc ); 69 fileToSend->setText(desc.isEmpty() ? file : desc );
70 scan_for_receivers(); 70 scan_for_receivers();
71} 71}
72 72
73int SendWidget::addReceiver(const char *r, const char *icon) 73int SendWidget::addReceiver(const char *r, const char *icon)
74{ 74{
75 QListViewItem * item = new QListViewItem( receiverList, 0 ); 75 QListViewItem * item = new QListViewItem( receiverList, 0 );
76 item->setText( 0, r); 76 item->setText( 0, r);
77 item->setPixmap( 1, Resource::loadPixmap( icon ) ); 77 item->setPixmap( 1, Resource::loadPixmap( icon ) );
78 78
79 int id=receivers.count(); 79 int id=receivers.count();
80 receivers[id]=item; 80 receivers[id]=item;
81 return id; 81 return id;
82} 82}
83 83
84bool SendWidget::receiverSelected(int id) 84bool SendWidget::receiverSelected(int id)
85{ 85{
86 return (bool)(receivers[id]->pixmap(2) != NULL); 86 return (bool)(receivers[id]->pixmap(2) != NULL);
87} 87}
88 88
89void SendWidget::setReceiverStatus( int id, const QString& status ) { 89void SendWidget::setReceiverStatus( int id, const QString& status ) {
90 if ( !receivers.contains(id) ) return; 90 if ( !receivers.contains(id) ) return;
91 receivers[id]->setText(3, status ); 91 receivers[id]->setText(3, status );
92} 92}
93 93
94void SendWidget::slotIrDaDevices( const QStringList& list) { 94void SendWidget::slotIrDaDevices( const QStringList& list) {
95 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { 95 for (QStringList::ConstIterator it = list.begin();
96 int id = addReceiver(*it, "obex/irda.png"); 96 it != list.end(); ++it ) {
97 m_irDa.insert( id, (*it) ); 97 int id = addReceiver(*it, "obex/irda.png");
98 m_irDa.insert( id, (*it) );
98 } 99 }
99 irdaStatus->setText( tr("ready.")); 100 irdaStatus->setText( tr("ready."));
100 m_irDaIt = m_irDa.begin(); 101 m_irDaIt = m_irDa.begin();
101 102
102} 103}
103 104
104void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) { 105void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) {
105 for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) { 106 for(QMap<QString, QString>::ConstIterator it = str.begin();
106 int id = addReceiver(it.key(), "obex/bt.png"); 107 it != str.end(); ++it ) {
108 int id = addReceiver(it.key(), "obex/bt.png");
107 m_bt.insert( id, Pair( it.key(), it.data() ) ); 109 m_bt.insert( id, Pair( it.key(), it.data() ) );
108 } 110 }
109 btStatus->setText(tr("ready.")); 111 btStatus->setText(tr("ready."));
110 m_btIt = m_bt.begin(); 112 m_btIt = m_bt.begin();
111 113
112} 114}
113void SendWidget::slotSelectedDevice( int, int ) { 115void SendWidget::slotSelectedDevice( int, int ) {
114/* if ( name == m_irDeSearch ) { 116/* if ( name == m_irDeSearch ) {
115 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it ) 117 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it )
116 m_devBox->removeDevice( it.key() ); 118 m_devBox->removeDevice( it.key() );
117 119
118 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 120 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
119 }*/ 121 }*/
120} 122}
121void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) { 123void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
122 if ( str == "devices(QStringList)" ) { 124 if ( str == "devices(QStringList)" ) {
123 QDataStream stream( ar, IO_ReadOnly ); 125 QDataStream stream( ar, IO_ReadOnly );
124 QStringList list; 126 QStringList list;
125 stream >> list; 127 stream >> list;
126 slotIrDaDevices( list ); 128 slotIrDaDevices( list );
127 } 129 }
128} 130}
129void SendWidget::slotIrError( int ) { 131void SendWidget::slotIrError( int ) {
130 irdaStatus->setText(tr("error :(")); 132 irdaStatus->setText(tr("error :("));
131} 133}
132void SendWidget::slotIrSent( bool b) { 134void SendWidget::slotIrSent( bool b) {
133 QString text = b ? tr("Sent") : tr("Failure"); 135 QString text = b ? tr("Sent") : tr("Failure");
134 setReceiverStatus( m_irDaIt.key(), text ); 136 setReceiverStatus( m_irDaIt.key(), text );
135 ++m_irDaIt; 137 ++m_irDaIt;
136 slotStartIrda(); 138 slotStartIrda();
137} 139}
138void SendWidget::slotIrTry(unsigned int trI) { 140void SendWidget::slotIrTry(unsigned int trI) {
139 setReceiverStatus(m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) )); 141 setReceiverStatus(m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) ));
140} 142}
141void SendWidget::slotStartIrda() { 143void SendWidget::slotStartIrda() {
142 if ( !m_irDa.count() ) return; 144 if ( !m_irDa.count() )
143 if ( m_irDaIt == m_irDa.end() ) { 145 return;
146 if ( m_irDaIt == m_irDa.end() || !receiverSelected(m_irDaIt.key())) {
144 irdaStatus->setText(tr("complete.")); 147 irdaStatus->setText(tr("complete."));
145 return; 148 return;
146 } 149 }
147 setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); 150 setReceiverStatus( m_irDaIt.key(), tr("Start sending") );
148 m_obex->send( m_file ); 151 m_obex->send( m_file );
149} 152}
150 153
151void SendWidget::dispatchBt( const QCString& str, const QByteArray& ar ) { 154void SendWidget::dispatchBt( const QCString& str, const QByteArray& ar ) {
152 if ( str == "devices(QStringMap)" ) { 155 if ( str == "devices(QStringMap)" ) {
153 QDataStream stream( ar, IO_ReadOnly ); 156 QDataStream stream( ar, IO_ReadOnly );
154 QMap<QString, QString> btmap; 157 QMap<QString, QString> btmap;
155 stream >> btmap; 158 stream >> btmap;
156 slotBTDevices( btmap ); 159 slotBTDevices( btmap );
157 } 160 }
158} 161}
159void SendWidget::slotBtError( int ) { 162void SendWidget::slotBtError( int ) {
160 btStatus->setText(tr("error :(")); 163 btStatus->setText(tr("error :("));
161} 164}
162void SendWidget::slotBtSent( bool b) { 165void SendWidget::slotBtSent( bool b) {
163 QString text = b ? tr("Sent") : tr("Failure"); 166 QString text = b ? tr("Sent") : tr("Failure");
164 setReceiverStatus( m_btIt.key(), text ); 167 setReceiverStatus( m_btIt.key(), text );
165 ++m_btIt; 168 ++m_btIt;
166 slotStartBt(); 169 slotStartBt();
167} 170}
168void SendWidget::slotBtTry(unsigned int trI) { 171void SendWidget::slotBtTry(unsigned int trI) {
169 setReceiverStatus( m_btIt.key(), tr("Try %1").arg( QString::number( trI ) ) ); 172 setReceiverStatus( m_btIt.key(), tr("Try %1").arg( QString::number( trI ) ) );
170} 173}
171void SendWidget::slotStartBt() { 174void SendWidget::slotStartBt() {
172 // skip past unselected receivers 175 // skip past unselected receivers
173 while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) 176 while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key()))
174 ++m_btIt; 177 ++m_btIt;
175 if (m_btIt == m_bt.end() ) { 178 if (m_btIt == m_bt.end() ) {
176 btStatus->setText(tr("complete.")); 179 btStatus->setText(tr("complete."));
177 return; 180 return;
178 } 181 }
179 setReceiverStatus( m_btIt.key(), tr("Start sending") ); 182 setReceiverStatus( m_btIt.key(), tr("Start sending") );
180 m_btobex->send( m_file, m_btIt.data().second() ); 183 m_btobex->send( m_file, m_btIt.data().second() );
181} 184}
182 185
183void SendWidget::send_to_receivers() { 186void SendWidget::send_to_receivers() {
184 slotStartIrda(); 187 slotStartIrda();
185 slotStartBt(); 188 slotStartBt();
186} 189}
187 190
188void SendWidget::scan_for_receivers() 191void SendWidget::scan_for_receivers()
189{ 192{
190 receiverList->clear(); 193 receiverList->clear();
191 receivers.clear(); 194 receivers.clear();
192 sendButton->setDisabled( true ); 195 sendButton->setDisabled( true );
193 196
194 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) 197 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") )
195 { 198 {
196 irdaStatus->setText(tr("not enabled.")); 199 irdaStatus->setText(tr("not enabled."));
197 } 200 }
198 else 201 else
199 { 202 {
200 QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); 203 QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()");
201 irdaStatus->setText(tr("searching...")); 204 irdaStatus->setText(tr("searching..."));
202 sendButton->setEnabled( true ); 205 sendButton->setEnabled( true );
203 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 206 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
204 } 207 }
205 208
206 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) 209 if ( !QCopChannel::isRegistered("QPE/Bluetooth") )
207 { 210 {
208 btStatus->setText(tr("not enabled.")); 211 btStatus->setText(tr("not enabled."));
209 } 212 }
210 else 213 else
211 { 214 {
212 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); 215 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
213 btStatus->setText(tr("searching...")); 216 btStatus->setText(tr("searching..."));
214 sendButton->setEnabled( true ); 217 sendButton->setEnabled( true );
215 QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); 218 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
216 } 219 }
217} 220}
218 221
219void SendWidget::toggle_receiver(QListViewItem* item) 222void SendWidget::toggle_receiver(QListViewItem* item)
220{ 223{
221 // toggle the state of an individual receiver. 224 // toggle the state of an individual receiver.
222 if(item->pixmap(2)) 225 if(item->pixmap(2))
223 item->setPixmap(2,QPixmap()); 226 item->setPixmap(2,QPixmap());
224 else 227 else
225 item->setPixmap(2,Resource::loadPixmap("backup/check.png")); 228 item->setPixmap(2,Resource::loadPixmap("obex/check.png"));
226} 229}
227 230
228 231
229void SendWidget::closeEvent( QCloseEvent* e) { 232void SendWidget::closeEvent( QCloseEvent* evt) {
230 obexSendBase::closeEvent(e); 233 delete m_obex;
231 QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()"); 234 m_obex = NULL;
232 QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()"); 235 delete m_btobex;
236 m_btobex = NULL;
237 obexSendBase::closeEvent(evt);
238 {
239 QCopEnvelope e("QPE/IrDaApplet", "disableIrda()");
240 }
241 {
242 QCopEnvelope e("QPE/Bluetooth", "disableBluetooth()");
243 }
233} 244}
234 245
235void SendWidget::userDone() { 246void SendWidget::userDone() {
236 close(); 247 close();
237} 248}
238 249
239QString SendWidget::file()const { 250QString SendWidget::file()const {
240 return m_file; 251 return m_file;
241} 252}