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

Annotation of /trunk/Src/wptKeyEditOwnertrustDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 48 - (hide annotations)
Mon Oct 31 21:14:11 2005 UTC (19 years, 4 months ago) by werner
File size: 3752 byte(s)
More changes.  Compiles again but there are at least gettext issues with
w32-gettext.c.  I can't get a gpg-error build with ENABLE_NLS.

1 werner 36 /* wptKeyEditOwnertrustDlg.cpp - Key onwertrust dialog
2     * Copyright (C) 2000-2005 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     #ifdef HAVE_CONFIG_H
22     #include <config.h>
23     #endif
24    
25     #include <windows.h>
26    
27 werner 47 #include "resource.h"
28 werner 36 #include "wptErrors.h"
29     #include "wptW32API.h"
30     #include "wptVersion.h"
31     #include "wptTypes.h"
32     #include "wptNLS.h"
33     #include "wptGPG.h"
34     #include "wptCommonCtl.h"
35     #include "wptContext.h" /* for passphrase_s */
36     #include "wptDlgs.h"
37     #include "wptKeyEdit.h"
38    
39    
40     /* Dialog box procedure to set the ownertrust. */
41     BOOL CALLBACK
42     keyedit_ownertrust_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
43     {
44     static winpt_key_t k;
45     gpgme_error_t err;
46     gpgme_key_t key=NULL;
47     GpgKeyEdit *ek;
48     HWND lb;
49     int index, id = 0;
50    
51     switch( msg ) {
52     case WM_INITDIALOG:
53     k = (winpt_key_t)lparam;
54     if (k == NULL)
55     dlg_fatal_error( dlg, "Could not get dialog param!" );
56     #ifndef LANG_DE
57     SetWindowText( dlg, _("Change Ownertrust") );
58     #endif
59     lb = GetDlgItem( dlg, IDC_KEYTRUST_TRUST );
60     listbox_add_string( lb, _("Don't know") );
61     listbox_add_string( lb, _("I do NOT trust") );
62     listbox_add_string( lb, _("I trust marginally") );
63     listbox_add_string( lb, _("I trust fully") );
64     listbox_add_string( lb, _("I trust ultimately") );
65     SetDlgItemText (dlg, IDC_KEYTRUST_INF,
66     _("Please decide how far you trust this user to "
67     "correctly verify other users' keys (by looking "
68     "at passports, checking fingerprint from "
69     "different source...)?"));
70     center_window (dlg, NULL);
71     SetForegroundWindow (dlg);
72     return TRUE;
73    
74     case WM_SYSCOMMAND:
75     if (LOWORD (wparam) == SC_CLOSE)
76     EndDialog(dlg, TRUE);
77     return FALSE;
78    
79     case WM_COMMAND:
80     switch( LOWORD( wparam ) ) {
81     case IDCANCEL:
82     k->callback.new_val = -1;
83     EndDialog (dlg, FALSE);
84     return TRUE;
85    
86     case IDOK:
87     lb = GetDlgItem (dlg, IDC_KEYTRUST_TRUST);
88     index = listbox_get_cursel (lb) + 1;
89     if (index < 1 || index > 5) {
90     msg_box( dlg, _("Please choose one entry."), _("Ownertrust"), MB_ERR );
91     return TRUE;
92     }
93     /* check if there is a corresponding secret key for the public key. */
94     get_seckey (k->keyid, &key);
95     if (index == 5 && !key) {
96     id = msg_box (dlg, _("Do you really want to set this key to ultimate trust?"),
97     _("Ownertrust"), MB_YESNO);
98     if (id == IDNO)
99     return TRUE;
100     }
101     k->callback.new_val = index;
102     ek = new GpgKeyEdit (k->keyid);
103     err = ek->setTrust ((gpgme_validity_t)index);
104     delete ek;
105     if (err) {
106     msg_box (dlg, gpgme_strerror (err), _("Ownertrust"), MB_ERR);
107     return TRUE;
108     }
109     EndDialog (dlg, TRUE);
110     return TRUE;
111     }
112     break;
113     }
114     return FALSE;
115     }

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26