-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 8 | ||||
-rw-r--r-- | core/applets/obex/config.in | 4 | ||||
-rw-r--r-- | core/applets/obex/libopieobex.control | 8 | ||||
-rw-r--r-- | core/applets/obex/obex.cc | 194 | ||||
-rw-r--r-- | core/applets/obex/obex.h | 85 | ||||
-rw-r--r-- | core/applets/obex/obex.pro | 32 | ||||
-rw-r--r-- | core/applets/obex/obexdlg.ui | 279 | ||||
-rw-r--r-- | core/applets/obex/obeximpl.cc | 150 | ||||
-rw-r--r-- | core/applets/obex/obeximpl.h | 38 | ||||
-rw-r--r-- | core/applets/obex/obexinc.ui | 230 | ||||
-rwxr-xr-x | core/applets/obex/processwrapper.cc | 114 |
11 files changed, 4 insertions, 1138 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp index 84c656f..a5b4bfc 100644 --- a/core/applets/irdaapplet/irda.cpp +++ b/core/applets/irdaapplet/irda.cpp | |||
@@ -155,91 +155,91 @@ bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) | |||
155 | QFile discovery ( "/proc/sys/net/irda/discovery" ); | 155 | QFile discovery ( "/proc/sys/net/irda/discovery" ); |
156 | 156 | ||
157 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { | 157 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { |
158 | discovery.putch ( d ? '1' : '0' ); | 158 | discovery.putch ( d ? '1' : '0' ); |
159 | return true; | 159 | return true; |
160 | } | 160 | } |
161 | return false; | 161 | return false; |
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) | 165 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) |
166 | { | 166 | { |
167 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); | 167 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); |
168 | e << ( d ? 1 : 0 ); | 168 | e << ( d ? 1 : 0 ); |
169 | 169 | ||
170 | m_receive_active = d; | 170 | m_receive_active = d; |
171 | m_receive_state_changed = true; | 171 | m_receive_state_changed = true; |
172 | 172 | ||
173 | return true; | 173 | return true; |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | void IrdaApplet::showDiscovered ( ) | 177 | void IrdaApplet::showDiscovered ( ) |
178 | { | 178 | { |
179 | static Sound snd_found ( "irdaapplet/irdaon" ); | 179 | //static Sound snd_found ( "irdaapplet/irdaon" ); |
180 | static Sound snd_lost ( "irdaapplet/irdaoff" ); | 180 | //static Sound snd_lost ( "irdaapplet/irdaoff" ); |
181 | 181 | ||
182 | QFile discovery ( "/proc/net/irda/discovery" ); | 182 | QFile discovery ( "/proc/net/irda/discovery" ); |
183 | 183 | ||
184 | if ( discovery. open ( IO_ReadOnly )) { | 184 | if ( discovery. open ( IO_ReadOnly )) { |
185 | bool qcopsend = false; | 185 | bool qcopsend = false; |
186 | 186 | ||
187 | QString discoveredDevice; | 187 | QString discoveredDevice; |
188 | QString deviceAddr; | 188 | QString deviceAddr; |
189 | 189 | ||
190 | // since it is /proc we _must_ use QTextStream | 190 | // since it is /proc we _must_ use QTextStream |
191 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); | 191 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); |
192 | 192 | ||
193 | QMap <QString, QString>::Iterator it; | 193 | QMap <QString, QString>::Iterator it; |
194 | 194 | ||
195 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) | 195 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) |
196 | it. data ( ). prepend ( "+++" ); | 196 | it. data ( ). prepend ( "+++" ); |
197 | 197 | ||
198 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { | 198 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { |
199 | const QString &line = *lit; | 199 | const QString &line = *lit; |
200 | 200 | ||
201 | if ( line. startsWith ( "nickname:" )) { | 201 | if ( line. startsWith ( "nickname:" )) { |
202 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); | 202 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); |
203 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); | 203 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); |
204 | 204 | ||
205 | // qDebug(discoveredDevice + "(" + deviceAddr + ")"); | 205 | // qDebug(discoveredDevice + "(" + deviceAddr + ")"); |
206 | 206 | ||
207 | if ( !m_devices. contains ( deviceAddr )) { | 207 | if ( !m_devices. contains ( deviceAddr )) { |
208 | popup ( tr( "Found:" ) + " " + discoveredDevice ); | 208 | popup ( tr( "Found:" ) + " " + discoveredDevice ); |
209 | snd_found. play ( ); | 209 | //snd_found. play ( ); |
210 | qcopsend = true; | 210 | qcopsend = true; |
211 | } | 211 | } |
212 | m_devices. replace ( deviceAddr, discoveredDevice ); | 212 | m_devices. replace ( deviceAddr, discoveredDevice ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { | 216 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { |
217 | // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); | 217 | // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); |
218 | 218 | ||
219 | if ( it. data ( ). left ( 3 ) == "+++" ) { | 219 | if ( it. data ( ). left ( 3 ) == "+++" ) { |
220 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); | 220 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); |
221 | snd_lost. play ( ); | 221 | //snd_lost. play ( ); |
222 | 222 | ||
223 | QMap <QString, QString>::Iterator tmp = it; | 223 | QMap <QString, QString>::Iterator tmp = it; |
224 | tmp++; | 224 | tmp++; |
225 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator | 225 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator |
226 | it = tmp; | 226 | it = tmp; |
227 | 227 | ||
228 | qcopsend = true; | 228 | qcopsend = true; |
229 | } | 229 | } |
230 | else | 230 | else |
231 | it++; | 231 | it++; |
232 | } | 232 | } |
233 | // XXX if( qcopsend ) { | 233 | // XXX if( qcopsend ) { |
234 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); | 234 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); |
235 | e << ( m_devices. count ( ) > 0 ); | 235 | e << ( m_devices. count ( ) > 0 ); |
236 | // } | 236 | // } |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) | 240 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) |
241 | { | 241 | { |
242 | QPopupMenu *menu = new QPopupMenu ( this ); | 242 | QPopupMenu *menu = new QPopupMenu ( this ); |
243 | QString cmd; | 243 | QString cmd; |
244 | 244 | ||
245 | /* Refresh active state */ | 245 | /* Refresh active state */ |
diff --git a/core/applets/obex/config.in b/core/applets/obex/config.in deleted file mode 100644 index 4d1f43d..0000000 --- a/core/applets/obex/config.in +++ b/dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | config OBEX | ||
2 | boolean "Obex library (library needed for beaming in Opie)" | ||
3 | default "y" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | ||
diff --git a/core/applets/obex/libopieobex.control b/core/applets/obex/libopieobex.control deleted file mode 100644 index 3fd0f77..0000000 --- a/core/applets/obex/libopieobex.control +++ b/dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | Files: plugins/obex/libopieobex.so* | ||
2 | Priority: optional | ||
3 | Section: opie/system | ||
4 | Maintainer: Holger Freyther <zecke@handhelds.org> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION.1 | ||
7 | Depends: opie-base, openobex | libopenobex1 | ||
8 | Description: Irda obex lib | ||
diff --git a/core/applets/obex/obex.cc b/core/applets/obex/obex.cc deleted file mode 100644 index 43041f5..0000000 --- a/core/applets/obex/obex.cc +++ b/dev/null | |||
@@ -1,194 +0,0 @@ | |||
1 | |||
2 | #include <qapplication.h> | ||
3 | #include <qmessagebox.h> | ||
4 | #include <qpe/qcopenvelope_qws.h> | ||
5 | #include <opie/oprocess.h> | ||
6 | #include "obex.h" | ||
7 | |||
8 | using namespace OpieObex; | ||
9 | |||
10 | Obex::Obex( QObject *parent, const char* name ) | ||
11 | : QObject(parent, name ) | ||
12 | { | ||
13 | m_rec = 0; | ||
14 | m_send=0; | ||
15 | m_count = 0; | ||
16 | m_receive = false; | ||
17 | connect( this, SIGNAL(error(int) ), // for recovering to receive | ||
18 | SLOT(slotError() ) ); | ||
19 | connect( this, SIGNAL(sent() ), | ||
20 | SLOT(slotError() ) ); | ||
21 | }; | ||
22 | Obex::~Obex() { | ||
23 | delete m_rec; | ||
24 | delete m_send; | ||
25 | } | ||
26 | void Obex::receive() { | ||
27 | m_receive = true; | ||
28 | m_outp = QString::null; | ||
29 | qWarning("Receive" ); | ||
30 | m_rec = new OProcess(); | ||
31 | *m_rec << "irobex_palm3"; | ||
32 | // connect to the necessary slots | ||
33 | connect(m_rec, SIGNAL(processExited(OProcess*) ), | ||
34 | this, SLOT(slotExited(OProcess*) ) ); | ||
35 | |||
36 | connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | ||
37 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | ||
38 | |||
39 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | ||
40 | qWarning("could not start :("); | ||
41 | emit done( false ); | ||
42 | delete m_rec; | ||
43 | m_rec = 0; | ||
44 | } | ||
45 | // emit currentTry(m_count ); | ||
46 | |||
47 | } | ||
48 | void Obex::send( const QString& fileName) { // if currently receiving stop it send receive | ||
49 | m_count = 0; | ||
50 | m_file = fileName; | ||
51 | qWarning("send"); | ||
52 | if (m_rec != 0 ) { | ||
53 | qWarning("running"); | ||
54 | if (m_rec->isRunning() ) { | ||
55 | emit error(-1 ); | ||
56 | qWarning("is running"); | ||
57 | delete m_rec; | ||
58 | m_rec = 0; | ||
59 | |||
60 | }else{ | ||
61 | qWarning("is not running"); | ||
62 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending | ||
63 | return; | ||
64 | } | ||
65 | } | ||
66 | sendNow(); | ||
67 | } | ||
68 | void Obex::sendNow(){ | ||
69 | qWarning("sendNow"); | ||
70 | if ( m_count >= 25 ) { // could not send | ||
71 | emit error(-1 ); | ||
72 | return; | ||
73 | } | ||
74 | // OProcess inititialisation | ||
75 | m_send = new OProcess(); | ||
76 | *m_send << "irobex_palm3"; | ||
77 | *m_send << m_file; | ||
78 | |||
79 | // connect to slots Exited and and StdOut | ||
80 | connect(m_send, SIGNAL(processExited(OProcess*) ), | ||
81 | this, SLOT(slotExited(OProcess*)) ); | ||
82 | connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )), | ||
83 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | ||
84 | |||
85 | // now start it | ||
86 | if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { | ||
87 | qWarning("could not send" ); | ||
88 | m_count = 25; | ||
89 | emit error(-1 ); | ||
90 | delete m_send; | ||
91 | m_send=0; | ||
92 | } | ||
93 | // end | ||
94 | m_count++; | ||
95 | emit currentTry( m_count ); | ||
96 | } | ||
97 | |||
98 | void Obex::slotExited(OProcess* proc ){ | ||
99 | if (proc == m_rec ) { // receive process | ||
100 | received(); | ||
101 | }else if ( proc == m_send ) { | ||
102 | sendEnd(); | ||
103 | } | ||
104 | } | ||
105 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ | ||
106 | if ( proc == m_rec ) { // only receive | ||
107 | QCString cstring( buf, len ); | ||
108 | m_outp.append( cstring.data() ); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | void Obex::received() { | ||
113 | if (m_rec->normalExit() ) { | ||
114 | if ( m_rec->exitStatus() == 0 ) { // we got one | ||
115 | QString filename = parseOut(); | ||
116 | qWarning("ACHTUNG"); | ||
117 | emit receivedFile( filename ); | ||
118 | } | ||
119 | }else{ | ||
120 | emit done(false); | ||
121 | }; | ||
122 | delete m_rec; | ||
123 | m_rec = 0; | ||
124 | receive(); | ||
125 | } | ||
126 | |||
127 | void Obex::sendEnd() { | ||
128 | if (m_send->normalExit() ) { | ||
129 | if ( m_send->exitStatus() == 0 ) { | ||
130 | delete m_send; | ||
131 | m_send=0; | ||
132 | qWarning("done" ); | ||
133 | emit sent(); | ||
134 | }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready | ||
135 | // let's try it again | ||
136 | delete m_send; | ||
137 | m_send = 0; | ||
138 | qWarning("try sending again" ); | ||
139 | sendNow(); | ||
140 | } | ||
141 | }else { | ||
142 | emit error( -1 ); | ||
143 | delete m_send; | ||
144 | m_send = 0; | ||
145 | } | ||
146 | } | ||
147 | QString 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 | qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ; | ||
156 | qWarning("%d %d", (*it).length(), (*it).length()-pos ); | ||
157 | |||
158 | path = (*it).remove( pos, (*it).length() - pos ); | ||
159 | qWarning("%s", path.latin1() ); | ||
160 | path = path.mid(6 ); | ||
161 | path = path.stripWhiteSpace(); | ||
162 | qWarning("path %s", path.latin1() ); | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | return path; | ||
167 | } | ||
168 | /** | ||
169 | * when sent is done slotError is called we will start receive again | ||
170 | */ | ||
171 | void Obex::slotError() { | ||
172 | qWarning("slotError"); | ||
173 | if ( m_receive ) | ||
174 | receive(); | ||
175 | }; | ||
176 | void Obex::setReceiveEnabled( bool receive ) { | ||
177 | if ( !receive ) { // | ||
178 | m_receive = false; | ||
179 | shutDownReceive(); | ||
180 | } | ||
181 | } | ||
182 | |||
183 | void Obex::shutDownReceive() { | ||
184 | if (m_rec != 0 ) { | ||
185 | qWarning("running"); | ||
186 | if (m_rec->isRunning() ) { | ||
187 | emit error(-1 ); | ||
188 | qWarning("is running"); | ||
189 | delete m_rec; | ||
190 | m_rec = 0; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | } | ||
diff --git a/core/applets/obex/obex.h b/core/applets/obex/obex.h deleted file mode 100644 index 781fca2..0000000 --- a/core/applets/obex/obex.h +++ b/dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | |||
2 | |||
3 | #ifndef OpieObex_H | ||
4 | #define OpieObex_H | ||
5 | |||
6 | #include <qobject.h> | ||
7 | |||
8 | class OProcess; | ||
9 | class QCopChannel; | ||
10 | namespace 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 recieved 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 recieved 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(); | ||
50 | // private slots | ||
51 | void done(bool); | ||
52 | |||
53 | private: | ||
54 | uint m_count; | ||
55 | QString m_file; | ||
56 | QString m_outp; | ||
57 | OProcess *m_send; | ||
58 | OProcess *m_rec; | ||
59 | bool m_receive : 1; | ||
60 | void shutDownReceive(); | ||
61 | |||
62 | private slots: | ||
63 | |||
64 | /** | ||
65 | * send over palm obex | ||
66 | */ | ||
67 | |||
68 | //void send(const QString&); | ||
69 | |||
70 | // the process exited | ||
71 | void slotExited(OProcess* proc) ; | ||
72 | void slotStdOut(OProcess*, char*, int); | ||
73 | void slotError(); | ||
74 | |||
75 | private: | ||
76 | void sendNow(); | ||
77 | QString parseOut(); | ||
78 | void received(); | ||
79 | void sendEnd(); | ||
80 | |||
81 | }; | ||
82 | }; | ||
83 | |||
84 | |||
85 | #endif | ||
diff --git a/core/applets/obex/obex.pro b/core/applets/obex/obex.pro deleted file mode 100644 index d7cc338..0000000 --- a/core/applets/obex/obex.pro +++ b/dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG += qt warn_on release | ||
3 | HEADERS= obex.h obeximpl.h | ||
4 | SOURCES= obex.cc obeximpl.cc | ||
5 | TARGET = opieobex | ||
6 | DESTDIR = $(OPIEDIR)/plugins/obex | ||
7 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher | ||
8 | DEPENDPATH += ../$(OPIEDIR)/include | ||
9 | INTERFACES = obexinc.ui obexdlg.ui | ||
10 | LIBS += -lqpe -lopie | ||
11 | VERSION = 0.0.1 | ||
12 | |||
13 | TRANSLATIONS = ../../../i18n/de/libopieobex.ts \ | ||
14 | ../../../i18n/da/libopieobex.ts \ | ||
15 | ../../../i18n/xx/libopieobex.ts \ | ||
16 | ../../../i18n/en/libopieobex.ts \ | ||
17 | ../../../i18n/es/libopieobex.ts \ | ||
18 | ../../../i18n/fr/libopieobex.ts \ | ||
19 | ../../../i18n/hu/libopieobex.ts \ | ||
20 | ../../../i18n/ja/libopieobex.ts \ | ||
21 | ../../../i18n/ko/libopieobex.ts \ | ||
22 | ../../../i18n/no/libopieobex.ts \ | ||
23 | ../../../i18n/pl/libopieobex.ts \ | ||
24 | ../../../i18n/pt/libopieobex.ts \ | ||
25 | ../../../i18n/pt_BR/libopieobex.ts \ | ||
26 | ../../../i18n/sl/libopieobex.ts \ | ||
27 | ../../../i18n/zh_CN/libopieobex.ts \ | ||
28 | ../../../i18n/zh_TW/libopieobex.ts | ||
29 | |||
30 | |||
31 | |||
32 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/core/applets/obex/obexdlg.ui b/core/applets/obex/obexdlg.ui deleted file mode 100644 index b367ffd..0000000 --- a/core/applets/obex/obexdlg.ui +++ b/dev/null | |||
@@ -1,279 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>ObexDlg</class> | ||
3 | <author>me</author> | ||
4 | <widget> | ||
5 | <class>QWidget</class> | ||
6 | <property stdset="1"> | ||
7 | <name>name</name> | ||
8 | <cstring>Form1</cstring> | ||
9 | </property> | ||
10 | <property stdset="1"> | ||
11 | <name>geometry</name> | ||
12 | <rect> | ||
13 | <x>0</x> | ||
14 | <y>0</y> | ||
15 | <width>204</width> | ||
16 | <height>246</height> | ||
17 | </rect> | ||
18 | </property> | ||
19 | <property stdset="1"> | ||
20 | <name>caption</name> | ||
21 | <string>OBEX Sending</string> | ||
22 | </property> | ||
23 | <widget> | ||
24 | <class>QLayoutWidget</class> | ||
25 | <property stdset="1"> | ||
26 | <name>name</name> | ||
27 | <cstring>Layout5</cstring> | ||
28 | </property> | ||
29 | <property stdset="1"> | ||
30 | <name>geometry</name> | ||
31 | <rect> | ||
32 | <x>0</x> | ||
33 | <y>60</y> | ||
34 | <width>200</width> | ||
35 | <height>70</height> | ||
36 | </rect> | ||
37 | </property> | ||
38 | <vbox> | ||
39 | <property stdset="1"> | ||
40 | <name>margin</name> | ||
41 | <number>0</number> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>spacing</name> | ||
45 | <number>6</number> | ||
46 | </property> | ||
47 | <widget> | ||
48 | <class>QLabel</class> | ||
49 | <property stdset="1"> | ||
50 | <name>name</name> | ||
51 | <cstring>TextLabel1</cstring> | ||
52 | </property> | ||
53 | <property stdset="1"> | ||
54 | <name>text</name> | ||
55 | <string>Sending:</string> | ||
56 | </property> | ||
57 | </widget> | ||
58 | <spacer> | ||
59 | <property> | ||
60 | <name>name</name> | ||
61 | <cstring>Spacer6</cstring> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>orientation</name> | ||
65 | <enum>Vertical</enum> | ||
66 | </property> | ||
67 | <property stdset="1"> | ||
68 | <name>sizeType</name> | ||
69 | <enum>Fixed</enum> | ||
70 | </property> | ||
71 | <property> | ||
72 | <name>sizeHint</name> | ||
73 | <size> | ||
74 | <width>20</width> | ||
75 | <height>20</height> | ||
76 | </size> | ||
77 | </property> | ||
78 | </spacer> | ||
79 | <widget> | ||
80 | <class>QLabel</class> | ||
81 | <property stdset="1"> | ||
82 | <name>name</name> | ||
83 | <cstring>lblPath</cstring> | ||
84 | </property> | ||
85 | <property stdset="1"> | ||
86 | <name>text</name> | ||
87 | <string>filename</string> | ||
88 | </property> | ||
89 | <property stdset="1"> | ||
90 | <name>textFormat</name> | ||
91 | <enum>RichText</enum> | ||
92 | </property> | ||
93 | <property stdset="1"> | ||
94 | <name>alignment</name> | ||
95 | <set>AlignTop|AlignLeft</set> | ||
96 | </property> | ||
97 | <property> | ||
98 | <name>hAlign</name> | ||
99 | </property> | ||
100 | <property> | ||
101 | <name>vAlign</name> | ||
102 | </property> | ||
103 | </widget> | ||
104 | </vbox> | ||
105 | </widget> | ||
106 | <spacer> | ||
107 | <property> | ||
108 | <name>name</name> | ||
109 | <cstring>Spacer7</cstring> | ||
110 | </property> | ||
111 | <property stdset="1"> | ||
112 | <name>orientation</name> | ||
113 | <enum>Vertical</enum> | ||
114 | </property> | ||
115 | <property stdset="1"> | ||
116 | <name>sizeType</name> | ||
117 | <enum>Expanding</enum> | ||
118 | </property> | ||
119 | <property> | ||
120 | <name>sizeHint</name> | ||
121 | <size> | ||
122 | <width>20</width> | ||
123 | <height>20</height> | ||
124 | </size> | ||
125 | </property> | ||
126 | </spacer> | ||
127 | <spacer> | ||
128 | <property> | ||
129 | <name>name</name> | ||
130 | <cstring>Spacer8</cstring> | ||
131 | </property> | ||
132 | <property stdset="1"> | ||
133 | <name>orientation</name> | ||
134 | <enum>Vertical</enum> | ||
135 | </property> | ||
136 | <property stdset="1"> | ||
137 | <name>sizeType</name> | ||
138 | <enum>Expanding</enum> | ||
139 | </property> | ||
140 | <property> | ||
141 | <name>sizeHint</name> | ||
142 | <size> | ||
143 | <width>20</width> | ||
144 | <height>20</height> | ||
145 | </size> | ||
146 | </property> | ||
147 | </spacer> | ||
148 | <widget> | ||
149 | <class>QLayoutWidget</class> | ||
150 | <property stdset="1"> | ||
151 | <name>name</name> | ||
152 | <cstring>Layout6</cstring> | ||
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>geometry</name> | ||
156 | <rect> | ||
157 | <x>20</x> | ||
158 | <y>170</y> | ||
159 | <width>170</width> | ||
160 | <height>34</height> | ||
161 | </rect> | ||
162 | </property> | ||
163 | <hbox> | ||
164 | <property stdset="1"> | ||
165 | <name>margin</name> | ||
166 | <number>0</number> | ||
167 | </property> | ||
168 | <property stdset="1"> | ||
169 | <name>spacing</name> | ||
170 | <number>6</number> | ||
171 | </property> | ||
172 | <spacer> | ||
173 | <property> | ||
174 | <name>name</name> | ||
175 | <cstring>Spacer9</cstring> | ||
176 | </property> | ||
177 | <property stdset="1"> | ||
178 | <name>orientation</name> | ||
179 | <enum>Horizontal</enum> | ||
180 | </property> | ||
181 | <property stdset="1"> | ||
182 | <name>sizeType</name> | ||
183 | <enum>Expanding</enum> | ||
184 | </property> | ||
185 | <property> | ||
186 | <name>sizeHint</name> | ||
187 | <size> | ||
188 | <width>20</width> | ||
189 | <height>20</height> | ||
190 | </size> | ||
191 | </property> | ||
192 | </spacer> | ||
193 | <widget> | ||
194 | <class>QPushButton</class> | ||
195 | <property stdset="1"> | ||
196 | <name>name</name> | ||
197 | <cstring>PushButton2</cstring> | ||
198 | </property> | ||
199 | <property stdset="1"> | ||
200 | <name>text</name> | ||
201 | <string>&Cancel</string> | ||
202 | </property> | ||
203 | </widget> | ||
204 | <spacer> | ||
205 | <property> | ||
206 | <name>name</name> | ||
207 | <cstring>Spacer10</cstring> | ||
208 | </property> | ||
209 | <property stdset="1"> | ||
210 | <name>orientation</name> | ||
211 | <enum>Horizontal</enum> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>sizeType</name> | ||
215 | <enum>Expanding</enum> | ||
216 | </property> | ||
217 | <property> | ||
218 | <name>sizeHint</name> | ||
219 | <size> | ||
220 | <width>20</width> | ||
221 | <height>20</height> | ||
222 | </size> | ||
223 | </property> | ||
224 | </spacer> | ||
225 | </hbox> | ||
226 | </widget> | ||
227 | <spacer> | ||
228 | <property> | ||
229 | <name>name</name> | ||
230 | <cstring>Spacer11</cstring> | ||
231 | </property> | ||
232 | <property stdset="1"> | ||
233 | <name>orientation</name> | ||
234 | <enum>Vertical</enum> | ||
235 | </property> | ||
236 | <property stdset="1"> | ||
237 | <name>sizeType</name> | ||
238 | <enum>Expanding</enum> | ||
239 | </property> | ||
240 | <property> | ||
241 | <name>sizeHint</name> | ||
242 | <size> | ||
243 | <width>20</width> | ||
244 | <height>20</height> | ||
245 | </size> | ||
246 | </property> | ||
247 | </spacer> | ||
248 | <spacer> | ||
249 | <property> | ||
250 | <name>name</name> | ||
251 | <cstring>Spacer18</cstring> | ||
252 | </property> | ||
253 | <property stdset="1"> | ||
254 | <name>orientation</name> | ||
255 | <enum>Vertical</enum> | ||
256 | </property> | ||
257 | <property stdset="1"> | ||
258 | <name>sizeType</name> | ||
259 | <enum>Expanding</enum> | ||
260 | </property> | ||
261 | <property> | ||
262 | <name>sizeHint</name> | ||
263 | <size> | ||
264 | <width>20</width> | ||
265 | <height>20</height> | ||
266 | </size> | ||
267 | </property> | ||
268 | </spacer> | ||
269 | </widget> | ||
270 | <connections> | ||
271 | <connection> | ||
272 | <sender>PushButton2</sender> | ||
273 | <signal>clicked()</signal> | ||
274 | <receiver>Form1</receiver> | ||
275 | <slot>slotCancel()</slot> | ||
276 | </connection> | ||
277 | <slot access="public">slotCancel()</slot> | ||
278 | </connections> | ||
279 | </UI> | ||
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc deleted file mode 100644 index 88f2d44..0000000 --- a/core/applets/obex/obeximpl.cc +++ b/dev/null | |||
@@ -1,150 +0,0 @@ | |||
1 | |||
2 | #include <qdatastream.h> | ||
3 | #include <qmessagebox.h> | ||
4 | |||
5 | |||
6 | #include <qpe/qcom.h> | ||
7 | #include <qpe/applnk.h> | ||
8 | |||
9 | #include <qlabel.h> | ||
10 | |||
11 | #include "obex.h" | ||
12 | #include "obeximpl.h" | ||
13 | |||
14 | |||
15 | |||
16 | using namespace OpieObex; | ||
17 | |||
18 | ObexImpl::ObexImpl( ) | ||
19 | : QObject() { | ||
20 | // register to a channel | ||
21 | qWarning( "c'tor" ); | ||
22 | m_obex = new Obex(this, "obex"); | ||
23 | m_sendgui = new ObexDlg(); | ||
24 | m_recvgui = new ObexInc(); | ||
25 | m_chan = new QCopChannel("QPE/Obex" ); | ||
26 | connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ), | ||
27 | this, SLOT(slotMessage(const QCString&, const QByteArray&) ) ); | ||
28 | connect(m_obex, SIGNAL(receivedFile(const QString& ) ), | ||
29 | this, SLOT(slotReceivedFile(const QString& ) ) ); | ||
30 | connect((QObject*) m_recvgui->InsertButton, SIGNAL(clicked()), | ||
31 | m_recvgui, SLOT( accept() )); | ||
32 | connect((QObject*) m_recvgui->RejectButton, SIGNAL(clicked()), | ||
33 | m_recvgui, SLOT( reject() )); | ||
34 | } | ||
35 | |||
36 | ObexImpl::~ObexImpl() { | ||
37 | delete m_obex; | ||
38 | delete m_chan; | ||
39 | delete m_sendgui; | ||
40 | delete m_recvgui; | ||
41 | } | ||
42 | |||
43 | QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | ||
44 | *iface = 0; | ||
45 | if( uuid == IID_QUnknown ) | ||
46 | *iface = this; | ||
47 | else if( uuid == IID_ObexInterface ) | ||
48 | *iface = this; | ||
49 | |||
50 | qWarning("query" ); | ||
51 | if(*iface ) | ||
52 | (*iface)->addRef(); | ||
53 | return QS_OK; | ||
54 | } | ||
55 | |||
56 | void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { | ||
57 | QDataStream stream( data, IO_ReadOnly ); | ||
58 | qWarning("Message %s", msg.data() ); | ||
59 | if(msg == "send(QString,QString,QString)" ) { | ||
60 | QString desc; | ||
61 | stream >> desc; | ||
62 | stream >> m_name; | ||
63 | m_sendgui->raise(); // should be on top | ||
64 | m_sendgui->showMaximized(); | ||
65 | m_sendgui->lblPath->setText(m_name); | ||
66 | connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()), | ||
67 | this, SLOT(slotCancelSend())); | ||
68 | m_obex->send(m_name ); | ||
69 | connect( (QObject*)m_obex, SIGNAL( sent() ), this, | ||
70 | SLOT( slotSent() ) ); | ||
71 | connect( (QObject*)m_obex, SIGNAL( error(int) ), this, | ||
72 | SLOT( slotSent() ) ); | ||
73 | }else if(msg == "receive(int)" ) { // open a GUI | ||
74 | //m_recvgui->showMaximized(); | ||
75 | int receiveD = 0; | ||
76 | stream >> receiveD; | ||
77 | if ( receiveD == 1) | ||
78 | m_obex->receive(); | ||
79 | else | ||
80 | m_obex->setReceiveEnabled( false ); | ||
81 | |||
82 | } else if (msg =="done(QString)") { | ||
83 | QString text; | ||
84 | stream >> text; | ||
85 | m_sendgui->lblPath->setText(tr("Done transfering " + text)); | ||
86 | |||
87 | } | ||
88 | } | ||
89 | |||
90 | void ObexImpl::slotCancelSend() { | ||
91 | // cancel sync process too | ||
92 | //m_obex->cancel(); // not ready yet | ||
93 | m_sendgui->hide(); | ||
94 | } | ||
95 | |||
96 | void ObexImpl::slotDone(bool) { | ||
97 | QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot | ||
98 | e << m_name; | ||
99 | } | ||
100 | |||
101 | void ObexImpl::slotSent() { | ||
102 | m_sendgui->lblPath->setText("Done!"); | ||
103 | m_sendgui->hide(); | ||
104 | } | ||
105 | |||
106 | void ObexImpl::slotError( int errorCode) { | ||
107 | |||
108 | QString errorString = ""; | ||
109 | if (errorCode == -1) { | ||
110 | errorString = "test"; | ||
111 | } | ||
112 | qDebug("Error: " + errorString); | ||
113 | m_sendgui->hide(); | ||
114 | } | ||
115 | |||
116 | // Received a file via beam | ||
117 | // check for mime type and then either | ||
118 | // add to App via setDocument | ||
119 | void ObexImpl::slotReceivedFile( const QString &fileName ) { | ||
120 | qWarning("filename %s", fileName.latin1() ); | ||
121 | DocLnk lnk( fileName ); | ||
122 | QString exec = lnk.exec(); | ||
123 | qWarning("executing %s", exec.latin1() ); | ||
124 | if ( exec.isEmpty() || exec == "" ) { | ||
125 | qWarning("empty"); | ||
126 | if ( fileName.right(4) == ".vcf" ) | ||
127 | exec = "addressbook"; | ||
128 | else if ( fileName.right(4) == ".vcs" ) { | ||
129 | exec = "datebook"; | ||
130 | } | ||
131 | } // now prompt and then add it | ||
132 | |||
133 | m_recvgui->PixmapLabel->setPixmap( lnk.pixmap() ); | ||
134 | m_recvgui->AppLabel->setText( "<b>" + exec + "<b>" ); | ||
135 | m_recvgui->FileLabel->setText( lnk.name() ); | ||
136 | // m_recvgui->showMaximized(); | ||
137 | // if( m_recvgui->exec() == 0 ) { | ||
138 | QCString str= "QPE/Application/"; | ||
139 | str += exec.latin1(); | ||
140 | qWarning("channel %s", str.data() ); | ||
141 | QCopEnvelope e(str , "setDocument(QString)" ); | ||
142 | e << fileName; | ||
143 | //} | ||
144 | } | ||
145 | |||
146 | |||
147 | |||
148 | Q_EXPORT_INTERFACE() { | ||
149 | Q_CREATE_INSTANCE( ObexImpl ) | ||
150 | } | ||
diff --git a/core/applets/obex/obeximpl.h b/core/applets/obex/obeximpl.h deleted file mode 100644 index 78d5b25..0000000 --- a/core/applets/obex/obeximpl.h +++ b/dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | |||
2 | #ifndef OpieObexImpl_H | ||
3 | #define OpieObexImpl_H | ||
4 | |||
5 | #include <qobject.h> | ||
6 | #include <obexinterface.h> | ||
7 | #include "obexdlg.h" | ||
8 | #include "obexinc.h" | ||
9 | #include <qpe/qcopenvelope_qws.h> | ||
10 | |||
11 | namespace OpieObex { | ||
12 | class Obex; | ||
13 | class ObexImpl : public QObject, public ObexInterface { | ||
14 | Q_OBJECT | ||
15 | public: | ||
16 | ObexImpl(); | ||
17 | virtual ~ObexImpl(); | ||
18 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
19 | Q_REFCOUNT // for reference counting (macro ) | ||
20 | private: | ||
21 | ulong ref; | ||
22 | Obex* m_obex; // obex lib | ||
23 | QCopChannel *m_chan; | ||
24 | ObexDlg *m_sendgui; | ||
25 | ObexInc *m_recvgui; | ||
26 | QString m_name; | ||
27 | private slots: | ||
28 | void slotCancelSend(); | ||
29 | void slotMessage( const QCString&, const QByteArray& ); | ||
30 | void slotError(int ); | ||
31 | // void slotCurrentTry( unsigned int ); */ | ||
32 | void slotDone(bool); | ||
33 | void slotReceivedFile(const QString & ); | ||
34 | void slotSent(); | ||
35 | |||
36 | }; | ||
37 | }; | ||
38 | #endif | ||
diff --git a/core/applets/obex/obexinc.ui b/core/applets/obex/obexinc.ui deleted file mode 100644 index 4cc8056..0000000 --- a/core/applets/obex/obexinc.ui +++ b/dev/null | |||
@@ -1,230 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>ObexInc</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>ObexInc</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>208</width> | ||
15 | <height>248</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>OBEX Receiving</string> | ||
21 | </property> | ||
22 | <widget> | ||
23 | <class>QLayoutWidget</class> | ||
24 | <property stdset="1"> | ||
25 | <name>name</name> | ||
26 | <cstring>Layout5</cstring> | ||
27 | </property> | ||
28 | <property stdset="1"> | ||
29 | <name>geometry</name> | ||
30 | <rect> | ||
31 | <x>90</x> | ||
32 | <y>100</y> | ||
33 | <width>79</width> | ||
34 | <height>68</height> | ||
35 | </rect> | ||
36 | </property> | ||
37 | <vbox> | ||
38 | <property stdset="1"> | ||
39 | <name>margin</name> | ||
40 | <number>0</number> | ||
41 | </property> | ||
42 | <property stdset="1"> | ||
43 | <name>spacing</name> | ||
44 | <number>6</number> | ||
45 | </property> | ||
46 | <widget> | ||
47 | <class>QLabel</class> | ||
48 | <property stdset="1"> | ||
49 | <name>name</name> | ||
50 | <cstring>AppLabel</cstring> | ||
51 | </property> | ||
52 | <property stdset="1"> | ||
53 | <name>text</name> | ||
54 | <string>TextLabel1</string> | ||
55 | </property> | ||
56 | </widget> | ||
57 | <widget> | ||
58 | <class>QLabel</class> | ||
59 | <property stdset="1"> | ||
60 | <name>name</name> | ||
61 | <cstring>FileLabel</cstring> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>text</name> | ||
65 | <string>Filename</string> | ||
66 | </property> | ||
67 | <property stdset="1"> | ||
68 | <name>alignment</name> | ||
69 | <set>AlignTop|AlignLeft</set> | ||
70 | </property> | ||
71 | <property> | ||
72 | <name>vAlign</name> | ||
73 | </property> | ||
74 | </widget> | ||
75 | </vbox> | ||
76 | </widget> | ||
77 | <widget> | ||
78 | <class>QLabel</class> | ||
79 | <property stdset="1"> | ||
80 | <name>name</name> | ||
81 | <cstring>TextLabel1</cstring> | ||
82 | </property> | ||
83 | <property stdset="1"> | ||
84 | <name>geometry</name> | ||
85 | <rect> | ||
86 | <x>30</x> | ||
87 | <y>30</y> | ||
88 | <width>161</width> | ||
89 | <height>41</height> | ||
90 | </rect> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>text</name> | ||
94 | <string>A file was beamed | ||
95 | to you.</string> | ||
96 | </property> | ||
97 | </widget> | ||
98 | <widget> | ||
99 | <class>QLabel</class> | ||
100 | <property stdset="1"> | ||
101 | <name>name</name> | ||
102 | <cstring>PixmapLabel</cstring> | ||
103 | </property> | ||
104 | <property stdset="1"> | ||
105 | <name>geometry</name> | ||
106 | <rect> | ||
107 | <x>30</x> | ||
108 | <y>100</y> | ||
109 | <width>40</width> | ||
110 | <height>40</height> | ||
111 | </rect> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>scaledContents</name> | ||
115 | <bool>true</bool> | ||
116 | </property> | ||
117 | </widget> | ||
118 | <widget> | ||
119 | <class>QLayoutWidget</class> | ||
120 | <property stdset="1"> | ||
121 | <name>name</name> | ||
122 | <cstring>Layout4</cstring> | ||
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>geometry</name> | ||
126 | <rect> | ||
127 | <x>0</x> | ||
128 | <y>210</y> | ||
129 | <width>246</width> | ||
130 | <height>33</height> | ||
131 | </rect> | ||
132 | </property> | ||
133 | <hbox> | ||
134 | <property stdset="1"> | ||
135 | <name>margin</name> | ||
136 | <number>0</number> | ||
137 | </property> | ||
138 | <property stdset="1"> | ||
139 | <name>spacing</name> | ||
140 | <number>6</number> | ||
141 | </property> | ||
142 | <spacer> | ||
143 | <property> | ||
144 | <name>name</name> | ||
145 | <cstring>Spacer9</cstring> | ||
146 | </property> | ||
147 | <property stdset="1"> | ||
148 | <name>orientation</name> | ||
149 | <enum>Horizontal</enum> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>sizeType</name> | ||
153 | <enum>Expanding</enum> | ||
154 | </property> | ||
155 | <property> | ||
156 | <name>sizeHint</name> | ||
157 | <size> | ||
158 | <width>20</width> | ||
159 | <height>20</height> | ||
160 | </size> | ||
161 | </property> | ||
162 | </spacer> | ||
163 | <widget> | ||
164 | <class>QPushButton</class> | ||
165 | <property stdset="1"> | ||
166 | <name>name</name> | ||
167 | <cstring>InsertButton</cstring> | ||
168 | </property> | ||
169 | <property stdset="1"> | ||
170 | <name>text</name> | ||
171 | <string>Insert</string> | ||
172 | </property> | ||
173 | </widget> | ||
174 | <spacer> | ||
175 | <property> | ||
176 | <name>name</name> | ||
177 | <cstring>Spacer11</cstring> | ||
178 | </property> | ||
179 | <property stdset="1"> | ||
180 | <name>orientation</name> | ||
181 | <enum>Horizontal</enum> | ||
182 | </property> | ||
183 | <property stdset="1"> | ||
184 | <name>sizeType</name> | ||
185 | <enum>Expanding</enum> | ||
186 | </property> | ||
187 | <property> | ||
188 | <name>sizeHint</name> | ||
189 | <size> | ||
190 | <width>20</width> | ||
191 | <height>20</height> | ||
192 | </size> | ||
193 | </property> | ||
194 | </spacer> | ||
195 | <widget> | ||
196 | <class>QPushButton</class> | ||
197 | <property stdset="1"> | ||
198 | <name>name</name> | ||
199 | <cstring>RejectButton</cstring> | ||
200 | </property> | ||
201 | <property stdset="1"> | ||
202 | <name>text</name> | ||
203 | <string>Reject</string> | ||
204 | </property> | ||
205 | </widget> | ||
206 | <spacer> | ||
207 | <property> | ||
208 | <name>name</name> | ||
209 | <cstring>Spacer10</cstring> | ||
210 | </property> | ||
211 | <property stdset="1"> | ||
212 | <name>orientation</name> | ||
213 | <enum>Horizontal</enum> | ||
214 | </property> | ||
215 | <property stdset="1"> | ||
216 | <name>sizeType</name> | ||
217 | <enum>Expanding</enum> | ||
218 | </property> | ||
219 | <property> | ||
220 | <name>sizeHint</name> | ||
221 | <size> | ||
222 | <width>20</width> | ||
223 | <height>20</height> | ||
224 | </size> | ||
225 | </property> | ||
226 | </spacer> | ||
227 | </hbox> | ||
228 | </widget> | ||
229 | </widget> | ||
230 | </UI> | ||
diff --git a/core/applets/obex/processwrapper.cc b/core/applets/obex/processwrapper.cc deleted file mode 100755 index ebc7794..0000000 --- a/core/applets/obex/processwrapper.cc +++ b/dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | // | ||
2 | m_rec == KProcess | ||
3 | m_count = int // the number of tries to recieve | ||
4 | m_send == KProcess | ||
5 | m_file == QString filename to send | ||
6 | m_outp == the output of the process | ||
7 | |||
8 | // | ||
9 | |||
10 | |||
11 | void receive() { | ||
12 | m_rec = new KProcess(); | ||
13 | *m_rec << "irobex_palm3"; | ||
14 | // connect to the necessary slots | ||
15 | connect(m_rec, SIGNAL(processExited(KProcess*) ), | ||
16 | this, SLOT(slotExited(KProcess*) ) ); | ||
17 | |||
18 | connect(m_rec, SIGNAL(receivedStdout(KProcess*, char*, int ) ), | ||
19 | this, SLOT(slotStdOut(KProcess*, char*, int) ) ); | ||
20 | |||
21 | if(!m_rec->start(KProcess::NotifyOnExit, KProcess::AllOutput) ) { | ||
22 | qWarning("could not start :("); | ||
23 | emit done( false ); | ||
24 | } | ||
25 | emit try(m_count ) | ||
26 | } | ||
27 | void send(const QString &fileName) { | ||
28 | m_count = 0; | ||
29 | m_file = fileName; | ||
30 | sendNow(); | ||
31 | } | ||
32 | void sendNow() { | ||
33 | if ( m_count >= 15 ) { // could not send | ||
34 | emit error(-1 ); | ||
35 | } | ||
36 | // KProcess inititialisation | ||
37 | m_send = new KProcess(); | ||
38 | m_send << "irobex_palm3"; | ||
39 | m_send << m_file; | ||
40 | |||
41 | // connect to slots Exited and and StdOut | ||
42 | connect(m_send, SIGNAL(processExited(KProcess*) ), | ||
43 | this, SLOT(slotExited(KProcess*)) ); | ||
44 | connect(m_send, SIGNAL(receivedStdout(KProcess*, char*, int ) ) | ||
45 | this, SLOT(slotStdOut(KProcess*, char*, int) ) ); | ||
46 | // now start it | ||
47 | if (!m_send->start(/*KProcess::NotifyOnExit, KProcess::AllOutput*/ ) ) { | ||
48 | m_count = 15; | ||
49 | emit error(-1 ); | ||
50 | } | ||
51 | // end | ||
52 | m_count++; | ||
53 | emit try( m_count ); | ||
54 | } | ||
55 | |||
56 | void recieved() { | ||
57 | if (m_rec->normalExit() ) { | ||
58 | if ( m_rec->exitStatus() == 0 ) { // we got one | ||
59 | QString filename = parseOut(); | ||
60 | emit recievedFile( filename ); | ||
61 | } | ||
62 | }else{ | ||
63 | emit error(-1); | ||
64 | }; | ||
65 | delete m_rec; | ||
66 | } | ||
67 | |||
68 | |||
69 | void slotExited(KProcess* proc) { | ||
70 | if (proc == m_rec ) { // recieve process | ||
71 | recieved(); | ||
72 | }else if ( proc == m_send ) { | ||
73 | send(); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | |||
78 | void send() { | ||
79 | if (m_send->normalExit() ) { | ||
80 | if ( m_send->exitStatus() == 0 ) { | ||
81 | delete m_send; | ||
82 | m_send=0; | ||
83 | emit sent(); | ||
84 | }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready | ||
85 | // let's try it again | ||
86 | delete m_send; | ||
87 | m_send = 0; | ||
88 | sendNow(); | ||
89 | } | ||
90 | }else { | ||
91 | emit error( -1 ); | ||
92 | delete m_send; | ||
93 | m_send = 0; | ||
94 | } | ||
95 | |||
96 | } | ||
97 | void parseOut() { | ||
98 | QStringList list = QStringList::split("\n", m_outp); | ||
99 | QStringList::Iterator it; | ||
100 | for (it = list.begin(); it != list.end(); ++it ) { | ||
101 | if ( (*it).startsWith("Wrote" ) ) { | ||
102 | QStringList pathes = QStringList::split(' ', (*it) ); | ||
103 | QString path = pathes[1]; | ||
104 | } | ||
105 | } | ||
106 | } | ||
107 | |||
108 | void slotStdOut(KProcess* proc, char* buf, int len) { | ||
109 | if ( proc == m_rec ) { // only recieve | ||
110 | QCString cstring( buf, len ); | ||
111 | m_outp.append( cstring.data() ); | ||
112 | } | ||
113 | |||
114 | } | ||