[Digikam-devel] extragear/libs/kipi-plugins/metadataedit

Gilles Caulier caulier.gilles at free.fr
Mon Nov 20 09:22:57 GMT 2006


SVN commit 606387 by cgilles:

kipi-plugins from trunk : MetadataEdit : new option to set Comments to a group of pictures. This tool will set the same comments to all selected pictures from host application. You can sync IPTC/EXIF/JFIF comments at the same time.

A fresh screenshot :
 http://digikam3rdparty.free.fr/Screenshots/KipipluginBatchCommentsEditor.png

CCMAIL: digikam-devel at kde.org, kde-imaging at kde.org

 M  +2 -2      Makefile.am  
 A             commenteditdialog.cpp   [License: GPL]
 A             commenteditdialog.h   [License: GPL]
 M  +20 -11    plugin_metadataedit.cpp  


--- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #606386:606387
@@ -15,8 +15,8 @@
 	                             exiflens.cpp exifdevice.cpp exiflight.cpp \
 	                             iptceditdialog.cpp iptccaption.cpp iptcsubjects.cpp \
 	                             iptccredits.cpp iptcstatus.cpp iptcorigin.cpp \
-	                             iptcdatetime.cpp iptckeywords.cpp iptccategories.cpp 
-	                                 
+	                             iptcdatetime.cpp iptckeywords.cpp iptccategories.cpp \
+				     commenteditdialog.cpp
 
 # Libs needed by the plugin
 kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \
--- trunk/extragear/libs/kipi-plugins/metadataedit/plugin_metadataedit.cpp #606386:606387
@@ -41,6 +41,7 @@
 #include "exiv2iface.h"
 #include "exifeditdialog.h"
 #include "iptceditdialog.h"
+#include "commenteditdialog.h"
 #include "plugin_metadataedit.h"
 #include "plugin_metadataedit.moc"
 
@@ -113,7 +114,7 @@
                                      actionCollection(),
                                      "importiptc"));
 
-/*    m_actionMetadataEdit->popupMenu()->insertSeparator();
+    m_actionMetadataEdit->popupMenu()->insertSeparator();
 
     m_actionMetadataEdit->insert(new KAction (i18n("Edit Comments..."),
                                      0,
@@ -122,7 +123,7 @@
                                      SLOT(slotEditComments()),
                                      actionCollection(),
                                      "editcomments"));
-*/
+
     addAction( m_actionMetadataEdit );
 
     m_interface = dynamic_cast< KIPI::Interface* >( parent() );
@@ -439,13 +440,9 @@
     if ( !images.isValid() || images.images().isEmpty() )
         return;
 
-    // TODO : new Edit Comments dialog here.
+    KIPIMetadataEditPlugin::CommentEditDialog dlg(kapp->activeWindow());
 
-    if (KMessageBox::warningYesNo(
-                     kapp->activeWindow(),
-                     i18n("Comments from current selected pictures will be permanently "
-                          "replaced.\nDo you want to continue ?"),
-                     i18n("Edit Pictures Comments")) != KMessageBox::Yes)
+    if (dlg.exec() != KMessageBox::Ok)
         return;
 
     KURL::List imageURLs = images.images();
@@ -458,13 +455,25 @@
         KURL url = *it;
         bool ret = false;
 
+        KIPI::ImageInfo info = m_interface->info(url);
+        info.setDescription(dlg.getComments());
+
         if (!KIPIPlugins::Exiv2Iface::isReadOnly(url.path()))
         {
             ret = true;
             KIPIPlugins::Exiv2Iface exiv2Iface;
             ret &= exiv2Iface.load(url.path());
-/*            ret &= exiv2Iface.setIptc(iptcData);
-            ret &= exiv2Iface.save(url.path());*/
+
+            if (dlg.syncEXIFCommentIsChecked())
+                ret &= exiv2Iface.setExifComment(dlg.getComments());
+        
+            if (dlg.syncJFIFCommentIsChecked())
+                ret &= exiv2Iface.setComments(dlg.getComments().utf8());
+        
+            if (dlg.syncIPTCCaptionIsChecked())
+                ret &= exiv2Iface.setIptcTagString("Iptc.Application2.Caption", dlg.getComments());
+
+            ret &= exiv2Iface.save(url.path());
         }
         
         if (!ret)
@@ -482,7 +491,7 @@
     {
         KMessageBox::errorList(
                     kapp->activeWindow(),
-                    i18n("Unable to set Comments from:"),
+                    i18n("Unable to set comments like picture metadata from:"),
                     errorURLs.toStringList(),
                     i18n("Edit Pictures Comments"));  
     }



More information about the Digikam-devel mailing list