KHTML
khtml_printsettings.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "khtml_printsettings.h"
00021
00022 #include <klocale.h>
00023 #include <qcheckbox.h>
00024 #include <qlayout.h>
00025 #include <qwhatsthis.h>
00026
00027 KHTMLPrintSettings::KHTMLPrintSettings(QWidget *parent, const char *name)
00028 : KPrintDialogPage(parent, name)
00029 {
00030
00031 QString 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 QString 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 QString 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 QCheckBox(i18n("Printer friendly mode (black text, no background)"), this);
00074 QWhatsThis::add(m_printfriendly, whatsThisPrinterFriendlyMode);
00075 m_printfriendly->setChecked(true);
00076 m_printimages = new QCheckBox(i18n("Print images"), this);
00077 QWhatsThis::add(m_printimages, whatsThisPrintImages);
00078 m_printimages->setChecked(true);
00079 m_printheader = new QCheckBox(i18n("Print header"), this);
00080 QWhatsThis::add(m_printheader, whatsThisPrintHeader);
00081 m_printheader->setChecked(true);
00082
00083 QVBoxLayout *l0 = new QVBoxLayout(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 KHTMLPrintSettings::~KHTMLPrintSettings()
00091 {
00092 }
00093
00094 void KHTMLPrintSettings::getOptions(QMap<QString,QString>& opts, bool )
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 KHTMLPrintSettings::setOptions(const QMap<QString,QString>& 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 "khtml_printsettings.moc"