[plasma/print-manager] src: libkcups,apps: Update icon logic for printer type

Mike Noe <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 4dfb059d3f1c9dbaac53880b023cf5f68c1c0b06 by Mike Noe.
Committed on 17/07/2026 at 01:42.
Pushed by noee into branch 'master'.

libkcups,apps: Update icon logic for printer type

- Adapt kcm for model changes
- Adapt print-queue for model changes

M  +1    -1    src/kcm/ui/PrinterSettings.qml
M  +1    -3    src/kcm/ui/main.qml
M  +10   -4    src/libkcups/KCupsPrinter.cpp
M  +1    -3    src/print-queue/qml/Main.qml

https://invent.kde.org/plasma/print-manager/-/commit/4dfb059d3f1c9dbaac53880b023cf5f68c1c0b06

diff --git a/src/kcm/ui/PrinterSettings.qml b/src/kcm/ui/PrinterSettings.qml
index 89ba1b9f..b9041c7b 100644
--- a/src/kcm/ui/PrinterSettings.qml
+++ b/src/kcm/ui/PrinterSettings.qml
@@ -323,7 +323,7 @@ KCM.AbstractKCM {
             Layout.bottomMargin: Kirigami.Units.largeSpacing
 
             Kirigami.Icon {
-                source: root.modelData.isClass ? "folder-print" : root.modelData.iconName
+                source: root.modelData.iconName
                 Layout.preferredWidth: Kirigami.Units.iconSizes.enormous
                 Layout.preferredHeight: Layout.preferredWidth
             }
diff --git a/src/kcm/ui/main.qml b/src/kcm/ui/main.qml
index f1ad4344..308088fd 100644
--- a/src/kcm/ui/main.qml
+++ b/src/kcm/ui/main.qml
@@ -365,9 +365,7 @@ KCM.ScrollViewKCM {
                              ? " (%1)".arg(location)
                              : "")
                     subtitle: stateMessage
-                    icon.name: remote
-                            ? "folder-network-symbolic"
-                            : (isClass ? "folder-print" : iconName)
+                    icon.name: iconName
 
                     font.bold: list.count > 1 & isDefault
                     selected: deviceDelegate.highlighted || deviceDelegate.down
diff --git a/src/libkcups/KCupsPrinter.cpp b/src/libkcups/KCupsPrinter.cpp
index 2eee053e..1ef8f4bc 100644
--- a/src/libkcups/KCupsPrinter.cpp
+++ b/src/libkcups/KCupsPrinter.cpp
@@ -175,13 +175,19 @@ QString KCupsPrinter::iconName() const
 
 QString KCupsPrinter::iconName(cups_ptype_e type)
 {
-    // TODO get the ppd or something to get the real printer icon
+    if (type & CUPS_PRINTER_CLASS) {
+        return QStringLiteral("folder-print");
+    }
+    if (type & CUPS_PRINTER_REMOTE) {
+        return QStringLiteral("folder-network");
+    }
     if (!(type & CUPS_PRINTER_COLOR)) {
         // If the printer is not color it is probably a laser one
         return QStringLiteral("printer-laser");
-    } else if (type & CUPS_PRINTER_SCANNER) {
+    }
+    if (type & CUPS_PRINTER_SCANNER) {
         return QStringLiteral("scanner");
-    } else {
-        return QStringLiteral("printer");
     }
+
+    return QStringLiteral("printer");
 }
diff --git a/src/print-queue/qml/Main.qml b/src/print-queue/qml/Main.qml
index bde358bc..83654062 100644
--- a/src/print-queue/qml/Main.qml
+++ b/src/print-queue/qml/Main.qml
@@ -198,9 +198,7 @@ Kirigami.ApplicationWindow {
                          : "")
                 Accessible.description: titleItem.subtitle
 
-                icon.name: remote
-                        ? "folder-network-symbolic"
-                        : (isClass ? "folder-print" : iconName)
+                icon.name: iconName
                 icon.width: Kirigami.Units.iconSizes.medium
                 icon.height: Kirigami.Units.iconSizes.medium
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.