Bug 130017

Summary: WISH: batch operation to save existing comments in the files
Product: digikam Reporter: Antonio E. <aironmail>
Component: Tags-CaptionsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles, david, marko, valerio.fuoglio
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.1

Description Antonio E. 2006-06-29 14:57:36 UTC
Version:           0.9-svn (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages

In reference to #109253, digikam can now save the comments in the files (JFIF,EXIF,...), but I think that it only save the new comments that an user make after upgrading to 0.9. So, is there any way to save all existing comments (I suposse that they are saved in the db) to the files? Maybe a batch operation. As the number of pictures can become very large, it would be useful to have something like that.

Thanks.
Comment 1 caulier.gilles 2006-10-22 22:06:13 UTC
*** Bug 136060 has been marked as a duplicate of this bug. ***
Comment 2 caulier.gilles 2007-01-22 21:06:24 UTC
SVN commit 626305 by cgilles:

digikam from trunk : New batch tool to sync all pictures metadata (EXIF/IPTC) with digiKam database contents (comments, tags, rating, date, etc...)

This tool use the new MetadataHub class from Marcel (great implementation!). 
THis tool use the Metadata setup (thrue MetadataHub).
There is a new option in Tools menu named "Sync Pictures Metadata".
Test and feedback are require...

CCBUGS: 127583, 136254, 137503
BUG: 130017



 M  +26 -0     digikam/digikamapp.cpp  
 M  +3 -0      digikam/digikamapp.h  
 M  +1 -0      digikam/digikamui.rc  
 M  +2 -1      utilities/batch/Makefile.am  
 A             utilities/batch/batchsyncmetadata.cpp   [License: GPL]
 A             utilities/batch/batchsyncmetadata.h   [License: GPL]
 A             utilities/batch/imageinfojob.cpp   [License: GPL]
 A             utilities/batch/imageinfojob.h   [License: GPL]


--- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #626304:626305
@@ -88,6 +88,7 @@
 #include "imageattributeswatch.h"
 #include "dcrawbinary.h"
 #include "batchthumbsgenerator.h"
+#include "batchsyncmetadata.h"
 #include "digikamview.h"
 #include "digikamapp.h"
 #include "digikamapp.moc"
@@ -801,6 +802,10 @@
                 this, SLOT(slotRebuildAllThumbs()), actionCollection(),
                 "thumbs_rebuild");
 
+    new KAction(i18n("Sync Pictures metadata..."), "reload_page", 0,
+                this, SLOT(slotSyncPicturesMetadata()), actionCollection(),
+                "sync_metadata");
+
     // -----------------------------------------------------------
 
     // Provides a menu entry that allows showing/hiding the toolbar(s)
@@ -1644,6 +1649,27 @@
     mView->applySettings(mAlbumSettings);
 }
 
+void DigikamApp::slotSyncPicturesMetadata()
+{
+    QString msg = i18n("Sync pictures metadata with digiKam database can take a while.\n"
+                       "Do you want to continue?");
+    int result = KMessageBox::warningContinueCancel(this, msg);
+    if (result != KMessageBox::Continue)
+        return;
+
+    BatchSyncMetadata *syncMetadata = new BatchSyncMetadata(this);
+    
+    connect(syncMetadata, SIGNAL(signalComplete()),
+            this, SLOT(slotSyncPicturesMetadataDone()));
+
+    syncMetadata->exec();
+}
+
+void DigikamApp::slotSyncPicturesMetadataDone()
+{
+    mView->applySettings(mAlbumSettings);
+}
+
 void DigikamApp::slotDonateMoney()
 {
     KApplication::kApplication()->invokeBrowser("http://www.digikam.org/?q=donation");
--- trunk/extragear/graphics/digikam/digikam/digikamapp.h #626304:626305
@@ -160,9 +160,12 @@
     void slotEditKeys();
     void slotConfToolbars();
     void slotToggleFullScreen();
+
     void slotDatabaseRescan();
     void slotRebuildAllThumbs();
     void slotRebuildAllThumbsDone();
+    void slotSyncPicturesMetadata();
+    void slotSyncPicturesMetadataDone();
     
     void slotChangeTheme(const QString& theme);
 
--- trunk/extragear/graphics/digikam/digikam/digikamui.rc #626304:626305
@@ -71,6 +71,7 @@
       <Separator/>
         <Action name="database_rescan" />
         <Action name="thumbs_rebuild" />
+        <Action name="sync_metadata" />
       <Separator/>
         <ActionList name="album_actions"/>
       <Separator/>
--- trunk/extragear/graphics/digikam/utilities/batch/Makefile.am #626304:626305
@@ -3,13 +3,14 @@
 INCLUDES = -I$(top_srcdir)/digikam/digikam \
 	   -I$(top_srcdir)/digikam/libs/dialogs \
 	   -I$(top_srcdir)/digikam/libs/dimg \
+	   -I$(top_srcdir)/digikam/libs/dmetadata \
 	   -I$(top_srcdir)/digikam/libs/thumbbar \
 	   -I$(top_srcdir)/digikam/libs/widgets/common \
 	   $(all_includes)
 
 noinst_LTLIBRARIES = libbatch.la 
 
-libbatch_la_SOURCES = batchthumbsgenerator.cpp 
+libbatch_la_SOURCES = batchthumbsgenerator.cpp batchsyncmetadata.cpp imageinfojob.cpp 
 
 libbatch_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)