From 32f9963a39236d08718a36d5adad2a0c5c4e2602 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 11 Sep 2004 15:41:30 +0000 Subject: Mail enhancements --- (limited to 'kmicromail/libmailwrapper/abstractmail.cpp') diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index f876235..374d606 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -158,6 +159,72 @@ void AbstractMail::deleteMailList(const QValueList&target) ++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,tr("Error creating new Folder"), + tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); + return; + } + QValueList t; + listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); + if ( t.count() == 0 ) { + Global::statusMessage(tr("There are no new messages")); + return; + } + QValueList e; + targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); + qDebug("target has mails %d ", e.count()); + QValueList 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("found "); + else + qDebug("NOT found "); + + if ( !found ) { + n.append( r ); + } + ++iii; + } + if ( n.count() == 0 ) { + Global::statusMessage(tr("There are no new messages")); + return; + } + mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); + + +#if 0 + QValueList 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) { -- cgit v0.9.0.2