Diffstat (limited to 'kmicromail/libmailwrapper/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index ed5c898..870985e 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp @@ -91,189 +91,192 @@ QString AbstractMail::convert_String(const char*text) { size_t index = 0; char*res = 0; int err = MAILIMF_NO_ERROR; QString result(text); //qDebug("convert_String %s ", text); //err = mailmime_encoded_phrase_parse("iso-8859-1", // text, strlen(text),&index, "iso-8859-1",&res); err = mailmime_encoded_phrase_parse("iso-8859-1", text, strlen(text),&index, "utf-8",&res); if (err == MAILIMF_NO_ERROR && res && strlen(res)) { result = QString::fromUtf8(res); } //qDebug("convert_String:%s ",result.latin1() ); if (res) free(res); return result; } /* cp & paste from launcher */ QString AbstractMail::gen_attachment_id() { QFile file( "/proc/sys/kernel/random/uuid" ); if (!file.open(IO_ReadOnly ) ) return QString::null; QTextStream stream(&file); return "{" + stream.read().stripWhiteSpace() + "}"; } int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) { return 0; } QString AbstractMail::defaultLocalfolder() { // QString f = getenv( "HOME" ); QString f = locateLocal( "data", "kopiemail/localmail"); // f += "/Applications/opiemail/localmail"; return f; } QString AbstractMail::draftFolder() { return QString("Drafts"); } /* temporary - will be removed when implemented in all classes */ void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) { } void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) { //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); // this is currently re-implemented in pop3wrapper and imapwrapper int iii = 0; int count = target.count(); QProgressBar wid ( count ); wid.setCaption( i18n("Deleting ...")); wid.show(); while (iii < count ) { Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count)); wid.setProgress( iii ); wid.raise(); qApp->processEvents(); RecMailP mail = (*target.at( iii )); deleteMail(mail); ++iii; } } void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) { //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); // get local folder Account * acc = getAccount(); if ( !acc ) return; QString lfName = acc->getLocalFolder(); if ( lfName.isEmpty() ) lfName = acc->getAccountName(); // create local folder if ( !targetMail->createMbox(lfName)) { QMessageBox::critical(0,i18n("Error creating new Folder"), i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); return; } QValueList<RecMailP> t; listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); if ( t.count() == 0 ) { qDebug("There are no new messages %s", fromFolder->getName().latin1()); Global::statusMessage(i18n("There are no new messages")); return; } + Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); + qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName())); + qApp->processEvents(); QValueList<RecMailP> e; targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); //qDebug("target has mails %d ", e.count()); QValueList<RecMailP> n; int iii = 0; int count = t.count(); while (iii < count ) { RecMailP r = (*t.at( iii )); bool found = false; int jjj = 0; int countE = e.count(); while (jjj < countE ) { RecMailP re = (*e.at( jjj )); if ( re->isEqual(r) ) { found = true; break; } ++jjj; } if ( !found ) { //qDebug("AAAdate *%s* ", r->isodate.latin1() ); n.append( r ); } ++iii; } qDebug("Downloaded %d messages ",n.count() ); if ( n.count() == 0 ) { Global::statusMessage(i18n("There are no new messages")); return; } mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count())); #if 0 QValueList<RecMailP> t; listMessages(fromFolder->getName(),t, maxSizeInKb); mvcpMailList( t,targetFolder,targetWrapper,moveit); #endif } void AbstractMail::mvcpAllMails(const FolderP&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) { QValueList<RecMailP> t; listMessages(fromFolder->getName(),t, maxSizeInKb); mvcpMailList( t,targetFolder,targetWrapper,moveit); } void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { encodedString*st = 0; int iii = 0; int count = t.count(); if ( count == 0 ) return; // wel, processevents is qite strange, we need a widget for getting // Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye QProgressBar wid ( count ); wid.setCaption( i18n("Copying...")); wid.show(); while (iii < count ) { Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count)); wid.setProgress( iii ); wid.raise(); qApp->processEvents(); RecMailP r = (*t.at( iii )); st = fetchRawBody(r); if (st) { targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); delete st; } ++iii; } if (moveit) { deleteMailList( t ); //deleteAllMail(fromFolder); } } void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { encodedString*st = 0; st = fetchRawBody(mail); if (st) { targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); delete st; } if (moveit) { deleteMail(mail); } } |