From 03299d6c2e77fe82fd8ab997f373e8b8de57284a Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Tue, 7 Feb 2006 02:25:27 +0100 Subject: [PATCH] Add documents displayed via "What to do" dialog to globhist First the patch makes sure doc_loading_callback is always called from tp_display even if the download is in result state. This is often the case for local files that the user decides to display via the WTD dialog. Furthermore, improve the adding to globhist part of doc_loading_callback, so that it works also for downloads in result state where the download->conn member is NULL. In addition to grabbing the URI from the connection try also the cache entry if it is set. Fixes: bug 355 (Documents displayed via WTD aren't added to globhist) --- src/session/download.c | 5 +---- src/session/session.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/session/download.c b/src/session/download.c index 3b0fa81b0..bc6f732e7 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -967,10 +967,7 @@ tp_display(struct type_query *type_query) new->callback = (download_callback_T *) doc_loading_callback; new->data = ses; - if (is_in_progress_state(old->state)) - move_download(old, new, PRI_MAIN); - else - new->state = old->state; + move_download(old, new, PRI_MAIN); } display_timer(ses); diff --git a/src/session/session.c b/src/session/session.c index 9e18a02e1..37845b9eb 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -604,11 +604,19 @@ doc_loading_callback(struct download *download, struct session *ses) print_screen_status(ses); #ifdef CONFIG_GLOBHIST - if (download->conn && download->pri != PRI_CSS) { + if (download->pri != PRI_CSS) { unsigned char *title = ses->doc_view->document->title; - struct uri *uri = download->conn->proxied_uri; + struct uri *uri; - add_global_history_item(struri(uri), title, time(NULL)); + if (download->conn) + uri = download->conn->proxied_uri; + else if (download->cached) + uri = download->cached->uri; + else + uri = NULL; + + if (uri) + add_global_history_item(struri(uri), title, time(NULL)); } #endif