# HG changeset patch # User Olaf Wintermann # Date 1730225231 -3600 # Node ID ede7885491b1da63489c77308d27a7c18b0f0fb0 # Parent d5307e9ee38463f98a492ba57f6abdeb8e807292 implement repo Generate Key button diff -r d5307e9ee384 -r ede7885491b1 application/settings.c --- a/application/settings.c Tue Oct 29 17:51:02 2024 +0100 +++ b/application/settings.c Tue Oct 29 19:07:11 2024 +0100 @@ -349,6 +349,14 @@ dav_config_add_key(wdata->settings->config, newkey); settings_reload_repo_keys(wdata->settings); settings_reload_keys(wdata->settings); + + if(wdata->add_to_repo && (wdata->settings->selected_repo >= 0 || wdata->settings->repo_new)) { + CxList *repo_keys = wdata->settings->repo_keys->data; + ssize_t index = cxListFind(repo_keys, name); + if(index >= 0) { + ui_list_setselection(wdata->settings->repo_keys, index); + } + } } ui_close(event->obj); @@ -381,6 +389,7 @@ wdata->message = ui_string_new(dialog->ctx, NULL); wdata->secretstore = ui_int_new(dialog->ctx, NULL); wdata->type = ui_list_new(dialog->ctx, NULL); + wdata->add_to_repo = userdata ? TRUE : FALSE; dialog->window = wdata; ui_list_append(wdata->type, "AES256"); @@ -604,7 +613,7 @@ ui_llabel(obj, .label = "Default key"); ui_hbox(obj, .spacing = 4) { ui_combobox(obj, .list = wdata->repo_keys, .groups = UI_GROUPS(SETTINGS_STATE_REPO_ENCRYPTION)); - ui_button(obj, .label = "Generate Key", .groups = UI_GROUPS(SETTINGS_STATE_REPO_ENCRYPTION)); + ui_button(obj, .label = "Generate Key", .onclick = keys_add, .onclickdata = "repo", .groups = UI_GROUPS(SETTINGS_STATE_REPO_ENCRYPTION)); } ui_newline(obj); @@ -745,6 +754,8 @@ settings->repo_tls_versions = ui_list_new(obj->ctx, NULL); settings->repo_encryption = ui_int_new(obj->ctx, NULL); settings->repo_disable_verification = ui_int_new(obj->ctx, NULL); + CxList *repo_keys = settings->repo_keys->data; + repo_keys->collection.cmpfunc = (cx_compare_func)strcmp; ui_list_append(settings->repo_tls_versions, "Default"); ui_list_append(settings->repo_tls_versions, "TLSv1.3"); diff -r d5307e9ee384 -r ede7885491b1 application/settings.h --- a/application/settings.h Tue Oct 29 17:51:02 2024 +0100 +++ b/application/settings.h Tue Oct 29 19:07:11 2024 +0100 @@ -133,6 +133,8 @@ */ UiList *type; UiInteger *secretstore; + + DavBool add_to_repo; } SettingsNewKeyDialog; void settings_window_open();