mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-14 00:39:53 -05:00
Perform file hash checks asynchronously (#3815)
This commit is contained in:
parent
7ba9fcc0e5
commit
d3978980d2
@ -18,7 +18,9 @@
|
||||
|
||||
#include "FileWatcher.h"
|
||||
|
||||
#include "core/AsyncTask.h"
|
||||
#include "core/Clock.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QFileInfo>
|
||||
|
||||
@ -134,6 +136,7 @@ void FileWatcher::checkFileChecksum()
|
||||
|
||||
QByteArray FileWatcher::calculateChecksum()
|
||||
{
|
||||
return AsyncTask::runAndWaitForFuture([this]() -> QByteArray {
|
||||
QFile file(m_filePath);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
QCryptographicHash hash(QCryptographicHash::Sha256);
|
||||
@ -145,6 +148,7 @@ QByteArray FileWatcher::calculateChecksum()
|
||||
return hash.result();
|
||||
}
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
BulkFileWatcher::BulkFileWatcher(QObject* parent)
|
||||
|
Loading…
Reference in New Issue
Block a user