summaryrefslogtreecommitdiff
path: root/core/obex/receiver.cpp
Unidiff
Diffstat (limited to 'core/obex/receiver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/receiver.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp
index 7d9f7ec..ee2668b 100644
--- a/core/obex/receiver.cpp
+++ b/core/obex/receiver.cpp
@@ -1,76 +1,76 @@
1#include <sys/types.h> 1#include <sys/types.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/mman.h> 3#include <sys/mman.h>
4#include <stdlib.h> // int system 4#include <stdlib.h> // int system
5#include <unistd.h> 5#include <unistd.h>
6 6
7#include <fcntl.h> 7#include <fcntl.h>
8 8
9#include <qfileinfo.h> 9#include <qfileinfo.h>
10#include <qlabel.h> 10#include <qlabel.h>
11#include <qtextview.h> 11#include <qtextview.h>
12#include <qpushbutton.h> 12#include <qpushbutton.h>
13 13
14#include <qpe/applnk.h> 14#include <qpe/applnk.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/qcopenvelope_qws.h> 16#include <qpe/qcopenvelope_qws.h>
17 17
18#include "obex.h" 18#include "obex.h"
19#include "receiver.h" 19#include "receiver.h"
20 20
21using namespace OpieObex; 21using namespace OpieObex;
22 22
23/* TRANSLATOR OpieObex::Receiver */ 23/* TRANSLATOR OpieObex::Receiver */
24 24
25Receiver::Receiver() { 25Receiver::Receiver() {
26 m_obex = new Obex(this, "Receiver"); 26 m_obex = new Obex(this, "Receiver");
27 connect(m_obex, SIGNAL(receivedFile(const QString& ) ), 27 connect(m_obex, SIGNAL(receivedFile(const QString&) ),
28 this, SLOT(slotReceived(const QString& ) ) ); 28 this, SLOT(slotReceived(const QString&) ) );
29 m_obex->receive(); 29 m_obex->receive();
30} 30}
31Receiver::~Receiver() { 31Receiver::~Receiver() {
32 m_obex->setReceiveEnabled( false ); 32 m_obex->setReceiveEnabled( false );
33 delete m_obex; 33 delete m_obex;
34} 34}
35void Receiver::slotReceived( const QString& _file ) { 35void Receiver::slotReceived( const QString& _file ) {
36 QString file = _file; 36 QString file = _file;
37 int check = checkFile(file); 37 int check = checkFile(file);
38 if ( check == AddressBook ) 38 if ( check == AddressBook )
39 handleAddr( file ); 39 handleAddr( file );
40 else if ( check == Datebook ) 40 else if ( check == Datebook )
41 handleDateTodo( file ); 41 handleDateTodo( file );
42 else 42 else
43 handleOther( file ); 43 handleOther( file );
44} 44}
45void Receiver::handleAddr( const QString& str ) { 45void Receiver::handleAddr( const QString& str ) {
46 QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" ); 46 QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" );
47 e << str; 47 e << str;
48} 48}
49/* we can not say for sure if it's a VEevent ot VTodo */ 49/* we can not say for sure if it's a VEevent ot VTodo */
50void Receiver::handleDateTodo( const QString& str ) { 50void Receiver::handleDateTodo( const QString& str ) {
51 QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)"); 51 QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)");
52 e0 << str; 52 e0 << str;
53 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); 53 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" );
54 e1 << str; 54 e1 << str;
55} 55}
56/* 56/*
57 * Handle other asks if it should accept the 57 * Handle other asks if it should accept the
58 * beamed object and creates a DocLnk 58 * beamed object and creates a DocLnk
59 */ 59 */
60void Receiver::handleOther( const QString& other ) { 60void Receiver::handleOther( const QString& other ) {
61 OtherHandler* hand = new OtherHandler(); 61 OtherHandler* hand = new OtherHandler();
62 hand->handle( other ); 62 hand->handle( other );
63} 63}
64void Receiver::tidyUp( QString& _file, const QString& ending) { 64void Receiver::tidyUp( QString& _file, const QString& ending) {
65 /* libversit fails on BASE64 encoding we try to sed it away */ 65 /* libversit fails on BASE64 encoding we try to sed it away */
66 QString file = _file; 66 QString file = _file;
67 char foo[24]; // big enough 67 char foo[24]; // big enough
68 (void)::strcpy(foo, "/tmp/opie-XXXXXX"); 68 (void)::strcpy(foo, "/tmp/opie-XXXXXX");
69 69
70 int fd = ::mkstemp(foo); 70 int fd = ::mkstemp(foo);
71 71
72 if ( fd == -1 ) 72 if ( fd == -1 )
73 return; 73 return;
74 74
75 (void)::strncat( foo, ending.latin1(), 4 ); 75 (void)::strncat( foo, ending.latin1(), 4 );
76 _file = QString::fromLatin1( foo ); 76 _file = QString::fromLatin1( foo );