Blame SOURCES/kdelibs-4.3.4-bz#587016.patch

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