https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ff1fa4f38ab9424891eb350e57268b755a1b0d48

commit ff1fa4f38ab9424891eb350e57268b755a1b0d48
Author:     Stanislav Motylkov <[email protected]>
AuthorDate: Mon May 22 01:34:02 2023 +0300
Commit:     Stanislav Motylkov <[email protected]>
CommitDate: Sat May 27 15:36:53 2023 +0300

    [RAPPS] Add /APPWIZ command-line key to open "Installed" section
    
    Addendum to ab7ddc44. CORE-18981
---
 base/applications/rapps/gui.cpp              |  4 ++--
 base/applications/rapps/include/gui.h        |  3 ++-
 base/applications/rapps/include/unattended.h |  1 +
 base/applications/rapps/unattended.cpp       | 10 ++++++++--
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index 2d5eb7e098a..9073b7bf957 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -82,7 +82,7 @@ CSideTreeView::~CSideTreeView()
 
 // **** 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->Expand(hRootItemInstalled, TVE_EXPAND);
     m_TreeView->Expand(hRootItemAvailable, TVE_EXPAND);
-    m_TreeView->SelectItem(hRootItemAvailable);
+    m_TreeView->SelectItem(bAppwizMode ? hRootItemInstalled : 
hRootItemAvailable);
 }
 
 BOOL
diff --git a/base/applications/rapps/include/gui.h 
b/base/applications/rapps/include/gui.h
index ee136f48133..07a07356475 100644
--- a/base/applications/rapps/include/gui.h
+++ b/base/applications/rapps/include/gui.h
@@ -57,12 +57,13 @@ class CMainWindow : public CWindowImpl<CMainWindow, 
CWindow, CFrameWinTraits>
     CAtlList<CAppInfo *> m_Selected;
 
     BOOL bUpdating = FALSE;
+    BOOL bAppwizMode;
 
     CStringW szSearchPattern;
     AppsCategories SelectedEnumType;
 
   public:
-    CMainWindow(CAppDB *db);
+    explicit CMainWindow(CAppDB *db, BOOL bAppwiz = FALSE);
 
     ~CMainWindow();
 
diff --git a/base/applications/rapps/include/unattended.h 
b/base/applications/rapps/include/unattended.h
index 83aa2e06b9f..8eaaf93c244 100644
--- a/base/applications/rapps/include/unattended.h
+++ b/base/applications/rapps/include/unattended.h
@@ -1,5 +1,6 @@
 #pragma once
 
+#define CMD_KEY_APPWIZ L"APPWIZ"
 #define CMD_KEY_INSTALL L"INSTALL"
 #define CMD_KEY_SETUP L"SETUP"
 #define CMD_KEY_FIND L"FIND"
diff --git a/base/applications/rapps/unattended.cpp 
b/base/applications/rapps/unattended.cpp
index 9a5fa2a3fa5..a8a21d698aa 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -222,6 +222,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, 
int nCmdShow)
 {
     INT argc;
     LPWSTR *argv = CommandLineToArgvW(lpCmdLine, &argc);
+    BOOL bAppwizMode = FALSE;
 
     if (!argv)
     {
@@ -232,6 +233,11 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, 
int nCmdShow)
     GetStorageDirectory(Directory);
     CAppDB db(Directory);
 
+    if (argc > 1 && MatchCmdOption(argv[1], CMD_KEY_APPWIZ))
+    {
+        bAppwizMode = TRUE;
+    }
+
     if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch)
     {
         db.RemoveCached();
@@ -239,7 +245,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, 
int nCmdShow)
     db.UpdateAvailable();
     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
         HANDLE hMutex;
@@ -256,7 +262,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, 
int nCmdShow)
             return FALSE;
         }
 
-        CMainWindow wnd(&db);
+        CMainWindow wnd(&db, bAppwizMode);
         MainWindowLoop(&wnd, nCmdShow);
 
         if (hMutex)

Reply via email to