tdehtml_printsettings.cpp
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2002 Michael Goffioul <tdeprint@swing.be> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 **/ 00019 00020 #include "tdehtml_printsettings.h" 00021 00022 #include <tdelocale.h> 00023 #include <tqcheckbox.h> 00024 #include <tqlayout.h> 00025 #include <tqwhatsthis.h> 00026 00027 TDEHTMLPrintSettings::TDEHTMLPrintSettings(TQWidget *parent, const char *name) 00028 : KPrintDialogPage(parent, name) 00029 { 00030 //WhatsThis strings.... (added by pfeifle@kde.org) 00031 TQString whatsThisPrintImages = i18n( "<qt>" 00032 "<p><strong>'Print images'</strong></p>" 00033 "<p>" 00034 "If this checkbox is enabled, images contained in the HTML page will " 00035 "be printed. Printing may take longer and use more ink or toner." 00036 "</p>" 00037 "<p>" 00038 "If this checkbox is disabled, only the text of the HTML page will be " 00039 "printed, without the included images. Printing will be faster and use " 00040 "less ink or toner." 00041 "</p>" 00042 " </qt>" ); 00043 TQString whatsThisPrintHeader = i18n( "<qt>" 00044 "<p><strong>'Print header'</strong></p>" 00045 "<p>" 00046 "If this checkbox is enabled, the printout of the HTML document will " 00047 "contain a header line at the top of each page. This header contains " 00048 "the current date, the location URL of the printed page and the page " 00049 "number." 00050 "</p>" 00051 "<p>" 00052 "If this checkbox is disabled, the printout of the HTML document will " 00053 "not contain such a header line." 00054 "</p>" 00055 " </qt>" ); 00056 TQString whatsThisPrinterFriendlyMode = i18n( "<qt>" 00057 "<p><strong>'Printerfriendly mode'</strong></p>" 00058 "<p>" 00059 "If this checkbox is enabled, the printout of the HTML document will " 00060 "be black and white only, and all colored background will be converted " 00061 "into white. Printout will be faster and use less ink or toner." 00062 "</p>" 00063 "<p>" 00064 "If this checkbox is disabled, the printout of the HTML document will " 00065 "happen in the original color settings as you see in your application. " 00066 "This may result in areas of full-page color (or grayscale, if you use " 00067 "a black+white printer). Printout will possibly happen slower and will " 00068 "certainly use much more toner or ink." 00069 "</p>" 00070 " </qt>" ); 00071 setTitle(i18n("HTML Settings")); 00072 00073 m_printfriendly = new TQCheckBox(i18n("Printer friendly mode (black text, no background)"), this); 00074 TQWhatsThis::add(m_printfriendly, whatsThisPrinterFriendlyMode); 00075 m_printfriendly->setChecked(true); 00076 m_printimages = new TQCheckBox(i18n("Print images"), this); 00077 TQWhatsThis::add(m_printimages, whatsThisPrintImages); 00078 m_printimages->setChecked(true); 00079 m_printheader = new TQCheckBox(i18n("Print header"), this); 00080 TQWhatsThis::add(m_printheader, whatsThisPrintHeader); 00081 m_printheader->setChecked(true); 00082 00083 TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, 10); 00084 l0->addWidget(m_printfriendly); 00085 l0->addWidget(m_printimages); 00086 l0->addWidget(m_printheader); 00087 l0->addStretch(1); 00088 } 00089 00090 TDEHTMLPrintSettings::~TDEHTMLPrintSettings() 00091 { 00092 } 00093 00094 void TDEHTMLPrintSettings::getOptions(TQMap<TQString,TQString>& opts, bool /*incldef*/) 00095 { 00096 opts["app-khtml-printfriendly"] = (m_printfriendly->isChecked() ? "true" : "false"); 00097 opts["app-khtml-printimages"] = (m_printimages->isChecked() ? "true" : "false"); 00098 opts["app-khtml-printheader"] = (m_printheader->isChecked() ? "true" : "false"); 00099 } 00100 00101 void TDEHTMLPrintSettings::setOptions(const TQMap<TQString,TQString>& opts) 00102 { 00103 m_printfriendly->setChecked(opts["app-khtml-printfriendly"] != "false"); 00104 m_printimages->setChecked(opts["app-khtml-printimages"] != "false"); 00105 m_printheader->setChecked(opts["app-khtml-printheader"] != "false"); 00106 } 00107 00108 #include "tdehtml_printsettings.moc"