1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

fix(printers): fix add by address with manually entered host

port 1.5
This commit is contained in:
bbedward
2026-07-12 18:27:51 -04:00
parent eaecff93a4
commit 75443758f9
+16 -3
View File
@@ -28,6 +28,16 @@ Item {
property string newPrinterInfo: "" property string newPrinterInfo: ""
property var suggestedPPDs: [] property var suggestedPPDs: []
readonly property string effectiveDeviceUri: {
if (selectedDeviceUri)
return selectedDeviceUri;
if (!manualEntryMode || !manualHost)
return "";
const port = parseInt(manualPort) || 631;
const path = manualProtocol === "ipp" || manualProtocol === "ipps" ? "/ipp/print" : "";
return `${manualProtocol}://${manualHost}:${port}${path}`;
}
function resetAddPrinterForm() { function resetAddPrinterForm() {
manualEntryMode = false; manualEntryMode = false;
manualHost = ""; manualHost = "";
@@ -512,6 +522,7 @@ Item {
text: printerTab.manualHost text: printerTab.manualHost
onTextEdited: { onTextEdited: {
printerTab.manualHost = text; printerTab.manualHost = text;
printerTab.selectedDeviceUri = "";
printerTab.testConnectionResult = null; printerTab.testConnectionResult = null;
} }
} }
@@ -536,6 +547,7 @@ Item {
text: printerTab.manualPort text: printerTab.manualPort
onTextEdited: { onTextEdited: {
printerTab.manualPort = text; printerTab.manualPort = text;
printerTab.selectedDeviceUri = "";
printerTab.testConnectionResult = null; printerTab.testConnectionResult = null;
} }
} }
@@ -562,6 +574,7 @@ Item {
options: ["ipp", "ipps", "lpd", "socket"] options: ["ipp", "ipps", "lpd", "socket"]
onValueChanged: value => { onValueChanged: value => {
printerTab.manualProtocol = value; printerTab.manualProtocol = value;
printerTab.selectedDeviceUri = "";
printerTab.testConnectionResult = null; printerTab.testConnectionResult = null;
} }
} }
@@ -661,7 +674,7 @@ Item {
Row { Row {
spacing: Theme.spacingS spacing: Theme.spacingS
visible: !printerTab.testConnectionResult?.success && printerTab.testConnectionResult?.data?.error visible: !!(printerTab.testConnectionResult?.data?.error || printerTab.testConnectionResult?.error)
Item { Item {
width: 80 width: 80
@@ -820,9 +833,9 @@ Item {
text: CupsService.creatingPrinter ? I18n.tr("Creating...") : I18n.tr("Create Printer") text: CupsService.creatingPrinter ? I18n.tr("Creating...") : I18n.tr("Create Printer")
iconName: CupsService.creatingPrinter ? "sync" : "add" iconName: CupsService.creatingPrinter ? "sync" : "add"
buttonHeight: 36 buttonHeight: 36
enabled: printerTab.newPrinterName.length > 0 && printerTab.selectedDeviceUri.length > 0 && printerTab.selectedPpd.length > 0 && !CupsService.creatingPrinter enabled: printerTab.newPrinterName.length > 0 && printerTab.effectiveDeviceUri.length > 0 && printerTab.selectedPpd.length > 0 && !CupsService.creatingPrinter
onClicked: { onClicked: {
CupsService.createPrinter(printerTab.newPrinterName, printerTab.selectedDeviceUri, printerTab.selectedPpd, { CupsService.createPrinter(printerTab.newPrinterName, printerTab.effectiveDeviceUri, printerTab.selectedPpd, {
location: printerTab.newPrinterLocation, location: printerTab.newPrinterLocation,
information: printerTab.newPrinterInfo information: printerTab.newPrinterInfo
}); });