[RAPPS] Add /APPWIZ command-line key to open "Installed" section

Addendum to ab7ddc44. CORE-18981
This commit is contained in:
Stanislav Motylkov 2023-05-22 01:34:02 +03:00
parent d6fecc52d1
commit ff1fa4f38a
4 changed files with 13 additions and 5 deletions

View file

@ -82,7 +82,7 @@ CSideTreeView::~CSideTreeView()
// **** CMainWindow **** // **** CMainWindow ****
CMainWindow::CMainWindow(CAppDB *db) : m_ClientPanel(NULL), m_Db(db), SelectedEnumType(ENUM_ALL_INSTALLED) CMainWindow::CMainWindow(CAppDB *db, BOOL bAppwiz) : m_ClientPanel(NULL), m_Db(db), bAppwizMode(bAppwiz), SelectedEnumType(ENUM_ALL_INSTALLED)
{ {
} }
@ -123,7 +123,7 @@ CMainWindow::InitCategoriesList()
m_TreeView->SetImageList(); m_TreeView->SetImageList();
m_TreeView->Expand(hRootItemInstalled, TVE_EXPAND); m_TreeView->Expand(hRootItemInstalled, TVE_EXPAND);
m_TreeView->Expand(hRootItemAvailable, TVE_EXPAND); m_TreeView->Expand(hRootItemAvailable, TVE_EXPAND);
m_TreeView->SelectItem(hRootItemAvailable); m_TreeView->SelectItem(bAppwizMode ? hRootItemInstalled : hRootItemAvailable);
} }
BOOL BOOL

View file

@ -57,12 +57,13 @@ class CMainWindow : public CWindowImpl<CMainWindow, CWindow, CFrameWinTraits>
CAtlList<CAppInfo *> m_Selected; CAtlList<CAppInfo *> m_Selected;
BOOL bUpdating = FALSE; BOOL bUpdating = FALSE;
BOOL bAppwizMode;
CStringW szSearchPattern; CStringW szSearchPattern;
AppsCategories SelectedEnumType; AppsCategories SelectedEnumType;
public: public:
CMainWindow(CAppDB *db); explicit CMainWindow(CAppDB *db, BOOL bAppwiz = FALSE);
~CMainWindow(); ~CMainWindow();

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#define CMD_KEY_APPWIZ L"APPWIZ"
#define CMD_KEY_INSTALL L"INSTALL" #define CMD_KEY_INSTALL L"INSTALL"
#define CMD_KEY_SETUP L"SETUP" #define CMD_KEY_SETUP L"SETUP"
#define CMD_KEY_FIND L"FIND" #define CMD_KEY_FIND L"FIND"

View file

@ -222,6 +222,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
{ {
INT argc; INT argc;
LPWSTR *argv = CommandLineToArgvW(lpCmdLine, &argc); LPWSTR *argv = CommandLineToArgvW(lpCmdLine, &argc);
BOOL bAppwizMode = FALSE;
if (!argv) if (!argv)
{ {
@ -232,6 +233,11 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
GetStorageDirectory(Directory); GetStorageDirectory(Directory);
CAppDB db(Directory); CAppDB db(Directory);
if (argc > 1 && MatchCmdOption(argv[1], CMD_KEY_APPWIZ))
{
bAppwizMode = TRUE;
}
if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch) if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch)
{ {
db.RemoveCached(); db.RemoveCached();
@ -239,7 +245,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
db.UpdateAvailable(); db.UpdateAvailable();
db.UpdateInstalled(); db.UpdateInstalled();
if (argc == 1) // RAPPS is launched without options if (argc == 1 || bAppwizMode) // RAPPS is launched without options or APPWIZ mode is requested
{ {
// Check whether the RAPPS MainWindow is already launched in another process // Check whether the RAPPS MainWindow is already launched in another process
HANDLE hMutex; HANDLE hMutex;
@ -256,7 +262,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
return FALSE; return FALSE;
} }
CMainWindow wnd(&db); CMainWindow wnd(&db, bAppwizMode);
MainWindowLoop(&wnd, nCmdShow); MainWindowLoop(&wnd, nCmdShow);
if (hMutex) if (hMutex)