[Digikam-devel] [Bug 103255] wish: *add* (not edit) EXIF headers like date, comment etc

Gilles Caulier caulier.gilles at free.fr
Wed Oct 18 08:48:09 BST 2006


------- 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=103255         




------- Additional Comments From caulier.gilles free fr  2006-10-18 09:47 -------
SVN commit 596693 by cgilles:

kipiplugins from trunk : MetadataEdit plugin: capabaility to load EXIF metadata from a specific picture and apply it to a list of pictures

CCMAIL: kde-imaging kde org
CCBUGS: 103255

 M  +47 -3     metadataeditdialog.cpp  


--- trunk/extragear/libs/kipi-plugins/metadataedit/metadataeditdialog.cpp #596692:596693
 @ -357,7 +357,51  @
 
 void MetadataEditDialog::slotLoadExif()
 {
-    // TODO
+    if (!d->listView->currentItem())
+    {
+        KMessageBox::information(this, i18n("Please, select at least one picture from "
+                     "the list to apply EXIF metadata from a specific picture."), i18n("Edit Metadata"));    
+        return;
+    }
+
+    KURL loadEXIFFile = KFileDialog::getOpenURL(KGlobalSettings::documentPath(),
+                                                QString::null, this,
+                                                i18n("Select File to Load EXIF data") );
+    if( loadEXIFFile.isEmpty() )
+       return;
+    
+    KIPIPlugins::Exiv2Iface exiv2Iface;
+    if (!exiv2Iface.load(loadEXIFFile.path()))
+    {
+        KMessageBox::error(this, i18n("Cannot load metadata from \"%1\"!").arg(loadEXIFFile.fileName()), 
+                           i18n("Edit Metadata"));    
+        return;
+    }
+    
+    QByteArray exifData = exiv2Iface.getExif();
+    if (exifData.isEmpty())
+    {
+        KMessageBox::error(this, i18n("\"%1\" do not have EXIF metadata!").arg(loadEXIFFile.fileName()), 
+                           i18n("Edit Metadata"));    
+        return;
+    }        
+
+    EXIFEditDialog dlg(this, exifData, loadEXIFFile.fileName());
+
+    if (dlg.exec() == KDialogBase::Accepted)
+    {
+        QListViewItemIterator it(d->listView);
+
+        while (it.current())
+        {
+            if (it.current()->isSelected())
+            {
+                MetadataItem *selItem = (MetadataItem*)it.current();
+                selItem->setExif(dlg.getEXIFInfo(), true);
+            }
+            ++it;
+        }
+    }
 }
 
 void MetadataEditDialog::slotLoadIptc()
 @ -378,7 +422,7  @
     KIPIPlugins::Exiv2Iface exiv2Iface;
     if (!exiv2Iface.load(loadIPTCFile.path()))
     {
-        KMessageBox::error(this, i18n("Cannot load metadata from %1!").arg(loadIPTCFile.fileName()), 
+        KMessageBox::error(this, i18n("Cannot load metadata from \"%1\"!").arg(loadIPTCFile.fileName()), 
                            i18n("Edit Metadata"));    
         return;
     }
 @ -386,7 +430,7  @
     QByteArray iptcData = exiv2Iface.getIptc();
     if (iptcData.isEmpty())
     {
-        KMessageBox::error(this, i18n("%1 do not have IPTC metadata!").arg(loadIPTCFile.fileName()), 
+        KMessageBox::error(this, i18n("\"%1\" do not have IPTC metadata!").arg(loadIPTCFile.fileName()), 
                            i18n("Edit Metadata"));    
         return;
     }



More information about the Digikam-devel mailing list