Wed, 27 Nov 2024 16:42:19 +0100
add encryption and lock indicator, resolves #501
--- a/application/settings.c Wed Nov 27 14:06:56 2024 +0100 +++ b/application/settings.c Wed Nov 27 16:42:19 2024 +0100 @@ -1382,3 +1382,17 @@ ui_set(settings->key_file, ""); } + + + +const char* settings_get_cryptoflag(UiBool encrypted) { + return encrypted ? "C" : ""; +} + +const char* settings_get_lockflag(UiBool locked) { + return locked ? "L" : ""; +} + +const char* settings_get_execflag(UiBool executable) { + return ""; // executable flag disabled +}
--- a/application/settings.h Wed Nov 27 14:06:56 2024 +0100 +++ b/application/settings.h Wed Nov 27 16:42:19 2024 +0100 @@ -210,6 +210,12 @@ void settings_clear_key(SettingsWindow *settings); + +const char* settings_get_cryptoflag(UiBool encrypted); +const char* settings_get_lockflag(UiBool locked); +const char* settings_get_execflag(UiBool executable); + + #ifdef __cplusplus } #endif
--- 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); } }