SUMMARY After getting back from a trip my workflow is that I start watching the photos I took whilst making a selection (deleting photos I don't like). It would be great if this could be done from the slideshow directly. Also, it would be great if one can just hit the "Delete" key on the keyboard to move photos to Trash. P.S. If you'd be interested in such a feature I'd be happy to try to contribute by opening a PR. Though a few pointers to where and want would be great.
A similar bug report is bug 280133 Maik
Le, I think this file can be easily fixed by patching the slideshow tool bar with a new button to move item to digiKam trashbin. What do you think ? Note: Maik comment #1 point to bug #280133 where another option can be also append to toolbar to rotate current item. Note that the thumbbar support from #280133 is another story, more complex to solve, and out of topic... Best Gilles Caulier
Created attachment 137192 [details] Button for moving image to trash in slideshow Hi Gilles, This patch creates a button in slideshow. By clicking this button, it moves image the image to trash of digiKam, and remove image from current list of image slide show. LE
Hi Le, You cannot use this code in the plugin : + ItemInfo info = ItemInfo::fromUrl(url); + + DIO::del(info, true); ItemInfo and DIO can only used from digiKam as they depends of database. The plugin is also avaialble in Showfoto, and there is no database... The solution is to use the host interface for plugins: The abstract parent class: https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/dplugins/iface/dinfointerface.h The re-implementation for Showfoto using file metadata instead database : https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/dplugins/iface/dmetainfoiface.h The re-implementation for digiKam using the database : https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/database/utils/ifaces/dbinfoiface.h The interface instance is always available in all plugin and must be used to play with items. Of course there is no method in interface to move item to trash. New one must be implemented. In the digiKam version, DIO and ItemInfo must be used. In the Showfoto version, just delete the item like it do here : https://invent.kde.org/graphics/digikam/-/blob/master/core/showfoto/main/showfoto.cpp#L802 Gilles Caulier
Created attachment 137716 [details] move image to trash (digiKam)/ delete image (not digikam) Hi Gilles, This patch solve the problem that you mentioned. The DIO is used to move image to trash if the application is digiKam, if not, image file will be deleted by DMetaInfoIface
Hi Le, Unfortunately, the new patch do not the problem. The plugin still depend of digiKam database with DIO/DItemInfo class. You cannot use these classes in the plugin which is also available in Showfoto and it do not have the database, as explained in comment #4. In other word, the plugin must depend on digiKam core shared lib at linking time, not digiKam database shared lib. To wrap around this problem, DMetaInfoIface (showfoto) and DBInfoIface (digiKam) interface have been created and based on DInfoInterface abstract class. A DInfoInterface instance is always available in the plugin instance and must be used to preform the item operation. Depending of the host application running the plugin, DInfoInterface instance == DMetaInfoIface | DBInfoIface. From your patch, your customized digiKam code must be moved on a re-implemented method to DBInfoIface, and your Showfoto code must be moved on a re-implemented method from DMetaInfoIface. Calling the generic method from the plugin DInfoInterface instance at run time will delegate on the right host method re-implemented. This is a use case of abstract class with interface signatures in oriented programming language : https://en.wikipedia.org/wiki/Class_(computer_programming)#Abstract_and_concrete Best Gilles
In the file delete function for Showfoto, if Qt-5.15 is available, we should use the new function QFile::moveToTrash() instead of deleting. This new feature in Qt-5.15 moves the file to the System Trash. Maik
Created attachment 137771 [details] generic func deleteImage() in DInfoInterface Hi, Update for previous pack: + deleteImage() virtual in DInfoInterface, using DIO in DBInfoIface, and QFile::remove() in DMetaInfoIface + condition for version of Qt >= 5.15, using QFile::moveToTrash() Is it better now ? Best
More correct, but you must not call DBInfoIface or DMetaInfoIface directly in the SlideShow plugin. The DInfoInterface is overloaded with the respective interface. The SlideShow plugin must not be dependent on digikamgui either. Maik
Created attachment 137792 [details] remove dependency of digikamgui from plugin Hi, The plugin is now independent to digikamgui. I misunderstood this in the first place. Best
I can't test it until tonight, but the patch looks good now. Maik
Git commit c797b69c8741ce966f52daa954d01f78ab689ba9 by Maik Qualmann. Committed on 24/04/2021 at 19:28. Pushed by mqualmann into branch 'master'. apply patch #137792 from Phuoc Khanh LE to move image to trash in the slideshow FIXED-IN: 7.3.0 M +2 -2 NEWS M +13 -0 core/dplugins/generic/view/slideshow/common/slideshowloader.cpp M +1 -0 core/dplugins/generic/view/slideshow/common/slideshowloader.h M +3 -0 core/dplugins/generic/view/slideshow/widgets/slideosd.cpp M +38 -0 core/dplugins/generic/view/slideshow/widgets/slidetoolbar.cpp M +2 -0 core/dplugins/generic/view/slideshow/widgets/slidetoolbar.h M +7 -0 core/libs/database/utils/ifaces/dbinfoiface.cpp M +2 -0 core/libs/database/utils/ifaces/dbinfoiface.h M +5 -0 core/libs/dplugins/iface/dinfointerface.cpp M +5 -0 core/libs/dplugins/iface/dinfointerface.h M +14 -0 core/libs/dplugins/iface/dmetainfoiface.cpp M +3 -0 core/libs/dplugins/iface/dmetainfoiface.h M +22 -0 core/showfoto/main/showfoto.cpp M +2 -0 core/showfoto/main/showfoto.h https://invent.kde.org/graphics/digikam/commit/c797b69c8741ce966f52daa954d01f78ab689ba9
Hi Le, I tested your patch reviewed by Maik and it work perfectly with the Slideshow plugin. Can this patch can be adapted quickly to the Presentation plugin ? This will add the benefit to have the same feature in both View tools... Thank in advance Gilles
Created attachment 138055 [details] Move image to trash in presentation Hi, This patch add same feature of removing image to trash in presentation.
Git commit 476caf2a9fdc504007569b5483cb6c354f6d5c22 by Gilles Caulier. Committed on 02/05/2021 at 04:03. Pushed by cgilles into branch 'master'. Apply patch #426859 from Phuoc Khanh Le about to add new option to move items to the trash, as SlideShow tool. M +1 -1 NEWS M +0 -1 core/dplugins/generic/view/presentation/TODO M +2 -1 core/dplugins/generic/view/presentation/audio/presentationaudiowidget.h M +2 -1 core/dplugins/generic/view/presentation/dialogs/presentation_captionpage.h M +14 -9 core/dplugins/generic/view/presentation/dialogs/presentation_mainpage.cpp M +4 -2 core/dplugins/generic/view/presentation/dialogs/presentation_mainpage.h M +10 -3 core/dplugins/generic/view/presentation/opengl/kbeffect.cpp M +4 -5 core/dplugins/generic/view/presentation/opengl/presentationgl.cpp M +1 -1 core/dplugins/generic/view/presentation/opengl/presentationgl.h M +0 -1 core/dplugins/generic/view/presentation/opengl/presentationkb.cpp M +2 -0 core/dplugins/generic/view/presentation/opengl/presentationkb_p.h M +8 -2 core/dplugins/generic/view/presentation/presentationmngr.cpp M +38 -1 core/dplugins/generic/view/presentation/widgets/presentationctrlwidget.cpp M +2 -0 core/dplugins/generic/view/presentation/widgets/presentationctrlwidget.h M +7 -0 core/dplugins/generic/view/presentation/widgets/presentationctrlwidget.ui M +29 -1 core/dplugins/generic/view/presentation/widgets/presentationwidget.cpp M +1 -0 core/dplugins/generic/view/presentation/widgets/presentationwidget.h https://invent.kde.org/graphics/digikam/commit/476caf2a9fdc504007569b5483cb6c354f6d5c22