author | zautrix <zautrix> | 2004-09-10 19:57:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-10 19:57:55 (UTC) |
commit | cebdd6de7481514ad5ea0517f7a2e8f4db422be5 (patch) (side-by-side diff) | |
tree | 0b29859b5bbfdcb702724c3b0c721f22b0d0e666 /kmicromail/libmailwrapper/imapwrapper.cpp | |
parent | 157120031b77a3d9f10d780a66b6441dac1399fa (diff) | |
download | kdepimpi-cebdd6de7481514ad5ea0517f7a2e8f4db422be5.zip kdepimpi-cebdd6de7481514ad5ea0517f7a2e8f4db422be5.tar.gz kdepimpi-cebdd6de7481514ad5ea0517f7a2e8f4db422be5.tar.bz2 |
Added status info when deleting mails
Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 021633b..be825ef 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -9,12 +9,17 @@ #include <qprogressbar.h> using namespace Opie::Core; +int IMAPwrapper::mMax = 0; +int IMAPwrapper::mCurrent = 0; + IMAPwrapper::IMAPwrapper( IMAPaccount *a ) : AbstractMail() { account = a; m_imap = 0; m_Lastmbox = ""; + mCurrent = 0; + mMax = 0; } IMAPwrapper::~IMAPwrapper() @@ -40,10 +45,30 @@ int IMAPwrapper::selectMbox(const QString&mbox) void IMAPwrapper::imap_progress( size_t current, size_t maximum ) { + //qDebug("imap progress %d of %d ",current,maximum ); + //Global::statusMessage(tr("Downloading message %1 of %2").arg( current).arg(maximum)); + //qApp->processEvents() + static int last = 0; + if ( last != current ) + IMAPwrapper::progress(); + last = current; +} +void IMAPwrapper::progress( QString m ) +{ + + static QString mProgrMess; + if ( m != QString::null ) { + mProgrMess = m; + mCurrent = 0; + return; + } + QString mess; + //qDebug("progress "); + if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); + else mess = mProgrMess +tr(" message %1").arg( mCurrent++); + Global::statusMessage(mess); qApp->processEvents(); - qDebug("imap progress %d of %d ",current,maximum ); } - bool IMAPwrapper::start_tls(bool force_tls) { int err; @@ -465,8 +490,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) #if 0 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); - //odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl; - //odebug << da.toString() << oendl; + qDebug("time %s ",da.toString().latin1() ); #endif } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { size = item->att_data.att_static->att_data.att_rfc822_size; @@ -886,25 +910,14 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) int count = target.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; - + + mMax = count; + //progress( tr("Delete")); + QWidget wid; + wid.show(); while (iii < count ) { - if ( ! bar.isVisible() ) - return ; - if ( incCounter % modulo == 0 ) - bar.setProgress( incCounter ); - ++incCounter; + Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); + wid.raise(); qApp->processEvents(); RecMailP mail = (*target.at( iii )); //#if 0 @@ -1199,7 +1212,9 @@ encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) { - if (targetWrapper != this || maxSizeInKb > 0 ) { + if (targetWrapper != this || maxSizeInKb > 0 ) { + mMax = 0; + progress( tr("Copy")); AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); qDebug("IMAPwrapper::mvcpAllMails::Using generic"); // odebug << "Using generic" << oendl; @@ -1214,6 +1229,7 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, if ( err != MAILIMAP_NO_ERROR ) { return; } + Global::statusMessage( tr("Copying mails on server...") ); int last = m_imap->imap_selection_info->sel_exists; set = mailimap_set_new_interval( 1, last ); err = mailimap_copy(m_imap,set,targetFolder.latin1()); |