summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-14 10:42:07 (UTC)
committer harlekin <harlekin>2002-06-14 10:42:07 (UTC)
commit21742ad6d7b1b4d1bc00ca5025a4134d080924c1 (patch) (unidiff)
tree4e147f45afec7a9876090047196b6a4ec0f4e466
parenta014866573fc86bf63544d1f692ccdd94c0d104f (diff)
downloadopie-21742ad6d7b1b4d1bc00ca5025a4134d080924c1.zip
opie-21742ad6d7b1b4d1bc00ca5025a4134d080924c1.tar.gz
opie-21742ad6d7b1b4d1bc00ca5025a4134d080924c1.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/obex/obeximpl.cc3
-rw-r--r--core/applets/obex/obexinc.ui322
2 files changed, 132 insertions, 193 deletions
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc
index 7df933a..da47e5b 100644
--- a/core/applets/obex/obeximpl.cc
+++ b/core/applets/obex/obeximpl.cc
@@ -1,144 +1,145 @@
1 1
2#include <qdatastream.h> 2#include <qdatastream.h>
3#include <qmessagebox.h> 3#include <qmessagebox.h>
4 4
5 5
6#include <qpe/qcom.h> 6#include <qpe/qcom.h>
7#include <qpe/applnk.h> 7#include <qpe/applnk.h>
8 8
9#include <qlabel.h> 9#include <qlabel.h>
10 10
11#include "obex.h" 11#include "obex.h"
12#include "obeximpl.h" 12#include "obeximpl.h"
13 13
14 14
15 15
16using namespace OpieObex; 16using namespace OpieObex;
17 17
18ObexImpl::ObexImpl( ) 18ObexImpl::ObexImpl( )
19 : QObject() { 19 : QObject() {
20 // register to a channel 20 // register to a channel
21 qWarning( "c'tor" ); 21 qWarning( "c'tor" );
22 m_obex = new Obex(this, "obex"); 22 m_obex = new Obex(this, "obex");
23 m_sendgui = new ObexDlg(); 23 m_sendgui = new ObexDlg();
24 m_recvgui = new ObexInc(); 24 m_recvgui = new ObexInc();
25 m_chan = new QCopChannel("QPE/Obex" ); 25 m_chan = new QCopChannel("QPE/Obex" );
26 connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 26 connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
27 this, SLOT(slotMessage(const QCString&, const QByteArray&) ) ); 27 this, SLOT(slotMessage(const QCString&, const QByteArray&) ) );
28 connect(m_obex, SIGNAL(receivedFile(const QString& ) ), 28 connect(m_obex, SIGNAL(receivedFile(const QString& ) ),
29 this, SLOT(slotReceivedFile(const QString& ) ) ); 29 this, SLOT(slotReceivedFile(const QString& ) ) );
30} 30}
31 31
32ObexImpl::~ObexImpl() { 32ObexImpl::~ObexImpl() {
33 delete m_obex; 33 delete m_obex;
34 delete m_chan; 34 delete m_chan;
35 delete m_sendgui; 35 delete m_sendgui;
36} 36}
37 37
38QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 38QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
39 *iface = 0; 39 *iface = 0;
40 if( uuid == IID_QUnknown ) 40 if( uuid == IID_QUnknown )
41 *iface = this; 41 *iface = this;
42 else if( uuid == IID_ObexInterface ) 42 else if( uuid == IID_ObexInterface )
43 *iface = this; 43 *iface = this;
44 44
45 qWarning("query" ); 45 qWarning("query" );
46 if(*iface ) 46 if(*iface )
47 (*iface)->addRef(); 47 (*iface)->addRef();
48 return QS_OK; 48 return QS_OK;
49} 49}
50 50
51void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { 51void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) {
52 QDataStream stream( data, IO_ReadOnly ); 52 QDataStream stream( data, IO_ReadOnly );
53 qWarning("Message %s", msg.data() ); 53 qWarning("Message %s", msg.data() );
54 if(msg == "send(QString,QString,QString)" ) { 54 if(msg == "send(QString,QString,QString)" ) {
55 QString desc; 55 QString desc;
56 stream >> desc; 56 stream >> desc;
57 stream >> m_name; 57 stream >> m_name;
58 m_sendgui->raise(); // should be on top 58 m_sendgui->raise(); // should be on top
59 m_sendgui->showMaximized(); 59 m_sendgui->showMaximized();
60 m_sendgui->lblPath->setText(m_name); 60 m_sendgui->lblPath->setText(m_name);
61 connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()), 61 connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()),
62 this, SLOT(slotCancelSend())); 62 this, SLOT(slotCancelSend()));
63 m_obex->send(m_name ); 63 m_obex->send(m_name );
64 connect( (QObject*)m_obex, SIGNAL( sent() ), this, 64 connect( (QObject*)m_obex, SIGNAL( sent() ), this,
65 SLOT( slotSent() ) ); 65 SLOT( slotSent() ) );
66 connect( (QObject*)m_obex, SIGNAL( error(int) ), this, 66 connect( (QObject*)m_obex, SIGNAL( error(int) ), this,
67 SLOT( slotSent() ) ); 67 SLOT( slotSent() ) );
68 }else if(msg == "receive(int)" ) { // open a GUI 68 }else if(msg == "receive(int)" ) { // open a GUI
69 //m_recvgui->showMaximized(); 69 //m_recvgui->showMaximized();
70 int receiveD = 0; 70 int receiveD = 0;
71 stream >> receiveD; 71 stream >> receiveD;
72 if ( receiveD == 1) 72 if ( receiveD == 1)
73 m_obex->receive(); 73 m_obex->receive();
74 else 74 else
75 m_obex->setReceiveEnabled( false ); 75 m_obex->setReceiveEnabled( false );
76 76
77 } else if (msg =="done(QString)") { 77 } else if (msg =="done(QString)") {
78 QString text; 78 QString text;
79 stream >> text; 79 stream >> text;
80 m_sendgui->lblPath->setText(tr("Done transfering " + text)); 80 m_sendgui->lblPath->setText(tr("Done transfering " + text));
81 81
82 } 82 }
83} 83}
84 84
85void ObexImpl::slotCancelSend() { 85void ObexImpl::slotCancelSend() {
86 // cancel sync process too 86 // cancel sync process too
87 //m_obex->cancel(); // not ready yet 87 //m_obex->cancel(); // not ready yet
88 m_sendgui->hide(); 88 m_sendgui->hide();
89} 89}
90 90
91void ObexImpl::slotDone(bool) { 91void ObexImpl::slotDone(bool) {
92 QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot 92 QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot
93 e << m_name; 93 e << m_name;
94} 94}
95 95
96void ObexImpl::slotSent() { 96void ObexImpl::slotSent() {
97 m_sendgui->lblPath->setText("Done!"); 97 m_sendgui->lblPath->setText("Done!");
98 m_sendgui->hide(); 98 m_sendgui->hide();
99} 99}
100 100
101void ObexImpl::slotError( int errorCode) { 101void ObexImpl::slotError( int errorCode) {
102 102
103 QString errorString = ""; 103 QString errorString = "";
104 if (errorCode == -1) { 104 if (errorCode == -1) {
105 errorString = "test"; 105 errorString = "test";
106 } 106 }
107 qDebug("Error: " + errorString); 107 qDebug("Error: " + errorString);
108 m_sendgui->hide(); 108 m_sendgui->hide();
109} 109}
110 110
111// Received a file via beam 111// Received a file via beam
112// check for mime type and then either 112// check for mime type and then either
113// add to App via setDocument 113// add to App via setDocument
114void ObexImpl::slotReceivedFile( const QString &fileName ) { 114void ObexImpl::slotReceivedFile( const QString &fileName ) {
115 qWarning("filename %s", fileName.latin1() ); 115 qWarning("filename %s", fileName.latin1() );
116 DocLnk lnk( fileName ); 116 DocLnk lnk( fileName );
117 QString exec = lnk.exec(); 117 QString exec = lnk.exec();
118 qWarning("executing %s", exec.latin1() ); 118 qWarning("executing %s", exec.latin1() );
119 if ( exec.isEmpty() || exec == "" ) { 119 if ( exec.isEmpty() || exec == "" ) {
120 qWarning("empty"); 120 qWarning("empty");
121 if ( fileName.right(4) == ".vcf" ) 121 if ( fileName.right(4) == ".vcf" )
122 exec = "addressbook"; 122 exec = "addressbook";
123 else if ( fileName.right(4) == ".vcs" ) { 123 else if ( fileName.right(4) == ".vcs" ) {
124 exec = "datebook"; 124 exec = "datebook";
125 } 125 }
126 } // now prompt and then add it 126 } // now prompt and then add it
127 127
128 m_recvgui->PixmapLabel->setPixmap(lnk.pixmap()); 128 m_recvgui->PixmapLabel->setPixmap(lnk.pixmap());
129 m_recvgui->TextLabel1_2->setText(lnk.name()); 129 m_recvgui->AppLabel->setText(lnk.name());
130 m_recvgui->FileLabel->setText(fileName);
130 m_recvgui->showMaximized(); 131 m_recvgui->showMaximized();
131 132
132 QCString str= "QPE/Application/"; 133 QCString str= "QPE/Application/";
133 str += exec.latin1(); 134 str += exec.latin1();
134 qWarning("channel %s", str.data() ); 135 qWarning("channel %s", str.data() );
135 QCopEnvelope e(str , "setDocument(QString)" ); 136 QCopEnvelope e(str , "setDocument(QString)" );
136 e << fileName; 137 e << fileName;
137 138
138} 139}
139 140
140 141
141Q_EXPORT_INTERFACE() 142Q_EXPORT_INTERFACE()
142{ 143{
143 Q_CREATE_INSTANCE( ObexImpl ) 144 Q_CREATE_INSTANCE( ObexImpl )
144} 145}
diff --git a/core/applets/obex/obexinc.ui b/core/applets/obex/obexinc.ui
index 05eb6ee..13d2767 100644
--- a/core/applets/obex/obexinc.ui
+++ b/core/applets/obex/obexinc.ui
@@ -1,292 +1,230 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>ObexInc</class> 2<class>ObexInc</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>ObexInc</cstring> 7 <cstring>ObexInc</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>208</width> 14 <width>204</width>
15 <height>254</height> 15 <height>254</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>OBEX Receiving</string> 20 <string>OBEX Receiving</string>
21 </property> 21 </property>
22 <spacer>
23 <property>
24 <name>name</name>
25 <cstring>Spacer19</cstring>
26 </property>
27 <property stdset="1">
28 <name>orientation</name>
29 <enum>Horizontal</enum>
30 </property>
31 <property stdset="1">
32 <name>sizeType</name>
33 <enum>Fixed</enum>
34 </property>
35 <property>
36 <name>sizeHint</name>
37 <size>
38 <width>20</width>
39 <height>20</height>
40 </size>
41 </property>
42 </spacer>
43 <widget> 22 <widget>
44 <class>QLayoutWidget</class> 23 <class>QLayoutWidget</class>
45 <property stdset="1"> 24 <property stdset="1">
46 <name>name</name> 25 <name>name</name>
47 <cstring>Layout7</cstring> 26 <cstring>Layout4</cstring>
48 </property> 27 </property>
49 <property stdset="1"> 28 <property stdset="1">
50 <name>geometry</name> 29 <name>geometry</name>
51 <rect> 30 <rect>
52 <x>-14</x> 31 <x>1</x>
53 <y>-2</y> 32 <y>206</y>
54 <width>248</width> 33 <width>246</width>
55 <height>240</height> 34 <height>33</height>
56 </rect> 35 </rect>
57 </property> 36 </property>
58 <grid> 37 <hbox>
59 <property stdset="1"> 38 <property stdset="1">
60 <name>margin</name> 39 <name>margin</name>
61 <number>0</number> 40 <number>0</number>
62 </property> 41 </property>
63 <property stdset="1"> 42 <property stdset="1">
64 <name>spacing</name> 43 <name>spacing</name>
65 <number>6</number> 44 <number>6</number>
66 </property> 45 </property>
67 <widget row="3" column="0" rowspan="1" colspan="3" > 46 <spacer>
68 <class>QLayoutWidget</class>
69 <property stdset="1">
70 <name>name</name>
71 <cstring>Layout4</cstring>
72 </property>
73 <hbox>
74 <property stdset="1">
75 <name>margin</name>
76 <number>0</number>
77 </property>
78 <property stdset="1">
79 <name>spacing</name>
80 <number>6</number>
81 </property>
82 <spacer>
83 <property>
84 <name>name</name>
85 <cstring>Spacer9</cstring>
86 </property>
87 <property stdset="1">
88 <name>orientation</name>
89 <enum>Horizontal</enum>
90 </property>
91 <property stdset="1">
92 <name>sizeType</name>
93 <enum>Expanding</enum>
94 </property>
95 <property>
96 <name>sizeHint</name>
97 <size>
98 <width>20</width>
99 <height>20</height>
100 </size>
101 </property>
102 </spacer>
103 <widget>
104 <class>QPushButton</class>
105 <property stdset="1">
106 <name>name</name>
107 <cstring>InsertButton</cstring>
108 </property>
109 <property stdset="1">
110 <name>text</name>
111 <string>Insert</string>
112 </property>
113 </widget>
114 <spacer>
115 <property>
116 <name>name</name>
117 <cstring>Spacer11</cstring>
118 </property>
119 <property stdset="1">
120 <name>orientation</name>
121 <enum>Horizontal</enum>
122 </property>
123 <property stdset="1">
124 <name>sizeType</name>
125 <enum>Expanding</enum>
126 </property>
127 <property>
128 <name>sizeHint</name>
129 <size>
130 <width>20</width>
131 <height>20</height>
132 </size>
133 </property>
134 </spacer>
135 <widget>
136 <class>QPushButton</class>
137 <property stdset="1">
138 <name>name</name>
139 <cstring>RecjectButton</cstring>
140 </property>
141 <property stdset="1">
142 <name>text</name>
143 <string>Reject</string>
144 </property>
145 </widget>
146 <spacer>
147 <property>
148 <name>name</name>
149 <cstring>Spacer10</cstring>
150 </property>
151 <property stdset="1">
152 <name>orientation</name>
153 <enum>Horizontal</enum>
154 </property>
155 <property stdset="1">
156 <name>sizeType</name>
157 <enum>Expanding</enum>
158 </property>
159 <property>
160 <name>sizeHint</name>
161 <size>
162 <width>20</width>
163 <height>20</height>
164 </size>
165 </property>
166 </spacer>
167 </hbox>
168 </widget>
169 <spacer row="1" column="2" >
170 <property> 47 <property>
171 <name>name</name> 48 <name>name</name>
172 <cstring>Spacer20</cstring> 49 <cstring>Spacer9</cstring>
173 </property> 50 </property>
174 <property stdset="1"> 51 <property stdset="1">
175 <name>orientation</name> 52 <name>orientation</name>
176 <enum>Horizontal</enum> 53 <enum>Horizontal</enum>
177 </property> 54 </property>
178 <property stdset="1"> 55 <property stdset="1">
179 <name>sizeType</name> 56 <name>sizeType</name>
180 <enum>Fixed</enum> 57 <enum>Expanding</enum>
181 </property> 58 </property>
182 <property> 59 <property>
183 <name>sizeHint</name> 60 <name>sizeHint</name>
184 <size> 61 <size>
185 <width>53</width> 62 <width>20</width>
186 <height>20</height> 63 <height>20</height>
187 </size> 64 </size>
188 </property> 65 </property>
189 </spacer> 66 </spacer>
190 <widget row="1" column="0" > 67 <widget>
191 <class>QLabel</class> 68 <class>QPushButton</class>
192 <property stdset="1"> 69 <property stdset="1">
193 <name>name</name> 70 <name>name</name>
194 <cstring>PixmapLabel</cstring> 71 <cstring>InsertButton</cstring>
195 </property> 72 </property>
196 <property stdset="1"> 73 <property stdset="1">
197 <name>scaledContents</name> 74 <name>text</name>
198 <bool>true</bool> 75 <string>Insert</string>
199 </property> 76 </property>
200 </widget> 77 </widget>
201 <spacer row="2" column="1" > 78 <spacer>
202 <property> 79 <property>
203 <name>name</name> 80 <name>name</name>
204 <cstring>Spacer7</cstring> 81 <cstring>Spacer11</cstring>
205 </property> 82 </property>
206 <property stdset="1"> 83 <property stdset="1">
207 <name>orientation</name> 84 <name>orientation</name>
208 <enum>Vertical</enum> 85 <enum>Horizontal</enum>
209 </property> 86 </property>
210 <property stdset="1"> 87 <property stdset="1">
211 <name>sizeType</name> 88 <name>sizeType</name>
212 <enum>Fixed</enum> 89 <enum>Expanding</enum>
213 </property> 90 </property>
214 <property> 91 <property>
215 <name>sizeHint</name> 92 <name>sizeHint</name>
216 <size> 93 <size>
217 <width>20</width> 94 <width>20</width>
218 <height>58</height> 95 <height>20</height>
219 </size> 96 </size>
220 </property> 97 </property>
221 </spacer> 98 </spacer>
222 <widget row="1" column="1" > 99 <widget>
223 <class>QLayoutWidget</class> 100 <class>QPushButton</class>
224 <property stdset="1"> 101 <property stdset="1">
225 <name>name</name> 102 <name>name</name>
226 <cstring>Layout5</cstring> 103 <cstring>RecjectButton</cstring>
104 </property>
105 <property stdset="1">
106 <name>text</name>
107 <string>Reject</string>
227 </property> 108 </property>
228 <vbox>
229 <property stdset="1">
230 <name>margin</name>
231 <number>0</number>
232 </property>
233 <property stdset="1">
234 <name>spacing</name>
235 <number>6</number>
236 </property>
237 <widget>
238 <class>QLabel</class>
239 <property stdset="1">
240 <name>name</name>
241 <cstring>TextLabel1_2</cstring>
242 </property>
243 <property stdset="1">
244 <name>text</name>
245 <string>TextLabel1</string>
246 </property>
247 </widget>
248 <widget>
249 <class>QLabel</class>
250 <property stdset="1">
251 <name>name</name>
252 <cstring>TextLabel1</cstring>
253 </property>
254 <property stdset="1">
255 <name>text</name>
256 <string>Filename</string>
257 </property>
258 <property stdset="1">
259 <name>alignment</name>
260 <set>AlignTop|AlignLeft</set>
261 </property>
262 <property>
263 <name>vAlign</name>
264 </property>
265 </widget>
266 </vbox>
267 </widget> 109 </widget>
268 <spacer row="0" column="1" > 110 <spacer>
269 <property> 111 <property>
270 <name>name</name> 112 <name>name</name>
271 <cstring>Spacer8</cstring> 113 <cstring>Spacer10</cstring>
272 </property> 114 </property>
273 <property stdset="1"> 115 <property stdset="1">
274 <name>orientation</name> 116 <name>orientation</name>
275 <enum>Vertical</enum> 117 <enum>Horizontal</enum>
276 </property> 118 </property>
277 <property stdset="1"> 119 <property stdset="1">
278 <name>sizeType</name> 120 <name>sizeType</name>
279 <enum>Fixed</enum> 121 <enum>Expanding</enum>
280 </property> 122 </property>
281 <property> 123 <property>
282 <name>sizeHint</name> 124 <name>sizeHint</name>
283 <size> 125 <size>
284 <width>20</width> 126 <width>20</width>
285 <height>59</height> 127 <height>20</height>
286 </size> 128 </size>
287 </property> 129 </property>
288 </spacer> 130 </spacer>
289 </grid> 131 </hbox>
132 </widget>
133 <widget>
134 <class>QLabel</class>
135 <property stdset="1">
136 <name>name</name>
137 <cstring>PixmapLabel</cstring>
138 </property>
139 <property stdset="1">
140 <name>geometry</name>
141 <rect>
142 <x>20</x>
143 <y>90</y>
144 <width>40</width>
145 <height>40</height>
146 </rect>
147 </property>
148 <property stdset="1">
149 <name>scaledContents</name>
150 <bool>true</bool>
151 </property>
152 </widget>
153 <widget>
154 <class>QLayoutWidget</class>
155 <property stdset="1">
156 <name>name</name>
157 <cstring>Layout5</cstring>
158 </property>
159 <property stdset="1">
160 <name>geometry</name>
161 <rect>
162 <x>80</x>
163 <y>90</y>
164 <width>79</width>
165 <height>68</height>
166 </rect>
167 </property>
168 <vbox>
169 <property stdset="1">
170 <name>margin</name>
171 <number>0</number>
172 </property>
173 <property stdset="1">
174 <name>spacing</name>
175 <number>6</number>
176 </property>
177 <widget>
178 <class>QLabel</class>
179 <property stdset="1">
180 <name>name</name>
181 <cstring>AppLabel</cstring>
182 </property>
183 <property stdset="1">
184 <name>text</name>
185 <string>TextLabel1</string>
186 </property>
187 </widget>
188 <widget>
189 <class>QLabel</class>
190 <property stdset="1">
191 <name>name</name>
192 <cstring>FileLabel</cstring>
193 </property>
194 <property stdset="1">
195 <name>text</name>
196 <string>Filename</string>
197 </property>
198 <property stdset="1">
199 <name>alignment</name>
200 <set>AlignTop|AlignLeft</set>
201 </property>
202 <property>
203 <name>vAlign</name>
204 </property>
205 </widget>
206 </vbox>
207 </widget>
208 <widget>
209 <class>QLabel</class>
210 <property stdset="1">
211 <name>name</name>
212 <cstring>TextLabel1</cstring>
213 </property>
214 <property stdset="1">
215 <name>geometry</name>
216 <rect>
217 <x>20</x>
218 <y>20</y>
219 <width>161</width>
220 <height>41</height>
221 </rect>
222 </property>
223 <property stdset="1">
224 <name>text</name>
225 <string>A file was beamed
226to you.</string>
227 </property>
290 </widget> 228 </widget>
291</widget> 229</widget>
292</UI> 230</UI>