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

Diff of /trunk/Src/wptKeysigDlg.cpp

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

revision 36 by werner, Thu Oct 27 15:25:13 2005 UTC revision 129 by twoaday, Fri Dec 30 13:56:10 2005 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  #include <time.h>  #include <time.h>
27    
28  #include "../resource.h"  #include "resource.h"
29  #include "wptGPG.h"  #include "wptGPG.h"
30  #include "wptCommonCtl.h"  #include "wptCommonCtl.h"
31  #include "wptContext.h" /* for passphrase_s */  #include "wptContext.h" /* for passphrase_s */
32  #include "wptDlgs.h"  #include "wptDlgs.h"
33  #include "wptW32API.h"  #include "wptW32API.h"
34  #include "wptNLS.h"  #include "wptNLS.h"
35  #include "wptKeyList.h"  #include "wptKeylist.h"
36  #include "wptKeyserver.h"  #include "wptKeyserver.h"
37  #include "wptUTF8.h"  #include "wptUTF8.h"
38  #include "wptTypes.h"  #include "wptTypes.h"
# Line 48  static subclass_s siglist_proc; Line 46  static subclass_s siglist_proc;
46  static int  static int
47  is_sig (listview_ctrl_t lv, int pos)  is_sig (listview_ctrl_t lv, int pos)
48  {  {
49      char tmpbuf[256];      char tmpbuf[200];
50    
51      if (pos == -1)      if (pos == -1)
52          pos = listview_get_curr_pos (lv);          pos = listview_get_curr_pos (lv);
53      if (pos == -1)      if (pos == -1)
54          return 0;          return 0;
55      listview_get_item_text (lv, pos, 0, tmpbuf, 200);      listview_get_item_text (lv, pos, 0, tmpbuf, sizeof (tmpbuf)-1);
56      if (*tmpbuf == ' ')      if (*tmpbuf == ' ')
57          return -1;          return -1;
58      return 0;      return 0;
# Line 131  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 129  sigprops_dlg_proc (HWND dlg, UINT msg, W
129          return FALSE;          return FALSE;
130    
131      case WM_INITDIALOG:      case WM_INITDIALOG:
132            SetWindowText (dlg, _("Signature Properties"));
133            SetDlgItemText (dlg, IDC_SIGPROPS_EXP, _("Exportable"));
134            SetDlgItemText (dlg, IDC_SIGPROPS_NREV, _("Non-revocably"));
135            SetDlgItemText (dlg, IDC_SIGPROPS_EXPIRED, _("Expired"));
136            SetDlgItemText (dlg, IDC_SIGPROPS_REV, _("Revoked"));
137            SetDlgItemText (dlg, IDC_SIGPROPS_CLASSINF, _("Class"));
138            SetDlgItemText (dlg, IDC_SIGPROPS_EXPSTR, _("Expire date"));
139            SetDlgItemText (dlg, IDC_SIGPROPS_KEYINF, _("Issuer key"));
140            SetDlgItemText (dlg, IDC_SIGPROPS_KEYIDINF, _("Issuer key ID"));
141          lv = (listview_ctrl_t)lparam;          lv = (listview_ctrl_t)lparam;
142          if (!lv)          if (!lv)
143              dlg_fatal_error (dlg, "could not get dialog param");              dlg_fatal_error (dlg, "could not get dialog param");
# Line 256  check_for_missing_keys (listview_ctrl_t Line 263  check_for_missing_keys (listview_ctrl_t
263  static int  static int
264  recv_missing_keys (HWND dlg, listview_ctrl_t lv)  recv_missing_keys (HWND dlg, listview_ctrl_t lv)
265  {  {
266      int i, n, rc;      int i, n, rc=0;
267      char id[128], keyid[18+1];      char id[128], keyid[18+1];
268            
269      n = listview_count_items (lv, 0);      n = listview_count_items (lv, 0);
270      for( i = 0; i < n; i++ ) {      for( i = 0; i < n; i++ ) {
271          listview_get_item_text( lv, i, 1, id, sizeof id - 1 );          listview_get_item_text (lv, i, 1, id, sizeof (id) - 1);
272          if( !strncmp( id, "NOKEY", 5 ) ) {          if( !strncmp( id, "NOKEY", 5 ) ) {
273              listview_get_item_text( lv, i, 4, keyid, sizeof keyid -1 );              listview_get_item_text( lv, i, 4, keyid, sizeof (keyid) -1);
274              rc = hkp_recv_key( dlg, default_keyserver, default_keyserver_port, keyid, 0, 0 );              rc = hkp_recv_key (dlg, default_keyserver,
275                                   default_keyserver_port, keyid, 0, 0);
276              if( rc )                            if( rc )              
277                  break;                  break;
278          }          }
# Line 344  keysig_dlg_proc (HWND dlg, UINT msg, WPA Line 352  keysig_dlg_proc (HWND dlg, UINT msg, WPA
352          if (k->uid)          if (k->uid)
353              _snprintf (inf, DIM (inf)-1, _("Signature List for \"%s\""), k->uid);              _snprintf (inf, DIM (inf)-1, _("Signature List for \"%s\""), k->uid);
354          SetWindowText (dlg, inf);          SetWindowText (dlg, inf);
         #ifndef LANG_DE  
355          SetDlgItemText (dlg, IDC_KEYSIG_RECVKEY, _("&Receive Key"));          SetDlgItemText (dlg, IDC_KEYSIG_RECVKEY, _("&Receive Key"));
356          SetDlgItemText (dlg, IDC_KEYSIG_SIGPROPS, _("&Properties"));          SetDlgItemText (dlg, IDC_KEYSIG_SIGPROPS, _("&Properties"));
357          #endif  
358          lv = siglist_load (GetDlgItem (dlg, IDC_KEYSIG_LIST), k->keyid);          lv = siglist_load (GetDlgItem (dlg, IDC_KEYSIG_LIST), k->keyid);
359          if (!check_for_missing_keys (lv))          if (!check_for_missing_keys (lv))
360              EnableWindow (GetDlgItem( dlg, IDC_KEYSIG_RECVKEY ), FALSE);              EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_RECVKEY), FALSE);
361            EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_SIGPROPS), FALSE);
362          k->callback.ctl = lv;          k->callback.ctl = lv;
363          sl = GetDlgItem (dlg, IDC_KEYSIG_LIST);          sl = GetDlgItem (dlg, IDC_KEYSIG_LIST);
364          siglist_proc.dlg = dlg;          siglist_proc.dlg = dlg;
# Line 384  keysig_dlg_proc (HWND dlg, UINT msg, WPA Line 392  keysig_dlg_proc (HWND dlg, UINT msg, WPA
392          return FALSE;          return FALSE;
393    
394      case WM_NOTIFY:      case WM_NOTIFY:
395          NMHDR * notify;          NMHDR *notify;
396                    
397          notify = (NMHDR *)lparam;          notify = (NMHDR *)lparam;
398          if( notify && notify->code == NM_DBLCLK          if (notify && notify->code == NM_DBLCLK
399              && notify->idFrom == IDC_KEYSIG_LIST )              && notify->idFrom == IDC_KEYSIG_LIST)
400              do_load_keyprops (dlg, lv);              do_load_keyprops (dlg, lv);
401          if (notify && notify->code == NM_RCLICK &&          if (notify && notify->code == NM_RCLICK &&
402              notify->idFrom == IDC_KEYSIG_LIST)              notify->idFrom == IDC_KEYSIG_LIST &&
403                is_sig (lv, -1))
404              do_create_popup (dlg);              do_create_popup (dlg);
405            if (notify && notify->code == LVN_ITEMCHANGED &&
406                ((LPNMLISTVIEW)lparam)->uNewState) {
407                idx = listview_get_curr_pos (lv);
408                listview_get_item_text (lv, idx, 1, inf, DIM (inf)-1);
409                EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_RECVKEY),
410                              strcmp (inf, "NOKEY") == 0? TRUE: FALSE);
411                EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_SIGPROPS),
412                              is_sig (lv, -1)? TRUE : FALSE);
413            }
414          break;          break;
415                    
416      case WM_COMMAND:      case WM_COMMAND:
# Line 415  keysig_dlg_proc (HWND dlg, UINT msg, WPA Line 433  keysig_dlg_proc (HWND dlg, UINT msg, WPA
433                                  _("Key Manager"), MB_YESNO|MB_INFO );                                  _("Key Manager"), MB_YESNO|MB_INFO );
434                  if (id == IDYES) {                  if (id == IDYES) {
435                      rc = recv_missing_keys (dlg, lv);                      rc = recv_missing_keys (dlg, lv);
436                      if( !rc )                      if (!rc)
437                          keycache_set_reload (1);                          keycache_set_reload (1);
438                      return TRUE;                      return TRUE;
439                  }                  }
440                  return TRUE;                  return TRUE;
441              }              }
             listview_get_item_text (lv, idx, 1, inf, DIM (inf)-1);  
             if (strcmp (inf, "NOKEY"))  
                 return FALSE;  
442              listview_get_item_text (lv, idx, 4, keyid, DIM (keyid)-1);              listview_get_item_text (lv, idx, 4, keyid, DIM (keyid)-1);
443              rc = hkp_recv_key (dlg, default_keyserver, default_keyserver_port, keyid, 0, 0);              rc = hkp_recv_key (dlg, default_keyserver, default_keyserver_port, keyid, 0, 0);
444              if (!rc)              if (!rc)
445                  keycache_set_reload (1);                  keycache_update (0, keyid);
446              return TRUE;              return TRUE;
447    
448          case IDC_KEYSIG_SIGPROPS:          case IDC_KEYSIG_SIGPROPS:

Legend:
Removed from v.36  
changed lines
  Added in v.129

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26