Commit 402c8756 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved OLECMDID_SETDOWNLOADSTATE call to separated function.

parent e325be79
......@@ -692,6 +692,7 @@ void set_current_mon(HTMLWindow*,IMoniker*) DECLSPEC_HIDDEN;
HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
void abort_document_bindings(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN;
......
......@@ -184,6 +184,7 @@ static nsresult NSAPI handle_keypress(nsIDOMEventListener *iface,
static void handle_docobj_load(HTMLDocumentObj *doc)
{
IOleCommandTarget *olecmd = NULL;
HRESULT hres;
if(doc->nscontainer->editor_controller) {
......@@ -195,33 +196,31 @@ static void handle_docobj_load(HTMLDocumentObj *doc)
handle_edit_load(&doc->basedoc);
if(doc->client) {
IOleCommandTarget *olecmd = NULL;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) {
if(doc->download_state) {
VARIANT state, progress;
V_VT(&progress) = VT_I4;
V_I4(&progress) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS,
OLECMDEXECOPT_DONTPROMPTUSER, &progress, NULL);
V_VT(&state) = VT_I4;
V_I4(&state) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
OLECMDEXECOPT_DONTPROMPTUSER, &state, NULL);
}
IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 103, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL);
IOleCommandTarget_Release(olecmd);
if(FAILED(hres))
olecmd = NULL;
}
if(doc->download_state) {
if(olecmd) {
VARIANT progress;
V_VT(&progress) = VT_I4;
V_I4(&progress) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS,
OLECMDEXECOPT_DONTPROMPTUSER, &progress, NULL);
}
set_download_state(doc, 0);
}
doc->download_state = 0;
if(olecmd) {
IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 103, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL);
IOleCommandTarget_Release(olecmd);
}
}
static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event)
......
......@@ -94,6 +94,28 @@ void set_current_mon(HTMLWindow *This, IMoniker *mon)
set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
}
void set_download_state(HTMLDocumentObj *doc, int state)
{
if(doc->client) {
IOleCommandTarget *olecmd;
HRESULT hres;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) {
VARIANT var;
V_VT(&var) = VT_I4;
V_I4(&var) = state;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
IOleCommandTarget_Release(olecmd);
}
}
doc->download_state = state;
}
static void set_progress_proc(task_t *_task)
{
docobj_task_t *task = (docobj_task_t*)_task;
......@@ -139,7 +161,6 @@ static void set_downloading_proc(task_t *_task)
{
download_proc_task_t *task = (download_proc_task_t*)_task;
HTMLDocumentObj *doc = task->doc;
IOleCommandTarget *olecmd;
HRESULT hres;
TRACE("(%p)\n", doc);
......@@ -147,25 +168,12 @@ static void set_downloading_proc(task_t *_task)
set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url);
CoTaskMemFree(task->url);
if(task->set_download)
set_download_state(doc, 1);
if(!doc->client)
return;
if(task->set_download) {
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) {
VARIANT var;
V_VT(&var) = VT_I4;
V_I4(&var) = 1;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
IOleCommandTarget_Release(olecmd);
}
doc->download_state = 1;
}
if(doc->view_sink)
IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment