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

Diff of /trunk/Src/wptKeyCacheDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by twoaday, Mon Oct 24 08:03:48 2005 UTC revision 36 by werner, Thu Oct 27 15:25:13 2005 UTC
# Line 1  Line 1 
1  /* wptKeyCacheDlg.cpp - Key caching dialog  /* wptKeyCacheDlg.cpp - Key caching dialog
2   *      Copyright (C) 2000-2005 Timo Schulz   *      Copyright (C) 2000-2005 Timo Schulz
3   *      Copyright (C) 2005 g10 Code GmbH   *      Copyright (C) 2005 g10 Code GmbH
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
6   *   *
7   * WinPT is free software; you can redistribute it and/or modify   * WinPT is free software; you can redistribute it and/or modify
8   * it under the terms of the GNU General Public License as published by   * it under the terms of the GNU General Public License as published by
9   * the Free Software Foundation; either version 2 of the License, or   * the Free Software Foundation; either version 2 of the License, or
10   * (at your option) any later version.   * (at your option) any later version.
11   *   *
12   * WinPT is distributed in the hope that it will be useful,   * WinPT is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.   * GNU General Public License for more details.
16   *   *
17   * You should have received a copy of the GNU General Public License   * You should have received a copy of the GNU General Public License
18   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
19   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20   */   */
21    
22  #include <windows.h>  #ifdef HAVE_CONFIG_H
23    #include <config.h>
24  #include "../resource.h"  #endif
25  #include "wptNLS.h"  
26  #include "wptGPG.h"  #include <windows.h>
27  #include "wptTypes.h"  #include <windows.h>
28  #include "wptW32API.h"  
29  #include "wptVersion.h"  #include "../resource.h"
30    #include "wptNLS.h"
31  /* Dialog box procedure for starting the key cache procedure.  #include "wptGPG.h"
32     Actually this dialog is hidden and just kick off the real  #include "wptTypes.h"
33     caching process. */  #include "wptW32API.h"
34  BOOL CALLBACK  #include "wptVersion.h"
35  keycache_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  
36  {  /* Dialog box procedure for starting the key cache procedure.
37      gpgme_error_t err;     Actually this dialog is hidden and just kick off the real
38      refresh_cache_s * rcs;     caching process. */
39      char * pubring = NULL, * secring = NULL;  BOOL CALLBACK
40        keycache_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
41      switch( msg ) {  {
42      case WM_INITDIALOG:      gpgme_error_t err;
43          rcs = (refresh_cache_s *)lparam;      refresh_cache_s * rcs;
44          if (!rcs)      char * pubring = NULL, * secring = NULL;
45              BUG (NULL);      
46          SetForegroundWindow (dlg);      switch( msg ) {
47          ShowWindow (dlg, SW_HIDE);      case WM_INITDIALOG:
48          center_window (dlg, NULL);          rcs = (refresh_cache_s *)lparam;
49          #ifndef LANG_DE          if (!rcs)
50          SetWindowText (dlg, _("WinPT Key Caching"));              BUG (NULL);
51          #endif          SetForegroundWindow (dlg);
52          ShowWindow (GetDlgItem (dlg, IDC_KEYCACHE_INFO), SW_SHOW);          ShowWindow (dlg, SW_HIDE);
53          SetDlgItemText (dlg, IDC_KEYCACHE_INFO,          center_window (dlg, NULL);
54                          _("Caching keyrings, please wait..."));          #ifndef LANG_DE
55                    SetWindowText (dlg, _("WinPT Key Caching"));
56          pubring = get_gnupg_keyring (1, NO_STRICT);          #endif
57          if (!pubring)          ShowWindow (GetDlgItem (dlg, IDC_KEYCACHE_INFO), SW_SHOW);
58              BUG (0);          SetDlgItemText (dlg, IDC_KEYCACHE_INFO,
59          secring = get_gnupg_keyring (0, NO_STRICT);                          _("Caching keyrings, please wait..."));
60          if (!secring)          
61              BUG (0);          pubring = get_gnupg_keyring (1, NO_STRICT);
62          if (rcs->tr_update)          if (!pubring)
63              gpg_rebuild_cache (NULL);              BUG (0);
64          if (rcs->kr_update) {          secring = get_gnupg_keyring (0, NO_STRICT);
65              keycache_set_reload (rcs->kr_reload);          if (!secring)
66              err = keycache_init (pubring, secring);              BUG (0);
67              if (err)          if (rcs->tr_update)
68                  msg_box (dlg, gpgme_strerror (err), _("Key Cache"), MB_ERR);              gpg_rebuild_cache (NULL);
69          }          if (rcs->kr_update) {
70          free_if_alloc (pubring);              keycache_set_reload (rcs->kr_reload);
71          free_if_alloc (secring);              err = keycache_init (pubring, secring);
72          EndDialog (dlg, TRUE);              if (err)
73          return FALSE;                  msg_box (dlg, gpgme_strerror (err), _("Key Cache"), MB_ERR);
74      }          }
75                free_if_alloc (pubring);
76      return FALSE;          free_if_alloc (secring);
77  }          EndDialog (dlg, TRUE);
78            return FALSE;
79        }
80        
81        return FALSE;
82    }

Legend:
Removed from v.32  
changed lines
  Added in v.36

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26