[Winpt-commits] r212 - trunk/Src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue May 9 12:29:09 CEST 2006


Author: twoaday
Date: 2006-05-09 12:29:07 +0200 (Tue, 09 May 2006)
New Revision: 212

Modified:
   trunk/Src/ChangeLog
   trunk/Src/wptClipSignDlg.cpp
   trunk/Src/wptGPGME.cpp
   trunk/Src/wptGPGParser.cpp
   trunk/Src/wptKeyEditDlgs.cpp
   trunk/Src/wptKeyManager.cpp
   trunk/Src/wptKeyManagerDlg.cpp
   trunk/Src/wptKeyPropsDlg.cpp
   trunk/Src/wptKeyRevokersDlg.cpp
   trunk/Src/wptKeysigDlg.cpp
   trunk/Src/wptKeysignDlg.cpp
Log:



Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/ChangeLog	2006-05-09 10:29:07 UTC (rev 212)
@@ -1,3 +1,7 @@
+2006-05-09  Timo Schulz  <ts at g10code.de>
+
+	* wptKeyRevokersDlg.cpp (revokelist_build): Store key ptr.
+	
 2006-05-07  Timo Schulz  <ts at g10code.de>
 
 	* wptKeyserverDlg.cpp (hkp_err_box): Improved.
@@ -4,6 +8,8 @@
 	* wptKeyserver.cpp (wsock_strerror): Likewise.
 	* wptKeygenCBDlg.cpp (keygen_cb_dlg_destroy): New param.
 	Change all callers.
+	* wptKeysigDlg.cpp (do_load_keyprops): Correct key update
+	problem.
 	
 2006-05-06  Timo Schulz  <ts at g10code.de>
 

Modified: trunk/Src/wptClipSignDlg.cpp
===================================================================
--- trunk/Src/wptClipSignDlg.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptClipSignDlg.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -62,13 +62,12 @@
     if (err)
         return err;
 
-    get_pubkey (keyid, &key);
-    if (key)
-	err = gpgme_signers_add (ctx, key);
-    else {
-	err = gpg_error (GPG_ERR_NO_PUBKEY);
+    err = get_pubkey (keyid, &key);
+    if (err)
 	goto leave;
-    }
+    err = gpgme_signers_add (ctx, key);
+    if (err)
+	goto leave;
     err = gpgme_data_new (&sig);
     if (err)
 	goto leave;	

Modified: trunk/Src/wptGPGME.cpp
===================================================================
--- trunk/Src/wptGPGME.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptGPGME.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -217,8 +217,8 @@
     k->is_v3 = k->ctx->subkeys->pubkey_algo == GPGME_PK_RSA && 
 		strlen (k->ctx->subkeys->fpr) == 32;
     k->is_protected = k->ext->gloflags.is_protected;
-    k->keyid = k->ctx->subkeys->keyid;
-    k->uid = k->ctx->uids->uid;
+    k->keyid = k->ctx->subkeys->keyid+8;
+    k->uid = k->ext->uids->uid;
     return 0;
 }
 
@@ -234,8 +234,8 @@
     k->is_v3 = k->ctx->subkeys->pubkey_algo == GPGME_PK_RSA && 
 		strlen (k->ctx->subkeys->fpr) == 32;
     k->is_protected = k->ext->gloflags.is_protected;
-    k->keyid = k->ctx->subkeys->keyid;
-    k->uid = k->ctx->uids->uid;
+    k->keyid = k->ctx->subkeys->keyid+8;
+    k->uid = k->ext->uids->uid;
     return 0;
 }
 

Modified: trunk/Src/wptGPGParser.cpp
===================================================================
--- trunk/Src/wptGPGParser.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptGPGParser.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -53,7 +53,7 @@
     e = new gpg_option_s;
     if (!e)
 	BUG (0);
-    memset (e, 0, sizeof (e));
+    memset (e, 0, sizeof *e);
     return e;
 }
 
@@ -241,7 +241,7 @@
 	return;
     free_if_alloc (opt->name);
     free_if_alloc (opt->val);
-    free_if_alloc (opt );
+    free_if_alloc (opt);
 }
 
 

Modified: trunk/Src/wptKeyEditDlgs.cpp
===================================================================
--- trunk/Src/wptKeyEditDlgs.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptKeyEditDlgs.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -2203,8 +2203,8 @@
 	    case CMD_LSIGN: do_editkey_sign_userid (k, dlg, 
 						    lvuid, cmd);
 			    break;
-	    case CMD_CLEAN: do_editkey_clean (k, dlg);
-	    case CMD_MINIMIZE: do_editkey_minimize (k, dlg);
+	    case CMD_CLEAN: do_editkey_clean (k, dlg); break;
+	    case CMD_MINIMIZE: do_editkey_minimize (k, dlg); break;
 	    }
 	    break;
 	    

Modified: trunk/Src/wptKeyManager.cpp
===================================================================
--- trunk/Src/wptKeyManager.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptKeyManager.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -701,13 +701,10 @@
     rset = (gpgme_key_t *)calloc (i+1, sizeof (gpgme_key_t));
     if (!rset)
 	BUG (NULL);
-    memset (&key2, 0, sizeof (key2));
     for (i = 0; i < n; i++) {
-	
+        if (listview_get_item_state(lv, i)) {
+	    km_get_key (lv, i, &key2);
 
-        if (listview_get_item_state(lv, i)) {	    
-	    key2.ctx = km_get_key_ptr (lv, i, &key2.ext);
-
 	    seckey_type = km_check_for_seckey (lv, i, NULL);
             if (confirm && !seckey_type) {
 		p = km_key_get_info (&key2, 0);
@@ -779,7 +776,7 @@
 km_send_to_keyserver (listview_ctrl_t lv, HWND dlg, 
 		      const char *host, WORD port)
 {
-    gpgme_key_t key;
+    winpt_key_s key;
     int id;
     
     id = listview_get_curr_pos (lv);
@@ -788,12 +785,12 @@
 	return WPTERR_GENERAL;
     }
 
-    key = km_get_key_ptr (lv, id, NULL);
+    km_get_key (lv, id, &key);
     id = log_box (_("Key Manager"), MB_YESNO,
 		  _("Do you really want to send '0x%s' to keyserver %s?"),
-		    key->subkeys->keyid+8, host);
+		  key.keyid, host);
     if (id == IDYES)
-        hkp_send_key (dlg, host, port, key->subkeys->keyid+8);
+        hkp_send_key (dlg, host, port, key.keyid);
 
     return 0;
 }

Modified: trunk/Src/wptKeyManagerDlg.cpp
===================================================================
--- trunk/Src/wptKeyManagerDlg.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptKeyManagerDlg.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -1586,6 +1586,8 @@
                               _("Key Signature List"), IDS_WINPT_KEYSIG);
 	    if (k.update)
 		update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 0);
+	    if (updated_keys_avail ())
+		refresh_keylist (kmi);
             return TRUE;
             
         case ID_KEYMISC_PROPS:	    

Modified: trunk/Src/wptKeyPropsDlg.cpp
===================================================================
--- trunk/Src/wptKeyPropsDlg.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptKeyPropsDlg.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -274,7 +274,7 @@
 BOOL CALLBACK
 keyprops_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
-    static winpt_key_t k;
+    static winpt_key_t k = NULL;
     gpgme_validity_t valid;
     const char *inf;
     int rc;

Modified: trunk/Src/wptKeyRevokersDlg.cpp
===================================================================
--- trunk/Src/wptKeyRevokersDlg.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptKeyRevokersDlg.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -39,9 +39,9 @@
 #include "wptVersion.h"
 #include "wptKeyEdit.h"
 #include "wptKeylist.h"
-#include "wptUTF8.h"
+#include "wptKeyManager.h"
 
-
+/* symbolic column IDs */
 enum revoke_col_t {
     REV_COL_NAME    = 0,
     REV_COL_KEYID   = 1,
@@ -129,7 +129,7 @@
 	else
 	    uid = revkey.ext->uids->name;
 	_snprintf (keyid, sizeof (keyid)-1, "0x%s", r->fpr+32);
-	listview_add_item (lv, "");
+	listview_add_item2 (lv, "", revkey.ext);
 	alg = get_key_pubalgo (r->pubkey_algo);
 	listview_add_sub_item (lv, 0, REV_COL_ALGO, alg);
 	listview_add_sub_item (lv, 0, REV_COL_KEYID, keyid);
@@ -169,6 +169,7 @@
 	if (notify && notify->code == (UINT)NM_DBLCLK && 
 	    notify->idFrom == IDC_KEYREVOKERS_LIST) {
 	    int idx = listview_get_curr_pos (lv);
+
 	    listview_get_item_text (lv, idx, REV_COL_KEYID, keyid, DIM (keyid)-1);
 	    listview_get_item_text (lv, idx, REV_COL_NAME, buf, sizeof (buf)-1);
 	    if (!strcmp (buf, _("user ID not found"))) {
@@ -192,8 +193,9 @@
 	    }
 	    else {
 		struct winpt_key_s k;
+
 		memset (&k, 0, sizeof k);
-		k.keyid = keyid;
+		km_get_key (lv, idx, &k);
 		DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYPROPS, dlg,
 				keyprops_dlg_proc, (LPARAM)&k);
 	    }

Modified: trunk/Src/wptKeysigDlg.cpp
===================================================================
--- trunk/Src/wptKeysigDlg.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptKeysigDlg.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -375,7 +375,6 @@
 do_load_keyprops (HWND dlg, listview_ctrl_t lv)
 {
     winpt_key_s k;
-    gpgme_key_t key;
     char keyid[32] = {0};
     char status[64] = {0}, creation[64] = {0};
     int n = listview_get_curr_pos (lv);
@@ -392,13 +391,12 @@
 	    return;
     }
     
-    if ((strlen (keyid) < 3 ||get_pubkey (keyid, &key))) {
+    memset (&k, 0, sizeof k);
+    if ((strlen (keyid) < 3 || winpt_get_pubkey (keyid, &k))) {
 	if (strlen (creation) > 0)
 	    msg_box (dlg, _("Key not found in keyring."), _("Key Manager"), MB_INFO);
 	return;
     }
-    memset (&k, 0, sizeof k);
-    k.keyid = keyid;
     DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYPROPS, dlg,
 		    keyprops_dlg_proc, (LPARAM)&k);
 }
@@ -528,6 +526,10 @@
 	    }
 	    return TRUE;
             
+	case IDCANCEL:
+	    EndDialog (dlg, FALSE);
+	    return TRUE;
+
         case IDOK:
             EndDialog (dlg, TRUE);
             return TRUE;

Modified: trunk/Src/wptKeysignDlg.cpp
===================================================================
--- trunk/Src/wptKeysignDlg.cpp	2006-05-07 12:36:48 UTC (rev 211)
+++ trunk/Src/wptKeysignDlg.cpp	2006-05-09 10:29:07 UTC (rev 212)
@@ -139,12 +139,13 @@
 static void
 do_check_protection (HWND dlg)
 {
-    int idx, protec;
     gpgme_key_t key;
     struct winpt_key_s k;
+    int idx, protec;    
 
-    idx = SendDlgItemMessage( dlg, IDC_KEYSIGN_KEYLIST, CB_GETCURSEL, 0, 0 );
-    key = (gpgme_key_t)SendDlgItemMessage( dlg, IDC_KEYSIGN_KEYLIST, CB_GETITEMDATA, (WPARAM)idx, 0 );
+    idx = SendDlgItemMessage (dlg, IDC_KEYSIGN_KEYLIST, CB_GETCURSEL, 0, 0);
+    key = (gpgme_key_t)SendDlgItemMessage (dlg, IDC_KEYSIGN_KEYLIST, 
+					   CB_GETITEMDATA, (WPARAM)idx, 0);
     if (key) {
 	winpt_get_seckey (key->subkeys->keyid, &k);
 	protec = k.is_protected;



More information about the Winpt-commits mailing list