summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/imapwrapper.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp46
1 files changed, 38 insertions, 8 deletions
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
@@ -3,12 +3,13 @@
#include <libetpan/libetpan.h>
#include <qpe/global.h>
#include <qapplication.h>
#include "imapwrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
+#include <qprogressbar.h>
using namespace Opie::Core;
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
@@ -868,27 +869,49 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which
}
target_part->setEncoding(encoding);
target_part->setSize(which->bd_size);
}
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;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
@@ -902,18 +925,25 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
// odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
return;
}
// 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)
{
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
@@ -942,13 +972,13 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
}
- qDebug("IMAPwrapper::deleteMail ");
+ //qDebug("IMAPwrapper::deleteMail 2");
}
void IMAPwrapper::answeredMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
@@ -1186,13 +1216,13 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
}
int last = m_imap->imap_selection_info->sel_exists;
set = mailimap_set_new_interval( 1, last );
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;
}
if (moveit) {
deleteAllMail(fromFolder);