1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 **/
20
21#ifndef KDEPRINTDIALOG_H
22#define KDEPRINTDIALOG_H
23
24#include <kdeui_export.h>
25
26#include <QtCore/QList>
27
28class QPrintDialog;
29class QPrinter;
30class QWidget;
31
32/**
33 * Namespace for the KDE printing system
34 */
35namespace KdePrint
36{
37 /**
38 * Whether pages to be printed are selected by the application or the print system.
39 *
40 * If ApplicationSelectsPages is set then the Application paints only the
41 * pages selected by the user in the Print Dialog and the Print System prints
42 * all the pages.
43 *
44 * If SystemSelectsPages is set then the Application paints all the pages
45 * and the Server will attempt to select the user requested pages. This
46 * only works in CUPS, not LPR, Windows, or OSX.
47 */
48 enum PageSelectPolicy { ApplicationSelectsPages, SystemSelectsPages };
49
50 /**
51 * @since 4.4
52 *
53 * Creates a printer dialog for a QPrinter with the given custom widgets.
54 *
55 * If ApplicationSelectsPages is set then the Application paints only the
56 * pages selected by the user in the Print Dialog and the Print System prints
57 * all the pages.
58 *
59 * If SystemSelectsPages is set then the Application paints all the pages
60 * and the Server will attempt to select the user requested pages. On
61 * platforms where the Server does not support the selection of pages
62 * (i.e. Windows, OSX, and LPR) then the Page Range input will be disabled
63 * on the print dialog.
64 *
65 * Note that the custom widgets are only supported on X11
66 * and will @b not be shown on Qt versions prior to 4.3.2.
67 * On non-X11 systems it is preferred to provide the widgets
68 * within configuration dialog of the application.
69 *
70 * Setting the widgets will transfer their ownership to the print dialog
71 * even on non-X11 systems.
72 *
73 * The caller takes ownership of the dialog and is responsible
74 * for deleting it.
75 *
76 * @param printer the QPrinter to apply settings to
77 * @param pageSelectPolicy whether the Application or the System does the page selection
78 * @param customTabs a list of custom widgets to show as tabs, the name printed on the tab will
79 * be taken from the widgets windowTitle().
80 * @param parent the parent for the dialog
81 * @see QWidget::setWindowTitle()
82 * @see QAbstractPrintDialog::setOptionTabs()
83 */
84 KDEUI_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
85 PageSelectPolicy pageSelectPolicy,
86 const QList<QWidget*> &customTabs,
87 QWidget *parent = 0);
88
89 /**
90 * Creates a printer dialog for a QPrinter with the given custom widgets.
91 *
92 * Convenience method, assumes PageSelectionMode of ApplicationSelectsPages,
93 * see full version method for full documentation.
94 *
95 * The caller takes ownership of the dialog and is responsible
96 * for deleting it.
97 *
98 * @param printer the QPrinter to apply settings to
99 * @param parent the parent for the dialog
100 * @param customTabs a list of custom widgets to show as tabs, the name printed on the tab will
101 * be taken from the widgets windowTitle().
102 */
103 KDEUI_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
104 const QList<QWidget*> &customTabs,
105 QWidget *parent = 0);
106
107 /**
108 * @since 4.4
109 *
110 * Creates a printer dialog for a QPrinter with the given custom widgets.
111 *
112 * Convenience method, see full version method for full documentation.
113 *
114 * The caller takes ownership of the dialog and is responsible
115 * for deleting it.
116 *
117 * @param printer the QPrinter to apply settings to
118 * @param pageSelectPolicy whether the Application or the System does the page selection
119 * @param parent the parent for the dialog
120 */
121 KDEUI_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
122 PageSelectPolicy pageSelectPolicy,
123 QWidget *parent = 0);
124
125 /**
126 * Creates a printer dialog for a QPrinter
127 *
128 * Convenience method, assumes PageSelectionMode of ApplicationSelectsPages,
129 * see full version method for full documentation.
130 *
131 * The caller takes ownership of the dialog and is responsible
132 * for deleting it.
133 *
134 * @param printer the QPrinter to apply settings to
135 * @param parent the parent for the dialog
136 */
137 KDEUI_EXPORT QPrintDialog *createPrintDialog(QPrinter *printer,
138 QWidget *parent = 0);
139}
140
141
142#endif // KDEPRINTDIALOG_H
143
144