Bug 273991 - Mark message as ... submenu grows way too big when user has defined many tags
Summary: Mark message as ... submenu grows way too big when user has defined many tags
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: message list (show other bugs)
Version: 2.0.90
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 22:17 UTC by Christian (Fuchs)
Modified: 2011-12-02 09:50 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8


Attachments
Tags filling the whole screen (134.48 KB, image/png)
2011-09-22 19:19 UTC, Sven Wehner
Details
Patch that extends the Tag::compare() method (1.10 KB, patch)
2011-09-22 23:40 UTC, Sven Wehner
Details
First attempt to split the tags menu into multiple pages (4.38 KB, patch)
2011-09-22 23:53 UTC, Sven Wehner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian (Fuchs) 2011-05-23 22:17:39 UTC
If the user has defined many tags (e.g. 100), the "mark message as ..." submenu of the contextmenu or the message menu grows way too big, as big as the whole screen on low resolutions (e.g. netbooks). 

The best solution would probably be to provide a dialog to select tags instead. Or provide it if the list grows to long, similar to the dolphin sidebar  (5 most recent entries showed, plus an entry  "more", which opens the dialog) 

I mark this as a bug since the sub menu might fill up the whole screen on a netbook by just accidentally moving the mouse over this context menu entry, which makes it hard and annoying to get back to the message list or the context menu entry the user originally wanted.
Comment 1 Sven Wehner 2011-09-22 19:19:00 UTC
Created attachment 63863 [details]
Tags filling the whole screen

This screenshot shows the problem. The whole screen is filled with the tags menu. Please note that the menu leaves the visible space, and: the Tags seem to be not sorted.

Sorry, I had to pixelize the tags, since most of them are people tags from digikam, i.e. full names.
Comment 2 Sven Wehner 2011-09-22 19:19:30 UTC
I use digikam to manage my photos and recently started tagging people, places, objects etc. So I have a lot of tags. And entering the context menu for a message can be quite stunning when hovering over the "Mark Message" entry.
I attached an screenshot of my full screen (!) when opening the menu. Please note that on the right side the menu leaves the visible screen. And there is no possibility to show those entries that doesn't find on the screen.

An additional problem is that the entries don't appear to be sorted. Which is quite strange, because in the source code it says that it should be sorted (tagactionmanager.cpp, line 107):
--- snip ---
// Build a sorted list of tags
QList<Tag::Ptr> tagList;
foreach( const Nepomuk::Tag &nepomukTag, Nepomuk::Tag::allTags() ) { [...] }
qSort( tagList.begin(), tagList.end(), KMail::Tag::compare );
(Source code: https://projects.kde.org/projects/kde/kdepim/repository/revisions/master/entry/kmail/tagactionmanager.cpp#L107 )

If you check Tag.cpp for the compare() method, you will find that it sorts only for priority... ( https://projects.kde.org/projects/kde/kdepim/repository/revisions/master/entry/kmail/tag.cpp#L101 )
I don't know if this is really a good idea. Couldn't you add something like the top 5 or top 10 most important tags, and then add the other tags alphabetically?


It would already help a lot if the Tags would be grouped, i.e. hierarchical structured, like digikam does. Is that something digikam internal, or is there a way to use this hierarchy?

KMail version: 4.7.1
Comment 3 Sven Wehner 2011-09-22 23:40:34 UTC
Created attachment 63872 [details]
Patch that extends the Tag::compare() method

This patch tries (!) to extend the compare() method.

The current version of tag.cpp sorts based on the priority of the tags only. But it seems to be seldom (never? I used nepomukshell to find a tag that had a priority property...) set, and therefore a default value (-1) is used. And thus, the sort order is more or less arbitrary.
The patch makes the compare() method use also the tags' names, when the priority is equal.

Additionally a second compare method is introduced: compareName(). This method ignores the priority and compares only based on tag name.

The patch was written against the source code of the 4.7.1 version, but it should also apply in the trunk, because there haven't been any changes on tag.{h,cpp} for quite some time.


Question: What is the priority for, and why does no one uses it? The source code states "sort order of the tag", but I couldn't see that.
(Would be great if it would be something like a measure of uses or recently uses...)
Comment 4 Sven Wehner 2011-09-22 23:53:31 UTC
Created attachment 63873 [details]
First attempt to split the tags menu into multiple pages

This second patch (it needs the first one, because of the compareName() method) does two things:
1. It adds a small set of the most prioritized tags (atm: 7).
2. It adds the alphabetically sorted tags in sets of 20 tags to a menu, then adds a submenu "More Tags" which also includes 20 tags and another submenu...

Note to 1.: This is currently completely useless! Since there seems to be no tags with a priority property set. And therefore, the "Top Tags" are the first in the alphabet... :(

Note to 2.: This is rather a dirty hack. Now there are a lot of submenus, which makes it quite painful to find a specific tag.
Maybe a search field could help...


Disclaimer: Please note, that this patch is a mere attempt to help some real developer to actually better the situation. Please do not even consider to apply this patch! I didn't even took the time to check if I need to clean up the memory...
Comment 5 Dominic Lyons 2011-10-03 15:18:25 UTC
In KMail 2 settings it's possible to remove tags (just for KMAil, they won't be removed from Digikam). So it's some sort of opt-out.

I think it should be the other way round: Opt-In for the few tags you really need.
Comment 6 Laurent Montel 2011-10-28 07:41:50 UTC
Git commit de2571460c0e568757ce7c401a3d1084bc737991 by Montel Laurent.
Committed on 28/10/2011 at 09:40.
Pushed by mlaurent into branch 'master'.

Add menu "More..." when we have too many entry

CCBUG: 273991

M  +1    -0    kmail/CMakeLists.txt
M  +13   -1    kmail/kmmainwidget.cpp
M  +1    -0    kmail/kmmainwidget.h
M  +21   -2    kmail/tagactionmanager.cpp
M  +4    -1    kmail/tagactionmanager.h
A  +86   -0    kmail/tagselectdialog.cpp     [License: GPL (v2) (+Qt exception)]
A  +50   -0    kmail/tagselectdialog.h     [License: GPL (v2) (+Qt exception)]

http://commits.kde.org/kdepim/de2571460c0e568757ce7c401a3d1084bc737991
Comment 7 Laurent Montel 2011-10-28 08:05:43 UTC
Git commit 8160e893647bb82ede1be49c66ffc9eb0a1d039c by Montel Laurent.
Committed on 28/10/2011 at 10:05.
Pushed by mlaurent into branch 'master'.

Fix Bug 273991 - Mark message as ... submenu grows way too big when user has defined many tags

FIXED-IN: 4.8
BUG: 273991

M  +24   -15   kmail/kmcommands.cpp
M  +3    -3    kmail/kmcommands.h
M  +9    -1    kmail/kmmainwidget.cpp

http://commits.kde.org/kdepim/8160e893647bb82ede1be49c66ffc9eb0a1d039c
Comment 8 Dominic Lyons 2011-10-28 21:51:36 UTC
Thank you!