• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • dialogs
kdeprintdialog.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
4 * Copyright (c) 2007 Thomas Zander <zander@kde.org>
5 * Copyright (c) 2008 John Layt <john@layt.net>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 **/
22
23#include "kdeprintdialog.h"
24#ifdef Q_WS_X11
25#include "kcupsoptionspageswidget_p.h"
26#include "kcupsoptionsjobwidget_p.h"
27#include "kcupsoptionssettingswidget_p.h"
28#endif
29
30#include "kdebug.h"
31#include "kdialog.h"
32#include "klocale.h"
33#include "kdeversion.h"
34
35#include <fixx11h.h> // for enable-final
36#include <QPrintDialog>
37#include <QLabel>
38
39QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
40 PageSelectPolicy pageSelectPolicy,
41 const QList<QWidget*> &customTabs,
42 QWidget *parent)
43{
44 QPrintDialog *dialog = new QPrintDialog( printer, parent );
45 // Windows and lpr don't support server side page range so default to not
46 // showing print range in dialog, enable only for CUPS depending on Qt version.
47 // Need to check OSX.
48 if ( pageSelectPolicy == SystemSelectsPages ) {
49 dialog->setOption( QAbstractPrintDialog::PrintPageRange, false);
50 }
51#ifdef Q_WS_X11
52// Hopefully Qt 4.9 will have native support for all Cups options, Odd/Even, and page ranges
53#if QT_VERSION < KDE_MAKE_VERSION(4,9,0)
54 if ( KCupsOptionsWidget::cupsAvailable() ) {
55 KCupsOptionsPagesWidget *cupsOptionsPagesTab = new KCupsOptionsPagesWidget( dialog );
56 KCupsOptionsJobWidget *cupsOptionsJobTab = new KCupsOptionsJobWidget( dialog );
57 dialog->setOptionTabs( QList<QWidget*>() << cupsOptionsPagesTab << cupsOptionsJobTab << customTabs );
58 KCupsOptionsSettingsWidget *cupsOptionsSettingsTab = new KCupsOptionsSettingsWidget( dialog );
59 if ( pageSelectPolicy == SystemSelectsPages ) {
60 dialog->setOption( QAbstractPrintDialog::PrintPageRange, true );
61 cupsOptionsSettingsTab->setSystemSelectsPages( true );
62 }
63 } else {
64 dialog->setOptionTabs( customTabs );
65 }
66#else // Qt >= 4.9
67 dialog->setOptionTabs( customTabs );
68#endif // Qt < 4.9
69#else //Not X11
70 foreach( QWidget* w, customTabs ) // reparent to avoid leaks
71 w->setParent( dialog );
72#endif
73 dialog->setWindowTitle( KDialog::makeStandardCaption( i18nc( "@title:window", "Print" ) ) );
74 return dialog;
75}
76
77QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
78 const QList<QWidget*> &customTabs,
79 QWidget *parent)
80{
81 return KdePrint::createPrintDialog(printer, KdePrint::ApplicationSelectsPages, customTabs, parent);
82}
83
84
85QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
86 PageSelectPolicy pageSelectPolicy,
87 QWidget *parent)
88{
89 return KdePrint::createPrintDialog(printer, pageSelectPolicy, QList<QWidget*>(), parent);
90}
91
92QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
93 QWidget *parent)
94{
95 return KdePrint::createPrintDialog(printer, KdePrint::ApplicationSelectsPages, QList<QWidget*>(), parent);
96}
KDialog::makeStandardCaption
static QString makeStandardCaption(const QString &userCaption, QWidget *window=0, CaptionFlags flags=HIGCompliantCaption)
Builds a caption that contains the application name along with the userCaption using a standard layou...
Definition: kdialog.cpp:442
QList
QWidget
fixx11h.h
kdebug.h
kdeprintdialog.h
kdialog.h
klocale.h
i18nc
QString i18nc(const char *ctxt, const char *text)
KdePrint::PageSelectPolicy
PageSelectPolicy
Whether pages to be printed are selected by the application or the print system.
Definition: kdeprintdialog.h:48
KdePrint::ApplicationSelectsPages
@ ApplicationSelectsPages
Definition: kdeprintdialog.h:48
KdePrint::SystemSelectsPages
@ SystemSelectsPages
Definition: kdeprintdialog.h:48
KdePrint::createPrintDialog
QPrintDialog * createPrintDialog(QPrinter *printer, PageSelectPolicy pageSelectPolicy, const QList< QWidget * > &customTabs, QWidget *parent=0)
Definition: kdeprintdialog.cpp:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal