application/settings.h

changeset 65
48f43130b4a2
parent 63
d0eeb2b98dae
child 67
3f987dde3be2
--- a/application/settings.h	Mon Oct 28 07:37:45 2024 +0100
+++ b/application/settings.h	Mon Oct 28 15:20:58 2024 +0100
@@ -38,29 +38,79 @@
     
 
 typedef struct SettingsWindow {
+    UiObject *obj;
+    
     DavConfig *config;
+    PwdStore *pwdstore;
     DavBool config_saved;
     
     UiList *repos;
+    /*
+     * 0: repo list page
+     * 1: edit repo page
+     */
     UiInteger *repo_tabview;
     
     DavBool repo_new;
     UiString *repo_name;
     UiString *repo_url;
+    /*
+     * value: char*   credential id
+     * 
+     * '-' entry + list of all credentials
+     * This list contains the same credential pointers as credentials_users
+     * and therefore doesn't need a destructor.
+     * Both lists are updated at the same time
+     */
     UiList *repo_credentials;
     UiString *repo_user;
     UiString *repo_password;
+    /*
+     * checkbox value
+     */
     UiInteger *repo_encryption;
     UiList *repo_keys;
+    /*
+     * value: char*   tls version name
+     * 
+     * static list of TLS version strings
+     */
     UiList *repo_tls_versions;
     UiString *repo_cacert;
     UiInteger *repo_disable_verification;
     
+    DavBool credentials_new;
+    DavBool credentials_modified;
+    DavBool credentials_list_needs_update;
+    DavBool credentials_ignore_selectionevent;
+    char *credentials_selected_id;
+    int credentials_selected_index;
+    int credentials_location_selected_index;
+    /*
+     * value: char*   credentials id
+     * 
+     * List of pwdstore locations and noloc credentials
+     * The value is a copy (allocated by the UiContext)
+     */
+    UiList *credentials_users;
+    UiString *credentials_id;
+    UiString *credentials_user;
+    UiString *credentials_password;
+    /*
+     * value: char*   url
+     * 
+     * List of credential locations (PwdIndexEntry locations)
+     * The value is a copy (allocated by the UiContext)
+     */
+    UiList *credentials_locations;
+    
     int selected_repo;
 } SettingsWindow;
     
 void settings_window_open();
 
+void settings_credentials_decrypt(SettingsWindow *settings);
+
 void settings_ok(UiEvent *event, void *userdata);
 
 void settings_cancel(UiEvent *event, void *userdata);
@@ -93,8 +143,23 @@
 const char* dav_tlsversion2str(int value);
 
 void settings_reload_credentials(SettingsWindow *settings);
+void settings_reload_repo_credentials(SettingsWindow *settings);
 
+/*
+ * select credentials with the specified id and fill the credentials form
+ * 
+ * if the id is specified, settings->credentials_id will be adjusted
+ * id no id is specified, credentials with the id settings->credentials_id
+ * are selected
+ */
+void settings_credentials_select(SettingsWindow *settings, const char *id);
 
+/*
+ * clear the credentials form
+ */
+void settings_credentials_clear(SettingsWindow *settings);
+
+int settings_credentials_save(SettingsWindow *settings);
 
 
 #ifdef __cplusplus

mercurial