Fix status bar message for registered command and tab list

Fix empty title with "restore on demand"
import/tags/kmeleon75
boisso 7 years ago
parent 586190bffa
commit 3f9afb45f6
  1. 11
      k-meleon/BrowserFrm.cpp
  2. 18
      k-meleon/BrowserFrmTab.cpp
  3. 1
      k-meleon/BrowserFrmTab.h
  4. 16
      k-meleon/BrowserView.cpp
  5. 12
      k-meleon/KmCommand.cpp
  6. 2
      k-meleon/KmCommand.h

@ -1875,6 +1875,17 @@ void CBrowserFrame::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu)
if (GetActiveView()->OnMenuSelect(nItemID, nFlags, hSysMenu))
return;
if (nItemID >= WINDOW_MENU_START_ID && nItemID <= WINDOW_MENU_STOP_ID) {
POSITION pos = theApp.m_FrameWndLst.FindIndex(nItemID-WINDOW_MENU_START_ID);
if (pos) {
CBrowserFrame* pBrowserFrame = (CBrowserFrame *) theApp.m_FrameWndLst.GetAt(pos);
if (pBrowserFrame) {
UpdateStatus(pBrowserFrame->GetActiveView()->GetCurrentURI());
return;
}
}
}
CFrameWnd::OnMenuSelect(nItemID, nFlags, hSysMenu);
}

@ -47,7 +47,7 @@ public:
void SetBrowserTitle(LPCTSTR aTitle)
{
CBrowserGlue::SetBrowserTitle(aTitle);
if (!theApp.preferences.GetBool("kmeleon.tabs.useLoadingTitle", FALSE))
if (!theApp.preferences.GetBool("kmeleon.tabs.useLoadingTitle", FALSE) || !mLoading)
((CBrowserFrmTab*)mpBrowserFrame)->SetTabTitle((CBrowserTab*)mpBrowserView, aTitle);
}
@ -134,6 +134,7 @@ BEGIN_MESSAGE_MAP(CBrowserFrmTab, CBrowserFrame)
// ON_MESSAGE(UWM_GETFAVICON, OnGetFavIcon)
ON_WM_KEYDOWN()
ON_WM_SYSCOMMAND()
ON_WM_MENUSELECT()
END_MESSAGE_MAP()
BOOL CBrowserFrmTab::OnToolTipText(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
@ -751,6 +752,19 @@ void CBrowserFrmTab::OnShowFindBar()
m_wndTabs->UpdateVisibility(); // Ugly hack
}
void CBrowserFrmTab::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
if (nItemID >= TABS_START_ID && nItemID <= TABS_STOP_ID) {
CBrowserTab* tab = (CBrowserTab*)m_Tabs[IDTOTABINDEX(nItemID)];
if (tab) {
UpdateStatus(tab->GetCurrentURI());
return;
}
}
CBrowserFrame::OnMenuSelect(nItemID, nFlags, hSysMenu);
}
/**********************************************/
CBrowserTab::CBrowserTab() : CBrowserView()
@ -944,4 +958,4 @@ void CBrowserFrmTab::AllowJS(BOOL allow)
if (m_Tabs[i])
m_Tabs[i]->GetBrowserWrapper()->AllowJS(allow);
}
}
}

@ -186,6 +186,7 @@ protected:
public: // Temporary
afx_msg void OnNewTab();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu);
};

@ -410,6 +410,12 @@ void CBrowserView::OnNavHome()
void CBrowserView::_OnNavReload(BOOL force)
{
if (GetBrowserGlue()->mHIndex>=0) {
GetBrowserWrapper()->GotoHistoryIndex(GetBrowserGlue()->mHIndex);
GetBrowserGlue()->mHIndex = -1;
return;
}
// If there is no URI to reload, load the address in the url bar
CString url = m_pWindow->GetURI();
if (url.IsEmpty() || url.Compare(_T("about:blank")) == 0)
@ -418,7 +424,7 @@ void CBrowserView::_OnNavReload(BOOL force)
if (!url.IsEmpty())
OpenURL(url);
}
else
else
m_pWindow->Reload(force);
}
@ -1098,9 +1104,9 @@ bool CBrowserView::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu)
return true;
}
CString desc;// = theApp.commands.GetDescription(nItemID); // TODO
if (desc.GetLength()>0) {
mpBrowserFrame->UpdateStatus(desc);
KmCommand* cmd = theApp.commands.GetCommand(nItemID);
if (cmd && cmd->GetDesc().GetLength()>0) {
mpBrowserFrame->UpdateStatus(theApp.lang.Translate(cmd->GetDesc()));
return true;
}
@ -1126,4 +1132,4 @@ void CBrowserView::OnEnableJS()
void CBrowserView::OnDisableJS()
{
m_pWindow->AllowJS(FALSE);
}
}

@ -89,6 +89,18 @@ UINT KmCmdService::GetList(kmeleonCommand* cmdList, UINT size, BOOL def)
return i;
}
KmCommand* KmCmdService::GetCommand(UINT id)
{
CCmdMap::CPair* pCurVal = mCommandList.PGetFirstAssoc();
while (pCurVal != NULL) {
if (pCurVal->value.id == id) {
return &pCurVal->value;
}
pCurVal = mCommandList.PGetNextAssoc(pCurVal);
}
return nullptr;
}
bool KmCmdService::GetCommand(LPCTSTR command, KmCommand& kcommand)
{
return mCommandList.Lookup(command, kcommand);

@ -153,7 +153,7 @@ public:
}
UINT GetId(LPCTSTR command);
bool GetCommand(UINT id, KmCommand&);
KmCommand* GetCommand(UINT id);
bool GetCommand(LPCTSTR command, KmCommand&);
CString GetDescription(LPCTSTR command);

Loading…
Cancel
Save