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

Diff of /trunk/Src/wptKeyPropsDlg.cpp

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

revision 365 by twoaday, Fri Sep 25 16:07:38 2009 UTC revision 366 by twoaday, Tue Dec 6 12:32:08 2011 UTC
# Line 32  Line 32 
32  #include "wptW32API.h"  #include "wptW32API.h"
33  #include "wptVersion.h"  #include "wptVersion.h"
34  #include "wptKeyEdit.h"  #include "wptKeyEdit.h"
35    #include "StringBuffer.h"
36    
37    
38  /* Context to store associated data of the dialog. */  /* Context to store associated data of the dialog. */
# Line 46  struct prop_info_s { Line 47  struct prop_info_s {
47  static int  static int
48  do_check_key (gpgme_key_t key)  do_check_key (gpgme_key_t key)
49  {  {
50      int invalid;      int invalid = key->expired;
   
     invalid = key->expired;  
51      if (!invalid)      if (!invalid)
52          invalid = key->revoked;          invalid = key->revoked;
53      return invalid;      return invalid;
# Line 79  ownertrust_to_string (int val, bool is_k Line 78  ownertrust_to_string (int val, bool is_k
78      return inf;      return inf;
79  }  }
80    
81    /* Generate a temporary name for the photo ID */
82  int  int
83  get_photo_tmpname (gpgme_key_t key, char *buf, size_t buflen)  get_photo_tmpname (gpgme_key_t key, char *buf, size_t buflen)
84  {  {
# Line 102  key_load_photo (winpt_key_t key, Line 101  key_load_photo (winpt_key_t key,
101                  char *photo_file, size_t photo_file_size,                  char *photo_file, size_t photo_file_size,
102                  gpgme_validity_t *r_valid)                  gpgme_validity_t *r_valid)
103  {  {
104      FILE *fp;      const BYTE *img = key->ext->attrib.d;
105      const BYTE *img;      DWORD imglen = key->ext->attrib.len;
     DWORD imglen;  
       
     img = key->ext->attrib.d;  
     imglen = key->ext->attrib.len;  
106      if (img && !key->ext->attrib.validity)      if (img && !key->ext->attrib.validity)
107          get_uat_validity (key->ctx->subkeys->keyid,          get_uat_validity (key->ctx->subkeys->keyid,
108                            &key->ext->attrib.validity);                            &key->ext->attrib.validity);
# Line 118  key_load_photo (winpt_key_t key, Line 113  key_load_photo (winpt_key_t key,
113          return -1;          return -1;
114                            
115      get_photo_tmpname (key->ctx, photo_file, photo_file_size);      get_photo_tmpname (key->ctx, photo_file, photo_file_size);
116      fp = fopen (photo_file, "wb");      FILE *fp = fopen (photo_file, "wb");
117      if (fp != NULL) {      if (fp == NULL)
118          const int pos = 16;          return -1;
         fwrite (img + pos, 1, imglen - pos, fp);  
         fclose (fp);  
         return 0;  
     }  
119            
120      return -1;          const int HEADER_OFF = 16;
121        fwrite (img + HEADER_OFF, 1, imglen - HEADER_OFF, fp);
122        fclose (fp);
123        return 0;
124  }  }
125    
126    
# Line 248  on_init_dialog (HWND dlg, WPARAM wparam, Line 242  on_init_dialog (HWND dlg, WPARAM wparam,
242  {  {
243      winpt_key_t k = (winpt_key_t)lparam;      winpt_key_t k = (winpt_key_t)lparam;
244      assert (k != NULL);      assert (k != NULL);
245      SetWindowText (dlg, _("Key Properties"));  
246        StringBuffer s = _("Key Properties");
247        if (k->ext->key->revoked)
248            s += " - REVOKED KEY";
249        
250        SetWindowText (dlg, s.getBuffer());
251      SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change"));      SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change"));
252      SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers"));      SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers"));
253      SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Password"));      SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Password"));

Legend:
Removed from v.365  
changed lines
  Added in v.366

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26