summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2006-07-07 10:39:20 (UTC)
committer mickeyl <mickeyl>2006-07-07 10:39:20 (UTC)
commit043999046de3e7088ef386f18348ebe4484b0e65 (patch) (unidiff)
treec46908a6ccc183713b98c2ccbf4e0134c74d66b1
parent9fb74057cd43bf6ac0cb50c617f9146457367cbc (diff)
downloadopie-043999046de3e7088ef386f18348ebe4484b0e65.zip
opie-043999046de3e7088ef386f18348ebe4484b0e65.tar.gz
opie-043999046de3e7088ef386f18348ebe4484b0e65.tar.bz2
s/Resource/OResource/
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp10
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 9a30a0a..2512de3 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -1,125 +1,125 @@
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 <opie2/oresource.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, OResource::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(); 95 for (QStringList::ConstIterator it = list.begin();
96 it != list.end(); ++it ) { 96 it != list.end(); ++it ) {
97 int id = addReceiver(*it, "obex/irda.png"); 97 int id = addReceiver(*it, "obex/irda.png");
98 m_irDa.insert( id, (*it) ); 98 m_irDa.insert( id, (*it) );
99 } 99 }
100 irdaStatus->setText( tr("ready.")); 100 irdaStatus->setText( tr("ready."));
101 m_irDaIt = m_irDa.begin(); 101 m_irDaIt = m_irDa.begin();
102 102
103} 103}
104 104
105void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) { 105void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) {
106 for(QMap<QString, QString>::ConstIterator it = str.begin(); 106 for(QMap<QString, QString>::ConstIterator it = str.begin();
107 it != str.end(); ++it ) { 107 it != str.end(); ++it ) {
108 int id = addReceiver(it.key(), "obex/bt.png"); 108 int id = addReceiver(it.key(), "obex/bt.png");
109 m_bt.insert( id, Pair( it.key(), it.data() ) ); 109 m_bt.insert( id, Pair( it.key(), it.data() ) );
110 } 110 }
111 btStatus->setText(tr("ready.")); 111 btStatus->setText(tr("ready."));
112 m_btIt = m_bt.begin(); 112 m_btIt = m_bt.begin();
113 113
114} 114}
115void SendWidget::slotSelectedDevice( int, int ) { 115void SendWidget::slotSelectedDevice( int, int ) {
116/* if ( name == m_irDeSearch ) { 116/* if ( name == m_irDeSearch ) {
117 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 )
118 m_devBox->removeDevice( it.key() ); 118 m_devBox->removeDevice( it.key() );
119 119
120 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 120 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
121 }*/ 121 }*/
122} 122}
123void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) { 123void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
124 if ( str == "devices(QStringList)" ) { 124 if ( str == "devices(QStringList)" ) {
125 QDataStream stream( ar, IO_ReadOnly ); 125 QDataStream stream( ar, IO_ReadOnly );
@@ -177,76 +177,76 @@ void SendWidget::slotStartBt() {
177 ++m_btIt; 177 ++m_btIt;
178 if (m_btIt == m_bt.end() ) { 178 if (m_btIt == m_bt.end() ) {
179 btStatus->setText(tr("complete.")); 179 btStatus->setText(tr("complete."));
180 return; 180 return;
181 } 181 }
182 setReceiverStatus( m_btIt.key(), tr("Start sending") ); 182 setReceiverStatus( m_btIt.key(), tr("Start sending") );
183 m_btobex->send( m_file, m_btIt.data().second() ); 183 m_btobex->send( m_file, m_btIt.data().second() );
184} 184}
185 185
186void SendWidget::send_to_receivers() { 186void SendWidget::send_to_receivers() {
187 slotStartIrda(); 187 slotStartIrda();
188 slotStartBt(); 188 slotStartBt();
189} 189}
190 190
191void SendWidget::scan_for_receivers() 191void SendWidget::scan_for_receivers()
192{ 192{
193 receiverList->clear(); 193 receiverList->clear();
194 receivers.clear(); 194 receivers.clear();
195 sendButton->setDisabled( true ); 195 sendButton->setDisabled( true );
196 196
197 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) 197 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") )
198 { 198 {
199 irdaStatus->setText(tr("not enabled.")); 199 irdaStatus->setText(tr("not enabled."));
200 } 200 }
201 else 201 else
202 { 202 {
203 QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); 203 QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()");
204 irdaStatus->setText(tr("searching...")); 204 irdaStatus->setText(tr("searching..."));
205 sendButton->setEnabled( true ); 205 sendButton->setEnabled( true );
206 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 206 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
207 } 207 }
208 208
209 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) 209 if ( !QCopChannel::isRegistered("QPE/Bluetooth") )
210 { 210 {
211 btStatus->setText(tr("not enabled.")); 211 btStatus->setText(tr("not enabled."));
212 } 212 }
213 else 213 else
214 { 214 {
215 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); 215 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
216 btStatus->setText(tr("searching...")); 216 btStatus->setText(tr("searching..."));
217 sendButton->setEnabled( true ); 217 sendButton->setEnabled( true );
218 QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); 218 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
219 } 219 }
220} 220}
221 221
222void SendWidget::toggle_receiver(QListViewItem* item) 222void SendWidget::toggle_receiver(QListViewItem* item)
223{ 223{
224 // toggle the state of an individual receiver. 224 // toggle the state of an individual receiver.
225 if(item->pixmap(2)) 225 if (item->pixmap(2))
226 item->setPixmap(2,QPixmap()); 226 item->setPixmap(2, QPixmap());
227 else 227 else
228 item->setPixmap(2,Resource::loadPixmap("obex/check.png")); 228 item->setPixmap(2, OResource::loadPixmap("obex/check.png"));
229} 229}
230 230
231 231
232void SendWidget::closeEvent( QCloseEvent* evt) { 232void SendWidget::closeEvent( QCloseEvent* evt) {
233 delete m_obex; 233 delete m_obex;
234 m_obex = NULL; 234 m_obex = NULL;
235 delete m_btobex; 235 delete m_btobex;
236 m_btobex = NULL; 236 m_btobex = NULL;
237 obexSendBase::closeEvent(evt); 237 obexSendBase::closeEvent(evt);
238 { 238 {
239 QCopEnvelope e("QPE/IrDaApplet", "disableIrda()"); 239 QCopEnvelope e("QPE/IrDaApplet", "disableIrda()");
240 } 240 }
241 { 241 {
242 QCopEnvelope e("QPE/Bluetooth", "disableBluetooth()"); 242 QCopEnvelope e("QPE/Bluetooth", "disableBluetooth()");
243 } 243 }
244} 244}
245 245
246void SendWidget::userDone() { 246void SendWidget::userDone() {
247 close(); 247 close();
248} 248}
249 249
250QString SendWidget::file()const { 250QString SendWidget::file()const {
251 return m_file; 251 return m_file;
252} 252}
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 91ab2e1..8498afc 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -24,97 +24,97 @@
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29 29
30#include "bluezapplet.h" 30#include "bluezapplet.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/otaskbarapplet.h> 33#include <opie2/otaskbarapplet.h>
34#include <opie2/odevice.h> 34#include <opie2/odevice.h>
35#include <opie2/odebug.h> 35#include <opie2/odebug.h>
36#include <opie2/oresource.h> 36#include <opie2/oresource.h>
37#include <opie2/oprocess.h> 37#include <opie2/oprocess.h>
38#include <qpe/version.h> 38#include <qpe/version.h>
39#include <qpe/applnk.h> 39#include <qpe/applnk.h>
40#include <qpe/qcopenvelope_qws.h> 40#include <qpe/qcopenvelope_qws.h>
41#include <qpe/config.h> 41#include <qpe/config.h>
42using namespace Opie::Core; 42using namespace Opie::Core;
43 43
44/* QT */ 44/* QT */
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qpoint.h> 46#include <qpoint.h>
47#include <qpainter.h> 47#include <qpainter.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qframe.h> 49#include <qframe.h>
50#include <qpixmap.h> 50#include <qpixmap.h>
51#include <qstring.h> 51#include <qstring.h>
52#include <qtimer.h> 52#include <qtimer.h>
53#include <qpopupmenu.h> 53#include <qpopupmenu.h>
54#include <qmessagebox.h> 54#include <qmessagebox.h>
55 55
56/* STD */ 56/* STD */
57#include <device.h> 57#include <device.h>
58 58
59namespace OpieTooth { 59namespace OpieTooth {
60 BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { 60 BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) {
61 setFixedHeight( AppLnk::smallIconSize() ); 61 setFixedHeight( AppLnk::smallIconSize() );
62 setFixedWidth( AppLnk::smallIconSize() ); 62 setFixedWidth( AppLnk::smallIconSize() );
63#if OPIE_VERSION < 102010 63#if OPIE_VERSION < 102010
64 bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); 64 bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" );
65 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); 65 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" );
66 bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" ); 66 bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" );
67 bluezReceiveOnPixmap = Resource::loadPixmap( "bluetoothapplet/receive.png" ); 67 bluezReceiveOnPixmap = Resource::loadPixmap( "bluetoothapplet/receive.png" );
68#else 68#else
69 bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon ); 69 bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon );
70 bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon ); 70 bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon );
71 bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); 71 bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon );
72 bluezReceiveOnPixmap = Resource::loadImage( "bluetoothapplet/bluezonreceive", Opie::Core::OResource::SmallIcon ); 72 bluezReceiveOnPixmap = OResource::loadImage( "bluetoothapplet/bluezonreceive", Opie::Core::OResource::SmallIcon );
73#endif 73#endif
74 startTimer(2000); 74 startTimer(2000);
75 btDevice = 0; 75 btDevice = 0;
76 btManager = 0; 76 btManager = 0;
77 bluezactive = false; 77 bluezactive = false;
78 bluezDiscoveryActive = false; 78 bluezDiscoveryActive = false;
79 bluezReceiveActive = false; 79 bluezReceiveActive = false;
80 bluezReceiveChanged = false; 80 bluezReceiveChanged = false;
81 doListDevice = false; 81 doListDevice = false;
82 isScanning = false; 82 isScanning = false;
83 m_wasOn = false; 83 m_wasOn = false;
84 m_sync = false; 84 m_sync = false;
85 85
86 // TODO: determine whether this channel has to be closed at destruction time. 86 // TODO: determine whether this channel has to be closed at destruction time.
87 QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this ); 87 QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this );
88 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 88 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
89 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); 89 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
90 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); 90 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null");
91 } 91 }
92 92
93 BluezApplet::~BluezApplet() { 93 BluezApplet::~BluezApplet() {
94 if ( btDevice ) { 94 if ( btDevice ) {
95 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); 95 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null");
96 delete btDevice; 96 delete btDevice;
97 } 97 }
98 if ( btManager ) { 98 if ( btManager ) {
99 delete btManager; 99 delete btManager;
100 } 100 }
101 } 101 }
102 102
103 int BluezApplet::position() 103 int BluezApplet::position()
104 { 104 {
105 return 6; 105 return 6;
106 } 106 }
107 107
108 108
109 bool BluezApplet::checkBluezStatus() { 109 bool BluezApplet::checkBluezStatus() {
110 if (btDevice) { 110 if (btDevice) {
111 if (btDevice->isLoaded() ) { 111 if (btDevice->isLoaded() ) {
112 odebug << "btDevice isLoaded" << oendl; 112 odebug << "btDevice isLoaded" << oendl;
113 return true; 113 return true;
114 } else { 114 } else {
115 odebug << "btDevice is NOT loaded" << oendl; 115 odebug << "btDevice is NOT loaded" << oendl;
116 return false; 116 return false;
117 } 117 }
118 } else { 118 } else {
119 odebug << "btDevice is ZERO" << oendl; 119 odebug << "btDevice is ZERO" << oendl;
120 return false; 120 return false;