1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef IDAV_APPLICATION_H
30 #define IDAV_APPLICATION_H
31
32 #include <ui/ui.h>
33
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <stdbool.h>
37
38 #include <libidav/webdav.h>
39 #include <libidav/config.h>
40
41 #include <cx/linked_list.h>
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 #define APP_STATE_BROWSER_SESSION 100
48 #define APP_STATE_BROWSER_SELECTION 110
49
50 #define RESOURCEVIEWER_STATE_MODIFIED 2000
51 #define RESOURCEVIEWER_STATE_PROP_SELECTED 2001
52 #define RESOURCEVIEWER_STATE_PROP_XML 2002
53
54 typedef struct DavApp {
55 DavConfig *dav_config;
56 UiList *repos;
57 UiList *transfers;
58 } DavApp;
59
60
61 typedef struct DavTransfer {
62 char *label;
63 size_t label_len;
64 double progress;
65 UiObject *window;
66 time_t last_update;
67 } DavTransfer;
68
69 typedef enum DavResourceViewType {
70 DAV_RESOURCE_VIEW_PROPERTIES =
0,
71 DAV_RESOURCE_VIEW_TEXT,
72 DAV_RESOURCE_VIEW_IMAGE
73 } DavResourceViewType;
74
75 #define DAV_RESOURCEVIEWER_PREVIEW_MAX_SIZE 0x1000000
76
77
78
79
80 typedef struct DavBrowser {
81 UiObject *window;
82
83 UiContext *ctx;
84 DavSession *sn;
85 UiThreadpool *dav_queue;
86
87 CxMap *res_open_inprogress;
88
89 char *repo_base;
90
91 DavResource *current;
92
93
94
95
96 uint64_t res_counter;
97
98 CxList *navigation_stack;
99 bool navstack_enabled;
100 int navstack_pos;
101
102
103
104
105 UiString *path;
106
107
108
109
110 UiList *resources;
111 } DavBrowser;
112
113
114
115
116
117 typedef struct DavPropertyList {
118 char *ns;
119 char *name;
120 char *value_simplified;
121 char *value_full;
122 DavXmlNode *xml;
123 DavBool update;
124 DavBool isnew;
125 } DavPropertyList;
126
127
128
129
130 typedef struct DavResourceViewer {
131 UiObject *obj;
132 UiContext *ctx;
133 DavSession *sn;
134 UiThreadpool *dav_queue;
135 DavResource *current;
136 char *path;
137 DavResourceViewType type;
138
139 UiInteger *tabview;
140 UiInteger *loading;
141 UiString *message;
142
143 UiList *properties;
144 UiText *text;
145 UiGeneric *image;
146
147 UiString *info_url;
148 UiString *info_name;
149 UiString *info_type;
150 UiString *info_encrypted;
151 UiString *info_etag;
152 UiString *info_size;
153
154 UiInteger *property_type;
155 UiString *property_ns;
156 UiString *property_name;
157 UiString *property_nsdef;
158 UiText *property_value;
159 UiString *property_errormsg;
160
161 DavPropertyList *selected_property;
162 DavPropertyList *edit_property;
163
164 int error;
165 char *message_str;
166
167 CxBuffer *text_content;
168 char *tmp_file;
169
170 bool properties_modified;
171 bool loaded;
172 bool window_closed;
173 } DavResourceViewer;
174
175 typedef struct SessionAuthData {
176 UiObject *obj;
177 UiCondVar *cond;
178 DavSession *sn;
179 char *user;
180 char *password;
181 } SessionAuthData;
182
183
184 void application_init(
void);
185
186
187
188
189 void application_startup(UiEvent* event,
void* data);
190
191
192
193
194 void application_create_menu(
void);
195
196 DavApp* get_application(
void);
197
198 void* transfers_getlabel(
void *data,
int col);
199
200 void application_register_transfer(DavTransfer *trans);
201 void application_remove_transfer(DavTransfer *trans);
202 void application_update_transferlist(
void);
203
204 DavApp* application_create_app_document(
void);
205
206 void application_update_repolist(DavApp *app);
207
208 DavContext* application_dav_context(
void);
209
210 void action_refresh(UiEvent *event,
void *data);
211
212 void action_window_new(UiEvent *event,
void *data);
213
214 void action_window_close(UiEvent *event,
void *data);
215
216 void action_repo_selected(UiEvent *event,
void *data);
217
218 void action_download(UiEvent *event,
void *data);
219
220 void action_upload_file(UiEvent *event,
void *data);
221
222 void action_upload_dir(UiEvent *event,
void *data);
223
224 void action_delete(UiEvent *event,
void *data);
225
226 void action_selectall(UiEvent *event,
void *data);
227
228 void action_rename(UiEvent *event,
void *data);
229
230 void action_newfile(UiEvent *event,
void *data);
231
232 void action_mkcol(UiEvent *event,
void *data);
233
234 void action_open_settings(UiEvent *event,
void *data);
235
236 void action_open_properties(UiEvent *event,
void *data);
237
238 void action_transfer_selected(UiEvent *event,
void *data);
239
240 #ifdef __cplusplus
241 }
242 #endif
243
244 #endif
245