File indexing completed on 2025-01-05 05:23:29
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2009 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #include "checksumcalculatejob.hpp" 0010 0011 // 0012 #include <abstractbytearraychecksumalgorithm.hpp> 0013 // Okteta core 0014 #include <Okteta/AbstractByteArrayModel> 0015 // Qt 0016 #include <QCoreApplication> 0017 0018 namespace Kasten { 0019 0020 void ChecksumCalculateJob::exec() 0021 { 0022 // check 0023 if (!mByteArrayModel || !mSelection.isValid()) { 0024 // reset 0025 mChecksum->clear(); 0026 0027 deleteLater(); // TODO: could be reused on next operation 0028 0029 return; 0030 } 0031 0032 connect(mAlgorithm, &AbstractByteArrayChecksumAlgorithm::calculatedBytes, this, &ChecksumCalculateJob::onCalculatedBytes); 0033 0034 mAlgorithm->calculateChecksum(mChecksum, mByteArrayModel, mSelection); 0035 0036 deleteLater(); // TODO: could be reused on next operation 0037 } 0038 0039 void ChecksumCalculateJob::onCalculatedBytes() 0040 { 0041 QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); 0042 } 0043 0044 } 0045 0046 #include "moc_checksumcalculatejob.cpp"