File indexing completed on 2024-04-21 14:58:55

0001 /*
0002  *  This file is part of the KDE libraries
0003  *  Copyright (c) 2002 Michael Goffioul <kdeprint@swing.be>
0004  *
0005  *  This library is free software; you can redistribute it and/or
0006  *  modify it under the terms of the GNU Library General Public
0007  *  License version 2 as published by the Free Software Foundation.
0008  *
0009  *  This library is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  *  Library General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU Library General Public License
0015  *  along with this library; see the file COPYING.LIB.  If not, write to
0016  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  *  Boston, MA 02110-1301, USA.
0018  **/
0019 
0020 #include "khtml_printsettings.h"
0021 
0022 #include <klocalizedstring.h>
0023 #include <QCheckBox>
0024 #include <QLayout>
0025 
0026 KHTMLPrintSettings::KHTMLPrintSettings(QWidget *parent)
0027     : QWidget(parent)
0028 {
0029     //WhatsThis strings.... (added by pfeifle@kde.org)
0030     QString whatsThisPrintImages = i18n("<qt>"
0031                                         "<p><strong>'Print images'</strong></p>"
0032                                         "<p>"
0033                                         "If this checkbox is enabled, images contained in the HTML page will "
0034                                         "be printed. Printing may take longer and use more ink or toner."
0035                                         "</p>"
0036                                         "<p>"
0037                                         "If this checkbox is disabled, only the text of the HTML page will be "
0038                                         "printed, without the included images. Printing will be faster and use "
0039                                         "less ink or toner."
0040                                         "</p>"
0041                                         " </qt>");
0042     QString whatsThisPrintHeader = i18n("<qt>"
0043                                         "<p><strong>'Print header'</strong></p>"
0044                                         "<p>"
0045                                         "If this checkbox is enabled, the printout of the HTML document will "
0046                                         "contain a header line at the top of each page. This header contains "
0047                                         "the current date, the location URL of the printed page and the page "
0048                                         "number."
0049                                         "</p>"
0050                                         "<p>"
0051                                         "If this checkbox is disabled, the printout of the HTML document will "
0052                                         "not contain such a header line."
0053                                         "</p>"
0054                                         " </qt>");
0055     QString whatsThisPrinterFriendlyMode = i18n("<qt>"
0056                                            "<p><strong>'Printerfriendly mode'</strong></p>"
0057                                            "<p>"
0058                                            "If this checkbox is enabled, the printout of the HTML document will "
0059                                            "be black and white only, and all colored background will be converted "
0060                                            "into white. Printout will be faster and use less ink or toner."
0061                                            "</p>"
0062                                            "<p>"
0063                                            "If this checkbox is disabled, the printout of the HTML document will "
0064                                            "happen in the original color settings as you see in your application. "
0065                                            "This may result in areas of full-page color (or grayscale, if you use "
0066                                            "a black+white printer). Printout will possibly happen more slowly and "
0067                                            "will probably use more toner or ink."
0068                                            "</p>"
0069                                            " </qt>");
0070     setWindowTitle(i18n("HTML Settings"));
0071 
0072     m_printfriendly = new QCheckBox(i18n("Printer friendly mode (black text, no background)"), this);
0073     m_printfriendly->setWhatsThis(whatsThisPrinterFriendlyMode);
0074     m_printfriendly->setChecked(true);
0075     m_printimages = new QCheckBox(i18n("Print images"), this);
0076     m_printimages->setWhatsThis(whatsThisPrintImages);
0077     m_printimages->setChecked(true);
0078     m_printheader = new QCheckBox(i18n("Print header"), this);
0079     m_printheader->setWhatsThis(whatsThisPrintHeader);
0080     m_printheader->setChecked(true);
0081 
0082     QVBoxLayout *l0 = new QVBoxLayout(this);
0083     l0->addWidget(m_printfriendly);
0084     l0->addWidget(m_printimages);
0085     l0->addWidget(m_printheader);
0086     l0->addStretch(1);
0087 }
0088 
0089 KHTMLPrintSettings::~KHTMLPrintSettings()
0090 {
0091 }
0092 
0093 bool KHTMLPrintSettings::printFriendly()
0094 {
0095     return m_printfriendly->isChecked();
0096 }
0097 
0098 bool KHTMLPrintSettings::printImages()
0099 {
0100     return m_printimages->isChecked();
0101 }
0102 
0103 bool KHTMLPrintSettings::printHeader()
0104 {
0105     return m_printheader->isChecked();
0106 }
0107 
0108 #include "moc_khtml_printsettings.cpp"