summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kmail/kmcommands.cpp17
-rw-r--r--kmail/kmcomposewin.cpp17
-rw-r--r--kmail/kmmessage.cpp7
-rw-r--r--kmail/kmmessage.h8
4 files changed, 45 insertions, 4 deletions
diff --git a/kmail/kmcommands.cpp b/kmail/kmcommands.cpp
index e3be3b11..d4fead48 100644
--- a/kmail/kmcommands.cpp
+++ b/kmail/kmcommands.cpp
@@ -1115,7 +1115,22 @@ KMCommand::Result KMReplyToCommand::execute()
if ( !msg || !msg->codec() ) {
return Failed;
}
- KMMessage *reply = msg->createReply( KMail::ReplySmart, mSelection );
+
+ // Find the account that held the original message
+ TQString accountName;
+ KMFolder* parentFolder = msg->parent();
+ if (parentFolder) {
+ KMFolderDir* parentFolderDir = parentFolder->parent();
+ while (parentFolderDir) {
+ TQString prettyURL = parentFolderDir->prettyURL();
+ if (prettyURL != "") {
+ accountName = prettyURL;
+ }
+ parentFolderDir = parentFolderDir->parent();
+ }
+ }
+
+ KMMessage *reply = msg->createReply( KMail::ReplySmart, mSelection, false, true, TQString(), accountName );
KMail::Composer * win = KMail::makeComposer( reply );
win->setCharset( msg->codec()->mimeName(), true );
win->setReplyFocus();
diff --git a/kmail/kmcomposewin.cpp b/kmail/kmcomposewin.cpp
index d7e96b26..27a76c72 100644
--- a/kmail/kmcomposewin.cpp
+++ b/kmail/kmcomposewin.cpp
@@ -1980,8 +1980,23 @@ void KMComposeWin::setMsg(KMMessage* newMsg, bool mayAutoSign,
TQString transport = newMsg->headerField("X-KMail-Transport");
const bool stickyTransport = mBtnTransport->isChecked() && !mIgnoreStickyFields;
- if (!stickyTransport && !transport.isEmpty())
+ if (!stickyTransport && !transport.isEmpty()) {
setTransport( transport );
+ }
+
+ // If we are using the default transport, and the originating account name of the original message matches the name of a valid transport, use setTransport() to set it
+ // See Bug 1239
+ if (transport.isEmpty() && !mMsg->originatingAccountName().isEmpty()) {
+ TQString transportCandidate = mMsg->originatingAccountName();
+ bool transportFound = false;
+ for ( int i = 0; i < mTransport->count(); ++i ) {
+ if ( mTransport->text(i) == transportCandidate ) {
+ transportFound = true;
+ setTransport(transportCandidate);
+ break;
+ }
+ }
+ }
if (!mBtnFcc->isChecked())
{
diff --git a/kmail/kmmessage.cpp b/kmail/kmmessage.cpp
index ba8fba5a..c33fdf6a 100644
--- a/kmail/kmmessage.cpp
+++ b/kmail/kmmessage.cpp
@@ -867,7 +867,8 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
TQString selection /* = TQString() */,
bool noQuote /* = false */,
bool allowDecryption /* = true */,
- const TQString &tmpl /* = TQString() */ )
+ const TQString &tmpl /* = TQString() */,
+ const TQString &originatingAccount /* = TQString() */ )
{
KMMessage* msg = new KMMessage;
TQString mailingListStr, replyToStr, toStr;
@@ -1048,6 +1049,10 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
}
}
+ if (!originatingAccount.isEmpty()) {
+ msg->setOriginatingAccountName(originatingAccount);
+ }
+
msg->setTo(toStr);
refStr = getRefStr();
diff --git a/kmail/kmmessage.h b/kmail/kmmessage.h
index a1600657..3a61a11f 100644
--- a/kmail/kmmessage.h
+++ b/kmail/kmmessage.h
@@ -164,7 +164,8 @@ public:
KMMessage* createReply( KMail::ReplyStrategy replyStrategy = KMail::ReplySmart,
TQString selection=TQString(), bool noQuote = false,
bool allowDecryption = true,
- const TQString &tmpl = TQString() );
+ const TQString &tmpl = TQString(),
+ const TQString &originatingAccount = TQString() );
/** Create a new message that is a redirect to this message, filling all
required header fields with the proper values. The returned message
@@ -802,6 +803,10 @@ public:
TQString fileName() const { return mFileName; }
void setFileName(const TQString& file) { if(mFileName != file) { mFileName=file; setDirty(true); } }
+ /** Get/set originating account name. */
+ TQString originatingAccountName() const { return mOriginatingAccountName; }
+ void setOriginatingAccountName(const TQString& account) { if(mOriginatingAccountName != account) { mOriginatingAccountName=account; setDirty(true); } }
+
/** Get/set size of message in the folder including the whole header in
bytes. Can be 0, if the message is not in a folder.
The setting of mMsgSize = mMsgLength = sz is needed for popFilter*/
@@ -960,6 +965,7 @@ private:
const TQTextCodec * mOverrideCodec;
TQString mFileName;
+ TQString mOriginatingAccountName;
off_t mFolderOffset;
size_t mMsgSize, mMsgLength;
time_t mDate;