diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-02-25 11:50:48 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-03-12 07:54:50 +0000 |
commit | d98e8e8b62c90ee867e8f25fabca4f3adeeacbea (patch) | |
tree | 22a48482d17addd7aa786191f711acda8c7770fa /examples | |
parent | 3c7b8025e0db7607ee6ca718a3faf6ddfc677a51 (diff) |
Perform headless commands without GUI dependency
Task-number: QTIFW-1633
Change-Id: I207cd152a471fddd51c152223460f8a9873f4382
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'examples')
2 files changed, 15 insertions, 11 deletions
diff --git a/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs index e644afbe6..2cd5e8728 100644 --- a/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs +++ b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the FOO module of the Qt Toolkit. @@ -52,8 +52,8 @@ Component.prototype.installationFinished = function() { try { if (installer.isInstaller() && installer.status == QInstaller.Success) { - var isReadMeCheckBoxChecked = component.userInterface( "ReadMeCheckBoxForm" ).readMeCheckBox.checked; - if (isReadMeCheckBoxChecked) { + var checkboxForm = component.userInterface( "ReadMeCheckBoxForm" ); + if (checkboxForm && checkboxForm.readMeCheckBox.checked) { QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/README.txt"); } } diff --git a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs index a5a6bb174..aa3fa3a67 100644 --- a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs +++ b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the FOO module of the Qt Toolkit. @@ -49,9 +49,10 @@ addRegisterFileCheckBox = function() { // don't show when updating or uninstalling if (installer.isInstaller()) { - installer.addWizardPageItem(component, "RegisterFileCheckBoxForm", QInstaller.TargetDirectory); - component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.text = - component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.text + component.unusualFileType; + if (installer.addWizardPageItem(component, "RegisterFileCheckBoxForm", QInstaller.TargetDirectory)) { + component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.text = + component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.text + component.unusualFileType; + } } } @@ -61,7 +62,9 @@ Component.prototype.createOperations = function() // call default implementation to actually install the registeredfile component.createOperations(); - var isRegisterFileChecked = component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.checked; + if (component.userInterface("RegisterFileCheckBoxForm")) { + var isRegisterFileChecked = component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.checked; + } if (installer.value("os") === "win") { var iconId = 0; var notepadPath = installer.environmentVariable("SystemRoot") + "\\notepad.exe"; @@ -93,8 +96,9 @@ openRegisteredFileIfChecked = function() addOpenFileCheckBoxToFinishPage = function() { if (installer.isInstaller() && installer.status == QInstaller.Success) { - installer.addWizardPageItem(component, "OpenFileCheckBoxForm", QInstaller.InstallationFinished); - component.userInterface("OpenFileCheckBoxForm").OpenRegisteredFileCheckBox.text = - component.userInterface("OpenFileCheckBoxForm").OpenRegisteredFileCheckBox.text + component.unusualFileType; + if (installer.addWizardPageItem(component, "OpenFileCheckBoxForm", QInstaller.InstallationFinished)) { + component.userInterface("OpenFileCheckBoxForm").OpenRegisteredFileCheckBox.text = + component.userInterface("OpenFileCheckBoxForm").OpenRegisteredFileCheckBox.text + component.unusualFileType; + } } } |