author | zecke <zecke> | 2002-06-13 20:33:24 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-13 20:33:24 (UTC) |
commit | 21ad567831e0be83156d5023d93aac42a60a2af3 (patch) (unidiff) | |
tree | c7b0094910e4a82cd2d2b738f2c88cd7eddfce26 /core/applets/obex/obeximpl.cc | |
parent | ed10b73df98c1b4c41a0b940e4f8729fe28c2b8a (diff) | |
download | opie-21ad567831e0be83156d5023d93aac42a60a2af3.zip opie-21ad567831e0be83156d5023d93aac42a60a2af3.tar.gz opie-21ad567831e0be83156d5023d93aac42a60a2af3.tar.bz2 |
OBEX receiving is supporte
Diffstat (limited to 'core/applets/obex/obeximpl.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/obex/obeximpl.cc | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc index 0c137af..1a1c922 100644 --- a/core/applets/obex/obeximpl.cc +++ b/core/applets/obex/obeximpl.cc | |||
@@ -2,7 +2,10 @@ | |||
2 | #include <qdatastream.h> | 2 | #include <qdatastream.h> |
3 | #include <qmessagebox.h> | 3 | #include <qmessagebox.h> |
4 | 4 | ||
5 | |||
5 | #include <qpe/qcom.h> | 6 | #include <qpe/qcom.h> |
7 | #include <qpe/applnk.h> | ||
8 | |||
6 | #include <qlabel.h> | 9 | #include <qlabel.h> |
7 | 10 | ||
8 | #include "obex.h" | 11 | #include "obex.h" |
@@ -22,6 +25,8 @@ ObexImpl::ObexImpl( ) | |||
22 | m_chan = new QCopChannel("QPE/Obex" ); | 25 | m_chan = new QCopChannel("QPE/Obex" ); |
23 | connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ), | 26 | connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ), |
24 | this, SLOT(slotMessage(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& ) ) ); | ||
25 | } | 30 | } |
26 | ObexImpl::~ObexImpl() { | 31 | ObexImpl::~ObexImpl() { |
27 | delete m_obex; | 32 | delete m_obex; |
@@ -47,16 +52,17 @@ void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { | |||
47 | if(msg == "send(QString,QString,QString)" ) { | 52 | if(msg == "send(QString,QString,QString)" ) { |
48 | QString desc; | 53 | QString desc; |
49 | stream >> desc; | 54 | stream >> desc; |
50 | QString filename; | 55 | stream >> m_name; |
51 | stream >> filename; | ||
52 | m_sendgui->raise(); // should be on top | 56 | m_sendgui->raise(); // should be on top |
53 | m_sendgui->showMaximized(); | 57 | m_sendgui->showMaximized(); |
54 | m_sendgui->lblPath->setText(filename); | 58 | m_sendgui->lblPath->setText(m_name); |
55 | connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()), | 59 | connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()), |
56 | this, SLOT(slotCancelSend())); | 60 | this, SLOT(slotCancelSend())); |
57 | m_obex->send(filename ); | 61 | m_obex->send(m_name ); |
58 | connect( (QObject*)m_obex, SIGNAL( sent() ), this, | 62 | connect( (QObject*)m_obex, SIGNAL( sent() ), this, |
59 | SLOT( slotSent() ) ); | 63 | SLOT( slotSent() ) ); |
64 | connect( (QObject*)m_obex, SIGNAL( error(int) ), this, | ||
65 | SLOT( slotSent() ) ); | ||
60 | }else if(msg == "receive(int)" ) { // open a GUI | 66 | }else if(msg == "receive(int)" ) { // open a GUI |
61 | m_recvgui->showMaximized(); | 67 | m_recvgui->showMaximized(); |
62 | int receiveD = 0; | 68 | int receiveD = 0; |
@@ -82,7 +88,7 @@ void ObexImpl::slotCancelSend() { | |||
82 | 88 | ||
83 | void ObexImpl::slotDone(bool) { | 89 | void ObexImpl::slotDone(bool) { |
84 | QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot | 90 | QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot |
85 | e << "Done!"; | 91 | e << m_name; |
86 | } | 92 | } |
87 | 93 | ||
88 | void ObexImpl::slotSent() { | 94 | void ObexImpl::slotSent() { |
@@ -99,6 +105,30 @@ void ObexImpl::slotError( int errorCode) { | |||
99 | qDebug("Error: " + errorString); | 105 | qDebug("Error: " + errorString); |
100 | m_sendgui->hide(); | 106 | m_sendgui->hide(); |
101 | } | 107 | } |
108 | // Received a file via beam | ||
109 | // check for mime type and then either | ||
110 | // add to App via setDocument | ||
111 | void ObexImpl::slotReceivedFile( const QString &fileName ) { | ||
112 | qWarning("filename %s", fileName.latin1() ); | ||
113 | DocLnk lnk( fileName ); | ||
114 | QString exec = lnk.exec(); | ||
115 | qWarning("executing %s", exec.latin1() ); | ||
116 | if ( exec.isEmpty() || exec == "" ) { | ||
117 | qWarning("empty"); | ||
118 | if ( fileName.right(4) == ".vcf" ) | ||
119 | exec = "addressbook"; | ||
120 | else if ( fileName.right(4) == ".vcs" ) { | ||
121 | exec = "datebook"; | ||
122 | } | ||
123 | } // now prompt and then add it | ||
124 | QCString str= "QPE/Application/"; | ||
125 | str += exec.latin1(); | ||
126 | qWarning("channel %s", str.data() ); | ||
127 | QCopEnvelope e(str , "setDocument(QString)" ); | ||
128 | e << fileName; | ||
129 | |||
130 | } | ||
131 | |||
102 | 132 | ||
103 | Q_EXPORT_INTERFACE() | 133 | Q_EXPORT_INTERFACE() |
104 | { | 134 | { |