/[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 73 by twoaday, Tue Nov 8 07:15:13 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 342  get_key_trust2 (gpgme_key_t key, int val Line 319  get_key_trust2 (gpgme_key_t key, int val
319      switch (val) {      switch (val) {
320      case GPGME_VALIDITY_UNKNOWN:      case GPGME_VALIDITY_UNKNOWN:
321      case GPGME_VALIDITY_UNDEFINED:          case GPGME_VALIDITY_UNDEFINED:    
322          return "None";          return _("None");
323      case GPGME_VALIDITY_NEVER:          case GPGME_VALIDITY_NEVER:    
324          return "Never";          return _("Never");
325      case GPGME_VALIDITY_MARGINAL:      case GPGME_VALIDITY_MARGINAL:
326          return "Marginal";          return _("Marginal");
327      case GPGME_VALIDITY_FULL:      case GPGME_VALIDITY_FULL:
328      case GPGME_VALIDITY_ULTIMATE:      case GPGME_VALIDITY_ULTIMATE:
329          return "Full";          return _("Full");
330      }      }
331      return "";      return "";
332  }  }
# 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 */
# Line 816  keylist_add_key (listview_ctrl_t lv, int Line 814  keylist_add_key (listview_ctrl_t lv, int
814      gpgme_subkey_t k;      gpgme_subkey_t k;
815    
816      /* if the entire key is disabled, just return. */      /* if the entire key is disabled, just return. */
817      if (key->disabled)      if (key->disabled && !(mode & KEYLIST_LIST))
818          return 0;          return 0;
819    
820      for (k=key->subkeys, i = 0; i < count_subkeys (key); i++, k=k->next) {      for (k=key->subkeys, i = 0; i < count_subkeys (key); i++, k=k->next) {
# Line 882  keylist_sort (listview_ctrl_t lv, int so Line 880  keylist_sort (listview_ctrl_t lv, int so
880  static int  static int
881  key_check_validity (const char *validity)  key_check_validity (const char *validity)
882  {      {    
883      if (strstr (validity, "Unknown") ||      if (strstr (validity, _("Unknown")) ||
884          strstr (validity, "Undefined") ||          strstr (validity, _("Undefined")) ||
885          strstr (validity, "Never") ||          strstr (validity, _("Never")) ||
886          strstr (validity, "None"))          strstr (validity, _("None")))
887          return 0;            return 0;  
888      return 1;      return 1;
889  }  }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26