[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#446912: Acknowledgement (Printing ignores changes in the header style until the program is restarted, and ignores them completely if the message pane is hidden.)



  The attached patch clears up this issue for me.  It extends
KMPrintCommand to close over the header formatting options of the
message when it's created and to restore them before printing.

  Daniel
diff -x'Makefile*' -ru /tmp/kmail.orig/kmcommands.cpp kmail/kmcommands.cpp
--- /tmp/kmail.orig/kmcommands.cpp	2007-10-16 09:07:38.000000000 -0700
+++ kmail/kmcommands.cpp	2007-10-16 09:55:42.000000000 -0700
@@ -1558,9 +1558,14 @@
 
 
 KMPrintCommand::KMPrintCommand( QWidget *parent,
-  KMMessage *msg, bool htmlOverride, bool htmlLoadExtOverride,
-  bool useFixedFont, const QString & encoding )
-  : KMCommand( parent, msg ), mHtmlOverride( htmlOverride ),
+				KMMessage *msg,
+				const KMail::HeaderStyle * headerStyle,
+				const KMail::HeaderStrategy * headerStrategy,
+				bool htmlOverride, bool htmlLoadExtOverride,
+				bool useFixedFont, const QString & encoding )
+  : KMCommand( parent, msg ),
+    mHeaderStyle(headerStyle), mHeaderStrategy(headerStrategy),
+    mHtmlOverride( htmlOverride ),
     mHtmlLoadExtOverride( htmlLoadExtOverride ),
     mUseFixedFont( useFixedFont ), mEncoding( encoding )
 {
@@ -1571,6 +1576,8 @@
   KMReaderWin printWin( 0, 0, 0 );
   printWin.setPrinting( true );
   printWin.readConfig();
+  if(mHeaderStyle != NULL && mHeaderStrategy != NULL)
+    printWin.setHeaderStyleAndStrategy(mHeaderStyle, mHeaderStrategy);
   printWin.setHtmlOverride( mHtmlOverride );
   printWin.setHtmlLoadExtOverride( mHtmlLoadExtOverride );
   printWin.setUseFixedFont( mUseFixedFont );
diff -x'Makefile*' -ru /tmp/kmail.orig/kmcommands.h kmail/kmcommands.h
--- /tmp/kmail.orig/kmcommands.h	2007-10-16 09:07:39.000000000 -0700
+++ kmail/kmcommands.h	2007-10-16 10:23:08.000000000 -0700
@@ -31,6 +31,8 @@
 namespace KMail {
   class Composer;
   class FolderJob;
+  class HeaderStyle;
+  class HeaderStrategy;
 }
 namespace GpgME { class Error; }
 namespace Kleo { class SpecialJob; }
@@ -593,8 +595,8 @@
 
 public:
   KMPrintCommand( QWidget *parent, KMMessage *msg,
-		  const KMail::HeaderStyle * style,
-		  const KMail::HeaderStrategy * strategy,
+		  const KMail::HeaderStyle * headerStyle = NULL,
+		  const KMail::HeaderStrategy * headerStrategy = NULL,
                   bool htmlOverride=false,
                   bool htmlLoadExtOverride=false,
                   bool useFixedFont = false,
@@ -603,6 +605,9 @@
 private:
   virtual Result execute();
 
+  const KMail::HeaderStyle * mHeaderStyle;
+  const KMail::HeaderStrategy * mHeaderStrategy;
+
   bool mHtmlOverride;
   bool mHtmlLoadExtOverride;
   bool mUseFixedFont;
diff -x'Makefile*' -ru /tmp/kmail.orig/kmmainwidget.cpp kmail/kmmainwidget.cpp
--- /tmp/kmail.orig/kmmainwidget.cpp	2007-10-16 09:07:38.000000000 -0700
+++ kmail/kmmainwidget.cpp	2007-10-16 09:58:10.000000000 -0700
@@ -1760,6 +1760,7 @@
                                : reader.readBoolEntry( "useFixedFont", false );
   KMCommand *command =
     new KMPrintCommand( this, mHeaders->currentMsg(),
+			mMsgView->headerStyle(), mMsgView->headerStrategy(),
                         htmlOverride, htmlLoadExtOverride,
                         useFixedFont, overrideEncoding() );
   command->start();
diff -x'Makefile*' -ru /tmp/kmail.orig/kmreadermainwin.cpp kmail/kmreadermainwin.cpp
--- /tmp/kmail.orig/kmreadermainwin.cpp	2007-10-16 09:07:39.000000000 -0700
+++ kmail/kmreadermainwin.cpp	2007-10-16 09:56:54.000000000 -0700
@@ -181,6 +181,7 @@
 void KMReaderMainWin::slotPrintMsg()
 {
   KMCommand *command = new KMPrintCommand( this, mReaderWin->message(),
+      mReaderWin->headerStyle(), mReaderWin->headerStrategy(),
       mReaderWin->htmlOverride(), mReaderWin->htmlLoadExtOverride(),
       mReaderWin->isFixedFont(), mReaderWin->overrideEncoding() );
   command->start();

Reply to: