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

Annotation of /trunk/Src/wptKeyEditOwnertrustDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 105 - (hide annotations)
Wed Nov 30 10:22:00 2005 UTC (19 years, 3 months ago) by twoaday
File size: 3766 byte(s)
Several cleanups and improved translation.


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

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26