-rw-r--r-- | kmicromail/accountview.cpp | 33 | ||||
-rw-r--r-- | kmicromail/accountview.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 6 |
3 files changed, 28 insertions, 12 deletions
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 6227f6d..cef55ab 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp @@ -12,20 +12,26 @@ #include <qpe/qpeapplication.h> /* QT */ #include <qmessagebox.h> #include <qpopupmenu.h> #include <qcheckbox.h> +#include <qtimer.h> #include <qspinbox.h> #include <klocale.h> +#include <kmessagebox.h> using namespace Opie::Core; AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) : QListView( parent, name, flags ) { - connect( this, SIGNAL( selectionChanged(QListViewItem*) ), + //connect( this, SIGNAL( selectionChanged(QListViewItem*) ), + // SLOT( refresh(QListViewItem*) ) ); + connect( this, SIGNAL( clicked(QListViewItem*) ), + SLOT( refresh(QListViewItem*) ) ); + connect( this, SIGNAL( returnPressed(QListViewItem*) ), SLOT( refresh(QListViewItem*) ) ); connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); setSorting(0); } @@ -88,17 +94,21 @@ void AccountView::populate( QList<Account> list ) } void AccountView::refresh(QListViewItem *item) { if ( item ) { + int result = KMessageBox::warningContinueCancel(this, + i18n("Refresh\n%1\n?").arg( item->text(0) ), + i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), + true); + if (result != KMessageBox::Continue) return; m_currentItem = item; - QValueList<RecMailP> headerlist; - AccountViewItem *view = static_cast<AccountViewItem *>(item); - view->refresh(headerlist); - emit refreshMailview(headerlist); + topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; + QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); + } } void AccountView::refreshOutgoing() { m_currentItem = currentItem(); if ( !m_currentItem ) return; @@ -118,21 +128,28 @@ void AccountView::refreshOutgoing() //qDebug("name *%s* ",bName.lower().latin1() ); if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { refreshCurrent(); // qDebug("refresh "); } } - -void AccountView::refreshCurrent() +void AccountView::refreshCurrentSelected() { - m_currentItem = currentItem(); if ( !m_currentItem ) return; QValueList<RecMailP> headerlist; AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); view->refresh(headerlist); emit refreshMailview(headerlist); + topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; +} + +void AccountView::refreshCurrent() +{ + m_currentItem = currentItem(); + if ( !m_currentItem ) return; + topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; + QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); } void AccountView::refreshAll() { } diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h index e403cb8..33f3479 100644 --- a/kmicromail/accountview.h +++ b/kmicromail/accountview.h @@ -27,12 +27,13 @@ public: virtual bool currentisDraft(); QValueList<MHviewItem*> allAccounts() { return mhAccounts;} public slots: virtual void refreshAll(); virtual void refresh(QListViewItem *item); virtual void refreshCurrent(); + virtual void refreshCurrentSelected(); virtual void refreshOutgoing(); virtual void slotHold(int, QListViewItem *,const QPoint&,int); virtual void slotContextMenu(int id); void setupFolderselect(Selectstore*sels); signals: diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 09e52b8..4f0c849 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -44,13 +44,12 @@ int IMAPwrapper::selectMbox(const QString&mbox) m_Lastmbox = mbox; return err; } void IMAPwrapper::imap_progress( size_t current, size_t maximum ) { - qApp->processEvents(); return; //qDebug("imap progress %d of %d ",current,maximum ); //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum)); //qApp->processEvents() static unsigned int last = 0; if ( last != current ) @@ -155,13 +154,12 @@ void IMAPwrapper::login(bool tryTLS) // = true) return; } } else { user = account->getUser(); pass = account->getPassword(); } - m_imap = mailimap_new( 20, &imap_progress ); /* connect */ bool ssl = false; bool try_tls = false; bool force_tls = false; @@ -171,15 +169,15 @@ void IMAPwrapper::login(bool tryTLS) // = true) } if (account->ConnectionType()==1) { force_tls = true; } if ( ssl ) { - qDebug("using ssl "); + //qDebug("using ssl "); err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); - qDebug("back "); + //qDebug("back "); } else { err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); } if ( err != MAILIMAP_NO_ERROR && err != MAILIMAP_NO_ERROR_AUTHENTICATED && |