[Winpt-commits] r150 - trunk/Src
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Wed Jan 18 12:52:47 CET 2006
Author: twoaday
Date: 2006-01-18 12:52:45 +0100 (Wed, 18 Jan 2006)
New Revision: 150
Modified:
trunk/Src/ChangeLog
trunk/Src/WinPT-en.rc
trunk/Src/resource.h
trunk/Src/wptClipImportDlg.cpp
trunk/Src/wptCommonDlg.cpp
trunk/Src/wptFileManagerDlg.cpp
trunk/Src/wptGPGME.cpp
trunk/Src/wptGPGPrefsDlg.cpp
trunk/Src/wptKeyCache.cpp
trunk/Src/wptKeyCacheDlg.cpp
trunk/Src/wptKeyEditDlgs.cpp
trunk/Src/wptKeyManager.cpp
trunk/Src/wptKeyManagerDlg.cpp
trunk/Src/wptKeyPropsDlg.cpp
trunk/Src/wptKeygenDlg.cpp
trunk/Src/wptKeylist.cpp
trunk/Src/wptKeyserver.cpp
trunk/Src/wptKeyserverDlg.cpp
trunk/Src/wptKeysigDlg.cpp
trunk/Src/wptListView.cpp
trunk/Src/wptMAPI.cpp
trunk/Src/wptMainProc.cpp
trunk/Src/wptPreferencesDlg.cpp
trunk/Src/wptRegistry.cpp
trunk/Src/wptSigList.cpp
trunk/Src/wptW32API.cpp
Log:
2006-01-18 Timo Schulz <ts at g10code.com>
* wptListview.cpp (listview_del_sel_items): Fixed index
calculation. This fixed a lot of problems with the KM listview
update.
(listview_del_all): Renamed to...
(listview_del_all_items): ..this. Changed all callers.
* wptKeyManagerDlg.cpp (keymanager_dlg_proc): Just refresh
list when file import contained new/updated keys.
* wptKeyManager.cpp (km_file_import): Indicate if the
import contained any new/update keys.
* wptClipImportDlg.cpp (print_import_status): Just mark
keys which actually changed.
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/ChangeLog 2006-01-18 11:52:45 UTC (rev 150)
@@ -1,3 +1,82 @@
+2006-01-18 Timo Schulz <ts at g10code.com>
+
+ * wptListview.cpp (listview_del_sel_items): Fixed index
+ calculation. This fixed a lot of problems with the KM listview
+ update.
+ (listview_del_all): Renamed to...
+ (listview_del_all_items): ..this. Changed all callers.
+ * wptKeyManagerDlg.cpp (keymanager_dlg_proc): Just refresh
+ list when file import contained new/updated keys.
+ * wptKeyManager.cpp (km_file_import): Indicate if the
+ import contained any new/update keys.
+ * wptClipImportDlg.cpp (print_import_status): Just mark
+ keys which actually changed.
+
+2006-01-17 Timo Schulz <ts at g10code.com>
+
+ * wptMAPI.cpp (mapi_send_pubkey_ext): New.
+ * wptKeysigDlg.cpp (do_delsig): Just flag the key, do not
+ update it.
+ * wptKeyManagerDlg.cpp (keymanager_dlg_proc): Be more
+ careful about const pointers.
+ * wptKeyEditDlgs.cpp (get_subkey_fingerprint): Renamed to..
+ (get_subkey_keyid): ..this. Fix problem that key was updated
+ twice and this corrupted.
+ (keyedit_add_subkey): Set @lv item in the callback context.
+
+2006-01-16 Timo Schulz <ts at g10code.com>
+
+ * wptKeyManagerDlg.cpp (keymanager_dlg_proc): Restore
+ window if it lost focus during the operation. Thanks to Kurt.
+ Update keylist when the window is enabled.
+ (find_keypos): New.
+ * wptKeyCache.cpp (keycache_next_key): Reset update status.
+ (gpg_keycache_next_updated_key): New arg @r_status. Change all
+ callers.
+ (gpg_keycache_update_key): Different status for new and updated.
+ Include key signatures.
+ * wptClipImportDlg.cpp (print_import_status): Mark all
+ imported keys.
+ * wptMainProc.cpp (clip_gpg_dlg): On import refresh KM keylist.
+ Thanks to Kurt.
+ * wptKeysigDlg.cpp (recv_missing_keys): Mark all received keys.
+ (do_delsig): Directly reload key. Thanks to Kurt.
+ * wptGPGME.cpp (keycache_set_reload, keycache_get_reload):
+ Removed.
+ * wptKeygenDlg.cpp (keygen_dlg_proc): Use new update system.
+ * wptClipImportDlg.cpp (clip_import_dlg_proc): Return
+ FALSE if no keys were updated or operation was cancelled.
+ * wptCommonDlg.cpp (http_dlg_proc): Fix title selection code.
+ * wptKeylist.cpp (get_ext_validity): Handle disabled keys.
+ * wptKeyPropsDlg.cpp (keyprops_dlg_proc):
+ Do not allow to change ownertrust of invalid keys.
+ Changed translation.
+ Slightly different user interface.
+
+2006-11-14 Timo Schulz <ts at g10code.com>
+
+ * wptW32API.cpp (make_special_filename): New.
+ * wptRegistry.cpp (set_winpt_reg_prefs, get_winpt_reg_prefs):
+ Removed 'KeyServer' item.
+ * wptPreferencesDlg.cpp (prefs_dlg_proc): Remove keyserver
+ config item.
+ * wptKeyManagerDlg.cpp (keymanager_dlg_proc): Disable group
+ window until we really use it.
+ * wptKeyserver.cpp (kserver_save_conf): New.
+ (wsock_end): Save keyserver config file.
+ * wptKeyserverDlg.cpp (keyserver_edit): New.
+ (keyserver_remove): New.
+ (keyserver_add): New.
+ (fill_keyserv_types): New.
+ (keyserver_modify_dlg_proc): New.
+ (keyserver_dlg_proc): Provide context menu to modify the
+ keyserver list.
+ (keyserver_build_list): Remove 'proto' column because it is
+ not really useful.
+ * WinPT.cpp (load_keyserver_conf): Store keyserver.conf at
+ $APPDATA\winpt. If keyserver.conf exists in the current folder
+ move it to the new destination.
+
2006-11-13 Timo Schulz <ts at g10code.com>
* wptPreferencesDlg.cpp (prefs_dlg_proc): Changed translation.
Modified: trunk/Src/WinPT-en.rc
===================================================================
--- trunk/Src/WinPT-en.rc 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/WinPT-en.rc 2006-01-18 11:52:45 UTC (rev 150)
@@ -74,40 +74,6 @@
// Dialog
//
-IDD_WINPT_GPGCONF DIALOG DISCARDABLE 0, 0, 220, 189
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "GnuPG Configuration"
-FONT 8, "MS Sans Serif"
-BEGIN
- LTEXT "Encrypt to this key",IDC_GPGCONF_ENCTOINF,8,8,59,8
- COMBOBOX IDC_GPGCONF_ENCTO,73,6,81,13,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
- LTEXT "Comment in armored files",IDC_STATIC,8,25,79,8
- EDITTEXT IDC_GPGCONF_COMMENT,8,36,159,12,ES_AUTOHSCROLL
- CONTROL "Run GnuPG in &expert mode",IDC_GPGCONF_EXPERT,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,8,54,103,10
- CONTROL "No auto key &retrieve (WinPT fetches keys from keyservers)",
- IDC_GPGCONF_NOAUTOKEY,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,8,67,203,10
- CONTROL "No &mangle DOS filenames (do not truncate the extension)",
- IDC_GPGCONF_NODOS83,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,7,80,197,10
- CONTROL "Ignore time &conflict (for the case a clock is wrongly set)",
- IDC_GPGCONF_IGNTIMERR,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,8,93,190,8
- CONTROL "&Ignore CRC error (for the case the transport damaged the file)",
- IDC_GPGCONF_IGNCRCERR,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,8,105,205,10
- GROUPBOX "PGP",IDC_STATIC,7,120,202,43
- LTEXT "Compatibility mode to",IDC_STATIC,14,132,67,8
- COMBOBOX IDC_GPGCONF_PGPMODE,86,129,76,13,CBS_DROPDOWN | CBS_SORT |
- WS_VSCROLL | WS_TABSTOP
- CONTROL "&Force version 3 signatures",IDC_GPGCONF_V3SIGS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,147,99,10
- DEFPUSHBUTTON "&OK",IDOK,110,167,50,14
- PUSHBUTTON "&Cancel",IDCANCEL,162,167,50,14
-END
-
IDD_WINPT_KEYWIZARD DIALOG DISCARDABLE 0, 0, 273, 178
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Key Generation Wizard"
@@ -214,14 +180,6 @@
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
- IDD_WINPT_GPGCONF, DIALOG
- BEGIN
- LEFTMARGIN, 2
- RIGHTMARGIN, 215
- TOPMARGIN, 3
- BOTTOMMARGIN, 184
- END
-
IDD_WINPT_KEYWIZARD, DIALOG
BEGIN
LEFTMARGIN, 2
@@ -445,7 +403,7 @@
PUSHBUTTON "&Cancel",IDCANCEL,329,176,50,14
END
-IDD_WINPT_KEYMISC DIALOG DISCARDABLE 0, 0, 470, 305
+IDD_WINPT_KEYMISC DIALOG DISCARDABLE 0, 0, 470, 231
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
CAPTION "Key Management"
@@ -454,10 +412,6 @@
CONTROL "List1",IDC_KEYMISC_KEYLIST,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER |
WS_TABSTOP,6,7,451,190
- CONTROL "Tree1",IDC_KEYMISC_GROUP,"SysTreeView32",TVS_HASBUTTONS |
- TVS_HASLINES | TVS_LINESATROOT | WS_BORDER | WS_TABSTOP,
- 6,220,449,48
- LTEXT "Groups",IDC_KEYMISC_GTEXT,6,208,24,8
END
IDD_WINPT_ABOUTGPG DIALOG DISCARDABLE 0, 0, 344, 154
@@ -518,7 +472,7 @@
PUSHBUTTON "&Cancel",IDCANCEL,227,174,54,15
END
-IDD_WINPT_GPGPREFS DIALOG DISCARDABLE 0, 0, 222, 213
+IDD_WINPT_GPGPREFS DIALOG DISCARDABLE 0, 0, 222, 226
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "GnuPG Preferences"
FONT 8, "MS Sans Serif"
@@ -537,17 +491,19 @@
IDC_GPGPREFS_LOCALINF,12,85,148,8
EDITTEXT IDC_GPGPREFS_LOCALE,12,96,152,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_GPGPREFS_LOCDLG,167,95,41,14
- GROUPBOX "General GPG options",IDC_GPGPREFS_ALLOPTINF,5,116,210,
+ GROUPBOX "General GPG options",IDC_GPGPREFS_ALLOPTINF,5,130,210,
74
CONTROL "Ask for the signature class during key sign",
IDC_GPGPREFS_ASKLEVEL,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,11,130,166,10
- LTEXT "Comment in armored files",IDC_GPGPREFS_CMTINF,11,143,
+ WS_TABSTOP,11,144,166,10
+ LTEXT "Comment in armored files",IDC_GPGPREFS_CMTINF,11,157,
124,8
- EDITTEXT IDC_GPGPREFS_COMMENT,11,154,188,12,ES_AUTOHSCROLL
- LTEXT "Encrypt to this key",IDC_GPGPREFS_ENCINF,11,173,66,8
- EDITTEXT IDC_GPGPREFS_ENCTO,78,171,121,13,ES_AUTOHSCROLL
- PUSHBUTTON "&OK",IDC_GPGPREFS_SAVE,159,193,55,14
+ EDITTEXT IDC_GPGPREFS_COMMENT,11,168,188,12,ES_AUTOHSCROLL
+ LTEXT "Encrypt to this key",IDC_GPGPREFS_ENCINF,11,187,66,8
+ EDITTEXT IDC_GPGPREFS_ENCTO,78,185,121,13,ES_AUTOHSCROLL
+ PUSHBUTTON "&OK",IDC_GPGPREFS_SAVE,159,207,55,14
+ CONTROL "&Overwrite default settings",IDC_GPGPREFS_OVRDEFAULT,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,115,121,10
END
IDD_WINPT_IMPORT DIALOG DISCARDABLE 0, 0, 321, 118
@@ -646,7 +602,7 @@
PUSHBUTTON "&Cancel",IDCANCEL,119,107,50,14
END
-IDD_WINPT_PREFS DIALOG DISCARDABLE 0, 0, 292, 285
+IDD_WINPT_PREFS DIALOG DISCARDABLE 0, 0, 292, 271
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "WinPT Preferences"
FONT 8, "MS Sans Serif"
@@ -656,7 +612,7 @@
EDITTEXT IDC_PREFS_CACHETIME,124,7,25,13
LTEXT "(CTRL+ALT+F to clear the cache)",IDC_PREFS_CACHEHINT,
151,9,108,8
- GROUPBOX "General options",IDC_PREFS_ALLOPTINF,8,23,271,113
+ GROUPBOX "General options",IDC_PREFS_ALLOPTINF,8,23,271,97
LTEXT "Word wrap cleartext &signatures at column",
IDC_PREFS_WWINFO,13,34,139,8
EDITTEXT IDC_PREFS_WORDWRAP,156,32,14,13
@@ -674,43 +630,40 @@
LTEXT "Select &wipe mode",IDC_PREFS_WIPEINF,13,104,79,8
COMBOBOX IDC_PREFS_WIPEMODE,100,103,64,40,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
- LTEXT "Keyserver &config",IDC_PREFS_KSINF,13,119,76,8
- EDITTEXT IDC_PREFS_KSERVER,100,119,124,12,ES_AUTOHSCROLL
- PUSHBUTTON "Browse...",IDC_PREFS_KSELFILE,225,119,48,14
- GROUPBOX "Clipboard hotkeys",IDC_PREFS_CLIPINF,8,137,112,70
- LTEXT "Encrypt CTRL+ALT+",IDC_STATIC,13,152,67,8
- EDITTEXT IDC_PREFS_CLIP_ENCRYPT,83,150,10,12
- LTEXT "Decrypt/verify CTRL+ALT+",IDC_STATIC,13,164,88,8
- EDITTEXT IDC_PREFS_CLIP_DECRYPT_VERIFY,103,162,9,12
- LTEXT "Sign CTRL+ALT+",IDC_STATIC,13,177,57,8
- EDITTEXT IDC_PREFS_CLIP_SIGNENC,73,175,9,12
- LTEXT "Sign && Encrypt CTRL+ALT+",IDC_STATIC,13,191,89,8
- EDITTEXT IDC_PREFS_CLIP_SIGN,103,189,9,13
- GROUPBOX "Current window hotkeys",IDC_PREFS_CURRINF,127,137,152,
+ GROUPBOX "Clipboard hotkeys",IDC_PREFS_CLIPINF,8,122,112,70
+ LTEXT "Encrypt CTRL+ALT+",IDC_STATIC,13,137,67,8
+ EDITTEXT IDC_PREFS_CLIP_ENCRYPT,83,135,10,12
+ LTEXT "Decrypt/verify CTRL+ALT+",IDC_STATIC,13,149,88,8
+ EDITTEXT IDC_PREFS_CLIP_DECRYPT_VERIFY,103,147,9,12
+ LTEXT "Sign CTRL+ALT+",IDC_STATIC,13,162,57,8
+ EDITTEXT IDC_PREFS_CLIP_SIGNENC,73,160,9,12
+ LTEXT "Sign && Encrypt CTRL+ALT+",IDC_STATIC,13,176,89,8
+ EDITTEXT IDC_PREFS_CLIP_SIGN,103,174,9,13
+ GROUPBOX "Current window hotkeys",IDC_PREFS_CURRINF,127,122,152,
70
- LTEXT "Encrypt ALT+SHIFT+",IDC_STATIC,134,152,69,8
- EDITTEXT IDC_PREFS_CWS_ENCRYPT,210,150,9,12
- LTEXT "Decrypt/verify ALT+SHIFT+",IDC_STATIC,134,165,90,8
- EDITTEXT IDC_PREFS_CWS_DECRYPT_VERIFY,227,164,9,12
- LTEXT "Sign ALT+SHIFT+",IDC_STATIC,134,178,59,8
- EDITTEXT IDC_PREFS_CWS_SIGN,196,177,9,12
- LTEXT "Sign && Encrypt ALT+SHIFT+",IDC_STATIC,134,191,91,8
- EDITTEXT IDC_PREFS_CWS_SIGNENC,227,189,10,12
+ LTEXT "Encrypt ALT+SHIFT+",IDC_STATIC,134,137,69,8
+ EDITTEXT IDC_PREFS_CWS_ENCRYPT,210,135,9,12
+ LTEXT "Decrypt/verify ALT+SHIFT+",IDC_STATIC,134,150,90,8
+ EDITTEXT IDC_PREFS_CWS_DECRYPT_VERIFY,227,149,9,12
+ LTEXT "Sign ALT+SHIFT+",IDC_STATIC,134,163,59,8
+ EDITTEXT IDC_PREFS_CWS_SIGN,196,162,9,12
+ LTEXT "Sign && Encrypt ALT+SHIFT+",IDC_STATIC,134,176,91,8
+ EDITTEXT IDC_PREFS_CWS_SIGNENC,227,174,10,12
CONTROL "&Disable hotkeys (Not recommended!)",
IDC_PREFS_DISABLE_HOTKEYS,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,8,210,159,10
- GROUPBOX "",IDC_STATIC,8,229,271,38
+ WS_TABSTOP,8,195,159,10
+ GROUPBOX "",IDC_STATIC,8,214,271,38
CONTROL "&Automatic keyring backup when WinPT closes",
IDC_PREFS_AUTOBACKUP,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,14,228,195,11
+ WS_TABSTOP,14,213,195,11
CONTROL "Backup to &keyring folder",IDC_PREFS_BAKHOME,"Button",
- BS_AUTORADIOBUTTON,24,240,150,10
+ BS_AUTORADIOBUTTON,24,225,150,10
CONTROL "Backup to:",IDC_PREFS_BAKUSER,"Button",
- BS_AUTORADIOBUTTON,24,252,55,10
- EDITTEXT IDC_PREFS_BAKPATH,80,251,130,12,ES_AUTOHSCROLL
- PUSHBUTTON "Browse...",IDC_PREFS_BAKSELECT,212,250,47,14
- DEFPUSHBUTTON "&OK",IDOK,151,270,50,14
- PUSHBUTTON "&Cancel",IDCANCEL,203,270,50,14
+ BS_AUTORADIOBUTTON,24,237,55,10
+ EDITTEXT IDC_PREFS_BAKPATH,80,236,130,12,ES_AUTOHSCROLL
+ PUSHBUTTON "Browse...",IDC_PREFS_BAKSELECT,212,235,47,14
+ DEFPUSHBUTTON "&OK",IDOK,176,255,50,14
+ PUSHBUTTON "&Cancel",IDCANCEL,228,255,50,14
END
IDD_WINPT_HKPSEARCH DIALOG DISCARDABLE 0, 0, 359, 157
@@ -781,26 +734,26 @@
PUSHBUTTON "&Cancel",IDCANCEL,290,118,50,14
END
-IDD_WINPT_KEYPROPS DIALOG DISCARDABLE 0, 0, 215, 177
+IDD_WINPT_KEYPROPS DIALOG DISCARDABLE 0, 0, 215, 194
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Key Properties"
FONT 8, "MS Sans Serif"
BEGIN
- EDITTEXT IDC_KEYPROPS_INFO,5,7,112,75,ES_MULTILINE |
+ EDITTEXT IDC_KEYPROPS_INFO,5,12,112,75,ES_MULTILINE |
ES_AUTOHSCROLL | ES_READONLY
- LTEXT "Fingerprint",IDC_STATIC,5,93,34,8
- EDITTEXT IDC_KEYPROPS_FPR,5,105,199,13,ES_READONLY
- LTEXT "Ownertrust",IDC_KEYPROPS_OTINF,5,124,94,8
- EDITTEXT IDC_KEYPROPS_OT,5,136,131,12,ES_AUTOHSCROLL |
+ LTEXT "Fingerprint",IDC_STATIC,5,107,34,8
+ EDITTEXT IDC_KEYPROPS_FPR,5,119,199,13,ES_READONLY
+ LTEXT "Ownertrust",IDC_KEYPROPS_OTINF,5,137,94,8
+ EDITTEXT IDC_KEYPROPS_OT,5,149,131,12,ES_AUTOHSCROLL |
ES_READONLY
- PUSHBUTTON "&Change",IDC_KEYPROPS_OT_CHANGE,140,136,39,12
- DEFPUSHBUTTON "&OK",IDOK,33,156,50,14
- PUSHBUTTON "Change &Passwd",IDC_KEYPROPS_CHANGE_PWD,87,156,58,14,
+ PUSHBUTTON "&Change",IDC_KEYPROPS_OT_CHANGE,140,149,39,12
+ DEFPUSHBUTTON "&OK",IDOK,96,175,50,14
+ PUSHBUTTON "Change &Passwd",IDC_KEYPROPS_CHANGE_PWD,125,90,76,14,
WS_DISABLED
- PUSHBUTTON "&Revokers",IDC_KEYPROPS_REVOKERS,148,156,58,14,
+ PUSHBUTTON "&Revokers",IDC_KEYPROPS_REVOKERS,149,175,58,14,
WS_DISABLED
- CONTROL "",IDC_KEYPROPS_IMG,"Static",SS_BLACKFRAME,125,7,76,76
- LTEXT "",IDC_KEYPROPS_IMGINF,126,84,75,9
+ CONTROL "",IDC_KEYPROPS_IMG,"Static",SS_BLACKFRAME,125,12,76,76
+ LTEXT "",IDC_KEYPROPS_IMGINF,125,3,75,9
END
IDD_WINPT_KEYTRUST DIALOG DISCARDABLE 0, 0, 346, 189
@@ -1337,23 +1290,6 @@
PUSHBUTTON "&Cancel",IDCANCEL,118,117,50,14
END
-IDD_WINPT_MAIL DIALOG DISCARDABLE 0, 0, 247, 162
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
-CAPTION "Windows Privacy Mail"
-FONT 8, "MS Sans Serif"
-BEGIN
- DEFPUSHBUTTON "&Send",IDOK,137,141,50,14
- PUSHBUTTON "&Cancel",IDCANCEL,190,141,50,14
- LTEXT "&To:",IDC_STATIC,5,12,12,8
- EDITTEXT IDC_PMAIL_TO,38,9,202,12,ES_AUTOHSCROLL
- LTEXT "&Cc:",IDC_STATIC,6,27,12,8
- EDITTEXT IDC_PMAIL_CC,38,25,202,12,ES_AUTOHSCROLL
- LTEXT "&Subject",IDC_STATIC,6,42,25,8
- EDITTEXT IDC_PMAIL_SUBJECT,38,41,202,12,ES_AUTOHSCROLL
- EDITTEXT IDC_PMAIL_MSG,8,62,232,69,ES_MULTILINE | ES_AUTOHSCROLL |
- ES_WANTRETURN
-END
-
IDD_WINPT_CDISK_MOUNT DIALOG DISCARDABLE 0, 0, 177, 109
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Cryptdisk -- Mount Volume"
@@ -1424,7 +1360,23 @@
LTEXT "Static",IDC_INFODLG_TEXT,44,14,196,29
END
+IDD_WINPT_KEYSERVER_ADD DIALOG DISCARDABLE 0, 0, 186, 101
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Edit Keyserver"
+FONT 8, "MS Sans Serif"
+BEGIN
+ LTEXT "Type:",IDC_KSERVADD_TYPEINF,9,9,33,8
+ COMBOBOX IDC_KSERVADD_TYPES,61,8,96,45,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ LTEXT "Host name:",IDC_KSERVADD_HOSTINF,9,32,47,8
+ EDITTEXT IDC_KSERVADD_HOST,61,30,106,12,ES_AUTOHSCROLL
+ LTEXT "Port:",IDC_KSERVADD_PORTINF,9,51,31,8
+ EDITTEXT IDC_KSERVADD_PORT,61,52,43,12,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "&Add",IDOK,77,83,50,14
+ PUSHBUTTON "&Cancel",IDCANCEL,131,83,50,14
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -1502,7 +1454,7 @@
LEFTMARGIN, 2
RIGHTMARGIN, 465
TOPMARGIN, 4
- BOTTOMMARGIN, 301
+ BOTTOMMARGIN, 227
END
IDD_WINPT_ABOUTGPG, DIALOG
@@ -1542,7 +1494,7 @@
LEFTMARGIN, 3
RIGHTMARGIN, 215
TOPMARGIN, 4
- BOTTOMMARGIN, 208
+ BOTTOMMARGIN, 221
END
IDD_WINPT_IMPORT, DIALOG
@@ -1606,7 +1558,7 @@
LEFTMARGIN, 3
RIGHTMARGIN, 286
TOPMARGIN, 3
- BOTTOMMARGIN, 283
+ BOTTOMMARGIN, 269
END
IDD_WINPT_HKPSEARCH, DIALOG
@@ -1646,7 +1598,7 @@
LEFTMARGIN, 2
RIGHTMARGIN, 208
TOPMARGIN, 3
- BOTTOMMARGIN, 172
+ BOTTOMMARGIN, 189
END
IDD_WINPT_KEYTRUST, DIALOG
@@ -1897,14 +1849,6 @@
BOTTOMMARGIN, 131
END
- IDD_WINPT_MAIL, DIALOG
- BEGIN
- LEFTMARGIN, 2
- RIGHTMARGIN, 242
- TOPMARGIN, 3
- BOTTOMMARGIN, 155
- END
-
IDD_WINPT_CDISK_MOUNT, DIALOG
BEGIN
LEFTMARGIN, 2
@@ -1944,6 +1888,14 @@
TOPMARGIN, 1
BOTTOMMARGIN, 64
END
+
+ IDD_WINPT_KEYSERVER_ADD, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 181
+ TOPMARGIN, 1
+ BOTTOMMARGIN, 97
+ END
END
#endif // APSTUDIO_INVOKED
@@ -2096,7 +2048,6 @@
BEGIN
POPUP "&File"
BEGIN
- MENUITEM "Send Mail...", ID_KEYMISC_MAIL, GRAYED
MENUITEM "&Ownertrust", ID_KEYMISC_OT
MENUITEM SEPARATOR
MENUITEM "&Quit", ID_KEYMISC_QUIT
@@ -2284,7 +2235,17 @@
END
END
+IDR_WINPT_KEYSERVER_CTX MENU DISCARDABLE
+BEGIN
+ POPUP "Contextmenu"
+ BEGIN
+ MENUITEM "&Add", ID_KSERVCTX_ADD
+ MENUITEM "&Remove", ID_KSERVCTX_DEL
+ MENUITEM "&Edit", ID_KSERVCTX_EDIT
+ END
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
Modified: trunk/Src/resource.h
===================================================================
--- trunk/Src/resource.h 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/resource.h 2006-01-18 11:52:45 UTC (rev 150)
@@ -159,6 +159,8 @@
#define IDI_KEY_NEW 235
#define IDI_COMPUTER 236
#define IDD_WINPT_INFODLG 237
+#define IDD_WINPT_KEYSERVER_ADD 238
+#define IDR_WINPT_KEYSERVER_CTX 239
#define IDC_CLIPEDIT_SEND 1000
#define IDC_CLIPEDIT_CLEAR 1001
#define IDC_CLIPEDIT_CLIPTEXT 1002
@@ -622,6 +624,13 @@
#define IDC_ABOUT_GPLINF 1501
#define IDC_INFODLG_TEXT 1502
#define IDC_INFODLG_ICO 1503
+#define IDC_KSERVADD_TYPEINF 1504
+#define IDC_KSERVADD_TYPES 1505
+#define IDC_KSERVADD_HOSTINF 1506
+#define IDC_KSERVADD_HOST 1507
+#define IDC_KSERVADD_PORTINF 1508
+#define IDC_KSERVADD_PORT 1509
+#define IDC_GPGPREFS_OVRDEFAULT 1510
#define ID_GPG_ENCRYPT 40003
#define ID_GPG_DECRYPT 40004
#define ID_GPG_SIGN 40005
@@ -791,14 +800,17 @@
#define ID_KEYMISC_VIEWTYPE 40179
#define ID_KEYMISC_VIEWCREAT 40180
#define ID_KEYMISC_WEBSITE 40181
+#define ID_KSERVCTX_ADD 40182
+#define ID_KSERVCTX_DEL 40183
+#define ID_KSERVCTX_EDIT 40184
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 238
-#define _APS_NEXT_COMMAND_VALUE 40182
-#define _APS_NEXT_CONTROL_VALUE 1504
+#define _APS_NEXT_RESOURCE_VALUE 240
+#define _APS_NEXT_COMMAND_VALUE 40185
+#define _APS_NEXT_CONTROL_VALUE 1511
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Modified: trunk/Src/wptClipImportDlg.cpp
===================================================================
--- trunk/Src/wptClipImportDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptClipImportDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -18,7 +18,6 @@
* along with WinPT; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,14 +57,25 @@
/* Load the import statistics dialog with the results from @res. */
-void
+int
print_import_status (gpgme_import_result_t res)
{
+ gpgme_import_status_t st;
+ const char *keyid;
+
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT_STAT, glob_hwnd,
import_status_dlg_proc, (LPARAM)res,
_("Key Import Statistics"), IDS_WINPT_IMPORT_STAT);
- if (res->imported || res->secret_imported)
- keycache_set_reload (1); /* XXX: update flag */
+ if (res->unchanged != res->considered) {
+ for (st=res->imports; st; st=st->next) {
+ if (st->status == 0) /* nothing changed */
+ continue;
+ keyid = st->fpr;
+ keyid += (strlen (st->fpr) == 32)? 24 : 32;
+ keycache_update (0, keyid);
+ }
+ }
+ return !(res->unchanged == res->considered);
}
@@ -76,14 +86,12 @@
static listview_ctrl_t lv = NULL;
static int is_revcert;
static int has_seckeys;
- int rc = 0;
- /*int id=0;*/
+ int rc = 0, upd = 0;
gpgme_error_t err;
gpgme_ctx_t ctx;
gpgme_import_result_t res;
- /*gpgme_key_t *selkeys = NULL;*/
- switch( msg ) {
+ switch (msg) {
case WM_INITDIALOG:
SetWindowText (dlg, _("Key Import"));
SetDlgItemText (dlg, IDC_IMPORT_DOIT, _("&Import"));
@@ -104,14 +112,14 @@
return FALSE;
case WM_SYSCOMMAND:
- if( LOWORD (wparam) == SC_CLOSE )
- EndDialog( dlg, TRUE );
+ if (LOWORD (wparam) == SC_CLOSE)
+ EndDialog (dlg, FALSE);
return FALSE;
case WM_COMMAND:
- switch( LOWORD( wparam ) ) {
+ switch (LOWORD(wparam)) {
case IDCANCEL:
- EndDialog (dlg, TRUE);
+ EndDialog (dlg, FALSE);
return TRUE;
case IDC_IMPORT_DOIT:
@@ -124,25 +132,6 @@
SetForegroundWindow (dlg);
center_window (dlg, NULL);
- /* XXX: support interactive and only import some keys. */
- /*
- int n;
- char keyid[32];
- n = listview_count_items (lv, 0);
- if( n > 1 && listview_count_items( lv, 1 ) > 0 ) {
- selkeys = calloc (n+1, sizeof (gpgme_key_t));
- if (!selkeys)
- BUG (NULL);
- for (id = 0; id < n; id++) {
- if (listview_get_item_state (lv, id)) {
- listview_get_item_text (lv, id, 2, keyid, DIM (keyid)-1);
- // XXX: set the keyid??
- // ( selkeys, keyid+2 );
- }
- }
- }
- */
-
err = gpgme_new (&ctx);
if (err)
BUG (NULL);
@@ -153,7 +142,7 @@
return FALSE;
}
res = gpgme_op_import_result (ctx);
- print_import_status (res);
+ upd = print_import_status (res);
if (res->no_user_id > 0) {
msg_box (dlg, _("Key without a self signature was dectected!\n"
"(This key is NOT usable for encryption, etc)\n"
@@ -161,7 +150,7 @@
"Cannot import these key(s)."), _("Import"), MB_INFO);
}
gpgme_release (ctx);
- EndDialog (dlg, TRUE);
+ EndDialog (dlg, upd);
return TRUE;
}
break;
Modified: trunk/Src/wptCommonDlg.cpp
===================================================================
--- trunk/Src/wptCommonDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptCommonDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -59,12 +59,13 @@
BUG (0);
if (ctx->desc != NULL)
SetWindowText (dlg, ctx->desc);
+ else
+ SetWindowText (dlg, _("HTTP Key Import"));
if (ctx->title != NULL)
SetDlgItemText (dlg, IDC_HTTP_TITLE, ctx->title);
else
SetDlgItemText (dlg, IDC_HTTP_TITLE, _("Enter URL to retrieve the public key"));
SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
- SetWindowText (dlg, _("HTTP Key Import"));
SetForegroundWindow (dlg);
break;
@@ -143,3 +144,101 @@
return NULL;
return m_strdup (ctx.url);
}
+
+#if 0
+struct infodlg_s {
+ const char *title;
+ const char *button_1;
+ const char *button_2;
+ const char *text;
+ HICON ico;
+ int retval;
+};
+
+/* Dialog box procedure for the info dialog. */
+static BOOL CALLBACK
+infodlg_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ static struct infodlg_s *ctx;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ ctx = (struct infodlg_s *)lparam;
+ if (!ctx)
+ EndDialog (dlg, FALSE);
+ if (ctx->title)
+ SetWindowText (dlg, ctx->title);
+ if (ctx->text)
+ SetDlgItemText (dlg, IDC_INFODLG_TEXT, ctx->text);
+ if (ctx->button_1)
+ SetDlgItemText (dlg, IDOK, ctx->button_1);
+ if (ctx->button_2)
+ SetDlgItemText (dlg, IDCANCEL, ctx->button_2);
+ if (ctx->ico != NULL) {
+ SendMessage (GetDlgItem (dlg, IDC_INFODLG_ICO), STM_SETICON,
+ (WPARAM)(HICON)ctx->ico, 0);
+ }
+ SetForegroundWindow (dlg);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD (wparam)) {
+ case IDOK:
+ ctx->retval = IDOK;
+ EndDialog (dlg, TRUE);
+ break;
+
+ case IDCANCEL:
+ ctx->retval = IDCANCEL;
+ EndDialog (dlg, FALSE);
+ break;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+
+int
+InfoBox (HWND hwnd, LPCTSTR text, LPCTSTR title, UINT type)
+{
+ struct infodlg_s inf;
+
+ memset (&inf, 0, sizeof (inf));
+ inf.text = text;
+ inf.title = title;
+ if (type & MB_YESNO) {
+ inf.button_1 = _("Yes");
+ inf.button_2 = _("No");
+ }
+ else {
+ inf.button_1 = _("OK");
+ inf.button_2 = _("Cancel");
+ }
+ if (type & MB_ICONERROR)
+ inf.ico = LoadIcon (NULL, IDI_ERROR);
+ else if (type & MB_ICONWARNING)
+ inf.ico = LoadIcon (NULL, IDI_EXCLAMATION);
+ else if (type & MB_ICONINFORMATION)
+ inf.ico = LoadIcon (NULL, IDI_INFORMATION);
+ DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_INFODLG, hwnd,
+ infodlg_dlg_proc, (LPARAM)&inf);
+ return inf.retval;
+}
+
+
+int
+InfoBoxEx (HWND hwnd, LPCTSTR text, LPCTSTR title, UINT type, ...)
+{
+ va_list arg_ptr;
+ char buf[2048];
+ int id;
+
+ va_start (arg_ptr, type);
+ _vsnprintf (buf, sizeof (buf)-1, text, arg_ptr);
+ id = InfoBox (hwnd, buf, title, type);
+ va_end (arg_ptr);
+ return id;
+}
+#endif
+
Modified: trunk/Src/wptFileManagerDlg.cpp
===================================================================
--- trunk/Src/wptFileManagerDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptFileManagerDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -657,7 +657,7 @@
return TRUE;
case ID_FILEMISC_CLEAR:
- listview_del_all( lv );
+ listview_del_all_items (lv);
return TRUE;
case ID_FILEMISC_OPEN:
Modified: trunk/Src/wptGPGME.cpp
===================================================================
--- trunk/Src/wptGPGME.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptGPGME.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -43,7 +43,6 @@
static gpg_keycache_t pub = NULL;
static gpg_keycache_t sec = NULL;
-static unsigned int reload = 0;
static char *gpg_secring = NULL;
@@ -105,7 +104,6 @@
return err;
}
-/* XXX: cache_keyring_names must be called then the GPG homedir changes! */
/* Initialize both cache contexts. Use @pubring for the public
keyring and @secring for the secret keyring. */
@@ -121,11 +119,7 @@
free_if_alloc (gpg_secring);
gpg_secring = get_gnupg_keyring (0, NO_STRICT);
}
-
- if (reload) {
- keycache_release (0);
- reload = 0;
- }
+
p = get_reg_entry (HKEY_CURRENT_USER, "Software\\WinPT", "nKeys");
if (p && *p != ' ') {
val = atoi (p);
@@ -133,6 +127,9 @@
memset (&pfx, 0, sizeof (pfx));
}
+ /* Release old contexts first. */
+ keycache_release (0);
+
err = gpg_keycache_new (&pub);
if (err)
return err;
@@ -155,22 +152,6 @@
}
-/* If @val = 1 indicate to reload the cache. */
-void
-keycache_set_reload (int val)
-{
- reload = val;
-}
-
-
-/* Return the reload cache flag. */
-int
-keycache_get_reload (void)
-{
- return reload;
-}
-
-
/* Return the public cache context if @is_pub is set
the secre cache context otherwise. */
gpg_keycache_t
Modified: trunk/Src/wptGPGPrefsDlg.cpp
===================================================================
--- trunk/Src/wptGPGPrefsDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptGPGPrefsDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -139,10 +139,13 @@
SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDLG, _("Browse..."));
SetDlgItemText (dlg, IDC_GPGREFS_EXEDLG, _("Browse..."));
SetDlgItemText (dlg, IDC_GPGPREFS_LOCDLG, _("Browse..."));
+ SetDlgItemText (dlg, IDC_GPGPREFS_OVRDEFAULT, _("&Overwrite default settings"));
gpg4win = load_gpg4win_values (dlg);
if (!gpg4win)
load_registry_values (dlg);
+ EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_OVRDEFAULT),
+ gpg4win? TRUE : FALSE);
p = get_gnupg_cfgfile ();
if (p) {
Modified: trunk/Src/wptKeyCache.cpp
===================================================================
--- trunk/Src/wptKeyCache.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyCache.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -503,15 +503,18 @@
/* Return the next key which was updated. Before it is
returned the update flag is cleared.
+ @r_status is 1 for a new key and 2 for an updated key.
Return value: 0 on success. */
gpgme_error_t
gpg_keycache_next_updated_key (gpg_keycache_t ctx,
- struct keycache_s **r_obj)
+ struct keycache_s **r_obj,
+ int *r_status)
{
struct keycache_s *c;
for (c = ctx->item; c; c = c->next) {
- if (c->flags == 1) {
+ if (c->flags != 0) {
+ *r_status = c->flags;
c->flags = 0;
*r_obj = c;
return 0;
@@ -535,6 +538,7 @@
err = gpgme_new (&gctx);
if (err)
return err;
+ gpgme_set_keylist_mode (gctx, GPGME_KEYLIST_MODE_SIGS);
err = gpgme_get_key (gctx, keyid, &key, is_sec);
gpgme_release (gctx);
if (err)
@@ -544,7 +548,7 @@
log_debug ("keycache update: keyid=%s %p\r\n", keyid, pub);
gpgme_key_release (fndkey);
c->key = key;
- c->flags = 1;
+ c->flags = KC_FLAG_UPD;
if (is_sec && pub != NULL &&
!gpg_keycache_find_key (pub, keyid, 0, &fndkey)) {
log_debug ("keycache update: set public part %p\r\n", fndkey);
@@ -568,7 +572,7 @@
}
}
if (c)
- c->flags = 1;
+ c->flags = KC_FLAG_ADD;
}
return 0;
}
@@ -746,7 +750,8 @@
*r_key = NULL;
return gpg_error (GPG_ERR_EOF);
}
-
+ if (ctx->tmp->flags != 0)
+ ctx->tmp->flags = 0; /* reset the 'updated' status. */
*r_key = flags? ctx->tmp->pubpart->key : ctx->tmp->key;
*c = ctx->tmp = ctx->tmp->next;
ctx->pos++;
Modified: trunk/Src/wptKeyCacheDlg.cpp
===================================================================
--- trunk/Src/wptKeyCacheDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyCacheDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -1,6 +1,6 @@
/* wptKeyCacheDlg.cpp - Key caching dialog
- * Copyright (C) 2000-2005 Timo Schulz
- * Copyright (C) 2005 g10 Code GmbH
+ * Copyright (C) 2000-2006 Timo Schulz
+ * Copyright (C) 2005, 2006 g10 Code GmbH
*
* This file is part of WinPT.
*
@@ -18,7 +18,6 @@
* along with WinPT; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -39,8 +38,9 @@
keycache_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
gpgme_error_t err;
- refresh_cache_s * rcs;
- char * pubring = NULL, * secring = NULL;
+ refresh_cache_s *rcs;
+ char *pubring = NULL;
+ char *secring = NULL;
switch( msg ) {
case WM_INITDIALOG:
@@ -64,7 +64,6 @@
if (rcs->tr_update)
gpg_rebuild_cache (NULL);
if (rcs->kr_update) {
- keycache_set_reload (rcs->kr_reload);
err = keycache_init (pubring, secring);
if (err)
msg_box (dlg, gpgme_strerror (err), _("Key Cache"), MB_ERR);
Modified: trunk/Src/wptKeyEditDlgs.cpp
===================================================================
--- trunk/Src/wptKeyEditDlgs.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyEditDlgs.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -113,7 +113,7 @@
int keygen_check_date (SYSTEMTIME *st);
void get_userid_preflist (char **r_prefs, int * r_flags);
-char* get_subkey_fingerprint (const char *keyid);
+char* get_subkey_keyid (const char *keyid);
/* Associate each key with a combo box entry.
@@ -195,18 +195,21 @@
_snprintf (info, sizeof info-1, "%d-bit %s",
keygen->bits,
get_key_pubalgo ((gpgme_pubkey_algo_t)keygen->algo));
- _snprintf (keyid, sizeof keyid-1, "0x%s", keygen->fpr+32);
+ _snprintf (keyid, sizeof keyid-1, "0x%s", keygen->fpr+8);
n = listview_count_items (lv, 0);
listview_add_item_pos (lv, n);
listview_add_sub_item (lv, n, 0, info);
listview_add_sub_item (lv, n, 1, keyid);
listview_add_sub_item (lv, n, 2, get_key_created (time (NULL)));
listview_add_sub_item (lv, n, 3, expdate);
- if (flags & KM_FLAG_REVOKED) s = _("Revoked");
- else if (flags & KM_FLAG_EXPIRED) s = _("Expired");
- else s = _("OK");
+ if (flags & KM_FLAG_REVOKED)
+ s = _("Revoked");
+ else if (flags & KM_FLAG_EXPIRED)
+ s = _("Expired");
+ else
+ s = _("OK");
listview_add_sub_item (lv, n, 4, s);
-} /* do_add_new_subkey */
+}
/* Try to find the GPG edit key index which belongs to the user ID
@@ -610,25 +613,27 @@
return FALSE;
case WM_SYSCOMMAND:
- if( LOWORD (wparam) == SC_CLOSE ) {
- EndDialog( dlg, TRUE );
+ if (LOWORD (wparam) == SC_CLOSE) {
+ EndDialog (dlg, TRUE);
}
return FALSE;
case WM_COMMAND:
- if (HIWORD (wparam) == BN_CLICKED && LOWORD (wparam) == IDC_ADDSUBKEY_EXPIRE) {
+ if (HIWORD (wparam) == BN_CLICKED &&
+ LOWORD (wparam) == IDC_ADDSUBKEY_EXPIRE) {
if (IsDlgButtonChecked (dlg, IDC_ADDSUBKEY_EXPIRE))
EnableWindow (GetDlgItem (dlg, IDC_ADDSUBKEY_EXPDATE), FALSE);
else
EnableWindow (GetDlgItem (dlg, IDC_ADDSUBKEY_EXPDATE), TRUE);
}
- if (HIWORD (wparam) == LBN_SELCHANGE && LOWORD (wparam) == IDC_ADDSUBKEY_ALGO) {
+ if (HIWORD (wparam) == LBN_SELCHANGE &&
+ LOWORD (wparam) == IDC_ADDSUBKEY_ALGO) {
index = SendMessage ((HWND)lparam, LB_GETCURSEL, 0, 0);
if (index == 0)
SendDlgItemMessage (dlg, IDC_ADDSUBKEY_SIZE, CB_SETCURSEL, 0, 0);
}
- switch ( LOWORD(wparam) ) {
+ switch (LOWORD (wparam)) {
case IDOK:
lb = GetDlgItem (dlg, IDC_ADDSUBKEY_ALGO);
switch (listbox_get_cursel (lb)) {
@@ -636,17 +641,17 @@
case 1: index = 4; break;
case 2: index = 5; break;
case 3: index = 6; break;
- default:
- msg_box( dlg, _("Please select one entry."), _("Add Subkey"), MB_ERR );
+ default:
+ msg_box (dlg, _("Please select one entry."), _("Add Subkey"), MB_ERR);
return FALSE;
}
size = get_keysize_from_box (dlg, IDC_ADDSUBKEY_SIZE);
if (index == 2 && size != 1024) {
- msg_box( dlg,_("DSS uses a fixed keysize of 1024. Size changed."), _("Add Subkey"), MB_INFO );
+ msg_box (dlg,_("DSS uses a fixed keysize of 1024. Size changed."),
+ _("Add Subkey"), MB_INFO);
size = 1024;
}
valid = diff_time (GetDlgItem (dlg, IDC_ADDSUBKEY_EXPDATE), NULL);
-
keygen->bits = size;
switch (index) {
case 2: keygen->algo = GPGME_PK_DSA; break;
@@ -662,11 +667,11 @@
BUG (NULL);
ke->setCallback (keygen_cb, NULL);
if (ctx->pass)
- ke->setPassphrase (ctx->pass);
+ ke->setPassphrase (ctx->pass);
keygen_cb_dlg_create ();
err = ke->addSubkey ((gpgme_pubkey_algo_t)index, size, valid);
- keygen->fpr = get_subkey_fingerprint (ctx->keyid);
+ keygen->fpr = get_subkey_keyid (ctx->keyid);
keygen_cb_dlg_destroy ();
keygen_cb (NULL, NULL, 0, 0, 0); /* flush */
if (err)
@@ -674,7 +679,7 @@
else {
msg_box (dlg, _("Subkey successfully added."), _("GnuPG Status"), MB_OK);
if (ctx->lv)
- do_add_new_subkey (ctx->lv, keygen, /*XXXk->flags*/0);
+ do_add_new_subkey (ctx->lv, keygen, 0);
ctx->finished = 1;
}
delete ke;
@@ -728,38 +733,25 @@
char*
-get_subkey_fingerprint (const char *keyid)
+get_subkey_keyid (const char *keyid)
{
gpgme_error_t err;
- gpgme_key_t key, main;
+ gpgme_key_t key;
gpgme_ctx_t ctx;
- gpgme_subkey_t last_sk, k, new_sk;
- int n;
+ gpgme_subkey_t subk;
+ char *kid;
err = gpgme_new (&ctx);
if (err)
return NULL;
err = gpgme_get_key (ctx, keyid, &key, 0);
+ gpgme_release (ctx);
if (err)
return NULL;
- /* XXX: this is very slow and complicated */
-
- n = count_subkeys (key);
- last_sk = get_nth_key (key, n-1);
- new_sk = (gpgme_subkey_t)calloc (1, sizeof *new_sk);
- if (!new_sk)
- BUG (NULL);
- memcpy (new_sk, last_sk, sizeof *last_sk);
- new_sk->fpr = strdup (last_sk->fpr);
- new_sk->keyid = strdup (last_sk->keyid);
-
- get_pubkey (keyid, &main);
- for (k=main->subkeys; k->next; k=k->next)
- ;
- k->next = new_sk;
-
+ subk = get_nth_key (key, count_subkeys (key));
+ kid = strdup (subk->keyid);
gpgme_key_release (key);
- return new_sk->fpr;
+ return kid;
}
@@ -783,6 +775,7 @@
memset (&keygen, 0, sizeof (keygen));
memset (&cb, 0, sizeof (cb));
+ cb.lv = lv;
cb.keyid = k->keyid;
cb.pass = k->is_protected? pass : NULL;
cb.opaque = &keygen;
@@ -790,6 +783,7 @@
dlg, keyedit_addsubkey_dlg_proc,
(LPARAM)&cb, _("Add new Subkey"),
IDS_WINPT_KEYEDIT_ADDSUBKEY);
+ safe_free (keygen.fpr);
if (cb.finished)
k->update = 1;
Modified: trunk/Src/wptKeyManager.cpp
===================================================================
--- trunk/Src/wptKeyManager.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyManager.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -81,8 +81,8 @@
/* Return a general description of the key @key. */
-static char*
-key_get_info (gpgme_key_t pk, int is_sec)
+char*
+km_key_get_info (gpgme_key_t pk, int is_sec)
{
const char *fmt = "%s %04d%s/0x%s %s\n \"%s\"";
char *p, *uid;
@@ -463,10 +463,11 @@
_("Key Manager"), MB_INFO);
}
- dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg,
- clip_import_dlg_proc, 0,
- _("Key Import"), IDS_WINPT_IMPORT);
-
+ has_data = dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg,
+ clip_import_dlg_proc, 0,
+ _("Key Import"), IDS_WINPT_IMPORT);
+ if (!has_data)
+ return WPTERR_GENERAL;
return 0;
}
@@ -528,6 +529,7 @@
gpgme_error_t err;
fm_state_s fm_stat;
gpgme_import_result_t res;
+ int no_data = 0;
memset (&fm_stat, 0, sizeof (fm_stat));
fm_stat.opaque = m_strdup (fname);
@@ -559,6 +561,8 @@
}
res = gpgme_op_import_result (ctx);
+ if (res->unchanged == res->considered)
+ no_data = 1;
if (res->new_revocations == 0 && fm_stat.import.revcert == 1)
res->new_revocations = 1;
if (res->secret_imported == 0 && fm_stat.import.has_seckey == 1)
@@ -579,6 +583,8 @@
gpgme_data_release (keydata);
gpgme_release (ctx);
free_if_alloc (fm_stat.opaque);
+ if (no_data)
+ return WPTERR_GENERAL;
return (int)err;
}
@@ -636,7 +642,7 @@
BUG (NULL);
seckey_type = km_check_for_seckey (lv, i, NULL);
if (confirm && !seckey_type) {
- p = key_get_info (key, 0);
+ p = km_key_get_info (key, 0);
rc = log_box (_("Key Manager"), MB_YESNO|MB_ICONWARNING,
_("Do you really want to delete this key?\n\n"
"%s"), p);
@@ -646,7 +652,7 @@
free_if_alloc (p);
}
else if (confirm) {
- p = key_get_info (key, 1);
+ p = km_key_get_info (key, 1);
rc = log_box (_("Key Manager"), MB_YESNO|MB_ICONWARNING,
_("Do you really want to delete this KEY PAIR?\n\n"
"Please remember that you are not able to decrypt\n"
@@ -692,7 +698,7 @@
if (n == 0)
show_msg (dlg, 1500, _("GnuPG Status: Finished"));
gpgme_release (ctx);
- listview_del_items (lv);
+ listview_del_sel_items (lv);
delete_keys_from_cache (rset, k_pos);
free (rset);
Modified: trunk/Src/wptKeyManagerDlg.cpp
===================================================================
--- trunk/Src/wptKeyManagerDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyManagerDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -1,5 +1,5 @@
/* wptKeyManagerDlg.cpp - WinPT Key Manager
- * Copyright (C) 2000-2005 Timo Schulz
+ * Copyright (C) 2000-2006 Timo Schulz
* Copyright (C) 2004 Andreas Jobs
*
* This file is part of WinPT.
@@ -137,8 +137,8 @@
break;
case VK_P:
- if (GetAsyncKeyState (VK_CONTROL))
- km_clip_import (keylist_proc.dlg);
+ if (GetAsyncKeyState (VK_CONTROL))
+ send_cmd_id (keylist_proc.dlg, ID_KEYMISC_PASTE);
break;
case VK_F:
@@ -382,6 +382,7 @@
kmi->ypos_sep - rclient.top, bRepaint);
rclient.top = kmi->ypos_sep + 5 + 8;
+#if 0 /* Disable the code until we support groups again. */
/* Place the group text and the group box below the separator */
h = GetDlgItem (dlg, IDC_KEYMISC_GTEXT);
MoveWindow (h, rclient.left, rclient.top, 100, 14, bRepaint);
@@ -391,6 +392,7 @@
MoveWindow (h, rclient.left, rclient.top, rclient.right - rclient.left,
(rclient.bottom < rclient.top) ?
0 : rclient.bottom - rclient.top, bRepaint);
+#endif
/* Repaint the whole thing */
InvalidateRect (dlg, NULL, TRUE);
@@ -488,25 +490,6 @@
}
-
-/* Reload the key cache if requested. */
-static void
-do_check_cache (listview_ctrl_t lv, HWND dlg, HWND sb)
-{
- gpg_keycache_t cache;
-
- if (keycache_get_reload ()) {
- keycache_reload (dlg);
- keycache_set_reload (0);
- cache = keycache_get_ctx (1);
- if (!cache)
- BUG (dlg);
- keylist_reload (lv, cache, KEYLIST_LIST, KEY_SORT_USERID);
- update_status_bar (sb, lv);
- }
-}
-
-
long CALLBACK
separator_wnd_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
@@ -669,6 +652,7 @@
enable_button (tb_hwnd, ID_KEYMISC_SIGN, key_selected && !key_inv);
enable_button (tb_hwnd, ID_KEYMISC_EXPORT, key_selected);
enable_button (tb_hwnd, ID_KEYCTX_COPY, key_selected);
+ enable_button (tb_hwnd, ID_KEYCTX_PASTE, clip_contains_pgpkey ());
/* Enable / disable menu items */
state = key_selected? MF_ENABLED : MF_DISABLED|MF_GRAYED;
@@ -1015,19 +999,56 @@
}
-/* Add all recently updated keys in the cache to the list. */
+/* Return true if the cache contain marked keys. */
+static bool
+updated_keys_avail (void)
+{
+ gpg_keycache_t kc = keycache_get_ctx (1);
+ struct keycache_s *k;
+
+ for (k = kc->item; k; k = k->next) {
+ if (k->flags)
+ return true;
+ }
+ return false;
+}
+
+
+/* Find the index of the key identified by @key. */
+static int
+find_keypos (listview_ctrl_t lv, gpgme_key_t key)
+{
+ gpgme_key_t src;
+ int i;
+
+ for (i=0; i < listview_count_items (lv, 0); i++) {
+ src = (gpgme_key_t)listview_get_item2 (lv, i);
+ if (src && src->subkeys->keyid == key->subkeys->keyid)
+ return i;
+ }
+ return -1;
+}
+
+
+/* Add all recently updated keys in the cache to the list
+ and refresh all GUI elements. */
static void
-refresh_keylist (listview_ctrl_t lv)
+refresh_keylist (struct km_info_s *kmi)
{
struct keycache_s *ctx;
gpg_keycache_t kc;
+ int status=0;
kc = keycache_get_ctx (1);
- while (!gpg_keycache_next_updated_key (kc, &ctx)) {
- keylist_add_key (lv, KEYLIST_LIST, ctx->key);
- /*msg_box (NULL, ctx->key->uids->name, "debug", MB_OK);*/
+ while (!gpg_keycache_next_updated_key (kc, &ctx, &status)) {
+ if (status == KC_FLAG_ADD)
+ keylist_add_key (kmi->lv, KEYLIST_LIST, ctx->key);
+ else
+ keylist_upd_key (kmi->lv, find_keypos (kmi->lv, ctx->key), ctx->key);
+ /*log_box ("debug", 0, "(%d) %s", status, ctx->key->uids->name);*/
}
- keylist_sort (lv, KEY_SORT_USERID);
+ keylist_sort (kmi->lv, KEY_SORT_USERID);
+ update_status_bar (kmi->statbar, kmi->lv);
}
@@ -1036,7 +1057,6 @@
keymanager_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
struct km_info_s *kmi;
- static int refresh_keys = 0;
INITCOMMONCONTROLSEX icex;
HWND kl;
HMENU hm;
@@ -1068,10 +1088,6 @@
translate_menu_strings (dlg);
SetWindowText (dlg, _("Key Manager"));
- if (keyring_check_last_access ())
- keycache_set_reload (1);
- if (keycache_get_reload ())
- keycache_reload (dlg);
c = keycache_get_ctx (KEYCACHE_PUB);
if (!c)
BUG (NULL);
@@ -1123,9 +1139,12 @@
/* Remove runtime information. This should be the last action taken here. */
delete kmi; kmi = NULL;
SetWindowLong (dlg, GWL_USERDATA, 0);
- keycache_set_reload (refresh_keys);
return FALSE;
+ case WM_SHOWWINDOW:
+ /*refresh_keylist (kmi);*/
+ break;
+
case WM_MOVE:
RECT r;
GetWindowRect (dlg, &r);
@@ -1248,8 +1267,7 @@
if (notify->idFrom == IDC_KEYMISC_KEYLIST) {
l_idx =listview_get_curr_pos (kmi->lv);
if (l_idx == -1)
- return TRUE; /* Popup only when a item was selected */
- do_check_cache (kmi->lv, dlg, kmi->statbar);
+ return TRUE; /* Popup only when a item was selected */
GetCursorPos (&p);
hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYMISC_CTX));
popup = GetSubMenu (hm, 0);
@@ -1362,17 +1380,11 @@
_("Key Manager"), MB_ERR);
return FALSE;
}
- do_check_cache (kmi->lv, dlg, kmi->statbar);
- switch( LOWORD (wparam)) {
+
+ switch (LOWORD (wparam)) {
case ID_KEYMISC_QUIT:
EndDialog (dlg, TRUE);
return TRUE;
-
- case ID_KEYMISC_MAIL:
- /* XXX
- DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_MAIL, GetDesktopWindow (),
- winpt_mail_proc, NULL);*/
- break;
case ID_KEYMISC_FIND:
km_find_key (dlg, kmi->lv);
@@ -1394,13 +1406,14 @@
return TRUE;
key = (gpgme_key_t)listview_get_item2 (kmi->lv, kmi->lv_idx);
memset (&k, 0, sizeof (k));
+ strncpy (k.tmp_keyid, key->subkeys->keyid+8, 8);
k.ctx = key;
k.keyid = key->subkeys->keyid;
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYSIGN, dlg,
keysign_dlg_proc, (LPARAM)&k,
_("Key Signing"), IDS_WINPT_KEYSIGN);
if (k.update)
- update_key (kmi->lv, kmi->lv_idx, k.keyid, 0);
+ update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 0);
return TRUE;
case ID_KEYMISC_REVCERT:
@@ -1465,12 +1478,15 @@
if (!key)
BUG (NULL);
memset (&k, 0, sizeof (k));
- k.keyid = key->subkeys->keyid+8;
+ strncpy (k.tmp_keyid, key->subkeys->keyid+8, 8);
+ k.keyid = k.tmp_keyid;
k.uid = key->uids->uid;
k.ctx = (gpgme_key_t)listview_get_item2 (kmi->lv, kmi->lv_idx);
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYSIG, dlg,
keysig_dlg_proc, (LPARAM)&k,
_("Key Signature List" ), IDS_WINPT_KEYSIG);
+ if (k.update)
+ update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 0);
return TRUE;
case ID_KEYMISC_PROPS:
@@ -1497,9 +1513,7 @@
return TRUE;
case ID_KEYMISC_RECACHE:
- /* If there is already a reload request,
- don't bother the user with a message. */
- if (keycache_get_reload () == 1)
+ if (updated_keys_avail ())
l_idx = IDYES;
else {
char inf[256];
@@ -1518,8 +1532,8 @@
if (!c)
BUG (dlg);
keylist_reload (kmi->lv, c, KEYLIST_LIST, KEY_SORT_USERID);
- refresh_keys = 0;
}
+ SetForegroundWindow (dlg);
return TRUE;
case ID_KEYMISC_REBUILD:
@@ -1530,6 +1544,7 @@
show_msg (dlg, 2000, line? name + (line-name)+1 : name);
safe_free (name);
}
+ SetForegroundWindow (dlg);
return TRUE;
case ID_KEYMISC_NEWKEY:
@@ -1537,10 +1552,8 @@
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYGEN, dlg,
keygen_dlg_proc, (LPARAM)&genkey, _("Key Generation"),
IDS_WINPT_KEYGEN);
- if (genkey.newkey != NULL) {
- keylist_add_key (kmi->lv, KEYLIST_LIST, genkey.newkey);
- keylist_sort (kmi->lv, KEY_SORT_USERID);
- }
+ if (genkey.cancel == 0)
+ refresh_keylist (kmi);
return TRUE;
case ID_KEYMISC_CARDNEW:
@@ -1552,8 +1565,7 @@
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_CARD_KEYGEN, dlg,
card_keygen_dlg_proc, 0, _("Card Key Generation"),
IDS_WINPT_CARD_KEYGEN);
- /* XXX: use new code */
- if (keycache_get_reload ())
+ if (updated_keys_avail ())
send_cmd_id (dlg, ID_KEYMISC_RECACHE);
return TRUE;
@@ -1563,17 +1575,15 @@
keygen_wizard_dlg_proc, (LPARAM)&genkey,
_("Key Generation Wizard"),
IDS_WINPT_KEYWIZARD);
- if (genkey.newkey != NULL) {
- keylist_add_key (kmi->lv, KEYLIST_LIST, genkey.newkey);
- keylist_sort (kmi->lv, KEY_SORT_USERID);
- }
+ if (genkey.cancel == 0)
+ refresh_keylist (kmi);
return TRUE;
case ID_KEYMISC_SENDRECV:
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYSERVER, dlg,
keyserver_dlg_proc, 0, _("Keyserver Access"),
IDS_WINPT_KEYSERVER);
- refresh_keylist (kmi->lv);
+ refresh_keylist (kmi);
return TRUE;
case ID_KEYMISC_GPGPREFS:
@@ -1591,15 +1601,19 @@
case ID_KEYMISC_IMPORT:
t = get_fileopen_dlg (dlg, _("Choose Name of the Key File"),
NULL, NULL);
- if (t)
- km_file_import (dlg, t);
+ if (!t)
+ break;
+ if (!km_file_import (dlg, t))
+ refresh_keylist (kmi);
return TRUE;
case ID_KEYMISC_IMPORT_HTTP:
url = (struct URL_ctx_s*)get_http_file_dlg (dlg);
- if (url->cancel == 0)
+ if (url->cancel == 0) {
km_http_import (dlg, url->url);
- delete url; url=NULL;
+ refresh_keylist (kmi);
+ }
+ free_if_alloc (url);
break;
case ID_KEYMISC_EXPORT:
@@ -1683,16 +1697,17 @@
BUG (NULL);
/* XXX: pub/crd = secret key does not work */
memset (&k, 0, sizeof (k));
+ strncpy (k.tmp_keyid, key->subkeys->keyid+8, 8);
+ k.keyid = k.tmp_keyid;
k.is_protected = km_check_if_protected (kmi->lv, kmi->lv_idx);
k.key_pair = km_check_for_seckey (kmi->lv, kmi->lv_idx, NULL);
- k.keyid = key->subkeys->keyid+8;
k.is_v3 = km_key_is_v3 (kmi->lv, kmi->lv_idx);
k.flags = km_get_key_status (kmi->lv, kmi->lv_idx);
dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT, dlg,
keyedit_main_dlg_proc, (LPARAM)&k,
_("Key Edit"), IDS_KEYCTX_EDIT);
if (k.update)
- update_key (kmi->lv, kmi->lv_idx, k.keyid, 1);
+ update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 1);
break;
case ID_KEYMISC_COPY:
@@ -1704,7 +1719,8 @@
break;
case ID_KEYMISC_PASTE:
- km_clip_import (dlg);
+ if (!km_clip_import (dlg))
+ refresh_keylist (kmi);
break;
case ID_KEYCTX_SETPREFKS:
@@ -1764,12 +1780,13 @@
if (!key)
BUG (NULL);
memset (&k, 0, sizeof (k));
+ strncpy (k.tmp_keyid, key->subkeys->keyid+8, 8);
+ k.keyid = k.tmp_keyid;
k.key_pair = km_check_for_seckey (kmi->lv, kmi->lv_idx, NULL);
k.is_protected = km_check_if_protected (kmi->lv, kmi->lv_idx);
- k.keyid = key->subkeys->keyid+8;
keyedit_add_subkey (&k, dlg, NULL);
if (k.update)
- update_key (kmi->lv, kmi->lv_idx, k.keyid, 1);
+ update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 1);
break;
case ID_KEYCTX_ADDUID:
@@ -1777,12 +1794,13 @@
if (!key)
BUG (NULL);
memset (&k, 0, sizeof (k));
+ strncpy (k.tmp_keyid, key->subkeys->keyid+8, 8);
+ k.keyid = k.tmp_keyid;
k.key_pair = km_check_for_seckey (kmi->lv, kmi->lv_idx, NULL);
k.is_protected = km_check_if_protected (kmi->lv, kmi->lv_idx);
- k.keyid = key->subkeys->keyid+8;
keyedit_add_userid (&k, dlg, NULL);
if (k.update)
- update_key (kmi->lv, kmi->lv_idx, k.keyid, 1);
+ update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 1);
break;
case ID_KEYCTX_ADDREV:
@@ -1790,12 +1808,13 @@
if (!key)
BUG (NULL);
memset (&k, 0, sizeof (k));
- k.keyid = key->subkeys->keyid+8;
+ strncpy (k.tmp_keyid, key->subkeys->keyid+8, 8);
+ k.keyid = k.tmp_keyid;
k.is_protected = km_check_if_protected (kmi->lv, kmi->lv_idx);
k.key_pair = km_check_for_seckey (kmi->lv, kmi->lv_idx, NULL);
keyedit_add_revoker (&k, dlg);
if (k.update)
- update_key (kmi->lv, kmi->lv_idx, k.keyid, 1);
+ update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 1);
break;
case ID_KEYCTX_ADDPHOTO:
@@ -1803,12 +1822,13 @@
if (!key)
BUG (NULL);
memset (&k, 0, sizeof (k));
- k.keyid = key->subkeys->keyid+8;
+ strncpy (k.tmp_keyid, key->subkeys->keyid+8, 8);
+ k.keyid = k.tmp_keyid;
k.is_protected = km_check_if_protected (kmi->lv, kmi->lv_idx);
k.key_pair = km_check_for_seckey (kmi->lv, kmi->lv_idx, NULL);
keyedit_add_photo (&k, dlg);
if (k.update)
- update_key (kmi->lv, kmi->lv_idx, k.keyid, 1);
+ update_key (kmi->lv, kmi->lv_idx, k.tmp_keyid, 1);
break;
case ID_KEYCTX_KS_NL:
@@ -1856,11 +1876,11 @@
break;
case ID_KEYCTX_COPY:
- km_clip_export (dlg, kmi->lv);
+ send_cmd_id (dlg, ID_KEYMISC_COPY);
break;
case ID_KEYCTX_PASTE:
- km_clip_import (dlg);
+ send_cmd_id (dlg, ID_KEYMISC_PASTE);
break;
case ID_KEYCTX_DISABLE:
Modified: trunk/Src/wptKeyPropsDlg.cpp
===================================================================
--- trunk/Src/wptKeyPropsDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyPropsDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -1,5 +1,5 @@
/* wptKeyPropsDlg.cpp - WinPT key properties dialog
- * Copyright (C) 2000, 2001, 2002, 2003, 2005 Timo Schulz
+ * Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006 Timo Schulz
*
* This file is part of WinPT.
*
@@ -51,7 +51,7 @@
/* Convert a trust integer into a string representation. */
static const char*
-ownertrust_to_string (int val)
+ownertrust_to_string (int val, bool is_keypair)
{
const char *inf;
int id = val;
@@ -62,7 +62,11 @@
case 3: inf = _("I trust marginally"); break;
case 4: inf = _("I trust fully"); break;
case 5:
- case 6: inf = _("I trust ultimately"); break;
+ case 6:
+ if (is_keypair)
+ inf = _("I trust ultimately (implicit)");
+ else
+ inf = _("I trust ultimately"); break;
default:inf = _("Unknown"); break;
}
@@ -254,7 +258,7 @@
SetDlgItemText (dlg, IDC_KEYPROPS_INFO, info);
SetDlgItemText (dlg, IDC_KEYPROPS_FPR, get_key_fpr (key));
- inf = ownertrust_to_string (key->owner_trust);
+ inf = ownertrust_to_string (key->owner_trust, k->key_pair);
SetDlgItemText (dlg, IDC_KEYPROPS_OT, inf);
*r_key = key;
@@ -270,6 +274,7 @@
gpgme_validity_t valid;
refresh_cache_s rcs = {0};
const char *inf;
+ int cancel = 0;
int rc;
/* XXX: static variable (k) prevent that the dialog can
@@ -282,7 +287,7 @@
SetWindowText (dlg, _("Key Properties"));
SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change"));
SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers"));
- SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Passwd"));
+ SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Password"));
SetDlgItemText (dlg, IDC_KEYPROPS_OTINF, _("Ownertrust"));
display_key_info (dlg, k, &key);
@@ -295,6 +300,8 @@
EnableWindow (GetDlgItem (dlg, IDC_KEYPROPS_CHANGE_PWD), TRUE);
if (check_for_desig_rev (key))
EnableWindow (GetDlgItem (dlg, IDC_KEYPROPS_REVOKERS), TRUE);
+ if (key->revoked || key->expired)
+ EnableWindow (GetDlgItem (dlg, IDC_KEYPROPS_OT_CHANGE), FALSE);
center_window (dlg, NULL);
SetForegroundWindow (dlg);
return TRUE;
@@ -326,11 +333,11 @@
_("WinPT Warning"), MB_ERR);
return TRUE;
}
- if( !k->key_pair && key->uids->validity < 3 ) {
- rc = msg_box( dlg, _("This is a non-valid key.\n"
+ if (!k->key_pair && key->uids->validity < 3) {
+ rc = msg_box (dlg, _("This is a non-valid key.\n"
"Modifying the ownertrust has no effect on such keys.\n\n"
"Do you really want to continue?"),
- _("WinPT Warning"), MB_ICONWARNING|MB_YESNO );
+ _("WinPT Warning"), MB_ICONWARNING|MB_YESNO);
if (rc == IDNO)
return TRUE;
}
@@ -343,17 +350,12 @@
break;
}
- inf = ownertrust_to_string (k->callback.new_val);
+ inf = ownertrust_to_string (k->callback.new_val, k->key_pair);
SetDlgItemText (dlg, IDC_KEYPROPS_OT, inf);
msg_box (dlg, _("Ownertrust successfully changed."),
_("GnuPG Status"), MB_OK);
- /* XXX: modified ownertrust values can effect the entire
- WoT so we reload the cache. But this is very slow. */
- memset (&rcs, 0, sizeof (rcs));
- rcs.kr_reload = 1; rcs.kr_update = 1; /* reload only keylist */
- DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, dlg,
- keycache_dlg_proc, (LPARAM)&rcs);
+ keycache_update (0, key->subkeys->keyid);
return TRUE;
case IDC_KEYPROPS_CHANGE_PWD:
Modified: trunk/Src/wptKeygenDlg.cpp
===================================================================
--- trunk/Src/wptKeygenDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeygenDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -497,17 +497,19 @@
keycache_update (0, fpr);
keycache_update (1, fpr);
- if (ctx != NULL && ctx->first_start == 0)
- get_pubkey (fpr, &ctx->newkey);
- safe_free (fpr);
+ safe_free (fpr);
clear_dlg_fields (dlg);
backup_keyrings (dlg);
+ if (ctx)
+ ctx->cancel = 0;
EndDialog (dlg, TRUE);
return TRUE;
case IDCANCEL:
- EndDialog (dlg, FALSE);
+ if (ctx)
+ ctx->cancel = 1;
+ EndDialog (dlg, FALSE);
return FALSE;
}
break;
@@ -611,16 +613,18 @@
keycache_update (0, fpr);
keycache_update (1, fpr);
- if (ctx->first_start == 0 && ctx != NULL)
- get_pubkey (fpr, &ctx->newkey);
- if (fpr)
- free (fpr);
+ safe_free (fpr);
+
backup_keyrings (dlg);
+ if (ctx)
+ ctx->cancel = 0;
EndDialog (dlg, TRUE);
break;
case IDCANCEL:
- EndDialog( dlg, FALSE );
+ if (ctx)
+ ctx->cancel = 1;
+ EndDialog (dlg, FALSE);
break;
}
break;
Modified: trunk/Src/wptKeylist.cpp
===================================================================
--- trunk/Src/wptKeylist.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeylist.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -429,6 +429,8 @@
return GPGME_VALIDITY_ULTIMATE+1;
else if (k->expired)
return GPGME_VALIDITY_ULTIMATE+2;
+ else if (k->disabled)
+ return GPGME_VALIDITY_ULTIMATE+3;
return k->uids->validity;
}
@@ -582,6 +584,7 @@
ico[0] = LoadIcon (glob_hinst, (LPCTSTR)IDI_PUBKEY);
ico[1] = LoadIcon (glob_hinst, (LPCTSTR)IDI_KEYPAIR);
listview_set_image_list (lv, ico, 2);
+ listview_del_all_items (lv);
*r_lv = lv;
return 0;
@@ -639,7 +642,7 @@
int
keylist_reload (listview_ctrl_t lv, gpg_keycache_t pubkc, int mode, int sortby)
{
- listview_del_all (lv);
+ listview_del_all_items (lv);
keylist_load_keycache( lv, mode, pubkc, NULL );
keylist_sort (lv, sortby);
return 0;
@@ -928,7 +931,7 @@
int
keylist_sort (listview_ctrl_t lv, int sortby)
-{
+{
return listview_sort_items (lv, sortby, keylist_cmp_cb);
}
Modified: trunk/Src/wptKeyserver.cpp
===================================================================
--- trunk/Src/wptKeyserver.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyserver.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -24,6 +24,7 @@
#endif
#include <windows.h>
+#include <shlobj.h>
#include <stdio.h>
#include <sys/stat.h>
#include <ctype.h>
@@ -33,7 +34,6 @@
#include "wptTypes.h"
#include "wptNLS.h"
#include "wptW32API.h"
-#include "wptVersion.h"
#include "wptGPG.h"
#include "wptRegistry.h"
@@ -329,8 +329,12 @@
void
wsock_end (void)
{
+ char *p;
int i;
+ p = make_special_filename (CSIDL_APPDATA, "winpt\\keyserver.conf", NULL);
+ kserver_save_conf (p);
+ free_if_alloc (p);
free_if_alloc (default_keyserver);
for (i=0; i < MAX_KEYSERVERS; i++) {
if (server[i].used)
@@ -520,6 +524,31 @@
}
+/* Save the keyserver config file in @conf. */
+int
+kserver_save_conf (const char *conf)
+{
+ FILE *fp;
+ int pos;
+
+ fp = fopen (conf, "wb");
+ if (!fp) {
+ msg_box (NULL, _("Could not save keyserver.conf file"),
+ _("Keyserver"), MB_ERR);
+ return -1;
+ }
+
+ fprintf (fp, "# do NOT manually modify this file, it will be generated automatically!!\r\n");
+ for (pos = 0; pos < MAX_KEYSERVERS; pos++) {
+ if (!server[pos].used)
+ continue;
+ fprintf (fp, "%s\r\n", server[pos].name);
+ }
+ fclose (fp);
+ return 0;
+}
+
+
/* Load the keyserver config file @conf. */
int
kserver_load_conf (const char *conf)
Modified: trunk/Src/wptKeyserverDlg.cpp
===================================================================
--- trunk/Src/wptKeyserverDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeyserverDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -40,13 +40,23 @@
#include "wptDlgs.h"
#include "wptUTF8.h"
-
#define MAX_KEYSIZE 70000
char* get_reg_entry_keyserver (const char *);
int set_reg_entry_keyserver (const char *, const char *);
+enum { KS_COL_NAME = 0, KS_COL_PORT, KS_COL_DEFAULT };
+/* Callback context to modify (add, edit) keyserver items. */
+struct keyserver_rec_s {
+ char name[200]; /* hostname */
+ int proto; /* protocol */
+ int port; /* used port */
+ bool mode; /* true = edit */
+ bool cancel;
+};
+typedef struct keyserver_rec_s *keyserver_rec_t;
+
/* Print out keyserver error and a possible Winsock error. */
static void
hkp_err_box (HWND dlg, const char *host, WORD port, int rc)
@@ -270,7 +280,7 @@
int rc = 1;
/* Whitespace are not allowed! */
- if (strchr( pattern, ' ')) {
+ if (strchr (pattern, ' ')) {
rc = WPTERR_GENERAL;
goto leave;
}
@@ -287,7 +297,8 @@
goto leave;
}
- if( ( strchr( pattern, '@' ) ) && ( strlen( pattern ) >= 3 ) ) {
+ if ((strchr (pattern, '@')) &&
+ (strlen (pattern) >= 3)) {
rc = 0;
goto leave;
}
@@ -313,7 +324,7 @@
else
strcat (proxy, "none");
SetDlgItemText (dlg, IDC_KEYSERVER_PROXY, proxy);
-} /* set_proxy */
+}
static int inline
@@ -330,10 +341,12 @@
{
char buf[16];
- listview_get_item_text (lv, kserver_get_pos (lv), 3, buf, 15);
+ listview_get_item_text (lv, kserver_get_pos (lv), KS_COL_PORT, buf, 15);
return (u16)strtoul (buf, NULL, 10);
}
+
+/* Load the default keyserver and mark it in @lv. */
static void
load_default_ks (listview_ctrl_t lv)
{
@@ -343,54 +356,54 @@
p = get_reg_entry_keyserver ("Default");
if (!p)
return;
- for( i = 0; i < listview_count_items( lv, 0 ); i++ ) {
- listview_get_item_text( lv, i, 0, buf, sizeof (buf)-1 );
- if( !strncmp( p, buf, strlen( p ) ) ) {
- listview_add_sub_item( lv, i, 2, "x" );
+ for (i = 0; i < listview_count_items( lv, 0); i++ ) {
+ listview_get_item_text (lv, i, KS_COL_NAME, buf, sizeof (buf)-1);
+ if (!strncmp (p, buf, strlen (p))) {
+ listview_add_sub_item (lv, i, KS_COL_DEFAULT, "x");
break;
}
}
free_if_alloc (p);
-} /* load_default_ks */
+}
-
+/* Save the selected keyserver from @lv as the default server. */
static int
save_default_ks (listview_ctrl_t lv)
{
char buf[192], port[32];
int idx, i;
- idx = listview_get_curr_pos( lv );
- if( idx == -1 ) {
- msg_box( NULL, _("Please select one of the servers."), _("Keyserver"), MB_ERR );
+ idx = listview_get_curr_pos (lv);
+ if (idx == -1) {
+ msg_box (NULL, _("Please select one of the servers."), _("Keyserver"), MB_ERR);
return -1;
}
- listview_get_item_text( lv, idx, 1, buf, sizeof (buf)-1 );
- if( *buf != 'H' ) {
- msg_box( NULL, _("Only HTTP keyserver can be used."), _("Keyserver"), MB_ERR );
+ listview_get_item_text (lv, idx, KS_COL_NAME, buf, sizeof (buf)-1);
+ if (!strncmp (buf, "http", 4) && !strncmp (buf, "hkp", 3)) {
+ msg_box (NULL, _("Only HTTP keyserver can be used."),
+ _("Keyserver"), MB_ERR);
return -1;
}
- for (i = 0; i < listview_count_items( lv, 0 ); i++)
- listview_add_sub_item (lv, i, 2, "");
- listview_add_sub_item (lv, idx, 2, "x");
- listview_get_item_text (lv, idx, 0, buf, sizeof (buf)-1);
+ for (i = 0; i < listview_count_items (lv, 0); i++)
+ listview_add_sub_item (lv, i, KS_COL_DEFAULT, "");
+ listview_add_sub_item (lv, idx, KS_COL_DEFAULT, "x");
+ listview_get_item_text (lv, idx, KS_COL_NAME, buf, sizeof (buf)-1);
set_reg_entry_keyserver ("Default", buf);
i = kserver_get_port (lv);
sprintf (port, "%d", i);
set_reg_entry_keyserver ("Default_Port", port);
keyserver_set_default (buf, (u16)i);
return 0;
-} /* save_default_ks */
+}
int
keyserver_list_build (listview_ctrl_t *r_lv, HWND hwnd)
{
struct listview_column_s keyserver[] = {
- {0, 160, (char *)_("DNS Name")},
- {1, 52, (char *)_("Protocol")},
- {2, 46, (char *)_("Default")},
- {3, 46, (char *)_("Port")},
+ {0, 160, (char *)_("DNS Name")},
+ {1, 46, (char *)_("Port")},
+ {2, 60, (char *)_("Default")},
{0, 0, NULL}
};
HICON ico[1];
@@ -408,23 +421,14 @@
if (!server[j].used)
continue;
listview_add_item_image (lv, " ", 0);
- listview_add_sub_item (lv, 0, 0, server[j].name);
- switch (server[j].proto) {
- case KSPROTO_HTTP:
- listview_add_sub_item( lv, 0, 1, "H" ); break;
- case KSPROTO_LDAP:
- listview_add_sub_item( lv, 0, 1, "L" ); break;
- case KSPROTO_FINGER:
- listview_add_sub_item( lv, 0, 1, "F" ); break;
- }
+ listview_add_sub_item (lv, 0, KS_COL_NAME, server[j].name);
sprintf (buf, "%d", server[j].port);
- listview_add_sub_item (lv, 0, 3, buf);
+ listview_add_sub_item (lv, 0, KS_COL_PORT, buf);
}
load_default_ks (lv);
if (listview_count_items (lv, 0) == 0) {
listview_add_item (lv, "");
- listview_add_sub_item (lv, 0, 0, DEF_HKP_KEYSERVER);
- listview_add_sub_item (lv, 0, 1, "H");
+ listview_add_sub_item (lv, 0, KS_COL_NAME, DEF_HKP_KEYSERVER);
}
listview_set_ext_style (lv);
*r_lv = lv;
@@ -432,6 +436,152 @@
}
+static void
+keyserver_remove (listview_ctrl_t lv)
+{
+ char name[100];
+ int pos = listview_get_curr_pos (lv);
+ int i;
+
+ listview_get_item_text (lv, pos, KS_COL_NAME, name, sizeof (name)-1);
+ for (i=0; i < MAX_KEYSERVERS; i++) {
+ if (server[i].name && strcmp (server[i].name, name) == 0)
+ server[i].used = 0;
+ }
+ listview_del_item (lv, pos);
+}
+
+
+static void
+keyserver_edit (listview_ctrl_t lv, keyserver_rec_t ctx)
+{
+ char buf[16];
+ bool fnd = false;
+ int i;
+
+ for (i=0; i < MAX_KEYSERVERS; i++) {
+ if (server[i].name && strcmp (server[i].name, ctx->name) == 0) {
+ fnd = true;
+ break;
+ }
+ }
+ if (!fnd)
+ return;
+ server[i].port = ctx->port;
+
+ i = listview_get_curr_pos (lv);
+ sprintf (buf, "%d", ctx->port);
+ listview_add_sub_item (lv, i, KS_COL_NAME, ctx->name);
+ listview_add_sub_item (lv, i, KS_COL_PORT, buf);
+}
+
+static void
+keyserver_add (listview_ctrl_t lv, keyserver_rec_t ctx)
+{
+ char buf[16];
+ bool fnd = false;
+ int i;
+
+ for (i=0; i < MAX_KEYSERVERS; i++) {
+ if (server[i].used == 0) {
+ fnd = true;
+ break;
+ }
+ }
+ if (!fnd) {
+ msg_box (NULL, _("No space for new keyserver entry"),
+ _("Keyserver"), MB_ERR);
+ return;
+ }
+ free_if_alloc (server[i].name);
+ server[i].name = m_strdup (ctx->name);
+ server[i].port = ctx->port;
+ server[i].proto = ctx->proto;
+ server[i].used = 1;
+
+ sprintf (buf, "%d", ctx->port);
+ listview_add_item (lv, " ");
+ listview_add_sub_item (lv, 0, KS_COL_NAME, ctx->name);
+ listview_add_sub_item (lv, 0, KS_COL_PORT, buf);
+}
+
+
+static void
+fill_keyserv_types (HWND dlg)
+{
+ HWND h = GetDlgItem (dlg, IDC_KSERVADD_TYPES);
+ combox_add_string (h, _("HKP Keyserver"));
+ combox_add_string (h, _("LDAP Keyserver"));
+ combox_add_string (h, _("Finger Keyserver"));
+ SendMessage (h, CB_SETCURSEL, 0, 0);
+}
+
+
+/* Dialog box procedure for modify keyservers. */
+BOOL CALLBACK
+keyserver_modify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ static keyserver_rec_t ctx;
+ char tmp[128];
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ fill_keyserv_types (dlg);
+ ctx = (keyserver_rec_t)lparam;
+ if (ctx->mode) {
+ SendDlgItemMessage (dlg, IDC_KSERVADD_TYPES, CB_SETCURSEL, ctx->proto, 0);
+ SetDlgItemText (dlg, IDC_KSERVADD_HOST, ctx->name);
+ SetDlgItemInt (dlg, IDC_KSERVADD_PORT, ctx->port, FALSE);
+ EnableWindow (GetDlgItem (dlg, IDC_KSERVADD_HOST), FALSE);
+ EnableWindow (GetDlgItem (dlg, IDC_KSERVADD_TYPES), FALSE);
+ }
+ else
+ SetDlgItemInt (dlg, IDC_KSERVADD_PORT, 11371, FALSE);
+ SetWindowText (dlg, _("Edit Keyserver"));
+ SetDlgItemText (dlg, IDOK, _("&Add"));
+ SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
+ SetDlgItemText (dlg, IDC_KSERVADD_TYPEINF, _("Type:"));
+ SetDlgItemText (dlg, IDC_KSERVADD_PORTINF, _("Port:"));
+ SetDlgItemText (dlg, IDC_KSERVADD_HOSTINF, _("Host name:"));
+ SetForegroundWindow (dlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD (wparam)) {
+ case IDOK:
+ if (!GetDlgItemText (dlg, IDC_KSERVADD_HOST, tmp, sizeof (tmp)-1)) {
+ msg_box (dlg, _("Please enter a host name"), _("Keyserver"), MB_ERR);
+ return FALSE;
+ }
+ ctx->port = GetDlgItemInt (dlg, IDC_KSERVADD_PORT, NULL, FALSE);
+ if (ctx->port > 65535) {
+ msg_box (dlg, _("Invalid port, valid numbers are < 65535"), _("Keyserver"), MB_ERR);
+ return FALSE;
+ }
+ ctx->proto = SendDlgItemMessage (dlg, IDC_KSERVADD_TYPES, CB_GETCURSEL, 0, 0);
+ ctx->cancel = false;
+ if (!strstr (tmp, "://")) {
+ switch (ctx->proto) {
+ case KSPROTO_HTTP: strcpy (ctx->name, "http://"); break;
+ case KSPROTO_LDAP: strcpy (ctx->name, "ldap://"); break;
+ case KSPROTO_FINGER:strcpy (ctx->name, "finger://"); break;
+ }
+ }
+ strcat (ctx->name, tmp);
+ EndDialog (dlg, TRUE);
+ break;
+
+ case IDCANCEL:
+ ctx->cancel = true;
+ EndDialog (dlg, FALSE);
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
/* Dialog box procedure to access keyservers. */
BOOL CALLBACK
keyserver_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
@@ -439,6 +589,7 @@
static listview_ctrl_t lv = NULL;
static int lv_idx = 0;
keyserver_ctx ksc;
+ struct keyserver_rec_s edit;
char kserver[128], pattern[128];
char proto[16], *fpr = NULL;
int rc, proto_nr = 0;
@@ -465,9 +616,26 @@
case WM_NOTIFY:
NMHDR *notify;
notify = (NMHDR *)lparam;
- if (notify && notify->code == NM_CLICK
+ if (!notify)
+ break;
+ if (notify->code == NM_CLICK
&& notify->idFrom == IDC_KEYSERVER_LIST)
lv_idx = listview_get_curr_pos (lv);
+ else if (notify->code == NM_RCLICK &&
+ notify->idFrom == IDC_KEYSERVER_LIST) {
+ POINT p;
+ GetCursorPos (&p);
+ HMENU hm, pop;
+ hm = LoadMenu (glob_hinst, (LPCTSTR)IDR_WINPT_KEYSERVER_CTX);
+ pop = GetSubMenu (hm, 0);
+ set_menu_text (pop, ID_KSERVCTX_ADD, _("&Add"));
+ set_menu_text (pop, ID_KSERVCTX_DEL, _("&Remove"));
+ set_menu_text (pop, ID_KSERVCTX_EDIT, _("&Edit"));
+ TrackPopupMenu (pop, 0, p.x, p.y, 0, dlg, NULL);
+ DestroyMenu (hm);
+ DestroyMenu (pop);
+ }
+
return TRUE;
case WM_DESTROY:
@@ -501,13 +669,15 @@
return FALSE;
}
}
- listview_get_item_text (lv, lv_idx, 1, proto, sizeof (proto)-1);
- if (*proto == 'L') {
+ listview_get_item_text (lv, lv_idx, KS_COL_NAME,
+ proto, sizeof (proto)-1);
+ if (!strncmp (proto, "ldap", 4)) {
msg_box (dlg, _("This is not implemented yet!"),
_("Keyserver"), MB_ERR);
return FALSE;
}
- listview_get_item_text (lv, lv_idx, 0, kserver, sizeof (kserver)-1);
+ listview_get_item_text (lv, lv_idx, KS_COL_NAME,
+ kserver, sizeof (kserver)-1);
if (!GetDlgItemText (dlg, IDC_KEYSERVER_SEARCH, pattern, sizeof (pattern)-1)) {
msg_box (dlg, _("Please enter the search pattern."),
_("Keyserver"), MB_INFO);
@@ -530,32 +700,36 @@
return FALSE;
}
}
- listview_get_item_text( lv, lv_idx, 1, proto, sizeof (proto)-1 );
+ listview_get_item_text (lv, lv_idx, KS_COL_NAME,
+ proto, sizeof (proto)-1);
proto_nr = KSPROTO_HTTP;
- if (*proto == 'L')
+ if (!strncmp (proto, "ldap", 4))
proto_nr = KSPROTO_LDAP;
- else if (*proto == 'F')
+ else if (!strncmp (proto, "finger", 6))
proto_nr = KSPROTO_FINGER;
- listview_get_item_text (lv, lv_idx, 0, kserver, sizeof (kserver)-1);
- if( !GetDlgItemText( dlg, IDC_KEYSERVER_SEARCH, pattern, sizeof (pattern)-1)) {
+ listview_get_item_text (lv, lv_idx, KS_COL_NAME,
+ kserver, sizeof (kserver)-1);
+ if (!GetDlgItemText(dlg, IDC_KEYSERVER_SEARCH,
+ pattern, sizeof (pattern)-1)) {
msg_box (dlg, _("Please enter the search pattern."),
_("Keyserver"), MB_INFO);
return FALSE;
}
if (proto_nr == KSPROTO_LDAP && strchr (pattern, '@')) {
- msg_box (dlg, _("Only keyids are allowed."), _("LDAP Keyserver"), MB_INFO);
+ msg_box (dlg, _("Only keyids are allowed."),
+ _("Keyserver"), MB_INFO);
return FALSE;
}
else if (proto_nr == KSPROTO_FINGER) {
if (strchr (pattern, '@') || strchr (pattern, ' ')) {
msg_box (dlg, _("Only enter the name of the user."),
- _("FINGER Keyserver"), MB_INFO);
+ _("Keyserver"), MB_INFO);
return FALSE;
}
}
else if (check_pattern (pattern)) {
msg_box (dlg, _("Only email addresses or keyids are allowed."),
- _("HKP Keyserver"), MB_INFO);
+ _("Keyserver"), MB_INFO);
return FALSE;
}
rc = keyserver_recv_key (dlg, kserver, kserver_get_port (lv),
@@ -570,6 +744,40 @@
case IDC_KEYSERVER_DEFAULT:
save_default_ks (lv);
break;
+
+ case ID_KSERVCTX_ADD:
+ memset (&edit, 0, sizeof (edit));
+ edit.mode = false;
+ dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_ADD, dlg,
+ keyserver_modify_dlg_proc,
+ (LPARAM)&edit, _("Edit Keyserver"), 0);
+ if (!edit.cancel)
+ keyserver_add (lv, &edit);
+ return TRUE;
+
+ case ID_KSERVCTX_EDIT:
+ memset (&edit, 0, sizeof (edit));
+ edit.mode = true;
+ listview_get_item_text (lv, lv_idx, KS_COL_NAME,
+ edit.name, sizeof (edit.name)-1);
+ listview_get_item_text (lv, lv_idx, KS_COL_PORT, pattern, 32);
+ edit.port = atoi (pattern);
+ if (!strncmp (edit.name, "hkp", 3) || !strncmp (edit.name, "http", 4))
+ edit.proto = KSPROTO_HTTP;
+ else if (!strncmp (edit.name, "ldap", 4))
+ edit.proto = KSPROTO_LDAP;
+ else
+ edit.proto = KSPROTO_FINGER;
+ dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_ADD, dlg,
+ keyserver_modify_dlg_proc,
+ (LPARAM)&edit, _("Edit Keyserver"), 0);
+ if (!edit.cancel)
+ keyserver_edit (lv, &edit);
+ break;
+
+ case ID_KSERVCTX_DEL:
+ keyserver_remove (lv);
+ return TRUE;
case IDCANCEL:
EndDialog (dlg, FALSE);
Modified: trunk/Src/wptKeysigDlg.cpp
===================================================================
--- trunk/Src/wptKeysigDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptKeysigDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -64,14 +64,19 @@
static int
do_delsig (HWND dlg, listview_ctrl_t lv, winpt_key_t key)
{
- int pos, npos, id;
+ gpgme_error_t err;
+ GpgKeyEdit *ke;
+ char keyid[32];
+ int pos, npos, id, is_selfsig=0;
int signo=0, uidno=0;
- GpgKeyEdit *ke;
- gpgme_error_t err;
npos = pos = listview_get_curr_pos (lv);
if (!is_sig (lv, -1))
return -1;
+ listview_get_item_text (lv, pos, SL_COL_KEYID, keyid, sizeof (keyid)-1);
+ if (!strncmp (key->keyid, keyid+2, 8))
+ is_selfsig = 1;
+
while (pos > 0 && is_sig (lv, pos)) {
signo++;
pos--;
@@ -85,9 +90,10 @@
uidno++;
/* XXX: do not allow to delete the self signature */
- id = log_box (_("Key Manager"), MB_YESNO,
- _("Are you really sure you want to delete this signature from\n"
- " \"%s\""), key->uid);
+ id = log_box (_("Key Manager"), is_selfsig? MB_WARN_ASK : MB_QUEST_ASK,
+ _("Are you really sure you want to delete this %s from\n\n"
+ " \"%s\""), is_selfsig? _("self signature") : _("signature"),
+ key->uid);
if (id == IDNO)
return 0;
@@ -100,7 +106,8 @@
else
listview_del_item (lv, pos);
delete ke;
- key->update = 1; /*update*/
+ if (!err)
+ key->update = 1;
return err? -1 : 0;
}
@@ -260,16 +267,16 @@
/* Receive all missing keys marked in the list @lv. */
-static void
+static int
recv_missing_keys (HWND dlg, listview_ctrl_t lv)
{
+ char id[128], keyid[18+1];
int i, n, cnt=0;
- char id[128], keyid[18+1];
i = msg_box (dlg, _("Really receive all missing keys?"),
_("Key Manager"), MB_YESNO|MB_INFO);
if (i == IDNO)
- return;
+ return 0;
n = listview_count_items (lv, 0);
for (i = 0; i < n; i++) {
@@ -278,14 +285,15 @@
listview_get_item_text (lv, i, SL_COL_KEYID,
keyid, sizeof (keyid) -1);
if (!hkp_recv_key (dlg, default_keyserver,
- default_keyserver_port, keyid, 0, 0))
+ default_keyserver_port, keyid, 0, 0)) {
+ keycache_update (0, keyid);
cnt++;
+ }
else
break;
}
}
- if (cnt > 0)
- keycache_set_reload (1);
+ return cnt;
}
@@ -343,7 +351,7 @@
listview_get_item_text (lv, n, SL_COL_KEYID, keyid, DIM (keyid)-1);
if (!strcmp (status, "NOKEY")) {
int id = msg_box (dlg, _("Key not found in keyring, do you want to fetch it from the keyserver?"),
- _("Key Manager"), MB_QUEST_ASK);
+ _("Key Manager"), MB_QUEST_ASK);
if (id == IDNO)
return;
if (recv_single_key (dlg, lv, n))
@@ -412,11 +420,8 @@
return FALSE;
case WM_SYSCOMMAND:
- if (LOWORD (wparam) == SC_CLOSE) {
- if (k->update)
- keycache_update (0, k->keyid);
+ if (LOWORD (wparam) == SC_CLOSE)
EndDialog (dlg, TRUE);
- }
return FALSE;
case WM_NOTIFY:
@@ -485,8 +490,6 @@
return TRUE;
case IDOK:
- if (k->update)
- keycache_update (0, k->keyid);
EndDialog (dlg, TRUE);
return TRUE;
}
Modified: trunk/Src/wptListView.cpp
===================================================================
--- trunk/Src/wptListView.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptListView.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -209,41 +209,42 @@
}
+/* Delete a single item from @ctx at position @pos. */
int
-listview_del_item( listview_ctrl_t ctx, int pos )
+listview_del_item (listview_ctrl_t ctx, int pos)
{
int rc = 0;
- if( ListView_DeleteItem( ctx->ctrl, pos ) == -1 )
+ if (ListView_DeleteItem (ctx->ctrl, pos) == -1)
rc = 1;
return rc;
-} /* listview_del_item */
+}
+/* Delete all selected items in @ctx. */
int
-listview_del_items( listview_ctrl_t ctx )
+listview_del_sel_items (listview_ctrl_t ctx)
{
int i, n;
- /* delete all selected entries */
n = listview_count_items (ctx, 0);
- for( i = n; i > 0; i-- ) {
- if ( listview_get_item_state( ctx, i ) )
- listview_del_item( ctx, i );
+ for (i = n; i > -1; i--) {
+ if (listview_get_item_state (ctx, i))
+ listview_del_item (ctx, i);
}
return 0;
-} /* listview_del_items */
+}
int
-listview_del_all( listview_ctrl_t ctx )
+listview_del_all_items (listview_ctrl_t ctx)
{
int rc = 0;
- if( ListView_DeleteAllItems( ctx->ctrl ) == FALSE )
+ if (ListView_DeleteAllItems (ctx->ctrl) == FALSE)
rc = 1;
return rc;
-} /* listview_del_all */
+}
int
Modified: trunk/Src/wptMAPI.cpp
===================================================================
--- trunk/Src/wptMAPI.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptMAPI.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -1,5 +1,5 @@
-/* wptMAPI.cpp
- * Copyright (C) 2003, 2004, 2005 Timo Schulz
+/* wptMAPI.cpp - MAPI interface for sending keys.
+ * Copyright (C) 2003, 2004, 2005, 2006 Timo Schulz
*
* This file is part of WinPT.
*
@@ -31,7 +31,10 @@
#include "wptW32API.h"
#include "wptGPG.h"
#include "wptVersion.h"
+#include "wptCommonCtl.h"
+#include "wptKeyManager.h"
+
static LPMAPILOGON mapi_logon = NULL;
static LPMAPILOGOFF mapi_logoff = NULL;
static LPMAPISENDDOCUMENTS mapi_send_documents = NULL;
@@ -105,53 +108,15 @@
}
-/* Send a public key stored in @keyfile with the keyid @keyid
- via the MAPI mechanism to a mail recipient.
- Return value: SUCCESS_SUCCESS on succes. */
-int
-mapi_send_pubkey (const char *keyid, char *keyfile)
-{
- LHANDLE hd;
- const char * fmt;
- char * keyinf = NULL;
- int rc;
-
- if (!init)
- return 0;
-
- fmt = _("GPG Public Key of %s");
- keyinf = new char[strlen (fmt) + strlen (keyid) + 2];
- if (!keyinf)
- BUG (0);
- sprintf (keyinf, fmt, keyid);
- rc = mapi_logon (0, NULL, NULL, MAPI_LOGON_UI, 0, &hd);
- if (rc != SUCCESS_SUCCESS) {
- MessageBox (NULL, _("MAPI Login failed."), "MAPI", MB_ICONWARNING|MB_OK);
- goto fail;
- }
- rc = mapi_send_documents (0, ";", keyfile, keyinf, 0);
- if (rc == MAPI_E_USER_ABORT)
- rc = SUCCESS_SUCCESS;
- if (rc != SUCCESS_SUCCESS)
- MessageBox (NULL, _("Could not sent mail."), "MAPI", MB_ICONERROR|MB_OK);
-
-fail:
- mapi_logoff (hd, 0, 0, 0);
- free_if_alloc (keyinf);
- return rc;
-}
-
-
-#if 0 /* low:priority XXX port the code */
static void
-free_mapi_msg (MapiMessage * msg)
+free_mapi_msg (MapiMessage *msg)
{
if (!msg)
return;
safe_free (msg->lpszSubject);
safe_free (msg->lpszNoteText);
safe_free (msg);
-} /* free_mapi_msg */
+}
static void
@@ -166,11 +131,11 @@
for (i=0; i < n; i++)
safe_free (recip[i].lpszName);
safe_free (recip);
-} /* free_recip_tab */
+}
static void
-free_files_tab (MapiFileDesc * files, size_t n)
+free_files_tab (MapiFileDesc *files, size_t n)
{
size_t i;
@@ -183,127 +148,19 @@
safe_free (files[i].lpszPathName);
}
safe_free (files);
-} /* free_files_tab */
+}
-
-static gpgme_recipients_t
-conv_recipients (gpgme_recipients_t rset)
-{
- gpgme_recipients_t r;
- gpgme_error_t rc;
- void * ctx=NULL;
- const char * s;
-
- /* we need to convert the recipients to email addresses so
- GPG can handle them. */
- rc = gpgme_recipients_new (&r);
- if (rc)
- return NULL;
- gpgme_recipients_enum_open (rset, &ctx);
-
- while ((s=gpgme_recipients_enum_read (rset, &ctx))) {
- char * p, * q, * buf;
- if (!(p = strchr (s, '<')) || !(q = strchr (s, '>')))
- continue;
- buf = (char * )calloc (1, (q-s)-(p-s)+2);
- if (!buf)
- BUG (0);
- strncpy (buf, s+(p-s)+1, (q-s)-(p-s)-1);
- gpgme_recipients_add_name (r, buf);
- safe_free (buf);
- }
- return r;
-} /* conv_recipients */
-
-
-static char *
-secure_attachment (gpgme_recipients_t rset, const char *fname)
-{
- char tmpdir[512+32], * p;
- gpgme_recipients_t addrs;
- gpgme_ctx_t ctx;
- gpgme_error_t rc;
-
- if (strlen (fname) > 200)
- BUG (0);
- GetTempPath (sizeof tmpdir-200, tmpdir);
- p = strrchr (fname, '\\');
- if (!p)
- strcat (tmpdir, fname);
- else
- strcat (tmpdir, fname+(p-fname)+1);
- strcat (tmpdir, ".asc");
-
- rc = gpgme_new (&ctx);
- if (rc)
- return NULL;
- gpgme_set_armor (ctx, 1);
- addrs = conv_recipients (rset);
- if (!addrs) {
- msg_box (NULL, _("No valid mail addresses found."), _("Secure Attachment"), MB_ERR);
- gpgme_release (NULL);
- return NULL;
- }
- rc = gpgme_op_file_encrypt (ctx, addrs, fname, tmpdir);
- if (rc)
- log_box (_("Secure Attachment"), MB_ERR, _("Could not encrypt '%s'"), fname);
- gpgme_recipients_release (addrs);
- gpgme_release (ctx);
- return strdup (tmpdir);
-} /* secure_attachment */
-
-
-static gpgme_error_t
-secure_message (gpgme_recipients_t rset, const char *data,
- char *enc_msg, size_t *r_enclen)
-{
- gpgme_recipients_t addrs;
- gpgme_error_t rc;
- gpgme_data_t in, out;
- gpgme_ctx_t ctx;
- char * p;
- size_t n=0;
-
- rc = gpgme_new (&ctx);
- if (rc)
- return NULL;
- gpgme_set_armor (ctx, 1);
-
- addrs = conv_recipients (rset);
- rc = gpgme_data_new_from_mem (&in, data, strlen (data), 1);
- if (rc) {
- gpgme_release (ctx);
- return rc;
- }
- gpgme_data_new (&out);
- rc = gpgme_op_encrypt (ctx, addrs, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
- if (rc)
- log_box (_("Secure Message"), MB_ERR, "Could not encrypt the data");
-
- *r_enc_msg = gpgme_data_release_and_get_mem (&n);
- *r_enclen = n;
-
- gpgme_data_release (in);
- gpgme_release (ctx);
- gpgme_recipients_release (addrs);
-
- return rc;
-} /* secure_message */
-
-
+/* Same as mapi_send_pubkey but there is an additional note. */
int
-mapi_send_message (gpgme_recipients_t rset, const char * msgtxt,
- const char * subject, const char **files, size_t nfiles)
+mapi_send_pubkey_ext (gpgme_key_t to, const char *keyfile, int flags)
{
LHANDLE hd;
- MapiMessage * msg;
- MapiRecipDesc * recip;
- MapiFileDesc * attch;
- char * p;
- const char * s;
- void * ctx=NULL;
- size_t n, i=0, encmsg_len=0;
+ MapiMessage *msg;
+ MapiRecipDesc *recip;
+ MapiFileDesc *attch;
+ char *p, *kinf;
+ const char *s;
int rc;
if (!init)
@@ -315,155 +172,112 @@
return rc;
}
- msg = (MapiMessage *)calloc (1, sizeof * msg);
+ msg = (MapiMessage *)calloc (1, sizeof *msg);
if (!msg)
BUG (0);
- p = msg->lpszSubject = strdup (subject);
+ p = msg->lpszSubject = strdup ("OpenPGP Public Key");
if (!p)
BUG (0);
- p = msg->lpszNoteText = secure_message (rset, msgtxt, &p, &encmsg_len);
+
+ s = "Attached is this OpenPGP public key:\n%s\n\n"
+ "Import this key via the clipboard or the Key Manager to\n"
+ "exchange encrypted mails with the key holder and to be able\n"
+ "to verify its signatures.\n"
+ "\n"
+ "If you don't have WinPT, you can download it at http://www.winpt.org";
+ kinf = km_key_get_info (to, 0);
+ p = (char*)malloc (strlen (s) + strlen (kinf) + 2);
+ sprintf (p, s, kinf);
+ free_if_alloc (kinf);
+
+ p = msg->lpszNoteText = p;
if (!p)
- BUG (0);
- n = msg->nRecipCount = gpgme_recipients_count (rset);
- recip = (MapiRecipDesc *)calloc (n+1, sizeof * recip);
- if (!recip)
- BUG (0);
-
- gpgme_recipients_enum_open (rset, &ctx);
- while ((s = gpgme_recipients_enum_read (rset, &ctx))) {
- if (!i)
- recip[i].ulRecipClass = MAPI_TO;
- else
- recip[i].ulRecipClass = MAPI_CC;
- p = recip[i].lpszName = strdup (s);
- if (!p)
- BUG (0);
- i++;
- }
- msg->lpRecips = recip;
+ BUG (0);
- if (nfiles) {
- msg->nFileCount = nfiles;
- attch = (MapiFileDesc *)calloc (nfiles+1, sizeof * attch);
- if (!attch)
+ /* If the key was signed, we assume it shall be sent back to the owner. */
+ if (flags) {
+ recip = (MapiRecipDesc *)calloc (1, sizeof *recip);
+ if (!recip)
BUG (0);
- for (i=0; i < nfiles; i++) {
- char * p = secure_attachment (rset, *files);
- if (!p)
- continue;
- attch[i].lpszFileName = strdup (*files);
- attch[i].lpszPathName = strdup (p);
- files++;
- safe_free (p);
- }
- msg->lpFiles = attch;
+ recip[0].ulRecipClass = MAPI_TO;
+ p = recip[0].lpszName = strdup (to->uids->uid);
+ if (!p)
+ BUG (0);
+ msg->lpRecips = recip;
+ msg->nRecipCount = 1;
}
+ else {
+ msg->lpRecips = recip = NULL;
+ msg->nRecipCount = 0;
+ }
- rc = mapi_send_mail (hd, 0, msg, 0, 0);
+ msg->nFileCount = 1;
+ attch = (MapiFileDesc *)calloc (1, sizeof *attch);
+ if (!attch)
+ BUG (0);
+ attch[0].lpszFileName = strdup (keyfile);
+ attch[0].lpszPathName = strdup (keyfile);
+ msg->lpFiles = attch;
+
+ rc = mapi_send_mail (hd, 0, msg, MAPI_DIALOG , 0);
if (rc == MAPI_E_USER_ABORT)
rc = SUCCESS_SUCCESS;
if (rc != SUCCESS_SUCCESS)
MessageBox (NULL, _("Could not sent mail."), "MAPI", MB_ERR);
- free_recip_tab (recip, n);
- free_files_tab (attch, nfiles);
+ free_recip_tab (recip, 1);
+ free_files_tab (attch, 1);
free_mapi_msg (msg);
- gpgme_free (p);
mapi_logoff (hd, 0, 0, 0);
return 0;
-} /* mapi_send_message */
+}
-static int
-add_recipient (gpgme_recipients_t *r_rset, const char *addr)
+#if 0
+/* Send a public key stored in @keyfile with the keyid @keyid
+ via the MAPI mechanism to a mail recipient.
+ Return value: SUCCESS_SUCCESS on succes. */
+int
+mapi_send_pubkey2 (const char *keyid, char *keyfile)
{
- gpg_keycache_t pub = keycache_get_ctx (1);
- gpgme_key_t key;
- gpgme_error_t rc;
- char *uid;
+ LHANDLE hd;
+ const char * fmt;
+ char * keyinf = NULL;
+ int rc;
- if (!*r_rset)
- gpgme_recipients_new (&(*r_rset));
- rc = gpgme_keycache_find_key (pub, addr, 0, &key);
- if (rc) {
- log_box (_("Add Recipient"), MB_ERR, _("Could not find key for '%s'"), addr);
- return -1;
- }
- if (key->uids->uid) {
- uid = utf8_to_wincp2 (key->uids->uid);
- gpgme_recipients_add_name (*r_rset, uid);
- free_if_alloc (uid);
- }
- return 0;
-} /* add_recipient */
+ if (!init)
+ return 0;
-
-static int
-add_all_recipients (HWND dlg, int itemid, gpgme_recipients_t * r_rset)
-{
- char buf[1024], * p;
- int n=0;
-
- n = GetDlgItemText (dlg, itemid, buf, sizeof buf-10);
- if (!n)
- return -1;
- p = strtok (buf, ";,");
- while (p != NULL) {
- add_recipient (&*r_rset, p);
- p = strtok (NULL, ";,");
+ fmt = _("GPG Public Key of %s");
+ keyinf = new char[strlen (fmt) + strlen (keyid) + 2];
+ if (!keyinf)
+ BUG (0);
+ sprintf (keyinf, fmt, keyid);
+ rc = mapi_logon (0, NULL, NULL, MAPI_LOGON_UI, 0, &hd);
+ if (rc != SUCCESS_SUCCESS) {
+ MessageBox (NULL, _("MAPI Login failed."), "MAPI", MB_ICONWARNING|MB_OK);
+ goto fail;
}
- return 0;
-} /* add_all_recipients */
+ rc = mapi_send_documents (0, ";", keyfile, keyinf, 0);
+ if (rc == MAPI_E_USER_ABORT)
+ rc = SUCCESS_SUCCESS;
+ if (rc != SUCCESS_SUCCESS)
+ MessageBox (NULL, _("Could not sent mail."), "MAPI", MB_ICONERROR|MB_OK);
+fail:
+ mapi_logoff (hd, 0, 0, 0);
+ free_if_alloc (keyinf);
+ return rc;
+}
+#endif
-BOOL CALLBACK
-winpt_mail_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
+
+int
+mapi_send_pubkey (const char *keyid, char *keyfile)
{
- static gpgme_recipients_t rset=NULL;
- char subject[128];
- char * msgbuf;
- int n;
+ gpgme_key_t key;
- switch (msg) {
- case WM_INITDIALOG:
- center_window (dlg, NULL);
- SetForegroundWindow (dlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD (wparam)) {
- case IDOK:
- add_all_recipients (dlg, IDC_PMAIL_TO, &rset);
- add_all_recipients (dlg, IDC_PMAIL_CC, &rset);
- if (!gpgme_recipients_count (rset)) {
- msg_box (dlg, _("Please enter a recipient."), _("Mail"), MB_ERR);
- return FALSE;
- }
- n=GetDlgItemText (dlg, IDC_PMAIL_SUBJECT, subject, sizeof subject-1);
- if (!n)
- strcpy (subject, "");
- n = SendDlgItemMessage (dlg, IDC_PMAIL_MSG, WM_GETTEXTLENGTH, 0, 0);
- if (!n) {
- msg_box (dlg, _("Please enter a message."), _("Mail"), MB_ERR);
- return FALSE;
- }
- msgbuf = (char * )calloc (1, n+2);
- if (!msgbuf)
- BUG (0);
- GetDlgItemText (dlg, IDC_PMAIL_MSG, msgbuf, n+1);
- mapi_send_message (rset, msgbuf, subject, NULL, 0);
- safe_free (msgbuf);
- EndDialog (dlg, TRUE);
- break;
-
- case IDCANCEL:
- EndDialog (dlg, FALSE);
- break;
- }
- break;
- }
-
- return FALSE;
-} /* winpt_mail_proc */
-#endif
+ get_pubkey (keyid, &key);
+ return mapi_send_pubkey_ext (key, keyfile, 0);
+}
Modified: trunk/Src/wptMainProc.cpp
===================================================================
--- trunk/Src/wptMainProc.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptMainProc.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -1,5 +1,5 @@
/* wptMainProc.cpp - Main window procedure
- * Copyright (C) 2000-2005 Timo Schulz
+ * Copyright (C) 2000-2006 Timo Schulz
*
* This file is part of WinPT.
*
@@ -177,7 +177,7 @@
dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
clip_verify_dlg_proc, 0,
_("Verify"), IDS_WINPT_VERIFY );
- err = gpg_error (GPG_ERR_EOF); /* make sure window is ot updated. */
+ err = gpg_error (GPG_ERR_EOF); /* make sure window is not updated. */
}
break;
}
Modified: trunk/Src/wptPreferencesDlg.cpp
===================================================================
--- trunk/Src/wptPreferencesDlg.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptPreferencesDlg.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -154,8 +154,6 @@
SetDlgItemInt (dlg, IDC_PREFS_WORDWRAP, reg_prefs.word_wrap, TRUE);
if (reg_prefs.backup.path)
SetDlgItemText (dlg, IDC_PREFS_BAKPATH, reg_prefs.backup.path);
- if (reg_prefs.kserv_conf)
- SetDlgItemText (dlg, IDC_PREFS_KSERVER, reg_prefs.kserv_conf);
for (i=0; (id=hotkeys[i]); i++)
SetDlgItemText (dlg, id, reg_hotkeys[i].key);
@@ -244,14 +242,6 @@
SetDlgItemText (dlg, IDC_PREFS_BAKPATH, bpath);
break;
- case IDC_PREFS_KSELFILE: {
- const char * name;
- name = get_fileopen_dlg (dlg, _("Please select a keyserver.conf file"),
- NULL, NULL);
- if (name != NULL)
- SetDlgItemText (dlg, IDC_PREFS_KSERVER, name);
- break; }
-
case IDOK:
rc = GetDlgItemInt( dlg, IDC_PREFS_CACHETIME, NULL, FALSE );
if (!rc)
@@ -290,32 +280,6 @@
if (!p)
BUG (0);
}
- free_if_alloc (reg_prefs.kserv_conf);
- if (!GetDlgItemText (dlg, IDC_PREFS_KSERVER, path, sizeof (path)-1)
- || file_exist_check (path)) {
- rc = msg_box (dlg, _("The specified keyserver config file is invalid.\n\n"
- "Create new default config file?"),
- _("Preferences"), MB_ERR|MB_YESNO);
- if (rc == IDNO)
- return TRUE;
- else
- {
- char cwd[256], * fn;
- FILE * fp = fopen ("keyserver.conf", "wb");
- if (fp) {
- fprintf (fp, "%s\r\n", DEF_HKP_KEYSERVER);
- fclose (fp);
- }
- GetCurrentDirectory (DIM (cwd)-1, cwd);
- fn = make_filename (cwd, "keyserver", "conf");
- memset (path, 0, sizeof( path));
- strncpy (path, fn, DIM (path)-1);
- free_if_alloc (fn);
- }
- }
- p = reg_prefs.kserv_conf = m_strdup (path);
- if (!p)
- BUG (0);
cb = GetDlgItem( dlg, IDC_PREFS_LISTMODE );
reg_prefs.keylist_mode = SendMessage( cb, CB_GETCURSEL, 0, 0 );
Modified: trunk/Src/wptRegistry.cpp
===================================================================
--- trunk/Src/wptRegistry.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptRegistry.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -587,12 +587,6 @@
if (rc)
goto leave;
}
- if (opt->kserv_conf) {
- rc = set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "KeyserverConfig",
- opt->kserv_conf);
- if (rc)
- goto leave;
- }
for (i=0; reg_hotkeys[i].reg_entry; i++) {
strcpy (buf, " ");
@@ -703,11 +697,6 @@
if (val && val[0] != ' ')
opt->backup.path = m_strdup (val);
free_if_alloc (val);
-
- val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "KeyserverConfig");
- if (val && val[0] != ' ')
- opt->kserv_conf = m_strdup (val);
- free_if_alloc (val);
for (i=0; reg_hotkeys[i].reg_entry; i++) {
val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, reg_hotkeys[i].reg_entry);
Modified: trunk/Src/wptSigList.cpp
===================================================================
--- trunk/Src/wptSigList.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptSigList.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -66,6 +66,7 @@
for (j=0; implist[j].fieldname != NULL; j++)
listview_add_column (c, &implist[j]);
listview_set_ext_style (c);
+ listview_del_all_items (c);
*lv = c;
return 0;
}
Modified: trunk/Src/wptW32API.cpp
===================================================================
--- trunk/Src/wptW32API.cpp 2006-01-13 15:32:42 UTC (rev 149)
+++ trunk/Src/wptW32API.cpp 2006-01-18 11:52:45 UTC (rev 150)
@@ -309,6 +309,41 @@
}
+/* Generate a file name from a special dirctory. */
+char*
+make_special_filename (int folder, const char *file, const char *ext)
+{
+ BOOL ec;
+ char path[MAX_PATH], *p;
+ size_t n=0;
+
+ /* MSDN: buf must be at least MAX_PATH=256 bytes */
+ ec = SHGetSpecialFolderPath (HWND_DESKTOP, path, folder, TRUE);
+ if (ec != 1) {
+ log_debug ("SHGetSpecialFolderPath() failed\r\n", (int)GetLastError ());
+ return NULL;
+ }
+
+ n = strlen (path)+1;
+ if (file)
+ n += strlen (file)+1;
+ if (ext)
+ n += strlen (ext)+1;
+ p = new char[n+2];
+ if (!p)
+ BUG (0);
+ memset (p, 0, n+2);
+ strcpy (p, path);
+ if (file) {
+ strcat (p, "\\");
+ strcat (p, file);
+ }
+ if (ext)
+ strcat (p, ext);
+ return p;
+}
+
+
/* return 0 if the file @fname exists, otherwise >0. */
int
file_exist_check (const char *fname)
More information about the Winpt-commits
mailing list