Skip to content

libkcups/PrinterModel: Refactor display hints logic

Mike Noe requested to merge work/noee/display-hints into master

The model has two display hint properties: location display and printers only. This MR combines the logic into a single function that handles setting both hints and signalling to consumers. Also, define an explicit signal for the printers only hint.

Additionally, this seems to fix a rare case that causes system settings to crash. Before this, if there are least two printers configured and one printer group configured, deleting the printer group from the CUPS web interface sometimes crashes system settings. The plasmoid uses the same model and generally the same qml components for the display hints (listview section and location text) but does not crash.

There is no bug report and AFAICT, this has never been reported, but I found this crash while testing some CUPS v3 stuff. This could be a candidate to cherry-pick if the crash is ever reported.

Testing

Set up two printers and one printer group, with both printers as members. Leave system settings running.

Switch to a browser and navigate to localhost:631 and remove the printer group (CUPS calls it a Class).

Systemsettings should not crash. If the model contains printers only, there should be no listview section headers and if printers have distinct locations, they should display. If all printers have the same location or no location, locations will not display.

Edited by Mike Noe

Merge request reports

Loading