/[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 213 by twoaday, Thu May 11 13:32:56 2006 UTC revision 225 by twoaday, Tue Jun 6 13:37:59 2006 UTC
# Line 43  Line 43 
43  static subclass_s siglist_proc;  static subclass_s siglist_proc;
44    
45    
46    /* Return -1 if the selected item is a signature. */
47  static int  static int
48  is_sig (listview_ctrl_t lv, int pos)  is_sig (listview_ctrl_t lv, int pos)
49  {  {
# Line 131  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 132  sigprops_dlg_proc (HWND dlg, UINT msg, W
132      const char *s;      const char *s;
133    
134      switch (msg) {      switch (msg) {
     case WM_SYSCOMMAND:  
         if (LOWORD (wparam) == SC_CLOSE)  
             EndDialog (dlg, TRUE);  
         return FALSE;  
   
135      case WM_INITDIALOG:      case WM_INITDIALOG:
136          SetWindowText (dlg, _("Signature Properties"));          ks = (gpgme_key_sig_t)lparam;
137            if (!ks)
138                BUG (0);
139          SetDlgItemText (dlg, IDC_SIGPROPS_EXP, _("Exportable"));          SetDlgItemText (dlg, IDC_SIGPROPS_EXP, _("Exportable"));
140          SetDlgItemText (dlg, IDC_SIGPROPS_NREV, _("Non-revocably"));          SetDlgItemText (dlg, IDC_SIGPROPS_NREV, _("Non-revocably"));
141          SetDlgItemText (dlg, IDC_SIGPROPS_EXPIRED, _("Expired"));          SetDlgItemText (dlg, IDC_SIGPROPS_EXPIRED, _("Expired"));
# Line 147  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 145  sigprops_dlg_proc (HWND dlg, UINT msg, W
145          SetDlgItemText (dlg, IDC_SIGPROPS_KEYINF, _("Issuer key"));          SetDlgItemText (dlg, IDC_SIGPROPS_KEYINF, _("Issuer key"));
146          SetDlgItemText (dlg, IDC_SIGPROPS_KEYIDINF, _("Issuer key ID"));          SetDlgItemText (dlg, IDC_SIGPROPS_KEYIDINF, _("Issuer key ID"));
147          SetDlgItemText (dlg, IDC_SIGPROPS_POLICINF, _("Policy URL"));          SetDlgItemText (dlg, IDC_SIGPROPS_POLICINF, _("Policy URL"));
148          ks = (gpgme_key_sig_t)lparam;          SetWindowText (dlg, _("Signature Properties"));
149          if (!ks)          
             BUG (0);  
150          memset (&ctx, 0, sizeof ctx);          memset (&ctx, 0, sizeof ctx);
151          ctx._class = ks->sig_class;          ctx._class = ks->sig_class;
152          if (ctx._class == 0)          if (ctx._class == 0)
# Line 163  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 160  sigprops_dlg_proc (HWND dlg, UINT msg, W
160              ctx.alg = "ELG";              ctx.alg = "ELG";
161          ctx.exportable = ks->exportable;          ctx.exportable = ks->exportable;
162          _snprintf (tmpbuf, DIM (tmpbuf)-1, fmt_templ,          _snprintf (tmpbuf, DIM (tmpbuf)-1, fmt_templ,
163                     ctx.exportable? _("Exportable") : _("Non-exportable"), ctx.alg);                     ctx.exportable? _("Exportable") : _("Non-exportable"),
164                       ctx.alg);
165          SetDlgItemText (dlg, IDC_SIGPROPS_INFO, tmpbuf);          SetDlgItemText (dlg, IDC_SIGPROPS_INFO, tmpbuf);
166                    
167          _snprintf (tmpbuf, DIM (tmpbuf)-1, "0x%s", ks->keyid+8);          _snprintf (tmpbuf, DIM (tmpbuf)-1, "0x%s", ks->keyid+8);
# Line 184  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 182  sigprops_dlg_proc (HWND dlg, UINT msg, W
182          else {          else {
183              SYSTEMTIME st;              SYSTEMTIME st;
184              struct tm *tm;              struct tm *tm;
185              time_t t = time (NULL);              time_t now = time (NULL);
186              time_t tmp = ks->expires;              time_t tmp = ks->expires;
187    
188              tm = localtime (&tmp);              tm = localtime (&tmp);
# Line 195  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 193  sigprops_dlg_proc (HWND dlg, UINT msg, W
193              DateTime_SetSystemtime (GetDlgItem (dlg, IDC_SIGPROPS_EXPDATE),              DateTime_SetSystemtime (GetDlgItem (dlg, IDC_SIGPROPS_EXPDATE),
194                                      GDT_VALID, &st);                                      GDT_VALID, &st);
195    
196              tm = localtime (&t);              if (now > ks->expires)
             tm->tm_mon++;  
             tm->tm_year += 1900;  
             if (tm->tm_year > st.wYear)  
                 ctx.expired = 1;  
             else if (tm->tm_mon > st.wMonth)  
197                  ctx.expired = 1;                  ctx.expired = 1;
198              if (ctx.expired)              if (ctx.expired)
199                  CheckDlgButton (dlg, IDC_SIGPROPS_EXPIRED, BST_CHECKED);                  CheckDlgButton (dlg, IDC_SIGPROPS_EXPIRED, BST_CHECKED);
# Line 220  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 213  sigprops_dlg_proc (HWND dlg, UINT msg, W
213    
214      case WM_COMMAND:      case WM_COMMAND:
215          if (HIWORD (wparam) == BN_CLICKED) {          if (HIWORD (wparam) == BN_CLICKED) {
216                /* Code to prevent the user changes the check buttons. */
217              switch (LOWORD (wparam)) {              switch (LOWORD (wparam)) {
218              case IDC_SIGPROPS_EXP:              case IDC_SIGPROPS_EXP:
219                  CheckDlgButton (dlg, IDC_SIGPROPS_EXP,                  CheckDlgButton (dlg, IDC_SIGPROPS_EXP,
# Line 258  sigprops_dlg_proc (HWND dlg, UINT msg, W Line 252  sigprops_dlg_proc (HWND dlg, UINT msg, W
252  }  }
253    
254    
255    /* Subclass window procedure for the list view. */
256  static BOOL CALLBACK  static BOOL CALLBACK
257  subclass_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  subclass_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
258  {  {
# Line 292  check_for_missing_keys (listview_ctrl_t Line 287  check_for_missing_keys (listview_ctrl_t
287      int i, n;      int i, n;
288      char id[128];      char id[128];
289            
290      n = listview_count_items( lv, 0 );      n = listview_count_items (lv, 0);
291      for( i = 0; i < n; i++ ) {      for (i = 0; i < n; i++) {
292          listview_get_item_text (lv, i, SL_COL_VALID, id, sizeof (id) - 1);          listview_get_item_text (lv, i, SL_COL_VALID, id, sizeof (id) - 1);
293          if (!strncmp (id, "NOKEY", 5))          if (!strncmp (id, "NOKEY", 5))
294              return 1;              return 1;
# Line 319  recv_missing_keys (HWND dlg, listview_ct Line 314  recv_missing_keys (HWND dlg, listview_ct
314      for (i = 0; i < n; i++) {      for (i = 0; i < n; i++) {
315          listview_get_item_text (lv, i, SL_COL_VALID, id, sizeof (id) - 1);          listview_get_item_text (lv, i, SL_COL_VALID, id, sizeof (id) - 1);
316          if (!strncmp (id, "NOKEY", 5)) {          if (!strncmp (id, "NOKEY", 5)) {
317              listview_get_item_text (lv, i, SL_COL_KEYID,              listview_get_item_text (lv, i, SL_COL_KEYID,
318                                      keyid, sizeof (keyid) -1);                                      keyid, sizeof (keyid) -1);
319              if (!hkp_recv_key (dlg, default_keyserver,              if (!hkp_recv_key (dlg, default_keyserver,
320                                 default_keyserver_port, keyid, 0, 0)) {                                 default_keyserver_port, keyid, 0, 0)) {
# Line 363  recv_single_key (HWND dlg, listview_ctrl Line 358  recv_single_key (HWND dlg, listview_ctrl
358      listview_get_item_text (lv, idx, SL_COL_KEYID, keyid, DIM (keyid)-1);            listview_get_item_text (lv, idx, SL_COL_KEYID, keyid, DIM (keyid)-1);      
359      rc = hkp_recv_key (dlg, default_keyserver,      rc = hkp_recv_key (dlg, default_keyserver,
360                         default_keyserver_port, keyid, 0, 0);                         default_keyserver_port, keyid, 0, 0);
                   
361      if (!rc)      if (!rc)
362          keycache_update (0, keyid);          keycache_update (0, keyid);
363      return rc;      return rc;
# Line 451  keysig_dlg_proc (HWND dlg, UINT msg, WPA Line 445  keysig_dlg_proc (HWND dlg, UINT msg, WPA
445              lv = NULL;              lv = NULL;
446          }          }
447          return FALSE;          return FALSE;
           
     case WM_SYSCOMMAND:  
         if (LOWORD (wparam) == SC_CLOSE)  
             EndDialog (dlg, TRUE);  
         return FALSE;  
448    
449      case WM_NOTIFY:      case WM_NOTIFY:
450          NMHDR *notify;          NMHDR *notify;
# Line 463  keysig_dlg_proc (HWND dlg, UINT msg, WPA Line 452  keysig_dlg_proc (HWND dlg, UINT msg, WPA
452          notify = (NMHDR *)lparam;          notify = (NMHDR *)lparam;
453          if (!notify)          if (!notify)
454              return FALSE;              return FALSE;
455          if (notify->code == NM_DBLCLK          if (notify->code == NM_DBLCLK &&
456              && notify->idFrom == IDC_KEYSIG_LIST)              notify->idFrom == IDC_KEYSIG_LIST)
457              do_load_keyprops (dlg, lv);              do_load_keyprops (dlg, lv);
458          if (notify->code == NM_RCLICK &&          if (notify->code == NM_RCLICK &&
459              notify->idFrom == IDC_KEYSIG_LIST &&              notify->idFrom == IDC_KEYSIG_LIST &&

Legend:
Removed from v.213  
changed lines
  Added in v.225

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26