If a message is replied to from an incoming account, and an outgoing account is available with the same name, set that outgoing account as the default transport

This resolves Bug 1239
pull/21/head
Timothy Pearson 12 years ago
parent e4cc0ead9f
commit f1f9c9b90c

@ -1115,7 +1115,22 @@ KMCommand::Result KMReplyToCommand::execute()
if ( !msg || !msg->codec() ) { if ( !msg || !msg->codec() ) {
return Failed; 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 ); KMail::Composer * win = KMail::makeComposer( reply );
win->setCharset( msg->codec()->mimeName(), true ); win->setCharset( msg->codec()->mimeName(), true );
win->setReplyFocus(); win->setReplyFocus();

@ -1980,8 +1980,23 @@ void KMComposeWin::setMsg(KMMessage* newMsg, bool mayAutoSign,
TQString transport = newMsg->headerField("X-KMail-Transport"); TQString transport = newMsg->headerField("X-KMail-Transport");
const bool stickyTransport = mBtnTransport->isChecked() && !mIgnoreStickyFields; const bool stickyTransport = mBtnTransport->isChecked() && !mIgnoreStickyFields;
if (!stickyTransport && !transport.isEmpty()) if (!stickyTransport && !transport.isEmpty()) {
setTransport( transport ); 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()) if (!mBtnFcc->isChecked())
{ {

@ -867,7 +867,8 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
TQString selection /* = TQString() */, TQString selection /* = TQString() */,
bool noQuote /* = false */, bool noQuote /* = false */,
bool allowDecryption /* = true */, bool allowDecryption /* = true */,
const TQString &tmpl /* = TQString() */ ) const TQString &tmpl /* = TQString() */,
const TQString &originatingAccount /* = TQString() */ )
{ {
KMMessage* msg = new KMMessage; KMMessage* msg = new KMMessage;
TQString mailingListStr, replyToStr, toStr; TQString mailingListStr, replyToStr, toStr;
@ -1048,6 +1049,10 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
} }
} }
if (!originatingAccount.isEmpty()) {
msg->setOriginatingAccountName(originatingAccount);
}
msg->setTo(toStr); msg->setTo(toStr);
refStr = getRefStr(); refStr = getRefStr();

@ -164,7 +164,8 @@ public:
KMMessage* createReply( KMail::ReplyStrategy replyStrategy = KMail::ReplySmart, KMMessage* createReply( KMail::ReplyStrategy replyStrategy = KMail::ReplySmart,
TQString selection=TQString(), bool noQuote = false, TQString selection=TQString(), bool noQuote = false,
bool allowDecryption = true, 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 /** Create a new message that is a redirect to this message, filling all
required header fields with the proper values. The returned message required header fields with the proper values. The returned message
@ -802,6 +803,10 @@ public:
TQString fileName() const { return mFileName; } TQString fileName() const { return mFileName; }
void setFileName(const TQString& file) { if(mFileName != file) { mFileName=file; setDirty(true); } } 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 /** 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. bytes. Can be 0, if the message is not in a folder.
The setting of mMsgSize = mMsgLength = sz is needed for popFilter*/ The setting of mMsgSize = mMsgLength = sz is needed for popFilter*/
@ -960,6 +965,7 @@ private:
const TQTextCodec * mOverrideCodec; const TQTextCodec * mOverrideCodec;
TQString mFileName; TQString mFileName;
TQString mOriginatingAccountName;
off_t mFolderOffset; off_t mFolderOffset;
size_t mMsgSize, mMsgLength; size_t mMsgSize, mMsgLength;
time_t mDate; time_t mDate;

Loading…
Cancel
Save