summaryrefslogtreecommitdiff
Unidiff
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
@@ -31,14 +31,13 @@ BtObex::BtObex( QObject *parent, const char* name )
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;
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
@@ -89,24 +89,26 @@ bool SendWidget::receiverSelected(int id)
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}
@@ -136,25 +138,26 @@ void SendWidget::slotIrSent( bool b) {
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 :("));
@@ -168,13 +171,13 @@ void SendWidget::slotBtSent( bool b) {
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() );
@@ -219,20 +222,28 @@ void SendWidget::scan_for_receivers()
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