blob: aa28c198f04f51a15f8d6f3838c6216fd1ab8367 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*
* Copyright (C) 2010,2011 Rolf Eike Beer <[email protected]>
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KGPGDECRYPT_H
#define KGPGDECRYPT_H
#include <QObject>
#include <QUrl>
#include "kgpgtextorfiletransaction.h"
class QProcess;
class QStringList;
/**
* @brief decrypt the given text or files
*/
class KGpgDecrypt: public KGpgTextOrFileTransaction {
Q_OBJECT
Q_DISABLE_COPY(KGpgDecrypt)
KGpgDecrypt(); // = delete C++0x
public:
/**
* @brief decrypt given text
* @param parent parent object
* @param text text to decrypt
*/
explicit KGpgDecrypt(QObject *parent, const QString &text = QString());
/**
* @brief decrypt file(s)
* @param parent parent object
* @param files list of file locations to decrypt
*/
KGpgDecrypt(QObject *parent, const QList<QUrl> &files);
/**
* @brief decrypt file to given output filename
* @param parent parent object
* @param infile name of file to decrypt
* @param outfile name of file to write output to (will be overwritten)
*/
KGpgDecrypt(QObject *parent, const QUrl &infile, const QUrl &outfile);
/**
* @brief destructor
*/
virtual ~KGpgDecrypt();
/**
* @brief get decryption result
* @return decrypted text
*/
QStringList decryptedText() const;
/**
* @brief check if the given text contains an encoded message
* @param text text to check
* @param startPos if not NULL start offset of encoded text will be returned here
* @param endPos if not NULL end offset of encoded text will be returned here
*/
static bool isEncryptedText(const QString &text, int *startPos = NULL, int *endPos = NULL);
protected:
virtual QStringList command() const;
virtual bool nextLine(const QString &line);
private:
int m_fileIndex;
int m_plainLength; ///< length of decrypted plain text if given by GnuPG
const QString m_outFilename; ///< name of file to write output to
};
#endif // KGPGDECRYPT_H
|