Bug 130906

Summary: Allow user to click text of tags to tag an image (not checkbox only).
Product: [Applications] digikam Reporter: K Robinson <kjr99044>
Component: Tags-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 0.8.1   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.4
Attachments: patch #1
patch #2
patch #3
patch #4 (final?)
new version using middle button to select tag
right version patch using middle button to select tag

Description K Robinson 2006-07-16 12:57:58 UTC
Version:           0.8.1 (using KDE KDE 3.5.3)
Installed from:    Fedora RPMs
OS:                Linux

In the "Edit image comments and tags" dialog, the user has to click inside each checkbox for the tags.   It would be much more nice to be able to click on the tag text as well.  That way the user doesn't have to aim directly at the check box to choose which tags to apply to each image.

Best wishes to the developers,
K Robinson
Comment 1 K Robinson 2006-07-17 05:45:24 UTC
Perhaps installEventListener on the TAlbumListView or on each tag's TAlbumCheckListItem for a mouse click (or a Shift-click), upon which the relevant tag will be toggled?
Comment 2 Congyi Wu 2007-06-21 01:39:24 UTC
I like this idea.  Single click could lead to mistakes, so shift clicking is a good idea.  Double clicking might work too, since shift clicking is normally associated with selecting multiple items.

Also, right now the space bar seems to go to the next picture in the album, yet it doesn't show up in the configure shortcuts dialog...  I think it might also make sense to allow selecting multiple tags with ctrl or shift click, and toggling with the space bar.  This might be easier to implement as well.
Comment 3 songohan2 2008-04-23 10:32:06 UTC
there is definitely a need for improvement => usability rules!

(doubleclick would annoy me when is was to tag 1000pictures..)
Comment 4 Arnd Baecker 2008-04-23 10:59:50 UTC
Jens, sure;  patches, i.e code contributions, are very welcome! ;-)
Comment 5 Andi Clemens 2008-07-05 01:01:41 UTC
Created attachment 25847 [details]
patch #1

Hi, just wrote a little patch for the described problem. But it doesn't work
well yet. Clicking on the CheckListItem in general works fine, but if you click
the little checkbox, it doesn't work anymore.
Gilles, Arnd, Marcel... is it possible to filter where the user has clicked?

Another question: is a TAlbumListView object also used in the left tags
sidebar? If so, does this additional slot affect it in a negative way?
Comment 6 Andi Clemens 2008-07-05 01:45:01 UTC
Hmm it seems to be impossible to fix this, well at least I can't find a good solution. One possibility would be to double-click on the tag, just replace the signal in the connect statement with doubleClicked().
The problem with this is that the users have to be informed about this, because normally you don't double-click on such items...
Comment 7 caulier.gilles 2008-07-05 08:39:00 UTC
Andi,

Like it's said in comment #1 you need to add an eventFilter. Look my code as exemple from adjust level plugin dialog AdjustLevelDialog::eventFilter().

More info from Qt api : 

http://doc.trolltech.com/3.3/qobject.html#installEventFilter
http://doc.trolltech.com/3.3/qobject.html#eventFilter

Gilles
Comment 8 Andi Clemens 2008-07-06 15:19:00 UTC
Created attachment 25877 [details]
patch #2

Now it works fine...
Gilles, ready to commit?
Comment 9 Andi Clemens 2008-07-06 19:53:10 UTC
Created attachment 25884 [details]
patch #3

There was a problem with the second patch, you were not able to collapse the
CheckListItems anymore, only by double click, which also resulted in assigning
a tag, although not wanted.
To fix this, I used the mouseInItemRect() function from TAlbumViewList class.
The problem here: it is private. I had to change access to public to use it. Is
there a problem with that? TAlbumListView seems to be no part in any lib in
digiKam so changing its access rights isn't a too big problem, right?

Gilles, what do you think?
Comment 10 caulier.gilles 2008-07-07 08:13:02 UTC
Andi,

No problem to change access of this method. I will test your patch soon.

Gilles
Comment 11 Andi Clemens 2008-07-07 08:33:44 UTC
Gilles,

the mentioned function is also defined in FolderView, with exactly the same code as defined in TAlbumView. The only difference are the access rights, in FolderView the function is protected.
It would be even better to set the method in FolderView to public and completely remove it in TAlbumView. But FolderView is a member of libdigikam. Would this change have side effects on the lib?
If so, changing only TAlbumView is fine...
Comment 12 caulier.gilles 2008-07-07 08:37:00 UTC
Oh. nice. I take a look.

Gilles
Comment 13 caulier.gilles 2008-07-07 11:10:21 UTC
Andi,

About your comment #11, we must use parent class code. FolderView::mouseInItemRect() must be set as public and TAlbumViewList::mouseInItemRect() removed.

Gilles
Comment 14 Andi Clemens 2008-07-07 11:21:46 UTC
Created attachment 25895 [details]
patch #4 (final?)

Ok, now the function is removed completely from TAlbumView...
Comment 15 caulier.gilles 2008-07-07 11:27:24 UTC
>patch #4 (final?) 

No (:=))

I can see one problem with the new behaviour.

1/ one click => tag selected. work fine (great)
2/ one double click => tag selected => no. this must collapse/uncollapse childs treeview only. this is the default behaviour without your patch and it must be preserved.

Note: a similar patch must be applied to tagfilter view to be homogenous, else you will see a new bug report about in the future (:=)))

Gilles
Comment 16 Andi Clemens 2008-07-07 11:56:28 UTC
I guess this is not possible, I tried it before... A double click also is handled as a normal click... there is no way (at least for me right now) to handle such situations. Even if the very first line in the eventFilter is

if (e->type() == QEvent::MouseButtonDblClick)
  return false;

the "normal" click action will be called. Do you know a way to do this?
Comment 17 caulier.gilles 2008-07-07 12:33:50 UTC
Andi,

Yes, it's ound like impossible to separate single and double click behaviours

This is my proposal : always handle single click and ignore double like this:

bool ImageDescEditTab::eventFilter(QObject* obj, QEvent* e)
{
    if (obj == d->tagsView->viewport())
    {
        if (e->type() == QEvent::MouseButtonDblClick)
            return true;

        if (e->type() == QEvent::MouseButtonPress)
        {
...
}

Gilles
Comment 18 Andi Clemens 2008-07-07 12:41:06 UTC
Ok, but now double-click will not collapse the tree anymore... Maybe there is another way... but right now I'm too busy to think about it, maybe later...
Comment 19 caulier.gilles 2008-07-07 12:42:52 UTC
Yes, double click is ignored to collapse tree.

To do it, use the "+" or "-" symbols from tree view branch to collapse/expand.

Gilles
Comment 20 caulier.gilles 2008-07-07 12:44:46 UTC
There is another solution to unbreak colapse/expand tree view branch with double click : using middle mouse button to perform tag selection/deselection. What do you think about ?

Gilles
Comment 21 Andi Clemens 2008-07-07 13:02:29 UTC
Hmm don't know, this is a very unusual behavior. I guess most users will not like it and we must inform users somehow that they have to select tags with middle mouse button now. I guess this will even be true for the little checkbox widget, and this is definitely a strange way to select a checkbox...
I will play around with the event filter later that day... if nothing will work we have to discuss this over again.
Comment 22 caulier.gilles 2008-07-07 13:28:16 UTC
Created attachment 25898 [details]
new version using middle button to select tag

Andi,

This version include several mouse buttons behaviours changes:

1/ Use middle mouse button to select/uselect tag when user click on tag text
(and only tag text)
2/ Single Right mouse button click expand/collapse treeview. This behaviour is
ask on	this report: http://bugs.kde.org/show_bug.cgi?id=126871. This way is
already used in K3b to expand/collapse treeview faster. I think it's really an
usability improvement. Of course, this change must be done in other treeview as
Albumview, Dateview an Tagview from left sidebar.
3/ Double Right mouse click always work as default. No change here.

We cannot mix single/double right mouse button click to select/unselect tag and
expand/collapse treeview. Also, middle button to select/uselect tags is not too
wrong. It's a special case from digiKam taht all. In my patch, i have improved
the FoldeView::mouseInItemRect() to only handle text area without checkbox.
User can continue to use (+) and (-) to expand/collapse and the checkbox to
select/unselect tag.

Gilles
Comment 23 Andi Clemens 2008-07-07 13:41:47 UTC
This looks exactly like my patch, and it behaves the same... maybe you uploaded the wrong version?
Comment 24 caulier.gilles 2008-07-07 14:09:11 UTC
Created attachment 25899 [details]
right version patch using middle button to select tag
Comment 25 caulier.gilles 2008-07-08 12:41:10 UTC
SVN commit 829376 by cgilles:

digiKam from KDE3 branch : toggle on/of tag check box item using middle mouse button.
BUGS: 130906


 M  +12 -5     folderview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=829376
Comment 26 caulier.gilles 2008-07-08 13:35:19 UTC
SVN commit 829399 by cgilles:

backport commit #829376 from KDE3 branch
CCBUGS: 130906


 M  +11 -5     folderview.cpp  


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