summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/abstractmail.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp67
1 files changed, 67 insertions, 0 deletions
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 @@
10 10
11#include <qprogressbar.h> 11#include <qprogressbar.h>
12#include <qapplication.h> 12#include <qapplication.h>
13#include <qmessagebox.h>
13 14
14#include <kdecore/kstandarddirs.h> 15#include <kdecore/kstandarddirs.h>
15#include <qfile.h> 16#include <qfile.h>
@@ -158,6 +159,72 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
158 ++iii; 159 ++iii;
159 } 160 }
160} 161}
162
163void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
164{
165 qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
166 // get local folder
167 Account * acc = getAccount();
168 if ( !acc ) return;
169 QString lfName = acc->getLocalFolder();
170 if ( lfName.isEmpty() )
171 lfName = acc->getAccountName();
172 // create local folder
173 if ( !targetMail->createMbox(lfName))
174 {
175 QMessageBox::critical(0,tr("Error creating new Folder"),
176 tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
177 return;
178 }
179 QValueList<RecMailP> t;
180 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
181 if ( t.count() == 0 ) {
182 Global::statusMessage(tr("There are no new messages"));
183 return;
184 }
185 QValueList<RecMailP> e;
186 targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
187 qDebug("target has mails %d ", e.count());
188 QValueList<RecMailP> n;
189 int iii = 0;
190 int count = t.count();
191 while (iii < count ) {
192 RecMailP r = (*t.at( iii ));
193 bool found = false;
194 int jjj = 0;
195 int countE = e.count();
196 while (jjj < countE ) {
197 RecMailP re = (*e.at( jjj ));
198 if ( re->isEqual(r) ) {
199 found = true;
200 break;
201 }
202 ++jjj;
203 }
204 if ( found )
205 qDebug("found ");
206 else
207 qDebug("NOT found ");
208
209 if ( !found ) {
210 n.append( r );
211 }
212 ++iii;
213 }
214 if ( n.count() == 0 ) {
215 Global::statusMessage(tr("There are no new messages"));
216 return;
217 }
218 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
219
220
221#if 0
222 QValueList<RecMailP> t;
223 listMessages(fromFolder->getName(),t, maxSizeInKb);
224 mvcpMailList( t,targetFolder,targetWrapper,moveit);
225#endif
226
227}
161void AbstractMail::mvcpAllMails(const FolderP&fromFolder, 228void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
162 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) 229 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
163{ 230{