[Winpt-commits] r366 - trunk/Src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Dec 6 13:32:09 CET 2011
Author: twoaday
Date: 2011-12-06 13:32:08 +0100 (Tue, 06 Dec 2011)
New Revision: 366
Modified:
trunk/Src/ChangeLog
trunk/Src/wptKeyManagerDlg.cpp
trunk/Src/wptKeyPropsDlg.cpp
trunk/Src/wptNLS.cpp
Log:
2011-12-06 Timo Schulz <twoaday at gmx.net>
* wptKeyPropsDlg.cpp (on_init_dialog): Extra hint in
the title that the key has been revoked.
* wptKeyManagerDlg.cpp (keymanger_dlg_proc): Redraw
list view in case a modal client dialog has been closed.
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2011-12-05 20:20:10 UTC (rev 365)
+++ trunk/Src/ChangeLog 2011-12-06 12:32:08 UTC (rev 366)
@@ -1,3 +1,10 @@
+2011-12-06 Timo Schulz <twoaday at gmx.net>
+
+ * wptKeyPropsDlg.cpp (on_init_dialog): Extra hint in
+ the title that the key has been revoked.
+ * wptKeyManagerDlg.cpp (keymanger_dlg_proc): Redraw
+ list view in case a modal client dialog has been closed.
+
2011-12-04 Timo Schulz <twoaday at gmx.net>
* WinPT.cpp (get_file_version): New.
Modified: trunk/Src/wptKeyManagerDlg.cpp
===================================================================
--- trunk/Src/wptKeyManagerDlg.cpp 2011-12-05 20:20:10 UTC (rev 365)
+++ trunk/Src/wptKeyManagerDlg.cpp 2011-12-06 12:32:08 UTC (rev 366)
@@ -1904,6 +1904,7 @@
keyserver_dlg_proc, 0, _("Keyserver Access"),
IDS_WINPT_KEYSERVER);
refresh_keylist (kmi);
+ redraw_keylist (kmi);
return TRUE;
case ID_KEYMISC_WINPTPREFS:
@@ -1939,6 +1940,7 @@
refresh_keylist (kmi);
}
free_if_alloc (url);
+ redraw_keylist (kmi);
break;
case ID_KEYMISC_EXPORT:
@@ -2188,13 +2190,6 @@
i & MFS_CHECKED? MFS_UNCHECKED : MFS_CHECKED);
modify_listview_columns (kmi, LOWORD (wparam), !(i & MFS_CHECKED));
break;
-
- case ID_GROUP_NEW:
- case ID_GROUP_PASTE:
- case ID_GROUP_DELETE:
- case ID_GROUP_SHOW:
- /* XXX: Implement group manager. */
- return TRUE;
}
break;
Modified: trunk/Src/wptKeyPropsDlg.cpp
===================================================================
--- trunk/Src/wptKeyPropsDlg.cpp 2011-12-05 20:20:10 UTC (rev 365)
+++ trunk/Src/wptKeyPropsDlg.cpp 2011-12-06 12:32:08 UTC (rev 366)
@@ -32,6 +32,7 @@
#include "wptW32API.h"
#include "wptVersion.h"
#include "wptKeyEdit.h"
+#include "StringBuffer.h"
/* Context to store associated data of the dialog. */
@@ -46,9 +47,7 @@
static int
do_check_key (gpgme_key_t key)
{
- int invalid;
-
- invalid = key->expired;
+ int invalid = key->expired;
if (!invalid)
invalid = key->revoked;
return invalid;
@@ -79,7 +78,7 @@
return inf;
}
-
+/* Generate a temporary name for the photo ID */
int
get_photo_tmpname (gpgme_key_t key, char *buf, size_t buflen)
{
@@ -102,12 +101,8 @@
char *photo_file, size_t photo_file_size,
gpgme_validity_t *r_valid)
{
- FILE *fp;
- const BYTE *img;
- DWORD imglen;
-
- img = key->ext->attrib.d;
- imglen = key->ext->attrib.len;
+ const BYTE *img = key->ext->attrib.d;
+ DWORD imglen = key->ext->attrib.len;
if (img && !key->ext->attrib.validity)
get_uat_validity (key->ctx->subkeys->keyid,
&key->ext->attrib.validity);
@@ -118,15 +113,14 @@
return -1;
get_photo_tmpname (key->ctx, photo_file, photo_file_size);
- fp = fopen (photo_file, "wb");
- if (fp != NULL) {
- const int pos = 16;
- fwrite (img + pos, 1, imglen - pos, fp);
- fclose (fp);
- return 0;
- }
+ FILE *fp = fopen (photo_file, "wb");
+ if (fp == NULL)
+ return -1;
- return -1;
+ const int HEADER_OFF = 16;
+ fwrite (img + HEADER_OFF, 1, imglen - HEADER_OFF, fp);
+ fclose (fp);
+ return 0;
}
@@ -248,7 +242,12 @@
{
winpt_key_t k = (winpt_key_t)lparam;
assert (k != NULL);
- SetWindowText (dlg, _("Key Properties"));
+
+ StringBuffer s = _("Key Properties");
+ if (k->ext->key->revoked)
+ s += " - REVOKED KEY";
+
+ SetWindowText (dlg, s.getBuffer());
SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change"));
SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers"));
SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Password"));
Modified: trunk/Src/wptNLS.cpp
===================================================================
--- trunk/Src/wptNLS.cpp 2011-12-05 20:20:10 UTC (rev 365)
+++ trunk/Src/wptNLS.cpp 2011-12-06 12:32:08 UTC (rev 366)
@@ -307,20 +307,19 @@
load_modir_domain (void)
{
gettext_domain_t domain = NULL;
- StringBuffer s;
- char *modir;
- modir = get_reg_entry_mo ();
+ char *modir = get_reg_entry_mo ();
if (!modir)
return NULL;
if (dir_exist_check (modir)) {
free_if_alloc (modir);
return NULL;
}
- s = modir;
+ StringBuffer s = modir;
if (modir[strlen (modir)-1] != '\\')
s += "\\";
s += "winpt.mo";
+
const char *fname = s.getBuffer();
if (!file_exist_check (fname))
domain = load_domain (fname);
@@ -400,18 +399,17 @@
domain->trans_tab[idx].offset);
if (!domain->mapped[idx])
domain->mapped[idx] = 1;
- return (const char*)p;
+ return (const char *)p;
}
const char *
gettext (const char *msgid)
{
- gettext_domain_t domain;
size_t act = 0;
size_t top, bottom;
- domain = the_domain;
+ gettext_domain_t domain = the_domain;
if (domain == NULL)
goto not_found;
@@ -438,7 +436,7 @@
idx -= domain->hash_size - incr;
else
idx += incr;
- nstr = SWAPIT(domain->must_swap, domain->hash_tab[idx]);
+ nstr = SWAPIT (domain->must_swap, domain->hash_tab[idx]);
if (!nstr)
goto not_found; /* Hash table entry is empty. */
@@ -456,12 +454,10 @@
array of messages. */
bottom = 0;
top = domain->nstrings;
- while (bottom < top) {
- int cmp_val;
-
+ while (bottom < top) {
act = (bottom + top) / 2;
- cmp_val = strcmp (msgid, domain->data + SWAPIT(domain->must_swap,
- domain->orig_tab[act].offset));
+ int cmp_val = strcmp (msgid, domain->data + SWAPIT(domain->must_swap,
+ domain->orig_tab[act].offset));
if (cmp_val < 0)
top = act;
else if (cmp_val > 0)
@@ -480,9 +476,7 @@
const char*
gettext_get_langid (void)
{
- LANGID lang;
-
- lang = GetUserDefaultLangID ();
+ LANGID lang = GetUserDefaultLangID ();
if (PRIMARYLANGID (lang) == LANG_ENGLISH)
return NULL;
@@ -497,8 +491,7 @@
/* Take a table with control item IDs and their translation
and set each text to the translated value. */
void
-gettext_localize_dialog (HWND dlg, struct gettext_tab_s *tab,
- const char *title)
+gettext_localize_dialog (HWND dlg, struct gettext_tab_s *tab, const char *title)
{
for (int i=0; tab[i].trans != NULL; i++)
SetDlgItemText (dlg, tab[i].ctlid, tab[i].trans);
More information about the Winpt-commits
mailing list