summaryrefslogtreecommitdiffstats
path: root/kgpg/listkeys.h
blob: b2610dbf992f6ae211bd9eddd582739b515c15b1 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
/***************************************************************************
                          listkeys.h  -  description
                             -------------------
    begin                : Thu Jul 4 2002
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
    email                : bj@altern.org
 ***************************************************************************/

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

#include <kdialogbase.h>
#include <klistview.h>
#include <kmainwindow.h>
#include <klistviewsearchline.h>

#include <kactionclasses.h> 
#include <qclipboard.h>

#include "dcopiface.h"

#include <qptrlist.h>
#include <qstringlist.h>
#include <kurl.h>

#include <qcheckbox.h>
#include <kmainwindow.h>

class QPushButton;
class QPopupMenu;
class QLabel;
class QCheckbox;
class KStatusBar;
class KPassivePopup;
class KProcess;
class KProcIO;
class QEvent;
class KTempFile;
class KgpgApp;
class keyServer;
class groupEdit;
class KgpgInterface;
class KSelectAction;

struct gpgKey
{
        QString gpgkeymail;
        QString gpgkeyname;
        QString gpgkeyid;
        QString gpgkeytrust;
        QString gpgkeyvalidity;
        QString gpgkeysize;
        QString gpgkeycreation;
        QString gpgkeyexpiration;
        QString gpgkeyalgo;
        QPixmap trustpic;
};

class KgpgSelKey : public KDialogBase
{
        Q_OBJECT

public:
        KgpgSelKey( QWidget *parent = 0, const char *name = 0,bool allowMultipleSelection=false, QString preselected=QString::null);
        KListView *keysListpr;
        QPixmap keyPair;
        QCheckBox *local;
        QVBoxLayout *vbox;
        QWidget *page;
private slots:
        void slotOk();
        void slotpreOk();
        void slotSelect(QListViewItem *item);

public slots:
        QString getkeyID();
        QString getkeyMail();
};



class KeyView : public KListView
{
        Q_OBJECT
        friend class listKeys;
public:
        KeyView( QWidget *parent = 0, const char *name = 0);
        bool displayPhoto,displayOnlySecret,displayDisabled;
        int previewSize;
	QString secretList;
	QPixmap trustbad;
	
private:

        QString orphanList;
        QString photoKeysList;
        QPixmap pixkeyPair, pixkeySingle, pixkeyGroup, pixsignature, pixuserid, pixuserphoto;
	QPixmap trustunknown, trustrevoked, trustgood, pixRevoke, pixkeyOrphan;
        QListViewItem *itemToOpen;
        KTempFile *kgpgphototmp;
        int groupNb;

public slots:
        void slotRemoveColumn(int d);
        void slotAddColumn(int c);

private slots:
	void refreshTrust(int color,QColor newColor);
        void  droppedfile (KURL);
        void refreshkeylist();
        gpgKey extractKey(QString keyColon);
        void expandKey(QListViewItem *item);
        void expandGroup(QListViewItem *item);
        void refreshcurrentkey(QListViewItem *current);
        void refreshcurrentkey(QString currentID);
        void refreshselfkey();
        void refreshgroups();
        void insertOrphanedKeys(QStringList orpans);
        void insertOrphan(QString currentID);
        QPixmap slotGetPhoto(QString photoId,bool mini=false);
        void slotReloadKeys(QStringList keyIDs);
        void slotReloadOrphaned();

signals:
        void statusMessage(QString,int,bool keep=false);

protected:
        virtual void startDrag();
        virtual void contentsDragMoveEvent(QDragMoveEvent *e);
        virtual void  contentsDropEvent (QDropEvent*);
};

class mySearchLine: public KListViewSearchLine
{
    Q_OBJECT
public:
    mySearchLine(QWidget *parent = 0, KeyView *listView = 0, const char *name = 0);
    virtual ~mySearchLine();
private:
 KeyView *searchListView;    
    
public slots:
virtual void updateSearch(const QString &s = QString::null);
protected:
virtual bool itemMatches(const QListViewItem *item, const QString & s)  const;
};


class listKeys : public KMainWindow, virtual public KeyInterface
{
        friend class KeyView;
        Q_OBJECT

public:
        listKeys(QWidget *parent=0, const char *name=0);
        ~listKeys();
        QLabel *keyPhoto;
        KeyView *keysList2;
        QPopupMenu *popup,*popupsec,*popupout,*popupsig,*popupgroup,*popupphoto,*popupuid,*popuporphan;
        QString message;
        QStringList keynames;
        KPassivePopup *pop;
        KToggleAction *sTrust,*sCreat,*sExpi,*sSize;
        KSelectAction *photoProps;
        KStatusBar *keyStatusBar;
	KgpgApp *s_kgpgEditor;

private:
        QPushButton *bouton1,*bouton2,*bouton0;
        QString tempKeyFile,newKeyMail,newKeyName,newkeyFinger,newkeyID;
	KListViewSearchLine* listViewSearch;	
        bool continueSearch;
        bool showPhoto;
        keyServer *kServer;
        KTempFile *kgpgtmp;
        KAction *importSignatureKey,*importAllSignKeys,*signKey,*refreshKey;
        QPtrList<QListViewItem> signList,keysList;
        uint globalCount,keyCount;
        int globalChecked;
        bool globalisLocal,showTipOfDay;
        QString globalkeyMail,globalkeyID,searchString;
        long searchOptions;
        groupEdit *gEdit;
        KgpgInterface *revKeyProcess;
        KDialogBase *addUidWidget;
        QClipboard::Mode clipboardMode;
        QTimer *statusbarTimer;


protected:
        void closeEvent( QCloseEvent * e );
        bool eventFilter( QObject *, QEvent *e );

public slots:
        void slotgenkey();
        void refreshkey();
        void readAllOptions();
        void showKeyInfo(QString keyID);
        void findKey();
        void findFirstKey();
        void findNextKey();
        void slotSetDefaultKey(QString newID);

private slots:
        void quitApp();
        void  slotOpenEditor();
        void changeMessage(QString,int, bool keep=false);
        void statusBarTimeout();
        void slotShowTrust();
        void slotShowSize();
        void slotShowCreat();
        void slotShowExpi();
        void slotToggleSecret();
	void slotToggleDisabled();
        void slotGotoDefaultKey();
        void slotDelUid();
        void slotAddUid();
        void slotAddUidEnable(const QString & name);
        void slotGpgError(QString errortxt);
        void slotUpdatePhoto();
        void slotDeletePhoto();
        void slotAddPhoto();
        void slotSetPhotoSize(int size);
        void slotShowPhoto();
        void readgenprocess(KProcIO *p);
        void newKeyDone(KProcess *);
        void slotrevoke(QString keyID,QString revokeUrl,int reason,QString description);
        void revokeWidget();
        void doFilePrint(QString url);
        void doPrint(QString txt);
        void checkList();
        void signLoop();
        void slotManpage();
        void slotTip();
        void showKeyServer();
	void showKeyManager();
        void slotReadFingerProcess(KProcIO *p);
        void slotProcessExportMail(QString keys);
        void slotProcessExportClip(QString keys);
        void readOptions();
        void genover(KProcess *p);
        void showOptions();
        void slotSetDefKey();
        void slotSetDefaultKey(QListViewItem *newdef);
        void annule();
        void confirmdeletekey();
        void deletekey();
        void deleteseckey();
        void signkey();
        void delsignkey();
        void preimportsignkey();
        bool importRemoteKey(QString keyID);
        void importsignkey(QString importKeyId);
        void importallsignkey();
        void importfinished();
        void signatureResult(int success);
        void delsignatureResult(bool);
        void listsigns();
        void slotexport();
        void slotexportsec();
        void slotmenu(QListViewItem *,const QPoint &,int);
        void slotPreImportKey();
        void slotedit();
        void addToKAB();
        //	void allToKAB();
        void editGroup();
        void groupAdd();
        void groupRemove();
        void groupInit(QStringList keysGroup);
        void groupChange();
        void createNewGroup();
        void deleteGroup();
        void slotImportRevoke(QString url);
        void slotImportRevokeTxt(QString revokeText);
        void refreshKeyFromServer();
        void refreshFinished();
        void slotregenerate();
        void reloadSecretKeys();
	void dcopImportFinished();
	
signals:
        void readAgainOptions();
        void certificate(QString);
        void closeAsked();
        void fontChanged(QFont);
	void encryptFiles(KURL::List);
	void installShredder();

};


#endif // LISTKEYS_H