summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/pop3wrapper.cpp
authorzautrix <zautrix>2004-09-01 10:23:29 (UTC)
committer zautrix <zautrix>2004-09-01 10:23:29 (UTC)
commit6cefbdc9c8f3f3001373f10715361e2740c45395 (patch) (unidiff)
treecb2c36f57620e698913c27ca4ebe59e4a7c9d46e /kmicromail/libmailwrapper/pop3wrapper.cpp
parentb9257cb225cd29bab5d96fcdaf557926603ee587 (diff)
downloadkdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.zip
kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.tar.gz
kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.tar.bz2
Mail fixes and libetpan updated
Diffstat (limited to 'kmicromail/libmailwrapper/pop3wrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp43
1 files changed, 41 insertions, 2 deletions
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 7a84b30..0e6612c 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -8,6 +8,8 @@
8 8
9#include <qpe/global.h> 9#include <qpe/global.h>
10#include <qfile.h> 10#include <qfile.h>
11#include <qprogressbar.h>
12#include <qapplication.h>
11 13
12/* we don't fetch messages larger than 5 MB */ 14/* we don't fetch messages larger than 5 MB */
13#define HARD_MSG_SIZE_LIMIT 5242880 15#define HARD_MSG_SIZE_LIMIT 5242880
@@ -193,18 +195,37 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
193 return folders; 195 return folders;
194} 196}
195 197
196void POP3wrapper::deleteMailList(QValueList<RecMailP>&target) 198void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
197{ 199{
198 login(); 200 login();
199 if (!m_pop3) 201 if (!m_pop3)
200 return; 202 return;
201 int iii = 0; 203 int iii = 0;
202 int count = target.count(); 204 int count = target.count();
205 QProgressBar bar( count,0 );
206 bar.setCaption (("Removing mails - close to abort!") );
207 int w = 300;
208 if ( QApplication::desktop()->width() < 320 )
209 w = 220;
210 int h = bar.sizeHint().height() ;
211 int dw = QApplication::desktop()->width();
212 int dh = QApplication::desktop()->height();
213 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
214 bar.show();
215 int modulo = (count/10)+1;
216 int incCounter = 0;
203 while (iii < count ) { 217 while (iii < count ) {
218 if ( ! bar.isVisible() )
219 return ;
220 if ( incCounter % modulo == 0 )
221 bar.setProgress( incCounter );
222 ++incCounter;
223 qApp->processEvents();
224 //qDebug("delete ");
204 RecMailP mail = (*target.at( iii )); 225 RecMailP mail = (*target.at( iii ));
205 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); 226 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
206 if (err != MAIL_NO_ERROR) { 227 if (err != MAIL_NO_ERROR) {
207 Global::statusMessage(tr("error deleting mail")); 228 Global::statusMessage(tr("Error deleting mail"));
208 } 229 }
209 ++iii; 230 ++iii;
210 } 231 }
@@ -233,7 +254,25 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
233 Global::statusMessage(tr("Error getting folder info")); 254 Global::statusMessage(tr("Error getting folder info"));
234 return 0; 255 return 0;
235 } 256 }
257 QProgressBar bar( result,0 );
258 bar.setCaption (("Deleting mails - close to abort!") );
259 int w = 300;
260 if ( QApplication::desktop()->width() < 320 )
261 w = 220;
262 int h = bar.sizeHint().height() ;
263 int dw = QApplication::desktop()->width();
264 int dh = QApplication::desktop()->height();
265 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
266 bar.show();
267 int modulo = (result/10)+1;
268 int incCounter = 0;
236 for (unsigned int i = 0; i < result; ++i) { 269 for (unsigned int i = 0; i < result; ++i) {
270 if ( ! bar.isVisible() )
271 return 0;
272 if ( incCounter % modulo == 0 )
273 bar.setProgress( incCounter );
274 ++incCounter;
275 qApp->processEvents();
237 err = mailsession_remove_message(m_pop3->sto_session,i+1); 276 err = mailsession_remove_message(m_pop3->sto_session,i+1);
238 if (err != MAIL_NO_ERROR) { 277 if (err != MAIL_NO_ERROR) {
239 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 278 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));