summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/obex/obex.cpp187
-rw-r--r--core/obex/obex.h84
-rw-r--r--core/obex/obex.pro5
-rw-r--r--core/obex/obexsend.cpp234
-rw-r--r--core/obex/obexsend.h98
-rw-r--r--core/obex/obexsendbase.cpp299
-rw-r--r--core/obex/obexsendbase.h54
7 files changed, 959 insertions, 2 deletions
diff --git a/core/obex/obex.cpp b/core/obex/obex.cpp
new file mode 100644
index 0000000..36634ec
--- a/dev/null
+++ b/core/obex/obex.cpp
@@ -0,0 +1,187 @@
1
2#include "obex.h"
3
4/* OPIE */
5#include <opie2/oprocess.h>
6#include <opie2/odebug.h>
7
8/* QT */
9#include <qfileinfo.h>
10
11
12
13using namespace OpieObex;
14
15using namespace Opie::Core;
16/* TRANSLATOR OpieObex::Obex */
17
18Obex::Obex( QObject *parent, const char* name )
19 : QObject(parent, name )
20{
21 m_rec = 0;
22 m_send=0;
23 m_count = 0;
24 m_receive = false;
25 connect( this, SIGNAL(error(int) ), // for recovering to receive
26 SLOT(slotError() ) );
27 connect( this, SIGNAL(sent(bool) ),
28 SLOT(slotError() ) );
29};
30Obex::~Obex() {
31 delete m_rec;
32 delete m_send;
33}
34void Obex::receive() {
35 m_receive = true;
36 m_outp = QString::null;
37 m_rec = new OProcess();
38 *m_rec << "irobex_palm3";
39 // connect to the necessary slots
40 connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ),
41 this, SLOT(slotExited(Opie::Core::OProcess*) ) );
42
43 connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
44 this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
45
46 if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
47 emit done( false );
48 delete m_rec;
49 m_rec = 0;
50 }
51}
52
53void Obex::send( const QString& fileName) { // if currently receiving stop it send receive
54 m_count = 0;
55 m_file = fileName;
56 if (m_rec != 0 ) {
57 if (m_rec->isRunning() ) {
58 emit error(-1 );
59 delete m_rec;
60 m_rec = 0;
61
62 }else{
63 emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
64 return;
65 }
66 }
67 sendNow();
68}
69void Obex::sendNow(){
70 if ( m_count >= 25 ) { // could not send
71 emit error(-1 );
72 emit sent(false);
73 return;
74 }
75 // OProcess inititialisation
76 m_send = new OProcess();
77 m_send->setWorkingDirectory( QFileInfo(m_file).dirPath(true) );
78
79 *m_send << "irobex_palm3";
80 *m_send << QFile::encodeName(QFileInfo(m_file).fileName());
81
82 // connect to slots Exited and and StdOut
83 connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ),
84 this, SLOT(slotExited(Opie::Core::OProcess*)) );
85 connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )),
86 this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
87
88 // now start it
89 if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
90 m_count = 25;
91 emit error(-1 );
92 delete m_send;
93 m_send=0;
94 }
95 // end
96 m_count++;
97 emit currentTry( m_count );
98}
99
100void Obex::slotExited(OProcess* proc ){
101 if (proc == m_rec ) // receive process
102 received();
103 else if ( proc == m_send )
104 sendEnd();
105
106}
107void Obex::slotStdOut(OProcess* proc, char* buf, int len){
108 if ( proc == m_rec ) { // only receive
109 QByteArray ar( len );
110 memcpy( ar.data(), buf, len );
111 m_outp.append( ar );
112 }
113}
114
115void Obex::received() {
116 if (m_rec->normalExit() ) {
117 if ( m_rec->exitStatus() == 0 ) { // we got one
118 QString filename = parseOut();
119 emit receivedFile( filename );
120 }
121 }else{
122 emit done(false);
123 };
124 delete m_rec;
125 m_rec = 0;
126 receive();
127}
128
129void Obex::sendEnd() {
130 if (m_send->normalExit() ) {
131 if ( m_send->exitStatus() == 0 ) {
132 delete m_send;
133 m_send=0;
134 emit sent(true);
135 }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready
136 // let's try it again
137 delete m_send;
138 m_send = 0;
139 sendNow();
140 }
141 }else {
142 emit error( -1 );
143 delete m_send;
144 m_send = 0;
145 }
146}
147QString Obex::parseOut( ){
148 QString path;
149 QStringList list = QStringList::split("\n", m_outp);
150 QStringList::Iterator it;
151 for (it = list.begin(); it != list.end(); ++it ) {
152 if ( (*it).startsWith("Wrote" ) ) {
153 int pos = (*it).findRev('(' );
154 if ( pos > 0 ) {
155
156 path = (*it).remove( pos, (*it).length() - pos );
157 path = path.mid(6 );
158 path = path.stripWhiteSpace();
159 }
160 }
161 }
162 return path;
163}
164/**
165 * when sent is done slotError is called we will start receive again
166 */
167void Obex::slotError() {
168 if ( m_receive )
169 receive();
170};
171void Obex::setReceiveEnabled( bool receive ) {
172 if ( !receive ) { //
173 m_receive = false;
174 shutDownReceive();
175 }
176}
177
178void Obex::shutDownReceive() {
179 if (m_rec != 0 ) {
180 if (m_rec->isRunning() ) {
181 emit error(-1 );
182 delete m_rec;
183 m_rec = 0;
184 }
185 }
186
187}
diff --git a/core/obex/obex.h b/core/obex/obex.h
new file mode 100644
index 0000000..5993976
--- a/dev/null
+++ b/core/obex/obex.h
@@ -0,0 +1,84 @@
1
2
3#ifndef OpieObex_H
4#define OpieObex_H
5
6#include <qobject.h>
7
8namespace Opie {namespace Core {class OProcess;}}
9class QCopChannel;
10namespace OpieObex {
11 class Obex : public QObject {
12 Q_OBJECT
13 public:
14 /**
15 * Obex c'tor look
16 */
17 Obex( QObject *parent, const char* name);
18 /**
19 * d'tor
20 */
21 ~Obex();
22
23 /**
24 * Starting listening to irda after enabled by the applet
25 * a signal gets emitted when received a file
26 */
27 void receive();
28 void send( const QString& );
29 void setReceiveEnabled( bool = false );
30 signals:
31
32 /**
33 * a signal
34 * @param path The path to the received file
35 */
36 void receivedFile( const QString& path);
37 /**
38 * error signal if the program couldn't be started or the
39 * the connection timed out
40 */
41 void error( int );
42 /**
43 * The current try to receive data
44 */
45 void currentTry(unsigned int);
46 /**
47 * signal sent The file got beamed to the remote location
48 */
49 void sent(bool);
50 void done(bool);
51
52 private:
53 uint m_count;
54 QString m_file;
55 QString m_outp;
56 Opie::Core::OProcess *m_send;
57 Opie::Core::OProcess *m_rec;
58 bool m_receive : 1;
59 void shutDownReceive();
60
61private slots:
62
63 /**
64 * send over palm obex
65 */
66
67 //void send(const QString&);
68
69 // the process exited
70 void slotExited(Opie::Core::OProcess* proc) ;
71 void slotStdOut(Opie::Core::OProcess*, char*, int);
72 void slotError();
73
74 private:
75 void sendNow();
76 QString parseOut();
77 void received();
78 void sendEnd();
79
80 };
81};
82
83
84#endif
diff --git a/core/obex/obex.pro b/core/obex/obex.pro
index 1f4f486..d6b527c 100644
--- a/core/obex/obex.pro
+++ b/core/obex/obex.pro
@@ -1,11 +1,12 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 HEADERS = btobex.h obexhandler.h receiver.h obeximpl.h 3 HEADERS= obex.h btobex.h obexhandler.h obexsend.h receiver.h obeximpl.h
4 SOURCES = btobex.cpp obexhandler.cpp receiver.cpp obeximpl.cpp 4 SOURCES= obex.cpp btobex.cpp obexsend.cpp obexhandler.cpp receiver.cpp obeximpl.cpp
5 TARGET = opieobex 5 TARGET = opieobex
6 DESTDIR = $(OPIEDIR)/plugins/obex 6 DESTDIR = $(OPIEDIR)/plugins/obex
7INTERFACES = obexsendbase.ui 7INTERFACES = obexsendbase.ui
8INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher 8INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher
9DEPENDPATH +=
9 LIBS += -lqpe -lopiecore2 10 LIBS += -lqpe -lopiecore2
10 VERSION = 0.0.3 11 VERSION = 0.0.3
11 12
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
new file mode 100644
index 0000000..a80a48b
--- a/dev/null
+++ b/core/obex/obexsend.cpp
@@ -0,0 +1,234 @@
1// 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one
2// generated via QT2 Designer. The new form supports
3// selection of target devices, as opposed to sending to
4// all.
5
6#include "obex.h"
7#include "btobex.h"
8#include "obexsend.h"
9using namespace OpieObex;
10
11/* OPIE */
12#include <opie2/odebug.h>
13#include <qpe/qcopenvelope_qws.h>
14#include <qpe/resource.h>
15
16using namespace Opie::Core;
17
18/* QT */
19#include <qlabel.h>
20#include <qpixmap.h>
21#include <qlistview.h>
22#include <qtimer.h>
23
24/* TRANSLATOR OpieObex::SendWidget */
25
26SendWidget::SendWidget( QWidget* parent, const char* name )
27 : obexSendBase( parent, name ) {
28 initUI();
29}
30SendWidget::~SendWidget() {
31}
32void SendWidget::initUI() {
33 m_obex = new Obex(this, "obex");
34 connect(m_obex, SIGNAL(error(int) ),
35 this, SLOT(slotIrError(int) ) );
36 connect(m_obex, SIGNAL(sent(bool) ),
37 this, SLOT(slotIrSent(bool) ) );
38 connect(m_obex, SIGNAL(currentTry(unsigned int) ),
39 this, SLOT(slotIrTry(unsigned int) ) );
40
41 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
42 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
43 this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) );
44
45 m_btobex = new BtObex(this, "btobex");
46 connect(m_btobex, SIGNAL(error(int) ),
47 this, SLOT(slotBtError(int) ) );
48 connect(m_btobex, SIGNAL(sent(bool) ),
49 this, SLOT(slotBtSent(bool) ) );
50 connect(m_btobex, SIGNAL(currentTry(unsigned int) ),
51 this, SLOT(slotBtTry(unsigned int) ) );
52
53 chan = new QCopChannel("QPE/BluetoothBack", this );
54 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
55 this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) );
56
57}
58
59/*
60 * in send we'll first set everything up
61 * and then wait for a list of devices.
62 */
63void SendWidget::send( const QString& file, const QString& desc ) {
64 m_file = file;
65 m_irDa.clear();
66 m_start = 0;
67
68 fileToSend->setText(desc.isEmpty() ? file : desc );
69 scan_for_receivers();
70}
71
72int SendWidget::addReceiver(const char *r, const char *icon)
73{
74 QListViewItem * item = new QListViewItem( receiverList, 0 );
75 item->setText( 0, r);
76 item->setPixmap( 1, Resource::loadPixmap( icon ) );
77
78 int id=receivers.count();
79 receivers[id]=item;
80 return id;
81}
82
83bool SendWidget::receiverSelected(int id)
84{
85 return receivers[id]->pixmap(2);
86}
87
88void SendWidget::setReceiverStatus( int id, const QString& status ) {
89 if ( !receivers.contains(id) ) return;
90 receivers[id]->setText(3, status );
91}
92
93void SendWidget::slotIrDaDevices( const QStringList& list) {
94 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
95 int id = addReceiver(*it, "obex/irda.png");
96 m_irDa.insert( id, (*it) );
97 }
98 irdaStatus->setText( tr("ready."));
99 m_irDaIt = m_irDa.begin();
100
101}
102
103void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) {
104 for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) {
105 int id = addReceiver(it.key(), "obex/bt.png");
106 m_bt.insert( id, Pair( it.key(), it.data() ) );
107 }
108 btStatus->setText(tr("ready."));
109 m_btIt = m_bt.begin();
110
111}
112void SendWidget::slotSelectedDevice( int, int ) {
113/* if ( name == m_irDeSearch ) {
114 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it )
115 m_devBox->removeDevice( it.key() );
116
117 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
118 }*/
119}
120void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
121 if ( str == "devices(QStringList)" ) {
122 QDataStream stream( ar, IO_ReadOnly );
123 QStringList list;
124 stream >> list;
125 slotIrDaDevices( list );
126 }
127}
128void SendWidget::slotIrError( int ) {
129 irdaStatus->setText(tr("error :("));
130}
131void SendWidget::slotIrSent( bool b) {
132 QString text = b ? tr("Sent") : tr("Failure");
133 setReceiverStatus( m_irDaIt.key(), text );
134 ++m_irDaIt;
135 slotStartIrda();
136}
137void SendWidget::slotIrTry(unsigned int trI) {
138 setReceiverStatus(m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) ));
139}
140void SendWidget::slotStartIrda() {
141 if (m_irDaIt == m_irDa.end() ) {
142 irdaStatus->setText(tr("complete."));
143 return;
144 }
145 setReceiverStatus( m_irDaIt.key(), tr("Start sending") );
146 m_obex->send( m_file );
147}
148
149void SendWidget::dispatchBt( const QCString& str, const QByteArray& ar ) {
150 if ( str == "devices(QStringMap)" ) {
151 QDataStream stream( ar, IO_ReadOnly );
152 QMap<QString, QString> btmap;
153 stream >> btmap;
154 slotBTDevices( btmap );
155 }
156}
157void SendWidget::slotBtError( int ) {
158 btStatus->setText(tr("error :("));
159}
160void SendWidget::slotBtSent( bool b) {
161 QString text = b ? tr("Sent") : tr("Failure");
162 setReceiverStatus( m_btIt.key(), text );
163 ++m_btIt;
164 slotStartBt();
165}
166void SendWidget::slotBtTry(unsigned int trI) {
167 setReceiverStatus( m_btIt.key(), tr("Try %1").arg( QString::number( trI ) ) );
168}
169void SendWidget::slotStartBt() {
170 // skip past unselected receivers
171 while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key()))
172 ++m_btIt;
173 if (m_btIt == m_bt.end() ) {
174 btStatus->setText(tr("complete."));
175 return;
176 }
177 setReceiverStatus( m_btIt.key(), tr("Start sending") );
178 m_btobex->send( m_file, m_btIt.data().second() );
179}
180
181void SendWidget::send_to_receivers() {
182 slotStartIrda();
183 slotStartBt();
184}
185
186void SendWidget::scan_for_receivers() {
187
188 bool enable_irda=false;
189 bool enable_bt=false;
190
191 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) {
192 irdaStatus->setText(tr("not enabled."));
193 enable_irda=true;
194 } else
195 irdaStatus->setText(tr("searching..."));
196
197 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) {
198 btStatus->setText(tr("not enabled."));
199 enable_bt=true;
200 } else
201 btStatus->setText(tr("searching..."));
202
203 if (enable_irda)
204 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()");
205 if (enable_bt)
206 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
207
208 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
209 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
210
211}
212
213void SendWidget::toggle_receiver(QListViewItem* item)
214{
215 // toggle the state of an individual receiver.
216 if(item->pixmap(2))
217 item->setPixmap(2,QPixmap());
218 else
219 item->setPixmap(2,Resource::loadPixmap("backup/check.png"));
220}
221
222
223void SendWidget::closeEvent( QCloseEvent* e) {
224 e->accept(); // make sure
225 QTimer::singleShot(0, this, SLOT(userDone() ) );
226}
227void SendWidget::userDone() {
228 QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()");
229 QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()");
230 emit done();
231}
232QString SendWidget::file()const {
233 return m_file;
234}
diff --git a/core/obex/obexsend.h b/core/obex/obexsend.h
new file mode 100644
index 0000000..030e180
--- a/dev/null
+++ b/core/obex/obexsend.h
@@ -0,0 +1,98 @@
1#ifndef OPIE_OBEX_SEND_WIDGET_H
2#define OPIE_OBEX_SEND_WIDGET_H
3
4// 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one
5// generated via QT2 Designer. The new form supports
6// selection of target devices, as opposed to sending to
7// all.
8
9#include <qstring.h>
10#include <qstringlist.h>
11#include <qmap.h>
12#include "obexsendbase.h"
13
14class QLabel;
15class QVBoxLayout;
16/**
17 * This is the new sending widget for Obex
18 * It will attemp to smart and be able to send
19 * it to multiple (selected) devices.
20 * It'll support BT + IrDa
21 */
22namespace OpieObex {
23 class Obex;
24 class BtObex;
25
26 struct Pair {
27 Pair(const QString& first = QString::null,
28 const QString& second = QString::null)
29 : m_first(first), m_second(second ) {
30 }
31 QString first()const{ return m_first; }
32 QString second()const { return m_second; }
33 private:
34 QString m_first;
35 QString m_second;
36 };
37 class SendWidget : public obexSendBase {
38 Q_OBJECT
39 public:
40 SendWidget( QWidget* parent = 0, const char* name = 0);
41 ~SendWidget();
42
43 QString file()const;
44
45 protected:
46 void closeEvent( QCloseEvent* );
47
48 public slots:
49 void send( const QString& file, const QString& desc );
50
51 signals:
52 void done();
53
54 protected slots:
55 virtual void userDone();
56 virtual void send_to_receivers();
57 virtual void scan_for_receivers();
58 virtual void toggle_receiver(QListViewItem* item);
59
60 private slots: // QCOP slots
61 /* IrDa Names*/
62 void slotIrDaDevices( const QStringList& );
63 /* Bt Names + BD-Addr */
64 void slotBTDevices( const QMap<QString, QString>& );
65 void slotSelectedDevice( int id, int dev );
66
67 void dispatchIrda( const QCString& str, const QByteArray& ar );
68
69 void slotIrError( int );
70 void slotIrSent(bool);
71 void slotIrTry(unsigned int );
72 void slotStartIrda();
73
74 void dispatchBt( const QCString& str, const QByteArray& ar );
75 void slotBtError( int );
76 void slotBtSent(bool);
77 void slotBtTry(unsigned int );
78 void slotStartBt();
79
80 private:
81 void initUI();
82 int addReceiver(const char *r, const char *icon);
83 void setReceiverStatus( int id, const QString& status );
84 bool receiverSelected(int id);
85
86 int m_start;
87 QMap<int, QString> m_irDa;
88 QMap<int, QString>::Iterator m_irDaIt;
89 QMap<int, Pair > m_bt;
90 QMap<int, Pair>::Iterator m_btIt;
91 QMap<int, QListViewItem *> receivers;
92 QString m_file;
93 Obex* m_obex;
94 BtObex* m_btobex;
95 };
96}
97
98#endif
diff --git a/core/obex/obexsendbase.cpp b/core/obex/obexsendbase.cpp
new file mode 100644
index 0000000..ae6443c
--- a/dev/null
+++ b/core/obex/obexsendbase.cpp
@@ -0,0 +1,299 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'obexsendbase.ui'
3**
4** Created: Fri Aug 5 00:20:45 2005
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "obexsendbase.h"
10
11#include <qheader.h>
12#include <qlabel.h>
13#include <qlistview.h>
14#include <qpushbutton.h>
15#include <qlayout.h>
16#include <qvariant.h>
17#include <qtooltip.h>
18#include <qwhatsthis.h>
19#include <qimage.h>
20#include <qpixmap.h>
21
22static const char* const image0_data[] = {
23"14 14 4 1",
24". c None",
25"b c #000000",
26"a c #c00000",
27"# c #ff0000",
28"..............",
29"...#a.........",
30"....###.......",
31"......a##.....",
32"..#a....a#....",
33"...##a...a#...",
34".....##...#...",
35"..#a..a#..a#..",
36"...##..#a..#..",
37"....a#..#..#a.",
38".bb..#a.#a..#.",
39".bbb..#..#....",
40".bbb..........",
41".............."};
42
43static const char* const image1_data[] = {
44"14 18 107 2",
45"Qt c None",
46".8 c #000000",
47"#t c #000102",
48"#K c #000104",
49"#D c #00040c",
50"#O c #00050f",
51"#N c #000d24",
52"#M c #000f2a",
53"#L c #001130",
54"#j c #00163d",
55"#J c #001c52",
56"#s c #002770",
57"#C c #002772",
58".F c #002d7f",
59"#c c #00338f",
60"#I c #003699",
61"#B c #0038a3",
62"#E c #003aa5",
63"#A c #003cac",
64"#r c #003cad",
65"## c #003da7",
66".4 c #003da9",
67"#h c #003ead",
68"#q c #003eb0",
69".7 c #003fb1",
70".N c #003fb3",
71".V c #0040b2",
72"#z c #0042b9",
73".5 c #0042ba",
74".U c #0043bb",
75"#a c #0043bd",
76"#F c #0043c0",
77".W c #0044be",
78"#w c #0044c4",
79"#H c #0045c6",
80"#m c #0046c7",
81".L c #0048ca",
82".M c #0049ce",
83"#i c #0049d1",
84"#v c #004ad6",
85".6 c #004bd6",
86".X c #004cd8",
87"#G c #004cd9",
88"#b c #004cda",
89"#l c #004cdb",
90".B c #004edf",
91".D c #004fe1",
92".C c #0050e4",
93".E c #0052e9",
94"#p c #013eab",
95".Y c #0141b7",
96".w c #014dda",
97"#u c #014ede",
98"#k c #0150e3",
99".i c #0151e4",
100".p c #0153ea",
101".h c #0156f2",
102".b c #0156f3",
103".9 c #0256f1",
104".g c #0256f2",
105"#e c #054dd2",
106".a c #0558f2",
107".2 c #0659f3",
108".Z c #075af2",
109".S c #075af3",
110".1 c #0b5df3",
111".# c #0d5ff3",
112".R c #0e60f4",
113".x c #105fef",
114".0 c #1061f2",
115".O c #1263f4",
116".G c #1464f1",
117".c c #1563ed",
118".3 c #1652bc",
119".K c #165ad7",
120".q c #1764ec",
121".j c #1865ec",
122".d c #1d69ee",
123"#y c #1e59c6",
124".J c #206df6",
125".Q c #226ff6",
126".T c #2365dd",
127".y c #256fef",
128".P c #2672f6",
129"#x c #2967d8",
130"#d c #296ded",
131".k c #2a74f1",
132".r c #2b75f2",
133".H c #2d77f5",
134".I c #347df9",
135".l c #357ef7",
136".z c #3780f8",
137".t c #3f84f9",
138"#o c #4876c8",
139".s c #498af8",
140".e c #4c88f5",
141".o c #4c88f6",
142"#g c #4e79c5",
143".v c #4f8af7",
144"#n c #5086e9",
145"#f c #5087eb",
146".f c #5890f7",
147"#. c #5c90f1",
148".u c #5d95f8",
149".m c #5e95f8",
150".A c #6b9df8",
151".n c #ffffff",
152"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
153"QtQtQtQtQt.#.a.bQtQtQtQtQtQt",
154"QtQtQt.c.d.e.f.g.h.iQtQtQtQt",
155"QtQt.j.k.l.m.n.o.b.b.pQtQtQt",
156"Qt.q.r.s.t.u.n.n.v.b.h.wQtQt",
157".x.y.z.n.n.A.n.B.n.C.D.E.FQt",
158".G.H.I.J.n.n.n.n.K.L.M.B.NQt",
159".O.P.Q.R.S.n.n.T.U.V.W.X.YQt",
160".Z.0.1.2.n.n.n.n.3.4.5.6.7.8",
161".h.9.b.n.n#..n.B.n###a#b#cQt",
162"Qt.b.b#d#e#f.n.n#g#h#a#i#jQt",
163"Qt#k.b#l#m#n.n#o#p#q#r#s#tQt",
164"QtQt#u#v#w#x#y#z#A#B#C#DQtQt",
165"QtQtQt#E#F.B#G#H#I#J#KQtQtQt",
166"QtQtQtQtQt#L#M#N#O.8QtQtQtQt",
167"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
168"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
169"QtQtQtQtQtQtQtQtQtQtQtQtQtQt"};
170
171
172/*
173 * Constructs a obexSendBase which is a child of 'parent', with the
174 * name 'name' and widget flags set to 'f'
175 */
176obexSendBase::obexSendBase( QWidget* parent, const char* name, WFlags fl )
177 : QWidget( parent, name, fl )
178{
179 QPixmap image0( ( const char** ) image0_data );
180 QPixmap image1( ( const char** ) image1_data );
181 if ( !name )
182 setName( "obexSendBase" );
183 resize( 363, 221 );
184 setCaption( tr( "Send via OBEX" ) );
185 obexSendBaseLayout = new QVBoxLayout( this );
186 obexSendBaseLayout->setSpacing( 6 );
187 obexSendBaseLayout->setMargin( 11 );
188
189 Layout1 = new QHBoxLayout;
190 Layout1->setSpacing( 6 );
191 Layout1->setMargin( 0 );
192
193 sendLabel = new QLabel( this, "sendLabel" );
194 sendLabel->setText( tr( "Sending:" ) );
195 Layout1->addWidget( sendLabel );
196
197 fileToSend = new QLabel( this, "fileToSend" );
198 fileToSend->setText( tr( "Unknown" ) );
199 Layout1->addWidget( fileToSend );
200 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
201 Layout1->addItem( spacer );
202 obexSendBaseLayout->addLayout( Layout1 );
203
204 Layout4 = new QHBoxLayout;
205 Layout4->setSpacing( 6 );
206 Layout4->setMargin( 0 );
207
208 irdaLabel = new QLabel( this, "irdaLabel" );
209 irdaLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, irdaLabel->sizePolicy().hasHeightForWidth() ) );
210 irdaLabel->setText( tr( "" ) );
211 irdaLabel->setPixmap( image0 );
212 Layout4->addWidget( irdaLabel );
213
214 irdaStatus = new QLabel( this, "irdaStatus" );
215 irdaStatus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, irdaStatus->sizePolicy().hasHeightForWidth() ) );
216 irdaStatus->setText( tr( "Unknown" ) );
217 Layout4->addWidget( irdaStatus );
218
219 btLabel = new QLabel( this, "btLabel" );
220 btLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)1, btLabel->sizePolicy().hasHeightForWidth() ) );
221 btLabel->setText( tr( "" ) );
222 btLabel->setPixmap( image1 );
223 Layout4->addWidget( btLabel );
224
225 btStatus = new QLabel( this, "btStatus" );
226 btStatus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, btStatus->sizePolicy().hasHeightForWidth() ) );
227 btStatus->setText( tr( "Unknown" ) );
228 Layout4->addWidget( btStatus );
229 obexSendBaseLayout->addLayout( Layout4 );
230
231 receiverList = new QListView( this, "receiverList" );
232 receiverList->addColumn( tr( "Receiver" ) );
233 receiverList->header()->setClickEnabled( FALSE, receiverList->header()->count() - 1 );
234 receiverList->header()->setResizeEnabled( FALSE, receiverList->header()->count() - 1 );
235 receiverList->addColumn( tr( "T" ) );
236 receiverList->header()->setClickEnabled( FALSE, receiverList->header()->count() - 1 );
237 receiverList->header()->setResizeEnabled( FALSE, receiverList->header()->count() - 1 );
238 receiverList->addColumn( tr( "S" ) );
239 receiverList->header()->setClickEnabled( FALSE, receiverList->header()->count() - 1 );
240 receiverList->header()->setResizeEnabled( FALSE, receiverList->header()->count() - 1 );
241 receiverList->addColumn( tr( "Status" ) );
242 receiverList->header()->setClickEnabled( FALSE, receiverList->header()->count() - 1 );
243 receiverList->header()->setResizeEnabled( FALSE, receiverList->header()->count() - 1 );
244 obexSendBaseLayout->addWidget( receiverList );
245
246 Layout3 = new QHBoxLayout;
247 Layout3->setSpacing( 6 );
248 Layout3->setMargin( 0 );
249 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
250 Layout3->addItem( spacer_2 );
251
252 scanButton = new QPushButton( this, "scanButton" );
253 scanButton->setText( tr( "Scan" ) );
254 Layout3->addWidget( scanButton );
255
256 sendButton = new QPushButton( this, "sendButton" );
257 sendButton->setText( tr( "Send" ) );
258 Layout3->addWidget( sendButton );
259
260 doneButton = new QPushButton( this, "doneButton" );
261 doneButton->setText( tr( "Done" ) );
262 Layout3->addWidget( doneButton );
263 obexSendBaseLayout->addLayout( Layout3 );
264
265 // signals and slots connections
266 connect( scanButton, SIGNAL( clicked() ), this, SLOT( scan_for_receivers() ) );
267 connect( sendButton, SIGNAL( clicked() ), this, SLOT( send_to_receivers() ) );
268 connect( doneButton, SIGNAL( clicked() ), this, SLOT( userDone() ) );
269 connect( receiverList, SIGNAL( clicked(QListViewItem*) ), this, SLOT( toggle_receiver(QListViewItem *) ) );
270}
271
272/*
273 * Destroys the object and frees any allocated resources
274 */
275obexSendBase::~obexSendBase()
276{
277 // no need to delete child widgets, Qt does it all for us
278}
279
280void obexSendBase::scan_for_receivers()
281{
282 qWarning( "obexSendBase::scan_for_receivers(): Not implemented yet!" );
283}
284
285void obexSendBase::send_to_receivers()
286{
287 qWarning( "obexSendBase::send_to_receivers(): Not implemented yet!" );
288}
289
290void obexSendBase::toggle_receiver(QListViewItem *)
291{
292 qWarning( "obexSendBase::toggle_receiver(QListViewItem *): Not implemented yet!" );
293}
294
295void obexSendBase::userDone()
296{
297 qWarning( "obexSendBase::userDone(): Not implemented yet!" );
298}
299
diff --git a/core/obex/obexsendbase.h b/core/obex/obexsendbase.h
new file mode 100644
index 0000000..7ffd2b5
--- a/dev/null
+++ b/core/obex/obexsendbase.h
@@ -0,0 +1,54 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'obexsendbase.ui'
3**
4** Created: Fri Aug 5 00:14:51 2005
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef OBEXSENDBASE_H
10#define OBEXSENDBASE_H
11
12#include <qvariant.h>
13#include <qwidget.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QLabel;
18class QListView;
19class QListViewItem;
20class QPushButton;
21
22class obexSendBase : public QWidget
23{
24 Q_OBJECT
25
26public:
27 obexSendBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
28 ~obexSendBase();
29
30 QLabel* sendLabel;
31 QLabel* fileToSend;
32 QLabel* irdaLabel;
33 QLabel* irdaStatus;
34 QLabel* btLabel;
35 QLabel* btStatus;
36 QListView* receiverList;
37 QPushButton* scanButton;
38 QPushButton* sendButton;
39 QPushButton* doneButton;
40
41protected slots:
42 virtual void scan_for_receivers();
43 virtual void send_to_receivers();
44 virtual void toggle_receiver(QListViewItem *);
45 virtual void userDone();
46
47protected:
48 QVBoxLayout* obexSendBaseLayout;
49 QHBoxLayout* Layout1;
50 QHBoxLayout* Layout4;
51 QHBoxLayout* Layout3;
52};
53
54#endif // OBEXSENDBASE_H