mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kio: KFileItem::mimeComment() optimization
KFileItem::mimeTypePtr() is lesser version of KFileItem::determineMimeType() and if KFileItem::determineMimeType() did not return valid KMimeType::Ptr then neither will KFileItem::mimeTypePtr() but calling KFileItem::::mimeTypePtr() after KFileItem::determineMimeType() is redundant Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
632f5e52de
commit
ea56b1c92f
1 changed files with 3 additions and 5 deletions
|
@ -712,12 +712,11 @@ QString KFileItem::mimeComment() const
|
|||
if (!displayType.isEmpty())
|
||||
return displayType;
|
||||
|
||||
KMimeType::Ptr mType = determineMimeType();
|
||||
KMimeType::Ptr mime = determineMimeType();
|
||||
|
||||
bool isLocalUrl = false;
|
||||
KUrl url = mostLocalUrl(isLocalUrl);
|
||||
|
||||
KMimeType::Ptr mime = mimeTypePtr();
|
||||
// This cannot move to kio_file (with UDS_DISPLAY_TYPE) because it needs
|
||||
// the mimetype to be determined, which is done here, and possibly delayed...
|
||||
if (isLocalUrl && !d->isSlow() && mime->is("application/x-desktop")) {
|
||||
|
@ -727,12 +726,11 @@ QString KFileItem::mimeComment() const
|
|||
return comment;
|
||||
}
|
||||
|
||||
QString comment = d->isSlow() ? mType->comment() : mType->comment(url);
|
||||
QString comment = d->isSlow() ? mime->comment() : mime->comment(url);
|
||||
//kDebug() << "finding comment for " << url.url() << " : " << d->m_pMimeType->name();
|
||||
if (!comment.isEmpty())
|
||||
return comment;
|
||||
else
|
||||
return mType->name();
|
||||
return mime->name();
|
||||
}
|
||||
|
||||
static QString iconFromDesktopFile(const QString& path)
|
||||
|
|
Loading…
Add table
Reference in a new issue