From e0eb980220d8fb478b2c78b7f49124fad0364111 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sat, 6 Mar 2021 16:25:08 +0100 Subject: [PATCH] Use basename of file in PrinterPage header --- qml/pages/PrinterPage.qml | 2 +- qml/pages/utils.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index 8b54c42..7f9ce90 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -66,7 +66,7 @@ Page { PageHeader { id: pageHeader title: printer.attrs["printer-name"].value - description: selectedFile + description: Utils.basename(selectedFile) } Item { diff --git a/qml/pages/utils.js b/qml/pages/utils.js index b97e0bf..c19ffa1 100644 --- a/qml/pages/utils.js +++ b/qml/pages/utils.js @@ -379,6 +379,11 @@ function unknownForEmptyString(s) } } +function basename(filewithpath) +{ + return filewithpath.substring(filewithpath.lastIndexOf("/")+1); +} + var media = {"asme_f_28x40in": "28 x 40″", "choice_iso_a4_210x297mm_na_letter_8.5x11in": "A4 or US Letter",