[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde4support] tier3/kprintutils: Initial import from the monolithic kdelibs.
From:       Jenkins CI <null () kde ! org>
Date:       2014-02-28 13:11:50
Message-ID: E1WJNEE-0002gJ-39 () scm ! kde ! org
[Download RAW message or body]

Git commit d129617756153ac361fd38e62f553fa1db36fa48 by Jenkins CI.
Committed on 18/12/2013 at 00:45.
Pushed by alexmerry into branch 'master'.

Initial import from the monolithic kdelibs.

This is the beginning of revision history for this module. If you
want to look at revision history older than this, please refer to the
techbase wiki for how to use Git history grafting. At the time of
writing, this wiki is located here:

http://community.kde.org/Frameworks/GitOldHistory

If you have already performed the grafting and you don't see any
history beyond this commit, try running "git log" with the "--follow"
argument.

Branched from the monolithic repo, kdelibs frameworks branch, at commit
162066dbbecde401a7347a1cff4fe72a9c919f58

A  +75   -0    tier3/kprintutils/CMakeLists.txt
A  +510  -0    tier3/kprintutils/COPYING.LIB
A  +11   -0    tier3/kprintutils/KF5PrintUtilsConfig.cmake.in
A  +1    -0    tier3/kprintutils/Mainpage.dox
A  +55   -0    tier3/kprintutils/src/CMakeLists.txt
A  +1    -0    tier3/kprintutils/src/config-kprintutils.h.cmake
A  +140  -0    tier3/kprintutils/src/kcupsoptionsjobwidget_p.h     [License: LGPL (v2+)]
A  +100  -0    tier3/kprintutils/src/kcupsoptionspageswidget.ui
A  +122  -0    tier3/kprintutils/src/kcupsoptionspageswidget_p.cpp     [License: LGPL (v2+)]
A  +109  -0    tier3/kprintutils/src/kcupsoptionspageswidget_p.h     [License: LGPL (v2+)]
A  +97   -0    tier3/kprintutils/src/kcupsoptionssettingswidget_p.h     [License: LGPL (v2+)]
A  +83   -0    tier3/kprintutils/src/kcupsoptionswidget_p.cpp     [License: LGPL (v2+)]
A  +77   -0    tier3/kprintutils/src/kcupsoptionswidget_p.h     [License: LGPL (v2+)]
A  +85   -0    tier3/kprintutils/src/kdeprintdialog.cpp     [License: LGPL (v2+)]
A  +143  -0    tier3/kprintutils/src/kdeprintdialog.h     [License: LGPL (v2+)]
A  +184  -0    tier3/kprintutils/src/kprintpreview.cpp     [License: LGPL (v2)]
A  +76   -0    tier3/kprintutils/src/kprintpreview.h     [License: LGPL (v2)]
A  +15   -0    tier3/kprintutils/tests/CMakeLists.txt
A  +65   -0    tier3/kprintutils/tests/kprintpreview_test.cpp     [License: LGPL (v2)]

http://commits.kde.org/kde4support/d129617756153ac361fd38e62f553fa1db36fa48

diff --git a/tier3/kprintutils/CMakeLists.txt b/tier3/kprintutils/CMakeLists.txt
new file mode 100644
index 0000000..40f7cfe
--- /dev/null
+++ b/tier3/kprintutils/CMakeLists.txt
@@ -0,0 +1,75 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+project(KPrintUtils)
+
+find_package(ECM 0.0.9 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+
+set(REQUIRED_QT_VERSION "5.2.0")
+find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
+find_package(Qt5PrintSupport ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
+include(KDEInstallDirs)
+include(KDEFrameworkCompilerSettings)
+include(KDECMakeSettings)
+
+find_package(X11)
+set(HAVE_X11 ${X11_FOUND})
+
+include(FeatureSummary)
+include(ECMSetupVersion)
+
+set(KF5_VERSION "5.0.0")
+ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KPRINTUTILS
+                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kprintutils_version.h"
+                        PACKAGE_VERSION_FILE \
"${CMAKE_CURRENT_BINARY_DIR}/KF5PrintUtilsConfigVersion.cmake") +
+if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+  #NOTE: here the dependencies of dependencies are displayed as well, this shouldn't be needed
+  #after cmake 3.0.0 is released
+  find_package(KF5I18n ${KF5_VERSION} REQUIRED)
+  find_package(KF5GuiAddons ${KF5_VERSION} REQUIRED)
+  find_package(KF5WidgetsAddons ${KF5_VERSION} REQUIRED)
+  find_package(KF5DBusAddons ${KF5_VERSION} REQUIRED)
+  find_package(KF5ConfigWidgets ${KF5_VERSION} REQUIRED)
+  find_package(KF5ItemViews ${KF5_VERSION} REQUIRED)
+  find_package(KF5IconThemes ${KF5_VERSION} REQUIRED)
+  find_package(KF5WindowSystem ${KF5_VERSION} REQUIRED)
+  find_package(KF5Service ${KF5_VERSION} REQUIRED)
+  find_package(KF5Completion ${KF5_VERSION} REQUIRED)
+  find_package(KF5TextWidgets ${KF5_VERSION} REQUIRED)
+  find_package(KF5CoreAddons ${KF5_VERSION} REQUIRED)
+  find_package(KF5Parts ${KF5_VERSION} REQUIRED)
+endif()
+
+add_subdirectory(src)
+add_subdirectory(tests)
+
+# create a Config.cmake and a ConfigVersion.cmake file and install them
+set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5PrintUtils")
+
+include(CMakePackageConfigHelpers)
+
+configure_package_config_file(
+  "${CMAKE_CURRENT_SOURCE_DIR}/KF5PrintUtilsConfig.cmake.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/KF5PrintUtilsConfig.cmake"
+  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
+)
+
+install(FILES
+  "${CMAKE_CURRENT_BINARY_DIR}/KF5PrintUtilsConfig.cmake"
+  "${CMAKE_CURRENT_BINARY_DIR}/KF5PrintUtilsConfigVersion.cmake"
+  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
+  COMPONENT Devel
+)
+
+install(EXPORT KF5PrintUtilsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE \
KF5PrintUtilsTargets.cmake NAMESPACE KF5:: ) +
+
+install(FILES
+   ${CMAKE_CURRENT_BINARY_DIR}/kprintutils_version.h
+  DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
+)
+
+if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+  feature_summary(WHAT ALL   FATAL_ON_MISSING_REQUIRED_PACKAGES)
+endif()
diff --git a/tier3/kprintutils/COPYING.LIB b/tier3/kprintutils/COPYING.LIB
new file mode 100644
index 0000000..2d2d780
--- /dev/null
+++ b/tier3/kprintutils/COPYING.LIB
@@ -0,0 +1,510 @@
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+	51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard.  To achieve this, non-free programs must
+be allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at least
+    three years, to give the same user the materials specified in
+    Subsection 6a, above, for a charge no more than the cost of
+    performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License
+may add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.
+It is safest to attach them to the start of each source file to most
+effectively convey the exclusion of warranty; and each file should
+have at least the "copyright" line and a pointer to where the full
+notice is found.
+
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or
+your school, if any, to sign a "copyright disclaimer" for the library,
+if necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James
+  Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/tier3/kprintutils/KF5PrintUtilsConfig.cmake.in \
b/tier3/kprintutils/KF5PrintUtilsConfig.cmake.in new file mode 100644
index 0000000..664dd46
--- /dev/null
+++ b/tier3/kprintutils/KF5PrintUtilsConfig.cmake.in
@@ -0,0 +1,11 @@
+@PACKAGE_INIT@
+
+find_dependency(KF5I18n "@KF5_VERSION@")
+find_dependency(KF5Parts "@KF5_VERSION@")
+
+find_dependency(Qt5Widgets @REQUIRED_QT_VERSION@)
+find_dependency(Qt5PrintSupport @REQUIRED_QT_VERSION@)
+
+
+include("${CMAKE_CURRENT_LIST_DIR}/KF5PrintUtilsTargets.cmake")
+
diff --git a/tier3/kprintutils/Mainpage.dox b/tier3/kprintutils/Mainpage.dox
new file mode 100644
index 0000000..0f47e9e
--- /dev/null
+++ b/tier3/kprintutils/Mainpage.dox
@@ -0,0 +1 @@
+// DOXYGEN_SET_PROJECT_NAME = KPrintUtils
diff --git a/tier3/kprintutils/src/CMakeLists.txt b/tier3/kprintutils/src/CMakeLists.txt
new file mode 100644
index 0000000..6aa3279
--- /dev/null
+++ b/tier3/kprintutils/src/CMakeLists.txt
@@ -0,0 +1,55 @@
+remove_definitions(-DQT_NO_CAST_FROM_ASCII)
+
+configure_file(config-kprintutils.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kprintutils.h)
+
+set(kprintutils_LIB_SRCS
+    kprintpreview.cpp
+)
+
+set(kprintutils_LIB_SRCS
+  ${kprintutils_LIB_SRCS}
+  kdeprintdialog.cpp
+)
+
+if (X11_FOUND)
+set(kprintutils_LIB_SRCS
+  ${kprintutils_LIB_SRCS}
+  kcupsoptionswidget_p.cpp
+  kcupsoptionspageswidget_p.cpp
+)
+
+set(kprintutils_UI
+  ${kprintutils_UI}
+  kcupsoptionspageswidget.ui
+)
+endif ()
+
+qt5_wrap_ui(kprintutils_LIB_SRCS ${kprintutils_UI})
+
+add_library(KF5PrintUtils ${kprintutils_LIB_SRCS})
+generate_export_header(KF5PrintUtils BASE_NAME KPrintUtils)
+add_library(KF5::PrintUtils ALIAS KF5PrintUtils)
+
+target_link_libraries(KF5PrintUtils
+  PUBLIC
+    Qt5::Widgets
+    Qt5::PrintSupport
+  PRIVATE
+    KF5::Parts
+    KF5::I18n
+)
+set_target_properties(KF5PrintUtils PROPERTIES
+                      VERSION ${KPRINTUTILS_VERSION_STRING}
+                      SOVERSION ${KPRINTUTILS_SOVERSION}
+                      EXPORT_NAME PrintUtils
+)
+
+install( FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/kprintutils_export.h
+ kdeprintdialog.h
+ kprintpreview.h
+ DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
+
+install(TARGETS KF5PrintUtils EXPORT KF5PrintUtilsTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
+
+
diff --git a/tier3/kprintutils/src/config-kprintutils.h.cmake \
b/tier3/kprintutils/src/config-kprintutils.h.cmake new file mode 100644
index 0000000..89858d1
--- /dev/null
+++ b/tier3/kprintutils/src/config-kprintutils.h.cmake
@@ -0,0 +1 @@
+#cmakedefine01 HAVE_X11
diff --git a/tier3/kprintutils/src/kcupsoptionsjobwidget_p.h \
b/tier3/kprintutils/src/kcupsoptionsjobwidget_p.h new file mode 100644
index 0000000..1a7a8f9
--- /dev/null
+++ b/tier3/kprintutils/src/kcupsoptionsjobwidget_p.h
@@ -0,0 +1,140 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2008 John Layt <john@layt.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KCUPSOPTIONSJOBWIDGET_H
+#define KCUPSOPTIONSJOBWIDGET_H
+
+#include <qwidget.h>
+
+#include "kcupsoptionswidget_p.h"
+#include "ui_kcupsoptionsjobwidget.h"
+
+class QString;
+class QTime;
+
+/**
+ * A widget to add to QPrintDialog to enable extra CUPS options
+ * Private, not part of KDE API, not to be accessed by apps
+ * Use KDEPrintDialog to create a dialog with widget included.
+ *
+ * Note that the Cups Options cannot be updated until the dialog is
+ * closed otherwise they get overwritten.
+ */
+
+class KCupsOptionsJobWidget : public KCupsOptionsWidget
+{
+    Q_OBJECT
+
+public:
+
+    /**
+     * Enum for values of job-hold-until option
+     */
+    enum JobHoldUntil
+    {
+        NoHold = 0,  //CUPS Default
+        Indefinite,
+        DayTime,
+        Night,
+        SecondShift,
+        ThirdShift,
+        Weekend,
+        SpecificTime
+    };
+
+    /**
+     * Create a widget for extra CUPS options
+     */
+    explicit KCupsOptionsJobWidget( QPrintDialog *parent );
+
+    /**
+     * Destructor
+     */
+    ~KCupsOptionsJobWidget();
+
+    /**
+     * Set the Job Hold option
+     */
+    void setJobHold( JobHoldUntil jobHold = NoHold );
+
+    /**
+     * Returns the selected Job Hold option
+     */
+    JobHoldUntil jobHold() const;
+
+    /**
+     * Set the Job Hold Time
+     */
+    void setJobHoldTime( QTime holdUntilTime );
+
+    /**
+     * Returns the selected Job Hold Time
+     */
+    QTime jobHoldTime() const;
+
+    /**
+     * Set the Job Billing text
+     */
+    void setJobBilling( QString jobBilling = "" );
+
+    /**
+     * Returns the entered Job Billing text
+     */
+    QString jobBilling() const;
+
+    /**
+     * Set Job Priority
+     */
+    void setJobPriority( int priority = 50  );
+
+    /**
+     * Returns Job Priority
+     */
+    int jobPriority() const;
+
+    /**
+     * Set Job options
+     */
+    void setJobOptions( QStringList jobOptions );
+
+    /**
+     * Returns the entered Job Options
+     */
+    QStringList jobOptions() const;
+
+protected:
+
+    void setupCupsOptions( QStringList &cupsOptions );
+
+private Q_SLOTS:
+
+    void toggleJobHoldTime();
+
+private:
+
+    void initJobHold();
+    void initJobBilling();
+    void initJobPriority();
+    void initJobOptions();
+
+    Ui_KCupsOptionsJobWidget ui;
+};
+
+#endif  // KCUPSOPTIONSJOBWIDGET_H
diff --git a/tier3/kprintutils/src/kcupsoptionspageswidget.ui \
b/tier3/kprintutils/src/kcupsoptionspageswidget.ui new file mode 100644
index 0000000..e8a9f75
--- /dev/null
+++ b/tier3/kprintutils/src/kcupsoptionspageswidget.ui
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>KCupsOptionsPagesWidget</class>
+ <widget class="QWidget" name="KCupsOptionsPagesWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>548</width>
+    <height>319</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Page Options</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_7">
+   <item row="0" column="1">
+    <widget class="QGroupBox" name="pageLabelGroupBox">
+     <property name="title">
+      <string>Page Label</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_6">
+      <item row="0" column="0">
+       <widget class="QLineEdit" name="pageLabelLineEdit"/>
+      </item>
+      <item row="1" column="0">
+       <spacer name="verticalSpacer_5">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>11</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QGroupBox" name="mirrorPagesGroupBox">
+     <property name="title">
+      <string>Mirror Pages</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_4">
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="mirrorPagesCheckBox">
+        <property name="text">
+         <string>Mirror pages along vertical axis</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <spacer name="verticalSpacer_3">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>14</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Page Border</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_5">
+      <item row="0" column="0">
+       <widget class="QComboBox" name="pageBorderCombo"/>
+      </item>
+      <item row="1" column="0">
+       <spacer name="verticalSpacer_4">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>2</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tier3/kprintutils/src/kcupsoptionspageswidget_p.cpp \
b/tier3/kprintutils/src/kcupsoptionspageswidget_p.cpp new file mode 100644
index 0000000..f449674
--- /dev/null
+++ b/tier3/kprintutils/src/kcupsoptionspageswidget_p.cpp
@@ -0,0 +1,122 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2008 John Layt <john@layt.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#include "kcupsoptionspageswidget_p.h"
+
+#include <QCheckBox>
+#include <QComboBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QIcon>
+#include <QLayout>
+#include <QTimer>
+#include <QPrinter>
+#include <QPrintEngine>
+#include <qstandardpaths.h>
+
+#include <klocalizedstring.h>
+
+/** @internal */
+KCupsOptionsPagesWidget::KCupsOptionsPagesWidget( QPrintDialog *parent ) : KCupsOptionsWidget( \
parent ) +{
+    ui.setupUi( this );
+
+    //set all the default values
+    //TODO restore last used values
+    initPageBorder();
+    initPageLabel();
+    initMirrorPages();
+}
+
+KCupsOptionsPagesWidget::~KCupsOptionsPagesWidget()
+{
+}
+
+void KCupsOptionsPagesWidget::setupCupsOptions( QStringList &cupsOptions )
+{
+    switch ( pageBorder() )
+    {
+        case NoBorder        :                                                              \
break; //default +        case SingleLine      : setCupsOption( cupsOptions, "page-border", \
"single" );       break; +        case SingleThickLine : setCupsOption( cupsOptions, \
"page-border", "single-thick" ); break; +        case DoubleLine      : setCupsOption( \
cupsOptions, "page-border", "double" );       break; +        case DoubleThickLine : \
setCupsOption( cupsOptions, "page-border", "double-thick" ); break; +    }
+
+    if ( !pageLabel().isEmpty() ) {
+        setCupsOption( cupsOptions, "page-label", pageLabel() );
+    }
+
+    if ( mirrorPages() ) {
+        setCupsOption( cupsOptions, "mirror", "" );
+    }
+}
+
+void KCupsOptionsPagesWidget::initPageBorder()
+{
+    ui.pageBorderCombo->addItem( i18nc("No border line", "None"), NoBorder );
+    ui.pageBorderCombo->addItem( i18n("Single Line"),       SingleLine );
+    ui.pageBorderCombo->addItem( i18n("Single Thick Line"), SingleThickLine );
+    ui.pageBorderCombo->addItem( i18n("Double Line"),       DoubleLine );
+    ui.pageBorderCombo->addItem( i18n("Double Thick Line"), DoubleThickLine );
+
+    setPageBorder( NoBorder );
+}
+
+void KCupsOptionsPagesWidget::setPageBorder( KCupsOptionsPagesWidget::PageBorder pageBorder  )
+{
+    ui.pageBorderCombo->setCurrentIndex( ui.pageBorderCombo->findData( QVariant( pageBorder ) \
) ); +}
+
+KCupsOptionsPagesWidget::PageBorder KCupsOptionsPagesWidget::pageBorder() const
+{
+    return (KCupsOptionsPagesWidget::PageBorder) ui.pageBorderCombo->itemData( \
ui.pageBorderCombo->currentIndex() ).toInt(); +}
+
+void KCupsOptionsPagesWidget::initPageLabel()
+{
+    setPageLabel( "" );
+}
+
+void KCupsOptionsPagesWidget::setPageLabel( QString label )
+{
+    ui.pageLabelLineEdit->insert( label );
+}
+
+QString KCupsOptionsPagesWidget::pageLabel() const
+{
+    return ui.pageLabelLineEdit->text();
+}
+
+void KCupsOptionsPagesWidget::initMirrorPages()
+{
+    setMirrorPages( false );
+}
+
+void KCupsOptionsPagesWidget::setMirrorPages( bool mirror )
+{
+    ui.mirrorPagesCheckBox->setChecked( mirror );
+}
+
+bool KCupsOptionsPagesWidget::mirrorPages() const
+{
+    return ui.mirrorPagesCheckBox->isChecked();
+}
+
diff --git a/tier3/kprintutils/src/kcupsoptionspageswidget_p.h \
b/tier3/kprintutils/src/kcupsoptionspageswidget_p.h new file mode 100644
index 0000000..9799fbd
--- /dev/null
+++ b/tier3/kprintutils/src/kcupsoptionspageswidget_p.h
@@ -0,0 +1,109 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2008 John Layt <john@layt.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KCUPSOPTIONSPAGESWIDGET_H
+#define KCUPSOPTIONSPAGESWIDGET_H
+
+#include <qwidget.h>
+
+#include "kcupsoptionswidget_p.h"
+#include "ui_kcupsoptionspageswidget.h"
+
+/**
+ * A widget to add to QPrintDialog to enable extra CUPS options
+ * Private, not part of KDE API, not to be accessed by apps
+ * Use KDEPrintDialog to create a dialog with widget included.
+ *
+ * Note that the Cups Options cannot be updated until the dialog is
+ * closed otherwise they get overwritten.
+ */
+
+class KCupsOptionsPagesWidget : public KCupsOptionsWidget
+{
+    Q_OBJECT
+
+public:
+
+    /**
+     * Enum for valid border styles for pages
+     */
+    enum PageBorder
+    {
+        NoBorder = 0,  //CUPS Default 'none'
+        SingleLine,
+        SingleThickLine,
+        DoubleLine,
+        DoubleThickLine
+    };
+
+    /**
+     * Create a widget for extra CUPS options
+     */
+    explicit KCupsOptionsPagesWidget( QPrintDialog *parent );
+
+    /**
+     * Destructor
+     */
+    ~KCupsOptionsPagesWidget();
+
+    /**
+     * Set the border style of pages
+     */
+    void setPageBorder( PageBorder pageBorder = NoBorder  );
+
+    /**
+     * Returns the selected page border style
+     */
+    PageBorder pageBorder() const;
+
+    /**
+     * Set Page Label text
+     */
+    void setPageLabel( QString label = ""  );
+
+    /**
+     * Returns Page Label text
+     */
+    QString pageLabel() const;
+
+    /**
+     * Set mirror pages selected
+     */
+    void setMirrorPages( bool mirror = false  );
+
+    /**
+     * Returns if mirror pages selected
+     */
+    bool mirrorPages() const;
+
+protected:
+
+    void setupCupsOptions( QStringList &cupsOptions );
+
+private:
+
+    void initPageBorder();
+    void initPageLabel();
+    void initMirrorPages();
+
+    Ui_KCupsOptionsPagesWidget ui;
+};
+
+#endif  // KCUPSOPTIONSPAGESWIDGET_H
diff --git a/tier3/kprintutils/src/kcupsoptionssettingswidget_p.h \
b/tier3/kprintutils/src/kcupsoptionssettingswidget_p.h new file mode 100644
index 0000000..8d26e33
--- /dev/null
+++ b/tier3/kprintutils/src/kcupsoptionssettingswidget_p.h
@@ -0,0 +1,97 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2009 John Layt <john@layt.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KCUPSOPTIONSSETTINGSWIDGET_H
+#define KCUPSOPTIONSSETTINGSWIDGET_H
+
+#include <qwidget.h>
+#include <QComboBox>
+
+#include "kcupsoptionswidget_p.h"
+
+/**
+ * A widget to add to QPrintDialog to enable extra CUPS options
+ * Private, not part of KDE API, not to be accessed by apps
+ * Use KDEPrintDialog to create a dialog with widget included.
+ *
+ * Note that the Cups Options cannot be updated until the dialog is
+ * closed otherwise they get overwritten.
+ */
+
+class KCupsOptionsSettingsWidget : public KCupsOptionsWidget
+{
+    Q_OBJECT
+
+public:
+
+    /**
+    * Enum for valid page set
+    */
+    enum PageSet
+    {
+        AllPages = 0,  //CUPS Default
+        OddPages,
+        EvenPages
+    };
+
+    /**
+     * Create a widget for extra CUPS options
+     */
+    explicit KCupsOptionsSettingsWidget( QPrintDialog *parent );
+
+    /**
+     * Destructor
+     */
+    ~KCupsOptionsSettingsWidget();
+
+    /**
+    * Set the Page Set
+    */
+    void setPageSet( PageSet pageSet = AllPages  );
+
+    /**
+    * Returns the selected Page Set
+    */
+    PageSet pageSet() const;
+
+    /**
+    * Set the Server Selects Pages Mode
+    */
+
+    void setSystemSelectsPages( bool systemSelectsPages = true  );
+
+    /**
+    * Returns if set to System Selects Pages mode
+    */
+    bool systemSelectsPages() const;
+
+    protected:
+
+    void setupCupsOptions( QStringList &cupsOptions );
+
+private:
+
+    void initPageSet();
+
+    bool m_systemSelectsPages;
+    QComboBox *m_pageSetCombo;
+};
+
+#endif  // KCUPSOPTIONSSETTINGSWIDGET_H
diff --git a/tier3/kprintutils/src/kcupsoptionswidget_p.cpp \
b/tier3/kprintutils/src/kcupsoptionswidget_p.cpp new file mode 100644
index 0000000..f0ac84c
--- /dev/null
+++ b/tier3/kprintutils/src/kcupsoptionswidget_p.cpp
@@ -0,0 +1,83 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2008 John Layt <john@layt.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#include "kcupsoptionswidget_p.h"
+
+#include <config-kprintutils.h>
+
+#include <QPrinter>
+#include <QPrintEngine>
+#include <QPrintDialog>
+
+/** @internal */
+KCupsOptionsWidget::KCupsOptionsWidget( QPrintDialog *parent ) : QWidget( parent )
+{
+    m_dialog = parent;
+
+    // When user accepts the dialog, then set up the QPrinter with the CUPS options
+    connect( m_dialog, SIGNAL(accepted()), this, SLOT(setupPrinter()) );
+}
+
+KCupsOptionsWidget::~KCupsOptionsWidget()
+{
+}
+
+bool KCupsOptionsWidget::cupsAvailable()
+{
+#if HAVE_X11
+    // Ideally we would have access to the private Qt method
+    // QCUPSSupport::cupsAvailable() to do this as it is very complex routine.
+    // However, if CUPS is available then QPrinter::numCopies() will always return 1
+    // whereas if CUPS is not available it will return the real number of copies.
+    // This behaviour is guaranteed never to change, so we can use it as a reliable \
substitute. +    QPrinter testPrinter;
+    testPrinter.setNumCopies( 2 );
+    return ( testPrinter.numCopies() == 1 );
+#else
+    return false;
+#endif
+}
+
+void KCupsOptionsWidget::setupPrinter()
+{
+    if ( cupsAvailable() ) {
+        QStringList cupsOptions = \
m_dialog->printer()->printEngine()->property(QPrintEngine::PrintEnginePropertyKey(0xfe00)).toStringList();
 +
+        setupCupsOptions( cupsOptions );
+
+        m_dialog->printer()->printEngine()->setProperty(QPrintEngine::PrintEnginePropertyKey(0xfe00), \
QVariant(cupsOptions)); +    }
+}
+
+void KCupsOptionsWidget::setupCupsOptions( QStringList &cupsOptions )
+{
+    Q_UNUSED(cupsOptions);
+}
+
+void KCupsOptionsWidget::setCupsOption( QStringList &cupsOptions, const QString& option, const \
QString& value ) +{
+    if ( cupsOptions.contains( option ) ) {
+        cupsOptions.replace( cupsOptions.indexOf( option ) + 1, value );
+    } else {
+        cupsOptions.append( option );
+        cupsOptions.append( value );
+    }
+}
+
diff --git a/tier3/kprintutils/src/kcupsoptionswidget_p.h \
b/tier3/kprintutils/src/kcupsoptionswidget_p.h new file mode 100644
index 0000000..4fa30ad
--- /dev/null
+++ b/tier3/kprintutils/src/kcupsoptionswidget_p.h
@@ -0,0 +1,77 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2008 John Layt <john@layt.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KCUPSOPTIONSWIDGET_H
+#define KCUPSOPTIONSWIDGET_H
+
+#include <qwidget.h>
+
+class QString;
+class QStringList;
+class QPrinter;
+class QPrintDialog;
+
+/**
+ * A widget to add to QPrintDialog to enable extra CUPS options
+ * Private, not part of KDE API, not to be accessed by apps
+ * Use KDEPrintDialog to create a dialog with widget included.
+ *
+ * Base widget all CUPS widgets should inherit from
+ */
+
+class KCupsOptionsWidget : public QWidget
+{
+    Q_OBJECT
+
+public:
+
+    /**
+     * Create a widget for CUPS options
+     */
+    explicit KCupsOptionsWidget( QPrintDialog *parent );
+
+    /**
+     * Destructor
+     */
+    virtual ~KCupsOptionsWidget();
+
+    /**
+    * Return if Cups is running on system
+    */
+    static bool cupsAvailable();
+
+public Q_SLOTS:
+
+    /**
+     * Setup the given QPrinter with the selected print options
+     */
+    void setupPrinter();
+
+protected:
+
+    virtual void setupCupsOptions( QStringList &cupsOptions );
+    void setCupsOption( QStringList &cupsOptions, const QString& option, const QString& value \
); +
+    QPrintDialog *m_dialog;
+
+    Q_DISABLE_COPY(KCupsOptionsWidget)
+};
+
+#endif  // KCUPSOPTIONSWIDGET_H
diff --git a/tier3/kprintutils/src/kdeprintdialog.cpp \
b/tier3/kprintutils/src/kdeprintdialog.cpp new file mode 100644
index 0000000..c04b056
--- /dev/null
+++ b/tier3/kprintutils/src/kdeprintdialog.cpp
@@ -0,0 +1,85 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
+ *  Copyright (c) 2007 Thomas Zander <zander@kde.org>
+ *  Copyright (c) 2008 John Layt <john@layt.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ **/
+
+#include "kdeprintdialog.h"
+#include <config-kprintutils.h>
+
+#if HAVE_X11
+#include "kcupsoptionspageswidget_p.h"
+#include "kcupsoptionssettingswidget_p.h"
+#endif
+
+#include "klocalizedstring.h"
+
+#include <QPrintDialog>
+#include <QLabel>
+
+QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
+                                          PageSelectPolicy pageSelectPolicy,
+                                          const QList<QWidget*> &customTabs,
+                                          QWidget *parent)
+{
+    QPrintDialog *dialog = new QPrintDialog( printer, parent );
+    // Windows and lpr don't support server side page range so default to not
+    // showing print range in dialog, it will be enabled automatically
+    // for systems where CUPS is available
+    if ( pageSelectPolicy == SystemSelectsPages ) {
+        dialog->setOption( QAbstractPrintDialog::PrintPageRange, false);
+    }
+#if HAVE_X11
+    if ( KCupsOptionsWidget::cupsAvailable() ) {
+        KCupsOptionsPagesWidget *cupsOptionsPagesTab = new KCupsOptionsPagesWidget( dialog );
+        dialog->setOptionTabs( QList<QWidget*>() << cupsOptionsPagesTab << customTabs );
+        if ( pageSelectPolicy == SystemSelectsPages ) {
+            dialog->setOption( QAbstractPrintDialog::PrintPageRange, true );
+        }
+    } else {
+        dialog->setOptionTabs( customTabs );
+    }
+#else //Not X11
+    foreach( QWidget* w, customTabs ) // reparent to avoid leaks
+        w->setParent( dialog );
+#endif
+    dialog->setWindowTitle( i18nc( "@title:window", "Print" ) );
+    return dialog;
+}
+
+QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
+                                          const QList<QWidget*> &customTabs,
+                                          QWidget *parent)
+{
+    return KdePrint::createPrintDialog(printer, KdePrint::ApplicationSelectsPages, customTabs, \
parent); +}
+
+
+QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
+                                          PageSelectPolicy pageSelectPolicy,
+                                          QWidget *parent)
+{
+    return KdePrint::createPrintDialog(printer, pageSelectPolicy, QList<QWidget*>(), parent);
+}
+
+QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
+                                          QWidget *parent)
+{
+    return KdePrint::createPrintDialog(printer, KdePrint::ApplicationSelectsPages, \
QList<QWidget*>(), parent); +}
diff --git a/tier3/kprintutils/src/kdeprintdialog.h b/tier3/kprintutils/src/kdeprintdialog.h
new file mode 100644
index 0000000..2f5b6be
--- /dev/null
+++ b/tier3/kprintutils/src/kdeprintdialog.h
@@ -0,0 +1,143 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ **/
+
+#ifndef KDEPRINTDIALOG_H
+#define KDEPRINTDIALOG_H
+
+#include <kprintutils_export.h>
+
+#include <QtCore/QList>
+
+class QPrintDialog;
+class QPrinter;
+class QWidget;
+
+/**
+ * Namespace for the KDE printing system
+ */
+namespace KdePrint
+{
+    /**
+     * Whether pages to be printed are selected by the application or the print system.
+     *
+     * If ApplicationSelectsPages is set then the Application paints only the
+     * pages selected by the user in the Print Dialog and the Print System prints
+     * all the pages.
+     *
+     * If SystemSelectsPages is set then the Application paints all the pages
+     * and the Server will attempt to select the user requested pages.  This
+     * only works in CUPS, not LPR, Windows, or OSX.
+     */
+    enum PageSelectPolicy { ApplicationSelectsPages, SystemSelectsPages };
+
+    /**
+     * @since 4.4
+     *
+     * Creates a printer dialog for a QPrinter with the given custom widgets.
+     *
+     * If ApplicationSelectsPages is set then the Application paints only the
+     * pages selected by the user in the Print Dialog and the Print System prints
+     * all the pages.
+     *
+     * If SystemSelectsPages is set then the Application paints all the pages
+     * and the Server will attempt to select the user requested pages.  On
+     * platforms where the Server does not support the selection of pages
+     * (i.e. Windows, OSX, and LPR) then the Page Range input will be disabled
+     * on the print dialog.
+     *
+     * Note that the custom widgets are only supported on X11
+     * and will @b not be shown on Qt versions prior to 4.3.2.
+     * On non-X11 systems it is preferred to provide the widgets 
+     * within configuration dialog of the application.
+     *
+     * Setting the widgets will transfer their ownership to the print dialog
+     * even on non-X11 systems.
+     *
+     * The caller takes ownership of the dialog and is responsible
+     * for deleting it.
+     *
+     * @param printer the QPrinter to apply settings to
+     * @param pageSelectPolicy whether the Application or the System does the page selection
+     * @param customTabs a list of custom widgets to show as tabs, the name printed on the tab \
will +     *      be taken from the widgets windowTitle().
+     * @param parent the parent for the dialog
+     * @see QWidget::setWindowTitle()
+     * @see QAbstractPrintDialog::setOptionTabs()
+     */
+    KPRINTUTILS_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
+                                                       PageSelectPolicy pageSelectPolicy,
+                                                       const QList<QWidget*> &customTabs,
+                                                       QWidget *parent = 0);
+
+    /**
+     * Creates a printer dialog for a QPrinter with the given custom widgets.
+     *
+     * Convenience method, assumes PageSelectionMode of ApplicationSelectsPages,
+     * see full version method for full documentation.
+     *
+     * The caller takes ownership of the dialog and is responsible
+     * for deleting it.
+     *
+     * @param printer the QPrinter to apply settings to
+     * @param parent the parent for the dialog
+     * @param customTabs a list of custom widgets to show as tabs, the name printed on the tab \
will +     *      be taken from the widgets windowTitle().
+     */
+    KPRINTUTILS_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
+                                                       const QList<QWidget*> &customTabs,
+                                                       QWidget *parent = 0);
+
+    /**
+     * @since 4.4
+     *
+     * Creates a printer dialog for a QPrinter with the given custom widgets.
+     *
+     * Convenience method, see full version method for full documentation.
+     *
+     * The caller takes ownership of the dialog and is responsible
+     * for deleting it.
+     *
+     * @param printer the QPrinter to apply settings to
+     * @param pageSelectPolicy whether the Application or the System does the page selection
+     * @param parent the parent for the dialog
+     */
+    KPRINTUTILS_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
+                                                       PageSelectPolicy pageSelectPolicy,
+                                                       QWidget *parent = 0);
+
+    /**
+     * Creates a printer dialog for a QPrinter
+     *
+     * Convenience method, assumes PageSelectionMode of ApplicationSelectsPages,
+     * see full version method for full documentation.
+     *
+     * The caller takes ownership of the dialog and is responsible
+     * for deleting it.
+     *
+     * @param printer the QPrinter to apply settings to
+     * @param parent the parent for the dialog
+     */
+    KPRINTUTILS_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
+                                                       QWidget *parent = 0);
+}
+
+
+#endif // KDEPRINTDIALOG_H
+
diff --git a/tier3/kprintutils/src/kprintpreview.cpp b/tier3/kprintutils/src/kprintpreview.cpp
new file mode 100644
index 0000000..2915487
--- /dev/null
+++ b/tier3/kprintutils/src/kprintpreview.cpp
@@ -0,0 +1,184 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License version 2 as published by the Free Software Foundation.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ **/
+
+#include "kprintpreview.h"
+
+#include <QDialogButtonBox>
+#include <QtCore/QFile>
+#include <QLabel>
+#include <QPrinter>
+#include <QShowEvent>
+#include <QVBoxLayout>
+#include <QTemporaryDir>
+#include <QDebug>
+
+#include <klocalizedstring.h>
+#include <kmimetypetrader.h>
+#include <kparts/part.h>
+#include <kpluginfactory.h>
+#include <kpluginloader.h>
+#include <kservice.h>
+
+
+class KPrintPreviewPrivate
+{
+public:
+    KPrintPreviewPrivate(KPrintPreview *host, QPrinter * _printer)
+        : q(host)
+        , printer(_printer)
+        , mainWidget(new QWidget(host))
+        , previewPart(0)
+        , failMessage(0)
+    {
+        mainWidget->setLayout(new QVBoxLayout);
+
+        if ( tempdir.isValid() ) {
+            filename = tempdir.path() + '/' + "print_preview.pdf";
+        } else {
+            qWarning() << "Failed to create temporary directory";
+            filename = "/dev/null";
+        }
+    }
+
+    void getPart();
+    bool doPreview();
+    void fail();
+    void setCentralWidget(QWidget *widget);
+
+    KPrintPreview *q;
+
+    QPrinter *printer;
+    QWidget *mainWidget;
+
+    QTemporaryDir tempdir;
+    QString filename;
+
+    KParts::ReadOnlyPart *previewPart;
+    QWidget *failMessage;
+};
+
+void KPrintPreviewPrivate::getPart()
+{
+    if (previewPart) {
+        return;
+    }
+
+    KPluginFactory *factory(0);
+    const KService::List offers =
+        KMimeTypeTrader::self()->query("application/pdf", "KParts/ReadOnlyPart");
+
+    KService::List::ConstIterator it = offers.begin();
+    while (!factory && it != offers.end()) {
+        KPluginLoader loader(**it);
+        factory = loader.factory();
+        ++it;
+    }
+    if (factory) {
+        previewPart = factory->create<KParts::ReadOnlyPart>(q, (QVariantList() << \
"Print/Preview")); +    }
+}
+
+bool KPrintPreviewPrivate::doPreview()
+{
+    if (!QFile::exists(filename)) {
+        qWarning() << "Nothing was produced to be previewed";
+        return false;
+    }
+
+    getPart();
+    if (!previewPart) {
+        //TODO: error dialog
+        qWarning() << "Could not find a PDF viewer for the preview dialog";
+        fail();
+        return false;
+    } else {
+        setCentralWidget(previewPart->widget());
+        return previewPart->openUrl(QUrl::fromLocalFile(filename));
+    }
+}
+
+void KPrintPreviewPrivate::fail()
+{
+    if (!failMessage) {
+        failMessage = new QLabel(i18n("Could not load print preview part"), q);
+    }
+    setCentralWidget(failMessage);
+}
+
+void KPrintPreviewPrivate::setCentralWidget(QWidget *widget)
+{
+    mainWidget->layout()->addWidget(widget);
+}
+
+
+
+KPrintPreview::KPrintPreview(QPrinter *printer, QWidget *parent)
+    : QDialog(parent)
+    , d(new KPrintPreviewPrivate(this, printer))
+{
+    //There is no printing on wince
+#ifndef _WIN32_WCE
+    // Set up the dialog
+    setWindowTitle(i18n("Print Preview"));
+
+    // Set up the printer
+    printer->setOutputFileName(d->filename);
+
+    QVBoxLayout *layout = new QVBoxLayout;
+    layout->setMargin(0);
+    setLayout(layout);
+
+    layout->addWidget(d->mainWidget, 1);
+
+    QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
+    buttonBox->setStandardButtons(QDialogButtonBox::Close);
+    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+    layout->addWidget(buttonBox);
+
+    resize(QSize(600, 500));
+    adjustSize();
+#endif
+}
+
+KPrintPreview::~KPrintPreview()
+{
+    delete d;
+}
+
+void KPrintPreview::showEvent(QShowEvent *event)
+{
+    if (!event->spontaneous()) {
+        // being shown for the first time
+        if (!d->doPreview()) {
+            event->accept();
+            return;
+        }
+    }
+    QDialog::showEvent(event);
+}
+
+bool KPrintPreview::isAvailable()
+{
+    return !KMimeTypeTrader::self()->query("application/pdf", \
"KParts/ReadOnlyPart").isEmpty(); +}
+
+
+
+
diff --git a/tier3/kprintutils/src/kprintpreview.h b/tier3/kprintutils/src/kprintpreview.h
new file mode 100644
index 0000000..180da2f
--- /dev/null
+++ b/tier3/kprintutils/src/kprintpreview.h
@@ -0,0 +1,76 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License version 2 as published by the Free Software Foundation.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ **/
+
+#ifndef KPRINTPREVIEW_H
+#define KPRINTPREVIEW_H
+
+#include <kprintutils_export.h>
+
+#include <QDialog>
+#include <QPrinter>
+
+class KPrintPreviewPrivate;
+
+/**
+ * KPrintPreview provides a print preview dialog.
+ *
+ * Use it like this:
+ *
+ * @code
+ * QPrinter printer;
+ * KPrintPreview preview(&printer);
+ * doPrint(printer); // draws to the QPrinter
+ * preview.exec();
+ * @endcode
+ */
+class KPRINTUTILS_EXPORT KPrintPreview : public QDialog
+{
+    Q_OBJECT
+
+public:
+    /**
+     * Create a KPrintPreview object.
+     *
+     * This will change the settings on the QPrinter, so you
+     * should not re-use the QPrinter object for printing
+     * normally.
+     *
+     * @param printer pointer to a QPrinter to configure for
+     *                print preview
+     * @param parent  pointer to the parent widget for the dialog
+     */
+    explicit KPrintPreview(QPrinter *printer, QWidget *parent = 0);
+    virtual ~KPrintPreview();
+
+    /** 
+     * Returns true if the print preview system is available
+     * @since KDE 4.5
+     */
+    static bool isAvailable();
+
+protected:
+    void showEvent(QShowEvent *event);
+
+private:
+    KPrintPreviewPrivate * const d;
+};
+
+
+#endif // KPRINTPREVIEW_H
+
diff --git a/tier3/kprintutils/tests/CMakeLists.txt b/tier3/kprintutils/tests/CMakeLists.txt
new file mode 100644
index 0000000..6c6b656
--- /dev/null
+++ b/tier3/kprintutils/tests/CMakeLists.txt
@@ -0,0 +1,15 @@
+include(ECMMarkAsTest)
+
+find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test PrintSupport Widgets)
+
+macro(kprintutils_executable_tests)
+  foreach(_testname ${ARGN})
+    add_executable(${_testname} ${_testname}.cpp)
+    target_link_libraries(${_testname} Qt5::Test KF5::PrintUtils)
+    ecm_mark_as_test(${_testname})
+  endforeach()
+endmacro()
+
+kprintutils_executable_tests(
+  kprintpreview_test
+)
diff --git a/tier3/kprintutils/tests/kprintpreview_test.cpp \
b/tier3/kprintutils/tests/kprintpreview_test.cpp new file mode 100644
index 0000000..b22f5e6
--- /dev/null
+++ b/tier3/kprintutils/tests/kprintpreview_test.cpp
@@ -0,0 +1,65 @@
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (c) 2013 Martin Klapetek <mklapetek@kde.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License version 2 as published by the Free Software Foundation.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ **/
+
+#include <QApplication>
+#include <QTest>
+#include <QPrinter>
+#include <QPainter>
+
+#include "kprintpreview.h"
+
+int main( int argc, char **argv )
+{
+    QApplication::setApplicationName(QStringLiteral("kprintpreview_text"));
+    QApplication app(argc, argv);
+
+    QPrinter printer;
+    KPrintPreview *preview = new KPrintPreview(&printer);
+
+    QPainter painter;
+    painter.begin(&printer);
+    painter.drawText(printer.pageRect(), QStringLiteral("Lorem ipsum dolor sit amet, \
consectetur adipiscing elit. " +    "Nam malesuada massa dolor, sed sollicitudin turpis congue \
eu. Pellentesque ac risus felis. Etiam scelerisque " +    "leo vitae mauris condimentum \
malesuada. Praesent tortor neque, egestas non elit vitae, accumsan mattis augue. " +    \
"Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque ligula ligula, convallis \
ac felis in, " +    "tincidunt pulvinar magna. Maecenas eu congue ipsum. Donec laoreet \
vulputate lorem, fermentum consectetur orci. " +    "Suspendisse sed mauris sit amet mauris \
molestie ullamcorper. Vivamus aliquet consectetur est sit amet fringilla. " +    "Nunc cursus \
risus velit, tempus imperdiet sapien tristique non. Pellentesque leo sapien, blandit et turpis \
eu, " +    "placerat placerat odio. Vestibulum auctor nulla ut felis venenatis, eleifend \
venenatis quam feugiat." +
+    "Duis magna enim, dignissim et convallis quis, ultrices quis nisi. Nulla nec rutrum \
tellus. Nunc in commodo orci. " +    "Praesent tincidunt sem consequat neque tincidunt \
ullamcorper. Pellentesque sit amet dui vitae lectus fermentum " +    "dignissim vel vel justo. \
Donec nec felis venenatis, hendrerit nunc vitae, iaculis leo. Duis vel purus pharetra, " +    \
"laoreet nisl non, ultricies mauris. Etiam adipiscing eget magna quis bibendum." +
+    "Curabitur felis nunc, lobortis nec tincidunt commodo, tempor id libero. Nulla sit amet \
ultrices erat. " +    "Suspendisse tempus lorem lacus, a fermentum sem euismod vitae. Proin sed \
adipiscing leo, sit amet " +    "vestibulum eros. Proin faucibus ut ante id facilisis. Nunc \
cursus ut purus sed ullamcorper. Donec " +    "turpis risus, pretium sed dui sed, accumsan \
dictum arcu. Vestibulum cursus sit amet enim ac vestibulum. " +    "Proin eget commodo enim. \
Nullam eu lacus nulla. Suspendisse malesuada tempor nulla, ac ullamcorper arcu. " +    "Nunc \
facilisis laoreet fringilla. Aliquam bibendum lacinia quam in ultrices. Donec non iaculis \
augue. " +    "Duis semper rhoncus arcu. Curabitur faucibus consectetur ultricies."));
+
+    painter.end();
+
+    preview->resize(600, 600);
+    preview->show();
+
+    return app.exec();
+ }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic