164 davbrowser_connect2repo(event->obj, browser, repo, ""); |
164 davbrowser_connect2repo(event->obj, browser, repo, ""); |
165 } |
165 } |
166 |
166 |
167 static void file_selected(UiEvent *event, void *data) { |
167 static void file_selected(UiEvent *event, void *data) { |
168 UiFileList *files = event->eventdata; |
168 UiFileList *files = event->eventdata; |
169 |
169 if (files && files->nfiles > 0) { |
170 char *file = files->files[0]; |
170 // files will be freed by the filedialog handler, therefore we need a copy |
|
171 UiFileList uploadList = ui_filelist_copy(*files); // uploadList will be freed by davbrowser_upload_files |
|
172 davbrowser_upload_files(event->obj, event->document, uploadList); |
|
173 } |
|
174 |
171 } |
175 } |
172 |
176 |
173 void action_upload_file(UiEvent *event, void *data) { |
177 void action_upload_file(UiEvent *event, void *data) { |
174 ui_openfiledialog(event->obj, UI_FILEDIALOG_SELECT_MULTI, file_selected, NULL); |
178 ui_openfiledialog(event->obj, UI_FILEDIALOG_SELECT_MULTI, file_selected, NULL); |
175 } |
179 } |