application/window.c

changeset 92
43aee6c8c166
parent 90
f501f0efc9a8
child 94
7fdf1489b82f
--- a/application/window.c	Wed Nov 27 14:06:56 2024 +0100
+++ b/application/window.c	Wed Nov 27 16:42:19 2024 +0100
@@ -29,6 +29,7 @@
 #include "window.h"
 
 #include "davcontroller.h"
+#include "settings.h"
 
 #include <ui/stock.h>
 #include <ui/dnd.h>
@@ -91,9 +92,9 @@
     }
 
     // main content
-    UiModel* model = ui_model(obj->ctx, UI_ICON_TEXT, "Name", UI_STRING, "Type", UI_STRING_FREE, "Last Modified", UI_STRING_FREE, "Size", -1);
+    UiModel* model = ui_model(obj->ctx, UI_ICON_TEXT, "Name", UI_STRING_FREE, "Flags", UI_STRING, "Type", UI_STRING_FREE, "Last Modified", UI_STRING_FREE, "Size", -1);
     model->columnsize[0] = -1;
-    model->columnsize[1] = 150;
+    model->columnsize[2] = 150;
     model->getvalue = (ui_getvaluefunc) window_resource_table_getvalue;
     ui_table(obj,
             .fill = UI_ON,
@@ -124,13 +125,29 @@
         case 1: { // resource name
             return res->name;
         }
-        case 2: { // type
+        case 2: { // flags
+            char *keyprop = dav_get_string_property_ns(
+                    res,
+                    DAV_NS,
+                    "crypto-key");
+            DavXmlNode *lockdiscovery = dav_get_property(res, "D:lockdiscovery");
+            char *executable = dav_get_string_property_ns(
+                    res,
+                    "http://apache.org/dav/props/",
+                    "executable");
+            cxmutstr flags = cx_asprintf("%s%s%s",
+                    settings_get_cryptoflag(keyprop ? 1 : 0),
+                    settings_get_lockflag(lockdiscovery ? 1 : 0),
+                    settings_get_execflag(executable ? 1 : 0));
+            return flags.ptr;
+        }
+        case 3: { // type
             return res->iscollection ? "Collection" : (res->contenttype ? res->contenttype : "Resource");
         }
-        case 3: { // last modified
+        case 4: { // last modified
             return util_date_str(res->lastmodified);
         }
-        case 4: { // size
+        case 5: { // size
             return util_size_str(res->iscollection, res->contentlength);
         }
     }

mercurial