summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/cryptography/kgpginterface.h
blob: b70bc68ad0d742cab91048e6e3fb2c719501a1fa (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
87
88
89
90
91
//Code from KGPG

/***************************************************************************
                          kgpginterface.h  -  description
                             -------------------
    begin                : Sat Jun 29 2002
    copyright            : (C) 2002 by 
    email                : 
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KGPGINTERFACE_H
#define KGPGINTERFACE_H


#include <kurl.h>

/**
 * Encrypt a file using gpg.
 */
//class KgpgEncryptFile : public QObject {
class KgpgInterface : public QObject {

  Q_OBJECT

    public:
	/**
	 * Initialize the class
	 */
        KgpgInterface();
	
	
	/**Encrypt text function
	 * @param text QString text to be encrypted.
	 * @param userIDs the recipients key id's.
	 * @param Options String with the wanted gpg options. ex: "--armor"
	 * returns the encrypted text or empty string if encyption failed
	 */
	 static QString KgpgEncryptText(QString text,QString userIDs, QString Options="");
	
	 /**Decrypt text function
	 * @param text QString text to be decrypted.
	 * @param userID QString the name of the decryption key (only used to prompt user for passphrase)
	 */
	static QString KgpgDecryptText(QString text,QString userID);
//	static QString KgpgDecryptFileToText(KURL srcUrl,QString userID);

	/*
	 * Destructor for the class.
	 */
	~KgpgInterface();
	
	static QString checkForUtf8(QString txt);

	
    private slots:
	
signals:
	        
    private:
    /**
	 * @internal structure for communication
	 */
        QString message,tempKeyFile,userIDs,txtprocess,output;
		QCString passphrase;
		bool deleteSuccess,konsLocal,anonymous,txtsent,decfinished,decok,badmdc;
		int signSuccess;
		int step,signb,sigsearch;
		QString konsSignKey, konsKeyID;
		
		
	/**
	 * @internal structure for the file information
	 */
        KURL file;
	/**
	 * @internal structure to send signal only once on error.
	 */
	bool encError;
};


#endif