Commit 65895fc6 authored by Elvis Angelaccio's avatar Elvis Angelaccio

Cache the detected archive mimetype

Archive::mimeType() is frequently called (i.e. every time that in the view the selected
entry changes), so this saves some computation and reduces the amount of noisy
debug output.
parent f8621b09
......@@ -193,9 +193,17 @@ TestJob* Archive::testArchive()
return job;
QMimeType Archive::mimeType() const
QMimeType Archive::mimeType()
return isValid() ? determineMimeType(fileName()) : QMimeType();
if (!isValid()) {
return QMimeType();
if (!m_mimeType.isValid()) {
m_mimeType = determineMimeType(fileName());
return m_mimeType;
bool Archive::isReadOnly() const
......@@ -166,7 +166,7 @@ public:
QString completeBaseName() const;
QString fileName() const;
QString comment() const;
QMimeType mimeType() const;
QMimeType mimeType();
bool isReadOnly() const;
bool isSingleFolderArchive();
bool hasComment() const;
......@@ -246,6 +246,7 @@ private:
ArchiveError m_error;
EncryptionType m_encryptionType;
qulonglong m_numberOfFiles;
QMimeType m_mimeType;
} // namespace Kerfuffle
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment