42 #include <libidav/utils.h> |
42 #include <libidav/utils.h> |
43 |
43 |
44 DavBrowser* davbrowser_create(UiObject *toplevel) { |
44 DavBrowser* davbrowser_create(UiObject *toplevel) { |
45 DavBrowser *doc = ui_document_new(sizeof(DavBrowser)); |
45 DavBrowser *doc = ui_document_new(sizeof(DavBrowser)); |
46 UiContext *ctx = ui_document_context(doc); |
46 UiContext *ctx = ui_document_context(doc); |
|
47 doc->window = toplevel; |
47 doc->ctx = ctx; |
48 doc->ctx = ctx; |
48 |
49 |
49 doc->navigation_stack = cxLinkedListCreateSimple(CX_STORE_POINTERS); |
50 doc->navigation_stack = cxLinkedListCreateSimple(CX_STORE_POINTERS); |
50 doc->navstack_enabled = true; |
51 doc->navstack_enabled = true; |
51 doc->navstack_pos = 0; |
52 doc->navstack_pos = 0; |
466 free(wtitle.ptr); |
467 free(wtitle.ptr); |
467 |
468 |
468 DavFileUpload *upload = dav_upload_create(browser, dialog, files); |
469 DavFileUpload *upload = dav_upload_create(browser, dialog, files); |
469 transfer_window_init(dialog, action_upload_cancel); |
470 transfer_window_init(dialog, action_upload_cancel); |
470 dav_upload_start(upload); |
471 dav_upload_start(upload); |
|
472 application_register_transfer(&upload->trans); |
471 } |
473 } |
472 |
474 |
473 void davbrowser_download(UiObject *ui, DavBrowser *browser, DavResource *reslist, const char *local_path) { |
475 void davbrowser_download(UiObject *ui, DavBrowser *browser, DavResource *reslist, const char *local_path) { |
474 cxmutstr wtitle = cx_asprintf("Download to: %s", local_path); |
476 cxmutstr wtitle = cx_asprintf("Download to: %s", local_path); |
475 UiObject *dialog = ui_simple_window(wtitle.ptr, NULL); |
477 UiObject *dialog = ui_simple_window(wtitle.ptr, NULL); |
476 free(wtitle.ptr); |
478 free(wtitle.ptr); |
477 |
479 |
478 DavFileDownload *download = dav_download_create(browser, dialog, reslist, local_path); |
480 DavFileDownload *download = dav_download_create(browser, dialog, reslist, local_path); |
479 transfer_window_init(dialog, action_download_cancel); |
481 transfer_window_init(dialog, action_download_cancel); |
480 dav_download_start(download); |
482 dav_download_start(download); |
|
483 application_register_transfer(&download->trans); |
481 } |
484 } |
482 |
485 |
483 |
486 |
484 // ------------------------------------- Path Operation (DELETE, MKCOL) ------------------------------------- |
487 // ------------------------------------- Path Operation (DELETE, MKCOL) ------------------------------------- |
485 |
488 |