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

Legend:
Removed from v.2  
changed lines
  Added in v.217

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26