SVN commit 492902 by cgilles:
digikam from trunk : missing to check in saveAs method if user image file extension is supported by showfoto.
Tom, sorry for this, but we need to backport again this fix on stable branch please (:=)))...
CCMAIL:
[hidden email]
M +27 -4 showfoto.cpp
--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #492901:492902
@@ -714,17 +714,40 @@
// Check if target image format have been selected from Combo List of SaveAs dialog.
QString format = KImageIO::typeForMime(saveDialog.currentMimeFilter());
- if (format.isEmpty())
+ 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())
+
+ if ( format.isEmpty() )
{
- // Else, the format is empty then file format is same as that of the original file.
+ // If format is empty then file format is same as that of the original file.
format = QImageIO::imageFormat(url.path());
}
+ else
+ {
+ // Else, check if format from file name extension is include on file mime type list.
+
+ QString imgExtPattern;
+ QStringList imgExtList = QStringList::split(" ", mimetypes);
+ for (QStringList::ConstIterator it = imgExtList.begin() ; it != imgExtList.end() ; it++)
+ {
+ imgExtPattern.append (KImageIO::typeForMime(*it));
+ imgExtPattern.append (" ");
+ }
+ if ( imgExtPattern.contains("*.TIFF") ) imgExtPattern.append (" *.TIF");
+ if ( imgExtPattern.contains("*.JPEG") ) imgExtPattern.append (" *.JPG");
+
+ if ( !imgExtPattern.contains( format.upper() ) )
+ {
+ KMessageBox::error(this, i18n("Target image file format \"%1\" unsupported!")
+ .arg(format));
+ kdWarning() << k_funcinfo << "target image file format " << format << " unsupported!" << endl;
+ return false;
+ }
+ }
}
if (!saveAsURL.isValid())
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel