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

Diff of /trunk/Src/wptKeylist.cpp

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

revision 99 by twoaday, Fri Nov 25 07:47:51 2005 UTC revision 105 by twoaday, Wed Nov 30 10:22:00 2005 UTC
# Line 41  Line 41 
41    
42  #define key_is_useable(key) (!(key)->revoked && !(key)->expired && !(key)->disabled)  #define key_is_useable(key) (!(key)->revoked && !(key)->expired && !(key)->disabled)
43    
 static struct listview_column_s klist_enc[] = {  
     {0, 242, (char *)_("User ID")},  
     {1, 80, (char *)_("Key ID")},  
     {3, 46, (char *)_("Size")},  
     {4, 50, (char *)_("Cipher")},  
     {5, 70, (char *)_("Validity")},  
     {0, 0, NULL}  
 };  
 #define KLIST_ENC_ITEMS (DIM(klist_enc) -1)  
   
 static struct listview_column_s klist[] = {  
     {0, 242, (char *)_("User ID")},  
     {1, 78, (char *)_("Key ID")},  
     {2, 52, (char *)_("Type")},      
     {3, 68, (char *)_("Size")},  
     {4, 66, (char *)_("Cipher")},  
     {5, 70, (char *)_("Validity")},  
     {6, 40, (char *)_("Trust")},  
     {7, 72, (char *)_("Creation")},  
     {0, 0, NULL}  
 };  
 #define KLIST_ITEMS (DIM(klist) - 1)  
   
44  struct key_array_s {  struct key_array_s {
45      char keyid[32];      char keyid[32];
46      int checked;      int checked;
# Line 380  get_key_status (gpgme_key_t key, int uid Line 357  get_key_status (gpgme_key_t key, int uid
357      if (uididx < 0 || count_userids (key) > uididx)      if (uididx < 0 || count_userids (key) > uididx)
358          uididx = 0;          uididx = 0;
359      if (listmode) {      if (listmode) {
360          const char *s;          const char *s;
361                  
362          if (key->revoked)          if (key->revoked)
363              s = _("Revoked");              s = _("Revoked");
364          else if (key->expired)          else if (key->expired)
365              s = _("Expired");              s = _("Expired");
366          else if (key->disabled)          else if (key->disabled)
367              s = _("Disabled");              s = _("Disabled");
368          else          else
369            s = "";              s = "";
370                    
371          /* if the key has a special status, we don't continue to figure out          /* if the key has a special status, we don't continue to figure out
372             what any user-id validities. */             what any user-id validities. */
373          if (*s)          if (*s)
# Line 545  keylist_add_groups( listview_ctrl_t lv ) Line 522  keylist_add_groups( listview_ctrl_t lv )
522  static int  static int
523  keylist_build (listview_ctrl_t *r_lv, HWND ctrl, int mode)  keylist_build (listview_ctrl_t *r_lv, HWND ctrl, int mode)
524  {  {
525        struct listview_column_s klist_enc[] = {
526        {0, 242, (char *)_("User ID")},
527        {1, 80, (char *)_("Key ID")},
528        {3, 46, (char *)_("Size")},
529        {4, 50, (char *)_("Cipher")},
530        {5, 70, (char *)_("Validity")},
531        {0, 0, NULL}
532        };
533    
534        struct listview_column_s klist[] = {
535        {0, 242, (char *)_("User ID")},
536        {1, 78, (char *)_("Key ID")},
537        {2, 52, (char *)_("Type")},    
538        {3, 68, (char *)_("Size")},
539        {4, 66, (char *)_("Cipher")},
540        {5, 70, (char *)_("Validity")},
541        {6, 40, (char *)_("Trust")},
542        {7, 72, (char *)_("Creation")},
543        {0, 0, NULL}
544        };
545    
546      listview_ctrl_t lv;      listview_ctrl_t lv;
547      listview_column_t col;      listview_column_t col;
548      int j, n = 0;      int j, n = 0;
549        int kl_nolist = 0;
550      int rc = 0;      int rc = 0;
551            
552      rc = listview_new (&lv);      rc = listview_new (&lv);
553      if( rc )      if (rc)
554          return rc;          return rc;
555            
556      lv->ctrl = ctrl;      lv->ctrl = ctrl;
557      if ((mode & KEYLIST_ENCRYPT) || (mode & KEYLIST_ENCRYPT_MIN)) {      if ((mode & KEYLIST_ENCRYPT) || (mode & KEYLIST_ENCRYPT_MIN)) {
558          col = klist_enc;          col = klist_enc;
559          n = KLIST_ENC_ITEMS;          n = (DIM(klist_enc) -1);
560      }        }  
561      else if ((mode & KEYLIST_SIGN)) {      else if ((mode & KEYLIST_SIGN)) {
562          col = klist_enc;          col = klist_enc;
563          n = KLIST_ENC_ITEMS - 1;          n = (DIM(klist_enc) - 1) - 1;
564      }      }
565      else {      else {
566          col = klist;          col = klist;
567          n = KLIST_ITEMS;          n = (DIM(klist) - 1);
568      }      }
569            
570      for( j = 0; j < n; j++ )          for( j = 0; j < n; j++ )    
# Line 703  do_addkey (listview_ctrl_t lv, gpgme_key Line 702  do_addkey (listview_ctrl_t lv, gpgme_key
702          if (!u || u->revoked || uididx < 0)          if (!u || u->revoked || uididx < 0)
703              uididx = 0; /* fixme: this happen sometimes but it's illegal! (<0) */              uididx = 0; /* fixme: this happen sometimes but it's illegal! (<0) */
704          u = get_nth_userid (key, uididx);          u = get_nth_userid (key, uididx);
         /*attr = key->uids->uid; XXX*/  
705          attr = u->uid;          attr = u->uid;
706      }      }
707      if (attr == NULL || strlen (attr) < 5) { /* normal userids are >= 5 chars */      if (attr == NULL || strlen (attr) < 5) { /* normal userids are >= 5 chars */

Legend:
Removed from v.99  
changed lines
  Added in v.105

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26