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

Annotation of /trunk/Src/wptOwnertrustDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


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


1 twoaday 2 /* wptOwnertrust.cpp - Ownertrust im- and export
2     * Copyright (C) 2001, 2002, 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 <windows.h>
22    
23     #include "../resource.h"
24     #include "wptTypes.h"
25     #include "wptGPG.h"
26     #include "wptErrors.h"
27     #include "wptNLS.h"
28     #include "wptW32API.h"
29    
30    
31     BOOL CALLBACK
32     ownertrust_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam )
33     {
34     gpgme_error_t err;
35     char fname[256];
36    
37     switch( msg ) {
38     case WM_INITDIALOG:
39     #ifndef LANG_DE
40     SetWindowText( dlg, _("Ownertrust") );
41     SetDlgItemText( dlg, IDC_OWNERTRUST_INFO, _("File") );
42     SetDlgItemText( dlg, IDC_OWNERTRUST_DESC,
43     _("Here it is possible to save or restore the ownertrust from the "
44     "'trustdb' file. This could be very useful because the values are NOT "
45     "stored in the keyring.") );
46     #endif
47     center_window( dlg );
48     SetForegroundWindow( dlg );
49     return TRUE;
50    
51     case WM_SYSCOMMAND:
52     if( LOWORD (wparam) == SC_CLOSE )
53     EndDialog( dlg, TRUE );
54     return FALSE;
55    
56     case WM_COMMAND:
57     switch ( LOWORD( wparam ) ) {
58     case IDC_OWNERTRUST_SELFILE:
59     const char * s;
60     s = get_filename_dlg( dlg, 1, _("Please select a filename"), NULL, NULL );
61     if( s && *s )
62     SetDlgItemText( dlg, IDC_OWNERTRUST_FILE, s );
63     break;
64    
65     case IDC_OWNERTRUST_EXPORT:
66     if( !GetDlgItemText( dlg, IDC_OWNERTRUST_FILE, fname, sizeof fname -1 ) ) {
67     msg_box( dlg, _("Please enter the filename."), _("Ownertrust"), MB_ERR );
68     return FALSE;
69     }
70     err = gpgme_op_ownertrust_export_file( fname );
71     if( err ) {
72     msg_box( dlg, gpgme_strerror( err ), _("Ownertrust"), MB_ERR );
73     return FALSE;
74     }
75     status_box( dlg, _("Ownertrust successfully exported."), _("GnuPG Status") );
76     EndDialog( dlg, TRUE );
77     return TRUE;
78    
79     case IDC_OWNERTRUST_IMPORT:
80     if( !GetDlgItemText( dlg, IDC_OWNERTRUST_FILE, fname, sizeof fname-1 ) ) {
81     msg_box( dlg, _("Please enter the filename."), _("Ownertrust"), MB_ERR );
82     return FALSE;
83     }
84     err = gpgme_op_ownertrust_import_file( fname );
85     if( err ) {
86     msg_box( dlg, gpgme_strerror( err ), _("Ownertrust"), MB_ERR );
87     return FALSE;
88     }
89     status_box( dlg, _("Ownertrust succefully imported."), _("GnuPG Status") );
90     EndDialog( dlg, TRUE );
91     return TRUE;
92    
93     case IDCANCEL:
94     EndDialog( dlg, FALSE );
95     return FALSE;
96     }
97     break;
98     }
99    
100     return FALSE;
101     } /* ownertrust_dlg_proc */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26