[Winpt-commits] r166 - in trunk: Include Src
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Tue Jan 24 11:17:48 CET 2006
Author: twoaday
Date: 2006-01-24 11:17:47 +0100 (Tue, 24 Jan 2006)
New Revision: 166
Modified:
trunk/Include/wptKeyManager.h
trunk/Src/ChangeLog
trunk/Src/wptKeyManager.cpp
trunk/Src/wptKeyManagerDlg.cpp
Log:
2006-01-24 Timo Schulz <ts at g10code.com>
* wptKeyManager.cpp (km_dropped_file_import): New.
* wptKeyManagerDlg.cpp (keylist_subclass_proc): Allow
to drop files and try to import them.
(keymanager_dlg_proc): Pass kmi as opaque to the subclass
proc.
Modified: trunk/Include/wptKeyManager.h
===================================================================
--- trunk/Include/wptKeyManager.h 2006-01-24 10:10:15 UTC (rev 165)
+++ trunk/Include/wptKeyManager.h 2006-01-24 10:17:47 UTC (rev 166)
@@ -68,6 +68,8 @@
int km_file_import (HWND dlg, const char *fname,
int *r_newkeys, int *r_newsks);
int km_http_import (HWND dlg, const char * url);
+int km_dropped_file_import (HWND dlg, HDROP hdrop,
+ int *r_newkeys, int *r_newsks);
int km_delete_keys( listview_ctrl_t lv, HWND dlg );
int km_send_to_keyserver( listview_ctrl_t lv, HWND dlg, const char * host, unsigned short port);
int km_send_to_mail_recipient( listview_ctrl_t lv, HWND dlg );
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2006-01-24 10:10:15 UTC (rev 165)
+++ trunk/Src/ChangeLog 2006-01-24 10:17:47 UTC (rev 166)
@@ -1,3 +1,11 @@
+2006-01-24 Timo Schulz <ts at g10code.com>
+
+ * wptKeyManager.cpp (km_dropped_file_import): New.
+ * wptKeyManagerDlg.cpp (keylist_subclass_proc): Allow
+ to drop files and try to import them.
+ (keymanager_dlg_proc): Pass kmi as opaque to the subclass
+ proc.
+
2006-01-23 Timo Schulz <ts at g10code.de>
* wptMDSumDlg.cpp (mdsum_dlg_proc): Allow to send output
Modified: trunk/Src/wptKeyManager.cpp
===================================================================
--- trunk/Src/wptKeyManager.cpp 2006-01-24 10:10:15 UTC (rev 165)
+++ trunk/Src/wptKeyManager.cpp 2006-01-24 10:17:47 UTC (rev 166)
@@ -661,6 +661,26 @@
}
+/* Import all dropped files. */
+int
+km_dropped_file_import (HWND dlg, HDROP hdrop,
+ int *r_newkeys, int *r_newsks)
+{
+ char name[MAX_PATH+1];
+ UINT n = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
+ UINT i;
+ int newk=0, newsk=0, err=0;
+
+ for (i=0; i < n; i++) {
+ DragQueryFile (hdrop, i, name, MAX_PATH);
+ err = km_file_import (dlg, name, &newk, &newsk);
+ *r_newkeys = (*r_newkeys) + newk;
+ *r_newsks = (*r_newsks) + newsk;
+ }
+ return err;
+}
+
+
/* Mark the keys in @rset as deleted in the keycache. */
static void
delete_keys_from_cache (gpgme_key_t *rset, size_t n)
Modified: trunk/Src/wptKeyManagerDlg.cpp
===================================================================
--- trunk/Src/wptKeyManagerDlg.cpp 2006-01-24 10:10:15 UTC (rev 165)
+++ trunk/Src/wptKeyManagerDlg.cpp 2006-01-24 10:17:47 UTC (rev 166)
@@ -97,13 +97,21 @@
};
+static void km_gui_import (struct km_info_s *kmi, int cmd_id, void *param);
+
/* Subclass the keylist listview control to allow extended commands. */
static BOOL CALLBACK
keylist_subclass_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
struct listview_ctrl_s lv;
+ struct km_info_s *kmi;
switch (msg) {
+ case WM_DROPFILES:
+ kmi = (km_info_s *)keylist_proc.opaque;
+ km_gui_import (kmi, WM_DROPFILES, (void*)wparam);
+ break;
+
case WM_LBUTTONDBLCLK:
send_cmd_id (keylist_proc.dlg, ID_KEYMISC_PROPS);
break;
@@ -1090,7 +1098,7 @@
/* Handle all import request. */
static void
-km_gui_import (struct km_info_s *kmi, int cmd_id)
+km_gui_import (struct km_info_s *kmi, int cmd_id, void *param)
{
int newkeys=0, newsks=0;
int err = 0;
@@ -1104,6 +1112,11 @@
err = km_file_import (kmi->dlg, NULL, &newkeys, &newsks);
break;
+ case WM_DROPFILES:
+ err = km_dropped_file_import (kmi->dlg, (HDROP)param,
+ &newkeys, &newsks);
+ break;
+
default:
err = 1;
break;
@@ -1163,6 +1176,7 @@
kmi->lv = keylist_load (GetDlgItem (dlg, IDC_KEYMISC_KEYLIST), c,
NULL, KEYLIST_LIST, kmi->keylist_sortby);
/* init subclassing for the listview */
+ keylist_proc.opaque = kmi;
keylist_proc.dlg = dlg;
keylist_proc.current = (WNDPROC)keylist_subclass_proc;
keylist_proc.old = (WNDPROC)GetWindowLong(kl, GWL_WNDPROC);
@@ -1666,7 +1680,7 @@
return TRUE;
case ID_KEYMISC_IMPORT:
- km_gui_import (kmi, LOWORD (wparam));
+ km_gui_import (kmi, LOWORD (wparam), NULL);
return TRUE;
case ID_KEYMISC_IMPORT_HTTP:
@@ -1781,7 +1795,7 @@
break;
case ID_KEYMISC_PASTE:
- km_gui_import (kmi, LOWORD (wparam));
+ km_gui_import (kmi, LOWORD (wparam), NULL);
break;
case ID_KEYCTX_SETPREFKS:
More information about the Winpt-commits
mailing list