[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [Bug 42004] message selection is lost when new mail arrives
From:       Carsten Burghardt <burghardt () kde ! org>
Date:       2004-05-30 14:49:04
Message-ID: 20040530144904.21975.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
      
http://bugs.kde.org/show_bug.cgi?id=42004      
burghardt kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From burghardt kde org  2004-05-30 16:48 -------
CVS commit by burghard: 

Reselect all messages as otherwise the selection is lost when new mail arrives.
Actually I do wonder why msgChanged is called for IMAP and not for local folders.
CCMAIL: 42004-done bugs kde org


  M +30 -2     kmheaders.cpp   1.637
  M +14 -11    kmheaders.h   1.152


--- kdepim/kmail/kmheaders.cpp  #1.636:1.637
 @ -1045,8 +1045,10  @ void KMHeaders::msgChanged()
   disconnect(this,SIGNAL(currentChanged(QListViewItem*)),
              this,SLOT(highlightMessage(QListViewItem*)));
+  // remember all selected messages
+  QValueList<int> curItems = selectedItems();
   updateMessageList();
   setTopItemByIndex( i );
-  setCurrentMsg(cur);
-  setSelected( currentItem(), true );
+  setCurrentMsg( cur );
+  setSelectedByIndex( curItems, true );
   connect(this,SIGNAL(currentChanged(QListViewItem*)),
           this,SLOT(highlightMessage(QListViewItem*)));
 @ -1836,4 +1838,15  @ void KMHeaders::setSelected( QListViewIt
 }
 
+void KMHeaders::setSelectedByIndex( QValueList<int> items, bool selected )
+{
+  for ( QValueList<int>::Iterator it = items.begin(); it != items.end(); ++it )
+  {
+    if ( ((*it) >= 0) && ((*it) < (int)mItems.size()) ) 
+    {
+      setSelected( mItems[(*it)], selected );
+    }
+  }
+}
+
 void KMHeaders::clearSelectableAndAboutToBeDeleted( Q_UINT32 serNum )
 {
 @ -1872,4 +1885,19  @ KMMessageList* KMHeaders::selectedMsgs(b
 
 //-----------------------------------------------------------------------------
+QValueList<int> KMHeaders::selectedItems()
+{
+  QValueList<int> items;
+  for ( QListViewItemIterator it(this); it.current(); it++ ) 
+  {
+    if ( it.current()->isSelected() && it.current()->isVisible() ) 
+    {
+      KMHeaderItem* item = static_cast<KMHeaderItem*>( it.current() );
+      items.append( item->msgId() );
+    }
+  }
+  return items;
+}
+
+//-----------------------------------------------------------------------------
 int KMHeaders::firstSelectedMsg() const
 {

--- kdepim/kmail/kmheaders.h  #1.151:1.152
 @ -1,21 +1,16  @
-// -*- mode: C++ -*-
-
 #ifndef __KMHEADERS
 #define __KMHEADERS
 
-#include "kmmessage.h"
-#include "kmime_util.h"
-#include "kmcommands.h"
-
-#include <klistview.h>
-#include <kfoldertree.h>
-#include <kpopupmenu.h>
-
 #include <qwidget.h>
 #include <qstrlist.h>
+#include <klistview.h>
+#include <kfoldertree.h>
 #include <qmemarray.h>
 #include <qmap.h>
 #include <qdragobject.h>
 #include <qdict.h>
+#include "kmmessage.h"
+#include "kmime_util.h"
+#include <kpopupmenu.h>
 
 class KMFolder;
 @ -95,4 +90,7  @ public:
   virtual KMMessageList* selectedMsgs(bool toBeDeleted = false);
 
+  /** Returns the index values of currently selected items */
+  QValueList<int> selectedItems();
+
   /** Returns index of message returned by last getMsg() call */
   int indexOfGetMsg (void) const { return getMsgIndex; }
 @ -222,4 +220,9  @ public slots:
   virtual void setSelected(QListViewItem *item, bool selected);
 
+  /** Select several items by message index
+   * and if they are the parent of a closed thread, also
+   * recursively select their children. */
+  void setSelectedByIndex(QValueList<int> items, bool selected);
+
   /** switch size-column
       1 for activate, 0 for deactivate, -1 for toggle*/
 @ -297,5 +300,5  @ protected slots:
 
 private slots:
-  void slotMoveCompleted( KMCommand::Result result );
+  void slotMoveCompleted( bool success );
 
 private:
_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic