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");