1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
/*
* Copyright 2017 Canonical Ltd.
*
* This file is part of lomiri-printing-app.
*
* lomiri-printing-app is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* lomiri-printing-app is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored-by: Andrew Hayzen <andrew.hayzen@canonical.com>
*/
import QtQuick 2.4
import Lomiri.Components 1.3
import Lomiri.Components.ListItems 1.3 as ListItems
import Lomiri.Components.Extras.Printers 0.1
Flickable {
id: flickable
anchors {
fill: parent
}
contentHeight: column.implicitHeight
property alias filtersModel: repeaterModel.model
property QtObject queueHelper: null
Column {
id: column
anchors {
left: parent.left
right: parent.right
}
Repeater {
id: repeaterModel
delegate: Column {
anchors {
left: parent.left
right: parent.right
}
objectName: "filter" + index
visible: jobFilterRepeater.count > 0
readonly property var filter: model.filter
readonly property int outerIndex: index // used for QML tests
readonly property string outerState: model.state
ListItem {
divider {
visible: false
}
height: headerLayout.height
ListItemLayout {
id: headerLayout
padding {
bottom: units.gu(1)
top: units.gu(1)
}
title {
objectName: "filterHeaderLabel" + index
text: model.name
textSize: Label.Large
}
}
}
Repeater {
id: jobFilterRepeater
model: filter
objectName: "jobFilter" + index
delegate: QueueDelegate {
isActive: outerState === "active"
objectName: "jobFilter" + outerIndex + "delegate" + index
onCancel: {
console.debug("Cancel Job:", model.id, "for", model.printerName);
queueHelper.cancelJob(model.printerName, model.id);
}
onHold: {
console.debug("Hold Job:", model.id, "for", model.printerName);
queueHelper.holdJob(model.printerName, model.id);
}
onRelease: {
console.debug("Release Job:", model.id, "for", model.printerName);
queueHelper.releaseJob(model.printerName, model.id);
}
}
}
}
}
}
}
|