Index: scribus/util_formats.cpp
===================================================================
--- scribus/util_formats.cpp	(revision 17837)
+++ scribus/util_formats.cpp	(working copy)
@@ -172,44 +172,29 @@
 	return a + b + ";;" +c;
 }
 
+QStringList FormatsManager::extensionListForFormat(int type)
+{
+	QStringList result;
+	if ((JPEG & type) && !m_supportedImageFormats.contains(QByteArray("jpg")))
+		return result;
+	if ((GIF & type) && !m_supportedImageFormats.contains(QByteArray("gif")))
+		return result;
+	if (m_fmts.contains(type))
+		result = m_fmts.value(type);
+	return result;
+}
+
 QString FormatsManager::extensionListForFormat(int type, int listType)
 {
-	QString nameMatch;
-	QString separator(listType==0 ? " *." : "|");
-	QMapIterator<int, QStringList> it(m_fmts);
-	bool first=true;
-	int n=0;
-	while (it.hasNext())
-	{
-		it.next();
-		if (type & it.key())
-		{
-			//Just in case the Qt used doesn't support jpeg or gif
-			if ((JPEG & it.key()) && !m_supportedImageFormats.contains(QByteArray("jpg")))
-				continue;
-			if ((GIF & it.key()) && !m_supportedImageFormats.contains(QByteArray("gif")))
-				continue;
-			if (first)
-				first=false;
-			QStringListIterator itSL(it.value());
-			while (itSL.hasNext())
-			{
-				if (listType==0)
-					nameMatch += separator;
-				nameMatch += itSL.next();
-				if (listType==1 && itSL.hasNext())
-					nameMatch += separator;
-			}
-		}
-		++n;
-		if (listType==1 && it.hasNext() && nameMatch.length()>0 && !nameMatch.endsWith(separator))
-			nameMatch += separator;
-	}
-	if (listType==0 && nameMatch.startsWith(" "))
-		nameMatch.remove(0,1);
-	if (listType==1 && nameMatch.endsWith("|"))
-		nameMatch.chop(1);
-	return nameMatch;
+	// TODO: This method should probably be renamed and only used to return the "*." type of lists
+	// For the "piped ones" it's probably easier and faster to directly call the method above and do a join
+	// (ale/20121111)
+	QString result;
+	QString separator(listType == 0 ? " *." : "|");
+	result = extensionListForFormat(type).join(separator).trimmed();
+	if (listType == 0)
+		result = "*." + result;
+	return result;
 }
 
 void FormatsManager::fileTypeStrings(int type, QString& formatList, QString& formatText, QString& formatAll, bool lowerCaseOnly)
Index: scribus/util_formats.h
===================================================================
--- scribus/util_formats.h	(revision 17837)
+++ scribus/util_formats.h	(working copy)
@@ -121,6 +121,8 @@
 		//! Returns in the form of "EPS (*.eps *.EPS *.epsf *.EPSF *.epsi *.EPSI)"
 		QString extensionsForFormat(int type);
 		
+		//! Returns a list of extensions matching the type
+ 		QStringList extensionListForFormat(int type);
 		//! Returns in the form of "*.eps *.epsf *.epsi" or "eps|epsf|epsi"
  		QString extensionListForFormat(int type, int listType);
 		
