summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp58
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp46
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp47
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.h2
4 files changed, 136 insertions, 17 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 @@
#include "mailtypes.h"
+#include <qprogressbar.h>
+#include <qapplication.h>
#include <kdecore/kstandarddirs.h>
#include <qfile.h>
@@ -140,8 +142,33 @@ void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSma
}
void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
{
- qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
-
+ //qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
+ // this is currently re-implemented in pop3wrapper and imapwrapper
+ int iii = 0;
+ 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();
+ RecMailP mail = (*target.at( iii ));
+ deleteMail(mail);
+ ++iii;
+ }
}
void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
@@ -154,11 +181,33 @@ void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
-
encodedString*st = 0;
int iii = 0;
int count = t.count();
+ if ( count == 0 )
+ return;
+
+ QProgressBar bar( count,0 );
+ bar.setCaption (("Copying 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;
+ bar.raise();
+ qApp->processEvents();
+ //qDebug("copy ");
RecMailP r = (*t.at( iii ));
st = fetchRawBody(r);
if (st) {
@@ -166,7 +215,8 @@ void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
delete st;
}
++iii;
- }
+ }
+ bar.hide();
if (moveit) {
deleteMailList( t );
//deleteAllMail(fromFolder);
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index bb8bbfc..11d3343 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -6,6 +6,7 @@
#include "imapwrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
+#include <qprogressbar.h>
using namespace Opie::Core;
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
@@ -871,21 +872,43 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which
}
void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
{
+ //#if 0
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
+ //#endif
if (!m_imap) {
return;
}
int iii = 0;
int count = target.count();
- qDebug("imap remove count %d ", count);
+ // qDebug("imap remove count %d ", 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 ) {
- qDebug("IMAP remove %d ", iii);
+ if ( ! bar.isVisible() )
+ return ;
+ if ( incCounter % modulo == 0 )
+ bar.setProgress( incCounter );
+ ++incCounter;
+ qApp->processEvents();
RecMailP mail = (*target.at( iii ));
-
+ //#if 0
+ //qDebug("IMAP remove %d %d ", iii, mail->getNumber() );
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
@@ -905,12 +928,19 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
// odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
+ // err = mailimap_expunge(m_imap);
+ //if (err != MAILIMAP_NO_ERROR) {
+ // Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response));
+ // }
+ //#endif
+ //deleteMail( mail);
+ ++iii;
+ }
+ //qDebug("Deleting imap mails... ");
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
- Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
+ Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response));
}
- ++iii;
- }
}
void IMAPwrapper::deleteMail(const RecMailP&mail)
{
@@ -945,7 +975,7 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
}
- qDebug("IMAPwrapper::deleteMail ");
+ //qDebug("IMAPwrapper::deleteMail 2");
}
@@ -1189,7 +1219,7 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
err = mailimap_copy(m_imap,set,targetFolder.latin1());
mailimap_set_free( set );
if ( err != MAILIMAP_NO_ERROR ) {
- QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response);
+ QString error_msg = tr("Error copy mails: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
// odebug << error_msg << oendl;
return;
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 @@
#include <qpe/global.h>
#include <qfile.h>
+#include <qprogressbar.h>
+#include <qapplication.h>
/* we don't fetch messages larger than 5 MB */
#define HARD_MSG_SIZE_LIMIT 5242880
@@ -193,18 +195,37 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
return folders;
}
-void POP3wrapper::deleteMailList(QValueList<RecMailP>&target)
+void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
{
login();
if (!m_pop3)
return;
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 ));
int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
- Global::statusMessage(tr("error deleting mail"));
+ Global::statusMessage(tr("Error deleting mail"));
}
++iii;
}
@@ -233,7 +254,25 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
Global::statusMessage(tr("Error getting folder info"));
return 0;
}
+ 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);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h
index ee754a4..7c70942 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.h
+++ b/kmicromail/libmailwrapper/pop3wrapper.h
@@ -24,8 +24,8 @@ public:
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
+ virtual void deleteMailList(const QValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail);
- virtual void deleteMailList(QValueList<RecMailP>&target);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual RecBodyP fetchBody( const RecMailP &mail );