Commit Graph

63 Commits

Author SHA1 Message Date
Sune Vuorela
b4a95259e2 Remove some unused parts of FilePrinter 2023-12-13 10:27:13 +00:00
Sune Vuorela
c94d47b07f Fix a qprinter deprecation warning
Co-Authored-By: Carl Schwan <carl@carlschwan.eu>
2023-12-07 11:46:59 +00:00
Jeremy Whiting
4ae7d68857 Fix more Qt deprecations.
Mostly QPrinter::Orientation -> QPageLayout::Orientation and
a few things about sizes.
2023-08-10 23:12:39 +00:00
Volker Krause
50d0703ae0 Enable readability-braces-around-statements 2022-03-09 23:29:56 +01:00
Albert Astals Cid
a2576dc746 Act on core/ TODOs that are not binary compatible
I'm going to need to break binary compatibility to add a new feature
so may as well cleanup all the TODOs regarding that

Changes:
 * Moving a few destructors to the header
 * Removing a few unnecessary & in params
 * Adding a few necessary & in params
 * Making print return an enum instead of a bool and then having another
   function that returns the enum
 * Make Generator::requestFontData be a virtual
 * Remove unused enum
 * Remove a few filePrinter unneeded functions
 * Remove unused TextDocumentGenerator::addMetaData signal
2021-12-29 09:35:25 +00:00
Alexander Lohnau
2f193a63de Convert license headers to SPDX 2021-06-10 08:11:56 +00:00
Laurent Montel
486e05b270 If include is define in .h remove it if it's defined in .cpp too (scripted) 2020-10-23 07:32:28 +02:00
Albert Astals Cid
19d98d6a74 Run clang-format
find . \( -name "*.cpp" -or -name "*.h"  -or -name "*.c"  -or -name "*.cc" \) -exec clang-format -i {} \;

If you reached this file doing a git blame, please see README.clang-format (added 2 commits in the future of this one)
2020-07-11 09:17:33 +02:00
Albert Astals Cid
b558f7f762 Changes to make clang not mess up the clazy comment 2020-07-11 07:51:27 +02:00
Albert Astals Cid
93540ac16d Enable most of clazy level2 2020-02-21 14:57:48 +01:00
Albert Astals Cid
2e46cf22f5 CI: enable clang tidy performance checks 2020-01-02 14:27:11 +01:00
Laurent Montel
cb691f70dc Fix some clazy warning
Summary: fix clazy warning

Reviewers: aacid

Reviewed By: aacid

Subscribers: nicolasfella, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D20832
2019-05-27 08:02:57 +02:00
Michael Weghorn
748884b4c7 PDF: Implement scaling options for non-rasterized printing
Summary:
This adds another 'FilePrinter::printFile' method that
accepts an additional parameter to specify whether or not to
do scaling and passes the 'fit-to-page' to CUPS dependent
on what is specified.

If FilePrinter is used, The PDF generator now passes this
option depending on the scaling mode that was selected in the
custom print options widget, which is therefore now enabled
for non-rasterized printing as well.

Test Plan:
1) open a PDF document in Okular and open the print dialog
2) go to the "PDF Options" tab
3) verify that "Force rasterisation" is disabled, but the
  "Scale mode" combobox is active.
4) test all the three options available in the "Scale mode"
   combobox do what they say
5) Make sure the three options still work as expected for
   the "Force rasterisation" case.

Reviewers: #okular, ngraham, sander

Reviewed By: ngraham

Subscribers: aacid, fvogt, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D18179
2019-04-14 21:11:36 -06:00
Michael Weghorn
8bf1a91175 Add option to ignore print margins for non-PDF generators
Summary:
This adds a combobox in the print dialog of the non-PDF
generators to allow selecting whether or not to take
print margins into account.

For the PDF case and rasterized printing, new print otions have
been implemented in commit 2e97d58750
already, which adds an additional option to do no scaling at all.

For consistency reasons, the same terms also used for the PDF
case are used in the combobox (i.e. the two of the three that
apply).

This adds a new abstract class 'PrintOptionsWidget' with a
'ignorePrintMargins()' method to indicate whether print margins
should be ignored or not, and a default implementation.
The existing widget for the PDF generator now derives from this
class.

In order to avoid an ABI breakage, the return value of
'Document::printConfigurationWidget' is left as a 'QWidget *'
and a dynamic_cast is done on use.

FilePrinter is adapted to take into account the value set by
'QPrinter::setFullPage()' and the margin options
are now passed accordingly (either the values set in the dialog or '0').

A big thanks to Albert Astals Cid <aacid@kde.org> for showing how
to extend the initial implementation to cover more generators.

Test Plan:
1) Open a PostScript file in Okular (using a document size that matches
  a paper size available on the printer used later makes it easier
  to see things behave as expected)

2) open print dialog, go to "Print options" and notice that there is a new
  "Scale mode" combobox whose value is set to "Fit to printable area"
   by default.

3) don't change any options, print to a printer that has hardware margins

Expected result: the document is scaled to the printable area (e.g.
scaled down so that the printer's hardware margins remain empty) as it
has been without this change.

4) Set the value of the "Print Options" -> "Scale mode" combobox to
   "Fit to full page" and print again

Expected result: The document is scaled to the full page size, i.e. ignoring
the printer's hardware margins.

5) Try steps 1-4 with other document formats supported by Okular and
   observe that they behave the same (except for the PDF case, where
   there's a combobox with three options that has been implemented
   independent of this change).

Reviewers: #okular, ngraham

Reviewed By: ngraham

Subscribers: fvogt, rkflx, arthurpeters, ltoscano, okular-devel, aacid, ngraham

Tags: #okular

Differential Revision: https://phabricator.kde.org/D10974
2019-04-03 08:00:35 -06:00
Yuri Chornoivan
c04ca1fa96 Fix minor EBN issues 2018-08-31 12:23:45 +03:00
Albert Astals Cid
0919ad87d1 Fix width and height being switched when printing Custom size
BUGS: 383734
2017-08-21 00:09:27 +02:00
Oliver Sander
5fdbecf446 Simplify method FilePrinter::psPaperSize
The method FilePrinter::psPaperSize used to contain a long
list of hard-coded paper sizes for the different paper formats.
This patch makes the method get the same information
from QPrinter directly, which is much simpler and more
robust, too.

Note that the method is not actually used anywhere in okular,
though, so this change is purely cosmetic.

REVIEW: 130043
2017-07-05 20:37:36 +02:00
Albert Vaca
c71f308252 Fixes suggested by Clazy 2016-10-29 16:33:05 +02:00
Olivier CHURLAUD
33122dd825 Uncomment printing option pdf2ps 2016-07-21 20:33:04 +02:00
Martin T. H. Sandsmark
f05d42eac3 core: Fix build without implicit cast to/from ascii
See previous commits for details.
2016-07-11 22:07:57 +02:00
Krzysztof Pyrkosz
14c936ea1b Fix for CUPS printing
Okular was checking for Q_WS_X11 definition (which is not available since Qt 5) to detect CUPS, so detection always fails making CUPS parameters ignored.

REVIEW: 127036
2016-02-16 01:27:29 +01:00
Montel Laurent
466eb79615 Use QStringLiteral 2015-10-29 13:37:11 +01:00
Alex Richardson
e608908961 Remove check for Qt < 4.7
Useless as we currently require at least 5.2
2015-08-19 15:14:29 +01:00
Montel Laurent
c50c3d5332 kdelibs4support-- 2015-03-06 14:00:25 +01:00
Montel Laurent
08013f87d0 Port to QStandardPaths 2014-10-07 13:21:58 +02:00
Frederik Gladhorn
6c602bf0e7 Use categorized logging even more 2014-09-16 23:38:25 +02:00
Frederik Gladhorn
9d89739972 Use categorized logging 2014-09-16 23:24:36 +02:00
Frederik Gladhorn
83d3f1f6b7 Revert "Some more kDebug->qDebug"
Seems like kDebug doesn't spam the user, so this needs to use qCDebug.

This reverts commit 34fbdf8c85.
2014-09-11 02:03:46 +02:00
Frederik Gladhorn
34fbdf8c85 Some more kDebug->qDebug 2014-09-09 18:17:36 +02:00
Frederik Gladhorn
51e5589e71 Phonon fix, good bye klocalsocket 2014-08-09 21:29:06 +02:00
Frederik Gladhorn
c7e003d7bc Port to QCommandLineParser 2014-08-09 13:27:12 +02:00
Frederik Gladhorn
4efd432537 Disable PostScript printing 2014-08-09 00:26:26 +02:00
Frederik Gladhorn
4f196da176 Include more kde4support 2014-08-08 23:48:20 +02:00
Frederik Gladhorn
75031eee7e Fix includes 2014-08-08 01:59:55 +02:00
Jan Kundrát
677e0660fa Remove unused arguments
REVIEW: 114958
2014-01-11 00:25:09 +01:00
Albert Astals Cid
88e4bbbbf5 Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12 2013-12-15 23:47:27 +01:00
Albert Astals Cid
5dfffec650 Make sure string passed to -J is no more than 255 bytes
lpr refuses to print referencing http://tools.ietf.org/search/rfc2911#section-4.1.2
Unfortunately cutting at 255 bytes may mess up the end of the name, but oh well
BUGS: 326617
FIXED-IN: 4.11.5
2013-12-15 23:46:27 +01:00
Albert Astals Cid
5a1afc51e3 Pass down to lpr the printer margins
This makes automagically work the printing on printers with
hard-margins since the QPrinter dialog margins are initialized to the printer
hard-margins. If you still want the old and mostly unuseful
behaviour of not having any margin (and thus your printer not printing things on the borders) you
can always set the margins to 0 in the dialog

BUGS: 319476
FIXED-IN: 4.12.0
2013-10-29 21:25:54 +01:00
Yuri Chornoivan
3b73357d2f Fix some typos found by Krazy2 2013-06-24 13:46:16 +03:00
Albert Astals Cid
42c03e2139 Merge remote-tracking branch 'origin/KDE/4.9' 2012-10-10 23:18:56 +02:00
Albert Astals Cid
1525dea87d Fix printing contiguous selected pages with bookmarks
BUGS: 308200
FIXED-IN: 4.9.3
2012-10-10 23:17:17 +02:00
Albert Astals Cid
a716b3e4e0 kill all the deprecated functions now that we've change ABI anyway 2012-09-06 19:10:03 +02:00
Albert Astals Cid
d3ebf089c4 Do not rely on extension but on output format for conversion
BUGS: 277801
2011-08-11 16:17:24 +01:00
Kevin Kofler
e001fbab55 Fix landscape documents getting printed in portrait format if "Landscape" is selected in the print dialog (the default).
Partly based on a patch by Falk from KDE bug #181290.

BUG: 181290
REVIEW: 101513
2011-07-28 01:41:48 +02:00
John Layt
80a04bd577 Whoops! Didn't relise we had an API/BIC guarantee on Okular. Restore previous
API and make it call the new API.

CCMAIL: kde-bindings@kde.org
CCMAIL: aacid@kde.org
CCBUG: 194586


svn path=/trunk/KDE/kdegraphics/okular/; revision=1134631
2010-06-04 19:04:05 +00:00
John Layt
b30305b668 Enable Current Page option in Okular print dialog if running Qt >= 4.7
Changed exported api so cc: to bindings.
CCMAIL: kde-bindings@kde.org

CCBUG: 194586


svn path=/trunk/KDE/kdegraphics/okular/; revision=1134379
2010-06-04 08:25:25 +00:00
Luigi Toscano
2bacaf9e14 New method to get the proper PrintError from the printFile* return value
svn path=/trunk/KDE/kdegraphics/okular/; revision=1115578
2010-04-16 21:56:16 +00:00
Albert Astals Cid
ce41955ab8 avoid copying a file if we can just rename it
svn path=/trunk/KDE/kdegraphics/okular/; revision=1114913
2010-04-14 21:38:40 +00:00
Glen Kaukola
122fab0eee Krazy: Check single-char QString operations for efficiency.
svn path=/trunk/KDE/kdegraphics/okular/; revision=1110335
2010-04-02 19:07:36 +00:00
John Layt
9122f0db26 Improve CUPS detection to always match Qt, including if remote CUPS server
svn path=/trunk/KDE/kdegraphics/okular/; revision=1088926
2010-02-11 22:48:06 +00:00