summaryrefslogtreecommitdiffstats
path: root/examples/componenterror
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2013-08-21 13:28:16 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2013-08-22 12:07:31 +0200
commit0381020f4b59161d0a6b1f04e785e084f2758da8 (patch)
tree08f706713e5ff91d29bda6da86c06cc3c6d4bd74 /examples/componenterror
parentcb255a796995db5c47185f05c9fc2f662f3b6707 (diff)
Introduce example on how to handle component errors.
Change-Id: Idb102b8bc4a56365a4718d15856ecd96a40f952e Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'examples/componenterror')
-rw-r--r--examples/componenterror/README5
-rw-r--r--examples/componenterror/config/config.xml9
-rw-r--r--examples/componenterror/packages/root.component1/meta/installscript.js50
-rw-r--r--examples/componenterror/packages/root.component1/meta/package.xml7
-rw-r--r--examples/componenterror/packages/root.component2/meta/installscript.js50
-rw-r--r--examples/componenterror/packages/root.component2/meta/package.xml7
-rw-r--r--examples/componenterror/packages/root/meta/installscript.js76
-rw-r--r--examples/componenterror/packages/root/meta/package.xml7
8 files changed, 211 insertions, 0 deletions
diff --git a/examples/componenterror/README b/examples/componenterror/README
new file mode 100644
index 000000000..27fd4b3a4
--- /dev/null
+++ b/examples/componenterror/README
@@ -0,0 +1,5 @@
+Create an installer that shows how to react on errors set from a component.
+
+Generate installer with
+
+binarycreator --offline-only -c config/config.xml -p packages installer
diff --git a/examples/componenterror/config/config.xml b/examples/componenterror/config/config.xml
new file mode 100644
index 000000000..e16b411da
--- /dev/null
+++ b/examples/componenterror/config/config.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Installer>
+ <Name>Component error Installer Example</Name>
+ <Version>1.0.0</Version>
+ <Title>Component error Installer Example</Title>
+ <Publisher>Qt-Project</Publisher>
+ <StartMenuDir>Qt Installer Framework Example</StartMenuDir>
+ <TargetDir>@homeDir@/IFWComponentErrorInstallerExample</TargetDir>
+</Installer>
diff --git a/examples/componenterror/packages/root.component1/meta/installscript.js b/examples/componenterror/packages/root.component1/meta/installscript.js
new file mode 100644
index 000000000..6d76437b2
--- /dev/null
+++ b/examples/componenterror/packages/root.component1/meta/installscript.js
@@ -0,0 +1,50 @@
+/**************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+function Component()
+{
+ var error = true;
+ if (error) {
+ installer.setValue("component_errors", installer.value("component_errors") + ";;;"
+ + "error from component: " + component.name);
+ }
+ installer.setValue("ComponentError", true);
+}
diff --git a/examples/componenterror/packages/root.component1/meta/package.xml b/examples/componenterror/packages/root.component1/meta/package.xml
new file mode 100644
index 000000000..eac36530b
--- /dev/null
+++ b/examples/componenterror/packages/root.component1/meta/package.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<Package>
+ <DisplayName>component1</DisplayName>
+ <Version>1.0.1</Version>
+ <ReleaseDate>2013-08-21</ReleaseDate>
+ <Script>installscript.js</Script>
+</Package>
diff --git a/examples/componenterror/packages/root.component2/meta/installscript.js b/examples/componenterror/packages/root.component2/meta/installscript.js
new file mode 100644
index 000000000..6d76437b2
--- /dev/null
+++ b/examples/componenterror/packages/root.component2/meta/installscript.js
@@ -0,0 +1,50 @@
+/**************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+function Component()
+{
+ var error = true;
+ if (error) {
+ installer.setValue("component_errors", installer.value("component_errors") + ";;;"
+ + "error from component: " + component.name);
+ }
+ installer.setValue("ComponentError", true);
+}
diff --git a/examples/componenterror/packages/root.component2/meta/package.xml b/examples/componenterror/packages/root.component2/meta/package.xml
new file mode 100644
index 000000000..4caad7ad6
--- /dev/null
+++ b/examples/componenterror/packages/root.component2/meta/package.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<Package>
+ <DisplayName>component2</DisplayName>
+ <Version>1.0.1</Version>
+ <ReleaseDate>2013-08-21</ReleaseDate>
+ <Script>installscript.js</Script>
+</Package>
diff --git a/examples/componenterror/packages/root/meta/installscript.js b/examples/componenterror/packages/root/meta/installscript.js
new file mode 100644
index 000000000..e29892523
--- /dev/null
+++ b/examples/componenterror/packages/root/meta/installscript.js
@@ -0,0 +1,76 @@
+/**************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+function abortInstaller()
+{
+ installer.setDefaultPageVisible(QInstaller.Introduction, false);
+ installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
+ installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
+ installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);
+ installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
+ installer.setDefaultPageVisible(QInstaller.PerformInstallation, false);
+ installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
+
+ var abortText = "<font color='red' size=6>" + qsTr("The installation has been failed.") + "</font>";
+
+ var error_list = installer.value("component_errors").split(";;;");
+ abortText += "<ul>";
+ // ignore the first empty one
+ for (var i = 0; i < error_list.length; ++i) {
+ if (error_list[i] !== "") {
+ print(error_list[i]);
+ abortText += "<li>" + error_list[i] + "</li>"
+ }
+ }
+ abortText += "</ul>";
+ installer.setValue("FinishedText", abortText);
+}
+
+function reactOnAbortInstallerChange()
+{
+ if (installer.value("ComponentError") === "true")
+ abortInstaller();
+}
+
+function Component()
+{
+ installer.finishAllComponentsReset.connect(reactOnAbortInstallerChange);
+}
diff --git a/examples/componenterror/packages/root/meta/package.xml b/examples/componenterror/packages/root/meta/package.xml
new file mode 100644
index 000000000..ce9b55537
--- /dev/null
+++ b/examples/componenterror/packages/root/meta/package.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<Package>
+ <DisplayName>ROOT</DisplayName>
+ <Version>1.0.1</Version>
+ <ReleaseDate>2013-08-21</ReleaseDate>
+ <Script>installscript.js</Script>
+</Package>