mshtml: Move Exec(OLECMDID_SETTITLE) call to separated function and use it in on_timer.

This commit is contained in:
Jacek Caban 2007-06-10 11:39:39 +02:00 committed by Alexandre Julliard
parent d8e518eb68
commit 20d77432a2
4 changed files with 34 additions and 12 deletions

View File

@ -388,6 +388,7 @@ extern const cmdtable_t editmode_cmds[];
#define UPDATE_TITLE 0x0002 #define UPDATE_TITLE 0x0002
void update_doc(HTMLDocument *This, DWORD flags); void update_doc(HTMLDocument *This, DWORD flags);
void update_title(HTMLDocument*);
/* editor */ /* editor */
void set_ns_editmode(NSContainer*); void set_ns_editmode(NSContainer*);

View File

@ -153,6 +153,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
This->readystate = READYSTATE_LOADING; This->readystate = READYSTATE_LOADING;
call_property_onchanged(This->cp_propnotif, DISPID_READYSTATE); call_property_onchanged(This->cp_propnotif, DISPID_READYSTATE);
update_doc(This, UPDATE_TITLE);
HTMLDocument_LockContainer(This, TRUE); HTMLDocument_LockContainer(This, TRUE);

View File

@ -155,6 +155,8 @@ static void set_parsecomplete(HTMLDocument *doc)
IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL); IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL); IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL);
IOleCommandTarget_Release(olecmd);
} }
doc->readystate = READYSTATE_COMPLETE; doc->readystate = READYSTATE_COMPLETE;
@ -165,18 +167,7 @@ static void set_parsecomplete(HTMLDocument *doc)
IOleInPlaceFrame_SetStatusText(doc->frame, wszDone); IOleInPlaceFrame_SetStatusText(doc->frame, wszDone);
} }
if(olecmd) { update_title(doc);
VARIANT title;
WCHAR empty[] = {0};
V_VT(&title) = VT_BSTR;
V_BSTR(&title) = SysAllocString(empty);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER,
&title, NULL);
SysFreeString(V_BSTR(&title));
IOleCommandTarget_Release(olecmd);
}
} }
static void set_progress(HTMLDocument *doc) static void set_progress(HTMLDocument *doc)

View File

@ -104,6 +104,34 @@ void update_doc(HTMLDocument *This, DWORD flags)
This->update |= flags; This->update |= flags;
} }
void update_title(HTMLDocument *This)
{
IOleCommandTarget *olecmd;
HRESULT hres;
if(!(This->update & UPDATE_TITLE))
return;
This->update &= ~UPDATE_TITLE;
if(!This->client)
return;
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) {
VARIANT title;
WCHAR empty[] = {0};
V_VT(&title) = VT_BSTR;
V_BSTR(&title) = SysAllocString(empty);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER,
&title, NULL);
SysFreeString(V_BSTR(&title));
IOleCommandTarget_Release(olecmd);
}
}
static LRESULT on_timer(HTMLDocument *This) static LRESULT on_timer(HTMLDocument *This)
{ {
TRACE("(%p) %x\n", This, This->update); TRACE("(%p) %x\n", This, This->update);
@ -131,6 +159,7 @@ static LRESULT on_timer(HTMLDocument *This)
} }
} }
update_title(This);
This->update = 0; This->update = 0;
return 0; return 0;
} }