27#include <tqcombobox.h> 
   29#include <tqpushbutton.h> 
   30#include <tqlistview.h> 
   31#include <tqbuttongroup.h> 
   32#include <tqradiobutton.h> 
   33#include <tqmultilineedit.h> 
   34#include <tqcheckbox.h> 
   36#include <kdialogbase.h> 
   66       AllKeys = PublicKeys | SecretKeys | EncryptionKeys | SigningKeys,
 
   67       PubSecKeys = PublicKeys | SecretKeys,
 
   68       EncrSignKeys = EncryptionKeys | SigningKeys
 
   81class TDE_EXPORT Module
 
   96  virtual void readConfig();
 
   97  virtual void writeConfig(
bool sync);
 
  102  bool decrypt( Block& block );
 
  105  bool verify( Block& block );
 
  114  Kpgp::Result clearsign( Block& block,
 
  115                  const KeyID& keyId, 
const TQCString& charset = 0 );
 
  125  Kpgp::Result encrypt( Block& block,
 
  126                const TQStringList& receivers, 
const KeyID& keyId,
 
  127                bool sign, 
const TQCString& charset = 0 );
 
  136  Kpgp::Result getEncryptionKeys( KeyIDList& encryptionKeyIds,
 
  137                                  const TQStringList& recipients,
 
  138                                  const KeyID& keyId );
 
  149  int encryptionPossible( 
const TQStringList& recipients );
 
  152  int doEncSign( Block& block, 
const KeyIDList& recipientKeyIds, 
bool sign );
 
  156  bool signKey( 
const KeyID& keyID );
 
  159  const KeyList publicKeys();
 
  162  const KeyList secretKeys();
 
  166  void readPublicKeys( 
bool reread = 
false );
 
  170  void readSecretKeys( 
bool reread = 
false );
 
  173  TQCString getAsciiPublicKey( 
const KeyID& keyID );
 
  178  Key* publicKey( 
const KeyID& keyID );
 
  183  Key* publicKey( 
const TQString& userID );
 
  188  Key* secretKey( 
const KeyID& keyID );
 
  193  Validity keyTrust( 
const KeyID& keyID );
 
  199  Validity keyTrust( 
const TQString& userID );
 
  204  bool isTrusted( 
const KeyID& keyID );
 
  209  Key* rereadKey( 
const KeyID& keyID, 
const bool readTrust = 
true );
 
  213  bool changePassPhrase();
 
  217  void setUser(
const KeyID& keyID);
 
  219  const KeyID user() 
const;
 
  222  void setEncryptToSelf(
bool flag);
 
  223  bool encryptToSelf(
void) 
const;
 
  230  void setStorePassPhrase(
bool);
 
  231  bool storePassPhrase(
void) 
const;
 
  234  void clear(
const bool erasePassPhrase = 
false);
 
  237  const TQString lastErrorMsg(
void) 
const;
 
  240  enum PGPType { tAuto, tGPG, tPGP2, tPGP5, tPGP6, tOff } pgpType;
 
  243  bool havePGP(
void) 
const;
 
  246  bool usePGP(
void)
 const { 
return (havePGP() && (pgpType != tOff)); }
 
  249  void setShowCipherText(
const bool flag);
 
  250  bool showCipherText(
void) 
const;
 
  253  void setShowKeyApprovalDlg(
const bool flag);
 
  254  bool showKeyApprovalDlg(
void) 
const;
 
  260  KeyID selectSecretKey( 
const TQString& title,
 
  261                         const TQString& text = TQString(),
 
  262                         const KeyID& keyId = KeyID() );
 
  270  KeyID selectPublicKey( 
const TQString& title,
 
  271                         const TQString& text = TQString(),
 
  272                         const KeyID& oldKeyId = KeyID(),
 
  273                         const TQString& address = TQString(),
 
  274                         const unsigned int allowedKeys = AllKeys );
 
  282  KeyIDList selectPublicKeys( 
const TQString& title,
 
  283                              const TQString& text = TQString(),
 
  284                              const KeyIDList& oldKeyIds = KeyIDList(),
 
  285                              const TQString& address = TQString(),
 
  286                              const unsigned int allowedKeys = AllKeys );
 
  293  EncryptPref encryptionPreference( 
const TQString& address );
 
  298  void setEncryptionPreference( 
const TQString& address,
 
  299                                const EncryptPref pref );
 
  304  static Kpgp::Module *getKpgp();
 
  307  static TDEConfig *getConfig();
 
  323  static bool prepareMessageForDecryption( 
const TQCString& msg,
 
  324                                           TQPtrList<Block>& pgpBlocks,
 
  325                                           TQStrList& nonPgpBlocks );
 
  329  bool haveTrustedEncryptionKey( 
const TQString& person );
 
  332  KeyIDList getEncryptionKeys( 
const TQString& person );
 
  335  bool setPassPhrase(
const TQString &pass);
 
  343  int prepare(
bool needPassPhrase=
false, Block* block = 0 );
 
  346  void cleanupPass() { 
if (!storePass) wipePassPhrase(); }
 
  350  void wipePassPhrase(
bool free=
false);
 
  353  TQString canonicalAddress( 
const TQString& person );
 
  357  KeyID selectKey( 
const KeyList& keys,
 
  358                   const TQString& title,
 
  359                   const TQString& text = TQString(),
 
  360                   const KeyID& keyId = KeyID(),
 
  361                   const unsigned int allowedKeys = AllKeys );
 
  365  KeyIDList selectKeys( 
const KeyList& keys,
 
  366                        const TQString& title,
 
  367                        const TQString& text = TQString(),
 
  368                        const KeyIDList& keyIds = KeyIDList(),
 
  369                        const unsigned int allowedKeys = AllKeys );
 
  375  KeyID selectKey( 
bool& rememberChoice,
 
  377                   const TQString& title,
 
  378                   const TQString& text = TQString(),
 
  379                   const KeyID& keyId = KeyID(),
 
  380                   const unsigned int allowedKeys = AllKeys );
 
  386  KeyIDList selectKeys( 
bool& rememberChoice,
 
  388                        const TQString& title,
 
  389                        const TQString& text = TQString(),
 
  390                        const KeyIDList& keyIds = KeyIDList(),
 
  391                        const unsigned int allowedKeys = AllKeys );
 
  396  KeyIDList keysForAddress( 
const TQString& address );
 
  400  void setKeysForAddress( 
const TQString& address, 
const KeyIDList& keyIDs );
 
  403  void removeKeyForAddress( 
const TQString& address );
 
  408  void readAddressData();
 
  413  void writeAddressData();
 
  415  bool checkForPGP(
void);
 
  416  void assignPGPBase(
void);
 
  418  static Kpgp::Module *kpgpObject;
 
  423    EncryptPref encrPref;
 
  425  typedef TQMap<TQString, AddressData> AddressDataDict;
 
  426  AddressDataDict addressDataDict;
 
  429  bool mPublicKeysCached : 1; 
 
  431  bool mSecretKeysCached : 1; 
 
  439  bool flagEncryptToSelf : 1;
 
  444  bool havePassPhrase : 1;
 
  445  bool showEncryptionResult : 1;
 
  446  bool mShowKeyApprovalDlg : 1;
 
  452Module::setShowKeyApprovalDlg( 
const bool flag )
 
  454  mShowKeyApprovalDlg = flag;
 
  458Module::showKeyApprovalDlg( 
void )
 const 
  460  return mShowKeyApprovalDlg;