-rw-r--r-- | core/obex/receiver.cpp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp index ee2668b..8885256 100644 --- a/core/obex/receiver.cpp +++ b/core/obex/receiver.cpp | |||
@@ -1,27 +1,30 @@ | |||
1 | #include <sys/types.h> | 1 | #include "obex.h" |
2 | #include <sys/stat.h> | 2 | #include "receiver.h" |
3 | #include <sys/mman.h> | 3 | using namespace OpieObex; |
4 | #include <stdlib.h> // int system | ||
5 | #include <unistd.h> | ||
6 | 4 | ||
7 | #include <fcntl.h> | 5 | /* OPIE */ |
6 | #include <opie2/odebug.h> | ||
7 | #include <qpe/applnk.h> | ||
8 | #include <qpe/qpeapplication.h> | ||
9 | #include <qpe/qcopenvelope_qws.h> | ||
10 | using namespace Opie::Core; | ||
8 | 11 | ||
12 | /* QT */ | ||
9 | #include <qfileinfo.h> | 13 | #include <qfileinfo.h> |
10 | #include <qlabel.h> | 14 | #include <qlabel.h> |
11 | #include <qtextview.h> | 15 | #include <qtextview.h> |
12 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
13 | 17 | ||
14 | #include <qpe/applnk.h> | 18 | /* STD */ |
15 | #include <qpe/qpeapplication.h> | 19 | #include <sys/types.h> |
16 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <sys/stat.h> |
17 | 21 | #include <sys/mman.h> | |
18 | #include "obex.h" | 22 | #include <stdlib.h> // int system |
19 | #include "receiver.h" | 23 | #include <unistd.h> |
20 | 24 | #include <fcntl.h> | |
21 | using namespace OpieObex; | ||
22 | 25 | ||
23 | /* TRANSLATOR OpieObex::Receiver */ | 26 | /* TRANSLATOR OpieObex::Receiver */ |
24 | 27 | ||
25 | Receiver::Receiver() { | 28 | Receiver::Receiver() { |
26 | m_obex = new Obex(this, "Receiver"); | 29 | m_obex = new Obex(this, "Receiver"); |
27 | connect(m_obex, SIGNAL(receivedFile(const QString&) ), | 30 | connect(m_obex, SIGNAL(receivedFile(const QString&) ), |
@@ -72,20 +75,20 @@ void Receiver::tidyUp( QString& _file, const QString& ending) { | |||
72 | if ( fd == -1 ) | 75 | if ( fd == -1 ) |
73 | return; | 76 | return; |
74 | 77 | ||
75 | (void)::strncat( foo, ending.latin1(), 4 ); | 78 | (void)::strncat( foo, ending.latin1(), 4 ); |
76 | _file = QString::fromLatin1( foo ); | 79 | _file = QString::fromLatin1( foo ); |
77 | QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) ); | 80 | QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) ); |
78 | qWarning("Executing: %s", cmd.latin1() ); | 81 | owarn << "Executing: " << cmd << "" << oendl; |
79 | (void)::system( cmd.latin1() ); | 82 | (void)::system( cmd.latin1() ); |
80 | 83 | ||
81 | cmd = QString("rm %1").arg( Global::shellQuote(file) ); | 84 | cmd = QString("rm %1").arg( Global::shellQuote(file) ); |
82 | (void)::system( cmd.latin1() ); | 85 | (void)::system( cmd.latin1() ); |
83 | } | 86 | } |
84 | int Receiver::checkFile( QString& file ) { | 87 | int Receiver::checkFile( QString& file ) { |
85 | qWarning("check file!! %s", file.latin1() ); | 88 | owarn << "check file!! " << file << "" << oendl; |
86 | int ret; | 89 | int ret; |
87 | QString ending; | 90 | QString ending; |
88 | 91 | ||
89 | if (file.right(4) == ".vcs" ) { | 92 | if (file.right(4) == ".vcs" ) { |
90 | ret = Datebook; | 93 | ret = Datebook; |
91 | ending = QString::fromLatin1(".vcs"); | 94 | ending = QString::fromLatin1(".vcs"); |
@@ -104,13 +107,13 @@ int Receiver::checkFile( QString& file ) { | |||
104 | * and M$ likes to send that. So we will executed a small | 107 | * and M$ likes to send that. So we will executed a small |
105 | * tidy up system sed script | 108 | * tidy up system sed script |
106 | * At this point we can also remove umlaute from the filename | 109 | * At this point we can also remove umlaute from the filename |
107 | */ | 110 | */ |
108 | tidyUp( file, ending ); | 111 | tidyUp( file, ending ); |
109 | 112 | ||
110 | qWarning("check it now %d", ret ); | 113 | owarn << "check it now " << ret << "" << oendl; |
111 | return ret; | 114 | return ret; |
112 | } | 115 | } |
113 | 116 | ||
114 | /* TRANSLATOR OpieObex::OtherHandler */ | 117 | /* TRANSLATOR OpieObex::OtherHandler */ |
115 | 118 | ||
116 | OtherHandler::OtherHandler() | 119 | OtherHandler::OtherHandler() |
@@ -145,13 +148,13 @@ OtherHandler::~OtherHandler() { | |||
145 | 148 | ||
146 | } | 149 | } |
147 | void OtherHandler::handle( const QString& file ) { | 150 | void OtherHandler::handle( const QString& file ) { |
148 | m_file = file; | 151 | m_file = file; |
149 | m_na->setText(file); | 152 | m_na->setText(file); |
150 | DocLnk lnk(file); | 153 | DocLnk lnk(file); |
151 | qWarning(" %s %s", lnk.type().latin1(), lnk.icon().latin1() ); | 154 | owarn << " " << lnk.type() << " " << lnk.icon() << "" << oendl; |
152 | 155 | ||
153 | 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() ); | 156 | 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() ); |
154 | m_view->setText( str ); | 157 | m_view->setText( str ); |
155 | } | 158 | } |
156 | 159 | ||
157 | /* | 160 | /* |
@@ -188,12 +191,12 @@ QString OtherHandler::targetName( const QString& file ) { | |||
188 | 191 | ||
189 | return newFile; | 192 | return newFile; |
190 | } | 193 | } |
191 | 194 | ||
192 | /* fast cpy */ | 195 | /* fast cpy */ |
193 | void OtherHandler::copy(const QString& src, const QString& file) { | 196 | void OtherHandler::copy(const QString& src, const QString& file) { |
194 | qWarning("src %s, dest %s", src.latin1(),file.latin1() ); | 197 | owarn << "src " << src << ", dest " << file << "" << oendl; |
195 | QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )). | 198 | QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )). |
196 | arg( Global::shellQuote( file ) ); | 199 | arg( Global::shellQuote( file ) ); |
197 | ::system( cmd.latin1() ); | 200 | ::system( cmd.latin1() ); |
198 | // done | 201 | // done |
199 | } | 202 | } |