From d24d427907da06b6bfb9c3eac0703ff2ef3c824f Mon Sep 17 00:00:00 2001 From: Don Sanders Date: Mon, 31 Jul 2000 11:18:26 +0000 Subject: [PATCH] --msg option wasn't working, now it does. svn path=/trunk/kdenetwork/kmail/; revision=59362 --- kmailIface.h | 4 ++-- kmkernel.cpp | 18 +++++++++--------- kmkernel.h | 4 ++-- kmversion.h | 2 +- main.cpp | 6 ++++++ 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/kmailIface.h b/kmailIface.h index d7707ee41..a860508c8 100644 --- a/kmailIface.h +++ b/kmailIface.h @@ -20,9 +20,9 @@ class KMailIface : virtual public DCOPObject k_dcop: virtual void checkMail() = 0; - virtual void openReader(KURL messageFile) = 0; + virtual void openReader() = 0; virtual int openComposer(QString to, QString cc, QString bcc, QString subject, - int hidden) = 0; + int hidden, KURL messageFile) = 0; virtual int send(int composerId, int how) = 0; //0=default,1=now,2=later virtual int addAttachment(int composerId, KURL url, QString comment) = 0; diff --git a/kmkernel.cpp b/kmkernel.cpp index bbd46d14e..1b9cd640c 100644 --- a/kmkernel.cpp +++ b/kmkernel.cpp @@ -29,6 +29,7 @@ #include "kmacctmgr.h" #include "kbusyptr.h" #include "kmaddrbook.h" +#include "kfileio.h" #include #include @@ -68,7 +69,7 @@ void KMKernel::checkMail () //might create a new reader but won mWin->slotCheckMail(); } -void KMKernel::openReader( KURL /*messageFile*/) +void KMKernel::openReader() { #warning Ugly hack! (sven) KMMainWin *mWin = 0; @@ -87,14 +88,11 @@ void KMKernel::openReader( KURL /*messageFile*/) mWin = new KMMainWin; mWin->show(); KWin::setActiveWindow(mWin->winId()); - //and "Activate" by kwin? - - //if (!messageFile.isEmpty()) - // mWin->viewMessage(messageFile); } int KMKernel::openComposer (QString to, QString cc, - QString bcc, QString subject, int hidden) + QString bcc, QString subject, int hidden, + KURL messageFile ) { debug ("KMKernel::openComposer called"); @@ -105,10 +103,12 @@ int KMKernel::openComposer (QString to, QString cc, if (!subject.isEmpty()) msg->setSubject(subject); if (!to.isEmpty()) msg->setTo(to); + if (!messageFile.isEmpty() && messageFile.isLocalFile()) + msg->setBody( kFileToString( messageFile.path(), true, false ) ); + KMComposeWin *cWin = new KMComposeWin(msg); if (hidden == 0) cWin->show(); - //return cWin->composerId() return 1; } @@ -508,9 +508,9 @@ void KMKernel::action(bool mailto, bool check, QString to, QString cc, { if (mailto) - openComposer (to, cc, bcc, subj, 0); + openComposer (to, cc, bcc, subj, 0, messageFile); else - openReader(messageFile); + openReader(); if (check) checkMail(); diff --git a/kmkernel.h b/kmkernel.h index d331a68af..651b060f5 100644 --- a/kmkernel.h +++ b/kmkernel.h @@ -37,8 +37,8 @@ public: void checkMail (); //returns id of composer if more are opened int openComposer (QString to, QString cc, QString bcc, QString subject, - int hidden); - void openReader(KURL messageFile); + int hidden, KURL messageFile); + void openReader(); int ready(); int send(int composerId, int how); //0=now, 1=later int addAttachment(int composerId, KURL url, QString comment); diff --git a/kmversion.h b/kmversion.h index 52560419c..e56f35549 100644 --- a/kmversion.h +++ b/kmversion.h @@ -3,6 +3,6 @@ #ifndef kmversion_h #define kmversion_h -#define KMAIL_VERSION "1.1.61" +#define KMAIL_VERSION "1.1.62" #endif /*kmversion_h*/ diff --git a/main.cpp b/main.cpp index 0986d5be8..a644102cd 100644 --- a/main.cpp +++ b/main.cpp @@ -154,6 +154,12 @@ int KMailApplication::newInstance() bcc = args->getOption("bcc"); } + if (args->getOption("msg")) + { + mailto = true; + messageFile = QString::fromLocal8Bit(args->getOption("msg")); + } + if (args->isSet("composer")) mailto = true;