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 | |||
@@ -10,4 +10,7 @@ | |||
10 | 10 | ||
11 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
12 | int IMAPwrapper::mMax = 0; | ||
13 | int IMAPwrapper::mCurrent = 0; | ||
14 | |||
12 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 15 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
13 | : AbstractMail() | 16 | : AbstractMail() |
@@ -16,4 +19,6 @@ IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | |||
16 | m_imap = 0; | 19 | m_imap = 0; |
17 | m_Lastmbox = ""; | 20 | m_Lastmbox = ""; |
21 | mCurrent = 0; | ||
22 | mMax = 0; | ||
18 | } | 23 | } |
19 | 24 | ||
@@ -41,8 +46,28 @@ int IMAPwrapper::selectMbox(const QString&mbox) | |||
41 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | 46 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) |
42 | { | 47 | { |
48 | //qDebug("imap progress %d of %d ",current,maximum ); | ||
49 | //Global::statusMessage(tr("Downloading message %1 of %2").arg( current).arg(maximum)); | ||
50 | //qApp->processEvents() | ||
51 | static int last = 0; | ||
52 | if ( last != current ) | ||
53 | IMAPwrapper::progress(); | ||
54 | last = current; | ||
55 | } | ||
56 | void IMAPwrapper::progress( QString m ) | ||
57 | { | ||
58 | |||
59 | static QString mProgrMess; | ||
60 | if ( m != QString::null ) { | ||
61 | mProgrMess = m; | ||
62 | mCurrent = 0; | ||
63 | return; | ||
64 | } | ||
65 | QString mess; | ||
66 | //qDebug("progress "); | ||
67 | if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); | ||
68 | else mess = mProgrMess +tr(" message %1").arg( mCurrent++); | ||
69 | Global::statusMessage(mess); | ||
43 | qApp->processEvents(); | 70 | qApp->processEvents(); |
44 | qDebug("imap progress %d of %d ",current,maximum ); | ||
45 | } | 71 | } |
46 | |||
47 | bool IMAPwrapper::start_tls(bool force_tls) | 72 | bool IMAPwrapper::start_tls(bool force_tls) |
48 | { | 73 | { |
@@ -466,6 +491,5 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
466 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 491 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
467 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 492 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
468 | //odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl; | 493 | qDebug("time %s ",da.toString().latin1() ); |
469 | //odebug << da.toString() << oendl; | ||
470 | #endif | 494 | #endif |
471 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 495 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
@@ -887,23 +911,12 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | |||
887 | // qDebug("imap remove count %d ", count); | 911 | // qDebug("imap remove count %d ", count); |
888 | 912 | ||
889 | QProgressBar bar( count,0 ); | 913 | |
890 | bar.setCaption (("Removing mails - close to abort!") ); | 914 | mMax = count; |
891 | int w = 300; | 915 | //progress( tr("Delete")); |
892 | if ( QApplication::desktop()->width() < 320 ) | 916 | QWidget wid; |
893 | w = 220; | 917 | wid.show(); |
894 | int h = bar.sizeHint().height() ; | ||
895 | int dw = QApplication::desktop()->width(); | ||
896 | int dh = QApplication::desktop()->height(); | ||
897 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
898 | bar.show(); | ||
899 | int modulo = (count/10)+1; | ||
900 | int incCounter = 0; | ||
901 | |||
902 | while (iii < count ) { | 918 | while (iii < count ) { |
903 | if ( ! bar.isVisible() ) | 919 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
904 | return ; | 920 | wid.raise(); |
905 | if ( incCounter % modulo == 0 ) | ||
906 | bar.setProgress( incCounter ); | ||
907 | ++incCounter; | ||
908 | qApp->processEvents(); | 921 | qApp->processEvents(); |
909 | RecMailP mail = (*target.at( iii )); | 922 | RecMailP mail = (*target.at( iii )); |
@@ -1200,5 +1213,7 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | |||
1200 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 1213 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
1201 | { | 1214 | { |
1202 | if (targetWrapper != this || maxSizeInKb > 0 ) { | 1215 | if (targetWrapper != this || maxSizeInKb > 0 ) { |
1216 | mMax = 0; | ||
1217 | progress( tr("Copy")); | ||
1203 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); | 1218 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); |
1204 | qDebug("IMAPwrapper::mvcpAllMails::Using generic"); | 1219 | qDebug("IMAPwrapper::mvcpAllMails::Using generic"); |
@@ -1215,4 +1230,5 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | |||
1215 | return; | 1230 | return; |
1216 | } | 1231 | } |
1232 | Global::statusMessage( tr("Copying mails on server...") ); | ||
1217 | int last = m_imap->imap_selection_info->sel_exists; | 1233 | int last = m_imap->imap_selection_info->sel_exists; |
1218 | set = mailimap_set_new_interval( 1, last ); | 1234 | set = mailimap_set_new_interval( 1, last ); |