1 |
/* wptRegistry.h - Registry interface |
2 |
* Copyright (C) 2000-2007 Timo Schulz |
3 |
* |
4 |
* This file is part of WinPT. |
5 |
* |
6 |
* WinPT is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU General Public License |
8 |
* as published by the Free Software Foundation; either version 2 |
9 |
* of the License, or (at your option) any later version. |
10 |
* |
11 |
* WinPT is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
* General Public License for more details. |
15 |
*/ |
16 |
#ifndef WPT_REGISTRY_H |
17 |
#define WPT_REGISTRY_H |
18 |
|
19 |
|
20 |
/* Symbolic configuration IDs */ |
21 |
enum cfg_t { |
22 |
CFG_INVALID=0, |
23 |
CFG_CACHETIME, |
24 |
CFG_WORDWRAP, |
25 |
CFG_FILEEXT, |
26 |
CFG_VIEWER, |
27 |
CFG_ALWAYSTRUST, |
28 |
CFG_AUTOBACKUP, |
29 |
CFG_AUTOBAKMODE, |
30 |
CFG_DISHOTKEYS, |
31 |
CFG_NOZIP_MMEDIA, |
32 |
CFG_EXPERT, |
33 |
CFG_FM_PROGRESS, |
34 |
CFG_BACKUP_INC_SKR, |
35 |
/* end of id list */ |
36 |
CFG_AUTOBAKPATH, |
37 |
CFG_KSERV_CONF, |
38 |
}; |
39 |
|
40 |
/* All valid configuration commands. */ |
41 |
static const char *cfg [] = { |
42 |
NULL, |
43 |
"CacheTime", |
44 |
"WordWrap", |
45 |
"DefaultExt", |
46 |
"Viewer", |
47 |
"AlwaysTrust", |
48 |
"AutoBackup", |
49 |
"BackupMode", |
50 |
"DisableHotkeys", |
51 |
"NoCompressMultiMedia", |
52 |
"Expert", |
53 |
"FMProgressBar", |
54 |
"BackupSecring" |
55 |
}; |
56 |
|
57 |
struct winpt_prefs_s { |
58 |
int no_hotkeys; /* disable ALL hotkeys */ |
59 |
int word_wrap; /* set word wrapping (0 means to disable it) */ |
60 |
int cache_time; /* caching time for passphrase */ |
61 |
int use_viewer; /* use clipboard viewer for displaying plaintext */ |
62 |
int no_zip_mmedia; /* disable compression for multi-media files (movies, music) */ |
63 |
int always_trust; /* skip key validation (1 means yes) */ |
64 |
int auto_backup; /* automatic backup (1 means activated) */ |
65 |
int default_ext; /* 1 = GPG, PGP otherwise. */ |
66 |
int no_safe_pwd_ctrl; /* disable the additional 'safe' window hooks. */ |
67 |
struct { |
68 |
int include_secr;/* including secret keyrings. */ |
69 |
int mode; /* backup mode */ |
70 |
char *path; /* keyring backup path */ |
71 |
} backup; |
72 |
char *kserv_conf; /* path to the keyserver config file. */ |
73 |
int expert; /* run in expert mode. */ |
74 |
struct { |
75 |
int progress; /* show the progress bar dialog. */ |
76 |
} fm; |
77 |
char *homedir; /* mobile home directory. */ |
78 |
|
79 |
/* Actual no registry options but virtual options. */ |
80 |
struct { |
81 |
unsigned int ask_cert_level:1; |
82 |
unsigned int ask_cert_expire:1; |
83 |
} gpg; |
84 |
}; |
85 |
typedef struct winpt_prefs_s *winpt_prefs_t; |
86 |
extern winpt_prefs_s reg_prefs; |
87 |
|
88 |
/*-- wptRegistry.cpp --*/ |
89 |
void free_reg_prefs (void); |
90 |
int regist_inst_gnupg (int create_mokey); |
91 |
int regist_inst_winpt (int with_ext, int *created); |
92 |
int set_reg_winpt_single (int id, int val); |
93 |
int get_reg_winpt_single (int id); |
94 |
int set_reg_winpt_prefs (winpt_prefs_t opt); |
95 |
int get_reg_winpt_prefs (winpt_prefs_t opt); |
96 |
char* get_reg_entry (HKEY root_key, const char *dir, const char *key); |
97 |
int set_reg_entry (HKEY root_key, const char * dir, const char * key, |
98 |
const char *value); |
99 |
int set_reg_key (HKEY root_key, const char * dir, const char * key, |
100 |
const char * value); |
101 |
int set_reg_entry_gpg (const char *key, const char *value); |
102 |
int set_reg_entry_mo (const char *value); |
103 |
char* get_reg_entry_gpg (const char * key); |
104 |
char* get_reg_entry_mo (void); |
105 |
int set_reg_entry_keyserver (const char * name, const char *val); |
106 |
char* get_reg_entry_keyserver( const char * name ); |
107 |
int set_reg_winpt_flag (const char *name, int val); |
108 |
int get_reg_winpt_flag (const char *name); |
109 |
char* get_reg_entry_gpg4win (const char *path); |
110 |
int is_gpg4win_installed (void); |
111 |
|
112 |
#endif /* WPT_REGISTRY_H */ |