application/window.c

changeset 92
43aee6c8c166
parent 90
f501f0efc9a8
child 94
7fdf1489b82f
equal deleted inserted replaced
91:7ee944cf53de 92:43aee6c8c166
27 */ 27 */
28 28
29 #include "window.h" 29 #include "window.h"
30 30
31 #include "davcontroller.h" 31 #include "davcontroller.h"
32 #include "settings.h"
32 33
33 #include <ui/stock.h> 34 #include <ui/stock.h>
34 #include <ui/dnd.h> 35 #include <ui/dnd.h>
35 36
36 #include <libidav/utils.h> 37 #include <libidav/utils.h>
89 90
90 ui_progressspinner(obj, .value = wdata->progress); 91 ui_progressspinner(obj, .value = wdata->progress);
91 } 92 }
92 93
93 // main content 94 // main content
94 UiModel* model = ui_model(obj->ctx, UI_ICON_TEXT, "Name", UI_STRING, "Type", UI_STRING_FREE, "Last Modified", UI_STRING_FREE, "Size", -1); 95 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);
95 model->columnsize[0] = -1; 96 model->columnsize[0] = -1;
96 model->columnsize[1] = 150; 97 model->columnsize[2] = 150;
97 model->getvalue = (ui_getvaluefunc) window_resource_table_getvalue; 98 model->getvalue = (ui_getvaluefunc) window_resource_table_getvalue;
98 ui_table(obj, 99 ui_table(obj,
99 .fill = UI_ON, 100 .fill = UI_ON,
100 .model = model, 101 .model = model,
101 .onselection = action_list_selection, 102 .onselection = action_list_selection,
122 return res->iscollection ? folder_icon : file_icon; 123 return res->iscollection ? folder_icon : file_icon;
123 } 124 }
124 case 1: { // resource name 125 case 1: { // resource name
125 return res->name; 126 return res->name;
126 } 127 }
127 case 2: { // type 128 case 2: { // flags
129 char *keyprop = dav_get_string_property_ns(
130 res,
131 DAV_NS,
132 "crypto-key");
133 DavXmlNode *lockdiscovery = dav_get_property(res, "D:lockdiscovery");
134 char *executable = dav_get_string_property_ns(
135 res,
136 "http://apache.org/dav/props/",
137 "executable");
138 cxmutstr flags = cx_asprintf("%s%s%s",
139 settings_get_cryptoflag(keyprop ? 1 : 0),
140 settings_get_lockflag(lockdiscovery ? 1 : 0),
141 settings_get_execflag(executable ? 1 : 0));
142 return flags.ptr;
143 }
144 case 3: { // type
128 return res->iscollection ? "Collection" : (res->contenttype ? res->contenttype : "Resource"); 145 return res->iscollection ? "Collection" : (res->contenttype ? res->contenttype : "Resource");
129 } 146 }
130 case 3: { // last modified 147 case 4: { // last modified
131 return util_date_str(res->lastmodified); 148 return util_date_str(res->lastmodified);
132 } 149 }
133 case 4: { // size 150 case 5: { // size
134 return util_size_str(res->iscollection, res->contentlength); 151 return util_size_str(res->iscollection, res->contentlength);
135 } 152 }
136 } 153 }
137 return NULL; 154 return NULL;
138 } 155 }

mercurial