Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to clear queue #163

Merged
merged 15 commits into from
Jun 28, 2022
Merged

Add button to clear queue #163

merged 15 commits into from
Jun 28, 2022

Conversation

jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Jun 3, 2022

Partially addresses #40 in conjunction with #161

At present the button purges all jobs without confirmation. Design input needed as to whether confirmation needed or whether should only clear completed jobs etc.

Should the Clear button be separated from the Print Test Page button?

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jun 4, 2022

Screenshot from 2022-06-03 15 01 43

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we should probably have a confirmation dialog here since this is a potential accidental data loss situation

We should probably place the button in an actionbar in the list frame so that it's more clearly associated with the list and also so it doesn't show when we switch pages to page setup, etc

@jeremypw
Copy link
Collaborator Author

@danrabbit I think there is a separate queue for each printer destination (I'll check) so in that case we need to decide whether the button clears the queue for the printer page it is on - or all queues. This will affect its appropriate location.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jun 17, 2022

Yes, each printer page has its own queue and at the moment the button on that page clears only the queue for that printer. So it seems reasonable for the button to be close to the queue it is going to clear. The action will be made clearer by having a confirmation dialog.

If desired a button "Clear all Printer Queues" could be added to the Printer List action bar (when there are > 1 printer)

@jeremypw
Copy link
Collaborator Author

I have added a confirmation dialog now. I have also filtered the job list so that only pending and completed jobs are listed - this is so the "Clear" button removes all visible jobs.

@jeremypw
Copy link
Collaborator Author

Note that at present, the CUPS server keeps a list of cancelled jobs so clearing the queue is more of practical use than to completely protect privacy.

@jeremypw
Copy link
Collaborator Author

It is noted that there is a commandline function cancel -ax that purges all jobs and removes the associated data but this function does not appear to be exposed by "org.opensuse.CupsPkHelper.Mechanism" or cups.vapi?

@jeremypw
Copy link
Collaborator Author

It is also noted that the job status does not update in the list (i.e. a job appears to be pending even when it is completed unless you restart the switchboard) - I'll fix that in a separate PR if I can.

@jeremypw jeremypw requested a review from danirabbit June 17, 2022 15:33
@jeremypw jeremypw mentioned this pull request Jun 18, 2022
2 tasks
@danirabbit
Copy link
Member

Sorry for taking a while to review this! I just realized today I could test the queue by creating a print-to-file printer. Can you resolve conflicts here?

# Conflicts fixed in:
#	src/Objects/Job.vala
@jeremypw
Copy link
Collaborator Author

@danrabbit Conflicts resolved.

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this no longer shows pending jobs. So for example I'm unable to resume a job that was paused

Screenshot of the suggested changes to dialog:
Screenshot from 2022-06-27 09 42 13

src/Views/JobsView.vala Outdated Show resolved Hide resolved
src/Dialogs/ClearQueueDialog.vala Outdated Show resolved Hide resolved
src/Dialogs/ClearQueueDialog.vala Outdated Show resolved Hide resolved
src/Dialogs/ClearQueueDialog.vala Outdated Show resolved Hide resolved
src/Dialogs/ClearQueueDialog.vala Outdated Show resolved Hide resolved
Jeremy Wootten and others added 2 commits June 28, 2022 08:31
@jeremypw
Copy link
Collaborator Author

@danrabbit Thanks for the review. I have committed your suggestions. I cannot reproduce your issue with pause/resume though. I can pauses and resume a pending job (creating by printing a test page to an unplugged printer) without problem. I can also clear such jobs.

I did notice another issue with the action revealer which hides when a second job is started after a pending one, but that is present in master. I'll try and fix it in another PR.

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the source of the issue and left an inline comment. To reproduce, start and then pause a job. Close and reopen System Settings. You'll notice the paused job is gone.

src/Views/JobsView.vala Outdated Show resolved Hide resolved
Comment on lines 35 to 41
public bool canceled_or_aborted {
get {
return (state == CUPS.IPP.JobState.CANCELED) ||
(state == CUPS.IPP.JobState.ABORTED);
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed as well right?

Suggested change
public bool canceled_or_aborted {
get {
return (state == CUPS.IPP.JobState.CANCELED) ||
(state == CUPS.IPP.JobState.ABORTED);
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Done

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jun 28, 2022

I have now removed that filter. I still think that maybe cancelled and aborted jobs should be listed separately from successfully completed jobs but that is outside the scope of this PR.

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🎉

@danirabbit danirabbit enabled auto-merge (squash) June 28, 2022 19:17
@danirabbit danirabbit merged commit 6d07941 into master Jun 28, 2022
@danirabbit danirabbit deleted the clear-queue branch June 28, 2022 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants