Bug 144431

Summary: Add option in Camera Download Dialog
Product: [Applications] digikam Reporter: Dotan Cohen <kde-2011.08>
Component: Import-SettingsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: alexiadeath, caulier.gilles, lure
Priority: NOR    
Version: 0.9.1   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.3
Sentry Crash Report:

Description Dotan Cohen 2007-04-19 21:24:44 UTC
Version:           0.9.1 (using KDE KDE 3.5.6)
Installed from:    Fedora RPMs
OS:                Linux

I often (always) download all the photos on the camera, then erase them all from the camera, then close the dialog. I assume that is a common procedure, so I propose a button that simply does all that. It should obey the settings that were set, such as file rename and album creation.
Comment 1 caulier.gilles 2007-04-20 06:23:01 UTC
*** Bug 137356 has been marked as a duplicate of this bug. ***
Comment 2 caulier.gilles 2007-08-26 22:31:02 UTC
SVN commit 704994 by cgilles:

digiKam from KDE3 branch : Camera Gui improvements : New options to Download pictures and Delete it from camera at the same time. 
2 options have been added : "Download/Delete Selected" and "Download/Delete All".
CCBUGS: 144431


 M  +8 -3      cameraiconview.cpp  
 M  +1 -0      cameraiconview.h  
 M  +41 -6     cameraui.cpp  
 M  +3 -1      cameraui.h  


--- branches/extragear/kde3/graphics/digikam/utilities/cameragui/cameraiconview.cpp #704993:704994
@@ -40,7 +40,6 @@
 
 // KDE includes.
 
-#include <kpopupmenu.h>
 #include <kurldrag.h>
 #include <kmimetype.h>
 #include <klocale.h>
@@ -56,6 +55,7 @@
 #include "gpiteminfo.h"
 #include "renamecustomizer.h"
 #include "icongroupitem.h"
+#include "dpopupmenu.h"
 #include "cameraui.h"
 #include "cameradragobject.h"
 #include "cameraiconitem.h"
@@ -428,11 +428,11 @@
 
     CameraIconViewItem* camItem = static_cast<CameraIconViewItem*>(item);
     
-    KPopupMenu menu(this);
-    menu.insertTitle(SmallIcon("digikam"), d->cameraUI->cameraTitle());
+    DPopupMenu menu(this);
     menu.insertItem(SmallIcon("editimage"), i18n("&View"), 0);
     menu.insertSeparator(-1);
     menu.insertItem(SmallIcon("down"),i18n("Download"), 1);
+    menu.insertItem(SmallIcon("down"),i18n("Download && Delete"), 4);
     menu.insertItem(SmallIcon("encrypted"), i18n("Toggle lock"), 3);
     menu.insertSeparator(-1);
     menu.insertItem(SmallIcon("editdelete"), i18n("Delete"), 2);
@@ -461,6 +461,11 @@
             emit signalToggleLock();
             break;
         }
+        case(4):
+        {
+            emit signalDownloadAndDelete();
+            break;
+        }
         default:
             break;
     }
--- branches/extragear/kde3/graphics/digikam/utilities/cameragui/cameraiconview.h #704993:704994
@@ -92,6 +92,7 @@
 
     void signalUpload(const KURL::List&);
     void signalDownload();
+    void signalDownloadAndDelete();
     void signalDelete();
     void signalToggleLock();
     void signalNewSelection(bool);
--- branches/extragear/kde3/graphics/digikam/utilities/cameragui/cameraui.cpp #704993:704994
@@ -418,11 +418,20 @@
     // -------------------------------------------------------------------------
 
     d->downloadMenu = new QPopupMenu(this);
-    d->downloadMenu->insertItem(i18n("Download Selected"), this, SLOT(slotDownloadSelected()), 0, 0);
-    d->downloadMenu->insertItem(i18n("Download All"),      this, SLOT(slotDownloadAll()), 0, 1);
+    d->downloadMenu->insertItem(i18n("Download Selected"), 
+                                this, SLOT(slotDownloadSelected()), 0, 0);
+    d->downloadMenu->insertItem(i18n("Download All"),      
+                                this, SLOT(slotDownloadAll()), 0, 1);
     d->downloadMenu->insertSeparator();
-    d->downloadMenu->insertItem(i18n("Upload..."),         this, SLOT(slotUpload()), 0, 2);
+    d->downloadMenu->insertItem(i18n("Download/Delete Selected"), 
+                                this, SLOT(slotDownloadAndDeleteSelected()), 0, 2);
+    d->downloadMenu->insertItem(i18n("Download/Delete All"),      
+                                this, SLOT(slotDownloadAll()), 0, 3);
+    d->downloadMenu->insertSeparator();
+    d->downloadMenu->insertItem(i18n("Upload..."),         
+                                this, SLOT(slotUpload()), 0, 4);
     d->downloadMenu->setItemEnabled(0, false);
+    d->downloadMenu->setItemEnabled(2, false);
     actionButton(User2)->setPopup(d->downloadMenu);
 
     // -------------------------------------------------------------------------
@@ -478,6 +487,9 @@
     connect(d->view, SIGNAL(signalDownload()),
             this, SLOT(slotDownloadSelected()));
 
+    connect(d->view, SIGNAL(signalDownloadAndDelete()),
+            this, SLOT(slotDownloadAndDeleteSelected()));
+
     connect(d->view, SIGNAL(signalDelete()),
             this, SLOT(slotDeleteSelected()));
 
@@ -1049,16 +1061,26 @@
 
 void CameraUI::slotDownloadSelected()
 {
-    slotDownload(true);
+    slotDownload(true, false);
 }
 
+void CameraUI::slotDownloadAndDeleteSelected()
+{
+    slotDownload(true, true);
+}
+
 void CameraUI::slotDownloadAll()
 {
-    slotDownload(false);
+    slotDownload(false, false);
 }
 
-void CameraUI::slotDownload(bool onlySelected)
+void CameraUI::slotDownloadAndDeleteAll()
 {
+    slotDownload(false, true);
+}
+
+void CameraUI::slotDownload(bool onlySelected, bool deleteAfter)
+{
     // -- Get the destination album from digiKam library ---------------
 
     AlbumManager* man = AlbumManager::instance();
@@ -1231,6 +1253,14 @@
     // disable settings tab here instead of slotBusy:
     // Only needs to be disabled while downloading
     d->advBox->setEnabled(false);
+
+    if (deleteAfter)
+    {
+        if (onlySelected)
+            slotDeleteSelected();
+        else
+            slotDeleteAll();
+    }
 }
 
 void CameraUI::slotDownloaded(const QString& folder, const QString& file, int status)
@@ -1514,6 +1544,8 @@
         // So do not allow Download All if there is a selection!
         d->downloadMenu->setItemEnabled(0, hasSelection);
         d->downloadMenu->setItemEnabled(1, !hasSelection);
+        d->downloadMenu->setItemEnabled(2, hasSelection);
+        d->downloadMenu->setItemEnabled(3, !hasSelection);
     }
     else
     {
@@ -1522,12 +1554,15 @@
         // This is the easiest default for new users
         d->downloadMenu->setItemEnabled(0, hasSelection);
         d->downloadMenu->setItemEnabled(1, true);
+        d->downloadMenu->setItemEnabled(2, hasSelection);
+        d->downloadMenu->setItemEnabled(3, true);
     }
 }
 
 void CameraUI::slotItemsSelected(CameraIconViewItem* item, bool selected)
 {
     d->downloadMenu->setItemEnabled(0, selected);
+    d->downloadMenu->setItemEnabled(2, selected);
     d->deleteMenu->setItemEnabled(0, selected);
 
     if (selected)
--- branches/extragear/kde3/graphics/digikam/utilities/cameragui/cameraui.h #704993:704994
@@ -109,9 +109,11 @@
     void slotUploadItems(const KURL::List&);
     void slotDownloadSelected();
     void slotDownloadAll();
-    void slotDownload(bool onlySelected);
+    void slotDownload(bool onlySelected, bool deleteAfter);
     void slotDeleteSelected();
+    void slotDownloadAndDeleteSelected();
     void slotDeleteAll();
+    void slotDownloadAndDeleteAll();
     void slotToggleLock();
 
     void slotFileView(CameraIconViewItem* item);
Comment 3 caulier.gilles 2007-08-27 05:43:36 UTC
SVN commit 705060 by cgilles:

digiKam from trunk (KDE4) : Camera Gui improvements : New options to Download pictures and Delete it from camera at the same time.
2 options have been added : "Download/Delete Selected" and "Download/Delete All".
BUG: 144431


 M  +7 -3      cameraiconview.cpp  
 M  +1 -0      cameraiconview.h  
 M  +80 -44    cameraui.cpp  
 M  +3 -1      cameraui.h  


--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraiconview.cpp #705059:705060
@@ -43,7 +43,6 @@
 // KDE includes.
 
 #include <k3urldrag.h>
-#include <kmenu.h>
 #include <kmimetype.h>
 #include <klocale.h>
 #include <kiconloader.h>
@@ -58,6 +57,7 @@
 #include "gpiteminfo.h"
 #include "renamecustomizer.h"
 #include "icongroupitem.h"
+#include "dpopupmenu.h"
 #include "cameraui.h"
 #include "cameradragobject.h"
 #include "cameraiconitem.h"
@@ -433,11 +433,11 @@
 
     CameraIconViewItem* camItem = static_cast<CameraIconViewItem*>(item);
 
-    KMenu menu(this);
-    menu.addTitle(SmallIcon("digikam"), d->cameraUI->cameraTitle());
+    DPopupMenu menu(this);
     QAction *viewAction      = menu.addAction(SmallIcon("editimage"), i18n("&View"));
     menu.addSeparator();
     QAction *downAction      = menu.addAction(SmallIcon("down"),i18n("Download"));
+    QAction *downDelAction   = menu.addAction(SmallIcon("down"),i18n("Download && Delete"));
     QAction *encryptedAction = menu.addAction(SmallIcon("encrypted"), i18n("Toggle lock"));
     menu.addSeparator();
     QAction *deleteAction    = menu.addAction(SmallIcon("edit-delete"), i18n("Delete"));
@@ -462,6 +462,10 @@
         {
             emit signalToggleLock();
         }
+        else if (choice == downDelAction)
+        {
+            emit signalDownloadAndDelete();
+        }
     }
 }
 
--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraiconview.h #705059:705060
@@ -93,6 +93,7 @@
 
     void signalUpload(const KUrl::List&);
     void signalDownload();
+    void signalDownloadAndDelete();
     void signalDelete();
     void signalToggleLock();
     void signalNewSelection(bool);
--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraui.cpp #705059:705060
@@ -134,41 +134,43 @@
 
     CameraUIPriv()
     {
-        busy               = false;
-        closed             = false;
-        helpMenu           = 0;
-        advBox             = 0;
-        downloadMenu       = 0;
-        deleteMenu         = 0;
-        imageMenu          = 0;
-        cancelBtn          = 0;
-        splitter           = 0;
-        rightSidebar       = 0;
-        fixDateTimeCheck   = 0;
-        autoRotateCheck    = 0;
-        autoAlbumDateCheck = 0;
-        autoAlbumExtCheck  = 0;
-        status             = 0;
-        progress           = 0;
-        controller         = 0;
-        view               = 0;
-        renameCustomizer   = 0;
-        anim               = 0;
-        dateTimeEdit       = 0;
-        setPhotographerId  = 0;
-        setCredits         = 0;
-        losslessFormat     = 0;
-        convertJpegCheck   = 0;
-        formatLabel        = 0;
-        folderDateLabel    = 0;
-        folderDateFormat   = 0;
-        increaseThumbsAction   = 0;
-        decreaseThumbsAction   = 0;
-        downloadSelectedAction = 0;
-        downloadAllAction      = 0;
-        deleteSelectedAction   = 0;
-        deleteAllAction        = 0;
-        cameraInfoAction       = 0;
+        busy                      = false;
+        closed                    = false;
+        helpMenu                  = 0;
+        advBox                    = 0;
+        downloadMenu              = 0;
+        deleteMenu                = 0;
+        imageMenu                 = 0;
+        cancelBtn                 = 0;
+        splitter                  = 0;
+        rightSidebar              = 0;
+        fixDateTimeCheck          = 0;
+        autoRotateCheck           = 0;
+        autoAlbumDateCheck        = 0;
+        autoAlbumExtCheck         = 0;
+        status                    = 0;
+        progress                  = 0;
+        controller                = 0;
+        view                      = 0;
+        renameCustomizer          = 0;
+        anim                      = 0;
+        dateTimeEdit              = 0;
+        setPhotographerId         = 0;
+        setCredits                = 0;
+        losslessFormat            = 0;
+        convertJpegCheck          = 0;
+        formatLabel               = 0;
+        folderDateLabel           = 0;
+        folderDateFormat          = 0;
+        increaseThumbsAction      = 0;
+        decreaseThumbsAction      = 0;
+        downloadSelectedAction    = 0;
+        downloadDelSelectedAction = 0;
+        downloadAllAction         = 0;
+        downloadDelAllAction      = 0;
+        deleteSelectedAction      = 0;
+        deleteAllAction           = 0;
+        cameraInfoAction          = 0;
     }
 
     bool                          busy;
@@ -187,7 +189,9 @@
     QAction                      *increaseThumbsAction;
     QAction                      *decreaseThumbsAction;
     QAction                      *downloadSelectedAction;
+    QAction                      *downloadDelSelectedAction;
     QAction                      *downloadAllAction;
+    QAction                      *downloadDelAllAction;
     QAction                      *deleteSelectedAction;
     QAction                      *deleteAllAction;
     QAction                      *cameraInfoAction;
@@ -449,14 +453,20 @@
 
     // -------------------------------------------------------------------------
 
-    d->downloadMenu = new QMenu(this);
-    d->downloadSelectedAction =
-        d->downloadMenu->addAction(i18n("Download Selected"), this, SLOT(slotDownloadSelected()));
-    d->downloadAllAction =
-        d->downloadMenu->addAction(i18n("Download All"),      this, SLOT(slotDownloadAll()));
+    d->downloadMenu              = new QMenu(this);
+    d->downloadSelectedAction    = d->downloadMenu->addAction(i18n("Download Selected"), 
+                                                              this, SLOT(slotDownloadSelected()));
+    d->downloadAllAction         = d->downloadMenu->addAction(i18n("Download All"),
+                                                              this, SLOT(slotDownloadAll()));
     d->downloadMenu->addSeparator();
-    d->downloadMenu->addAction(i18n("Upload..."),         this, SLOT(slotUpload()));
+    d->downloadDelSelectedAction = d->downloadMenu->addAction(i18n("Download/Delete Selected"),
+                                                              this, SLOT(slotDownloadAndDeleteSelected()));
+    d->downloadDelAllAction      = d->downloadMenu->addAction(i18n("Download/Delete All"),
+                                                              this, SLOT(slotDownloadAll()));
+    d->downloadMenu->addSeparator();
+    d->downloadMenu->addAction(i18n("Upload..."),             this, SLOT(slotUpload()));
     d->downloadSelectedAction->setEnabled(false);
+    d->downloadDelSelectedAction->setEnabled(false);
     button(User2)->setMenu(d->downloadMenu);
 
     // -------------------------------------------------------------------------
@@ -511,6 +521,9 @@
     connect(d->view, SIGNAL(signalDownload()),
             this, SLOT(slotDownloadSelected()));
 
+    connect(d->view, SIGNAL(signalDownloadAndDelete()),
+            this, SLOT(slotDownloadAndDeleteSelected()));
+
     connect(d->view, SIGNAL(signalDelete()),
             this, SLOT(slotDeleteSelected()));
 
@@ -1082,16 +1095,26 @@
 
 void CameraUI::slotDownloadSelected()
 {
-    slotDownload(true);
+    slotDownload(true, false);
 }
 
+void CameraUI::slotDownloadAndDeleteSelected()
+{
+    slotDownload(true, true);
+}
+
 void CameraUI::slotDownloadAll()
 {
-    slotDownload(false);
+    slotDownload(false, false);
 }
 
-void CameraUI::slotDownload(bool onlySelected)
+void CameraUI::slotDownloadAndDeleteAll()
 {
+    slotDownload(false, true);
+}
+
+void CameraUI::slotDownload(bool onlySelected, bool deleteAfter)
+{
     // -- Get the destination album from digiKam library ---------------
 
     AlbumManager* man = AlbumManager::componentData();
@@ -1264,6 +1287,14 @@
     // disable settings tab here instead of slotBusy:
     // Only needs to be disabled while downloading
     d->advBox->setEnabled(false);
+
+    if (deleteAfter)
+    {
+        if (onlySelected)
+            slotDeleteSelected();
+        else
+            slotDeleteAll();
+    }
 }
 
 void CameraUI::slotDownloaded(const QString& folder, const QString& file, int status)
@@ -1548,6 +1579,8 @@
         // So do not allow Download All if there is a selection!
         d->downloadSelectedAction->setEnabled(hasSelection);
         d->downloadAllAction->setEnabled(!hasSelection);
+        d->downloadDelSelectedAction->setEnabled(hasSelection);
+        d->downloadDelAllAction->setEnabled(!hasSelection);
     }
     else
     {
@@ -1556,12 +1589,15 @@
         // This is the easiest default for new users
         d->downloadSelectedAction->setEnabled(hasSelection);
         d->downloadAllAction->setEnabled(true);
+        d->downloadDelSelectedAction->setEnabled(hasSelection);
+        d->downloadDelAllAction->setEnabled(true);
     }
 }
 
 void CameraUI::slotItemsSelected(CameraIconViewItem* item, bool selected)
 {
     d->downloadSelectedAction->setEnabled(selected);
+    d->downloadDelSelectedAction->setEnabled(selected);
     d->deleteSelectedAction->setEnabled(selected);
 
     if (selected)
--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraui.h #705059:705060
@@ -112,8 +112,10 @@
     void slotUploadItems(const KUrl::List&);
     void slotDownloadSelected();
     void slotDownloadAll();
-    void slotDownload(bool onlySelected);
+    void slotDownloadAndDeleteAll();
+    void slotDownload(bool onlySelected, bool deleteAfter);
     void slotDeleteSelected();
+    void slotDownloadAndDeleteSelected();
     void slotDeleteAll();
     void slotToggleLock();