Bug 220412 - Selecting multiple word tags in gwenview doesn't work
Summary: Selecting multiple word tags in gwenview doesn't work
Status: RESOLVED FIXED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-28 16:26 UTC by Mike Bridge
Modified: 2012-10-19 13:26 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for the tag with quote problem in gwenview (572 bytes, patch)
2010-03-22 21:13 UTC, Kolia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Bridge 2009-12-28 16:26:35 UTC
Version:            (using KDE 4.3.4)
OS:                Linux
Installed from:    Ubuntu Packages

I started tagging my images via gwenview. Selecting multiple word tags on the right pane of the Gwenview start page returns no result. 

- Tag a file "Ernest Tubb's"
- Go to start page and select Ernest Tubb's .. Note no results.
- Search via Dolphin
-- nepomuksearch:/hastag:Ernest Tubb's .. Note no results.
-- nepomuksearch:/hastag:"Ernest Tubb's" .. Success!

Gwenview search syntax should be updated to search hastag:"Ernest Tubb's" vice hastag:Ernest Tubb's.
Comment 1 Mike Bridge 2010-01-02 18:13:13 UTC
I think the place to fix this is in /trunk/KDE/kdegraphics/gwenview/app/startpage.cpp line 193.
Comment 2 Eike Hein 2010-01-02 18:26:42 UTC
Yup, looks like the right line. However rather than surrounding the the tag name with quotation marks the right way to go about it would probably be to url-encode it (i.e. the space becomes %20 and so on) using QUrl::toPercentEncoding.
Comment 3 Kolia 2010-03-08 20:35:29 UTC
Hi 

FYI:I just tested and can reproduce it with Ernest Tubb's as tag.
But if I tag a picture with "test tag" (without the quotes), it works fine.
My guess is that it's not especially related to multiple words, but to the quote inside your tag.
Still, maybe the fix proposed by Eike would work fine. I'm about to test it (trunk currently building).

Regards
Comment 4 Kolia 2010-03-09 21:52:57 UTC
@Thomas:

nepomuksearch:/hastag:"Ernest Tubb's"  <-- this is really working in Dolphin for you? Here it's not.
Comment 5 Sebastian Trueg 2010-03-10 20:17:54 UTC
The right way to fix this is to not use strings in the first place. Gwenview already loads the tags. Thus, it has Nepomuk::Tag instances for all tags. Simply use the resourceUris() or in KDE 4.4 do:

Nepomuk::Query::ComparisonTerm(Soprano::Vocabulary::NAO::hasTag(), 
                               Nepomuk::Query::ResourceTerm(tag)));

And put that in a Nepomuk::Query::FileQuery.
Comment 6 Kolia 2010-03-22 21:13:36 UTC
Created attachment 42188 [details]
Patch for the tag with quote problem in gwenview

Using the resourceUri the search went indeed good. Here is a patch.

@Sebastian: i didn't find the instances of Tag so I generated it from the data I found. Seems to work fine. Where would be the tags?

@Aurelien: even if this allow the search on tag with quote to work, it has a difference with the current method: the "shortcut" generated on startpage after a search is a file with a resourceUri as name instead of "hasTag:/something". Which is less readable...
Comment 7 Sebastian Trueg 2010-03-23 09:11:10 UTC
The patch looks very good. It uses a trick but that is perfectly fine since the nepomuk KIO slave handles tags as special cases.
To get proper names I think it would be sufficient to use KFileItem::text() in the history model. Then, at least the history folders would use the name of the tag rather than the resource URI. But be aware that you need to do a KIO::stat in order to get that information.