|
|
219491 |
diff --git a/khtml/khtml_printsettings.cpp b/khtml/khtml_printsettings.cpp
|
|
|
219491 |
index 37cdb38..ab47a8e 100644
|
|
|
219491 |
--- a/khtml/khtml_printsettings.cpp
|
|
|
219491 |
+++ b/khtml/khtml_printsettings.cpp
|
|
|
219491 |
@@ -106,5 +106,19 @@ bool KHTMLPrintSettings::printHeader()
|
|
|
219491 |
return m_printheader->isChecked();
|
|
|
219491 |
}
|
|
|
219491 |
|
|
|
219491 |
+void KHTMLPrintSettings::setprintFriendly(bool b)
|
|
|
219491 |
+{
|
|
|
219491 |
+ m_printfriendly->setChecked(b);
|
|
|
219491 |
+}
|
|
|
219491 |
+
|
|
|
219491 |
+void KHTMLPrintSettings::setprintImages(bool b)
|
|
|
219491 |
+{
|
|
|
219491 |
+ m_printimages->setChecked(b);
|
|
|
219491 |
+}
|
|
|
219491 |
+
|
|
|
219491 |
+void KHTMLPrintSettings::setprintHeader(bool b)
|
|
|
219491 |
+{
|
|
|
219491 |
+ m_printheader->setChecked(b);
|
|
|
219491 |
+}
|
|
|
219491 |
|
|
|
219491 |
#include "khtml_printsettings.moc"
|
|
|
219491 |
diff --git a/khtml/khtml_printsettings.h b/khtml/khtml_printsettings.h
|
|
|
219491 |
index 0ed825e..562ace8 100644
|
|
|
219491 |
--- a/khtml/khtml_printsettings.h
|
|
|
219491 |
+++ b/khtml/khtml_printsettings.h
|
|
|
219491 |
@@ -35,6 +35,10 @@ public:
|
|
|
219491 |
bool printImages();
|
|
|
219491 |
bool printHeader();
|
|
|
219491 |
|
|
|
219491 |
+ void setprintFriendly(bool);
|
|
|
219491 |
+ void setprintImages(bool);
|
|
|
219491 |
+ void setprintHeader(bool);
|
|
|
219491 |
+
|
|
|
219491 |
private:
|
|
|
219491 |
QCheckBox *m_printfriendly;
|
|
|
219491 |
QCheckBox *m_printimages;
|
|
|
219491 |
diff --git a/khtml/khtmlview.cpp b/khtml/khtmlview.cpp
|
|
|
219491 |
index 1ac2339..6c9750e 100644
|
|
|
219491 |
--- a/khtml/khtmlview.cpp
|
|
|
219491 |
+++ b/khtml/khtmlview.cpp
|
|
|
219491 |
@@ -3031,6 +3031,14 @@ void KHTMLView::print(bool quick)
|
|
|
219491 |
if(!root) return;
|
|
|
219491 |
|
|
|
219491 |
QPointer<KHTMLPrintSettings> printSettings(new KHTMLPrintSettings); //XXX: doesn't save settings between prints like this
|
|
|
219491 |
+
|
|
|
219491 |
+ // read print settings
|
|
|
219491 |
+ KSharedConfigPtr config = KGlobal::config();
|
|
|
219491 |
+ KConfigGroup group(config, "KHTML Print Settings");
|
|
|
219491 |
+ printSettings->setprintFriendly(group.readEntry("PrintFriendly", true));
|
|
|
219491 |
+ printSettings->setprintImages(group.readEntry("PrintImages", true));
|
|
|
219491 |
+ printSettings->setprintHeader(group.readEntry("PrintHeader", true));
|
|
|
219491 |
+
|
|
|
219491 |
const QPointerDeleter settingsDeleter(printSettings); //the printdialog takes ownership of the settings widget, thus this workaround to avoid double deletion
|
|
|
219491 |
QPrinter printer;
|
|
|
219491 |
QPointer<QPrintDialog> dialog = KdePrint::createPrintDialog(&printer, KdePrint::SystemSelectsPages, QList<QWidget*>() << printSettings.data(), this);
|
|
|
219491 |
@@ -3042,6 +3050,13 @@ void KHTMLView::print(bool quick)
|
|
|
219491 |
docname = KStringHandler::csqueeze(docname, 80);
|
|
|
219491 |
|
|
|
219491 |
if(quick || (dialog->exec() && dialog)) { /*'this' and thus dialog might have been deleted while exec()!*/
|
|
|
219491 |
+ // write HTML settings
|
|
|
219491 |
+ KSharedConfigPtr config = KGlobal::config();
|
|
|
219491 |
+ KConfigGroup group(config, "KHTML Print Settings");
|
|
|
219491 |
+ group.writeEntry("PrintFriendly", printSettings->printFriendly());
|
|
|
219491 |
+ group.writeEntry("PrintImages", printSettings->printImages());
|
|
|
219491 |
+ group.writeEntry("PrintHeader", printSettings->printHeader());
|
|
|
219491 |
+
|
|
|
219491 |
viewport()->setCursor( Qt::WaitCursor ); // only viewport(), no QApplication::, otherwise we get the busy cursor in kdeprint's dialogs
|
|
|
219491 |
// set up KPrinter
|
|
|
219491 |
printer.setFullPage(false);
|