Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RAPPS] Refreshing the Installed list should read everything from the registry #5676

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions base/applications/rapps/appview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,39 @@ CApplicationView::AppendTabOrderWindow(int Direction, ATL::CSimpleArray<HWND> &T
m_AppsInfo->AppendTabOrderWindow(Direction, TabOrderList);
}

VOID
CApplicationView::GetRestoreListSelectionData(LVITEMW &Item, WCHAR *Name, UINT NameLen)
{
Item.mask = LVIF_TEXT|LVIF_STATE;
Item.iItem = -1, Item.iSubItem = 0;
Item.stateMask = LVIS_FOCUSED|LVIS_SELECTED;
Item.pszText = Name, Item.cchTextMax = NameLen;

HWND hList = m_ListView ? m_ListView->m_hWnd : NULL;
learn-more marked this conversation as resolved.
Show resolved Hide resolved
if (hList)
{
Item.iItem = ListView_GetNextItem(hList, -1, LVNI_FOCUSED);
ListView_GetItem(hList, &Item);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the convenience functions from the m_Listview itself?
stuff like m_ListView->GetItemData etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a MFC guy I guess.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

VOID
CApplicationView::RestoreListSelection(const LVITEMW &Item)
{
int index = Item.iItem;
if (index != -1) // Was there a selected item?
{
LVFINDINFOW fi;
fi.flags = LVFI_STRING;
fi.psz = Item.pszText;
index = ListView_FindItem(m_ListView->m_hWnd, -1, &fi);
}
if (index != -1) // Is it still in the list?
{
ListView_SetItemState(m_ListView->m_hWnd, index, Item.state, Item.stateMask);
}
}

// this function is called when a item of listview get focus.
// CallbackParam is the param passed to listview when adding the item (the one getting focus now).
VOID
Expand Down
8 changes: 7 additions & 1 deletion base/applications/rapps/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ CMainWindow::OnCommand(WPARAM wParam, LPARAM lParam)
break;

case ID_REFRESH:
UpdateApplicationsList(SelectedEnumType);
UpdateApplicationsList(SelectedEnumType, bReload);
break;

case ID_RESETDB:
Expand Down Expand Up @@ -600,6 +600,10 @@ CMainWindow::UpdateApplicationsList(AppsCategories EnumType, BOOL bReload)
if (SelectedEnumType != EnumType)
SelectedEnumType = EnumType;

LVITEMW selitem;
WCHAR selitembuf[MAX_PATH];
whindsaks marked this conversation as resolved.
Show resolved Hide resolved
m_ApplicationView->GetRestoreListSelectionData(selitem, selitembuf, _countof(selitembuf));

if (bReload)
m_Selected.RemoveAll();

Expand Down Expand Up @@ -640,6 +644,8 @@ CMainWindow::UpdateApplicationsList(AppsCategories EnumType, BOOL bReload)
{
ATLASSERT(0 && "This should be unreachable!");
}

m_ApplicationView->RestoreListSelection(selitem);
m_ApplicationView->SetRedraw(TRUE);
m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
UpdateStatusBarText();
Expand Down
5 changes: 5 additions & 0 deletions base/applications/rapps/include/appview.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ class CApplicationView : public CUiWindow<CWindowImpl<CApplicationView>>
VOID
AppendTabOrderWindow(int Direction, ATL::CSimpleArray<HWND> &TabOrderList);

VOID
GetRestoreListSelectionData(LVITEMW &Item, WCHAR *Name, UINT NameLen);
VOID
RestoreListSelection(const LVITEMW &Item);

// this function is called when a item of listview get focus.
// CallbackParam is the param passed to listview when adding the item (the one getting focus now).
VOID
Expand Down