QMimeType: document preferredSuffix()/suffixes() better
authorDavid Faure <faure@kde.org>
Fri, 6 Jul 2012 08:16:03 +0000 (10:16 +0200)
committerQt by Nokia <qt-info@nokia.com>
Sun, 8 Jul 2012 08:37:24 +0000 (10:37 +0200)
Change-Id: Icf4aab3516cd622d9932e32cb0bd819bef22ce9b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com>
src/corelib/mimetypes/qmimetype.cpp
tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp

index 2ae818d..bcbd0f2 100644 (file)
@@ -349,8 +349,8 @@ QStringList QMimeType::allAncestors() const
 }
 
 /*!
-    \fn QStringList QMimeType::suffixes() const;
     Returns the known suffixes for the MIME type.
+    No leading dot is included, so for instance this would return "jpg", "jpeg" for image/jpeg.
  */
 QStringList QMimeType::suffixes() const
 {
@@ -371,8 +371,9 @@ QStringList QMimeType::suffixes() const
 }
 
 /*!
-    \fn QString QMimeType::preferredSuffix() const;
     Returns the preferred suffix for the MIME type.
+    No leading dot is included, so for instance this would return "pdf" for application/pdf.
+    The return value can be empty, for mime types which do not have any suffixes associated.
  */
 QString QMimeType::preferredSuffix() const
 {
index e6def6e..d00de78 100644 (file)
@@ -557,6 +557,7 @@ void tst_QMimeDatabase::suffixes_data()
 
     QTest::newRow("mimetype with a single pattern") << "application/pdf" << "*.pdf" << "pdf";
     QTest::newRow("mimetype with multiple patterns") << "application/x-kpresenter" << "*.kpr;*.kpt" << "kpr";
+    QTest::newRow("jpeg") << "image/jpeg" << "*.jpe;*.jpg;*.jpeg" << "jpeg";
     //if (KMimeType::sharedMimeInfoVersion() > KDE_MAKE_VERSION(0, 60, 0)) {
         QTest::newRow("mimetype with many patterns") << "application/vnd.wordperfect" << "*.wp;*.wp4;*.wp5;*.wp6;*.wpd;*.wpp" << "wp";
     //}