Bug 54958

Summary: Message sort column settings change
Product: [Unmaintained] kmail Reporter: Sebastian Bertho <seppel>
Component: GUIAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: amitshah, dniq_kmail, irrationality, michael.jahn, rolf.offermanns, virgilg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Sebastian Bertho 2003-02-21 11:40:07 UTC
Version:            (using KDE KDE 3.1)
Installed from:    Debian stable Packages
OS:          Linux

If I change the sort column (e.g. from date to subject) or sort order (ascending or descending) and enter the settings dialog - then KMail switches back to the sort column used before entering the settings dialog.

If I restart KMail before I enter the settings dialog this effect doesn't appear.
Comment 1 Till Adam 2003-10-25 17:39:51 UTC
*** Bug 59923 has been marked as a duplicate of this bug. ***
Comment 2 Till Adam 2003-10-25 17:42:15 UTC
*** Bug 61067 has been marked as a duplicate of this bug. ***
Comment 3 Till Adam 2003-10-25 17:44:43 UTC
*** Bug 60366 has been marked as a duplicate of this bug. ***
Comment 4 Till Adam 2004-02-11 21:40:09 UTC
CVS commit by tilladam: 

Make sure that when the user clicks on a column header to resort the 
headers listview the .sorted file is invalidated and a new one generated, 
because newly arriving mail triggering a reload of the list view will 
result in a re-lapse to the sort order active on folder entry. Same goes
for a reload triggered by a config dialog apply/ok.

Thomas, thanks for reminding me, I've been meaning to fix that for ages.

CCMAIL: 54958-done@bugs.kde.org
CCMAIL: 74992-done@bugs.kde.org


  M +9 -0      DESIGN   1.16
  M +6 -0      kmheaders.cpp   1.609


--- kdepim/kmail/DESIGN  #1.15:1.16
@@ -730,4 +730,13 @@
   .sorted file as well.
 
+  Note that as an optimization newly arriving mail as part of a mailcheck in
+  an imap folder is not added via msgAdded, but rather via complete reload of
+  the folder via readSortOrder(). That's because only the headers are gotten
+  for each mail on imap and that is so fast, that adding them individually to
+  the list view is very slow by comparison. Thus we need to make sure that
+  writeSortOrder() is called whenever something related to sorting changes, 
+  otherwise we read stale info from the .sorted file. The reload is triggered
+  by the folderComplete() signal of imap folders.
+
 What happens when a message is removed from the folder?
   In this case the msgRemoved slot kicks in and updates the headers list. First

--- kdepim/kmail/kmheaders.cpp  #1.608:1.609
@@ -2637,4 +2637,10 @@ void KMHeaders::setSorting( int column, 
   KListView::setSorting( column, ascending );
   ensureCurrentItemVisible();
+  // Make sure the config and .sorted file are updated, otherwise stale info
+  // is read on new imap mail. ( folder->folderComplete() -> readSortOrder() ).
+  if ( mFolder ) {
+    writeFolderConfig();
+    writeSortOrder();
+  }
 }
 


Comment 5 Michael Jahn 2004-09-02 00:43:00 UTC
*** Bug 87512 has been marked as a duplicate of this bug. ***
Comment 6 Michael Jahn 2004-09-02 00:43:35 UTC
*** Bug 73415 has been marked as a duplicate of this bug. ***
Comment 7 Tom Albers 2004-09-02 00:54:17 UTC
If it is not fixed, this should be reopened I guess.
Comment 8 Michael Jahn 2004-09-02 10:17:05 UTC
To reproduce: 
1. Open contact.
2. Open a folder (here: inbox on a dimap account).
3. Change sort order of column (here: date) or change width of column or change order of columns.
4. Settings->Configure kmail
5. change something (here: Misc-> "Jump to first unread message when entering a folder") and press "Ok". Maybe you can observe the undesired behaviour already, if not repeat 3-5. You should now see that your changes are gone.
Comment 9 Stefano 2004-10-21 17:54:00 UTC
bug is present here on kmail-1.7.1 on kde-3.3.1 on gentoo linux compiled with gcc-3.4.2 glibc-2.3.4.20041006-r0, 2.6.9-rc4-mm1 i686
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.92.0.2-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r5
CXXFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer


please reopen bug (it's quite annoying too)
Comment 10 Andreas Gungl 2005-06-12 20:58:44 UTC
No more reproducible in KMail 1.8.1 - but please reopen if you find a way, though.
Comment 11 Rolf Offermanns 2005-06-12 21:57:33 UTC
Sorry, but I can still reproduce this bug with kmail 1.8.1.
1. Click "Sort by subject" (was: Sort by date)
2. Enter Settings dialog
3. Exit Settings dialog
-> Sort order is "by date" again.
Comment 12 Mats Ahlgren 2007-02-06 08:08:45 UTC
This bug has resurfaced in v1.9.6.
**Please reopen.**

Problem:
The sort-by-date gets set to oldest-on-top after certain random things occur. 

Examples of things which will very often trigger it:
- sending an email message
- making a change to kmail settings

Using KDE 3.5.6

Severity:
Above-average severity