/[winpt]/trunk/Src/wptCardManager.cpp
ViewVC logotype

Contents of /trunk/Src/wptCardManager.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Mon Jan 31 11:02:21 2005 UTC (20 years, 1 month ago) by twoaday
File size: 2315 byte(s)
WinPT initial checkin.


1 /* wptCardManager.cpp
2 * Copyright (C) 2003 Timo Schulz
3 *
4 * This file is part of WinPT.
5 *
6 * WinPT 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 * WinPT 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 WinPT; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 */
20
21 #include <stdio.h>
22 #include <windows.h>
23
24 #include "wptTypes.h"
25 #include "wptW32API.h"
26 #include "wptVersion.h"
27 #include "wptNLS.h"
28 #include "wptGPG.h"
29 #include "wptCard.h"
30 #include "../resource.h"
31
32
33 static BOOL CALLBACK
34 card_cb_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam )
35 {
36 static card_cb_s * ctx;
37
38 switch( msg ) {
39 case WM_INITDIALOG:
40 ctx = (struct card_cb_s *)lparam;
41 if( !ctx )
42 BUG( NULL );
43 switch( ctx->code ) {
44 case 1:
45 ShowWindow( GetDlgItem( dlg, IDC_CCTRL_VAL ), FALSE );
46 SetDlgItemText( dlg, IDC_CCTRL_MSG,
47 _("Please insert the OpenPGP smart card\n"
48 "Press OK to continue or Cancel") );
49 break;
50 }
51 center_window( dlg );
52 SetForegroundWindow( dlg );
53 break;
54
55 case WM_COMMAND:
56 switch( LOWORD( wparam ) ) {
57 case IDOK:
58 strcpy( ctx->val, "\r\n" );
59 EndDialog( dlg, TRUE );
60 break;
61
62 case IDCANCEL:
63 strcpy( ctx->val, "c" );
64 ctx->cancel = 1;
65 EndDialog( dlg, FALSE );
66 break;
67 }
68 break;
69 }
70
71 return FALSE;
72 } /* card_cb_dlg_proc */
73
74
75 const char *
76 card_callback( int code, void * opaque )
77 {
78 struct card_cb_s * ctx = (struct card_cb_s *)opaque;
79
80 if( !ctx )
81 return NULL;
82
83 if( !ctx->init ) {
84 memset( ctx->val, 0, sizeof ctx->val );
85 ctx->code = code;
86 DialogBoxParam( glob_hinst, (LPCTSTR)IDD_WINPT_CARD_CTRL, glob_hwnd,
87 card_cb_dlg_proc, (LPARAM)ctx );
88 ctx->init = 0;
89 }
90
91 return ctx->val;
92 } /* card_callback */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26