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

KDEUI

kdeprintdialog.cpp

Go to the documentation of this file.
00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
00004  *  Copyright (c) 2007 Thomas Zander <zander@kde.org>
00005  *  Copyright (c) 2008 John Layt <john@layt.net>
00006  *
00007  *  This library is free software; you can redistribute it and/or
00008  *  modify it under the terms of the GNU Library General Public
00009  *  License as published by the Free Software Foundation; either
00010  *  version 2 of the License, or (at your option) any later version.
00011  *
00012  *  This library is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  Library General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU Library General Public License
00018  *  along with this library; see the file COPYING.LIB.  If not, write to
00019  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  *  Boston, MA 02110-1301, USA.
00021  **/
00022 
00023 #include "kdeprintdialog.h"
00024 #ifdef Q_WS_X11
00025 #include "kcupsoptionspageswidget_p.h"
00026 #include "kcupsoptionsjobwidget_p.h"
00027 #include "kcupsoptionssettingswidget_p.h"
00028 #endif
00029 
00030 #include "kdebug.h"
00031 #include "kdialog.h"
00032 #include "klocale.h"
00033 #include "kdeversion.h"
00034 
00035 #include <fixx11h.h> // for enable-final
00036 #include <QPrintDialog>
00037 #include <QLabel>
00038 
00039 QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
00040                                           PageSelectPolicy pageSelectPolicy,
00041                                           const QList<QWidget*> &customTabs,
00042                                           QWidget *parent)
00043 {
00044     QPrintDialog *dialog = new QPrintDialog( printer, parent );
00045     // Windows and lpr don't support server side page range so default to not
00046     // showing print range in dialog, enable only for CUPS depending on Qt version.
00047     // Need to check OSX.
00048     if ( pageSelectPolicy == SystemSelectsPages ) {
00049         dialog->setOption( QAbstractPrintDialog::PrintPageRange, false);
00050     }
00051 #ifdef Q_WS_X11
00052 // Hopefully Qt 4.9 will have native support for all Cups options, Odd/Even, and page ranges
00053 #if QT_VERSION < KDE_MAKE_VERSION(4,9,0)
00054     if ( KCupsOptionsWidget::cupsAvailable() ) {
00055         KCupsOptionsPagesWidget *cupsOptionsPagesTab = new KCupsOptionsPagesWidget( dialog );
00056         KCupsOptionsJobWidget *cupsOptionsJobTab = new KCupsOptionsJobWidget( dialog );
00057         dialog->setOptionTabs( QList<QWidget*>() << cupsOptionsPagesTab << cupsOptionsJobTab << customTabs );
00058         KCupsOptionsSettingsWidget *cupsOptionsSettingsTab = new KCupsOptionsSettingsWidget( dialog );
00059         if ( pageSelectPolicy == SystemSelectsPages ) {
00060             dialog->setOption( QAbstractPrintDialog::PrintPageRange, true );
00061             cupsOptionsSettingsTab->setSystemSelectsPages( true );
00062         }
00063     } else {
00064         dialog->setOptionTabs( customTabs );
00065     }
00066 #else // Qt >= 4.9
00067     dialog->setOptionTabs( customTabs );
00068 #endif  // Qt < 4.9
00069 #else //Not X11
00070     foreach( QWidget* w, customTabs ) // reparent to avoid leaks
00071         w->setParent( dialog );
00072 #endif
00073     dialog->setWindowTitle( KDialog::makeStandardCaption( i18nc( "@title:window", "Print" ) ) );
00074     return dialog;
00075 }
00076 
00077 QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
00078                                           const QList<QWidget*> &customTabs,
00079                                           QWidget *parent)
00080 {
00081     return KdePrint::createPrintDialog(printer, KdePrint::ApplicationSelectsPages, customTabs, parent);
00082 }
00083 
00084 
00085 QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
00086                                           PageSelectPolicy pageSelectPolicy,
00087                                           QWidget *parent)
00088 {
00089     return KdePrint::createPrintDialog(printer, pageSelectPolicy, QList<QWidget*>(), parent);
00090 }
00091 
00092 QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
00093                                           QWidget *parent)
00094 {
00095     return KdePrint::createPrintDialog(printer, KdePrint::ApplicationSelectsPages, QList<QWidget*>(), parent);
00096 }

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal