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

Diff of /trunk/Src/wptRegistry.cpp

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

revision 167 by twoaday, Thu Jan 26 10:17:17 2006 UTC revision 172 by twoaday, Mon Jan 30 13:47:35 2006 UTC
# Line 36  Line 36 
36    
37  #define rc_ok(rc) ((rc) == ERROR_SUCCESS)  #define rc_ok(rc) ((rc) == ERROR_SUCCESS)
38    
39    #define WINPT_REG "Software\\WinPT"
40    
41  struct reg_hotkey_s reg_hotkeys[] = {  struct reg_hotkey_s reg_hotkeys[] = {
42      {"ClipEncrypt", "", 0},      {"ClipEncrypt", "", 0},
# Line 50  struct reg_hotkey_s reg_hotkeys[] = { Line 50  struct reg_hotkey_s reg_hotkeys[] = {
50      {NULL, "", 0}      {NULL, "", 0}
51  };  };
52    
53    /* Global WinPT registry prefereneces. */
54  winpt_reg_prefs_s reg_prefs;  winpt_reg_prefs_s reg_prefs;
55    
 #define WINPT_REG "Software\\WinPT"  
   
56    
57  /* Return != 0 if GPG4win is installed. */  /* Return != 0 if GPG4win is installed. */
58  int  int
# Line 159  regist_inst_winpt (int with_ext, int *cr Line 158  regist_inst_winpt (int with_ext, int *cr
158      HKEY reg;      HKEY reg;
159      char *p = NULL;      char *p = NULL;
160      char modpath[MAX_PATH+1];      char modpath[MAX_PATH+1];
161      int rc, i, id, n = 0;      int rc, i, id, n;
162    
163      gpg_filetype gpg_filetypes[] = {      gpg_filetype gpg_filetypes[] = {
164          {_("GPG Detached Signature"), ".sig", 1},          {_("GPG Detached Signature"), ".sig", 1},
# Line 170  regist_inst_winpt (int with_ext, int *cr Line 169  regist_inst_winpt (int with_ext, int *cr
169    
170      if (created)      if (created)
171          *created = 0;          *created = 0;
172        if (is_gpgee_installed ())
     p = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions");  
     if ((p && *p == '1') || is_gpgee_installed ())  
173          with_ext = 0;          with_ext = 0;
     free_if_alloc (p);  
174    
     if (with_ext) {  
         id = msg_box (NULL, _("WinPT can register some GPG file types for you so they can "  
                               "be processed with a double click in the explorer.\n"  
                               "Do you want to continue?"), _("WinPT"), MB_YESNO|MB_INFO);  
         if (id == IDNO) {  
             set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");  
             goto start;  
         }  
         for (i = 0; gpg_filetypes[i].ext; i++) {  
             rc = RegOpenKeyEx (HKEY_CLASSES_ROOT, gpg_filetypes[i].ext, 0, KEY_READ, &reg);  
             if (rc_ok (rc)) {  
                 RegCloseKey (reg);  
                 id = log_box (_("WinPT WARNING"), MB_YESNO|MB_INFO,  
                               _("It seems there was already a '%s' file type registered by another application.\n"  
                                 "Do you want to overwrite it?"), gpg_filetypes[i].ext);  
                 if (id == IDNO)  
                     continue;  
             }  
             regist_single_filetype (&gpg_filetypes[i]);  
             n++;  
         }  
     }  
           
 start:  
175      rc = RegOpenKeyEx (HKEY_CURRENT_USER, WINPT_REG, 0, KEY_READ, &reg);      rc = RegOpenKeyEx (HKEY_CURRENT_USER, WINPT_REG, 0, KEY_READ, &reg);
176      if (rc_ok (rc)) {      if (rc_ok (rc)) {
177          RegCloseKey (reg);          RegCloseKey (reg);
# Line 216  start: Line 188  start:
188              set_reg_entry_keyserver ("Default", DEF_HKP_KEYSERVER);              set_reg_entry_keyserver ("Default", DEF_HKP_KEYSERVER);
189          }          }
190          free_if_alloc (p);          free_if_alloc (p);
         if (n)  
             set_reg_entry( HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1" );  
191          return 0;          return 0;
192      }      }
193      rc = RegCreateKey (HKEY_CURRENT_USER, WINPT_REG, &reg);      rc = RegCreateKey (HKEY_CURRENT_USER, WINPT_REG, &reg);
# Line 226  start: Line 196  start:
196      if (created)      if (created)
197          *created = 1;          *created = 1;
198      RegCloseKey (reg);      RegCloseKey (reg);
199      if (n > 0 || is_gpgee_installed ())      if (with_ext) {
200          set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");          id = msg_box (NULL, _("WinPT can register some GPG file types for you so they can "
201                                  "be processed with a double click in the explorer.\n"
202                                  "Do you want to continue?"), _("WinPT"), MB_YESNO|MB_INFO);
203            if (id == IDYES) {
204                for (i = 0; gpg_filetypes[i].ext; i++) {
205                    rc = RegOpenKeyEx (HKEY_CLASSES_ROOT, gpg_filetypes[i].ext, 0, KEY_READ, &reg);
206                    if (rc_ok (rc)) {
207                    RegCloseKey (reg);
208                        id = log_box (_("WinPT WARNING"), MB_YESNO|MB_INFO,
209                                      _("It seems there was already a '%s' file type registered by another application.\n"
210                                        "Do you want to overwrite it?"), gpg_filetypes[i].ext);
211                        if (id == IDNO)
212                            continue;
213                    }
214                    regist_single_filetype (&gpg_filetypes[i]);
215                }
216            }
217        }
218      if ((n=GetModuleFileName (NULL, modpath, MAX_PATH-1)) > 0) {      if ((n=GetModuleFileName (NULL, modpath, MAX_PATH-1)) > 0) {
219          while (n-- > 0) {          while (n-- > 0) {
220              if (modpath[n] == '\\') {              if (modpath[n] == '\\') {

Legend:
Removed from v.167  
changed lines
  Added in v.172

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26