Sending prints to a specific printer in the cluster is now possible again

CL-541
This commit is contained in:
Jaime van Kessel 2018-01-04 14:56:42 +01:00
parent 8a7105dd9c
commit c9b8b0333c
2 changed files with 46 additions and 22 deletions

View file

@ -20,8 +20,24 @@ UM.Dialog
visible: true
modality: Qt.ApplicationModal
onVisibleChanged:
{
if(visible)
{
resetPrintersModel()
}
}
title: catalog.i18nc("@title:window", "Print over network")
title: catalog.i18nc("@title:window","Print over network")
property var printersModel: ListModel{}
function resetPrintersModel() {
printersModel.append({ name: "Automatic", key: ""})
for (var index in OutputDevice.printers)
{
printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key})
}
}
Column
{
@ -31,8 +47,7 @@ UM.Dialog
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.rightMargin: UM.Theme.getSize("default_margin").width
height: 50 * screenScaleFactor
height: 50 * screenScaleFactord
Label
{
id: manualPrinterSelectionLabel
@ -42,7 +57,7 @@ UM.Dialog
topMargin: UM.Theme.getSize("default_margin").height
right: parent.right
}
text: "Printer selection"
text: catalog.i18nc("@label", "Printer selection")
wrapMode: Text.Wrap
height: 20 * screenScaleFactor
}
@ -50,18 +65,12 @@ UM.Dialog
ComboBox
{
id: printerSelectionCombobox
model: OutputDevice.printers
textRole: "friendly_name"
model: base.printersModel
textRole: "name"
width: parent.width
height: 40 * screenScaleFactor
Behavior on height { NumberAnimation { duration: 100 } }
onActivated:
{
var printerData = OutputDevice.printers[index];
OutputDevice.selectPrinter(printerData.unique_name, printerData.friendly_name);
}
}
SystemPalette
@ -79,8 +88,6 @@ UM.Dialog
enabled: true
onClicked: {
base.visible = false;
// reset to defaults
OutputDevice.selectAutomaticPrinter()
printerSelectionCombobox.currentIndex = 0
}
}
@ -93,9 +100,8 @@ UM.Dialog
enabled: true
onClicked: {
base.visible = false;
OutputDevice.sendPrintJob();
OutputDevice.sendPrintJob(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key)
// reset to defaults
OutputDevice.selectAutomaticPrinter()
printerSelectionCombobox.currentIndex = 0
}
}