36 extern "C" { |
36 extern "C" { |
37 #endif |
37 #endif |
38 |
38 |
39 |
39 |
40 typedef struct SettingsWindow { |
40 typedef struct SettingsWindow { |
|
41 UiObject *obj; |
|
42 |
41 DavConfig *config; |
43 DavConfig *config; |
|
44 PwdStore *pwdstore; |
42 DavBool config_saved; |
45 DavBool config_saved; |
43 |
46 |
44 UiList *repos; |
47 UiList *repos; |
|
48 /* |
|
49 * 0: repo list page |
|
50 * 1: edit repo page |
|
51 */ |
45 UiInteger *repo_tabview; |
52 UiInteger *repo_tabview; |
46 |
53 |
47 DavBool repo_new; |
54 DavBool repo_new; |
48 UiString *repo_name; |
55 UiString *repo_name; |
49 UiString *repo_url; |
56 UiString *repo_url; |
|
57 /* |
|
58 * value: char* credential id |
|
59 * |
|
60 * '-' entry + list of all credentials |
|
61 * This list contains the same credential pointers as credentials_users |
|
62 * and therefore doesn't need a destructor. |
|
63 * Both lists are updated at the same time |
|
64 */ |
50 UiList *repo_credentials; |
65 UiList *repo_credentials; |
51 UiString *repo_user; |
66 UiString *repo_user; |
52 UiString *repo_password; |
67 UiString *repo_password; |
|
68 /* |
|
69 * checkbox value |
|
70 */ |
53 UiInteger *repo_encryption; |
71 UiInteger *repo_encryption; |
54 UiList *repo_keys; |
72 UiList *repo_keys; |
|
73 /* |
|
74 * value: char* tls version name |
|
75 * |
|
76 * static list of TLS version strings |
|
77 */ |
55 UiList *repo_tls_versions; |
78 UiList *repo_tls_versions; |
56 UiString *repo_cacert; |
79 UiString *repo_cacert; |
57 UiInteger *repo_disable_verification; |
80 UiInteger *repo_disable_verification; |
|
81 |
|
82 DavBool credentials_new; |
|
83 DavBool credentials_modified; |
|
84 DavBool credentials_list_needs_update; |
|
85 DavBool credentials_ignore_selectionevent; |
|
86 char *credentials_selected_id; |
|
87 int credentials_selected_index; |
|
88 int credentials_location_selected_index; |
|
89 /* |
|
90 * value: char* credentials id |
|
91 * |
|
92 * List of pwdstore locations and noloc credentials |
|
93 * The value is a copy (allocated by the UiContext) |
|
94 */ |
|
95 UiList *credentials_users; |
|
96 UiString *credentials_id; |
|
97 UiString *credentials_user; |
|
98 UiString *credentials_password; |
|
99 /* |
|
100 * value: char* url |
|
101 * |
|
102 * List of credential locations (PwdIndexEntry locations) |
|
103 * The value is a copy (allocated by the UiContext) |
|
104 */ |
|
105 UiList *credentials_locations; |
58 |
106 |
59 int selected_repo; |
107 int selected_repo; |
60 } SettingsWindow; |
108 } SettingsWindow; |
61 |
109 |
62 void settings_window_open(); |
110 void settings_window_open(); |
|
111 |
|
112 void settings_credentials_decrypt(SettingsWindow *settings); |
63 |
113 |
64 void settings_ok(UiEvent *event, void *userdata); |
114 void settings_ok(UiEvent *event, void *userdata); |
65 |
115 |
66 void settings_cancel(UiEvent *event, void *userdata); |
116 void settings_cancel(UiEvent *event, void *userdata); |
67 |
117 |
91 void settings_reload_keys(SettingsWindow *settings); |
141 void settings_reload_keys(SettingsWindow *settings); |
92 |
142 |
93 const char* dav_tlsversion2str(int value); |
143 const char* dav_tlsversion2str(int value); |
94 |
144 |
95 void settings_reload_credentials(SettingsWindow *settings); |
145 void settings_reload_credentials(SettingsWindow *settings); |
|
146 void settings_reload_repo_credentials(SettingsWindow *settings); |
96 |
147 |
|
148 /* |
|
149 * select credentials with the specified id and fill the credentials form |
|
150 * |
|
151 * if the id is specified, settings->credentials_id will be adjusted |
|
152 * id no id is specified, credentials with the id settings->credentials_id |
|
153 * are selected |
|
154 */ |
|
155 void settings_credentials_select(SettingsWindow *settings, const char *id); |
97 |
156 |
|
157 /* |
|
158 * clear the credentials form |
|
159 */ |
|
160 void settings_credentials_clear(SettingsWindow *settings); |
|
161 |
|
162 int settings_credentials_save(SettingsWindow *settings); |
98 |
163 |
99 |
164 |
100 #ifdef __cplusplus |
165 #ifdef __cplusplus |
101 } |
166 } |
102 #endif |
167 #endif |