/[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 25 by twoaday, Wed Oct 12 10:04:26 2005 UTC revision 26 by twoaday, Mon Oct 17 08:49:30 2005 UTC
# Line 65  struct key_array_s { Line 65  struct key_array_s {
65      int checked;      int checked;
66  };  };
67    
68  static int find_secret_key( gpgme_key_t key );  static int find_secret_key (gpgme_key_t key);
69    
70    
71  static key_array_s*  static key_array_s*
# Line 247  get_key_expire_date (long timestamp) Line 247  get_key_expire_date (long timestamp)
247  const char*  const char*
248  get_key_type (gpgme_key_t key)  get_key_type (gpgme_key_t key)
249  {  {
250      if (find_secret_key (key))      int type = find_secret_key (key);
251    
252        if (type == 1)
253          return _("Key Pair");          return _("Key Pair");
254        else if (type == 2)
255            return _("Key Pair (Card)");
256      return _("Public Key");      return _("Public Key");
257  } /* get_key_type */  } /* get_key_type */
258    
# Line 615  keylist_delete( listview_ctrl_t lv ) Line 619  keylist_delete( listview_ctrl_t lv )
619    
620    
621  static int  static int
622  find_secret_key( gpgme_key_t key )  find_secret_key (gpgme_key_t key)
623  {  {
624      const char * keyid;      const char *keyid;
625      gpgme_key_t skey;        winpt_key_s skey;
626        
627        memset (&skey, 0, sizeof (skey));
628      keyid = key->subkeys->keyid;      keyid = key->subkeys->keyid;
629      if (!keyid)      if (!keyid)
630          return 0;          return 0;
631      get_seckey (keyid, &skey);      winpt_get_seckey (keyid, &skey);
632      return skey? 1 : 0;      if (skey.ext && skey.ext->gloflags.divert_to_card)
633            return 2;
634        return skey.ctx? 1 : 0;
635  } /* find_secret_key */  } /* find_secret_key */
636    
637    
# Line 687  do_addkey (listview_ctrl_t lv, gpgme_key Line 694  do_addkey (listview_ctrl_t lv, gpgme_key
694          listview_add_sub_item( lv, 0, idx++, fmt );          listview_add_sub_item( lv, 0, idx++, fmt );
695      }      }
696      if (list > 0) {      if (list > 0) {
697          attr = find_secret_key (key)? "pub/sec" : "pub";          key_attr = find_secret_key (key);
698          if (strchr( attr, '/')) {          if (!key_attr)
699              struct winpt_key_s k;              attr = "pub";
700              winpt_get_seckey (key->subkeys->keyid, &k);          else
701              if (k.ext->gloflags.divert_to_card)              attr = key_attr == 1? "pub/sec" : "pub/crd";
702                  attr = "pub/crd";          listview_add_sub_item (lv, 0, idx++, attr);
         }  
         listview_add_sub_item( lv, 0, idx++, attr );  
703      }      }
704      if (lv->cols >= 2) {      if (lv->cols >= 2) {
705          attr = get_key_size (key, list == -1? keyidx+1 : 0);          attr = get_key_size (key, list == -1? keyidx+1 : 0);

Legend:
Removed from v.25  
changed lines
  Added in v.26

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26