Add legacy 'Connect over Network' button back

This commit is contained in:
ChrisTerBeke 2019-08-12 01:19:41 +02:00
parent d703e48007
commit e977cdd431
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
7 changed files with 131 additions and 140 deletions

View file

@ -23,37 +23,13 @@ Cura.MachineAction
function connectToPrinter()
{
if(base.selectedDevice && base.completeProperties)
if (base.selectedDevice && base.completeProperties)
{
var printerKey = base.selectedDevice.key
var printerName = base.selectedDevice.name // TODO To change when the groups have a name
if (manager.getStoredKey() != printerKey)
{
// Check if there is another instance with the same key
if (!manager.existsKey(printerKey))
{
manager.associateActiveMachineWithPrinterDevice(base.selectedDevice)
manager.setGroupName(printerName) // TODO To change when the groups have a name
completed()
}
else
{
existingConnectionDialog.open()
}
}
manager.associateActiveMachineWithPrinterDevice(base.selectedDevice)
completed()
}
}
MessageDialog
{
id: existingConnectionDialog
title: catalog.i18nc("@window:title", "Existing Connection")
icon: StandardIcon.Information
text: catalog.i18nc("@message:text", "This printer/group is already added to Cura. Please select another printer/group.")
standardButtons: StandardButton.Ok
modality: Qt.ApplicationModal
}
Column
{
anchors.fill: parent;
@ -151,21 +127,6 @@ Cura.MachineAction
{
id: listview
model: manager.foundDevices
onModelChanged:
{
var selectedKey = manager.getLastManualEntryKey()
// If there is no last manual entry key, then we select the stored key (if any)
if (selectedKey == "")
selectedKey = manager.getStoredKey()
for(var i = 0; i < model.length; i++) {
if(model[i].key == selectedKey)
{
currentIndex = i;
return
}
}
currentIndex = -1;
}
width: parent.width
currentIndex: -1
onCurrentIndexChanged: