Bug 330063

Summary: digiKam, when deleting photo no confirmation [patch]
Product: [Applications] digikam Reporter: Philippe ROUBACH <philippe.roubach>
Component: Import-MainViewAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, tpr
Priority: NOR    
Version: 3.5.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.1.0
Attachments: Now a KMessageBox pops up to confirm whether a user wants to delete or not
Now a KMessageBox::warningYesNo pops up to confirm whether a user wants to delete or not....donotaskagain also included
the .cpp file
Changes done in importui.cpp and importui.h so that a dialog appears to confirm deletion

Description Philippe ROUBACH 2014-01-17 10:23:57 UTC
in the import window
i select a photo
then
i choose "delete selection"
then
there is no confirmation dialog and the icon of photo stays displayed

with dolphin i can check that the photo is well deleted
with dolphin when deleting a file there is a confirmation dialog



Reproducible: Always
Comment 1 Philippe ROUBACH 2014-01-17 10:24:51 UTC
opensuse 13.1 x86_64 , digikam 3.5

ptp , mtp protocol are used
Comment 2 caulier.gilles 2014-01-17 10:37:16 UTC
Can you try again using last 4.0.0-beta2 released 2 days ago ?

Gilles Caulier
Comment 3 Shourya Singh Gupta 2014-01-20 11:33:13 UTC
Created attachment 84747 [details]
Now a KMessageBox pops up to confirm whether a user wants to delete or not

I used KMessageBox .If the User clicks Ok , then only the deletion will take place else not.
Comment 4 Teemu Rytilahti 2014-01-20 12:26:33 UTC
Some points:
- The check should be outside CameraController, as that is supposedly running on a separate thread. And at the moment deleteFile() would be called multiple times in a row (see deleteItems importui.cpp, which in my opinion would be the correct place for the check.
- You should use use a method, which makes it possible to tick displaying the dialog off (see dontAskAgainName in constructors)
- Perhaps warningYesNo instead of question? Someone knows better though.
- i18nify the strings (see http://techbase.kde.org/Development/Tutorials/Localization/i18n), in my opinion it should display how many files are to be deleted there, see i18np and with context, i18ncp.
- When checking for the return value, use the enumerator. This case it'd be KMessageBox::Yes.
- Check the indendation of the code.
Comment 5 Shourya Singh Gupta 2014-01-21 17:33:07 UTC
Created attachment 84777 [details]
Now a KMessageBox::warningYesNo pops up to confirm whether a user wants to delete or not....donotaskagain also included

I used KMessageBox::warningYesNo .If the User clicks Ok , then only the deletion will take place else not.If user checks donotaskagain then this dialog does not appear from the next time.
Comment 6 Teemu Rytilahti 2014-01-21 18:49:52 UTC
I'm not sure if that patch would work, but I took a deeper look into the relevant code and looks like there's already part of the confirmation box available with all relevant things. See ImportUI::deleteItems() and scroll down to see warnMsg variable and corresponding warningContinueCancelList call.

No idea why that is commented out, but that would be a start. Regarding to your patch, while coding, please note the coding-style of nearby code. That is in this case spaces after commas in parameter listing.
Comment 7 Shourya Singh Gupta 2014-01-21 19:03:18 UTC
Created attachment 84784 [details]
the .cpp file
Comment 8 Shourya Singh Gupta 2014-01-22 15:42:56 UTC
Created attachment 84802 [details]
Changes done in importui.cpp and importui.h so that a dialog appears to confirm deletion
Comment 9 caulier.gilles 2014-05-24 06:40:18 UTC
About original problem :

>there is no confirmation dialog and the icon of photo stays displayed

==> "photo stays displayed" is already fixed in 4.0.0

Gilles Caulier
Comment 10 caulier.gilles 2014-05-24 06:46:21 UTC
Shourya,

In your patch your reproduce a part of code from CameraMessageBox... Why to dupplicate it instead to fix existing one ???

The original problem of this dialog, if to handle properly camera item thumbnails to show in dialog. User want to be sure to delete right items. With your solution no item thumbs is show in dialog.

Also code duplicated and bloat ImportUi class for nothing... Your patch is definitively the wrong way...

Gilles Caulier
Comment 11 caulier.gilles 2014-05-26 13:00:02 UTC
Git commit 4639e6f0b04e73a30e1ed593e453cb5820604af7 by Gilles Caulier.
Committed on 26/05/2014 at 12:51.
Pushed by cgilles into branch 'master'.

Restore CameraThumbsCtrl class to manage and cache thumbnails from camera (concept from 2.x serie, dropped with 3.x model view port)
It cache Camera thumb in max size and pass to thumb model pixmap which need to ne resized. No need to reload thumb from camera if thumb size is changed.
This take a lot of time.
This controler is also used in CameMessageBox to confirm which images to remove from camera. This message box is also restored (fdropped in same condition with 3.x serie)
Note: This controller have been moved as well to ImportThumnailModel class which have been a wrong idea. This implementation must be separated and shared with class tht needs cached thumbnails.
ImportThumnailModel use this controller directly which simplify a lots implementation.
CCMAIL: al.wazery@gmail.com
CCMAIL: tpr@iki.fi

M  +1    -0    digikam/views/mapwidgetview.cpp
M  +2    -1    utilities/importui/CMakeLists.txt
M  +4    -0    utilities/importui/items/importdelegate.cpp
M  +37   -33   utilities/importui/main/importui.cpp
M  +5    -2    utilities/importui/main/importui_p.h
M  +2    -2    utilities/importui/models/importfiltermodel.cpp
M  +2    -2    utilities/importui/models/importfiltermodel.h
M  +14   -5    utilities/importui/models/importimagemodel.cpp
M  +2    -2    utilities/importui/models/importimagemodel.h
M  +25   -273  utilities/importui/models/importthumbnailmodel.cpp
M  +5    -31   utilities/importui/models/importthumbnailmodel.h
M  +8    -5    utilities/importui/views/importstackedview.cpp

http://commits.kde.org/digikam/4639e6f0b04e73a30e1ed593e453cb5820604af7