-rw-r--r-- | core/applets/obex/obeximpl.cc | 40 | ||||
-rw-r--r-- | core/applets/obex/obeximpl.h | 4 |
2 files changed, 38 insertions, 6 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 | |||
@@ -4,3 +4,6 @@ | |||
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> |
@@ -24,2 +27,4 @@ ObexImpl::ObexImpl( ) | |||
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 | } |
@@ -49,12 +54,13 @@ void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { | |||
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 |
@@ -84,3 +90,3 @@ 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 | } |
@@ -101,2 +107,26 @@ void ObexImpl::slotError( int errorCode) { | |||
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 | ||
diff --git a/core/applets/obex/obeximpl.h b/core/applets/obex/obeximpl.h index 4e5109f..8d10cf1 100644 --- a/core/applets/obex/obeximpl.h +++ b/core/applets/obex/obeximpl.h | |||
@@ -25,2 +25,3 @@ namespace OpieObex { | |||
25 | ObexInc *m_recvgui; | 25 | ObexInc *m_recvgui; |
26 | QString m_name; | ||
26 | private slots: | 27 | private slots: |
@@ -31,4 +32,5 @@ namespace OpieObex { | |||
31 | void slotDone(bool); | 32 | void slotDone(bool); |
32 | //void slotReceivedFile(const QString & ); | 33 | void slotReceivedFile(const QString & ); |
33 | void slotSent(); | 34 | void slotSent(); |
35 | |||
34 | }; | 36 | }; |