-rw-r--r-- | kmicromail/accountview.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 6227f6d..cef55ab 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp @@ -16,6 +16,8 @@ #include <qpopupmenu.h> #include <qcheckbox.h> +#include <qtimer.h> #include <qspinbox.h> #include <klocale.h> +#include <kmessagebox.h> using namespace Opie::Core; @@ -23,8 +25,12 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) : QListView( parent, name, flags ) { - connect( this, SIGNAL( selectionChanged(QListViewItem*) ), - SLOT( refresh(QListViewItem*) ) ); - connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, - SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); + //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); } @@ -92,9 +98,13 @@ 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() ) ); + } } @@ -122,8 +132,6 @@ void AccountView::refreshOutgoing() } } - -void AccountView::refreshCurrent() +void AccountView::refreshCurrentSelected() { - m_currentItem = currentItem(); if ( !m_currentItem ) return; QValueList<RecMailP> headerlist; @@ -131,4 +139,13 @@ void AccountView::refreshCurrent() 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() ) ); } |