10

I have created a simple installer for our product with only 1 component and no remote repositories manager.

When I start the uninstaller, the introduction page shows 3 radio buttons:

  • Package manager

  • Update components

  • Remove all components

I need only the third one, so I checked this documentation:

http://doc-snapshot.qt-project.org/qtifw-master/noninteractive.html

As I have understood and being unable to hide the buttons, I added this to my install.qs file:

function Controller()
{
}

Controller.prototype.IntroductionPageCallback = function()
{
    gui.clickButton(buttons.NextButton);
}

This should auto-click Next on the introduction page so it should go directly to the uninstall page.

Nothing happens, what ever I write in the Controller functions, the introduction page shows the 3 radio buttons. I added some messagebox in the function and they are never called.

Somebody knows how to solve it ?

MBach
  • 1,647
  • 16
  • 30
marco
  • 1,686
  • 1
  • 25
  • 33

1 Answers1

8

I think I have 2 working solutions.

First solution, if you want to have a single page uninstaller:

You need to create a Controller like the one you started before:

function Controller() {
    if (installer.isUninstaller()) {
        installer.setDefaultPageVisible(QInstaller.Introduction, false);
        installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
        installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
    }
}

This will disable all pages in the classic install/uninstall workflow. Make sure to check you're in uninstall mode.

If you want a 2 pages uninstaller:

function Controller()
{

}

Controller.prototype.IntroductionPageCallback = function()
{
    if (installer.isUninstaller()) {
        // Get the current wizard page
        var widget = gui.currentPageWidget(); 
        if (widget != null) {
            // Don't show buttons because we just want to uninstall the software
            widget.findChild("PackageManagerRadioButton").visible = false;
            widget.findChild("UpdaterRadioButton").visible = false;
            widget.findChild("UninstallerRadioButton").visible = false;
        }
    }
}

Bonus

In installer mode, select by default "I accept" the Licence Agreement. Seriously, who doesn't?

Controller.prototype.LicenseAgreementPageCallback = function()
{
    var widget = gui.currentPageWidget();
    if (widget != null) {
        widget.AcceptLicenseRadioButton.checked = true;
    }
}
MBach
  • 1,647
  • 16
  • 30
  • Nope, both solutions don't work. I cannot get rid of the radiobuttons. – marco Oct 28 '15 at 08:27
  • 2
    You will have to add the script to the `config.xml` using `controlScript.qs` – Felix Dec 17 '15 at 19:26
  • 1
    Thanks a lot. Where you get the info about ui controls names? – Borzh Feb 18 '16 at 19:28
  • @MBach Where can I find reference documentation for things like `widget.findChild("UninstallerRadioButton").visible`? – KcFnMi Feb 23 '21 at 14:52
  • The `AcceptLicenseRadioButton` widget member has changed to `AcceptLicenseRadioCheckBox`. You can list all members of the widget with `console.log(Object.getOwnPropertyNames(widget))`. – Edward May 28 '21 at 13:16
  • @Edward it's not `AcceptLicenseRadioCheckBox` but `AcceptLicenseCheckBox` – Azrael3000 Dec 03 '21 at 07:34