/[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 327 by twoaday, Wed Mar 21 10:59:31 2007 UTC revision 328 by twoaday, Fri Sep 25 16:07:38 2009 UTC
# Line 12  Line 12 
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   * General Public License for more details.   * General Public License for more details.
  *  
  * You should have received a copy of the GNU General Public License  
  * along with WinPT; if not, write to the Free Software Foundation,  
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
15   */   */
16  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
17  #include <config.h>  #include <config.h>
18  #endif  #endif
19    
 /* For the case WinPT will be compiled in mobile mode, we use a wrapper  
    to avoid registry access (read, write) and thus this file will not  
    be used. */  
 #ifndef WINPT_MOBILE  
20  #include <windows.h>  #include <windows.h>
21  #include <stdio.h>  #include <stdio.h>
22    
# Line 59  typedef struct gpg_filetype_s *gpg_filet Line 51  typedef struct gpg_filetype_s *gpg_filet
51  /* Global WinPT registry prefereneces. */  /* Global WinPT registry prefereneces. */
52  struct winpt_prefs_s reg_prefs;  struct winpt_prefs_s reg_prefs;
53    
54    /* All valid configuration commands. */
55    const char *cfg [] = {
56        NULL,      
57        "CacheTime",
58        "WordWrap",
59        "DefaultExt",
60        "Viewer",
61        "AlwaysTrust",
62        "AutoBackup",
63        "BackupMode",
64        "DisableHotkeys",  
65        "NoCompressMultiMedia",    
66        "Expert",
67        "FMProgressBar",
68        "BackupSecring"
69    };
70    
71  /* Return != 0 if GPG4win is installed. */  /* Return != 0 if GPG4win is installed. */
72  int  int
# Line 102  free_reg_prefs (void) Line 110  free_reg_prefs (void)
110      free_if_alloc (reg_prefs.backup.path);      free_if_alloc (reg_prefs.backup.path);
111      free_if_alloc (reg_prefs.kserv_conf);      free_if_alloc (reg_prefs.kserv_conf);
112      free_if_alloc (reg_prefs.homedir);      free_if_alloc (reg_prefs.homedir);
113      memset (&reg_prefs, 0, sizeof reg_prefs);      memset (&reg_prefs, 0, sizeof (reg_prefs));
114  }  }
115    
116    
# Line 420  set_reg_entry_gpg (const char *key, cons Line 428  set_reg_entry_gpg (const char *key, cons
428  }  }
429    
430    
 int  
 set_reg_entry_mo (const char *value)  
 {        
     return set_reg_entry (HKEY_CURRENT_USER, GPG_MO_REG, "MODir", value);  
 }  
   
431    
432  char*  char*
433  get_reg_entry_gpg (const char *key)  get_reg_entry_gpg (const char *key)
# Line 530  set_reg_winpt_prefs (winpt_prefs_t opt) Line 532  set_reg_winpt_prefs (winpt_prefs_t opt)
532          case CFG_CACHETIME:          case CFG_CACHETIME:
533              sprintf (buf, "%d", opt->cache_time);              sprintf (buf, "%d", opt->cache_time);
534              break;              break;
535                
536          case CFG_WORDWRAP:          case CFG_WORDWRAP:
537              sprintf (buf, "%d", opt->word_wrap);              sprintf (buf, "%d", opt->word_wrap);
538              break;              break;
539                
540          case CFG_FILEEXT:          case CFG_FILEEXT:
541              sprintf (buf, "%d", opt->default_ext);              sprintf (buf, "%d", opt->default_ext);
542              break;              break;
543                
544          case CFG_NOZIP_MMEDIA:          case CFG_NOZIP_MMEDIA:
545              sprintf (buf, "%d", opt->no_zip_mmedia);              sprintf (buf, "%d", opt->no_zip_mmedia);
546              break;              break;
547                
548          case CFG_VIEWER:          case CFG_VIEWER:
549              sprintf (buf, "%d", opt->use_viewer);              sprintf (buf, "%d", opt->use_viewer);
550              break;              break;
551                
552          case CFG_ALWAYSTRUST:          case CFG_ALWAYSTRUST:
553              sprintf (buf, "%d", opt->always_trust);              sprintf (buf, "%d", opt->always_trust);
554              break;              break;
555    
556          case CFG_AUTOBACKUP:          case CFG_AUTOBACKUP:
557              sprintf (buf, "%d", opt->auto_backup);              sprintf (buf, "%d", opt->auto_backup);
558              break;              break;
559                
560          case CFG_AUTOBAKMODE:          case CFG_AUTOBAKMODE:
561              sprintf (buf, "%d", opt->backup.mode);              sprintf (buf, "%d", opt->backup.mode);
562              break;              break;
563                
564          case CFG_DISHOTKEYS:          case CFG_DISHOTKEYS:
565              sprintf (buf, "%d", opt->no_hotkeys);              sprintf (buf, "%d", opt->no_hotkeys);
566              break;              break;
567                
568          case CFG_EXPERT:          case CFG_EXPERT:
569              sprintf (buf, "%d", opt->expert);              sprintf (buf, "%d", opt->expert);
570              break;              break;
# Line 578  set_reg_winpt_prefs (winpt_prefs_t opt) Line 589  set_reg_winpt_prefs (winpt_prefs_t opt)
589              goto leave;              goto leave;
590      }      }
591    
592      for (i=0; wpt_hotkeys[i].name; i++) {      for (i=0; wpt_hotkeys[i].name != NULL; i++) {
593          if (wpt_hotkeys[i].enabled) {          if (wpt_hotkeys[i].enabled == 1) {
594              buf[0] = wpt_hotkeys[i].key;              buf[0] = wpt_hotkeys[i].key;
595              buf[1] = 0;              buf[1] = 0;
596          }          }
# Line 616  get_reg_winpt_flag (const char *name) Line 627  get_reg_winpt_flag (const char *name)
627      buf = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, name);      buf = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, name);
628      if (buf && buf[0] == '1')      if (buf && buf[0] == '1')
629          flag = 1;          flag = 1;
630      else if (!buf || buf && buf[0] != '0')      else if (!buf || (buf && buf[0] != '0'))
631          flag = -1;          flag = -1;
632      free_if_alloc (buf);      free_if_alloc (buf);
633      return flag;      return flag;
# Line 713  set_reg_entry_keyserver (const char *nam Line 724  set_reg_entry_keyserver (const char *nam
724  {  {
725      return set_reg_entry (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", name, val);      return set_reg_entry (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", name, val);
726  }  }
727  #endif  

Legend:
Removed from v.327  
changed lines
  Added in v.328

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26