diff -r c254ed644edf -r 1ecc1183f046 application/application.c --- a/application/application.c Sun Feb 11 13:59:02 2024 +0100 +++ b/application/application.c Sun Feb 11 15:59:56 2024 +0100 @@ -85,8 +85,8 @@ ui_toolbar_menu("Repo", .label = "Repository") { ui_menu_itemlist(.varname = "repolist", .getvalue = davrepo_getname, .onselect = action_repo_selected); } - ui_toolbar_item("NewFolder", .icon = "NewFolder"); - ui_toolbar_item("NewFile", .icon = "Add"); + ui_toolbar_item("NewFolder", .icon = "NewFolder", .onclick = action_mkcol); + ui_toolbar_item("NewFile", .icon = "Add", .onclick = action_newfile); ui_toolbar_item("Upload", .label = "Upload", .icon = "Upload", .onclick = action_upload_file); ui_toolbar_item("Download", .icon = "SaveLocal"); ui_toolbar_item("Remove", .icon = "Delete", .onclick = action_delete ); @@ -187,3 +187,20 @@ } ui_listselection_free(sel); } + +void action_newfile(UiEvent *event, void *data) { + +} + + +static void newfolderdialog_result(UiEvent *event, void *data) { + DavBrowser *browser = event->document; + char *path = event->eventdata; + if (event->intval == 1) { + davbrowser_mkcol(event->obj, browser, path); + } +} + +void action_mkcol(UiEvent *event, void *data) { + ui_dialog(event->obj, .content = "New Folder", .input = TRUE, .button1_label = "Create Folder", .button2_label = "Close", .result = newfolderdialog_result); +}