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

List:       kmail-devel
Subject:    Operations on the parent of a closed thread
From:       Till Adam <till () adam-lilienthal ! de>
Date:       2003-03-29 9:38:46
[Download RAW message or body]

Fellow friends of Italian opera,

the attached patch changes the behavior of kmail such that when a closed 
thread is selected (the parent, rather) and an operation such as 
move/copy/delete is performed on it, that operation is performed on all 
children of that parent as well. To implement that I´ve changed 
KMHeaders::selectedMsgs() to consider children of selected parents of a 
closed thread as selected. 

I wanted to make that an option when I started out, but now I´ve done it, I 
really can't think of a reason why someone would want to turn that off. It 
really is the intuitive behavior, I think. One can always open a thread and 
operate on individual messages, if that is what is desired.

This fixes at least http://bugs.kde.org/show_bug.cgi?id=46448 I believe and 
possibly also http://bugs.kde.org/show_bug.cgi?id=3899 and 
http://bugs.kde.org/show_bug.cgi?id=46153

Cheers,

Till
["selectChildrenOfClosedThreads.diff" (text/x-diff)]

Index: kmheaders.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmheaders.cpp,v
retrieving revision 1.487
diff -u -3 -p -w -r1.487 kmheaders.cpp
--- kmheaders.cpp	20 Mar 2003 01:50:35 -0000	1.487
+++ kmheaders.cpp	29 Mar 2003 09:15:08 -0000
@@ -1525,13 +1645,40 @@ void KMHeaders::setCurrentMsg(int cur)
 KMMessageList* KMHeaders::selectedMsgs()
 {
   mSelMsgBaseList.clear();
-  for (QListViewItemIterator it(this); it.current(); it++)
-    if (it.current()->isSelected()) {
+  for (QListViewItemIterator it(this); it.current(); it++) {
+      if (! (it.current()->isSelected()) )
+          continue;
       KMHeaderItem *item = static_cast<KMHeaderItem*>(it.current());
       KMMsgBase *msgBase = mFolder->getMsgBase(item->msgId());
       mSelMsgBaseList.append(msgBase);
-    }
+      // If the item is the parent of a closed thread recursively select
+      // children .
+      if (mNested != mNestedOverride && !item->isOpen()) {
+          QListViewItem *next = item;
+          next = static_cast<KMHeaderItem*>(next)->firstChildNonConst();
+          while (next && next!=item) {
+	      KMMsgBase *msg = mFolder->getMsgBase(static_cast<KMHeaderItem*>(next)->msgId());
+	      if (msg)
+                  mSelMsgBaseList.append(msg);
 
+              if (static_cast<KMHeaderItem*>(next)->firstChildNonConst())
+                  next = next->firstChild();
+              else if (next->nextSibling())
+                  next = next->nextSibling();
+              else {
+                  while (next && (next != item)) {
+                      next = next->parent();
+                      if (next == item)
+                          break;
+                      if (next && next->nextSibling()) {
+                          next = next->nextSibling();
+                          break;
+                      }
+                  }
+              }
+          }
+      }
+  }
   return &mSelMsgBaseList;
 }

_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail

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

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