diff --git a/kerfuffle/propertiesdialog.cpp b/kerfuffle/propertiesdialog.cpp --- a/kerfuffle/propertiesdialog.cpp +++ b/kerfuffle/propertiesdialog.cpp @@ -29,6 +29,7 @@ #include "ark_debug.h" #include "ui_propertiesdialog.h" +#include #include #include @@ -80,6 +81,20 @@ break; } + QFile file(archive->fileName()); + if (file.open(QIODevice::ReadOnly)) { + QCryptographicHash hashMD5(QCryptographicHash::Md5); + hashMD5.addData(file.readAll()); + m_ui->lblMD5->setText(QLatin1String(hashMD5.result().toHex())); + file.close(); + } + if (file.open(QIODevice::ReadOnly)) { + QCryptographicHash hashSHA1(QCryptographicHash::Sha1); + hashSHA1.addData(file.readAll()); + m_ui->lblSHA1->setText(QLatin1String(hashSHA1.result().toHex())); + file.close(); + } + // Show an icon representing the mimetype of the archive. QIcon icon = QIcon::fromTheme(archive->mimeType().iconName()); m_ui->lblIcon->setPixmap(icon.pixmap(IconSize(KIconLoader::Desktop), IconSize(KIconLoader::Desktop))); diff --git a/kerfuffle/propertiesdialog.ui b/kerfuffle/propertiesdialog.ui --- a/kerfuffle/propertiesdialog.ui +++ b/kerfuffle/propertiesdialog.ui @@ -66,6 +66,13 @@ + + + + lblMimetype + + + @@ -178,10 +185,37 @@ - - + + - lblMimetype + MD5 hash: + + + + + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + SHA-1 hash: + + + + + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse