-rw-r--r-- | core/obex/receiver.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp index 50ee6cb..d5a7271 100644 --- a/core/obex/receiver.cpp +++ b/core/obex/receiver.cpp | |||
@@ -39,94 +39,98 @@ void Receiver::slotReceived( const QString& file ) { | |||
39 | handleDateTodo( file ); | 39 | handleDateTodo( file ); |
40 | else | 40 | else |
41 | handleOther( file ); | 41 | handleOther( file ); |
42 | } | 42 | } |
43 | void Receiver::handleAddr( const QString& str ) { | 43 | void Receiver::handleAddr( const QString& str ) { |
44 | QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" ); | 44 | QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" ); |
45 | e << str; | 45 | e << str; |
46 | } | 46 | } |
47 | /* we can not say for sure if it's a VEevent ot VTodo */ | 47 | /* we can not say for sure if it's a VEevent ot VTodo */ |
48 | void Receiver::handleDateTodo( const QString& str ) { | 48 | void Receiver::handleDateTodo( const QString& str ) { |
49 | QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)"); | 49 | QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)"); |
50 | e0 << str; | 50 | e0 << str; |
51 | QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); | 51 | QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); |
52 | e1 << str; | 52 | e1 << str; |
53 | } | 53 | } |
54 | /* | 54 | /* |
55 | * Handle other asks if it should accept the | 55 | * Handle other asks if it should accept the |
56 | * beamed object and creates a DocLnk | 56 | * beamed object and creates a DocLnk |
57 | */ | 57 | */ |
58 | void Receiver::handleOther( const QString& other ) { | 58 | void Receiver::handleOther( const QString& other ) { |
59 | OtherHandler* hand = new OtherHandler(); | 59 | OtherHandler* hand = new OtherHandler(); |
60 | hand->handle( other ); | 60 | hand->handle( other ); |
61 | } | 61 | } |
62 | int Receiver::checkFile( const QString& file ) { | 62 | int Receiver::checkFile( const QString& file ) { |
63 | qWarning("check file!! %s", file.latin1() ); | ||
63 | int ret; | 64 | int ret; |
64 | if (file.right(4) == ".vcs" ) { | 65 | if (file.right(4) == ".vcs" ) { |
65 | ret = Datebook; | 66 | ret = Datebook; |
66 | }else if ( file.right(4) == ".vcf") { | 67 | }else if ( file.right(4) == ".vcf") { |
67 | ret = AddressBook; | 68 | ret = AddressBook; |
68 | }else | 69 | }else |
69 | ret = Other; | 70 | ret = Other; |
70 | 71 | ||
72 | |||
73 | qWarning("check it now %d", ret ); | ||
71 | return ret; | 74 | return ret; |
72 | } | 75 | } |
73 | 76 | ||
74 | OtherHandler::OtherHandler() | 77 | OtherHandler::OtherHandler() |
75 | : QVBox() | 78 | : QVBox() |
76 | { | 79 | { |
77 | QHBox* box = new QHBox(this); | 80 | QHBox* box = new QHBox(this); |
78 | QLabel* lbl = new QLabel(box); | 81 | QLabel* lbl = new QLabel(box); |
79 | lbl->setText(tr("<qt><b>Received:</b></qt>")); | 82 | lbl->setText(tr("<qt><b>Received:</b></qt>")); |
80 | m_na = new QLabel(box); | 83 | m_na = new QLabel(box); |
81 | 84 | ||
82 | QFrame* frame = new QFrame(this); | 85 | QFrame* frame = new QFrame(this); |
83 | frame->setFrameShape( QFrame::HLine ); | 86 | frame->setFrameShape( QFrame::HLine ); |
84 | frame->setFrameShadow( QFrame::Sunken ); | 87 | frame->setFrameShadow( QFrame::Sunken ); |
85 | 88 | ||
86 | m_view = new QTextView(this); | 89 | m_view = new QTextView(this); |
87 | 90 | ||
88 | box = new QHBox(this); | 91 | box = new QHBox(this); |
89 | QPushButton *but = new QPushButton(box); | 92 | QPushButton *but = new QPushButton(box); |
90 | but->setText(tr("Accept") ); | 93 | but->setText(tr("Accept") ); |
91 | connect(but, SIGNAL(clicked() ), | 94 | connect(but, SIGNAL(clicked() ), |
92 | this, SLOT(accept()) ); | 95 | this, SLOT(accept()) ); |
93 | 96 | ||
94 | but = new QPushButton(box); | 97 | but = new QPushButton(box); |
95 | but->setText(tr("Deny") ); | 98 | but->setText(tr("Deny") ); |
96 | connect(but, SIGNAL(clicked() ), | 99 | connect(but, SIGNAL(clicked() ), |
97 | this, SLOT(deny() ) ); | 100 | this, SLOT(deny() ) ); |
98 | 101 | ||
99 | raise(); | 102 | raise(); |
100 | showMaximized(); | 103 | showMaximized(); |
101 | } | 104 | } |
102 | OtherHandler::~OtherHandler() { | 105 | OtherHandler::~OtherHandler() { |
103 | 106 | ||
104 | } | 107 | } |
105 | void OtherHandler::handle( const QString& file ) { | 108 | void OtherHandler::handle( const QString& file ) { |
106 | m_file = file; | 109 | m_file = file; |
107 | m_na->setText(file); | 110 | m_na->setText(file); |
108 | DocLnk lnk(file); | 111 | DocLnk lnk(file); |
112 | qWarning(" %s %s", lnk.type().latin1(), lnk.icon().latin1() ); | ||
109 | 113 | ||
110 | QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); | 114 | QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); |
111 | m_view->setText( str ); | 115 | m_view->setText( str ); |
112 | } | 116 | } |
113 | 117 | ||
114 | /* | 118 | /* |
115 | * hehe evil evil mmap ahead :) | 119 | * hehe evil evil mmap ahead :) |
116 | * we quickly copy the file and then we'll create a DocLnk for it | 120 | * we quickly copy the file and then we'll create a DocLnk for it |
117 | */ | 121 | */ |
118 | void OtherHandler::accept() { | 122 | void OtherHandler::accept() { |
119 | QString na = targetName( m_file ); | 123 | QString na = targetName( m_file ); |
120 | copy(m_file, na ); | 124 | copy(m_file, na ); |
121 | DocLnk lnk(na); | 125 | DocLnk lnk(na); |
122 | lnk.writeLink(); | 126 | lnk.writeLink(); |
123 | QFile::remove(m_file); | 127 | QFile::remove(m_file); |
124 | delete this; | 128 | delete this; |
125 | } | 129 | } |
126 | void OtherHandler::deny() { | 130 | void OtherHandler::deny() { |
127 | QFile::remove( m_file ); | 131 | QFile::remove( m_file ); |
128 | delete this; | 132 | delete this; |
129 | } | 133 | } |
130 | QString OtherHandler::targetName( const QString& file ) { | 134 | QString OtherHandler::targetName( const QString& file ) { |
131 | QFileInfo info( file ); | 135 | QFileInfo info( file ); |
132 | QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); | 136 | QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); |