Bug 131407 - use camera GUI also for import of images from different locations
Summary: use camera GUI also for import of images from different locations
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Import-MainView (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-26 18:08 UTC by Mikolaj Machowski
Modified: 2012-08-31 12:47 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikolaj Machowski 2006-07-26 18:09:07 UTC
Version:           0.9-svn (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

Usa camera GUI for importing of images also from other locations

Camera GUI offers many nice possibilities to adjust photos, rename, etc. But you can use it only when importing photos from Camera. This is not always the case. People can import images also from: CDs burned during vacations when camera cards were full; memory banks; USB sticks; etc. etc. And these are only images which could be made by digital camera. There are many other sources of images which could be saved somewhere.
Comment 1 caulier.gilles 2006-07-27 13:57:48 UTC
I'm agree with you, this will require to make a common implementation between a future Import tool and current camera gui, like we have do between showfoto and image editor.

Gilles
Comment 2 Robert Small 2006-09-10 20:04:46 UTC
Agreed! This really annoyed me when importing my old photos, I ended up sticking them all on an old hard drive and pretending it was a camera.
Comment 3 Mikolaj Machowski 2007-08-12 23:00:25 UTC
*** Bug 124864 has been marked as a duplicate of this bug. ***
Comment 4 Mikolaj Machowski 2007-08-22 11:48:00 UTC
*** Bug 145096 has been marked as a duplicate of this bug. ***
Comment 5 caulier.gilles 2007-08-22 18:40:14 UTC
Marcel,

Current Camera gui dialog is full of options. it's really difficult to add new one...

To be able to add new options in Camera Gui, and to make an interface more universal to import files in digiKam database, i would to use KMainWindow instead KDialogBase.

Like this, the interface will provide menu, toolbar, and statusbar like image editor and lighttable. What do you think about ?

Gilles
Comment 6 caulier.gilles 2007-08-30 10:26:07 UTC
SVN commit 706390 by cgilles:

digiKam from trunk (KDE4) : Use camera gui to import new images in digiKam album library.
The current menu option which use it is "Album/Import/Add Images".
CCBUGS: 131407


 M  +15 -1     digikamapp.cpp  
 M  +1 -0      digikamapp.h  
 M  +0 -50     digikamview.cpp  
 M  +0 -2      digikamview.h  


--- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #706389:706390
@@ -38,6 +38,7 @@
 #include <kactioncollection.h>
 #include <kaboutdata.h>
 #include <klocale.h>
+#include <kglobalsettings.h>
 #include <kstandarddirs.h>
 #include <kurl.h>
 #include <kstandardaction.h>
@@ -58,6 +59,7 @@
 #include <ktoolbarpopupaction.h>
 #include <ktogglefullscreenaction.h>
 #include <ktoolbar.h>
+#include <kfiledialog.h>
 #include <solid/device.h>
 #include <solid/deviceinterface.h>
 #include <solid/devicenotifier.h>
@@ -546,7 +548,7 @@
     d->addImagesAction = new KAction(KIcon("albumfolder-importimages"), i18n("Add Images..."), this);
     d->addImagesAction->setShortcut(Qt::CTRL+Qt::Key_I);
     d->addImagesAction->setWhatsThis(i18n("Adds new items to the current Album."));
-    connect(d->addImagesAction, SIGNAL(triggered()), d->view, SLOT(slotAlbumAddImages()));
+    connect(d->addImagesAction, SIGNAL(triggered()), this, SLOT(slotAlbumAddImages()));
     actionCollection()->addAction("album_addImages", d->addImagesAction);
 
     // -----------------------------------------------------------------
@@ -1916,4 +1918,16 @@
     d->zoomFitToWindowAction->setEnabled(t);
 }
 
+void DigikamApp::slotAlbumAddImages()
+{
+    QString path = KFileDialog::getExistingDirectory(KGlobalSettings::documentPath(), this, 
+                                i18n("Select folder to parse"));
+  
+    if(path.isEmpty())
+        return;
+
+    // The folder contents will be parsed by Camera interface in "Directory Browse" mode.
+    downloadFrom(path);
+}
+
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/digikam/digikamapp.h #706389:706390
@@ -108,6 +108,7 @@
 
 private slots:
 
+    void slotAlbumAddImages();
     void slotAlbumSelected(bool val);
     void slotTagSelected(bool val);
     void slotImageSelected(const ImageInfoList&, bool, bool);
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #706389:706390
@@ -898,56 +898,6 @@
     applySettings(AlbumSettings::componentData());
 }
 
-void DigikamView::slotAlbumAddImages()
-{
-    Album *album = d->albumManager->currentAlbum();
-    if (!album || album->type() != Album::PHYSICAL)
-        return;
-
-    PAlbum* palbum = dynamic_cast<PAlbum*>(album);
-
-    QString fileformats;
-    
-    QStringList patternList = KImageIO::pattern(KImageIO::Reading).split('\n', QString::SkipEmptyParts);
-    
-    // All Pictures from list must been always the first entry given by KDE API
-    QString allPictures = patternList[0];
-    
-    // Add other files format witch are missing to All Pictures" type mime provided by KDE and remplace current.
-    allPictures.insert(allPictures.indexOf("|"), QString(raw_file_extentions) + QString(" *.JPE *.TIF"));
-    patternList.removeAll(patternList[0]);
-    patternList.prepend(allPictures);
-    
-    // Added RAW file formats supported by dcraw program like a type mime. 
-    // Nota: we cannot use here "image/x-raw" type mime from KDE because it uncomplete 
-    // or unavailable(dcraw_0)(see file #121242 in B.K.O).
-    patternList.append(QString("\n%1|Camera RAW files").arg(QString(raw_file_extentions)));
-    
-    fileformats = patternList.join("\n");
-
-    DDebug () << "fileformats=" << fileformats << endl;   
-
-    KUrl::List urls = KFileDialog::getOpenUrls(CollectionManager::instance()->oneAlbumRootPath(),
-                                               fileformats, this, i18n("Select Image to Add"));
-
-    if (!urls.isEmpty())
-    {
-        KIO::Job* job = DIO::copy(urls, palbum->kurl());
-
-        connect(job, SIGNAL(result(KIO::Job *) ),
-                this, SLOT(slotImageCopyResult(KIO::Job *)));
-    }
-}
-
-void DigikamView::slotImageCopyResult(KIO::Job* job)
-{
-    if (job->error())
-    {
-        job->ui()->setWindow(this);
-        job->ui()->showErrorMessage();
-    }
-}
-
 void DigikamView::slotAlbumImportFolder()
 {
     d->folderView->albumImportFolder();
--- trunk/extragear/graphics/digikam/digikam/digikamview.h #706389:706390
@@ -99,7 +99,6 @@
     void slotDeleteAlbum();
     void slotSelectAlbum(const KUrl &url);
     void slotAlbumPropsEdit();
-    void slotAlbumAddImages();
     void slotAlbumOpenInKonqui();
     void slotAlbumRefresh();
     void slotAlbumImportFolder();
@@ -167,7 +166,6 @@
     void slotImageSelected();
     void slotTogglePreviewMode(AlbumIconItem *iconItem=0);
     void slotDispatchImageSelected();
-    void slotImageCopyResult(KIO::Job* job);
     void slotItemsInfoFromAlbums(const ImageInfoList&);
 
     void slotLeftSidebarChangedTab(QWidget* w);
Comment 7 caulier.gilles 2007-08-30 11:11:27 UTC
SVN commit 706398 by cgilles:

digiKam from KDE3 branch : Use camera gui to import new images in digiKam album library.
The current menu option which use it is "Album/Import/Add Images".
BUG: 131407


 M  +15 -2     digikamapp.cpp  
 M  +1 -0      digikamapp.h  
 M  +0 -49     digikamview.cpp  
 M  +0 -7      digikamview.h  


--- branches/extragear/kde3/graphics/digikam/digikam/digikamapp.cpp #706397:706398
@@ -48,6 +48,8 @@
 #include <kdeversion.h>
 #include <kapplication.h>
 #include <kmenubar.h>
+#include <kglobalsettings.h>
+#include <kfiledialog.h>
 #include <kmessagebox.h>
 #include <kwin.h>
 #include <dcopref.h>
@@ -541,7 +543,7 @@
     d->addImagesAction = new KAction( i18n("Add Images..."),
                                     "albumfolder-importimages",
                                     CTRL+Key_I,
-                                    d->view,
+                                    this,
                                     SLOT(slotAlbumAddImages()),
                                     actionCollection(),
                                     "album_addImages");
@@ -1886,5 +1888,16 @@
     d->zoomFitToWindowAction->setEnabled(t);
 }
 
+void DigikamApp::slotAlbumAddImages()
+{
+    QString path = KFileDialog::getExistingDirectory(KGlobalSettings::documentPath(), this,
+                                i18n("Select folder to parse"));
+
+    if(path.isEmpty())
+        return;
+
+    // The folder contents will be parsed by Camera interface in "Directory Browse" mode.
+    downloadFrom(path);
+}
+
 }  // namespace Digikam
-
--- branches/extragear/kde3/graphics/digikam/digikam/digikamapp.h #706397:706398
@@ -111,6 +111,7 @@
 
 private slots:
 
+    void slotAlbumAddImages();
     void slotAlbumSelected(bool val);
     void slotTagSelected(bool val);
     void slotImageSelected(const QPtrList<ImageInfo>&, bool, bool);
--- branches/extragear/kde3/graphics/digikam/digikam/digikamview.cpp #706397:706398
@@ -38,7 +38,6 @@
 // KDE includes.
 
 #include <kurl.h>
-#include <kfiledialog.h>
 #include <kpushbutton.h>
 #include <klocale.h>
 #include <kapplication.h>
@@ -46,7 +45,6 @@
 #include <krun.h>
 #include <kiconloader.h>
 #include <kstandarddirs.h>
-#include <kimageio.h>
 
 // LibKDcraw includes.
 
@@ -889,53 +887,6 @@
     applySettings(AlbumSettings::instance());
 }
 
-void DigikamView::slotAlbumAddImages()
-{
-    Album *album = d->albumManager->currentAlbum();
-    if (!album || album->type() != Album::PHYSICAL)
-        return;
-
-    PAlbum* palbum = dynamic_cast<PAlbum*>(album);
-
-    QString fileformats;
-    
-    QStringList patternList = QStringList::split('\n', KImageIO::pattern(KImageIO::Reading));
-    
-    // All Pictures from list must been always the first entry given by KDE API
-    QString allPictures = patternList[0];
-    
-    // Add other files format witch are missing to All Pictures" type mime provided by KDE and remplace current.
-    allPictures.insert(allPictures.find("|"), QString(raw_file_extentions) + QString(" *.JPE *.TIF"));
-    patternList.remove(patternList[0]);
-    patternList.prepend(allPictures);
-    
-    // Added RAW file formats supported by dcraw program like a type mime. 
-    // Nota: we cannot use here "image/x-raw" type mime from KDE because it uncomplete 
-    // or unavailable(dcraw_0)(see file #121242 in B.K.O).
-    patternList.append(QString("\n%1|Camera RAW files").arg(QString(raw_file_extentions)));
-    
-    fileformats = patternList.join("\n");
-
-    DDebug () << "fileformats=" << fileformats << endl;   
-
-    KURL::List urls = KFileDialog::getOpenURLs(AlbumManager::instance()->getLibraryPath(), 
-                                               fileformats, this, i18n("Select Image to Add"));
-
-    if (!urls.isEmpty())
-    {
-        KIO::Job* job = DIO::copy(urls, palbum->kurl());
-
-        connect(job, SIGNAL(result(KIO::Job *) ),
-                this, SLOT(slotImageCopyResult(KIO::Job *)));
-    }
-}
-
-void DigikamView::slotImageCopyResult(KIO::Job* job)
-{
-    if (job->error())
-        job->showErrorDialog(this);
-}
-
 void DigikamView::slotAlbumImportFolder()
 {
     d->folderView->albumImportFolder();
--- branches/extragear/kde3/graphics/digikam/digikam/digikamview.h #706397:706398
@@ -37,11 +37,6 @@
 
 class KURL;
 
-namespace KIO
-{
-class Job;
-}
-
 namespace Digikam
 {
 class AlbumIconItem;
@@ -95,7 +90,6 @@
     void slotDeleteAlbum();
     void slotSelectAlbum(const KURL &url);
     void slotAlbumPropsEdit();
-    void slotAlbumAddImages();
     void slotAlbumOpenInKonqui();
     void slotAlbumRefresh();
     void slotAlbumImportFolder();
@@ -163,7 +157,6 @@
     void slotImageSelected();
     void slotTogglePreviewMode(AlbumIconItem *iconItem=0);
     void slotDispatchImageSelected();
-    void slotImageCopyResult(KIO::Job* job);
     void slotItemsInfoFromAlbums(const ImageInfoList&);
 
     void slotLeftSidebarChangedTab(QWidget* w);
Comment 8 caulier.gilles 2007-08-30 11:30:11 UTC
Mik,

The menu option "Album/Import/Import Folders" still unchanged. This option import folder as well without parse content. 

Gilles
Comment 9 Mikolaj Machowski 2007-08-30 21:07:14 UTC
Works perfectly (tested in KDE3 branch). Many thanks :)

BTW - why we need Import Folders option?
Comment 10 caulier.gilles 2007-08-30 21:10:20 UTC
Mik,

To import folders as well, without parsing content to select the right images... This have been added in the past following a whish from an user.

Gilles