kget
verifier.cpp
Go to the documentation of this file.
38 const QStringList VerifierPrivate::SUPPORTED = (QStringList() << "sha512" << "sha384" << "sha256" << "ripmed160" << "sha1" << "md5" << "md4");
50 QString VerifierPrivate::calculatePartialChecksum(QFile *file, const QString &type, KIO::fileoffset_t startOffset, int pieceLength, KIO::filesize_t fileSize, bool *abortPtr)
136 return (useMd5 ? QString(md5Hash.hexDigest()) : QString(QCA::arrayToHex(hash.final().toByteArray())));
182 connect(&d->thread, SIGNAL(verified(QString,bool,KUrl)), this, SLOT(changeStatus(QString,bool)));
183 connect(&d->thread, SIGNAL(brokenPieces(QList<KIO::fileoffset_t>,KIO::filesize_t)), this, SIGNAL(brokenPieces(QList<KIO::fileoffset_t>,KIO::filesize_t)));
337 QPair<QString, PartialChecksums*> Verifier::availablePartialChecksum(Verifier::ChecksumStrength strength) const
375 Checksum pair = availableChecksum(static_cast<Verifier::ChecksumStrength>(Settings::checksumStrength()));
388 QPair<QString, PartialChecksums*> pair = availablePartialChecksum(static_cast<Verifier::ChecksumStrength>(Settings::checksumStrength()));
448 PartialChecksums Verifier::partialChecksums(const KUrl &dest, const QString &type, KIO::filesize_t length, bool *abortPtr)
499 QString hash = VerifierPrivate::calculatePartialChecksum(&file, type, length * i, length, fileSize, abortPtr);
524 void Verifier::addPartialChecksums(const QString &type, KIO::filesize_t length, const QStringList &checksums)
557 hash.setAttribute("verified", d->model->index(i, VerificationModel::Verified).data(Qt::EditRole).toInt());
558 QDomText value = e.ownerDocument().createTextNode(d->model->index(i, VerificationModel::Checksum).data().toString());
632 for (int i = 0; i < partialHashList.size(); ++i)//TODO give this function the size of the file, to calculate how many hashs are needed as an additional check, do that check in addPartialChecksums?!
QList< Checksum > availableChecksums() const
Returns all set checksums.
Definition: verifier.cpp:324
QStringList orderChecksumTypes(Verifier::ChecksumStrength strength) const
Definition: verifier.cpp:142
void addPartialChecksums(const QString &type, KIO::filesize_t length, const QStringList &checksums)
Add partial checksums that can be used as repairinformation.
Definition: verifier.cpp:524
Definition: verifier.h:80
void verify(const QModelIndex &index=QModelIndex())
Call this method if you want to verify() in its own thread, then signals with the result are emitted...
Definition: verifier.cpp:364
KIO::filesize_t partialChunkLength() const
Returns the length of the "best" partialChecksums.
Definition: verifier.cpp:532
static int diggestLength(const QString &type)
Returns the diggest length of type.
Definition: verifier.cpp:239
void verifiy(const QString &type, const QString &checksum, const KUrl &file)
Definition: verificationthread.cpp:44
Definition: verifier.h:78
Definition: dbusverifierwrapper.h:28
static QStringList supportedVerficationTypes()
Returns the supported verification types.
Definition: verifier.cpp:216
Definition: verifier.h:87
static bool isChecksum(const QString &type, const QString &checksum)
Tries to check if the checksum is a checksum and if it is supported it compares the diggestLength and...
Definition: verifier.cpp:256
Checksum availableChecksum(ChecksumStrength strength) const
Returns a checksum and a type.
Definition: verifier.cpp:298
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: verificationmodel.cpp:130
void setChecksums(const QStringList &checksums)
Definition: verifier.h:59
void setVerificationStatus(const QString &type, int verified)
Sets the verificationStatus for type.
Definition: verificationmodel.cpp:212
Definition: verifier.h:85
void findBrokenPieces(const QString &type, const QList< QString > checksums, KIO::filesize_t length, const KUrl &file)
Definition: verificationthread.cpp:58
QPair< QString, PartialChecksums * > availablePartialChecksum(Verifier::ChecksumStrength strength) const
Returns a PartialChecksum and a type.
Definition: verifier.cpp:337
QVariant data(const QModelIndex &index, int role) const
Definition: verificationmodel.cpp:50
static PartialChecksums partialChecksums(const KUrl &dest, const QString &type, KIO::filesize_t length=0, bool *abortPtr=0)
Create partial checksums of type for file dest.
Definition: verifier.cpp:448
QHash< QString, PartialChecksums * > partialSums
Definition: verifier_p.h:50
static QString cleanChecksumType(const QString &type)
Cleans the checksum type, that it should match the official name, i.e.
Definition: verifier.cpp:269
Definition: verifier.h:86
static QString calculatePartialChecksum(QFile *file, const QString &type, KIO::fileoffset_t startOffset, int pieceLength, KIO::filesize_t fileSize=0, bool *abortPtr=0)
Definition: verifier.cpp:50
void addChecksums(const QHash< QString, QString > &checksums)
Add multiple checksums that will later be used in the verification process.
Definition: verifier.cpp:519
Definition: verificationmodel.h:29
void addChecksum(const QString &type, const QString &checksum, int verified=0)
Add a checksum that is later used in the verification process.
Definition: verificationmodel.cpp:179
void addChecksums(const QHash< QString, QString > &checksums)
Add multiple checksums that will later be used in the verification process.
Definition: verificationmodel.cpp:203
void addChecksum(const QString &type, const QString &checksum, int verified=0)
Add a checksum that is later used in the verification process.
Definition: verifier.cpp:514
static QString checksum(const KUrl &dest, const QString &type, bool *abortPtr)
Creates the checksum type of the file dest.
Definition: verifier.cpp:398
Definition: verifier.h:79
Definition: verificationmodel.h:38
Definition: verifier_p.h:29
void brokenPieces() const
Call this method after calling verify() with a negative result, it will emit a list of the broken pie...
Definition: verifier.cpp:386
Definition: verifier.h:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.