Modified: trunk/Tools/ChangeLog (130471 => 130472)
--- trunk/Tools/ChangeLog 2012-10-05 06:57:34 UTC (rev 130471)
+++ trunk/Tools/ChangeLog 2012-10-05 06:58:57 UTC (rev 130472)
@@ -1,3 +1,23 @@
+2012-10-04 KyungTae Kim <ktf....@samsung.com>
+
+ [EFL][WK2] Fix destination path when download with suggested filename on the Minibrowser
+ https://bugs.webkit.org/show_bug.cgi?id=98334
+
+ Reviewed by Gyuyoung Kim.
+
+ Add callback functions for download requests to Minibrowser to set the destination path for download.
+ Set the destination path with suggested file name as (destination folder) + (suggested file name).
+ The 'destination folder' should be a specific folder user selected, but is set to '/tmp' for now.
+
+ Additionally, for printing out the download status,
+ use the info macro and set the verbose variable to 1 to enable it.
+
+ * MiniBrowser/efl/main.c:
+ (on_download_request):
+ (on_download_finished):
+ (on_download_failed):
+ (browserCreate):
+
2012-10-04 Christophe Dumez <christophe.du...@intel.com>
[WK2][WKTR] Implement UIClient focus callbacks in WebKitTestRunner
Modified: trunk/Tools/MiniBrowser/efl/main.c (130471 => 130472)
--- trunk/Tools/MiniBrowser/efl/main.c 2012-10-05 06:57:34 UTC (rev 130471)
+++ trunk/Tools/MiniBrowser/efl/main.c 2012-10-05 06:58:57 UTC (rev 130472)
@@ -36,7 +36,7 @@
printf(format, ##args); \
} while (0)
-static int verbose = 0;
+static int verbose = 1;
typedef struct _MiniBrowser {
Ecore_Evas *ee;
@@ -199,6 +199,41 @@
eina_strbuf_free(buffer);
}
+static void
+on_download_request(void *user_data, Evas_Object *webview, void *event_info)
+{
+ Ewk_Download_Job *download = (Ewk_Download_Job *)event_info;
+
+ // FIXME: The destination folder should be selected by the user but we set it to '/tmp' for now.
+ Eina_Strbuf *destination_path = eina_strbuf_new();
+ eina_strbuf_append(destination_path, "/tmp/");
+
+ const char *suggested_name = ewk_download_job_suggested_filename_get(download);
+ if (suggested_name && *suggested_name)
+ eina_strbuf_append(destination_path, suggested_name);
+ else {
+ eina_strbuf_append(destination_path, "downloaded-file.XXXXXX");
+ mktemp(eina_strbuf_string_get(destination_path));
+ }
+
+ ewk_download_job_destination_set(download, eina_strbuf_string_get(destination_path));
+ info("Downloading: %s\n", eina_strbuf_string_get(destination_path));
+ eina_strbuf_free(destination_path);
+}
+
+static void
+on_download_finished(void *user_data, Evas_Object *webview, void *event_info)
+{
+ Ewk_Download_Job *download = (Ewk_Download_Job *)event_info;
+ info("Download finished: %s\n", ewk_download_job_destination_get(download));
+}
+
+static void
+on_download_failed(void *user_data, Evas_Object *webview, void *event_info)
+{
+ info("Download failed!\n");
+}
+
static int
quit(Eina_Bool success, const char *msg)
{
@@ -238,6 +273,9 @@
Ewk_Settings *settings = ewk_view_settings_get(app->browser);
ewk_settings_file_access_from_file_urls_allowed_set(settings, EINA_TRUE);
+ evas_object_smart_callback_add(app->browser, "download,failed", on_download_failed, app);
+ evas_object_smart_callback_add(app->browser, "download,finished", on_download_finished, app);
+ evas_object_smart_callback_add(app->browser, "download,request", on_download_request, app);
evas_object_smart_callback_add(app->browser, "load,error", on_error, app);
evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);