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

Diff of /trunk/Src/wptSigTreeDlg.cpp

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

revision 193 by twoaday, Sat Apr 1 12:36:35 2006 UTC revision 304 by twoaday, Wed Mar 21 10:59:31 2007 UTC
# Line 17  Line 17 
17   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
18   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19   */   */
20    #ifdef HAVE_CONFIG_H
21    #include <config.h>
22    #endif
23    
24  #include <windows.h>  #include <windows.h>
25  #include <commctrl.h>  #include <commctrl.h>
# Line 43  BOOL CALLBACK keysig_dlg_proc (HWND dlg, Line 46  BOOL CALLBACK keysig_dlg_proc (HWND dlg,
46    
47  /* Initialize the signature tree based on the given key @key. */  /* Initialize the signature tree based on the given key @key. */
48  static void  static void
49  sigtree_load (HWND dlg, gpgme_key_t key)  sigtree_load (HWND dlg, winpt_key_t key)
50  {  {
51      TVITEM tvi;      TVITEM tvi;
52      TVINSERTSTRUCT ctx;      TVINSERTSTRUCT ctx;
53      HTREEITEM uid;      HTREEITEM uid;    
     gpgme_user_id_t u;  
54      gpgme_key_sig_t s;      gpgme_key_sig_t s;
55      gpgme_key_t signer;      winpt_key_s signer;
56      char *p;      struct native_uid_s *u;
57    
58      memset (&tvi, 0, sizeof (tvi));      memset (&tvi, 0, sizeof (tvi));
59      memset (&ctx, 0, sizeof (ctx));      memset (&ctx, 0, sizeof (ctx));
60      for (u=key->uids; u; u = u->next) {      for (u=key->ext->uids; u; u = u->next) {
61          if (u->revoked)          if (u->revoked)
62              continue;              continue;
63          p = utf8_to_native (u->uid);          tvi.pszText = u->uid;
         tvi.pszText = p;  
64          tvi.state = TVIS_BOLD;          tvi.state = TVIS_BOLD;
65          tvi.mask = TVIF_TEXT;          tvi.mask = TVIF_TEXT;
66          tvi.iImage = 0;          tvi.iImage = 0;
# Line 67  sigtree_load (HWND dlg, gpgme_key_t key) Line 68  sigtree_load (HWND dlg, gpgme_key_t key)
68          ctx.hParent = TVI_ROOT;          ctx.hParent = TVI_ROOT;
69          ctx.item = tvi;          ctx.item = tvi;
70          uid = TreeView_InsertItem (dlg, &ctx);          uid = TreeView_InsertItem (dlg, &ctx);
         safe_free (p);  
71          for (s = u->signatures; s; s=s->next) {          for (s = u->signatures; s; s=s->next) {
72              if (get_pubkey (s->keyid+8, &signer))              memset (&signer, 0, sizeof (signer));
73                if (winpt_get_pubkey (s->keyid+8, &signer))
74                  continue;                  continue;
75              p = utf8_to_native (signer->uids->uid);              tvi.pszText = signer.ext->uids->uid;
             tvi.pszText = p;  
76              tvi.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;              tvi.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
77              tvi.iImage = 1;              tvi.iImage = 1;
78              tvi.iSelectedImage = 1;              tvi.iSelectedImage = 1;
79              tvi.lParam = (LPARAM)s;              tvi.lParam = (LPARAM)s;
80              ctx.hParent = uid;              ctx.hParent = uid;
81              ctx.item = tvi;              ctx.item = tvi;
82                /* XXX: mark non exportable sigs */
83              TreeView_InsertItem (dlg, &ctx);              TreeView_InsertItem (dlg, &ctx);
             safe_free (p);  
84          }          }
85      }      }
86  }  }
# Line 104  treeview_set_image_list (HWND tree, HICO Line 104  treeview_set_image_list (HWND tree, HICO
104    
105    
106  static void  static void
107  create_popup (HWND dlg)  show_popup (HWND dlg)
108  {  {
109      HMENU hm;      HMENU hm;
110      POINT p;      POINT p;
# Line 119  create_popup (HWND dlg) Line 119  create_popup (HWND dlg)
119  }  }
120    
121    
122    /* Get the signature properties for the selected item. */
123  static void  static void
124  show_sigprops (HWND dlg)  show_sigprops (HWND dlg)
125  {  {
# Line 142  show_sigprops (HWND dlg) Line 143  show_sigprops (HWND dlg)
143  BOOL CALLBACK  BOOL CALLBACK
144  sigtree_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  sigtree_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
145  {  {
146      static winpt_key_t key;      static winpt_key_t key;    
     static HWND tree;  
147      static HIMAGELIST hil;      static HIMAGELIST hil;
148        HWND tree;
149      HICON ico[2];      HICON ico[2];
150      NMHDR *nft;      NMHDR *nft;
151      char inf[300], *p;      char inf[300];
152    
153      switch (msg) {      switch (msg) {
154      case WM_INITDIALOG:      case WM_INITDIALOG:
# Line 158  sigtree_dlg_proc (HWND dlg, UINT msg, WP Line 159  sigtree_dlg_proc (HWND dlg, UINT msg, WP
159          ico[1] = LoadIcon (glob_hinst, (LPCTSTR)IDI_KEY_SIG);          ico[1] = LoadIcon (glob_hinst, (LPCTSTR)IDI_KEY_SIG);
160          tree = GetDlgItem (dlg, IDC_VKEYSIG_TREE);          tree = GetDlgItem (dlg, IDC_VKEYSIG_TREE);
161          hil = treeview_set_image_list (tree, ico, 2);          hil = treeview_set_image_list (tree, ico, 2);
162          sigtree_load (tree, key->ctx);          sigtree_load (tree, key);
163          p = utf8_to_native (key->ctx->uids->name);          _snprintf (inf, DIM (inf)-1,
         _snprintf (inf, sizeof (inf)-1,  
164                     _("Signature Tree for \"%s\" (0x%s)"),                     _("Signature Tree for \"%s\" (0x%s)"),
165                     p, key->ctx->subkeys->keyid+8);                     key->ext->uids->name, key->ctx->subkeys->keyid+8);
         safe_free (p);  
166          SetDlgItemText (dlg, IDC_VKEYSIG_EDIT, _("Edit..."));          SetDlgItemText (dlg, IDC_VKEYSIG_EDIT, _("Edit..."));
167          SetWindowText (dlg, inf);          SetWindowText (dlg, inf);
168          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
# Line 178  sigtree_dlg_proc (HWND dlg, UINT msg, WP Line 177  sigtree_dlg_proc (HWND dlg, UINT msg, WP
177          if (nft->code == NM_DBLCLK)          if (nft->code == NM_DBLCLK)
178              show_sigprops (dlg);              show_sigprops (dlg);
179          else if (nft->code == NM_RCLICK)          else if (nft->code == NM_RCLICK)
180              create_popup (dlg);              show_popup (dlg);
181          break;          break;
182    
183      case WM_COMMAND:      case WM_COMMAND:

Legend:
Removed from v.193  
changed lines
  Added in v.304

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26