Bug 318998 - Add option to exit after printing
Summary: Add option to exit after printing
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 0.16.60
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2013-04-27 23:05 UTC by Kai Uwe Broulik
Modified: 2018-03-03 16:34 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch to add --print_and_exit (4.73 KB, patch)
2013-05-16 14:21 UTC, Clayton Gerstner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Uwe Broulik 2013-04-27 23:05:15 UTC
With current master you can run okular with the parameter --print to directly open the print mode. When acknowledging the dialog, however, Okular stays open, making this option not really useful for cmdline batch processing or a Dolphin service menu. There should be an option to have Okular exit once the dialog closed.

Reproducible: Always
Comment 1 Albert Astals Cid 2013-05-06 18:09:11 UTC
I'd probably go with a --print_and_exit since adding a --exit param makes no sense :D
Comment 2 Clayton Gerstner 2013-05-16 14:21:12 UTC
Created attachment 79914 [details]
Patch to add --print_and_exit

Here's a patch to add --print_and_exit to okular. It is perhaps overly simple. Because batch processing was specifically mentioned it doesn't open the window with print dialog, it simply prints and exits (with exit status guessed via Part::doPrint(), again for batch processing/scriptability) though that would obviously be trivial to change.

Anyway, it worked the one time I tested it connected to a printer. :)
Comment 3 Albert Astals Cid 2013-05-16 18:16:03 UTC
Hi Clayton, could you please use reviewboard.kde.org for the patches? It's much easier to keep track of them and comment there than here in bugzilla.

Thanks!
Comment 4 Albert Astals Cid 2013-08-12 18:44:39 UTC
Clayton?
Comment 5 Albert Astals Cid 2013-08-12 18:45:34 UTC
And that's why one has to use reviewboard, because you leave a comment here and you don't add yourself to the cc's so you ignore my answers...

Please Clayton, read up.
Comment 6 Swarn Avinash Kumar 2014-03-04 03:18:23 UTC
is this bug open? can I solve this bug?
Comment 7 Albert Astals Cid 2014-03-04 19:17:06 UTC
> is this bug open? 
Have you tried?
Comment 8 Abhyudaya 2014-09-22 14:19:16 UTC
I would like to solve this bug. Where do I start?
Comment 9 Albert Astals Cid 2014-09-22 14:27:35 UTC
Have you compiled okular already?
Comment 10 Abhyudaya 2014-09-22 14:28:31 UTC
No. where do I get the project to get started with?
Comment 11 Albert Astals Cid 2014-09-22 14:54:40 UTC
http://lmgtfy.com/?q=okular+source+code
Comment 12 Abhyudaya 2014-09-22 15:08:57 UTC
I installed it, how do i compile it?
Comment 13 Albert Astals Cid 2014-09-22 15:13:55 UTC
Spend a few hours trying to answer the question for yourself and if you really can't find the answer come back and ask again.
Comment 14 Abhyudaya 2014-09-23 19:01:30 UTC
I installed kde4 and got a copy of okular. I'm following the steps given here https://okular.kde.org/download.php and i'm stuck at this command 
cmake -DCMAKE_INSTALL_PREFIX=/path/to/your/kde4/install/dir
I can't seem to figure out the path to the kde4 installation, I've tried searching a lot (http://askubuntu.com/questions/527492/kde4-config-shows-no-output/527512?iemail=1&noredirect=1#527512) but couldn't find anything
Comment 15 Albert Astals Cid 2014-09-23 19:41:11 UTC
/path/to/your/kde4/install/dir is whatever path you want.
Comment 16 Abhyudaya 2014-09-24 09:00:41 UTC
Thank you for patiently helping, I apologize for the newbie questions. I've compiled and installed the copy of okular. How should I proceed further?
Comment 17 Albert Astals Cid 2014-09-24 09:55:21 UTC
Have you tried doing anything at all before asking for what to do?

Anyway the bug even has a patch attached and you are not even asking about it, are you not curious about it? 

Maybe someone should actually read all the comments of the bug and attach it to reviewboard as I asked?
Comment 18 Abhyudaya 2014-09-24 10:16:12 UTC
Sorry this is the first time I'm trying to fix bugs so I don't have an idea about anything. I did look into the path but didn't really understand anything and after reading the comments i thought the bug hasn't been resolved yet so asked about how to go about resolving it.
Comment 19 Albert Astals Cid 2014-09-24 21:53:06 UTC
So, i'm going what you need to do, you need to read okular code and produce a patch that does what the bug says. From here it's your work, you need to put 99.999% of the time, and then if you have a very specific question, you drop by our IRC client or our mailing list and ask it. If you want to reuse the existing patch or not is your choice. And I hope you don't do the same mistake Clayton did.
Comment 20 Ronnie.P.Thomas 2015-03-30 19:17:24 UTC
I'd like to have a go at this bug...

I've compiled the program, but I think that the shell/okular file is using the okularpart from my distribution's okular package. So, how can I make okular load the 'okularpart' which was compiled with it? Do I need to install it in /usr/local? I would prefer installing it some directory in my $HOME though..
Comment 21 Albert Astals Cid 2015-03-30 19:39:22 UTC
read http://okular.kde.org/download.php
Comment 22 Ronnie.P.Thomas 2015-03-31 05:40:01 UTC
Ah.. right, I should have read the manual. Thank you!
Comment 23 Dileep Sankhla 2018-02-01 17:01:46 UTC
What does the issue actually mean - adding an option to automatically exit with the exit code and message after acknowledging the print dialog when launched with --print parameter or adding a separate parameter option as --print_and_exit that do the same? Or is it something different? Confuse between improving an existing parameter or adding a new parameter for the same.
Comment 24 Albert Astals Cid 2018-02-01 19:46:16 UTC
What comment #1 says, so add --print_and_exit
Comment 25 Dileep Sankhla 2018-02-01 20:00:33 UTC
Thank you. One more thing, should it opens the print dialog and then exit on printing or should it be non-GUI that simply prints and exits? 
If the latter case, should it print the exit code?
Comment 26 Albert Astals Cid 2018-02-01 20:07:48 UTC
You need to show the gui, how will you select the printer, if you want black and white or not, etc if you don't?
Comment 27 Albert Astals Cid 2018-03-03 16:34:55 UTC
Git commit 09b7b079ac92bd1da7bac6b04e2bed139506f2f8 by Albert Astals Cid, on behalf of Dileep Sankhla.
Committed on 03/03/2018 at 16:36.
Pushed by aacid into branch 'master'.

Option to exit after printing

Summary:
When running okular with the parameter --print to directly open the print mode, it doesn't exit after acknowledging the print dialog. Hence adding --print_and_exit option exits Okular after acknowledging the print dialog and thus is useful for the command line batch processing or a Dolphin service as the issue suggests.

Test Plan:
1. open a file in Okular using the parameter --print. It will open Okular in print mode with the print dialog
2. Either print the file or cancel the print dialog
3. You will find that Okular stays open
4. Now using this patch, see for available options with the --help parameter. You will find --print_and_exit option
5. Now open a file in Okular using the parameter --print_and_exit. It will open Okular in print mode with the print dialog
6. Either print the file or cancel the print dialog
7. You will find that Okular closes after acknowledging the dialog

Reviewers: aacid, #okular, ngraham

Subscribers: ltoscano, ngraham, aacid, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D10249

M  +11   -11   autotests/mainshelltest.cpp
M  +19   -4    part.cpp
M  +3    -1    part.h
M  +1    -0    shell/main.cpp
M  +2    -0    shell/shell.cpp
M  +22   -13   shell/shellutils.cpp
M  +3    -2    shell/shellutils.h

https://commits.kde.org/okular/09b7b079ac92bd1da7bac6b04e2bed139506f2f8