Bug 141753

Summary: Ability to exclude tags in tag filter [patch]
Product: [Applications] digikam Reporter: Thomas McGuire <mcguire>
Component: Albums-FiltersAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: bko, caulier.gilles
Priority: NOR    
Version: 1.4.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 1.6.0
Sentry Crash Report:
Attachments: Patch to allow the exclusion of tags in the tag filter sidebar

Description Thomas McGuire 2007-02-15 19:35:04 UTC
Version:           SVN (using KDE KDE 3.5.6)
Installed from:    Compiled From Sources
OS:                Linux

The tag filter should be able to exclude certain tags.
Right now, a tag in the tag filter is either checked or unchecked.
Checked means "Show all pictures which have this tag" (mode 1)
Unchecked means "Don't care about this tag (it does not matter if a picture has this tag or not)" (mode 2)
I would like a third category, meaning "Do NOT show (exclude) pictures which have this tag" (mode 3)

This would make the checkbox tri-state. By default it is unchecked (mode 2), clicking it once should change it to mode 1, clicking it again should change it mode 3.
The icon for mode 1 should be a green checkmark.
The icon for mode 3 should be a red cross (X)

The context menu should get one more entry: "Exclude"
This entry should behave like the "Select" (mode 1) and "Deselect" (mode 2) entries, but of course for mode 3.

"Invert Selection" should change mode 2 checkboxes to mode 1 checkboxes and the other way round, but leave mode 3 checkboxes untouched.

The "Matching Condition" (and/or) should not care about mode 3 checkboxes. What I mean here is that first, the tag filter should completely ignore the mode 3 tags and build a list of visible pictures like it does with the current version. Only in this step, the matching condition should be relevant. In the next step, it should remove all pictures from that list which have a tag whose checkbox is mode 3. Then, only the remaining pictures should be shown.

If you think tri-state checkboxes are confusing, then maybe mode 3 could only be activated by the context menu entry ("Exclude"), and not by clicking the checkbox. Clicking the checkbox could then only cycle between mode 1 and 2. If a checkbox has mode 3, clicking it will set it to mode 2. Clicking it again then only toggles between mode 2 and mode 1.


Usecases:

There are several cases where this functionallity is useful for me, for example:

1. 
I have tagged all my videos with a "Video" tag. Sometimes, I only want to see my pictures in the thumbmail view, and not the ugly video icon. In this case, I could use the tag filter to exclude the "Video" tag.
I also have pictures which I did not take myself, they are taken by persons doing the same journey as me. Sometimes, I only want to see the pictures I have taken myself. With this wish implemented, I could just exclude the "NotMe" tag.

2. Tag Hierarchies
Let's say I have the following tag hierarchy:
Animals
|- Birds
For example, I have a picture of a lion which is tagged "Animal". Then I have a picture of a bird which is tagged "Animal" and "Bird". Now, let's say I want to see only animals which are not birds. With the current tag filter, this is not possible. If I only check the "Animal" tag in the tag filter, the picture of the bird would still be shown, because it is also tagged with the "Animal" tag.
With my proposal, I could simply exclude all children of "Animal" (therefore excluding "Birds"), and see only the picture of the lion.

See also bug #112799 for a discussion about this.
I hope I explained it clearly.
Comment 1 Ruth Alkema 2008-01-19 21:45:09 UTC
I would also like this functionality.  I know it can be done with advanced search, but it would be quicker if the tag filter could exclude some tags.

I use it to see if I have forgotten to give some pictures some tag. If I do a search for all fotos not having this tag, I can easily see wich pictures still need to get the tag.
Comment 2 Michael Christen 2008-01-20 09:58:00 UTC
also uns gefällt der schaft.
rebi wüdrde ihn aber dunkel nehmen...

Ruth Alkema schrieb:
[bugs.kde.org quoted mail]
Comment 3 Andi Clemens 2009-10-21 08:34:13 UTC
Was im Gottes Willen soll denn das heißen?

(Just commenting to post above :-))
Comment 4 Michael Christen 2009-10-21 08:56:57 UTC
Please ignore comment #2... That was a terrible mistake. ;-)

Can someone tell me how to delete a comment?
Comment 5 Andi Clemens 2009-10-21 09:03:11 UTC
It reads like porn-spam! :D
Hmm don't know how to delete comments, maybe it is just not possible?
At least for the digiKam product I should have all rights, but I can not see how to do it.
Comment 6 caulier.gilles 2009-10-21 09:24:55 UTC
I cannot see how to delete a comment too...

As i cannot read German words, i'm not in trouble (:=)))

Gilles
Comment 7 Bastiaan Hovestreydt 2010-07-20 00:59:52 UTC
Created attachment 49320 [details]
Patch to allow the exclusion of tags in the tag filter sidebar

I have implemented the following things:
-The pop-up menu has sub menu to set a tag to be ignored, included or excluded
-Tag icon has a green "+" over it when included in search result and a red "-" when excluded
-Middle click on a tag cycles trough exclude/include/ignore
-Excluded tags are always matched with "and", regardless of the selected matching condition -> if an image has any of the excluded tags it will not be shown
Comment 8 caulier.gilles 2010-07-20 08:40:23 UTC
Johannes,

Did you manage this patch ?

Gilles Caulier
Comment 9 Johannes Wienke 2010-07-20 10:20:59 UTC
I don't know If i got enough time in the next 6 weeks to do this.
Comment 10 Bastiaan Hovestreydt 2010-10-12 23:41:28 UTC
Hi,

can someone please include this patch into SVN? Since it didn't make it into 1.4.0 and 1.5.0 I would love to see this feature in 1.6.0.

Bastiaan
Comment 11 Andi Clemens 2010-11-13 11:23:28 UTC
I'll take a look at the patch today... I just applied it and it seems to be ok so far.

Andi
Comment 12 Andi Clemens 2010-11-13 12:34:13 UTC
SVN commit 1196406 by aclemens:

Add the ability to exclude tags in the tagfilter view.
Thanks to Bastiaan Hovestreydt for this patch.

BUG: 141753

 M  +3 -1      NEWS  
 M  +40 -7     digikam/albumselectcombobox.cpp  
 M  +2 -1      digikam/albumselectcombobox.h  
 M  +71 -3     digikam/albumtreeview.cpp  
 M  +1 -2      digikam/albumtreeview.h  
 M  +3 -1      digikam/digikammodelcollection.cpp  
 M  +2 -1      digikam/digikammodelcollection.h  
 M  +3 -2      digikam/digikamview.cpp  
 M  +2 -0      digikam/digikamview.h  
 M  +18 -4     digikam/tagcheckview.cpp  
 M  +5 -4      digikam/tagcheckview.h  
 M  +67 -20    digikam/tagfiltersidebarwidget.cpp  
 M  +6 -4      digikam/tagfiltersidebarwidget.h  
 M  +37 -4     libs/models/abstractalbummodel.cpp  
 M  +7 -2      libs/models/abstractalbummodel.h  
 M  +4 -3      libs/models/imagefiltermodel.cpp  
 M  +3 -2      libs/models/imagefiltermodel.h  
 M  +67 -11    libs/models/imagefiltersettings.cpp  
 M  +5 -3      libs/models/imagefiltersettings.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1196406
Comment 13 Marcel Wiesweg 2011-04-17 16:41:56 UTC
Git commit 434fc7e9410bc4866a31d78661699fc8745af45b by Marcel Wiesweg.
Committed on 17/04/2011 at 16:45.
Pushed by mwiesweg into branch 'master'.

Fix a regression introduced by the ability-to-exclude-tags patch, and make some stuff work (again):
- use a special "add exclude" mode only enabled in models that need it. Fixes regression 267421
  (partial check state treated as fully checked)
- albumDecorationRole is overridden by derived classes, so there is no sense in doing the overlay
  painting in this method in the parent class. Provide a tool method which is called from the children,
  now the + or - is visible.

CCBUG: 141753
BUG: 267421

M  +2    -1    NEWS     
M  +1    -2    digikam/models/digikammodelcollection.cpp     
M  +42   -23   libs/models/abstractalbummodel.cpp     
M  +16   -1    libs/models/abstractalbummodel.h     
M  +6    -2    libs/models/albummodel.cpp     

http://commits.kde.org/digikam/434fc7e9410bc4866a31d78661699fc8745af45b