diff options
author | David Faure <faure@kde.org> | 2012-04-02 11:42:26 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-08 10:36:51 +0200 |
commit | b069158ed35e7d39c3ac56ce4844c6ff1d69451f (patch) | |
tree | 6356bbd180236e082196caa70b0db42576599719 /src | |
parent | 32db7de2079967fe1c333c562b742318c50321a4 (diff) |
Fix QMimeType::operator== to only compare mimetype names.
The name is the unique identifier. Code such as
if (oldItem.mimeType() == newItem.mimeType())
really wants to detect whether the item has a new mimetype (name),
not compare static mimetype data such as comments and icons.
Change-Id: I5fe56443295c91e1024c066ad6e7f93d842ae507
Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/mimetypes/qmimetype.cpp | 21 | ||||
-rw-r--r-- | src/corelib/mimetypes/qmimetype_p.h | 2 |
2 files changed, 3 insertions, 20 deletions
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index 1b13a9f8c7..2ae818d862 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -77,23 +77,6 @@ void QMimeTypePrivate::clear() loaded = false; } -/*! - \fn bool QMimeTypePrivate::operator==(const QMimeTypePrivate &other) const; - Returns true if \a other equals this QMimeTypePrivate object, otherwise returns false. - */ -bool QMimeTypePrivate::operator==(const QMimeTypePrivate &other) const -{ - if (name == other.name && - localeComments == other.localeComments && - genericIconName == other.genericIconName && - iconName == other.iconName && - globPatterns == other.globPatterns) { - return true; - } - - return false; -} - void QMimeTypePrivate::addGlobPattern(const QString &pattern) { globPatterns.append(pattern); @@ -184,10 +167,12 @@ QMimeType::~QMimeType() /*! \fn bool QMimeType::operator==(const QMimeType &other) const; Returns true if \a other equals this QMimeType object, otherwise returns false. + The name is the unique identifier for a mimetype, so two mimetypes with + the same name, are equal. */ bool QMimeType::operator==(const QMimeType &other) const { - return d == other.d || *d == *other.d; + return d == other.d || d->name == other.d->name; } /*! diff --git a/src/corelib/mimetypes/qmimetype_p.h b/src/corelib/mimetypes/qmimetype_p.h index 775d5278e2..caef65cb5b 100644 --- a/src/corelib/mimetypes/qmimetype_p.h +++ b/src/corelib/mimetypes/qmimetype_p.h @@ -59,8 +59,6 @@ public: void clear(); - bool operator==(const QMimeTypePrivate &other) const; - void addGlobPattern(const QString &pattern); QString name; |