/[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 190 by twoaday, Mon Mar 27 10:05:14 2006 UTC revision 208 by twoaday, Mon May 1 12:22:18 2006 UTC
# Line 29  Line 29 
29  #include "wptCommonCtl.h"  #include "wptCommonCtl.h"
30  #include "wptContext.h"  #include "wptContext.h"
31  #include "wptUTF8.h"  #include "wptUTF8.h"
32    #include "wptW32API.h"
33    
34    
35  /* ID to display signature properties. */  /* ID to display signature properties. */
# Line 42  BOOL CALLBACK keysig_dlg_proc (HWND dlg, Line 43  BOOL CALLBACK keysig_dlg_proc (HWND dlg,
43    
44  /* Initialize the signature tree based on the given key @key. */  /* Initialize the signature tree based on the given key @key. */
45  static void  static void
46  sigtree_load (HWND dlg, gpgme_key_t key)  sigtree_load (HWND dlg, winpt_key_t key)
47  {  {
48      TVITEM tvi;      TVITEM tvi;
49      TVINSERTSTRUCT ctx;      TVINSERTSTRUCT ctx;
50      HTREEITEM uid;      HTREEITEM uid;    
     gpgme_user_id_t u;  
51      gpgme_key_sig_t s;      gpgme_key_sig_t s;
52      gpgme_key_t signer;      winpt_key_s signer;
53      char *p;      struct native_uid_s *u;
54    
55      memset (&tvi, 0, sizeof (tvi));      memset (&tvi, 0, sizeof (tvi));
56      memset (&ctx, 0, sizeof (ctx));      memset (&ctx, 0, sizeof (ctx));
57      for (u=key->uids; u; u = u->next) {      for (u=key->ext->uids; u; u = u->next) {
58          if (u->revoked)          if (u->revoked)
59              continue;              continue;
60          p = utf8_to_native (u->uid);          tvi.pszText = u->uid;
         tvi.pszText = p;  
61          tvi.state = TVIS_BOLD;          tvi.state = TVIS_BOLD;
62          tvi.mask = TVIF_TEXT;          tvi.mask = TVIF_TEXT;
63          tvi.iImage = 0;          tvi.iImage = 0;
# Line 66  sigtree_load (HWND dlg, gpgme_key_t key) Line 65  sigtree_load (HWND dlg, gpgme_key_t key)
65          ctx.hParent = TVI_ROOT;          ctx.hParent = TVI_ROOT;
66          ctx.item = tvi;          ctx.item = tvi;
67          uid = TreeView_InsertItem (dlg, &ctx);          uid = TreeView_InsertItem (dlg, &ctx);
         safe_free (p);  
68          for (s = u->signatures; s; s=s->next) {          for (s = u->signatures; s; s=s->next) {
69              if (get_pubkey (s->keyid+8, &signer))              memset (&signer, 0, sizeof (signer));
70                if (winpt_get_pubkey (s->keyid+8, &signer))
71                  continue;                  continue;
72              p = utf8_to_native (signer->uids->uid);              tvi.pszText = signer.ext->uids->uid;
             tvi.pszText = p;  
73              tvi.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;              tvi.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
74              tvi.iImage = 1;              tvi.iImage = 1;
75              tvi.iSelectedImage = 1;              tvi.iSelectedImage = 1;
# Line 79  sigtree_load (HWND dlg, gpgme_key_t key) Line 77  sigtree_load (HWND dlg, gpgme_key_t key)
77              ctx.hParent = uid;              ctx.hParent = uid;
78              ctx.item = tvi;              ctx.item = tvi;
79              TreeView_InsertItem (dlg, &ctx);              TreeView_InsertItem (dlg, &ctx);
             safe_free (p);  
80          }          }
81      }      }
82  }  }
# Line 106  static void Line 103  static void
103  create_popup (HWND dlg)  create_popup (HWND dlg)
104  {  {
105      HMENU hm;      HMENU hm;
     MENUITEMINFO mi;  
106      POINT p;      POINT p;
     char *s;  
107    
108      hm = CreatePopupMenu ();      hm = CreatePopupMenu ();
109      if (!hm)      if (!hm)
110          BUG( NULL );          BUG (0);
111      memset (&mi, 0, sizeof mi);      insert_menu_item (hm, 0, _ID_SIGCTX_PROPS, _("Signature &Properties"));
     mi.cbSize = sizeof mi;  
     s = (char *)_("Signature &Properties");  
     mi.fType = MF_STRING;  
     mi.dwTypeData = s;  
     mi.cch = strlen (s);  
     mi.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE;  
     mi.wID = _ID_SIGCTX_PROPS;  
     InsertMenuItem (hm, 0, FALSE, &mi);  
112      GetCursorPos (&p);      GetCursorPos (&p);
113      TrackPopupMenu (hm, 0, p.x, p.y, 0, dlg, NULL);      TrackPopupMenu (hm, 0, p.x, p.y, 0, dlg, NULL);
114      DestroyMenu (hm);      DestroyMenu (hm);
# Line 151  show_sigprops (HWND dlg) Line 138  show_sigprops (HWND dlg)
138  BOOL CALLBACK  BOOL CALLBACK
139  sigtree_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  sigtree_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
140  {  {
141      static winpt_key_t key;      static winpt_key_t key;    
     static HWND tree;  
142      static HIMAGELIST hil;      static HIMAGELIST hil;
143        HWND tree;
144      HICON ico[2];      HICON ico[2];
145      NMHDR *nft;      NMHDR *nft;
146      char inf[256], *p;      char inf[300];
147    
148      switch (msg) {      switch (msg) {
149      case WM_INITDIALOG:      case WM_INITDIALOG:
# Line 167  sigtree_dlg_proc (HWND dlg, UINT msg, WP Line 154  sigtree_dlg_proc (HWND dlg, UINT msg, WP
154          ico[1] = LoadIcon (glob_hinst, (LPCTSTR)IDI_KEY_SIG);          ico[1] = LoadIcon (glob_hinst, (LPCTSTR)IDI_KEY_SIG);
155          tree = GetDlgItem (dlg, IDC_VKEYSIG_TREE);          tree = GetDlgItem (dlg, IDC_VKEYSIG_TREE);
156          hil = treeview_set_image_list (tree, ico, 2);          hil = treeview_set_image_list (tree, ico, 2);
157          sigtree_load (tree, key->ctx);          sigtree_load (tree, key);
158          p = utf8_to_native (key->ctx->uids->uid);          _snprintf (inf, sizeof (inf)-1,
159          _snprintf (inf, sizeof (inf)-1, _("Signature Tree for \"%s\""), p);                     _("Signature Tree for \"%s\" (0x%s)"),
160          safe_free (p);                     key->ext->uids->uid, key->ctx->subkeys->keyid+8);
161          SetDlgItemText (dlg, IDC_VKEYSIG_EDIT, _("Edit..."));          SetDlgItemText (dlg, IDC_VKEYSIG_EDIT, _("Edit..."));
162          SetWindowText (dlg, inf);          SetWindowText (dlg, inf);
163          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);

Legend:
Removed from v.190  
changed lines
  Added in v.208

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26