23 |
|
|
24 |
#include <windows.h> |
#include <windows.h> |
25 |
#include <commctrl.h> |
#include <commctrl.h> |
26 |
|
#include <time.h> |
27 |
|
|
28 |
#include "resource.h" |
#include "resource.h" |
29 |
#include "wptGPG.h" |
#include "wptGPG.h" |
219 |
} |
} |
220 |
|
|
221 |
|
|
222 |
|
/* Check if the given system time @st points to today. */ |
223 |
|
static int |
224 |
|
date_is_today (SYSTEMTIME *st) |
225 |
|
{ |
226 |
|
time_t t; |
227 |
|
struct tm *tm; |
228 |
|
|
229 |
|
t = time (NULL); |
230 |
|
tm = localtime (&t); |
231 |
|
if (st->wDay == tm->tm_mday && |
232 |
|
st->wYear == tm->tm_year+1900 && |
233 |
|
st->wMonth == tm->tm_mon+1) |
234 |
|
return -1; |
235 |
|
return 0; |
236 |
|
} |
237 |
|
|
238 |
|
|
239 |
/* Dialog box procedure to sign a key. */ |
/* Dialog box procedure to sign a key. */ |
240 |
BOOL CALLBACK |
BOOL CALLBACK |
241 |
keysign_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
keysign_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
297 |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_SHOWIMG), TRUE); |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_SHOWIMG), TRUE); |
298 |
if (!reg_prefs.gpg.ask_cert_level) |
if (!reg_prefs.gpg.ask_cert_level) |
299 |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_ASKLEVEL), FALSE); |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_ASKLEVEL), FALSE); |
300 |
|
if (!reg_prefs.gpg.ask_cert_expire) |
301 |
|
EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_EXPSIG), FALSE); |
302 |
CheckDlgButton (dlg, IDC_KEYSIGN_HIDE, BST_CHECKED); |
CheckDlgButton (dlg, IDC_KEYSIGN_HIDE, BST_CHECKED); |
303 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
304 |
h = GetDlgItem (dlg, IDC_KEYSIGN_PASSPHRASE); |
h = GetDlgItem (dlg, IDC_KEYSIGN_PASSPHRASE); |
350 |
type = GPG_EDITKEY_NRLSIGN; |
type = GPG_EDITKEY_NRLSIGN; |
351 |
} |
} |
352 |
if (IsDlgButtonChecked (dlg, IDC_KEYSIGN_EXPSIG)) { |
if (IsDlgButtonChecked (dlg, IDC_KEYSIGN_EXPSIG)) { |
|
expires = 1; |
|
353 |
DateTime_GetSystemtime (GetDlgItem (dlg, IDC_KEYSIGN_EXPIRES), &st); |
DateTime_GetSystemtime (GetDlgItem (dlg, IDC_KEYSIGN_EXPIRES), &st); |
354 |
|
if (date_is_today (&st)) { |
355 |
|
msg_box (dlg, _("You cannot select today as the expiration date."), |
356 |
|
_("Key Signing"), MB_INFO); |
357 |
|
return TRUE; |
358 |
|
} |
359 |
|
else |
360 |
|
expires = 1; |
361 |
sprintf (keymsg, "%04d-%02d-%02d", st.wYear, st.wMonth, st.wDay); |
sprintf (keymsg, "%04d-%02d-%02d", st.wYear, st.wMonth, st.wDay); |
362 |
} |
} |
363 |
|
|