Bug 167873 - Tag and album trees are not expanded when searching for entries
Summary: Tag and album trees are not expanded when searching for entries
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-Filters (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-31 18:12 UTC by Gandalf Lechner
Modified: 2012-06-27 11:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.10.0


Attachments
expand patch #1 (5.43 KB, patch)
2008-08-16 23:46 UTC, Andi Clemens
Details
expand patch #2 (5.36 KB, patch)
2008-08-17 10:07 UTC, Andi Clemens
Details
expand patch #3 (9.21 KB, patch)
2008-08-18 09:05 UTC, Andi Clemens
Details
expand patch #4 (9.21 KB, patch)
2008-09-02 10:28 UTC, Andi Clemens
Details
collapse patch#5 (10.38 KB, patch)
2008-10-21 21:03 UTC, Andi Clemens
Details
final patch (9.79 KB, patch)
2008-10-29 16:34 UTC, Andi Clemens
Details
really final patch (7.50 KB, patch)
2008-10-29 20:59 UTC, Andi Clemens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gandalf Lechner 2008-07-31 18:12:33 UTC
Version:           0.10.0-beta3 (rev.: 840177) (using 4.1.00 (KDE 4.1.0), Kubuntu packages)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.24-17-generic

When typing in the search bar under the tag tree or album tree, autocompletion is used to narrow down the search quickly. However, the tree does not expand so that the user does not see what entries are still left that match the search. For example, one could type "Lond" in the search bar under the tag tree, and although the tag "London" matches this entry, this information stays hidden in the collapsed tree structure Place->Europe->UK->London.
Moreover, when the entry matches only a single unique item (tag or album), this item should be easily selectable (for example by hitting enter), since this is what the users usually wants in such a situation.
Comment 1 caulier.gilles 2008-07-31 19:29:58 UTC
Gandalf,

I confirm this one too...

Andi, it can be fixed easily i think.

Gilles
Comment 2 Andi Clemens 2008-08-16 18:36:26 UTC
I'll have a look on this one... I guess this will also be true for KDE3.

Andi
Comment 3 Andi Clemens 2008-08-16 23:46:34 UTC
Created attachment 26885 [details]
expand patch #1

When searching for albums and tags with the quick filter text search, the
folder view has not been expanded when an item matched the search criteria.

For this to work, we have to use setOpen() on every matched item. In most of
the cases the whole album or tag tree will be expanded, which will be very
annoying when you have a lot of tags or albums.

This commit will introduce a new FolderView method collapseView(CollapseMode
mode), that will collapse the tree when the search criteria is removed. Right
now it has two modes:

* CollapseModeOmitRoot (default): Collapse all items and expand the root item
in the end. This is used most of the time, for example for the AlbumFolderView,
where a root item (My Albums) has to be expanded again, otherwise no albums
will be seen.

* CollapseModeAll: Collapse all the items in the folder view. This is used
right now only in the TagFilterView, which has no root item and therefore
should not try to expand it.

If the new behavior is acceptable, it has to be ported to KDE3 of course.

Andi
Comment 4 Andi Clemens 2008-08-17 10:07:24 UTC
Created attachment 26891 [details]
expand patch #2

Slightly updated version, now CollapseModeOmitRoot is set as the default
action.

Andi
Comment 5 Andi Clemens 2008-08-18 09:03:01 UTC
Finally bugzilla is running again and even the MyLyn plugin from Eclipse connects to B.K.O. now, nice...!
So I can post the patch I wanted to attach here all sunday.

I tried to avoid copying source code and ended up in template hell ;-)
Somehow template methods only worked when defining them in the header file, which is bad.

Anyway here is a new version of the patch, it will introduce a new standard collapse mode for
AlbumFolderView and TagsFolderView: CollapseModeRestore.

This mode will collapse the whole folder view first, but restore the currently watched album in the
folder view again.

FolderView::collapseView() is a virtual function now, so it may be re-implemented if necessary.

Right now the default behaviors are:

FolderView::collapseView(): CollapseModeAll
AlbumFolderView::collapseView(): CollapseModeRestore
TagsFolderView::collapseView(): CollapseModeRestore
TagFilterView::collapseView(): CollapseModeAll (uses the original method from FolderView)
ImageDescEditTab::collapseView(): CollapseModeAll (uses the original method from FolderView)

Gilles,

unfortunately I can't test the code for TagsFolderView now because I don't see tags at all. Is it broken?
It is not my patch, if I revert everything I still can't see tags. To be more precise: I see tags in the TagsFolderView, but clicking on them will not give me any thumbnails in the icon view. All other views work fine
(AlbumFolderView, DateFolderView etc).
I also deleted my digikam4.db and the settings in home folder, still it is not working. So I guess it is seriously broken somehow.
Can you confirm this, too? I don't want to add a new bugreport if it is not necessary.

Andi
Comment 6 Andi Clemens 2008-08-18 09:05:30 UTC
Created attachment 26904 [details]
expand patch #3

Well you have to actually ATTACH a patch and not just talk about it! :-)

Andi
Comment 7 caulier.gilles 2008-08-18 10:00:26 UTC
Andi, 

Your icon view problem sound like a broken digikam album kioslave. Look error messages in the console.

I have not yet tested your patch here, but nothing is broken here (KDE3 and KDE4)

Gilles
Comment 8 Andi Clemens 2008-08-18 10:05:46 UTC
This is strange, but now it is working again... just wanted to make sure that the console output is right.

Gilles,

you seem to have used magic words or something like that, just talk about it and it is already fixed :-)

Andi
Comment 9 Andi Clemens 2008-09-02 10:28:57 UTC
Created attachment 27187 [details]
expand patch #4

Modified version to compile with latest trunk
Comment 10 Andi Clemens 2008-10-21 21:03:09 UTC
Created attachment 28056 [details]
collapse patch#5

This patch fixes some minor bugs...
One problem still exists: How to make sure the item is visible in the end?
Somehow ensureItemVisible() is not working here, seems to be the same problem as with the filmstrip.

Marcel, Gilles,

any idea why the selected listview item is not visible when resetting the filter search?
Do we need to return to event loop first so that the listview knows the position of its items?

Andi
Comment 11 Andi Clemens 2008-10-29 16:34:13 UTC
Created attachment 28221 [details]
final patch

itemIsVisible works now.

Gilles,

can you test this patch?
The collpase modes are described in the folderview.h file. It works with multiple root albums.
To see the results, you need to clear the text quickfilter in album or tags folder view. CollapseView() will only be called on an empty filter.

Andi
Comment 12 caulier.gilles 2008-10-29 16:39:41 UTC
Andi,

Yes, i will do it tomorow morning...

Gilles
Comment 13 Andi Clemens 2008-10-29 16:41:14 UTC
Maybe a quick description again what this patch does:

When fitering the album or tag view, results where not expanded so you had to click on each parent to finally get to the resulting album item. This patch will fix it.
Also it introduces some collapse modes:
If you had searched for an album and cleared the filter, it could happen that a big album tree stayed open (esp. if ou have a heavy nested album structure).
For album view the currently displayed album is restored, meaning that the folder tree will collapse and the viewed album will be expanded again.
Even if you have 5 root albums (like in my test database) you will quickly find your current viewed album now. The same is true for the tag folder view.
For "Captions/Tags" and its tag folder view there is a differen behaviour: when clearing the filter, it will just collpase all child items of "My Tags", but if we like we could also restore the last selected tag item... we just need to change the collapse mode for this folderview.

Andi
Comment 14 Andi Clemens 2008-10-29 18:02:30 UTC
Since somebody in the past installed this patch and asked me what it does, I think it is easier to understand if you watch a little movie. This link http://digikam3rdparty.free.fr/misc.tarballs/temp/collapse.avi will show the new behavior. Compare it to the current implementation to see the difference.

@Gilles,

ok!

Andi
Comment 15 caulier.gilles 2008-10-29 19:04:04 UTC
Andi,

tested here. all work fine as expected. Patch is simple to backport to KDE3 branch. Note : i have planed to release first 0.9.5-beta1 soon...

Marcel, 

Can you take a look in this patch if all work fine for you ?

Gilles
Comment 16 Andi Clemens 2008-10-29 20:33:36 UTC
Hi Gilles,

thanks for testing already... I just found out that I don't need to cast to the specialized folderitems (like album item or tag item), so I can implement collapseView() totally in folderview.h
I will update the patch...
This will be even easier now...

Andi
Comment 17 Andi Clemens 2008-10-29 20:59:45 UTC
Created attachment 28225 [details]
really final patch

So, now I'm happy with it...

Marcel, if you would like to test it?

Andi
Comment 18 caulier.gilles 2008-11-04 16:29:11 UTC
yes, it's fine for me. let's go

Gilles
Comment 19 Andi Clemens 2008-11-04 16:31:40 UTC
SVN commit 880036 by aclemens:

expand and collapse folder view when using quick filter text search

When searching for albums and tags with the quick filter text search, the
folder view has not been expanded when an item matched the search criteria.

For this to work, we have to use setOpen() on every matched item. In most of
the cases the whole album or tag tree will be expanded after you reset the
filter again, which will be very annoying when you have a lot of tags or albums.

This commit will introduce a new FolderView method collapseView(),
that will collapse the tree when the search criteria is removed. Right now it has two modes:

* RestoreCurrentAlbum (default):
  Collapse the folder view and re-open the current viewed album.
  In this mode, all root items are collapsed, then the one containing
  the currently selected album is expand again.
  This mode will make sure that the selected album is visible in the folder tree by scrolling the
  view to the selected item.

* OmitRoot:
  Collapse the folder view but omit the root item.
  In this mode all items in the folder view are collapsed,
  and the first root item is expanded again (My Tags / My Albums etc)

CCBUG:167873

 M  +10 -0     digikam/albumfolderview.cpp  
 M  +54 -5     digikam/folderview.cpp  
 M  +22 -0     digikam/folderview.h  
 M  +10 -0     digikam/tagfilterview.cpp  
 M  +10 -0     digikam/tagfolderview.cpp  
 M  +10 -0     libs/imageproperties/imagedescedittab.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=880036
Comment 20 Andi Clemens 2008-11-04 16:31:45 UTC
SVN commit 880037 by aclemens:

collapse children of matching album / tag names.

If an album name matches the filter in one of the children of the current item, but not the current item's own name,
don't expand the current item.
This will prevent the following situation. Assume we have this album layout:

|-- 1999
|   |-- Alleyras
|   `-- Test
|       |-- 01
|       `-- 02
`-- 2008
    `-- all
        |-- 01
        `-- 02

When we search for the term all, we will get this layout with the old behavior:

|-- 1999
|   |-- Alleyras
`-- 2008
    `-- all
        |-- 01
        `-- 02

But this is wrong and can get quite messy if you have heavy nested folders. We should only display the folder names that really match the term.
We can either do this by removing all folders that don't match the criteria, but this is bad. Assume we search for "birthday" and want to see the underlying folders.
With this method they'll be gone. So the only other possible way is to collapse all non matching children like this:

|-- 1999
|   |-- Alleyras
`-- 2008
    `-- all

You still can expand the folder 'all' to get the sub-folders, but they will not mess up the folder view anymore.
Ok this was a long description for a commit... :-)

Andi

BUG:167873

 M  +4 -2      digikam/albumfolderview.cpp  
 M  +3 -1      digikam/tagfilterview.cpp  
 M  +4 -2      digikam/tagfolderview.cpp  
 M  +3 -1      libs/imageproperties/imagedescedittab.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=880037
Comment 21 Andi Clemens 2008-11-04 16:46:30 UTC
SVN commit 880043 by aclemens:

backport commit 880036 and 880037 from trunk

CCBUG:167873



 M  +32 -20    digikam/albumfolderview.cpp  
 M  +57 -9     digikam/folderview.cpp  
 M  +20 -0     digikam/folderview.h  
 M  +16 -4     digikam/tagfilterview.cpp  
 M  +26 -14    digikam/tagfolderview.cpp  
 M  +23 -11    libs/imageproperties/imagedescedittab.cpp  


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