This file is indexed.

/usr/include/kpgp/kpgpui.h is in kdepim-dev 4:4.8.4a-0ubuntu0.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/*  -*- c++ -*-
    kpgpui.h

    Copyright (C) 2001,2002 the KPGP authors
    See file AUTHORS.kpgp for details

    This file is part of KPGP, the KDE PGP/GnuPG support library.

    KPGP 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.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef KPGPUI_H
#define KPGPUI_H

#include "libkpgp_export.h"
#include "kpgp.h"
#include "kpgpkey.h"

#include <QtCore/QString>     // is a member in KeyRequester
#include <QtCore/QVector>     // used in KeyApprovalDialog
#include <QtGui/QWidget>      // base class of Config
#include <QtGui/QCheckBox>    // used in inlined methods
#include <QtGui/QPixmap>
#include <QtGui/QLabel>

#include <kdebug.h>       // used in inlined methods
#include <kdialog.h>      // base class of all dialogs here
#include <kpassworddialog.h>

class QString;
class QRegExp;
class QByteArray;
class QCheckBox;            // needed by Config, KeySelectionDialog
class QTextEdit;            // needed by CipherTextDialog
class QComboBox;            // needed by Config
class QPixmap;              // needed by KeySelectionDialog
class QPushButton;          // needed by KeyRequester
class QTimer;               // needed by KeySelectionDialog
class QGroupBox;
class QTreeWidgetItem;

class QTreeWidget;          // needed by KeySelectionDialog
class KPasswordEdit;        // needed by PassphraseDialog

namespace Kpgp {

class Module;
class Key;                  // needed by KeySelectionDialog
class KeyIDList;            // needed by KeySelectionDialog

/** the passphrase dialog */
class KPGP_EXPORT PassphraseDialog : public KPasswordDialog
{
  Q_OBJECT

  public:
    explicit PassphraseDialog( QWidget *parent=0,
                               const QString &caption=QString(),
                               const QString &keyID=QString());
    virtual ~PassphraseDialog();

    QString passphrase();
};


// -------------------------------------------------------------------------
/** A widget for configuring the pgp interface. Can be included into
    a tabdialog. This widget by itself does not provide an apply/cancel
    button mechanism. */
class KPGP_EXPORT Config : public QWidget
{
  Q_OBJECT

  public:
    explicit Config( QWidget *parent = 0, bool encrypt = true );
    virtual ~Config();

    virtual void setValues();
    virtual void applySettings();
    QGroupBox* optionsGroupBox() { return mpOptionsGroupBox; }
  Q_SIGNALS:
    void changed();

  protected:
    Module *pgp;
    QCheckBox *storePass;
    QCheckBox *encToSelf;
    QCheckBox *showCipherText;
    QCheckBox *showKeyApprovalDlg;
    QComboBox *toolCombo;
    QGroupBox* mpOptionsGroupBox;
};


// -------------------------------------------------------------------------
#ifndef QT_NO_TREEWIDGET
#define KeySelectionDialogSuper KDialog
class KPGP_EXPORT KeySelectionDialog: public KeySelectionDialogSuper
{
  Q_OBJECT

  enum TrustCheckMode { NoExpensiveTrustCheck,
                        AllowExpensiveTrustCheck,
                        ForceTrustCheck
                      };

  public:
    /** allowedKeys: see kpgp.h
     */
    KeySelectionDialog( const KeyList& keyList,
                        const QString& title,
                        const QString& text = QString(),
                        const KeyIDList& keyIds = KeyIDList(),
                        const bool rememberChoice = false,
                        const unsigned int allowedKeys = AllKeys,
                        const bool extendedSelection = false,
                        QWidget *parent=0 );
    virtual ~KeySelectionDialog();

    /** Returns the key ID of the selected key in single selection mode.
        Otherwise it returns a null string. */
    virtual KeyID key() const;

    /** Returns a list of selected key IDs. */
    virtual KeyIDList keys() const
      { return mKeyIds; }

    virtual bool rememberSelection() const
      { if( mRememberCB )
          return mRememberCB->isChecked();
        else
          return false;
      }

  protected Q_SLOTS:
    virtual void slotRereadKeys();
    virtual void slotSelectionChanged();
    virtual void slotCheckSelection( QTreeWidgetItem* = 0 );
    virtual void slotRMB( const QPoint& pos );
    virtual void slotRecheckKey();
    virtual void slotOk();
    virtual void slotCancel();
    virtual void slotSearch( const QString & text );
    virtual void slotFilter();

  private:
    void filterByKeyID( const QString & keyID );
    void filterByKeyIDOrUID( const QString & keyID );
    void filterByUID( const QString & uid );
    void showAllItems();
    bool anyChildMatches( const QTreeWidgetItem * item, QRegExp & rx ) const;

    void initKeylist( const KeyList& keyList, const KeyIDList& keyIds );

    QString keyInfo( const Kpgp::Key* ) const;

    QString beautifyFingerprint( const QByteArray& ) const;

    // Returns the key ID of the key the given QListViewItem belongs to
    KeyID getKeyId( const QTreeWidgetItem* ) const;

    // Returns: -1 = unusable, 0 = unknown, 1 = valid, but untrusted, 2 = trusted
    int keyValidity( const Kpgp::Key* ) const;

    // Updates the given QListViewItem with the data of the given key
    void updateKeyInfo( const Kpgp::Key*, QTreeWidgetItem* ) const;

    /** Checks if choosing the given key is allowed
        Returns:
        -1 = key must not be chosen,
         0 = not enough information to decide whether the give key is allowed
             or not,
         1 = key can be chosen
    */
    int keyAdmissibility( QTreeWidgetItem*,
                          TrustCheckMode = NoExpensiveTrustCheck ) const;

    // Perform expensive trust checks for the given keys
    bool checkKeys( const QList<QTreeWidgetItem*>& ) const;

  private:
    QTreeWidget *mListView;
    QCheckBox *mRememberCB;
    QPixmap *mKeyGoodPix, *mKeyBadPix, *mKeyUnknownPix, *mKeyValidPix;
    KeyIDList mKeyIds;
    unsigned int mAllowedKeys;
    QTimer* mCheckSelectionTimer;
    QTimer* mStartSearchTimer;
    QString mSearchText;
    QTreeWidgetItem* mCurrentContextMenuItem;

  static const int sCheckSelectionDelay;
};
#endif

class KPGP_EXPORT KeyRequester: public QWidget
{
  Q_OBJECT

public:
  explicit KeyRequester( QWidget * parent=0, bool multipleKeys=false,
                         unsigned int allowedKeys=AllKeys, const char * name=0 );
  virtual ~KeyRequester();

  KeyIDList keyIDs() const;
  void setKeyIDs( const KeyIDList & keyIDs );

  QPushButton * eraseButton() const { return mEraseButton; }
  QPushButton * dialogButton() const { return mDialogButton; }

  void setDialogCaption( const QString & caption );
  void setDialogMessage( const QString & message );

  bool isMultipleKeysEnabled() const;
  void setMultipleKeysEnabled( bool enable );

  int allowedKeys() const;
  void setAllowedKeys( int allowed );

protected:
  /** Reimplement this to return a list of selected keys. */
  virtual KeyIDList keyRequestHook( Module * pgp ) const = 0;

protected:
  QLabel * mLabel;
  QPushButton * mEraseButton;
  QPushButton * mDialogButton;
  QString mDialogCaption, mDialogMessage;
  bool mMulti;
  int mAllowedKeys;
  KeyIDList mKeys;

protected Q_SLOTS:
  void slotDialogButtonClicked();
  void slotEraseButtonClicked();

Q_SIGNALS:
  void changed();

private:
  class Private;
  Private * d;
protected:
  virtual void virtual_hook( int, void* );
};


class KPGP_EXPORT PublicKeyRequester : public KeyRequester {
  Q_OBJECT
public:
  explicit PublicKeyRequester( QWidget * parent=0, bool multipleKeys=false,
                               unsigned int allowedKeys=PublicKeys,
                               const char * name=0 );
  virtual ~PublicKeyRequester();

protected:
  KeyIDList keyRequestHook( Module * pgp ) const;

private:
  typedef KeyRequester base;
  class Private;
  Private * d;
protected:
  virtual void virtual_hook( int, void* );
};


class KPGP_EXPORT SecretKeyRequester : public KeyRequester {
  Q_OBJECT
public:
  explicit SecretKeyRequester( QWidget * parent=0, bool multipleKeys=false,
                               unsigned int allowedKeys=SecretKeys,
                               const char * name=0 );
  virtual ~SecretKeyRequester();

protected:
  KeyIDList keyRequestHook( Module * pgp ) const;

private:
  typedef KeyRequester base;
  class Private;
  Private * d;
protected:
  virtual void virtual_hook( int, void* );
};


// -------------------------------------------------------------------------
class KPGP_EXPORT KeyApprovalDialog: public KDialog
{
  Q_OBJECT

  public:
    KeyApprovalDialog( const QStringList&,
                       const QVector<KeyIDList>&,
                       const int allowedKeys,
                       QWidget *parent = 0 );
    virtual ~KeyApprovalDialog() {}

    QVector<KeyIDList> keys() const { return mKeys; }

    bool preferencesChanged() const { return mPrefsChanged; }

  protected Q_SLOTS:
    void slotPrefsChanged( int ) { mPrefsChanged = true; }
    void slotChangeEncryptionKey( int );
    virtual void slotOk();
    virtual void slotCancel();

  private:
    QVector<KeyIDList> mKeys;
    int mAllowedKeys;
    int mEncryptToSelf;
    bool mPrefsChanged;
    QVector<QLabel*> mAddressLabels;
    QVector<QLabel*> mKeyIdsLabels;
    //QPtrVector<QListBox> mKeyIdListBoxes;
    QVector<QComboBox*> mEncrPrefCombos;
};


// -------------------------------------------------------------------------
class KPGP_EXPORT CipherTextDialog: public KDialog
{
  Q_OBJECT

  public:
    explicit CipherTextDialog( const QByteArray &text,
                               const QByteArray &charset=0,
                               QWidget *parent=0 );
    virtual ~CipherTextDialog() {}

  private:
    void setMinimumSize();
    QTextEdit *mEditBox;
};

} // namespace Kpgp

#endif