[Winpt-commits] r188 - trunk/Src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 22 13:39:04 CET 2006


Author: twoaday
Date: 2006-03-22 13:39:02 +0100 (Wed, 22 Mar 2006)
New Revision: 188

Modified:
   trunk/Src/ChangeLog
   trunk/Src/wptClipSignDlg.cpp
   trunk/Src/wptFileManagerDlg.cpp
   trunk/Src/wptKeyCache.cpp
   trunk/Src/wptKeyEditDlgs.cpp
   trunk/Src/wptProxySettingsDlg.cpp
   trunk/Src/wptSigTreeDlg.cpp
Log:
2006-03-22  Timo Schulz  <ts at g10code.de>
 
        * wptClipSignDlg.cpp (on_init_dialog): New.
        Check that there is at least one useable signing key.
        * wptSigTreeDlg.cpp (sigtree_load): Correct UTF8 handling.
        * wptKeyEditDlgs.cpp (keyedit_set_pref_keyserver): Show error
        if needed.



Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog	2006-03-22 11:04:20 UTC (rev 187)
+++ trunk/Src/ChangeLog	2006-03-22 12:39:02 UTC (rev 188)
@@ -1,3 +1,11 @@
+2006-03-22  Timo Schulz  <ts at g10code.de>
+
+	* wptClipSignDlg.cpp (on_init_dialog): New.
+	Check that there is at least one useable signing key.
+	* wptSigTreeDlg.cpp (sigtree_load): Correct UTF8 handling.
+	* wptKeyEditDlgs.cpp (keyedit_set_pref_keyserver): Show error
+	if needed.
+	
 2006-03-21  Timo Schulz  <ts at g10code.de>
 
 	* wptUTF8.cpp (native_to_utf8): Use directly W32 API.

Modified: trunk/Src/wptClipSignDlg.cpp
===================================================================
--- trunk/Src/wptClipSignDlg.cpp	2006-03-22 11:04:20 UTC (rev 187)
+++ trunk/Src/wptClipSignDlg.cpp	2006-03-22 12:39:02 UTC (rev 188)
@@ -157,12 +157,43 @@
 }
 
 
+static listview_ctrl_t
+on_init_dialog (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    listview_ctrl_t lv;
+    gpg_keycache_t kc, sec_kc;
+    int nkeys = 0;
+
+    SetWindowText (dlg, _("Signing"));
+    kc = keycache_get_ctx (KEYCACHE_PUB);
+    if (!kc)
+	BUG (0);
+    sec_kc = keycache_get_ctx (KEYCACHE_PRV);
+    if (!sec_kc)
+	BUG (0);
+
+    nkeys = count_useable_seckeys (sec_kc);
+    if (nkeys < 1) {
+	msg_box (dlg, _("No useable signing key found"), _("Signing"), MB_ERR);
+	return NULL;
+    }
+    else if (nkeys == 1) {
+        one_key_proc (dlg);
+	return NULL;
+    }
+    lv = keylist_load (GetDlgItem (dlg, IDC_SIGN_KEYLIST), kc, sec_kc,
+			KEYLIST_SIGN, KEY_SORT_USERID);
+    center_window (dlg, NULL);
+    SetForegroundWindow (dlg);
+    return lv;
+}
+
+
 /* Dialog box procedure for clipboard signing. */
 BOOL CALLBACK 
 clip_sign_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {	
-    static listview_ctrl_t lv = NULL;
-    gpg_keycache_t kc, sec_kc;
+    static listview_ctrl_t lv = NULL;    
     gpgme_ctx_t ctx;
     gpgme_error_t err;
     passphrase_cb_s pwd;
@@ -170,25 +201,11 @@
     int rc = 0, no_signer = 0;
     char *signer = NULL;
     
-    switch( msg ) {
+    switch (msg) {
     case WM_INITDIALOG:
-        SetWindowText (dlg, _("Signing"));
-
-        kc = keycache_get_ctx (KEYCACHE_PUB);
-	if (!kc)
-	    BUG( NULL );
-        sec_kc = keycache_get_ctx (KEYCACHE_PRV);
-	if (!sec_kc)
-	    BUG (dlg);
-        if (count_useable_seckeys (sec_kc) == 1) {
-            one_key_proc (dlg);
-            EndDialog (dlg, TRUE);
-            return FALSE;
-        }
-        lv = keylist_load (GetDlgItem (dlg, IDC_SIGN_KEYLIST), kc, sec_kc,
-			   KEYLIST_SIGN, KEY_SORT_USERID);
-	center_window (dlg, NULL);
-        SetForegroundWindow (dlg);
+	lv = on_init_dialog (dlg, msg, wparam, lparam);
+	if (!lv)
+	    EndDialog (dlg, TRUE);
         return FALSE;	
         
     case WM_DESTROY:

Modified: trunk/Src/wptFileManagerDlg.cpp
===================================================================
--- trunk/Src/wptFileManagerDlg.cpp	2006-03-22 11:04:20 UTC (rev 187)
+++ trunk/Src/wptFileManagerDlg.cpp	2006-03-22 12:39:02 UTC (rev 188)
@@ -216,6 +216,7 @@
 	}
 	SetWindowText (dlg, _("Key Import"));
 	SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
+	center_window (dlg, NULL);
 	SetForegroundWindow (dlg);
         return TRUE;
         

Modified: trunk/Src/wptKeyCache.cpp
===================================================================
--- trunk/Src/wptKeyCache.cpp	2006-03-22 11:04:20 UTC (rev 187)
+++ trunk/Src/wptKeyCache.cpp	2006-03-22 12:39:02 UTC (rev 188)
@@ -878,15 +878,17 @@
     if (!enc)
 	return gpg_error (GPG_ERR_NO_DATA);;
     *out = (char*)calloc (1, strlen (enc)+1);
+    if (!*out)
+	BUG (0);
     for (pos = 0; pos < strlen (enc); pos++) {
 	if (enc[pos] == '%' && enc[pos+1] == '%')
 	    (*out)[i++] = '%';
 	else if (enc[pos] == '%') {
-	    char tmp[3];
-	    tmp[0] = enc[++pos];
-	    tmp[1] = enc[++pos];
-	    tmp[2] = 0;
-	    (*out)[i++] = (char)strtoul (tmp, NULL, 16);
+	    char temp[3];
+	    temp[0] = enc[++pos];
+	    temp[1] = enc[++pos];
+	    temp[2] = 0;
+	    (*out)[i++] = (char)strtoul (temp, NULL, 16);
 	}
 	else
 	    (*out)[i++] = enc[pos];

Modified: trunk/Src/wptKeyEditDlgs.cpp
===================================================================
--- trunk/Src/wptKeyEditDlgs.cpp	2006-03-22 11:04:20 UTC (rev 187)
+++ trunk/Src/wptKeyEditDlgs.cpp	2006-03-22 12:39:02 UTC (rev 188)
@@ -882,6 +882,8 @@
     err = ke->setPreferredKeyserver (-1, url->url);
     if (!err)
 	msg_box (dlg, _("Preferred keyserver successfully set."), _("Key Edit"), MB_OK);
+    else
+	msg_box (dlg, gpgme_strerror (err), _("Key Edit"), MB_ERR);
 
     sfree_if_alloc (pass);
     delete ke;

Modified: trunk/Src/wptProxySettingsDlg.cpp
===================================================================
--- trunk/Src/wptProxySettingsDlg.cpp	2006-03-22 11:04:20 UTC (rev 187)
+++ trunk/Src/wptProxySettingsDlg.cpp	2006-03-22 12:39:02 UTC (rev 188)
@@ -203,7 +203,6 @@
 		    return FALSE;
 	    }
 	    set_reg_proxy_prefs (&proxy);
-	    log_box ("debug", 0, "%d", proxy.proto);
             EndDialog (dlg, TRUE);
             return TRUE;
             

Modified: trunk/Src/wptSigTreeDlg.cpp
===================================================================
--- trunk/Src/wptSigTreeDlg.cpp	2006-03-22 11:04:20 UTC (rev 187)
+++ trunk/Src/wptSigTreeDlg.cpp	2006-03-22 12:39:02 UTC (rev 188)
@@ -28,6 +28,7 @@
 #include "wptTypes.h"
 #include "wptCommonCtl.h"
 #include "wptContext.h"
+#include "wptUTF8.h"
 
 
 /* ID to display signature properties. */
@@ -36,8 +37,8 @@
 
 BOOL CALLBACK sigprops_dlg_proc (HWND dlg, UINT msg, 
 				 WPARAM wparam, LPARAM lparam);
-BOOL CALLBACK
-keysig_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam);
+BOOL CALLBACK keysig_dlg_proc (HWND dlg, UINT msg, 
+			       WPARAM wparam, LPARAM lparam);
 
 /* Initialize the signature tree based on the given key @key. */
 static void
@@ -49,6 +50,7 @@
     gpgme_user_id_t u;
     gpgme_key_sig_t s;
     gpgme_key_t signer;
+    char *p;
 
     memset (&tvi, 0, sizeof (tvi));
     memset (&ctx, 0, sizeof (ctx));
@@ -66,7 +68,8 @@
 	for (s = u->signatures; s; s=s->next) {
 	    if (get_pubkey (s->keyid+8, &signer))
 		continue;
-	    tvi.pszText = signer->uids->uid;
+	    p = utf8_to_native (signer->uids->uid);
+	    tvi.pszText = p;
 	    tvi.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
 	    tvi.iImage = 1;
 	    tvi.iSelectedImage = 1;
@@ -74,6 +77,7 @@
 	    ctx.hParent = uid;
 	    ctx.item = tvi;
 	    TreeView_InsertItem (dlg, &ctx);
+	    safe_free (p);
 	}
     }
 }



More information about the Winpt-commits mailing list