application/application.c

changeset 46
31bc86844659
parent 43
ef01d2c90128
child 47
3ac472683246
--- a/application/application.c	Sun Sep 29 20:25:41 2024 +0200
+++ b/application/application.c	Thu Oct 03 18:08:29 2024 +0200
@@ -98,8 +98,8 @@
     }
 
     //ui_toolbar_add_default("Home", UI_TOOLBAR_LEFT);
-    ui_toolbar_add_default("NewWindow", UI_TOOLBAR_LEFT);
-    ui_toolbar_add_default("Refresh", UI_TOOLBAR_LEFT);
+    //ui_toolbar_add_default("NewWindow", UI_TOOLBAR_LEFT);
+    //ui_toolbar_add_default("Refresh", UI_TOOLBAR_LEFT);
     ui_toolbar_add_default("Repo", UI_TOOLBAR_LEFT);
 
     ui_toolbar_add_default("NewFolder", UI_TOOLBAR_CENTER);
@@ -246,8 +246,26 @@
     ui_listselection_free(sel);
 }
 
+static void newfiledialog_result(UiEvent *event, void *data) {
+    DavBrowser *browser = event->document;
+    char *path = event->eventdata;
+    if (event->intval == 1) {
+        davbrowser_newfile(event->obj, browser, path);
+    }
+}
+
 void action_newfile(UiEvent *event, void *data) {
-
+    DavBrowser *browser = event->document;
+    if(!browser->sn) {
+        return;
+    }
+    
+    ui_dialog(event->obj,
+            .content = "New File",
+            .input =  TRUE,
+            .button1_label = "Create File",
+            .button2_label = "Cancel",
+            .result = newfiledialog_result);
 }
 
 
@@ -260,5 +278,16 @@
 }
 
 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);
+    DavBrowser *browser = event->document;
+    if(!browser->sn) {
+        return;
+    }
+    
+    
+    ui_dialog(event->obj,
+            .content = "New Folder",
+            .input =  TRUE,
+            .button1_label = "Create Folder",
+            .button2_label = "Cancel",
+            .result = newfolderdialog_result);
 }

mercurial