r19418 by fschmid - FileLoader:: parse filenames with more than one "." inside correctly.

scribus-commit scribus-commit at lists.scribus.net
Mon Aug 11 17:36:14 UTC 2014


Author: fschmid
Date: Mon Aug 11 17:36:14 2014
New Revision: 19418

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19418
Log:
FileLoader:: parse filenames with more than one "." inside correctly.

Modified:
    trunk/Scribus/scribus/fileloader.cpp

Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19418&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp (original)
+++ trunk/Scribus/scribus/fileloader.cpp Mon Aug 11 17:36:14 2014
@@ -118,12 +118,12 @@
 		ret = -1;
 	QString ext = fi.completeSuffix().toLower();
 
+	bool found = false;
 	QList<FileFormat> fileFormats(LoadSavePlugin::supportedFormats());
 	QList<FileFormat>::const_iterator it(fileFormats.constBegin());
 	QList<FileFormat>::const_iterator itEnd(fileFormats.constEnd());
 	for ( ; it != itEnd ; ++it )
 	{
-		bool found = false;
 		for (int a = 0; a < it->fileExtensions.count(); a++)
 		{
 			QString exts = it->fileExtensions[a].toLower();
@@ -142,6 +142,35 @@
 		}
 		if (found)
 			break;
+	}
+	if (!found)
+	{
+	// now try for the last suffix
+		ext = fi.suffix().toLower();
+		it = fileFormats.constBegin();
+		itEnd = fileFormats.constEnd();
+		for ( ; it != itEnd ; ++it )
+		{
+			bool found = false;
+			for (int a = 0; a < it->fileExtensions.count(); a++)
+			{
+				QString exts = it->fileExtensions[a].toLower();
+				if (ext == exts)
+				{
+					if (it->plug != 0)
+					{
+						if (it->plug->fileSupported(0, m_fileName))
+						{
+							ret = it->formatId;
+							found = true;
+							break;
+						}
+					}
+				}
+			}
+			if (found)
+				break;
+		}
 	}
 	m_fileType = ret;
 	return ret;




More information about the scribus-commit mailing list