/[winpt]/trunk/Src/wptClipSignEncDlg.cpp
ViewVC logotype

Diff of /trunk/Src/wptClipSignEncDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 47 by werner, Mon Oct 31 14:04:59 2005 UTC revision 176 by twoaday, Mon Feb 13 09:38:03 2006 UTC
# Line 17  Line 17 
17   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
18   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19   */   */
   
20  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
21  #include <config.h>  #include <config.h>
22  #endif  #endif
23    
24  #include <windows.h>  #include <windows.h>
 #include <windows.h>  
25  #include <commctrl.h>  #include <commctrl.h>
26    
27  #include "resource.h"  #include "resource.h"
# Line 63  gpg_clip_sign_encrypt (gpgme_ctx_t ctx, Line 61  gpg_clip_sign_encrypt (gpgme_ctx_t ctx,
61          return gpg_error (GPG_ERR_NO_PUBKEY);          return gpg_error (GPG_ERR_NO_PUBKEY);
62    
63      gpgme_set_armor (ctx, 1);      gpgme_set_armor (ctx, 1);
64        gpgme_set_textmode (ctx, 1);
65            
66      err = gpg_data_new_from_clipboard (&plain, 0);      err = gpg_data_new_from_clipboard (&plain, 0);
67      if (err)      if (err)
# Line 104  clip_signenc_dlg_proc (HWND dlg, UINT ms Line 103  clip_signenc_dlg_proc (HWND dlg, UINT ms
103      gpgme_ctx_t ctx;      gpgme_ctx_t ctx;
104      passphrase_cb_s pwd;      passphrase_cb_s pwd;
105      char *signer = NULL;      char *signer = NULL;
106      int force_trust = 0, opt = 0;      int force_trust = 0;
     int kmode = reg_prefs.keylist_mode? KEYLIST_ENCRYPT_MIN : KEYLIST_ENCRYPT;  
107      int n;      int n;
108            
109      switch( msg ) {      switch( msg ) {
110      case WM_INITDIALOG:      case WM_INITDIALOG:
111          SetWindowText (dlg, _("Sign & Encrypt"));          SetWindowText (dlg, _("Sign & Encrypt"));
112            SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
113          kc = keycache_get_ctx( KEYCACHE_PUB );          kc = keycache_get_ctx (KEYCACHE_PUB);
114          if( !kc )          if (!kc)
115              BUG( NULL );              BUG (NULL);
116          lv = keylist_load( GetDlgItem( dlg, IDC_SIGNENC_KEYLIST ),          lv = keylist_load (GetDlgItem (dlg, IDC_SIGNENC_KEYLIST),
117                             kc, NULL, kmode, KEY_SORT_USERID);                             kc, NULL, KEYLIST_ENCRYPT_MIN, KEY_SORT_USERID);
118          seclist_init( dlg, IDC_SIGNENC_SECLIST, KEYLIST_FLAG_SHORT, &list );          seclist_init (dlg, IDC_SIGNENC_SECLIST, KEYLIST_FLAG_SHORT, &list);
119          center_window (dlg, NULL);          center_window (dlg, NULL);
         set_active_window (dlg);  
120          EnableWindow (GetDlgItem (dlg, IDC_SIGNENC_SECLIST), FALSE);          EnableWindow (GetDlgItem (dlg, IDC_SIGNENC_SECLIST), FALSE);
121          SetDlgItemText (dlg, IDC_SIGNENC_SELKEY, _("Select key for signing"));          SetDlgItemText (dlg, IDC_SIGNENC_SELKEY, _("Select key for signing"));
122          SetDlgItemText (dlg, IDC_SIGNENC_SECLISTINF, _("Signing key:"));          SetDlgItemText (dlg, IDC_SIGNENC_SECLISTINF, _("Signing key:"));
# Line 128  clip_signenc_dlg_proc (HWND dlg, UINT ms Line 125  clip_signenc_dlg_proc (HWND dlg, UINT ms
125                    
126      case WM_DESTROY:      case WM_DESTROY:
127          seclist_destroy (&list);          seclist_destroy (&list);
         reset_active_window ();  
128          if (lv) {          if (lv) {
129              keylist_delete (lv);              keylist_delete (lv);
130              lv = NULL;              lv = NULL;
# Line 140  clip_signenc_dlg_proc (HWND dlg, UINT ms Line 136  clip_signenc_dlg_proc (HWND dlg, UINT ms
136          notify = (NMHDR *)lparam;          notify = (NMHDR *)lparam;
137          if (notify && notify->code == NM_DBLCLK          if (notify && notify->code == NM_DBLCLK
138              && notify->idFrom == IDC_SIGNENC_KEYLIST)              && notify->idFrom == IDC_SIGNENC_KEYLIST)
139              PostMessage (dlg, WM_COMMAND, MAKEWPARAM (IDOK, 0), NULL);              PostMessage (dlg, WM_COMMAND, MAKEWPARAM (IDOK, 0), 0);
140          return TRUE;          return TRUE;
141                    
142      case WM_SYSCOMMAND:      case WM_SYSCOMMAND:
143          if( LOWORD (wparam) == SC_CLOSE )          if (LOWORD (wparam) == SC_CLOSE)
144              EndDialog( dlg, TRUE );              EndDialog (dlg, TRUE);
145          return FALSE;          return FALSE;
146                    
147      case WM_COMMAND:      case WM_COMMAND:
# Line 154  clip_signenc_dlg_proc (HWND dlg, UINT ms Line 150  clip_signenc_dlg_proc (HWND dlg, UINT ms
150              int enable = IsDlgButtonChecked (dlg, IDC_SIGNENC_SELKEY);              int enable = IsDlgButtonChecked (dlg, IDC_SIGNENC_SELKEY);
151              EnableWindow (GetDlgItem (dlg, IDC_SIGNENC_SECLIST), enable? TRUE : FALSE);              EnableWindow (GetDlgItem (dlg, IDC_SIGNENC_SECLIST), enable? TRUE : FALSE);
152          }          }
153          switch( LOWORD( wparam ) ) {          switch (LOWORD (wparam)) {
154          case IDOK:          case IDOK:
155              rset = keylist_get_recipients( lv, &force_trust, &n );              rset = keylist_get_recipients (lv, &force_trust, &n);
156              if (!n) {              if (!n) {
157                  msg_box( dlg, _("You must select at least one key."), _("Sign & Encrypt"), MB_ERR );                  msg_box (dlg, _("You must select at least one key."),
158                             _("Sign & Encrypt"), MB_ERR);
159                  return FALSE;                  return FALSE;
160              }              }
161              if( IsDlgButtonChecked( dlg, IDC_SIGNENC_SELKEY ) ) {              if( IsDlgButtonChecked( dlg, IDC_SIGNENC_SELKEY ) ) {
# Line 166  clip_signenc_dlg_proc (HWND dlg, UINT ms Line 163  clip_signenc_dlg_proc (HWND dlg, UINT ms
163                  const char * s;                  const char * s;
164    
165                  if( seclist_select_key( dlg, IDC_SIGNENC_SECLIST, &key ) ) {                  if( seclist_select_key( dlg, IDC_SIGNENC_SECLIST, &key ) ) {
166                      msg_box( dlg, _("No key was selected."), _("Signing"), MB_ERR );                      msg_box (dlg, _("No key was selected."), _("Signing"), MB_ERR);
167                      return FALSE;                      return FALSE;
168                  }                  }
169                  s = key->subkeys->keyid;                  s = key->subkeys->keyid;
# Line 184  clip_signenc_dlg_proc (HWND dlg, UINT ms Line 181  clip_signenc_dlg_proc (HWND dlg, UINT ms
181              err = gpgme_new (&ctx);              err = gpgme_new (&ctx);
182              if (err)              if (err)
183                  BUG (NULL);                  BUG (NULL);
184    
185              set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Sign & Encrypt"));              set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Sign & Encrypt"));
186              err = gpg_clip_sign_encrypt (ctx, signer, rset, force_trust);              err = gpg_clip_sign_encrypt (ctx, signer, rset, force_trust);
187              release_gpg_passphrase_cb (&pwd);              release_gpg_passphrase_cb (&pwd);

Legend:
Removed from v.47  
changed lines
  Added in v.176

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26