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.cpp58
1 files changed, 54 insertions, 4 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 3998abd..3b0ca1f 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -7,6 +7,8 @@
7#include "mailtypes.h" 7#include "mailtypes.h"
8 8
9 9
10#include <qprogressbar.h>
11#include <qapplication.h>
10 12
11#include <kdecore/kstandarddirs.h> 13#include <kdecore/kstandarddirs.h>
12#include <qfile.h> 14#include <qfile.h>
@@ -140,8 +142,33 @@ void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSma
140} 142}
141void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) 143void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
142{ 144{
143 qDebug("AbstractMail::deleteMailList:: Please reimplement! "); 145 //qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
144 146 // this is currently re-implemented in pop3wrapper and imapwrapper
147 int iii = 0;
148 int count = target.count();
149 QProgressBar bar( count,0 );
150 bar.setCaption (("Removing mails - close to abort!") );
151 int w = 300;
152 if ( QApplication::desktop()->width() < 320 )
153 w = 220;
154 int h = bar.sizeHint().height() ;
155 int dw = QApplication::desktop()->width();
156 int dh = QApplication::desktop()->height();
157 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
158 bar.show();
159 int modulo = (count/10)+1;
160 int incCounter = 0;
161 while (iii < count ) {
162 if ( ! bar.isVisible() )
163 return ;
164 if ( incCounter % modulo == 0 )
165 bar.setProgress( incCounter );
166 ++incCounter;
167 qApp->processEvents();
168 RecMailP mail = (*target.at( iii ));
169 deleteMail(mail);
170 ++iii;
171 }
145} 172}
146void AbstractMail::mvcpAllMails(const FolderP&fromFolder, 173void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
147 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) 174 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
@@ -154,11 +181,33 @@ void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
154void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, 181void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
155 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 182 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
156{ 183{
157
158 encodedString*st = 0; 184 encodedString*st = 0;
159 int iii = 0; 185 int iii = 0;
160 int count = t.count(); 186 int count = t.count();
187 if ( count == 0 )
188 return;
189
190 QProgressBar bar( count,0 );
191 bar.setCaption (("Copying mails - close to abort!") );
192 int w = 300;
193 if ( QApplication::desktop()->width() < 320 )
194 w = 220;
195 int h = bar.sizeHint().height() ;
196 int dw = QApplication::desktop()->width();
197 int dh = QApplication::desktop()->height();
198 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
199 bar.show();
200 int modulo = (count/10)+1;
201 int incCounter = 0;
161 while (iii < count ) { 202 while (iii < count ) {
203 if ( ! bar.isVisible() )
204 return ;
205 if ( incCounter % modulo == 0 )
206 bar.setProgress( incCounter );
207 ++incCounter;
208 bar.raise();
209 qApp->processEvents();
210 //qDebug("copy ");
162 RecMailP r = (*t.at( iii )); 211 RecMailP r = (*t.at( iii ));
163 st = fetchRawBody(r); 212 st = fetchRawBody(r);
164 if (st) { 213 if (st) {
@@ -166,7 +215,8 @@ void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
166 delete st; 215 delete st;
167 } 216 }
168 ++iii; 217 ++iii;
169 } 218 }
219 bar.hide();
170 if (moveit) { 220 if (moveit) {
171 deleteMailList( t ); 221 deleteMailList( t );
172 //deleteAllMail(fromFolder); 222 //deleteAllMail(fromFolder);