summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformdialoghelper_qpa.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer.qnx@kdab.com>2012-05-23 12:01:11 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-24 17:46:15 +0200
commit66e68b79c276f33f9a161c9eb04a9416b4ec9d9d (patch)
tree4c9abb47855d41a40d8a6ef1b0cc8af7e979b691 /src/gui/kernel/qplatformdialoghelper_qpa.cpp
parent2d990ccba67d383bfacef5e360f9528b89e01487 (diff)
QPA: Refactor QFileDialogPrivate::qt_clean_filter_list for QPA
Allows QFileDialog and QPA plugins to access this helper function. Needed by the Cocoa and QNX plugins. This commit fixes up the Cocoa plugin. The QNX support will be in a follow-up commit. Change-Id: I8dd08a9f3dc27d85edd0dc9dad9629406c1e677a Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/gui/kernel/qplatformdialoghelper_qpa.cpp')
-rw-r--r--src/gui/kernel/qplatformdialoghelper_qpa.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.cpp b/src/gui/kernel/qplatformdialoghelper_qpa.cpp
index f00437f69b..f71c5e58de 100644
--- a/src/gui/kernel/qplatformdialoghelper_qpa.cpp
+++ b/src/gui/kernel/qplatformdialoghelper_qpa.cpp
@@ -577,4 +577,18 @@ void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptio
m_options = options;
}
+const char *QPlatformFileDialogHelper::filterRegExp =
+"^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
+
+// Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)"
+QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter)
+{
+ QRegExp regexp(QString::fromLatin1(filterRegExp));
+ QString f = filter;
+ int i = regexp.indexIn(f);
+ if (i >= 0)
+ f = regexp.cap(2);
+ return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
+}
+
QT_END_NAMESPACE