https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e694e247204f85b759081…
commit e694e247204f85b7590813bb81acb77eb7d357e4
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jan 10 11:36:30 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jan 10 11:36:30 2024 +0900
[RAPPS] Don't download database at startup if appwiz mode (#6319)
Providing quick access of Control
Panel "Add/Remove Programs".
JIRA issue: CORE-19419
- Don't download the database if
bAppwizMode in ParseCmdAndExecute
function.
- Add CAppDB::GetAvailableCount method.
- Add CMainWindow::CheckAvailable method.
- Use CMainWindow::CheckAvailable in
some cases of TVN_SELCHANGED handling.
---
base/applications/rapps/gui.cpp | 49 +++++++++++++++++++++------------
base/applications/rapps/include/appdb.h | 5 ++++
base/applications/rapps/include/gui.h | 5 +++-
base/applications/rapps/unattended.cpp | 17 ++++--------
4 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index 3283c71ef79..d0b518967df 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -293,6 +293,16 @@ CMainWindow::UninstallSelectedApp(BOOL bModify)
return InstalledApp->UninstallApplication(bModify);
}
+VOID
+CMainWindow::CheckAvailable()
+{
+ if (m_Db->GetAvailableCount() == 0)
+ {
+ m_Db->RemoveCached();
+ m_Db->UpdateAvailable();
+ }
+}
+
BOOL
CMainWindow::ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam,
LRESULT &theResult, DWORD dwMapId)
{
@@ -346,71 +356,71 @@ CMainWindow::ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM
wParam, LPARAM lPa
break;
case IDS_AVAILABLEFORINST:
- UpdateApplicationsList(ENUM_ALL_AVAILABLE);
+ UpdateApplicationsList(ENUM_ALL_AVAILABLE, FALSE, TRUE);
break;
case IDS_CAT_AUDIO:
- UpdateApplicationsList(ENUM_CAT_AUDIO);
+ UpdateApplicationsList(ENUM_CAT_AUDIO, FALSE, TRUE);
break;
case IDS_CAT_DEVEL:
- UpdateApplicationsList(ENUM_CAT_DEVEL);
+ UpdateApplicationsList(ENUM_CAT_DEVEL, FALSE, TRUE);
break;
case IDS_CAT_DRIVERS:
- UpdateApplicationsList(ENUM_CAT_DRIVERS);
+ UpdateApplicationsList(ENUM_CAT_DRIVERS, FALSE, TRUE);
break;
case IDS_CAT_EDU:
- UpdateApplicationsList(ENUM_CAT_EDU);
+ UpdateApplicationsList(ENUM_CAT_EDU, FALSE, TRUE);
break;
case IDS_CAT_ENGINEER:
- UpdateApplicationsList(ENUM_CAT_ENGINEER);
+ UpdateApplicationsList(ENUM_CAT_ENGINEER, FALSE, TRUE);
break;
case IDS_CAT_FINANCE:
- UpdateApplicationsList(ENUM_CAT_FINANCE);
+ UpdateApplicationsList(ENUM_CAT_FINANCE, FALSE, TRUE);
break;
case IDS_CAT_GAMES:
- UpdateApplicationsList(ENUM_CAT_GAMES);
+ UpdateApplicationsList(ENUM_CAT_GAMES, FALSE, TRUE);
break;
case IDS_CAT_GRAPHICS:
- UpdateApplicationsList(ENUM_CAT_GRAPHICS);
+ UpdateApplicationsList(ENUM_CAT_GRAPHICS, FALSE, TRUE);
break;
case IDS_CAT_INTERNET:
- UpdateApplicationsList(ENUM_CAT_INTERNET);
+ UpdateApplicationsList(ENUM_CAT_INTERNET, FALSE, TRUE);
break;
case IDS_CAT_LIBS:
- UpdateApplicationsList(ENUM_CAT_LIBS);
+ UpdateApplicationsList(ENUM_CAT_LIBS, FALSE, TRUE);
break;
case IDS_CAT_OFFICE:
- UpdateApplicationsList(ENUM_CAT_OFFICE);
+ UpdateApplicationsList(ENUM_CAT_OFFICE, FALSE, TRUE);
break;
case IDS_CAT_OTHER:
- UpdateApplicationsList(ENUM_CAT_OTHER);
+ UpdateApplicationsList(ENUM_CAT_OTHER, FALSE, TRUE);
break;
case IDS_CAT_SCIENCE:
- UpdateApplicationsList(ENUM_CAT_SCIENCE);
+ UpdateApplicationsList(ENUM_CAT_SCIENCE, FALSE, TRUE);
break;
case IDS_CAT_TOOLS:
- UpdateApplicationsList(ENUM_CAT_TOOLS);
+ UpdateApplicationsList(ENUM_CAT_TOOLS, FALSE, TRUE);
break;
case IDS_CAT_VIDEO:
- UpdateApplicationsList(ENUM_CAT_VIDEO);
+ UpdateApplicationsList(ENUM_CAT_VIDEO, FALSE, TRUE);
break;
case IDS_CAT_THEMES:
- UpdateApplicationsList(ENUM_CAT_THEMES);
+ UpdateApplicationsList(ENUM_CAT_THEMES, FALSE, TRUE);
break;
case IDS_SELECTEDFORINST:
@@ -591,10 +601,13 @@ CMainWindow::AddApplicationsToView(CAtlList<CAppInfo *>
&List)
}
VOID
-CMainWindow::UpdateApplicationsList(AppsCategories EnumType, BOOL bReload)
+CMainWindow::UpdateApplicationsList(AppsCategories EnumType, BOOL bReload, BOOL
bCheckAvailable)
{
bUpdating = TRUE;
+ if (bCheckAvailable)
+ CheckAvailable();
+
if (SelectedEnumType != EnumType)
SelectedEnumType = EnumType;
diff --git a/base/applications/rapps/include/appdb.h
b/base/applications/rapps/include/appdb.h
index 4e9c5386b3b..1f6bf531a35 100644
--- a/base/applications/rapps/include/appdb.h
+++ b/base/applications/rapps/include/appdb.h
@@ -32,4 +32,9 @@ class CAppDB
BOOL
RemoveInstalledAppFromRegistry(const CAppInfo *Info);
+
+ size_t GetAvailableCount() const
+ {
+ return m_Available.GetCount();
+ }
};
diff --git a/base/applications/rapps/include/gui.h
b/base/applications/rapps/include/gui.h
index e81b4eb8227..cf6fc90859a 100644
--- a/base/applications/rapps/include/gui.h
+++ b/base/applications/rapps/include/gui.h
@@ -90,6 +90,9 @@ class CMainWindow : public CWindowImpl<CMainWindow, CWindow,
CFrameWinTraits>
VOID
OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam);
+ VOID
+ CheckAvailable();
+
BOOL
RemoveSelectedAppFromRegistry();
BOOL
@@ -105,7 +108,7 @@ class CMainWindow : public CWindowImpl<CMainWindow, CWindow,
CFrameWinTraits>
UpdateStatusBarText();
VOID
- UpdateApplicationsList(AppsCategories EnumType, BOOL bReload = FALSE);
+ UpdateApplicationsList(AppsCategories EnumType, BOOL bReload = FALSE, BOOL
bCheckAvailable = FALSE);
VOID
AddApplicationsToView(CAtlList<CAppInfo *> &List);
diff --git a/base/applications/rapps/unattended.cpp
b/base/applications/rapps/unattended.cpp
index 1525e4b07b9..ab6aaec676e 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -222,27 +222,22 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
{
INT argc;
LPWSTR *argv = CommandLineToArgvW(lpCmdLine, &argc);
- BOOL bAppwizMode = FALSE;
-
if (!argv)
- {
return FALSE;
- }
CStringW Directory;
GetStorageDirectory(Directory);
CAppDB db(Directory);
- if (argc > 1 && MatchCmdOption(argv[1], CMD_KEY_APPWIZ))
+ BOOL bAppwizMode = (argc > 1 && MatchCmdOption(argv[1], CMD_KEY_APPWIZ));
+ if (!bAppwizMode)
{
- bAppwizMode = TRUE;
- }
+ if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch)
+ db.RemoveCached();
- if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch)
- {
- db.RemoveCached();
+ db.UpdateAvailable();
}
- db.UpdateAvailable();
+
db.UpdateInstalled();
if (argc == 1 || bAppwizMode) // RAPPS is launched without options or APPWIZ mode is
requested