summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp49
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp58
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.h4
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp47
4 files changed, 62 insertions, 96 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index cef4e97..f876235 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -7,2 +7,3 @@
#include "mailtypes.h"
+#include <qpe/global.h>
@@ -148,20 +149,7 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
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;
+ 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();
@@ -188,24 +176,10 @@ void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
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;
+ // wel, processevents is qite strange, we need a widget for getting
+ // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displayed
+ QWidget wid;
+ wid.show();
while (iii < count ) {
- if ( ! bar.isVisible() )
- return ;
- if ( incCounter % modulo == 0 )
- bar.setProgress( incCounter );
- ++incCounter;
- bar.raise();
+ Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count));
+ wid.raise();
qApp->processEvents();
- //qDebug("copy ");
RecMailP r = (*t.at( iii ));
@@ -218,3 +192,2 @@ void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
}
- bar.hide();
if (moveit) {
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
@@ -11,2 +11,5 @@
using namespace Opie::Core;
+int IMAPwrapper::mMax = 0;
+int IMAPwrapper::mCurrent = 0;
+
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
@@ -17,2 +20,4 @@ IMAPwrapper::IMAPwrapper( IMAPaccount *a )
m_Lastmbox = "";
+ mCurrent = 0;
+ mMax = 0;
}
@@ -42,6 +47,26 @@ 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)
@@ -467,4 +492,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
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
@@ -888,21 +912,10 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
- 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();
@@ -1202,2 +1215,4 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
if (targetWrapper != this || maxSizeInKb > 0 ) {
+ mMax = 0;
+ progress( tr("Copy"));
AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb);
@@ -1216,2 +1231,3 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
}
+ Global::statusMessage( tr("Copying mails on server...") );
int last = m_imap->imap_selection_info->sel_exists;
diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h
index 222fe95..db8ab5b 100644
--- a/kmicromail/libmailwrapper/imapwrapper.h
+++ b/kmicromail/libmailwrapper/imapwrapper.h
@@ -75,3 +75,5 @@ protected:
-
+ static void progress(QString mess = QString::null);
+ static int mCurrent;
+ static int mMax;
IMAPaccount *account;
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index f430121..8d2f778 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -128,2 +128,3 @@ void POP3wrapper::login()
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
+ qApp->processEvents();
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
@@ -132,3 +133,2 @@ void POP3wrapper::login()
// ok
- qDebug("ok ");
user = login.getUser();
@@ -167,3 +167,3 @@ void POP3wrapper::login()
; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
- Global::statusMessage(tr("Error initializing folder"));
+ Global::statusMessage(tr("Error %1 initializing folder").arg( err ));
mailstorage_free(m_pop3);
@@ -202,20 +202,7 @@ void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
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;
+ 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();
@@ -254,21 +241,9 @@ 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;
+ QWidget wid;
+ wid.show();
for (unsigned int i = 0; i < result; ++i) {
- if ( ! bar.isVisible() )
- return 0;
- if ( incCounter % modulo == 0 )
- bar.setProgress( incCounter );
- ++incCounter;
+ Global::statusMessage(tr("Delete message %1 of %2").arg(i).arg(result));
+ wid.raise();
qApp->processEvents();
+
err = mailsession_remove_message(m_pop3->sto_session,i+1);