Index: src/plugin/PluginClass.cpp |
=================================================================== |
--- a/src/plugin/PluginClass.cpp |
+++ b/src/plugin/PluginClass.cpp |
@@ -223,10 +223,6 @@ |
((CPluginClass*)thisPtr)->Unadvice(); |
} |
- if ((((CPluginClass*)thisPtr)->m_hPaneWnd == NULL) || (!((CPluginClass*)thisPtr)->IsStatusBarEnabled())) |
- { |
- ((CPluginClass*)thisPtr)->ShowStatusBar(); |
- } |
return 0; |
} |
@@ -427,7 +423,6 @@ |
{ |
VARIANT_BOOL isVisible; |
- CPluginSettings* settings = CPluginSettings::GetInstance(); |
CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); |
if (browser) |
@@ -438,70 +433,65 @@ |
{ |
if (!isVisible) |
{ |
- if (!settings->GetStatusBarAsked()) |
Oleksandr
2013/07/22 09:04:51
Just removed this if and fixed the formatting
|
+ SHANDLE_PTR pBrowserHWnd; |
+ browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd); |
+ Dictionary* dictionary = Dictionary::GetInstance(); |
+ |
+ HKEY pHkey; |
+ HKEY pHkeySub; |
+ LSTATUS regRes = 0; |
+ regRes = RegOpenCurrentUser(KEY_WRITE, &pHkey); |
+ |
+ // Do we have enough rights to enable a status bar? |
+ if (regRes != 0) |
{ |
- SHANDLE_PTR pBrowserHWnd; |
- browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd); |
- Dictionary* dictionary = Dictionary::GetInstance(); |
- settings->SetStatusBarAsked(); |
+ // We use the tab window here and in the next few calls, since the browser window may still not be available |
+ LRESULT res = MessageBox((HWND)m_hTabWnd, |
+ dictionary->Lookup("status-bar", "error-text").c_str(), |
+ dictionary->Lookup("status-bar", "error-title").c_str(), |
+ MB_OK); |
+ return; |
+ } |
+ // Ask if a user wants to enable a status bar automatically |
+ LRESULT res = MessageBox((HWND)m_hTabWnd, |
+ dictionary->Lookup("status-bar", "question").c_str(), |
+ dictionary->Lookup("status-bar", "title").c_str(), |
+ MB_YESNO); |
+ if (res == IDYES) |
+ { |
+ DWORD trueth = 1; |
+ regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &pHkeySub); |
+ regRes = RegSetValueEx(pHkeySub, L"ShowStatusBar", 0, REG_DWORD, (BYTE*)&trueth, sizeof(DWORD)); |
+ regRes = RegCloseKey(pHkeySub); |
+ regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub); |
+ regRes = RegSetValueEx(pHkeySub, L"StatusBarWeb", 0, REG_DWORD, (BYTE*)&trueth, sizeof(DWORD)); |
+ regRes = RegCloseKey(pHkeySub); |
+ hr = browser->put_StatusBar(TRUE); |
+ if (FAILED(hr)) |
+ { |
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR, "Class::Enable statusbar"); |
+ } |
+ CreateStatusBarPane(); |
- HKEY pHkey; |
- HKEY pHkeySub; |
- LSTATUS regRes = 0; |
- regRes = RegOpenCurrentUser(KEY_WRITE, &pHkey); |
+ // We need to restart the tab now, to enable the status bar properly |
+ VARIANT vFlags; |
+ vFlags.vt = VT_I4; |
+ vFlags.intVal = navOpenInNewTab; |
- // Do we have enough rights to enable a status bar? |
- if (regRes != 0) |
+ CComBSTR curLoc; |
+ browser->get_LocationURL(&curLoc); |
+ HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); |
+ if (FAILED(hr)) |
{ |
- // We use the tab window here and in the next few calls, since the browser window may still not be available |
- LRESULT res = MessageBox((HWND)m_hTabWnd, |
- dictionary->Lookup("status-bar", "error-text").c_str(), |
- dictionary->Lookup("status-bar", "error-title").c_str(), |
- MB_OK); |
- return; |
- } |
- // Ask if a user wants to enable a status bar automatically |
- LRESULT res = MessageBox((HWND)m_hTabWnd, |
- dictionary->Lookup("status-bar", "question").c_str(), |
- dictionary->Lookup("status-bar", "title").c_str(), |
- MB_YESNO); |
- if (res == IDYES) |
- { |
- DWORD trueth = 1; |
- regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &pHkeySub); |
- regRes = RegSetValueEx(pHkeySub, L"ShowStatusBar", 0, REG_DWORD, (BYTE*)&trueth, sizeof(DWORD)); |
- regRes = RegCloseKey(pHkeySub); |
- regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub); |
- regRes = RegSetValueEx(pHkeySub, L"StatusBarWeb", 0, REG_DWORD, (BYTE*)&trueth, sizeof(DWORD)); |
- regRes = RegCloseKey(pHkeySub); |
- hr = browser->put_StatusBar(TRUE); |
+ vFlags.intVal = navOpenInNewWindow; |
+ |
+ hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); |
if (FAILED(hr)) |
{ |
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR, "Class::Enable statusbar"); |
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION, "Navigation::Failed") |
} |
- CreateStatusBarPane(); |
- |
- // We need to restart the tab now, to enable the status bar properly |
- VARIANT vFlags; |
- vFlags.vt = VT_I4; |
- vFlags.intVal = navOpenInNewTab; |
- |
- CComBSTR curLoc; |
- browser->get_LocationURL(&curLoc); |
- HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); |
- if (FAILED(hr)) |
- { |
- vFlags.intVal = navOpenInNewWindow; |
- |
- hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); |
- if (FAILED(hr)) |
- { |
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION, "Navigation::Failed") |
- } |
- } |
- browser->Quit(); |
- |
} |
+ browser->Quit(); |
} |
} |
} |
@@ -825,6 +815,11 @@ |
if (CPluginClient::GetInstance()->IsFirstRun()) |
{ |
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThread, NULL, NULL, NULL); |
+ if ((m_hPaneWnd == NULL) || (!IsStatusBarEnabled())) |
+ { |
+ ShowStatusBar(); |
+ } |
+ |
} |
CPluginSettings* settings = CPluginSettings::GetInstance(); |