Bug 71596

Summary: Messages are not marked as read when opened in new window
Product: [Unmaintained] kmail Reporter: Bram Schoenmakers <me>
Component: generalAssignee: Till Adam <adam>
Status: RESOLVED FIXED    
Severity: normal CC: jdeking2
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Bram Schoenmakers 2004-01-01 17:19:50 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

In KMail CVS-20040101 the messages are not marked as read when I open the messages in a new window. When the Message Preview Pane is active, then the messages will be marked as read. And yes, I've checked the option to mark messages as read after 0 seconds. Everytime I have to mark them as read by hand, because I've disabled the preview pane.

I also noticed this behavior in 3.2beta2.
Comment 1 Till Adam 2004-01-02 19:47:17 UTC
Fixed in Osnabrueck branch. Assigning to me so I don't forget to merge.
Comment 2 Thomas Reitelbach 2004-01-06 09:16:28 UTC
confirmed with current cvs, please don't forget to merge the fix :-)
Comment 3 Till Adam 2004-01-06 14:35:07 UTC
*** Bug 69829 has been marked as a duplicate of this bug. ***
Comment 4 Till Adam 2004-01-07 00:23:00 UTC
Subject: kdepim/kmail

CVS commit by tilladam: 

Use BODY.PEEK instead of FETCH because the latter implicitly sets the \seen
flag. Instead, explicitly set the message to read (set \seen flag) on the
server when it is marked as read locally. The reasons being:

o the local and remote status don't go out of sync leading to incorrect
  unread counts
o it makes using the same imap account with multiple clients possible
o fixes a couple of bugs with the external reader window as a side effect

CCMAIL: 71596-done@bugs.kde.org
CCMAIL: 65005-done@bugs.kde.org


  M +3 -1      imapjob.cpp   1.38
  M +9 -7      kmreaderwin.cpp   1.733


--- kdepim/kmail/imapjob.cpp  #1.37:1.38
@@ -234,6 +234,8 @@ void ImapJob::slotGetNextMessage()
       path += ";SECTION=HEADER";
     } else {
-      path += ";SECTION=" + mPartSpecifier;
+      path += ";SECTION=BODY.PEEK[" + mPartSpecifier +"]";
     }
+  } else {
+      path += ";SECTION=BODY.PEEK";
   }
   url.setPath( path );

--- kdepim/kmail/kmreaderwin.cpp  #1.732:1.733
@@ -1408,7 +1408,9 @@ void KMReaderWin::slotTouchMessage()
   if (message())
   {
-    if (message()->isNew() || message()->isUnread() || message()->isRead())
-      message()->setStatus(KMMsgStatusRead);
-    if ( message()->isNew() || message()->isUnread() ) {
+    SerNumList serNums;
+    if (message()->isNew() || message()->isUnread()) {
+      serNums.append( message()->getMsgSerNum() );
+      KMCommand *command = new KMSetStatusCommand( KMMsgStatusRead, serNums );
+      command->start();
       KMMessage * receipt = message()->createMDN( MDN::ManualAction,
                                                   MDN::Displayed,