[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [PATCH] for Bug 135461: command line parameter --header is ignored
From:       Andreas Gungl <Andreas.Gungl () osp-dd ! de>
Date:       2006-10-11 14:55:27
Message-ID: 200610111655.27922 () osp-dd ! de
[Download RAW message or body]

Hello, 

I've come across this issue and found it unimplemented. Attached is the 
patch for the 3.5 branch. Please review.
If nobody objects until Friday morning, I'll commit the change and port it 
to trunk.

Andreas

["kmail-header-arguments.diff" (text/x-diff)]

Index: kmkernel.cpp
===================================================================
--- kmkernel.cpp	(revision 593826)
+++ kmkernel.cpp	(working copy)
@@ -192,6 +192,7 @@
 bool KMKernel::handleCommandLine( bool noArgsOpensReader )
 {
   QString to, cc, bcc, subj, body;
+  QCStringList customHeaders;
   KURL messageFile;
   KURL::List attachURLs;
   bool mailto = false;
@@ -252,6 +253,8 @@
          attachURLs += KURL( QString::fromLocal8Bit( *it ) );
   }
 
+  customHeaders = args->getOptionList("header");
+
   if (args->isSet("composer"))
     mailto = true;
 
@@ -302,7 +305,7 @@
     viewMessage( messageFile );
   else
     action( mailto, checkMail, to, cc, bcc, subj, body, messageFile,
-            attachURLs );
+            attachURLs, customHeaders );
   return true;
 }
 
@@ -366,7 +369,8 @@
                             const QString &bcc, const QString &subject,
                             const QString &body, int hidden,
                             const KURL &messageFile,
-                            const KURL::List &attachURLs)
+                            const KURL::List &attachURLs,
+                            const QCStringList &customHeaders)
 {
   kdDebug(5006) << "KMKernel::openComposer called" << endl;
   KMMessage *msg = new KMMessage;
@@ -389,6 +393,23 @@
   else if (!body.isEmpty())
     msg->setBody(body.utf8());
 
+  if (!customHeaders.isEmpty())
+  {
+    for ( QCStringList::ConstIterator it = customHeaders.begin() ; it != customHeaders.end() ; ++it )
+      if ( !(*it).isEmpty() )
+      {
+        int pos = (*it).find( ':' );
+        if ( pos > 0 )
+        {
+          QCString header, value;
+          header = (*it).left( pos ); header = header.stripWhiteSpace();
+          value = (*it).mid( pos+1 ); value  = value.stripWhiteSpace();
+          if ( header.length() && value.length() )
+            msg->setHeaderField( header, value );
+        }
+      }
+  }
+
   KMail::Composer * cWin = KMail::makeComposer( msg );
   cWin->setCharset("", TRUE);
   for ( KURL::List::ConstIterator it = attachURLs.begin() ; it != attachURLs.end() ; ++it )
@@ -1802,14 +1823,15 @@
                       const QString &cc, const QString &bcc,
                       const QString &subj, const QString &body,
                       const KURL &messageFile,
-                      const KURL::List &attachURLs)
+                      const KURL::List &attachURLs,
+                      const QCStringList &customHeaders)
 {
-  if (mailto)
-    openComposer (to, cc, bcc, subj, body, 0, messageFile, attachURLs);
+  if ( mailto )
+    openComposer( to, cc, bcc, subj, body, 0, messageFile, attachURLs, customHeaders );
   else
     openReader( check );
 
-  if (check)
+  if ( check )
     checkMail();
   //Anything else?
 }


_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic