QMimeType: document preferredSuffix()/suffixes() better

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>
This commit is contained in:
David Faure 2012-07-06 10:16:03 +02:00 committed by Qt by Nokia
parent b069158ed3
commit 2c55847e9e
2 changed files with 4 additions and 2 deletions

View File

@ -349,8 +349,8 @@ QStringList QMimeType::allAncestors() const
} }
/*! /*!
\fn QStringList QMimeType::suffixes() const;
Returns the known suffixes for the MIME type. 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 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. 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 QString QMimeType::preferredSuffix() const
{ {

View 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 a single pattern") << "application/pdf" << "*.pdf" << "pdf";
QTest::newRow("mimetype with multiple patterns") << "application/x-kpresenter" << "*.kpr;*.kpt" << "kpr"; 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)) { //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"; QTest::newRow("mimetype with many patterns") << "application/vnd.wordperfect" << "*.wp;*.wp4;*.wp5;*.wp6;*.wpd;*.wpp" << "wp";
//} //}