From ba1948bfc65a28be72ce7e762e37019593a4380f Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Fri, 20 Apr 2001 09:22:11 +0000 Subject: [PATCH] use a timer for the message menu update to get speed again in mass actions svn path=/trunk/kdenetwork/kmail/; revision=93012 --- kmmainwin.cpp | 31 ++++++++++++++++++------------- kmmainwin.h | 6 +++++- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/kmmainwin.cpp b/kmmainwin.cpp index 55404e34d..640924376 100644 --- a/kmmainwin.cpp +++ b/kmmainwin.cpp @@ -337,10 +337,8 @@ void KMMainWin::createWidgets(void) this, SLOT(slotMsgSelected(KMMessage*))); connect(mHeaders, SIGNAL(activated(KMMessage*)), this, SLOT(slotMsgActivated(KMMessage*))); -#ifdef thisIsReallySlow connect( mHeaders, SIGNAL( selectionChanged() ), - SLOT( updateMessageMenu() ) ); -#endif + SLOT( slotUpdateMessageMenu() ) ); accel->connectItem(accel->insertItem(Key_Left), mHeaders, SLOT(prevMessage())); accel->connectItem(accel->insertItem(Key_Right), @@ -1309,9 +1307,9 @@ void KMMainWin::slotCopyText() //----------------------------------------------------------------------------- void KMMainWin::slotMarkAll() { - QListViewItem *item; - for (item = mHeaders->firstChild(); item; item = item->itemBelow()) - mHeaders->setSelected( item, TRUE ); + QListViewItem *item; + for (item = mHeaders->firstChild(); item; item = item->itemBelow()) + mHeaders->setSelected( item, TRUE ); } //----------------------------------------------------------------------------- @@ -1806,6 +1804,10 @@ void KMMainWin::setupMenuBar() SIGNAL( aboutToShow() ), this, SLOT( updateMessageMenu() )); conserveMemory(); + + menutimer = new QTimer( this, "menutimer" ); + connect( menutimer, SIGNAL( timeout() ), SLOT( updateMessageMenu() ) ); + updateMessageMenu(); } @@ -1970,15 +1972,19 @@ QPopupMenu* KMMainWin::folderToPopupMenu(KMFolderTreeItem* fti, //----------------------------------------------------------------------------- +void KMMainWin::slotUpdateMessageMenu() +{ + menutimer->stop(); + menutimer->start( 20, true ); +} + void KMMainWin::updateMessageMenu() { - mMenuToFolder.clear(); - folderToPopupMenu( 0, true, this, &mMenuToFolder, moveActionMenu->popupMenu() ); - folderToPopupMenu( 0, false, this, &mMenuToFolder, copyActionMenu->popupMenu() ); + kdDebug() << "updateMessageMenu\n"; -#ifdef thisIsReallySlow - - mMenuToFolder.clear(); + mMenuToFolder.clear(); + folderToPopupMenu( 0, true, this, &mMenuToFolder, moveActionMenu->popupMenu() ); + folderToPopupMenu( 0, false, this, &mMenuToFolder, copyActionMenu->popupMenu() ); int count = 0; @@ -2037,7 +2043,6 @@ void KMMainWin::updateMessageMenu() action( "next_unread" )->setEnabled( mails ); action( "previous" )->setEnabled( mails ); action( "previous_unread" )->setEnabled( mails ); -#endif } diff --git a/kmmainwin.h b/kmmainwin.h index 91e8e5731..7c8cd7a25 100644 --- a/kmmainwin.h +++ b/kmmainwin.h @@ -101,8 +101,10 @@ public slots: void slotSelectFolder(KMFolder*); void slotSelectMessage(KMMessage*); + // sets the timer for the message menu update + void updateMessageMenu(); // Update the "Move to" and "Copy to" popoutmenus in the Messages menu. - virtual void updateMessageMenu(); + void slotUpdateMessageMenu(); protected: void setupMenuBar(); @@ -243,6 +245,8 @@ protected: KAction *modifyFolderAction, *removeFolderAction; KToggleAction *preferHtmlAction, *threadMessagesAction; KToggleAction *toolbarAction, *statusbarAction; + + QTimer *menutimer; }; #endif