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

Annotation of /trunk/Src/wptKeyEditOwnertrustDlg.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: 3562 byte(s)
WinPT initial checkin.


1 twoaday 2 /* wptKeyEditOwnertrustDlg.cpp - Key onwertrust dialog
2     * Copyright (C) 2000-2004 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 "wptErrors.h"
25     #include "wptW32API.h"
26     #include "wptVersion.h"
27     #include "wptTypes.h"
28     #include "wptNLS.h"
29     #include "wptGPG.h"
30     #include "wptCommonCtl.h"
31     #include "wptContext.h" /* for passphrase_s */
32     #include "wptDlgs.h"
33    
34    
35     static int index_val = 0; /* fixme */
36    
37    
38     int
39     keyedit_ownertrust_get_val( void )
40     {
41     return index_val;
42     } /* keyedit_ownertrust_get_val */
43    
44    
45     BOOL CALLBACK
46     keyedit_ownertrust_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam )
47     {
48     static gpgme_editkey_t ctx;
49     HWND lb;
50     int index, id = 0;
51    
52     switch( msg ) {
53     case WM_INITDIALOG:
54     ctx = (gpgme_editkey_t)lparam;
55     if( lparam == NULL )
56     dlg_fatal_error( dlg, "Could not get dialog param!" );
57     #ifndef LANG_DE
58     SetWindowText( dlg, _("Change Ownertrust") );
59     #endif
60     lb = GetDlgItem( dlg, IDC_KEYTRUST_TRUST );
61     listbox_add_string( lb, _("Don't know") );
62     listbox_add_string( lb, _("I do NOT trust") );
63     listbox_add_string( lb, _("I trust marginally") );
64     listbox_add_string( lb, _("I trust fully") );
65     listbox_add_string( lb, _("I trust ultimately") );
66     SetDlgItemText (dlg, IDC_KEYTRUST_INF, _("Please decide how far you trust this user to correctly verify other users' keys (by looking at passports, checking fingerprint from different source...)?"));
67     center_window (dlg);
68     SetForegroundWindow (dlg);
69     return TRUE;
70    
71     case WM_SYSCOMMAND:
72     if( LOWORD( wparam ) == SC_CLOSE )
73     EndDialog(dlg, TRUE);
74     return FALSE;
75    
76     case WM_COMMAND:
77     switch( LOWORD( wparam ) ) {
78     case IDCANCEL:
79     gpgme_editkey_make_invalid( ctx );
80     EndDialog( dlg, FALSE );
81     return FALSE;
82    
83     case IDOK:
84     lb = GetDlgItem( dlg, IDC_KEYTRUST_TRUST );
85     index = listbox_get_cursel( lb ) + 1;
86     if( index < 1 || index > 5 ) {
87     msg_box( dlg, _("Please choose one entry."), _("Ownertrust"), MB_ERR );
88     return FALSE;
89     }
90     if( index == 5 && !gpgme_editkey_is_secret( ctx, 0 ) ) {
91     id = msg_box( dlg, _("Do you really want to set this key to ultimate trust?"),
92     _("Ownertrust"), MB_YESNO );
93     if( id == IDNO )
94     return FALSE;
95     }
96     gpgme_editkey_trust_set( ctx, index );
97     index_val = index;
98     EndDialog( dlg, TRUE );
99     return TRUE;
100     }
101     break;
102     }
103     return FALSE;
104     } /* keyedit_ownertrust_dlg_proc */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26