1150 DavPathOpResult *result = data; |
1154 DavPathOpResult *result = data; |
1151 |
1155 |
1152 if (result->browser->current == result->collection && result->browser->res_counter == result->collection_ctn) { |
1156 if (result->browser->current == result->collection && result->browser->res_counter == result->collection_ctn) { |
1153 DavResource *res = dav_resource_new(result->browser->sn, result->path); |
1157 DavResource *res = dav_resource_new(result->browser->sn, result->path); |
1154 res->iscollection = result->iscollection; |
1158 res->iscollection = result->iscollection; |
|
1159 res->lastmodified = result->result_lastmodified; |
|
1160 res->contentlength = result->result_contentlength; |
|
1161 res->contenttype = result->result_contenttype ? dav_session_strdup(res->session, result->result_contenttype) : NULL; |
1155 // TODO: add the resource at the correct position or sort the list after append |
1162 // TODO: add the resource at the correct position or sort the list after append |
1156 ui_list_append(result->browser->resources, res); |
1163 ui_list_append(result->browser->resources, res); |
1157 result->browser->resources->update(result->browser->resources, 0); |
1164 result->browser->resources->update(result->browser->resources, 0); |
1158 } |
1165 } |
1159 |
1166 |
1160 free(result->path); |
1167 free(result->path); |
|
1168 free(result->result_contenttype); |
1161 free(result); |
1169 free(result); |
1162 return 0; |
1170 return 0; |
1163 } |
1171 } |
1164 |
1172 |
1165 static int jobthr_path_op(void *data) { |
1173 static int jobthr_path_op(void *data) { |
1178 result->path = strdup(res->path); |
1186 result->path = strdup(res->path); |
1179 result->result = 0; |
1187 result->result = 0; |
1180 result->res_index = op->list_indices[i]; |
1188 result->res_index = op->list_indices[i]; |
1181 result->errormsg = NULL; |
1189 result->errormsg = NULL; |
1182 result->iscollection = op->iscollection; |
1190 result->iscollection = op->iscollection; |
|
1191 result->result_lastmodified = 0; |
|
1192 result->result_contentlength = 0; |
|
1193 result->result_contenttype = NULL; |
1183 |
1194 |
1184 if (op->op == DAV_PATH_OP_DELETE) { |
1195 if (op->op == DAV_PATH_OP_DELETE) { |
1185 ui_threadfunc result_callback = uithr_pathop_delete_sucess; |
1196 ui_threadfunc result_callback = uithr_pathop_delete_sucess; |
1186 if (dav_delete(res)) { |
1197 if (dav_delete(res)) { |
1187 result->errormsg = op->sn->errorstr ? strdup(op->sn->errorstr) : NULL; |
1198 result->errormsg = op->sn->errorstr ? strdup(op->sn->errorstr) : NULL; |
1192 res->iscollection = op->iscollection; |
1203 res->iscollection = op->iscollection; |
1193 ui_threadfunc result_callback = uithr_pathop_create_resource_sucess; |
1204 ui_threadfunc result_callback = uithr_pathop_create_resource_sucess; |
1194 if (dav_create(res)) { |
1205 if (dav_create(res)) { |
1195 result->errormsg = op->sn->errorstr ? strdup(op->sn->errorstr) : NULL; |
1206 result->errormsg = op->sn->errorstr ? strdup(op->sn->errorstr) : NULL; |
1196 result_callback = uithr_pathop_create_resource_error; |
1207 result_callback = uithr_pathop_create_resource_error; |
|
1208 } else { |
|
1209 // try to load some basic resource properties |
|
1210 // we don't care about the result, if it fails, |
|
1211 // we just don't have the new properties |
|
1212 dav_load_prop(res, NULL, 0); |
|
1213 result->result_lastmodified = res->lastmodified; |
|
1214 result->result_contentlength = res->contentlength; |
|
1215 result->result_contenttype = res->contenttype ? strdup(res->contenttype) : NULL; |
1197 } |
1216 } |
1198 ui_call_mainthread(result_callback, result); |
1217 ui_call_mainthread(result_callback, result); |
1199 } |
1218 } |
1200 |
1219 |
1201 dav_resource_free(res); |
1220 dav_resource_free(res); |