summaryrefslogtreecommitdiff
path: root/core/obex/obexsend.cpp
Unidiff
Diffstat (limited to 'core/obex/obexsend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 2931cf7..cf5d958 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -1,113 +1,115 @@
1#include <qpushbutton.h> 1#include <qpushbutton.h>
2#include <qlabel.h> 2#include <qlabel.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qtl.h> 6#include <qtl.h>
7 7
8#include <qcopchannel_qws.h> 8#include <qcopchannel_qws.h>
9 9
10#include <qpe/resource.h> 10#include <qpe/resource.h>
11#include <qpe/qcopenvelope_qws.h> 11#include <qpe/qcopenvelope_qws.h>
12 12
13#include "obex.h" 13#include "obex.h"
14#include "obexsend.h" 14#include "obexsend.h"
15 15
16using namespace OpieObex; 16using namespace OpieObex;
17 17
18/* TRANSLATOR OpieObex::SendWidget */
19
18 20
19SendWidget::SendWidget( QWidget* parent, const char* name ) 21SendWidget::SendWidget( QWidget* parent, const char* name )
20 : QWidget( parent, name ) { 22 : QWidget( parent, name ) {
21 initUI(); 23 initUI();
22} 24}
23SendWidget::~SendWidget() { 25SendWidget::~SendWidget() {
24} 26}
25void SendWidget::initUI() { 27void SendWidget::initUI() {
26 m_obex = new Obex(this, "obex"); 28 m_obex = new Obex(this, "obex");
27 connect(m_obex, SIGNAL(error(int) ), 29 connect(m_obex, SIGNAL(error(int) ),
28 this, SLOT(slotIrError(int) ) ); 30 this, SLOT(slotIrError(int) ) );
29 connect(m_obex, SIGNAL(sent(bool) ), 31 connect(m_obex, SIGNAL(sent(bool) ),
30 this, SLOT(slotIrSent(bool) ) ); 32 this, SLOT(slotIrSent(bool) ) );
31 connect(m_obex, SIGNAL(currentTry(unsigned int ) ), 33 connect(m_obex, SIGNAL(currentTry(unsigned int ) ),
32 this, SLOT(slotIrTry(unsigned int ) ) ); 34 this, SLOT(slotIrTry(unsigned int ) ) );
33 35
34 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this ); 36 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
35 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 37 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
36 this, SLOT(dispatchIrda(const QCString&, const QByteArray& ) ) ); 38 this, SLOT(dispatchIrda(const QCString&, const QByteArray& ) ) );
37 39
38 chan = new QCopChannel("QPE/BluetoothBack", this ); 40 chan = new QCopChannel("QPE/BluetoothBack", this );
39 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 41 connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
40 this, SLOT(dispatchBt(const QCString&, const QByteArray& ) ) ); 42 this, SLOT(dispatchBt(const QCString&, const QByteArray& ) ) );
41 43
42 QVBoxLayout* lay = new QVBoxLayout(this); 44 QVBoxLayout* lay = new QVBoxLayout(this);
43 45
44 QHBox* nameBox = new QHBox(this); 46 QHBox* nameBox = new QHBox(this);
45 QLabel* name = new QLabel(nameBox); 47 QLabel* name = new QLabel(nameBox);
46 name->setText( tr("<qt><h1>Sending:</h1></qt>") ); 48 name->setText( tr("<qt><h1>Sending:</h1></qt>") );
47 name->setAlignment( AlignLeft | AlignTop ); 49 name->setAlignment( AlignLeft | AlignTop );
48 m_lblFile = new QLabel(nameBox); 50 m_lblFile = new QLabel(nameBox);
49 lay->addWidget(nameBox, 0); 51 lay->addWidget(nameBox, 0);
50 52
51 QFrame* frame = new QFrame(this); 53 QFrame* frame = new QFrame(this);
52 frame->setFrameShape( QFrame::HLine ); 54 frame->setFrameShape( QFrame::HLine );
53 frame->setFrameShadow( QFrame::Sunken ); 55 frame->setFrameShadow( QFrame::Sunken );
54 lay->addWidget(frame, 10); 56 lay->addWidget(frame, 10);
55 57
56 QLabel* devices = new QLabel(this); 58 QLabel* devices = new QLabel(this);
57 devices->setText("<qt><b>Devices:</b></qt>"); 59 devices->setText("<qt><b>Devices:</b></qt>");
58 devices->setAlignment( AlignLeft | AlignTop ); 60 devices->setAlignment( AlignLeft | AlignTop );
59 lay->addWidget( devices,10 ); 61 lay->addWidget( devices,10 );
60 62
61 m_devBox = new DeviceBox(this); 63 m_devBox = new DeviceBox(this);
62 lay->addWidget( m_devBox, 50 ); 64 lay->addWidget( m_devBox, 50 );
63 connect(m_devBox, SIGNAL(selectedDevice(int, int ) ), 65 connect(m_devBox, SIGNAL(selectedDevice(int, int ) ),
64 this, SLOT(slotSelectedDevice(int, int) ) ); 66 this, SLOT(slotSelectedDevice(int, int) ) );
65 67
66 QPushButton *but = new QPushButton(this); 68 QPushButton *but = new QPushButton(this);
67 but->setText(tr("Done") ); 69 but->setText(tr("Done") );
68 connect(but, SIGNAL(clicked() ), 70 connect(but, SIGNAL(clicked() ),
69 this, SLOT(slotDone() ) ); 71 this, SLOT(slotDone() ) );
70 72
71 lay->addWidget( but ); 73 lay->addWidget( but );
72 m_lay = lay; 74 m_lay = lay;
73 75
74 // QT does not like if you add items to an layout which already exits.... 76 // QT does not like if you add items to an layout which already exits....
75 // and was layouted invalidate() does not help too 77 // and was layouted invalidate() does not help too
76 // so we use RichText.... 78 // so we use RichText....
77} 79}
78 80
79/* 81/*
80 * in send we'll first set everything up 82 * in send we'll first set everything up
81 * and then wait for a list of devices. 83 * and then wait for a list of devices.
82 */ 84 */
83void SendWidget::send( const QString& file, const QString& desc ) { 85void SendWidget::send( const QString& file, const QString& desc ) {
84 m_file = file; 86 m_file = file;
85 m_irDa.clear(); 87 m_irDa.clear();
86 m_start = 0; 88 m_start = 0;
87 m_lblFile->setText(desc.isEmpty() ? file : desc ); 89 m_lblFile->setText(desc.isEmpty() ? file : desc );
88 90
89 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) { 91 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) {
90 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error ); 92 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error );
91 m_start++; 93 m_start++;
92 }else 94 }else
93 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search ); 95 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search );
94 96
95 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) { 97 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) {
96 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error ); 98 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error );
97 m_start++; 99 m_start++;
98 }else 100 }else
99 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search ); 101 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search );
100 102
101 if (m_start != 2 ) { 103 if (m_start != 2 ) {
102 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()"); 104 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()");
103 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); 105 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
104 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 106 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
105 QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); 107 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
106 } 108 }
107} 109}
108void SendWidget::slotIrDaDevices( const QStringList& list) { 110void SendWidget::slotIrDaDevices( const QStringList& list) {
109 qWarning("slot it irda devices "); 111 qWarning("slot it irda devices ");
110 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { 112 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
111 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") ); 113 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") );
112 m_irDa.insert( id, (*it) ); 114 m_irDa.insert( id, (*it) );
113 } 115 }