Bug 173079

Summary: Todo list sorting by priority: Sort "Unspecified" priority separately
Product: [Applications] korganizer Reporter: Steven Rosario <srosariomd>
Component: todoviewAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: chip, smartins, tom_t
Priority: NOR    
Version: 4.1   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Steven Rosario 2008-10-18 04:51:14 UTC
Version:            (using KDE 4.1.2)
OS:                Linux
Installed from:    Debian testing/unstable Packages

Hi, I'm starting to use KOrganizer to manage my todo list. I've noticed that we can assign 9 levels of priority to a given task, with a tenth level of "Unspecified priority". According to the source, unspecified priority tasks get assigned a priority of 0.

Unfortunately, that means that when sorting my list by priority, any 0 priority tasks will be listed before tasks with a highest priority of 1. Why should a task with 0 priority come before one with the highest?

I tried to look at the source code to see if this could be fixed by simply assigning "10" instead of "0" to unspecified priority tasks, but this would only put the tasks at the top if I decide to sort by priority in descending order.

Tasks with 0 priority should be sorted separately from tasks with priority 1-9, and displayed after all tasks with priority. That's how it's been with every other PIM program I've used.I suppose the only way to do this would be to sort 0 priority tasks separately, much like completed tasks also have an option to be treated separately on that basis.

Thanks!
Comment 1 Thomas Thrainer 2008-11-14 08:27:59 UTC
Hi there!

If you want to add this feature, look at kdepim/korganizer/views/todoview/kotodoviewsortfilterproxymodel.cpp, method lessThan().
The feature you describe should be implemented in almost the same fashion as the feature to sort completed todo's at the bottom, which is already realised in this method. Altough, you should check if sorting is performed on the priority column (something like left.column() == KOTodoModel::PriorityColumn), and then check if the priority of either the left or right index is 0 ([left|right].data( Qt::EditRole ).toInt() == 0). If so, sort by yourself (return true or false depending on the sorting order), and if neither left nor right have priority 0, just leave the sorting to Qt (return QSortFilterProxyModel::lessThan( left, right )).

Maybe you can provide a patch with this, unfortunately I'm currently not able to develop myself.

If you want to further expand this feature, add an option to turn it on or off. Just search in the KOrganizer source for sortCompletedTodosSeparately or similar, and add another along with it.

Regards,
Thomas
Comment 2 Chip Salzenberg 2009-04-14 21:31:38 UTC
I'd like to "CONFIRM" this but I can't.  I'm certainly seeing it.
Comment 3 Sergio Martins 2009-06-04 21:52:25 UTC
IMHO, this is a bug and it's trivial enough to fix inside the feature freeze.
Comment 4 Sergio Martins 2009-06-04 22:00:22 UTC
SVN commit 977606 by smartins:

While sorting, "Unspecified" priority must be treated as a low priority.

BUG: 173079


 M  +9 -0      kotodoviewsortfilterproxymodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=977606