[plasma/print-manager] src/libkcups: libkcups: Refactor constructor/helpers for public use

Mike Noe <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 511a1dfb425645ed1cd63f64840f0d06065ba0ab by Mike Noe.
Committed on 21/07/2026 at 14:09.
Pushed by noee into branch 'master'.

libkcups: Refactor constructor/helpers for public use

Mostly, this allows us to use this properly for testing.

M  +5    -0    src/libkcups/KCupsPrinter.cpp
M  +3    -7    src/libkcups/KCupsPrinter.h

https://invent.kde.org/plasma/print-manager/-/commit/511a1dfb425645ed1cd63f64840f0d06065ba0ab

diff --git a/src/libkcups/KCupsPrinter.cpp b/src/libkcups/KCupsPrinter.cpp
index 3705d1b5..052659ba 100644
--- a/src/libkcups/KCupsPrinter.cpp
+++ b/src/libkcups/KCupsPrinter.cpp
@@ -171,6 +171,11 @@ void KCupsPrinter::setAttribute(const QString &key, const QVariant &value)
     }
 }
 
+void KCupsPrinter::setAttributes(const QVariantMap &attributes)
+{
+    m_attributes = attributes;
+}
+
 QString KCupsPrinter::name() const
 {
     return m_printer;
diff --git a/src/libkcups/KCupsPrinter.h b/src/libkcups/KCupsPrinter.h
index e59c93f4..4d56c6a4 100644
--- a/src/libkcups/KCupsPrinter.h
+++ b/src/libkcups/KCupsPrinter.h
@@ -22,6 +22,9 @@ public:
 
     KCupsPrinter();
     explicit KCupsPrinter(const QString &printer, bool isClass = false);
+    explicit KCupsPrinter(const QVariantMap &attributes);
+    void setAttribute(const QString &key, const QVariant &value);
+    void setAttributes(const QVariantMap &attributes);
 
     QString name() const;
     bool isClass() const;
@@ -83,14 +86,7 @@ public:
      */
     QStringList checkMarkerLevels() const;
 
-protected:
-    explicit KCupsPrinter(const QVariantMap &attributes);
-    void setAttribute(const QString &key, const QVariant &value);
-
 private:
-    friend class KCupsRequest;
-    friend class PrinterModel;
-
     QString m_printer;
     bool m_isClass;
     QVariantMap m_attributes;
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.