1 |
/* wptAboutDlgs.cpp - GPG and WinPT about dialogs |
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 |
#include <malloc.h> |
26 |
|
27 |
#include "resource.h" |
28 |
#include "wptTypes.h" |
29 |
#include "wptNLS.h" |
30 |
#include "wptW32API.h" |
31 |
#include "wptVersion.h" |
32 |
#include "wptGPG.h" |
33 |
|
34 |
#ifdef _MSC_VER |
35 |
#include "winpt_header.h" |
36 |
|
37 |
static DWORD help_arr[] = { |
38 |
IDC_ABOUT_HELP, WPT_ABOUT_HELP, |
39 |
IDC_ABOUT_GPG, WPT_ABOUT_GPG, |
40 |
IDOK, WPT_ABOUT_OK, |
41 |
0, 0}; |
42 |
#endif |
43 |
|
44 |
/* Dialog procedure to show 'gpg --version' information. */ |
45 |
static BOOL CALLBACK |
46 |
about_gpg_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
47 |
{ |
48 |
char *gpg_version; |
49 |
gpgme_error_t rc; |
50 |
|
51 |
switch (msg) { |
52 |
case WM_INITDIALOG: |
53 |
SetWindowText (dlg, _("About the GNU Privacy Guard")); |
54 |
|
55 |
rc = gpg_get_version (&gpg_version); |
56 |
if (rc || !gpg_version) { |
57 |
msg_box (dlg, gpgme_strerror (rc), _("About GnuPG"), MB_ERR); |
58 |
return FALSE; |
59 |
} |
60 |
SetDlgItemText (dlg, IDC_ABOUT_AUTHORS, |
61 |
_("The AUTHORS files contains a list of all contributors and co-authors.")); |
62 |
SetDlgItemText (dlg, IDC_ABOUTGPG_INFO, gpg_version); |
63 |
free (gpg_version); |
64 |
center_window (dlg, NULL); |
65 |
SetForegroundWindow (dlg); |
66 |
return TRUE; |
67 |
|
68 |
case WM_SYSCOMMAND: |
69 |
if (LOWORD (wparam) == SC_CLOSE) |
70 |
EndDialog (dlg, TRUE); |
71 |
return FALSE; |
72 |
|
73 |
case WM_COMMAND: |
74 |
switch (LOWORD (wparam)) { |
75 |
case IDOK: |
76 |
EndDialog (dlg, TRUE); |
77 |
return TRUE; |
78 |
|
79 |
case IDCANCEL: |
80 |
EndDialog (dlg, FALSE); |
81 |
return TRUE; |
82 |
} |
83 |
break; |
84 |
} |
85 |
|
86 |
return FALSE; |
87 |
} |
88 |
|
89 |
|
90 |
/* Dialog procedure to show the WinPT about information. */ |
91 |
BOOL CALLBACK |
92 |
about_winpt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
93 |
{ |
94 |
switch (msg) { |
95 |
case WM_INITDIALOG: |
96 |
SetWindowText (dlg, _("About WinPT")); |
97 |
SetDlgItemText (dlg, IDC_ABOUT_GPLINF, _("Warranty")); |
98 |
SetDlgItemText (dlg, IDC_ABOUT_INFO, |
99 |
_("A free open source privacy tray for Windows based on GnuPG.")); |
100 |
SetDlgItemText (dlg, IDC_ABOUT_URL, |
101 |
_("For more information you can visit the homepage: http://www.winpt.org")); |
102 |
SetDlgItemText (dlg, IDC_ABOUT_BUGS, |
103 |
_("Please report any BUGS or suggestions for WinPT to <[email protected]>")); |
104 |
SetDlgItemText (dlg, IDC_ABOUT_GPL1, |
105 |
_("WinPT is free software; you can redistribute it and/or modify it under " |
106 |
"the terms of the GNU General Public License as published by the Free " |
107 |
"Software Foundation; either Version 2 of the License, or " |
108 |
"(at your option) any later version.")); |
109 |
SetDlgItemText (dlg, IDC_ABOUT_GPL2, |
110 |
_("WinPT is distributed in the hope that it will be useful, but WITHOUT " |
111 |
"ANY WARRANTY; without even the implied warranty of MERCHANTABLITY or " |
112 |
"FITNESS FOR A PARTICULAR PURPOSE. See the General Public License for " |
113 |
"more details. ")); |
114 |
SetDlgItemText (dlg, IDC_ABOUT_GPG, _("&About GPG...")); |
115 |
SetDlgItemText (dlg, IDC_ABOUT_HELP, _("&Help")); |
116 |
SetDlgItemText (dlg, IDC_WINPT_VERSION, PACKAGE_FULL_VERSION); |
117 |
|
118 |
/* XXX provide full CHM help file. */ |
119 |
//EnableWindow (GetDlgItem (dlg, IDC_ABOUT_HELP), FALSE); |
120 |
ShowWindow (GetDlgItem (dlg, IDC_ABOUT_HELP), SW_HIDE); |
121 |
|
122 |
center_window (dlg, NULL); |
123 |
SetForegroundWindow (dlg); |
124 |
return TRUE; |
125 |
|
126 |
case WM_HELP: |
127 |
html_help_dispatch (lparam, "winpt.chm::winpt_texts.txt", help_arr); |
128 |
break; |
129 |
|
130 |
case WM_SYSCOMMAND: |
131 |
if (LOWORD (wparam) == SC_CLOSE) |
132 |
EndDialog (dlg, TRUE); |
133 |
return FALSE; |
134 |
|
135 |
case WM_COMMAND: |
136 |
switch (LOWORD (wparam)) { |
137 |
case IDC_ABOUT_GPG: |
138 |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_ABOUTGPG, |
139 |
dlg, about_gpg_dlg_proc, |
140 |
0, _("About the GNU Privacy Guard"), 0); |
141 |
return TRUE; |
142 |
|
143 |
case IDC_ABOUT_HELP: |
144 |
ShellExecute (dlg, "open", "winpt.chm", NULL, NULL, SW_SHOW); |
145 |
break; |
146 |
|
147 |
case IDOK: |
148 |
EndDialog (dlg, TRUE); |
149 |
return TRUE; |
150 |
|
151 |
case IDCANCEL: |
152 |
EndDialog (dlg, FALSE); |
153 |
return TRUE; |
154 |
} |
155 |
break; |
156 |
} |
157 |
|
158 |
return FALSE; |
159 |
} |