1
by Jonathan Riddell
Import upstream version 4.10.80 |
1 |
/***************************************************************************
|
2 |
* Copyright (C) 2010 Matthias Fuchs <mat69@gmx.net> *
|
|
3 |
* *
|
|
4 |
* This program is free software; you can redistribute it and/or modify *
|
|
5 |
* it under the terms of the GNU General Public License as published by *
|
|
6 |
* the Free Software Foundation; either version 2 of the License, or *
|
|
7 |
* (at your option) any later version. *
|
|
8 |
* *
|
|
9 |
* This program is distributed in the hope that it will be useful, *
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
12 |
* GNU General Public License for more details. *
|
|
13 |
* *
|
|
14 |
* You should have received a copy of the GNU General Public License *
|
|
15 |
* along with this program; if not, write to the *
|
|
16 |
* Free Software Foundation, Inc., *
|
|
17 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
18 |
***************************************************************************/
|
|
19 |
||
20 |
#ifndef DBUSVERIFIERWRAPPER_H
|
|
21 |
#define DBUSVERIFIERWRAPPER_H
|
|
22 |
||
23 |
#include <QDBusVariant> |
|
24 |
#include <kio/global.h> |
|
25 |
||
26 |
class Verifier; |
|
27 |
||
28 |
class DBusVerifierWrapper : public QObject |
|
29 |
{
|
|
30 |
Q_OBJECT
|
|
31 |
public: |
|
32 |
DBusVerifierWrapper(Verifier *parent); |
|
33 |
~DBusVerifierWrapper(); |
|
34 |
||
35 |
public slots: |
|
36 |
/**
|
|
37 |
* @return the dest url
|
|
38 |
*/
|
|
39 |
QString destination() const; |
|
40 |
||
41 |
/**
|
|
42 |
* Adds a checksum to the transfer
|
|
43 |
*/
|
|
44 |
void addChecksum(const QString &type, const QString &hash); |
|
45 |
||
46 |
/**
|
|
47 |
* Add partial checksums that can be used as repairinformation
|
|
48 |
* @note only one checksum per type can be added (one MD5, one SHA1 etc.),
|
|
49 |
* the newer overwrites the older and a checksum can only be added if it is
|
|
50 |
* supported by the verifier
|
|
51 |
* @param type the type of the checksums
|
|
52 |
* @param length the length of each piece
|
|
53 |
* @param checksums the checksums, first entry is piece number 0
|
|
54 |
*/
|
|
55 |
void addPartialChecksums(const QString &type, qulonglong length, const QStringList &checksums); |
|
56 |
||
57 |
bool isVerifyable() const; |
|
58 |
||
59 |
void verify(); |
|
60 |
||
61 |
/**
|
|
62 |
* Call this method after calling verify() with a negative result, it will
|
|
63 |
* emit a list of the broken pieces, if PartialChecksums were defined,
|
|
64 |
* otherwise and in case of any error an empty list will be emitted
|
|
65 |
*/
|
|
66 |
void brokenPieces() const; |
|
67 |
||
68 |
signals: |
|
69 |
/**
|
|
70 |
* Emitted when the verification of a file finishes
|
|
71 |
*/
|
|
72 |
void verified(bool verified); |
|
73 |
||
74 |
/**
|
|
75 |
* Emitted when brokenPiecesThreaded finishes, the list can be empty
|
|
76 |
* @param offsets of the broken pieces, they are the beginning
|
|
77 |
* @param length of broken pieces
|
|
78 |
*/
|
|
79 |
void brokenPieces(const QStringList &offsets, qulonglong length); |
|
80 |
||
81 |
private slots: |
|
82 |
void slotBrokenPieces(const QList<KIO::fileoffset_t> &offsets, KIO::filesize_t length); |
|
83 |
||
84 |
private: |
|
85 |
Verifier *m_verifier; |
|
86 |
};
|
|
87 |
||
88 |
#endif
|