[plasma/print-manager/Plasma/6.6] src: [plasmoid,libkcups] Add poller for job queue when not empty
Mike Noe <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 246addd0444071a23632af3a375e641e54bd2e3e by Mike Noe.
Committed on 03/08/2026 at 14:25.
Pushed by noee into branch 'Plasma/6.6'.
[plasmoid,libkcups] Add poller for job queue when not empty
(cherry picked from commit d705315c)
M +2 -1 src/libkcups/JobModel.h
M +11 -0 src/plasmoid/main.qml
https://invent.kde.org/plasma/print-manager/-/commit/246addd0444071a23632af3a375e641e54bd2e3e
diff --git a/src/libkcups/JobModel.h b/src/libkcups/JobModel.h
index f338a248..e758a788 100644
--- a/src/libkcups/JobModel.h
+++ b/src/libkcups/JobModel.h
@@ -81,6 +81,8 @@ public:
Q_INVOKABLE void cancel(const QString &printerName, int jobId);
Q_INVOKABLE void move(const QString &printerName, int jobId, const QString &toPrinterName);
+ Q_INVOKABLE void getJobs();
+
QString processingJob() const;
Qt::ItemFlags flags(const QModelIndex &index) const override;
@@ -94,7 +96,6 @@ public:
KCupsRequest *modifyJob(int row, JobAction action, const QString &newDestName = QString(), const QModelIndex &parent = QModelIndex());
private Q_SLOTS:
- void getJobs();
void getJobFinished(KCupsRequest *request);
void jobCompleted(const QString &text,
diff --git a/src/plasmoid/main.qml b/src/plasmoid/main.qml
index 887b065e..b9c2fcb7 100644
--- a/src/plasmoid/main.qml
+++ b/src/plasmoid/main.qml
@@ -46,6 +46,17 @@ PlasmoidItem {
}
}
+ // HACK: CUPS fails to signal job queue changes at random times
+ // Start a timer to reload the queue if it's not empty
+ // When/if it goes empty, stop the timer
+ Timer {
+ interval: 10000
+ repeat: true
+ running: activeJobsFilterModel.activeCount > 0
+
+ onTriggered: jobsModel.getJobs()
+ }
+
toolTipMainText: i18n("Printers")
toolTipSubText: {
if (serverUnavailable && printersModelError) {