1 |
/* OEDlgSign.c - OE sign dialog |
2 |
* Copyright (C) 2001, 2002, 2003 Timo Schulz |
3 |
* |
4 |
* This file is part of GPGOE. |
5 |
* |
6 |
* GPGOE is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* GPGOE is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with GPGOE; if not, write to the Free Software Foundation, |
18 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
*/ |
20 |
|
21 |
#include <windows.h> |
22 |
#include <commctrl.h> |
23 |
|
24 |
#include "../resource.h" |
25 |
#include "GPGOE.h" |
26 |
|
27 |
|
28 |
BOOL CALLBACK |
29 |
sign_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam ) |
30 |
{ |
31 |
static ListviewControl lv = NULL; |
32 |
static struct oe_signer_ctx_s *signer; |
33 |
GpgmeKeycache kc; |
34 |
NMHDR *notify; |
35 |
int i; |
36 |
#if 0 |
37 |
switch( msg ) { |
38 |
case WM_INITDIALOG: |
39 |
signer = (struct oe_signer_ctx_s *)lparam; |
40 |
if( !signer ) |
41 |
dlg_fatal_error( dlg, "Couldn't get dialog param" ); |
42 |
_gpgoe_query_interfaces( &gpgme, &winpt ); |
43 |
kc = winpt->cache.get_ctx( 0 ); |
44 |
winpt->keylist.build( &lv, GetDlgItem(dlg, IDC_SIGN_KEYLIST), 8 ); |
45 |
winpt->keylist.load( lv, kc, KEYLIST_SIGN, GPGME_ATTR_USERID ); |
46 |
SetForegroundWindow( dlg ); |
47 |
break; |
48 |
|
49 |
case WM_DESTROY: |
50 |
if( lv ) { |
51 |
winpt->listview.release( lv ); |
52 |
lv = NULL; |
53 |
} |
54 |
return FALSE; |
55 |
|
56 |
case WM_NOTIFY: |
57 |
notify = (NMHDR *)lparam; |
58 |
if (notify && notify->code == NM_DBLCLK |
59 |
&& notify->idFrom == IDC_SIGN_KEYLIST ) |
60 |
PostMessage( dlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0 ); |
61 |
return TRUE; |
62 |
|
63 |
case WM_SYSCOMMAND: |
64 |
if( LOWORD (wparam) == SC_CLOSE ) |
65 |
EndDialog( dlg, 0 ); |
66 |
return FALSE; |
67 |
|
68 |
case WM_COMMAND: |
69 |
switch( LOWORD(wparam) ) { |
70 |
case IDOK: |
71 |
if (winpt->listview.count_items( lv, 0 ) == 1 ) { |
72 |
winpt->listview.get_item_text( lv, 0, 2, signer->name, sizeof signer->name -1 ); |
73 |
signer->use_signer = 1; |
74 |
} |
75 |
else if ( (i = winpt->listview.get_curr_pos( lv )) > -1 ) { |
76 |
winpt->listview.get_item_text( lv, i, 2, signer->name, sizeof(signer->name)-1 ); |
77 |
signer->use_signer = 1; |
78 |
} |
79 |
else { |
80 |
signer->use_signer = 0; |
81 |
} |
82 |
EndDialog( dlg, 0 ); |
83 |
break; |
84 |
} |
85 |
break; |
86 |
} |
87 |
#endif |
88 |
return FALSE; |
89 |
} /* sign_dlg_proc */ |