• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • dbus
dbusverifierwrapper.cpp
Go to the documentation of this file.
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 #include "dbusverifierwrapper.h"
21 #include "core/verifier.h"
22 #include "core/verificationmodel.h"
23 
24 DBusVerifierWrapper::DBusVerifierWrapper(Verifier *verifier)
25  : QObject(verifier),
26  m_verifier(verifier)
27 {
28  connect(m_verifier, SIGNAL(brokenPieces(QList<KIO::fileoffset_t>,KIO::filesize_t)), this, SLOT(slotBrokenPieces(QList<KIO::fileoffset_t>,KIO::filesize_t)));
29  connect(m_verifier, SIGNAL(verified(bool)), this, SIGNAL(verified(bool)));
30 }
31 
32 DBusVerifierWrapper::~DBusVerifierWrapper()
33 {
34 }
35 
36 QString DBusVerifierWrapper::destination() const
37 {
38  return m_verifier->destination().pathOrUrl();
39 }
40 
41 void DBusVerifierWrapper::addChecksum(const QString &type, const QString &hash)
42 {
43  m_verifier->model()->addChecksum(type, hash);
44 }
45 
46 void DBusVerifierWrapper::addPartialChecksums(const QString &type, qulonglong length, const QStringList &checksums)
47 {
48  m_verifier->addPartialChecksums(type, length, checksums);
49 }
50 
51 bool DBusVerifierWrapper::isVerifyable() const
52 {
53  return m_verifier->isVerifyable();
54 }
55 
56 void DBusVerifierWrapper::verify()
57 {
58  m_verifier->verify();
59 }
60 
61 void DBusVerifierWrapper::brokenPieces() const
62 {
63  m_verifier->brokenPieces();
64 }
65 
66 void DBusVerifierWrapper::slotBrokenPieces(const QList<KIO::fileoffset_t> &offsets, KIO::filesize_t length)
67 {
68  //FIXME seems to work correct though is not correctly received at TestTransfers or maybe wrong converted
69 // QList<QVariant> broken;
70 // for (int i = 0; i < brokenPieces.count(); ++i) {
71 // broken << brokenPieces[i];
72 // }
73 //
74 // QDBusVariant dbusBroken;
75 // dbusBroken.setVariant(QVariant(broken));
76 // emit this->brokenPieces(dbusBroken);
77 
78  QStringList broken;
79  for (int i = 0; i < offsets.count(); ++i) {
80  broken << QString::number(offsets[i]);
81  }
82 
83  emit brokenPieces(broken, length);
84 }
85 
86 
87 #include "dbusverifierwrapper.moc"
Verifier::addPartialChecksums
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
verificationmodel.h
Verifier::verify
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
Verifier::destination
KUrl destination() const
Definition: verifier.cpp:196
DBusVerifierWrapper::verify
void verify()
Definition: dbusverifierwrapper.cpp:56
DBusVerifierWrapper::DBusVerifierWrapper
DBusVerifierWrapper(Verifier *parent)
Definition: dbusverifierwrapper.cpp:24
QObject
DBusVerifierWrapper::brokenPieces
void brokenPieces() const
Call this method after calling verify() with a negative result, it will emit a list of the broken pie...
Definition: dbusverifierwrapper.cpp:61
DBusVerifierWrapper::~DBusVerifierWrapper
~DBusVerifierWrapper()
Definition: dbusverifierwrapper.cpp:32
verifier.h
DBusVerifierWrapper::verified
void verified(bool verified)
Emitted when the verification of a file finishes.
dbusverifierwrapper.h
Verifier
Definition: verifier.h:68
DBusVerifierWrapper::destination
QString destination() const
Definition: dbusverifierwrapper.cpp:36
Verifier::model
VerificationModel * model()
Definition: verifier.cpp:211
DBusVerifierWrapper::isVerifyable
bool isVerifyable() const
Definition: dbusverifierwrapper.cpp:51
DBusVerifierWrapper::addChecksum
void addChecksum(const QString &type, const QString &hash)
Adds a checksum to the transfer.
Definition: dbusverifierwrapper.cpp:41
Verifier::isVerifyable
bool isVerifyable() const
Definition: verifier.cpp:279
DBusVerifierWrapper::addPartialChecksums
void addPartialChecksums(const QString &type, qulonglong length, const QStringList &checksums)
Add partial checksums that can be used as repairinformation.
Definition: dbusverifierwrapper.cpp:46
VerificationModel::addChecksum
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
Verifier::brokenPieces
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal