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

Annotation of /trunk/Src/wptCardManager.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 185 - (hide annotations)
Mon Mar 20 12:48:52 2006 UTC (18 years, 11 months ago) by twoaday
File size: 2329 byte(s)
2006-03-20  Timo Schulz  <ts@g10code.de>

        * wptUTF8.cpp (get_native_charset): Removed.
        (utf8_to_native): Rewritten.
        * wptKeyEditDlgs.cpp (do_add_new_userid): Correct charset
        handling.
        * wptKeygenCBDlg.cpp (keygen_cb): Do proper reset if needed.


1 werner 36 /* wptCardManager.cpp
2     * Copyright (C) 2003, 2005 Timo Schulz
3     * Copyright (C) 2005 g10 Code GmbH
4     *
5     * This file is part of WinPT.
6     *
7     * WinPT is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * WinPT is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with WinPT; if not, write to the Free Software Foundation,
19     * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20     */
21    
22     #ifdef HAVE_CONFIG_H
23     #include <config.h>
24     #endif
25    
26     #include <stdio.h>
27     #include <windows.h>
28    
29     #include "wptTypes.h"
30     #include "wptW32API.h"
31     #include "wptVersion.h"
32     #include "wptNLS.h"
33     #include "wptGPG.h"
34     #include "wptCard.h"
35 werner 47 #include "resource.h"
36 werner 36
37    
38     /* Dialog box procedure for the card callback. */
39     static BOOL CALLBACK
40     card_cb_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
41     {
42     static card_cb_s * ctx;
43    
44     switch( msg ) {
45     case WM_INITDIALOG:
46     ctx = (struct card_cb_s *)lparam;
47 twoaday 185 if (!ctx)
48     BUG (NULL);
49 werner 36 switch (ctx->code) {
50     case CARD_CTL_INSERT:
51     ShowWindow (GetDlgItem (dlg, IDC_CCTRL_VAL), FALSE);
52     SetDlgItemText (dlg, IDC_CCTRL_MSG,
53     _("Please insert the OpenPGP smart card\n"
54     "Press OK to continue or Cancel"));
55     break;
56     }
57     center_window (dlg, NULL);
58     SetForegroundWindow (dlg);
59     break;
60    
61     case WM_COMMAND:
62     switch (LOWORD (wparam)) {
63     case IDOK:
64     strcpy (ctx->val, "\r\n");
65     EndDialog( dlg, TRUE );
66     break;
67    
68     case IDCANCEL:
69     strcpy (ctx->val, "c");
70     ctx->cancel = 1;
71     EndDialog (dlg, FALSE);
72     break;
73     }
74     break;
75     }
76    
77     return FALSE;
78     }
79    
80    
81     const char*
82     card_callback (int code, void *opaque)
83     {
84     struct card_cb_s *ctx = (struct card_cb_s *)opaque;
85    
86     if (!ctx)
87     return NULL;
88    
89     if (!ctx->init) {
90     memset (ctx->val, 0, sizeof (ctx->val));
91     ctx->code = code;
92     DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CARD_CTRL, glob_hwnd,
93     card_cb_dlg_proc, (LPARAM)ctx);
94     ctx->init = 0;
95     }
96    
97     return ctx->val;
98     }

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26