[Digikam-devel] [Bug 131407] use camera GUI also for import of images from different locations

Gilles Caulier caulier.gilles at gmail.com
Thu Aug 30 09:26:09 BST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=131407         




------- Additional Comments From caulier.gilles gmail com  2007-08-30 10:26 -------
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);



More information about the Digikam-devel mailing list