-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
There was a problem hiding this 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
@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. |
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) |
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. |
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. |
It is noted that there is a commandline function |
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. |
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
@danrabbit Conflicts resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Danielle Foré <[email protected]>
@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. |
There was a problem hiding this 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/Objects/Job.vala
Outdated
public bool canceled_or_aborted { | ||
get { | ||
return (state == CUPS.IPP.JobState.CANCELED) || | ||
(state == CUPS.IPP.JobState.ABORTED); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
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?
public bool canceled_or_aborted { | |
get { | |
return (state == CUPS.IPP.JobState.CANCELED) || | |
(state == CUPS.IPP.JobState.ABORTED); | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Done
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 🎉
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?