From 4ada7607ae57b2875d806f2eb43c29980a478739 Mon Sep 17 00:00:00 2001
From: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Date: Wed, 29 May 2019 12:23:57 +0300
Subject: [PATCH] Update documentation for Component Selection Page

Repository categories introduced in IFW 3.1 can cause behavior changes
in older automation scripts that use component selection methods.
Update documentation to include new items on Component Selection Page
and provide an example code for fetching components from a category.

Task-number: QTIFW-1354
Change-Id: Icf93d1325563d3bdf6a38799ab260b13f4078a81
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
---
 doc/noninteractive.qdoc | 53 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/doc/noninteractive.qdoc b/doc/noninteractive.qdoc
index 887b32ad..67ce18dc 100644
--- a/doc/noninteractive.qdoc
+++ b/doc/noninteractive.qdoc
@@ -330,8 +330,61 @@
         \row
             \li \c ResetComponentsButton
             \li Resets to already installed components.
+
+        \row
+            \li \c FetchCategoryButton
+            \li Fetch components from a category.
     \endtable
 
+    \table
+        \header
+        \li Widgets
+        \li Brief Description
+
+        \row
+            \li \c CategoryGroupBox
+            \li Contains checkboxes for selecting repository categories.
+    \endtable
+
+    Installer Framework 3.1 introduces repository categories as a new feature. When
+    you use an installer that contains repository categories, you can select a category
+    by its display name, fetch its contents, and then select the included components for installation.
+
+    You can fetch the components from a category as follows:
+    \code
+    Controller.prototype.ComponentSelectionPageCallback = function()
+    {
+        var page = gui.pageWidgetByObjectName("ComponentSelectionPage");
+
+        // if CategoryGroupBox is visible, check one of the checkboxes
+        // and click fetch button before selecting any components
+        var groupBox = gui.findChild(page, "CategoryGroupBox");
+        if (groupBox) {
+            console.log("groupBox found");
+            // findChild second argument is the display name of the checkbox
+            var checkBox = gui.findChild(page, "Archive");
+            if (checkBox) {
+                console.log("checkBox found");
+                console.log("checkBox name: " + checkBox.text);
+                if (checkBox.checked == false) {
+                    checkBox.click();
+                    var fetchButton = gui.findChild(page, "FetchCategoryButton");
+                    if (fetchButton) {
+                        console.log("fetchButton found");
+                        fetchButton.click();
+                    } else {
+                        console.log("fetchButton NOT found");
+                    }
+                }
+            } else {
+                console.log("checkBox NOT found");
+            }
+        } else {
+            console.log("groupBox NOT found");
+        }
+        // you can now select components from the fetched category
+    }
+    \endcode
 
     \section2 Start Menu Directory Page