Bug 142483 - Shift-R (Blank Reply) includes quote header.
Summary: Shift-R (Blank Reply) includes quote header.
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: templates (show other bugs)
Version: 1.9.6
Platform: Mandriva RPMs Linux
: NOR normal with 10 votes (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-04 00:06 UTC by Jonathan Hutchins
Modified: 2007-08-15 14:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Hutchins 2007-03-04 00:06:55 UTC
Version:           1.9.6 (using KDE KDE 3.5.6)
Installed from:    Mandriva RPMs

When using Shift-R to generate a blank reply, no text is quoted, but the quote header ("On Saturday 03 March 2007 12:29:52 pm you wrote:") is still inserted on the blank message.

This appears to be new to 1.9.6.
Comment 1 Thomas McGuire 2007-03-04 12:59:23 UTC
I can confirm this. I guess this is related to the new template functionality. 
Comment 2 Thomas McGuire 2007-07-17 13:39:01 UTC
Mass-changing component to "templates" and adding original template author to 
CC list.
Comment 3 Thomas McGuire 2007-08-15 14:22:20 UTC
SVN commit 700384 by tmcguire:

Make blank replys (Shift+R) work again.
Instead of skipping some template tags like QUOTE or HEADERS, now the whole
template is skipped when doing a blank reply.

BUG: 142483

 M  +2 -2      kmcommands.cpp  
 M  +1 -1      kmfilteraction.cpp  
 M  +6 -6      kmkernel.cpp  
 M  +4 -4      kmmainwidget.cpp  
 M  +15 -8     kmmessage.cpp  
 M  +7 -7      templateparser.cpp  
 M  +1 -2      templateparser.h  


--- trunk/KDE/kdepim/kmail/kmcommands.cpp #700383:700384
@@ -1314,7 +1314,7 @@
       {
 	KMMessage *msg = *it;
 	TemplateParser parser( fwdMsg, TemplateParser::Forward,
-			       msg->body(), false, false, false, false);
+			       msg->body(), false, false, false );
         parser.process( msg, 0, true );
 
         fwdMsg->link( (*it), MessageStatus::statusForwarded() );
@@ -1539,7 +1539,7 @@
     {
       KMMessage *msg = *it;
       TemplateParser parser( fwdMsg, TemplateParser::Forward,
-        msg->body(), false, false, false, false);
+        msg->body(), false, false, false );
         parser.process( msg, 0, true );
 
       fwdMsg->link( msg, MessageStatus::statusForwarded() );
--- trunk/KDE/kdepim/kmail/kmfilteraction.cpp #700383:700384
@@ -1475,7 +1475,7 @@
 
   // QString st = QString::fromUtf8( aMsg->createForwardBody() );
   TemplateParser parser( msg, TemplateParser::Forward,
-			 aMsg->body(), false, false, false, false);
+                         aMsg->body(), false, false, false);
   parser.process( aMsg );
 
   QByteArray
--- trunk/KDE/kdepim/kmail/kmkernel.cpp #700383:700384
@@ -393,7 +393,7 @@
     }
     else {
       TemplateParser parser( msg, TemplateParser::NewMessage,
-			     "", false, false, false, false );
+                             QString(), false, false, false );
       parser.process( NULL, NULL );
     }
   }
@@ -402,7 +402,7 @@
   }
   else {
     TemplateParser parser( msg, TemplateParser::NewMessage,
-			   "", false, false, false, false );
+                           QString(), false, false, false );
     parser.process( NULL, NULL );
   }
 
@@ -464,7 +464,7 @@
     msg->setBody(body.toUtf8());
   } else {
     TemplateParser parser( msg, TemplateParser::NewMessage,
-      "", false, false, false, false );
+                           QString(), false, false, false );
     parser.process( NULL, NULL );
   }
 
@@ -565,7 +565,7 @@
     msg->setBody(body.toUtf8());
   } else {
     TemplateParser parser( msg, TemplateParser::NewMessage,
-			   "", false, false, false, false );
+                           QString(), false, false, false );
     parser.process( NULL, NULL );
   }
 
@@ -615,12 +615,12 @@
 
   if ( useFolderId ) {
     TemplateParser parser( msg, TemplateParser::NewMessage,
-      "", false, false, false, false );
+                           QString(), false, false, false );
     parser.process( NULL, folder );
     win = makeComposer( msg, id );
   } else {
     TemplateParser parser( msg, TemplateParser::NewMessage,
-      "", false, false, false, false );
+                           QString(), false, false, false );
     parser.process( NULL, NULL );
     win = makeComposer( msg );
   }
--- trunk/KDE/kdepim/kmail/kmmainwidget.cpp #700383:700384
@@ -1003,13 +1003,13 @@
   if ( mFolder ) {
       msg->initHeader( mFolder->identity() );
       TemplateParser parser( msg, TemplateParser::NewMessage,
-			     "", false, false, false, false );
+                             QString(), false, false, false );
       parser.process( NULL, mFolder );
       win = KMail::makeComposer( msg, mFolder->identity() );
   } else {
       msg->initHeader();
       TemplateParser parser( msg, TemplateParser::NewMessage,
-			     "", false, false, false, false );
+                             QString(), false, false, false );
       parser.process( NULL, NULL );
       win = KMail::makeComposer( msg );
   }
@@ -1583,7 +1583,7 @@
 
   QString text = mMsgView? mMsgView->copyText() : "";
   KMCommand *command = new KMReplyListCommand( this, mHeaders->currentMsg(),
-					       text );
+                                               text );
   command->start();
 }
 
@@ -3091,7 +3091,7 @@
   mFilterMenu = new KActionMenu(KIcon("search-filter"), i18n("&Create Filter"), this);
   actionCollection()->addAction("create_filter", mFilterMenu );
   connect( mFilterMenu, SIGNAL(activated()), this,
-	   SLOT(slotFilter()) );
+           SLOT(slotFilter()) );
   mSubjectFilterAction = new KAction(i18n("Filter on &Subject..."), this);
   actionCollection()->addAction("subject_filter", mSubjectFilterAction );
   connect(mSubjectFilterAction, SIGNAL(triggered(bool) ), SLOT(slotSubjectFilter()));
--- trunk/KDE/kdepim/kmail/kmmessage.cpp #700383:700384
@@ -1045,10 +1045,15 @@
 
   msg->setSubject( replySubject() );
 
-  TemplateParser parser( msg, (replyAll ? TemplateParser::ReplyAll : TemplateParser::Reply),
-                         selection, sSmartQuote, noQuote, allowDecryption, selectionIsBody );
-  if ( !tmpl.isEmpty() ) parser.process( tmpl, this );
-  else parser.process( this );
+  // If the reply shouldn't be blank, apply the template to the message
+  if ( !noQuote ) {
+    TemplateParser parser( msg, (replyAll ? TemplateParser::ReplyAll : TemplateParser::Reply),
+                           selection, sSmartQuote, allowDecryption, selectionIsBody );
+    if ( !tmpl.isEmpty() )
+      parser.process( tmpl, this );
+    else
+      parser.process( this );
+  }
 
   msg->link( this, MessageStatus::statusReplied() );
 
@@ -1264,10 +1269,12 @@
   msg->setSubject( forwardSubject() );
 
   TemplateParser parser( msg, TemplateParser::Forward,
-    asPlainText( false, false ),
-    false, false, false, false);
-  if ( !tmpl.isEmpty() ) parser.process( tmpl, this );
-  else parser.process( this );
+                         asPlainText( false, false ),
+                         false, false, false);
+  if ( !tmpl.isEmpty() )
+    parser.process( tmpl, this );
+  else
+    parser.process( this );
 
   // QByteArray encoding = autoDetectCharset(charset(), sPrefCharsets, msg->body());
   // if (encoding.isEmpty()) encoding = "utf-8";
--- trunk/KDE/kdepim/kmail/templateparser.cpp #700383:700384
@@ -51,10 +51,10 @@
 
 TemplateParser::TemplateParser( KMMessage *amsg, const Mode amode,
                                 const QString &aselection,
-                                bool asmartQuote, bool anoQuote,
-                                bool aallowDecryption, bool aselectionIsBody ) :
+                                bool asmartQuote, bool aallowDecryption,
+                                bool aselectionIsBody ) :
   mMode( amode ), mFolder( 0 ), mIdentity( 0 ), mSelection( aselection ),
-  mSmartQuote( asmartQuote ), mNoQuote( anoQuote ),
+  mSmartQuote( asmartQuote ),
   mAllowDecryption( aallowDecryption ), mSelectionIsBody( aselectionIsBody ),
   mDebug( false ), mQuoteString( "> " ), mAppend( false )
 {
@@ -282,7 +282,7 @@
         int len = parseQuotes( "QUOTEPIPE=", cmd, q );
         i += len;
         QString pipe_cmd = q;
-        if ( mOrigMsg && !mNoQuote ) {
+        if ( mOrigMsg ) {
           QString str = pipe( pipe_cmd, mSelection );
           QString quote = mOrigMsg->asQuotedString( "", mQuoteString, str,
                                                     mSmartQuote, mAllowDecryption );
@@ -292,7 +292,7 @@
       } else if ( cmd.startsWith( "QUOTE" ) ) {
         kDebug(5006) <<"Command: QUOTE";
         i += strlen( "QUOTE" );
-        if ( mOrigMsg && !mNoQuote ) {
+        if ( mOrigMsg ) {
           QString quote = mOrigMsg->asQuotedString( "", mQuoteString, mSelection,
                                                     mSmartQuote, mAllowDecryption );
           body.append( quote );
@@ -301,7 +301,7 @@
       } else if ( cmd.startsWith( "QHEADERS" ) ) {
         kDebug(5006) <<"Command: QHEADERS";
         i += strlen( "QHEADERS" );
-        if ( mOrigMsg && !mNoQuote ) {
+        if ( mOrigMsg ) {
           QString quote = mOrigMsg->asQuotedString( "", mQuoteString,
                                                     mOrigMsg->headerAsSendableString(),
                                                     mSmartQuote, false );
@@ -311,7 +311,7 @@
       } else if ( cmd.startsWith( "HEADERS" ) ) {
         kDebug(5006) <<"Command: HEADERS";
         i += strlen( "HEADERS" );
-        if ( mOrigMsg && !mNoQuote ) {
+        if ( mOrigMsg ) {
           QString str = mOrigMsg->headerAsSendableString();
           body.append( str );
         }
--- trunk/KDE/kdepim/kmail/templateparser.h #700383:700384
@@ -44,7 +44,7 @@
 
   public:
     TemplateParser( KMMessage *amsg, const Mode amode, const QString &aselection,
-                    bool aSmartQuote, bool anoQuote, bool aallowDecryption,
+                    bool aSmartQuote, bool aallowDecryption,
                     bool aselectionIsBody );
 
     virtual void process( KMMessage *aorig_msg, KMFolder *afolder = NULL, bool append = false );
@@ -66,7 +66,6 @@
     KMMessage *mOrigMsg;
     QString mSelection;
     bool mSmartQuote;
-    bool mNoQuote;
     bool mAllowDecryption;
     bool mSelectionIsBody;
     bool mDebug;