~ubuntu-branches/ubuntu/oneiric/kdenetwork/oneiric-updates

« back to all changes in this revision

Viewing changes to kget/core/signature.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac, Philip Muškovac
  • Date: 2011-07-10 12:36:35 UTC
  • mfrom: (1.1.59 upstream)
  • Revision ID: package-import@ubuntu.com-20110710123635-3db9oyxdswp4sp1e
Tags: 4:4.6.90-0ubuntu1
* New upstream release
 - Bump on kde-sc-dev-latest
 - s/kdebase-runtime-dev/kde-runtime-dev
* Dropped kubuntu_05_samba_sharing.diff <- went upstream
* Added kubuntu_05_make_old_symbols_reappear_and_fix_building.diff
* Refreshed *.install
* Refreshed symbols

[ Philip Muškovac ]
* fix debug package depends on kdebase-runtime-dbg -> kde-runtime-dbg 
  and recommends on kde-workspace-dbg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
*   Copyright (C) 2009-2011 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 KGET_SIGNATURE_H
 
21
#define KGET_SIGNATURE_H
 
22
 
 
23
#include "../kget_export.h"
 
24
 
 
25
#include <KUrl>
 
26
 
 
27
class QDomElement;
 
28
 
 
29
#ifdef HAVE_QGPGME
 
30
#include <gpgme++/verificationresult.h>
 
31
#endif //HAVE_QGPGME
 
32
 
 
33
/**
 
34
 * @class Signature
 
35
 *
 
36
 * @short Class to verify signatures
 
37
 */
 
38
class KGET_EXPORT Signature : public QObject
 
39
{
 
40
    Q_OBJECT
 
41
 
 
42
    friend class KeyDownloader;
 
43
    friend class SignatureThread;
 
44
 
 
45
//TODO also support verification and decryption of files that contain the signature?
 
46
    public:
 
47
        explicit Signature(const KUrl &dest, QObject *object = 0);
 
48
        ~Signature();
 
49
 
 
50
        enum SignatureType
 
51
        {
 
52
            NoType = 0,
 
53
            AsciiDetached, //.asc
 
54
            BinaryDetached //.sig
 
55
        };
 
56
 
 
57
        enum VerificationStatus
 
58
        {
 
59
            NoResult, //either not tried, or not enough information
 
60
            NotWorked, //something during verification failed
 
61
            NotVerified,
 
62
            Verified,
 
63
            VerifiedInformation, //verified, though the there is some additional information
 
64
            VerifiedWarning //verified, though there is a warning
 
65
        };
 
66
 
 
67
        KUrl destination() const;
 
68
        void setDestination(const KUrl &destination);
 
69
 
 
70
        VerificationStatus status() const;
 
71
#ifdef HAVE_QGPGME
 
72
        GpgME::VerificationResult verificationResult();
 
73
#endif //HAVE_QGPGME
 
74
 
 
75
        void downloadKey(QString fingerprint);
 
76
        QByteArray signature();
 
77
        void setAsciiDetatchedSignature(const QString &signature);
 
78
        void setSignature(const QByteArray &signature, SignatureType type);
 
79
 
 
80
        SignatureType type() const;
 
81
 
 
82
        /**
 
83
         * The fingerprint of the signature//TODO get even without verification??
 
84
         */
 
85
        QString fingerprint();
 
86
        bool isVerifyable();
 
87
        void verify();
 
88
 
 
89
        void save(const QDomElement &element);
 
90
        void load(const QDomElement &e);
 
91
 
 
92
    signals:
 
93
        void verified(int verificationStatus);
 
94
 
 
95
    private slots:
 
96
#ifdef HAVE_QGPGME
 
97
        void slotVerified(const GpgME::VerificationResult &result);
 
98
#endif //HAVE_QGPGME
 
99
 
 
100
    private:
 
101
        class SignaturePrivate *d;
 
102
 
 
103
        friend class SignaturePrivate;
 
104
};
 
105
 
 
106
#endif