summaryrefslogtreecommitdiffstats
path: root/kgpg/listkeys.h
blob: a65abe6e76b91fe0653551e35e892f5c75879650 (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
303
304
305
306
/***************************************************************************
                          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 <tdelistview.h>
#include <tdemainwindow.h>
#include <tdelistviewsearchline.h>

#include <tdeactionclasses.h> 
#include <tqclipboard.h>

#include "dcopiface.h"

#include <tqptrlist.h>
#include <tqstringlist.h>
#include <kurl.h>

#include <tqcheckbox.h>
#include <tdemainwindow.h>

class TQPushButton;
class TQPopupMenu;
class TQLabel;
class TQCheckbox;
class KStatusBar;
class KPassivePopup;
class TDEProcess;
class TDEProcIO;
class TQEvent;
class KTempFile;
class KgpgApp;
class keyServer;
class groupEdit;
class KgpgInterface;
class TDESelectAction;

struct gpgKey
{
        TQString gpgkeymail;
        TQString gpgkeyname;
        TQString gpgkeyid;
        TQString gpgkeytrust;
        TQString gpgkeyvalidity;
        TQString gpgkeysize;
        TQString gpgkeycreation;
        TQString gpgkeyexpiration;
        TQString gpgkeyalgo;
        TQPixmap trustpic;
};

class KgpgSelKey : public KDialogBase
{
        TQ_OBJECT
  

public:
        KgpgSelKey( TQWidget *parent = 0, const char *name = 0,bool allowMultipleSelection=false, TQString preselected=TQString());
        TDEListView *keysListpr;
        TQPixmap keyPair;
        TQCheckBox *local;
        TQVBoxLayout *vbox;
        TQWidget *page;
private slots:
        void slotOk();
        void slotpreOk();
        void slotSelect(TQListViewItem *item);

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



class KeyView : public TDEListView
{
        TQ_OBJECT
  
        friend class listKeys;
public:
        KeyView( TQWidget *parent = 0, const char *name = 0);
        bool displayPhoto,displayOnlySecret,displayDisabled;
        int previewSize;
	TQString secretList;
	TQPixmap trustbad;
	
private:

        TQString orphanList;
        TQString photoKeysList;
        TQPixmap pixkeyPair, pixkeySingle, pixkeyGroup, pixsignature, pixuserid, pixuserphoto;
	TQPixmap trustunknown, trustrevoked, trustgood, pixRevoke, pixkeyOrphan;
        TQListViewItem *itemToOpen;
        KTempFile *kgpgphototmp;
        int groupNb;

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

private slots:
	void refreshTrust(int color,TQColor newColor);
        void  droppedfile (KURL);
        void refreshkeylist();
        gpgKey extractKey(TQString keyColon);
        void expandKey(TQListViewItem *item);
        void expandGroup(TQListViewItem *item);
        void refreshcurrentkey(TQListViewItem *current);
        void refreshcurrentkey(TQString currentID);
        void refreshselfkey();
        void refreshgroups();
        void insertOrphanedKeys(TQStringList orpans);
        void insertOrphan(TQString currentID);
        TQPixmap slotGetPhoto(TQString photoId,bool mini=false);
        void slotReloadKeys(TQStringList keyIDs);
        void slotReloadOrphaned();

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

protected:
        virtual void startDrag();
        virtual void contentsDragMoveEvent(TQDragMoveEvent *e);
        virtual void  contentsDropEvent (TQDropEvent*);
};

class mySearchLine: public TDEListViewSearchLine
{
    TQ_OBJECT
  
public:
    mySearchLine(TQWidget *parent = 0, KeyView *listView = 0, const char *name = 0);
    virtual ~mySearchLine();
private:
 KeyView *searchListView;    
    
public slots:
virtual void updateSearch(const TQString &s = TQString());
protected:
virtual bool itemMatches(const TQListViewItem *item, const TQString & s)  const;
};


class listKeys : public TDEMainWindow, virtual public KeyInterface
{
        friend class KeyView;
        TQ_OBJECT
  

public:
        listKeys(TQWidget *parent=0, const char *name=0);
        ~listKeys();
        TQLabel *keyPhoto;
        KeyView *keysList2;
        TQPopupMenu *popup,*popupsec,*popupout,*popupsig,*popupgroup,*popupphoto,*popupuid,*popuporphan;
        TQString message;
        TQStringList keynames;
        KPassivePopup *pop;
        TDEToggleAction *sTrust,*sCreat,*sExpi,*sSize;
        TDESelectAction *photoProps;
        KStatusBar *keyStatusBar;
	KgpgApp *s_kgpgEditor;

private:
        TQPushButton *bouton1,*bouton2,*bouton0;
        TQString tempKeyFile,newKeyMail,newKeyName,newkeyFinger,newkeyID;
	TDEListViewSearchLine* listViewSearch;	
        bool continueSearch;
        bool showPhoto;
        keyServer *kServer;
        KTempFile *kgpgtmp;
        TDEAction *importSignatureKey,*importAllSignKeys,*signKey,*refreshKey;
        TQPtrList<TQListViewItem> signList,keysList;
        uint globalCount,keyCount;
        int globalChecked;
        bool globalisLocal,showTipOfDay;
        TQString globalkeyMail,globalkeyID,searchString;
        long searchOptions;
        groupEdit *gEdit;
        KgpgInterface *revKeyProcess;
        KDialogBase *addUidWidget;
        TQClipboard::Mode clipboardMode;
        TQTimer *statusbarTimer;


protected:
        void closeEvent( TQCloseEvent * e );
        bool eventFilter( TQObject *, TQEvent *e );

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

private slots:
        void quitApp();
        void  slotOpenEditor();
        void changeMessage(TQString,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 TQString & name);
        void slotGpgError(TQString errortxt);
        void slotUpdatePhoto();
        void slotDeletePhoto();
        void slotAddPhoto();
        void slotSetPhotoSize(int size);
        void slotShowPhoto();
        void readgenprocess(TDEProcIO *p);
        void newKeyDone(TDEProcess *);
        void slotrevoke(TQString keyID,TQString revokeUrl,int reason,TQString description);
        void revokeWidget();
        void doFilePrint(TQString url);
        void doPrint(TQString txt);
        void checkList();
        void signLoop();
        void slotManpage();
        void slotTip();
        void showKeyServer();
	void showKeyManager();
        void slotReadFingerProcess(TDEProcIO *p);
        void slotProcessExportMail(TQString keys);
        void slotProcessExportClip(TQString keys);
        void readOptions();
        void genover(TDEProcess *p);
        void showOptions();
        void slotSetDefKey();
        void slotSetDefaultKey(TQListViewItem *newdef);
        void annule();
        void confirmdeletekey();
        void deletekey();
        void deleteseckey();
        void signkey();
        void delsignkey();
        void preimportsignkey();
        bool importRemoteKey(TQString keyID);
        void importsignkey(TQString importKeyId);
        void importallsignkey();
        void importfinished();
        void signatureResult(int success);
        void delsignatureResult(bool);
        void listsigns();
        void slotexport();
        void slotexportsec();
        void slotmenu(TQListViewItem *,const TQPoint &,int);
        void slotPreImportKey();
        void slotedit();
        void addToKAB();
        //	void allToKAB();
        void editGroup();
        void groupAdd();
        void groupRemove();
        void groupInit(TQStringList keysGroup);
        void groupChange();
        void createNewGroup();
        void deleteGroup();
        void slotImportRevoke(TQString url);
        void slotImportRevokeTxt(TQString revokeText);
        void refreshKeyFromServer();
        void refreshFinished();
        void slotregenerate();
        void reloadSecretKeys();
	void dcopImportFinished();
	
signals:
        void readAgainOptions();
        void certificate(TQString);
        void closeAsked();
        void fontChanged(TQFont);
	void encryptFiles(KURL::List);
	void installShredder();

};


#endif // LISTKEYS_H