Warning, /plasma/print-manager/src/plasmoid/package/contents/ui/PrinterDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2012-2013 Daniel Nicoletti <dantti12@gmail.com>
0003     SPDX-FileCopyrightText: 2014-2015 Jan Grulich <jgrulich@redhat.com>
0004     SPDX-FileCopyrightText: 2020 Nate Graham <nate@kde.org>
0005     SPDX-FileCopyrightText: 2023 Mike Noe <noeerover@gmail.com>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 import QtQuick
0011 import org.kde.plasma.extras as PlasmaExtras
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.plasma.printmanager as PrintManager
0014 
0015 PlasmaExtras.ExpandableListItem {
0016     readonly property bool isPaused: model.printerState === 5
0017 
0018     icon: model.iconName
0019     iconEmblem: isPaused ? "emblem-pause" : ""
0020     title: model.info + (model.location && printersModel.displayLocationHint
0021             ? " (%1)".arg(model.location)
0022             : "")
0023     subtitle: model.stateMessage
0024     isDefault: model.isDefault
0025 
0026     defaultActionButtonAction: Kirigami.Action {
0027         icon.name: isPaused ? "media-playback-start" : "media-playback-pause"
0028         text: isPaused ? i18n("Resume") : i18n("Pause")
0029 
0030         onTriggered: {
0031             if (isPaused) {
0032                 printersModel.resumePrinter(model.printerName);
0033             } else {
0034                 printersModel.pausePrinter(model.printerName);
0035             }
0036         }
0037     }
0038 
0039     contextualActions: [
0040         Kirigami.Action {
0041             icon.name: "configure"
0042             text: i18n("Configure printer…")
0043             onTriggered: PrintManager.ProcessRunner.configurePrinter(model.printerName);
0044         },
0045         Kirigami.Action {
0046             icon.name: "view-list-details"
0047             text: i18n("View print queue…")
0048             onTriggered: PrintManager.ProcessRunner.openPrintQueue(model.printerName);
0049         }
0050     ]
0051 }