extragear/graphics/digikam/showfoto

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

extragear/graphics/digikam/showfoto

Gilles Caulier
SVN commit 492733 by cgilles:

digikam from trunk : Showfoto BUGFIX in SaveAs method : when an user set an image file name with an extension without using mime type combo list from save as dialog, we need to check this file name extension before to perform image saving, else image editor will failed.

Tom, we need to backport this fix on stable branch please...

CCMAIL: [hidden email]


 M  +16 -0     showfoto.cpp  


--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #492732:492733
@@ -35,6 +35,7 @@
 #include <qpopupmenu.h>
 #include <qcursor.h>
 #include <qtimer.h>
+#include <qfileinfo.h>
 
 // KDE includes.
 
@@ -709,8 +710,23 @@
     }
 
     KURL saveAsURL = saveDialog.selectedURL();
+
+    // Check if target image format have been selected from Combo List of SaveAs dialog.
     QString format = KImageIO::typeForMime(saveDialog.currentMimeFilter());
 
+    if (format.isEmpty())
+    {
+        // Else, check if target image format have been add to target image file name using extension.
+        QFileInfo fi(saveAsURL.path());
+        format = fi.extension(false);
+
+        if (format.isEmpty())
+        {
+            // Else, the format is empty then file format is same as that of the original file.
+            format = QImageIO::imageFormat(url.path());
+        }
+    }
+
     if (!saveAsURL.isValid())
     {
         KMessageBox::error(this, i18n("Invalid target selected"));
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel