Bug 292482 - FACTORING : permit to fill image list with current selected album when no item are selected [patch]
Summary: FACTORING : permit to fill image list with current selected album when no ite...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-WebService-Google (show other bugs)
Version: unspecified
Platform: Mageia RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-26 16:36 UTC by Philippe ROUBACH
Modified: 2018-01-30 21:22 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11.0
Sentry Crash Report:


Attachments
If no item is selected,then the whole album is selected by digikam,which is the required solution to this bug. (4.37 KB, patch)
2014-02-15 16:26 UTC, Shourya Singh Gupta
Details
I created a new function loadImages() in kpimageslist.cpp,which loads all images from currentalbum if no image is selected by user or if the user has selected some images it loads those images only. (3.34 KB, patch)
2014-02-25 15:28 UTC, Shourya Singh Gupta
Details
A properly created patch which merges the above two patches, following proper indentation and coding style. (3.81 KB, patch)
2014-04-09 19:01 UTC, Shourya Singh Gupta
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe ROUBACH 2012-01-26 16:36:14 UTC
Version:           2.5.0 (using Devel) 
OS:                Linux

select an album
then
right click on the album name
then
choose
export
then
choose picasawebexport
then
no photos in the list of photos to export
this is a regression compared to digikam 1.9

with digikam 1.9 all the photos of the album are in the list
without selected them


Reproducible: Always

Steps to Reproduce:
see details


Expected Results:  
list of photos filled with all the album photos by only selecting the album

OS: Linux (x86_64) release 3.2.1-desktop-2.mga2
Compiler: gcc

mageia 2 alpha 3
kde 4.8.0
Comment 1 Smit Mehta 2012-04-19 10:06:50 UTC
I confirm the bug.
Comment 2 caulier.gilles 2012-04-19 10:47:09 UTC
Smit,

This dysfunction is also valid for other tools available from digiKam album/export context menu.

In fact it's delegate to KPImageList. Look into PicasaWebExport tool, imagelist try to load item from current selection :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/picasawebexport/picasawebimglist.cpp#L62

In case of you select album context menu to export items, nothing is selected in digiKam icon-view, following Philippe report.

If you take a look into KPImageList :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/common/libkipiplugins/widgets/kpimageslist.cpp#L768

... we use Digikam::KipiInterface::currentSelection() to get items list from KIPI host application, depending of current selection.

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/kipiiface/kipiinterface.cpp#L118

This method return current selection from icon-view. If this one is empty, we need to check in second time the current album selection to take all items hosted by it :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/kipiiface/kipiinterface.cpp#L102

Gilles Caulier
Comment 3 Smit Mehta 2012-04-19 13:30:29 UTC
Hi Gilles

I looked into it. The thing is, by default, "first" image of the folder is always selected. So if user doesnt touch his album, right click on album and use export, the first image will be considered. Now the problem is, if we approach the way you said, then user wont be able to export only one selected photo, because whenever he does that, the entire folder will get selected. What do you suggest here? what should I do? More essentially, is there a way to differentiate between "by default" selected image and user selected image?

Smit
Comment 4 caulier.gilles 2012-04-19 13:52:22 UTC
>I looked into it. The thing is, by default, "first" image of the folder is always selected.

Yes. I think it's a bug in digiKam icon-view implementation. Normaly none must be selected in this case..

>So if user doesnt touch his album, right click on album and use export, the first image will be >considered. 

yes this is the current behaviors.

>Now the problem is, if we approach the way you said, then user wont be able to export only one >selected photo, because whenever he does that, the entire folder will get selected. 

No. If user select one image from icon view, this will be used as selection.

If _no_ selection is done on icon view, well whole album contents will be passed as selection.

>What do you suggest here? what should I do? 

Just add to the KPImageList method a way to check if no item from icon-view is passed from digiKam kipi interface. if yes, check album selection with right method.

>More essentially, is there a way to differentiate between "by default" selected image and user selected >image?

No, it's not yet implemented, and i agree to do it in the future...

Gilles
Comment 5 Smit Mehta 2012-10-07 12:11:28 UTC
Hi Gilles

When we open any album, by-default, its first image is selected. This was justified my Marcel (in some other bug, i dont remember), that if nothing is selected, many of the things will look disabled on the digiKam screen, and it didnt look good , and hence he made it to select by default one. So in current scenario, the possible solution is :

(1) - get currentSelection() size and if its one, then select the entire folder. But it is obviously a fault, as it will give a bug when user wants to export only one image.
(2) - make by default current selection to be zero images. then we can just see currentSelection() size, and if its zero, we can add the entire folder.
(3) - introduce a method to distinguish between user selected images and system selected by default images. by that, we can apply method (1) again without resulting in a bug.
(4) - not touching the default image selections, and somehow passing a different signal to kipi plugins when the export is clicked by right-clicking the albums, and then correspondingly write slots for them.

What are your thoughts?

Smit
Comment 6 caulier.gilles 2012-10-07 12:18:43 UTC
I have been always happy wit 1), but for some obscure reason, relevant of other KIPI host application which have another behavior with selection through re-implemented KIPI interface.

I don't like very well 2)

For 4), signal must already exist in libkipi if i remember... I prefer 3) to 4).

Of course, digiKam is not alone here. If a solution is chosen, this must be tested in Gwenview and KPhotoAlbum to see is behavior is understandable by end-users.

Gilles
Comment 7 Philippe ROUBACH 2014-01-11 11:13:23 UTC
opensuse 13.1 , kde 4.12 , digikam 3.5

pb still valid

a little progress : the first one is selected
Comment 8 Shourya Singh Gupta 2014-02-15 16:26:33 UTC
Created attachment 85167 [details]
If no item is selected,then the whole album is selected by digikam,which is the required solution to this bug.

I have created 2 new functions in kpimageslist.cpp.First function is,loadImagesFromCurrentAlbum(),which loads images from the current album and the second function is checkSelection(),to check if any image is selected by user or not.Also some changes are done in picasawebimglist.cpp and picasawebwindow.cpp
Comment 9 Shourya Singh Gupta 2014-02-25 15:28:58 UTC
Created attachment 85325 [details]
I created a new function loadImages() in kpimageslist.cpp,which loads all images from currentalbum if no image is selected by user or if the user has selected some images it loads those images only.
Comment 10 Shourya Singh Gupta 2014-04-09 19:01:36 UTC
Created attachment 86021 [details]
A properly created patch which merges the above two patches, following proper indentation and  coding style.
Comment 11 caulier.gilles 2015-05-19 12:08:37 UTC
Maik,

The patch from Shourya is interesting. I checked code and it sound good. 

Shourya,

Can you update the patch against current implementation from git/master please ?

Gilles
Comment 12 caulier.gilles 2015-05-19 12:12:26 UTC
Shourya,

In your patch PicasaExport tool code don't need to be touched. In fact you button is add to KPImageList and it must work alone without to touch tool code. Like this your patch will add this feature to all tools which use KPImageList.

Gilles
Comment 13 Shourya Singh Gupta 2015-06-01 22:00:12 UTC
I dont know why but adding "BUG" keyword in my commit message did not close this bug. Hence manually closing this. The feature requested in this bug has been added and can be seen in this : http://commits.kde.org/kipi-plugins/d538446d6da6627c79552283d47bb9f7ea877e03
Comment 14 caulier.gilles 2015-06-02 05:12:51 UTC
You must use "BUGS", use a space after ':' and write all macros to a new line like this :

----------------------------------------------------------------
If no image is selected then all images from current album is selected by default.
BUGS: 292482
FIXED-IN: 4.11.0
----------------------------------------------------------------
Comment 15 caulier.gilles 2015-06-03 12:46:45 UTC
Git commit 2000b6c893f074ac29c9731534fcff91396752e9 by Gilles Caulier.
Committed on 03/06/2015 at 12:46.
Pushed by cgilles into branch 'frameworks'.

backport commit #d538446d6da6627c79552283d47bb9f7ea877e03 from git/master to frameworks branch

M  +45   -1    common/libkipiplugins/widgets/kpimageslist.cpp
M  +9    -1    common/libkipiplugins/widgets/kpimageslist.h

http://commits.kde.org/kipi-plugins/2000b6c893f074ac29c9731534fcff91396752e9