Warning, /plasma/print-manager/src/plasmoid/package/contents/ui/FullRepresentation.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: 2021 Carl Schwan <carl@carlschwan.eu>
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.plasma.components as PlasmaComponents3
0013 import org.kde.kirigami as Kirigami
0014 import org.kde.plasma.printmanager as PrintManager
0015 
0016 PlasmaExtras.Representation {
0017     collapseMarginsHint: true
0018 
0019     header: PlasmaExtras.PlasmoidHeading {
0020         PlasmaExtras.SearchField {
0021             anchors.fill: parent
0022             onAccepted: printersFilterModel.setFilterWildcard(text)
0023         }
0024     }
0025 
0026     PlasmaComponents3.ScrollView {
0027         anchors.fill: parent
0028         contentWidth: availableWidth - contentItem.leftMargin - contentItem.rightMargin
0029 
0030         contentItem: ListView {
0031             focus: true
0032             currentIndex: -1
0033 
0034             section {
0035                 property: printersModel.printersOnly ? "" : "isClass"
0036                 delegate: Kirigami.ListSectionHeader {
0037                     width: ListView.view.width
0038                     required property bool section
0039                     label: !section ? i18n("Printers") : i18n("Printer Groups")
0040                 }
0041             }
0042 
0043             model: PrintManager.PrinterSortFilterModel {
0044                 id: printersFilterModel
0045                 sourceModel: printersModel
0046                 sortRole: PrintManager.PrinterModel.DestIsClass
0047             }
0048 
0049             topMargin: Kirigami.Units.smallSpacing * 2
0050             bottomMargin: Kirigami.Units.smallSpacing * 2
0051             leftMargin: Kirigami.Units.smallSpacing * 2
0052             rightMargin: Kirigami.Units.smallSpacing * 2
0053             spacing: Kirigami.Units.smallSpacing
0054 
0055             highlight: PlasmaExtras.Highlight {}
0056             highlightMoveDuration: 0
0057             highlightResizeDuration: 0
0058             delegate: PrinterDelegate {}
0059 
0060             Loader {
0061                 anchors.centerIn: parent
0062                 width: parent.width - (Kirigami.Units.largeSpacing * 4)
0063                 active: printersFilterModel.count === 0 || serverUnavailable
0064                 sourceComponent: PlasmaExtras.PlaceholderMessage {
0065                     text: serverUnavailable ? printersModelError || i18n("No printers have been configured or discovered") : i18n("No matches")
0066                     iconName: serverUnavailable ? "dialog-error" : "edit-none"
0067                 }
0068             }
0069         }
0070     }
0071 }