Diffstat (limited to 'kmicromail/libmailwrapper/pop3wrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.cpp | 47 |
1 files changed, 43 insertions, 4 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 @@ -10,2 +10,4 @@ #include <qfile.h> +#include <qprogressbar.h> +#include <qapplication.h> @@ -195,3 +197,3 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { -void POP3wrapper::deleteMailList(QValueList<RecMailP>&target) +void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) { @@ -201,4 +203,23 @@ void POP3wrapper::deleteMailList(QValueList<RecMailP>&target) int iii = 0; - int count = target.count(); - while (iii < count ) { + int count = target.count(); + QProgressBar bar( count,0 ); + bar.setCaption (("Removing mails - close to abort!") ); + int w = 300; + if ( QApplication::desktop()->width() < 320 ) + w = 220; + int h = bar.sizeHint().height() ; + int dw = QApplication::desktop()->width(); + int dh = QApplication::desktop()->height(); + bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); + bar.show(); + int modulo = (count/10)+1; + int incCounter = 0; + while (iii < count ) { + if ( ! bar.isVisible() ) + return ; + if ( incCounter % modulo == 0 ) + bar.setProgress( incCounter ); + ++incCounter; + qApp->processEvents(); + //qDebug("delete "); RecMailP mail = (*target.at( iii )); @@ -206,3 +227,3 @@ void POP3wrapper::deleteMailList(QValueList<RecMailP>&target) if (err != MAIL_NO_ERROR) { - Global::statusMessage(tr("error deleting mail")); + Global::statusMessage(tr("Error deleting mail")); } @@ -235,3 +256,21 @@ int POP3wrapper::deleteAllMail(const FolderP&) { } + QProgressBar bar( result,0 ); + bar.setCaption (("Deleting mails - close to abort!") ); + int w = 300; + if ( QApplication::desktop()->width() < 320 ) + w = 220; + int h = bar.sizeHint().height() ; + int dw = QApplication::desktop()->width(); + int dh = QApplication::desktop()->height(); + bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); + bar.show(); + int modulo = (result/10)+1; + int incCounter = 0; for (unsigned int i = 0; i < result; ++i) { + if ( ! bar.isVisible() ) + return 0; + if ( incCounter % modulo == 0 ) + bar.setProgress( incCounter ); + ++incCounter; + qApp->processEvents(); err = mailsession_remove_message(m_pop3->sto_session,i+1); |