2
* This file is part of Checkbox
4
* Copyright 2013 Canonical Ltd.
7
* - Julia Segal <julia.segal@cellsoftware.co.uk>
8
* - Andrew Haigh <andrew.haigh@cellsoftware.co.uk>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; version 3.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
import Ubuntu.Components 0.1
26
import Ubuntu.Components.ListItems 0.1 as ListItem
34
title: i18n.tr("Suite Selection")
48
width: parent.width - units.gu(4)
50
height: parent.height - filler.height - okbutton.height - units.gu(6)
52
horizontalCenter: parent.horizontalCenter
61
contentHeight: units.gu(12) * whiteListModel.count
64
boundsBehavior : Flickable.StopAtBounds
67
delegate: SuiteSelectionDelegate{}
71
Component.onCompleted: {
72
// First uncheck all the suites
73
for (var i = whiteListModel.count - 1; i >= 0; i--){
74
var item = whiteListModel.get(i);
75
whiteListModel.setProperty(i, "check", false);
77
// Select only the one(s) matching the 'default' pattern
78
for (var i = whiteListModel.count - 1; i >= 0; i--){
79
var item = whiteListModel.get(i);
80
if (item.testname.match(/default/i)) {
81
whiteListModel.setProperty(i, "check", true);
89
flickableItem: testselection
90
align: Qt.AlignTrailing
93
// At least one whitelist MUST be selected
94
function ensure_one_selection() {
95
var one_selection = false;
97
for (var i = whiteListModel.count - 1; i >= 0; i--){
98
var item = whiteListModel.get(i);
100
if (item.check === "true") {
101
one_selection = true;
105
// If nothing is selected, disable the ok button
106
okbutton.enabled = one_selection
111
id: suite_sel_activity
115
anchors.horizontalCenter: suitelist.horizontalCenter
116
anchors.verticalCenter: suitelist.verticalCenter
121
width: parent.width - units.gu(4)
123
horizontalCenter:parent.horizontalCenter
124
bottom: parent.bottom
129
color: UbuntuColors.lightAubergine
131
// Ensure we only ask the service about this once (Bug 1209284)
132
okbutton.enabled = false;
134
suite_sel_activity.running = true;
136
suitelist.visible = false;
138
/* Now, we should go run the guiengine update to run the local jobs
139
which happen to match the whitelist. Then we can collect the
140
test jobs and show them to the user.
142
guiEngine.RunLocalJobs();
148
onLocalJobsCompleted: {
149
suite_sel_activity.running = false;
151
// Now, we should repopulate the testlistmodel...
152
testitemFactory.CreateTestListModel(testListModel);
153
// NOTE: When the user is done, this is where to load up the TestSelection list
154
mainView.state = "TESTSELECTION"