summaryrefslogtreecommitdiff
path: root/core/obex/receiver.cpp
Side-by-side diff
Diffstat (limited to 'core/obex/receiver.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/obex/receiver.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp
index d4ae323..7d9a42a 100644
--- a/core/obex/receiver.cpp
+++ b/core/obex/receiver.cpp
@@ -67,60 +67,57 @@ void Receiver::handleOther( const QString& other ) {
}
void Receiver::tidyUp( QString& _file, const QString& ending) {
/* libversit fails on BASE64 encoding we try to sed it away */
QString file = _file;
char foo[24]; // big enough
(void)::strcpy(foo, "/tmp/opie-XXXXXX");
int fd = ::mkstemp(foo);
if ( fd == -1 )
return;
- (void)::strncat( foo, ending.latin1(), 4 );
- _file = QString::fromLatin1( foo );
+ (void)::strncat( foo, QFile::encodeName(ending), 4 );
+ _file = QString::fromLocal8Bit( foo );
QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) );
- owarn << "Executing: " << cmd << "" << oendl;
- (void)::system( cmd.latin1() );
+ (void)::system( QFile::encodeName(cmd) );
cmd = QString("rm %1").arg( Global::shellQuote(file) );
- (void)::system( cmd.latin1() );
+ (void)::system( QFile::encodeName(cmd) );
}
int Receiver::checkFile( QString& file ) {
- owarn << "check file!! " << file << "" << oendl;
int ret;
QString ending;
if (file.right(4) == ".vcs" ) {
ret = Datebook;
ending = QString::fromLatin1(".vcs");
}else if ( file.right(4) == ".vcf") {
ret = AddressBook;
ending = QString::fromLatin1(".vcf");
}else
ret = Other;
if (ending.isEmpty() )
return ret;
/**
* currently the parser is broken in regard of BASE64 encoding
* and M$ likes to send that. So we will executed a small
* tidy up system sed script
* At this point we can also remove umlaute from the filename
*/
tidyUp( file, ending );
- owarn << "check it now " << ret << "" << oendl;
return ret;
}
/* TRANSLATOR OpieObex::OtherHandler */
OtherHandler::OtherHandler()
: QVBox()
{
QHBox* box = new QHBox(this);
QLabel* lbl = new QLabel(box);
lbl->setText(tr("<qt><b>Received:</b></qt>"));
m_na = new QLabel(box);
@@ -143,25 +140,24 @@ OtherHandler::OtherHandler()
this, SLOT(deny() ) );
raise();
showMaximized();
}
OtherHandler::~OtherHandler() {
}
void OtherHandler::handle( const QString& file ) {
m_file = file;
m_na->setText(file);
DocLnk lnk(file);
- owarn << " " << lnk.type() << " " << lnk.icon() << "" << oendl;
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() );
m_view->setText( str );
}
/*
* hehe evil evil mmap ahead :)
* we quickly copy the file and then we'll create a DocLnk for it
*/
void OtherHandler::accept() {
QString na = targetName( m_file );
copy(m_file, na );
@@ -186,23 +182,17 @@ QString OtherHandler::targetName( const QString& file ) {
int trie = 0;
while (QFile::exists(newFile + "."+info.extension() ) ) {
newFile = newFileBase + "_"+QString::number(trie) ;
trie++;
}
newFile += "." + info.extension();
return newFile;
}
/* fast cpy */
void OtherHandler::copy(const QString& src, const QString& file) {
- owarn << "src " << src << ", dest " << file << "" << oendl;
FileManager *fm;
if(!fm->copyFile(src,file)) {
owarn << "Copy failed" << oendl;
}
-
-// QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )).
-// arg( Global::shellQuote( file ) );
-// ::system( cmd.latin1() );
- // done
}