summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/obex/obeximpl.cc19
-rw-r--r--core/applets/obex/obexinc.ui204
2 files changed, 115 insertions, 108 deletions
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc
index da47e5b..eb0e67b 100644
--- a/core/applets/obex/obeximpl.cc
+++ b/core/applets/obex/obeximpl.cc
@@ -1,145 +1,152 @@
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 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() ));
30} 34}
31 35
32ObexImpl::~ObexImpl() { 36ObexImpl::~ObexImpl() {
33 delete m_obex; 37 delete m_obex;
34 delete m_chan; 38 delete m_chan;
35 delete m_sendgui; 39 delete m_sendgui;
40 delete m_recvgui;
36} 41}
37 42
38QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 43QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
39 *iface = 0; 44 *iface = 0;
40 if( uuid == IID_QUnknown ) 45 if( uuid == IID_QUnknown )
41 *iface = this; 46 *iface = this;
42 else if( uuid == IID_ObexInterface ) 47 else if( uuid == IID_ObexInterface )
43 *iface = this; 48 *iface = this;
44 49
45 qWarning("query" ); 50 qWarning("query" );
46 if(*iface ) 51 if(*iface )
47 (*iface)->addRef(); 52 (*iface)->addRef();
48 return QS_OK; 53 return QS_OK;
49} 54}
50 55
51void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { 56void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) {
52 QDataStream stream( data, IO_ReadOnly ); 57 QDataStream stream( data, IO_ReadOnly );
53 qWarning("Message %s", msg.data() ); 58 qWarning("Message %s", msg.data() );
54 if(msg == "send(QString,QString,QString)" ) { 59 if(msg == "send(QString,QString,QString)" ) {
55 QString desc; 60 QString desc;
56 stream >> desc; 61 stream >> desc;
57 stream >> m_name; 62 stream >> m_name;
58 m_sendgui->raise(); // should be on top 63 m_sendgui->raise(); // should be on top
59 m_sendgui->showMaximized(); 64 m_sendgui->showMaximized();
60 m_sendgui->lblPath->setText(m_name); 65 m_sendgui->lblPath->setText(m_name);
61 connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()), 66 connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()),
62 this, SLOT(slotCancelSend())); 67 this, SLOT(slotCancelSend()));
63 m_obex->send(m_name ); 68 m_obex->send(m_name );
64 connect( (QObject*)m_obex, SIGNAL( sent() ), this, 69 connect( (QObject*)m_obex, SIGNAL( sent() ), this,
65 SLOT( slotSent() ) ); 70 SLOT( slotSent() ) );
66 connect( (QObject*)m_obex, SIGNAL( error(int) ), this, 71 connect( (QObject*)m_obex, SIGNAL( error(int) ), this,
67 SLOT( slotSent() ) ); 72 SLOT( slotSent() ) );
68 }else if(msg == "receive(int)" ) { // open a GUI 73 }else if(msg == "receive(int)" ) { // open a GUI
69 //m_recvgui->showMaximized(); 74 //m_recvgui->showMaximized();
70 int receiveD = 0; 75 int receiveD = 0;
71 stream >> receiveD; 76 stream >> receiveD;
72 if ( receiveD == 1) 77 if ( receiveD == 1)
73 m_obex->receive(); 78 m_obex->receive();
74 else 79 else
75 m_obex->setReceiveEnabled( false ); 80 m_obex->setReceiveEnabled( false );
76 81
77 } else if (msg =="done(QString)") { 82 } else if (msg =="done(QString)") {
78 QString text; 83 QString text;
79 stream >> text; 84 stream >> text;
80 m_sendgui->lblPath->setText(tr("Done transfering " + text)); 85 m_sendgui->lblPath->setText(tr("Done transfering " + text));
81 86
82 } 87 }
83} 88}
84 89
85void ObexImpl::slotCancelSend() { 90void ObexImpl::slotCancelSend() {
86 // cancel sync process too 91 // cancel sync process too
87 //m_obex->cancel(); // not ready yet 92 //m_obex->cancel(); // not ready yet
88 m_sendgui->hide(); 93 m_sendgui->hide();
89} 94}
90 95
91void ObexImpl::slotDone(bool) { 96void ObexImpl::slotDone(bool) {
92 QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot 97 QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot
93 e << m_name; 98 e << m_name;
94} 99}
95 100
96void ObexImpl::slotSent() { 101void ObexImpl::slotSent() {
97 m_sendgui->lblPath->setText("Done!"); 102 m_sendgui->lblPath->setText("Done!");
98 m_sendgui->hide(); 103 m_sendgui->hide();
99} 104}
100 105
101void ObexImpl::slotError( int errorCode) { 106void ObexImpl::slotError( int errorCode) {
102 107
103 QString errorString = ""; 108 QString errorString = "";
104 if (errorCode == -1) { 109 if (errorCode == -1) {
105 errorString = "test"; 110 errorString = "test";
106 } 111 }
107 qDebug("Error: " + errorString); 112 qDebug("Error: " + errorString);
108 m_sendgui->hide(); 113 m_sendgui->hide();
109} 114}
110 115
111// Received a file via beam 116// Received a file via beam
112// check for mime type and then either 117// check for mime type and then either
113// add to App via setDocument 118// add to App via setDocument
114void ObexImpl::slotReceivedFile( const QString &fileName ) { 119void ObexImpl::slotReceivedFile( const QString &fileName ) {
115 qWarning("filename %s", fileName.latin1() ); 120 qWarning("filename %s", fileName.latin1() );
116 DocLnk lnk( fileName ); 121 DocLnk lnk( fileName );
117 QString exec = lnk.exec(); 122 QString exec = lnk.exec();
118 qWarning("executing %s", exec.latin1() ); 123 qWarning("executing %s", exec.latin1() );
119 if ( exec.isEmpty() || exec == "" ) { 124 if ( exec.isEmpty() || exec == "" ) {
120 qWarning("empty"); 125 qWarning("empty");
121 if ( fileName.right(4) == ".vcf" ) 126 if ( fileName.right(4) == ".vcf" )
122 exec = "addressbook"; 127 exec = "addressbook";
123 else if ( fileName.right(4) == ".vcs" ) { 128 else if ( fileName.right(4) == ".vcs" ) {
124 exec = "datebook"; 129 exec = "datebook";
125 } 130 }
126 } // now prompt and then add it 131 } // now prompt and then add it
127 132
128 m_recvgui->PixmapLabel->setPixmap(lnk.pixmap()); 133 m_recvgui->PixmapLabel->setPixmap(lnk.pixmap());
129 m_recvgui->AppLabel->setText(lnk.name()); 134 m_recvgui->AppLabel->setText(lnk.name());
130 m_recvgui->FileLabel->setText(fileName); 135 m_recvgui->FileLabel->setText(fileName);
131 m_recvgui->showMaximized(); 136 m_recvgui->showMaximized();
132 137 if( m_recvgui->exec() != -1 ) {
133 QCString str= "QPE/Application/"; 138 QCString str= "QPE/Application/";
134 str += exec.latin1(); 139 str += exec.latin1();
135 qWarning("channel %s", str.data() ); 140 qWarning("channel %s", str.data() );
136 QCopEnvelope e(str , "setDocument(QString)" ); 141 QCopEnvelope e(str , "setDocument(QString)" );
137 e << fileName; 142 e << fileName;
143 }
138 144
139} 145}
140 146
141 147
148
142Q_EXPORT_INTERFACE() 149Q_EXPORT_INTERFACE()
143{ 150{
144 Q_CREATE_INSTANCE( ObexImpl ) 151 Q_CREATE_INSTANCE( ObexImpl )
145} 152}
diff --git a/core/applets/obex/obexinc.ui b/core/applets/obex/obexinc.ui
index 13d2767..4cc8056 100644
--- a/core/applets/obex/obexinc.ui
+++ b/core/applets/obex/obexinc.ui
@@ -1,230 +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>QDialog</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>204</width> 14 <width>208</width>
15 <height>254</height> 15 <height>248</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 <widget> 22 <widget>
23 <class>QLayoutWidget</class> 23 <class>QLayoutWidget</class>
24 <property stdset="1"> 24 <property stdset="1">
25 <name>name</name> 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
95to 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>
26 <cstring>Layout4</cstring> 122 <cstring>Layout4</cstring>
27 </property> 123 </property>
28 <property stdset="1"> 124 <property stdset="1">
29 <name>geometry</name> 125 <name>geometry</name>
30 <rect> 126 <rect>
31 <x>1</x> 127 <x>0</x>
32 <y>206</y> 128 <y>210</y>
33 <width>246</width> 129 <width>246</width>
34 <height>33</height> 130 <height>33</height>
35 </rect> 131 </rect>
36 </property> 132 </property>
37 <hbox> 133 <hbox>
38 <property stdset="1"> 134 <property stdset="1">
39 <name>margin</name> 135 <name>margin</name>
40 <number>0</number> 136 <number>0</number>
41 </property> 137 </property>
42 <property stdset="1"> 138 <property stdset="1">
43 <name>spacing</name> 139 <name>spacing</name>
44 <number>6</number> 140 <number>6</number>
45 </property> 141 </property>
46 <spacer> 142 <spacer>
47 <property> 143 <property>
48 <name>name</name> 144 <name>name</name>
49 <cstring>Spacer9</cstring> 145 <cstring>Spacer9</cstring>
50 </property> 146 </property>
51 <property stdset="1"> 147 <property stdset="1">
52 <name>orientation</name> 148 <name>orientation</name>
53 <enum>Horizontal</enum> 149 <enum>Horizontal</enum>
54 </property> 150 </property>
55 <property stdset="1"> 151 <property stdset="1">
56 <name>sizeType</name> 152 <name>sizeType</name>
57 <enum>Expanding</enum> 153 <enum>Expanding</enum>
58 </property> 154 </property>
59 <property> 155 <property>
60 <name>sizeHint</name> 156 <name>sizeHint</name>
61 <size> 157 <size>
62 <width>20</width> 158 <width>20</width>
63 <height>20</height> 159 <height>20</height>
64 </size> 160 </size>
65 </property> 161 </property>
66 </spacer> 162 </spacer>
67 <widget> 163 <widget>
68 <class>QPushButton</class> 164 <class>QPushButton</class>
69 <property stdset="1"> 165 <property stdset="1">
70 <name>name</name> 166 <name>name</name>
71 <cstring>InsertButton</cstring> 167 <cstring>InsertButton</cstring>
72 </property> 168 </property>
73 <property stdset="1"> 169 <property stdset="1">
74 <name>text</name> 170 <name>text</name>
75 <string>Insert</string> 171 <string>Insert</string>
76 </property> 172 </property>
77 </widget> 173 </widget>
78 <spacer> 174 <spacer>
79 <property> 175 <property>
80 <name>name</name> 176 <name>name</name>
81 <cstring>Spacer11</cstring> 177 <cstring>Spacer11</cstring>
82 </property> 178 </property>
83 <property stdset="1"> 179 <property stdset="1">
84 <name>orientation</name> 180 <name>orientation</name>
85 <enum>Horizontal</enum> 181 <enum>Horizontal</enum>
86 </property> 182 </property>
87 <property stdset="1"> 183 <property stdset="1">
88 <name>sizeType</name> 184 <name>sizeType</name>
89 <enum>Expanding</enum> 185 <enum>Expanding</enum>
90 </property> 186 </property>
91 <property> 187 <property>
92 <name>sizeHint</name> 188 <name>sizeHint</name>
93 <size> 189 <size>
94 <width>20</width> 190 <width>20</width>
95 <height>20</height> 191 <height>20</height>
96 </size> 192 </size>
97 </property> 193 </property>
98 </spacer> 194 </spacer>
99 <widget> 195 <widget>
100 <class>QPushButton</class> 196 <class>QPushButton</class>
101 <property stdset="1"> 197 <property stdset="1">
102 <name>name</name> 198 <name>name</name>
103 <cstring>RecjectButton</cstring> 199 <cstring>RejectButton</cstring>
104 </property> 200 </property>
105 <property stdset="1"> 201 <property stdset="1">
106 <name>text</name> 202 <name>text</name>
107 <string>Reject</string> 203 <string>Reject</string>
108 </property> 204 </property>
109 </widget> 205 </widget>
110 <spacer> 206 <spacer>
111 <property> 207 <property>
112 <name>name</name> 208 <name>name</name>
113 <cstring>Spacer10</cstring> 209 <cstring>Spacer10</cstring>
114 </property> 210 </property>
115 <property stdset="1"> 211 <property stdset="1">
116 <name>orientation</name> 212 <name>orientation</name>
117 <enum>Horizontal</enum> 213 <enum>Horizontal</enum>
118 </property> 214 </property>
119 <property stdset="1"> 215 <property stdset="1">
120 <name>sizeType</name> 216 <name>sizeType</name>
121 <enum>Expanding</enum> 217 <enum>Expanding</enum>
122 </property> 218 </property>
123 <property> 219 <property>
124 <name>sizeHint</name> 220 <name>sizeHint</name>
125 <size> 221 <size>
126 <width>20</width> 222 <width>20</width>
127 <height>20</height> 223 <height>20</height>
128 </size> 224 </size>
129 </property> 225 </property>
130 </spacer> 226 </spacer>
131 </hbox> 227 </hbox>
132 </widget> 228 </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>
228 </widget>
229</widget> 229</widget>
230</UI> 230</UI>