Get rid of some unused, pre-template stuff.

svn path=/trunk/KDE/kdepim/; revision=866598
wilder-work
Thomas McGuire 18 years ago
parent e597473890
commit a51f770771
  1. 2
      kmcommands.cpp
  2. 1
      kmfilteraction.cpp
  3. 108
      kmmessage.cpp
  4. 30
      kmmessage.h
  5. 6
      templateparser.cpp
  6. 7
      templatesconfiguration_base.ui

@ -1306,7 +1306,6 @@ KMCommand::Result KMForwardCommand::execute()
if (id == 0)
id = (*it)->headerField("X-KMail-Identity").trimmed().toUInt();
// msgText += (*it)->createForwardBody();
linklist.append( (*it) );
}
if ( id == 0 )
@ -1527,7 +1526,6 @@ KMCommand::Result KMCustomForwardCommand::execute()
if (id == 0)
id = msg->headerField( "X-KMail-Identity" ).trimmed().toUInt();
// msgText += msg->createForwardBody();
linklist.append( msg );
}
if ( id == 0 )

@ -1481,7 +1481,6 @@ KMFilterAction::ReturnCode KMFilterActionForward::process( KMMessage *aMsg ) con
msg->initFromMessage( aMsg );
// QString st = QString::fromUtf8( aMsg->createForwardBody() );
TemplateParser parser( msg, TemplateParser::Forward,
aMsg->body(), false, false, false);
parser.process( aMsg );

@ -86,7 +86,6 @@ struct KMMessageStaticData
DwString emptyString;
// Values that are set from the config file with KMMessage::readConfig()
QString replyLanguage, replyStr, replyAllStr, forwardStr, indentPrefixStr;
bool smartQuote : 1, wordWrap : 1;
int wrapCol;
QStringList prefCharsets;
@ -434,38 +433,23 @@ void KMMessage::fromDwString(const DwString& str, bool aSetStatus)
//-----------------------------------------------------------------------------
QString KMMessage::formatString(const QString& aStr) const
{
QString result, str;
QChar ch;
uint j;
QString result;
if (aStr.isEmpty())
return aStr;
unsigned int strLength(aStr.length());
for (uint i=0; i<strLength;) {
ch = aStr[i++];
QChar ch = aStr[i++];
if (ch == '%') {
ch = aStr[i++];
switch (ch.toLatin1()) {
case 'D':
/* I'm not too sure about this change. Is it not possible
to have a long form of the date used? I don't
like this change to a short XX/XX/YY date format.
At least not for the default. -sanders */
result += KMime::DateFormatter::formatDate( KMime::DateFormatter::Localized,
date(), s->replyLanguage, false );
break;
case 'e':
result += from();
break;
case 'F':
result += fromStrip();
break;
case 'f':
case 'f': // sender's initals
{
str = fromStrip();
QString str = fromStrip();
for (j=0; str[j]>' '; j++)
uint j = 0;
for (; str[j]>' '; j++)
;
unsigned int strLength(str.length());
for (; j < strLength && str[j] <= ' '; j++)
@ -478,27 +462,9 @@ QString KMMessage::formatString(const QString& aStr) const
result += str[1];
}
break;
case 'T':
result += toStrip();
break;
case 't':
result += to();
break;
case 'C':
result += ccStrip();
break;
case 'c':
result += cc();
break;
case 'S':
result += subject();
break;
case '_':
result += ' ';
break;
case 'L':
result += '\n';
break;
case '%':
result += '%';
break;
@ -830,8 +796,7 @@ QString KMMessage::asPlainText( bool aStripSignature, bool allowDecryption ) con
return result;
}
QString KMMessage::asQuotedString( const QString& aHeaderStr,
const QString& aIndentStr,
QString KMMessage::asQuotedString( const QString& aIndentStr,
const QString& selection /*.clear() */,
bool aStripSignature /* = true */,
bool allowDecryption /* = true */) const
@ -851,10 +816,9 @@ QString KMMessage::asQuotedString( const QString& aHeaderStr,
content.prepend( indentStr );
content += '\n';
const QString headerStr = formatString( aHeaderStr );
if ( s->smartQuote && s->wordWrap )
return headerStr + smartQuote( content, s->wrapCol );
return headerStr + content;
return smartQuote( content, s->wrapCol );
return content;
}
//-----------------------------------------------------------------------------
@ -866,7 +830,7 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
const QString &tmpl /* = QString() */ )
{
KMMessage* msg = new KMMessage;
QString str, replyStr, mailingListStr, replyToStr, toStr;
QString str, mailingListStr, replyToStr, toStr;
QStringList mailingListAddresses;
QByteArray refStr, headerName;
bool replyAll = true;
@ -890,9 +854,6 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
mailingListAddresses << rx.cap(1) + '@' + rx.cap(2);
}
// use the "On ... Joe User wrote:" header by default
replyStr = s->replyAllStr;
switch( replyStrategy ) {
case KMail::ReplySmart : {
if ( !headerField( "Mail-Followup-To" ).isEmpty() ) {
@ -908,7 +869,6 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
else {
// doesn't seem to be a mailing list, reply to From: address
toStr = from();
replyStr = s->replyStr; // reply to author, so use "On ... you wrote:"
replyAll = false;
}
// strip all my addresses from the list of recipients
@ -1035,7 +995,6 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
else if ( !from().isEmpty() ) {
toStr = from();
}
replyStr = s->replyStr; // reply to author, so use "On ... you wrote:"
replyAll = false;
break;
}
@ -1052,16 +1011,6 @@ KMMessage* KMMessage::createReply( KMail::ReplyStrategy replyStrategy,
//In-Reply-To = original msg-id
msg->setReplyToId(msgId());
// if (!noQuote) {
// if( selectionIsBody ){
// QByteArray cStr = selection.toLatin1();
// msg->setBody( cStr );
// }else{
// msg->setBody(asQuotedString(replyStr + '\n', s->indentPrefixStr, selection,
// s->smartQuote, allowDecryption).toUtf8());
// }
// }
msg->setSubject( replySubject() );
// If the reply shouldn't be blank, apply the template to the message
@ -1169,30 +1118,6 @@ KMMessage* KMMessage::createRedirect( const QString &toStr )
return msg;
}
//-----------------------------------------------------------------------------
QByteArray KMMessage::createForwardBody()
{
QString tmp;
if (s->headerStrategy == HeaderStrategy::all()) {
tmp = "\n\n---------- " + s->forwardStr + " ----------\n\n"
+ headerAsString();
} else {
tmp = "\n\n---------- " + s->forwardStr + " ----------\n\n"
+ "Subject: " + subject() + '\n'
+ "Date: "
+ KMime::DateFormatter::formatDate( KMime::DateFormatter::Localized,
date(), s->replyLanguage, false )
+ '\n'
+ "From: " + from() + '\n'
+ "To: " + to() + '\n'
+ ( cc().isEmpty() ? QString() : ("Cc: " + cc() + '\n') )
+ '\n';
}
return asQuotedString(tmp, "", QString(), false, false).toUtf8()
+ "\n-------------------------------------------------------\n";
}
void KMMessage::sanitizeHeaders( const QStringList& whiteList )
{
// Strip out all headers apart from the content description and other
@ -3901,19 +3826,6 @@ void KMMessage::readConfig()
KConfigGroup config( KMKernel::config(), "General" );
int languageNr = config.readEntry( "reply-current-language", 0 );
{ // area for config group "KMMessage #n"
KConfigGroup config( KMKernel::config(), QString("KMMessage #%1").arg(languageNr) );
s->replyLanguage = config.readEntry("language",KGlobal::locale()->language());
s->replyStr = config.readEntry("phrase-reply",
i18n("On %D, you wrote:"));
s->replyAllStr = config.readEntry("phrase-reply-all",
i18n("On %D, %F wrote:"));
s->forwardStr = config.readEntry("phrase-forward",
i18n("Forwarded Message"));
s->indentPrefixStr = config.readEntry("indent-prefix",">%_");
}
{ // area for config group "Composer"
KConfigGroup config( KMKernel::config(), "Composer" );

@ -174,9 +174,6 @@ public:
*/
KMMessage* createRedirect( const QString &toStr );
/** Create the forwarded body for the message. */
QByteArray createForwardBody();
/** Create a new message that is a forward of this message, filling all
required header fields with the proper values. The returned message
is not stored in any folder. Marks this message as forwarded. */
@ -818,23 +815,16 @@ public:
*/
QByteArray mboxMessageSeparator();
/** Returns message body with quoting header and indented by the
given indentation string. This is suitable for including the message
in another message of for replies, forwards. The header string is
a template where the following fields are replaced with the
corresponding values:
<pre>
%D: date of this message
%S: subject of this message
%F: sender (from) of this message
%%: a single percent sign
</pre>
No attachments are handled if includeAttach is false.
The signature is stripped if aStripSignature is true and
smart quoting is turned on. Signed or encrypted texts
get converted to plain text when allowDecryption is true. */
QString asQuotedString( const QString & headerStr,
const QString & indentStr,
/**
* Returns message body indented by the
* given indentation string. This is suitable for including the message
* in another message of for replies, forwards.
*
* No attachments are handled if includeAttach is false.
* The signature is stripped if aStripSignature is true and
* smart quoting is turned on. Signed or encrypted texts
* get converted to plain text when allowDecryption is true. */
QString asQuotedString( const QString & indentStr,
const QString & selection=QString(),
bool aStripSignature=true,
bool allowDecryption=true) const;

@ -291,7 +291,7 @@ void TemplateParser::processWithTemplate( const QString &tmpl )
if ( mOrigMsg ) {
QString str =
pipe( pipe_cmd, mOrigMsg->asPlainText( mSmartQuote, mAllowDecryption ) );
QString quote = mOrigMsg->asQuotedString( "", mQuoteString, str,
QString quote = mOrigMsg->asQuotedString( mQuoteString, str,
mSmartQuote, mAllowDecryption );
if ( quote.endsWith( '\n' ) )
quote.chop( 1 );
@ -302,7 +302,7 @@ void TemplateParser::processWithTemplate( const QString &tmpl )
kDebug(5006) <<"Command: QUOTE";
i += strlen( "QUOTE" );
if ( mOrigMsg ) {
QString quote = mOrigMsg->asQuotedString( "", mQuoteString, mSelection,
QString quote = mOrigMsg->asQuotedString( mQuoteString, mSelection,
mSmartQuote, mAllowDecryption );
if ( quote.endsWith( '\n' ) )
quote.chop( 1 );
@ -313,7 +313,7 @@ void TemplateParser::processWithTemplate( const QString &tmpl )
kDebug(5006) <<"Command: QHEADERS";
i += strlen( "QHEADERS" );
if ( mOrigMsg ) {
QString quote = mOrigMsg->asQuotedString( "", mQuoteString,
QString quote = mOrigMsg->asQuotedString( mQuoteString,
mOrigMsg->headerAsSendableString(),
mSmartQuote, false );
if ( quote.endsWith( '\n' ) )

@ -290,7 +290,12 @@
<item>
<widget class="QLineEdit" name="lineEdit_quote" >
<property name="whatsThis" >
<string>&lt;qt>The following placeholders are supported in the quote indicator:&lt;br />&lt;table>&lt;tr> &lt;td>&lt;b>%D&lt;/b>: date&lt;/td> &lt;td>&lt;b>%S&lt;/b>: subject&lt;/td> &lt;td>&lt;/td>&lt;/tr>&lt;tr> &lt;td>&lt;b>%e&lt;/b>: sender's address&lt;/td> &lt;td>&lt;b>%F&lt;/b>: sender's name&lt;/td> &lt;td>&lt;b>%f&lt;/b>: sender's initials&lt;/td>&lt;/tr>&lt;tr> &lt;td>&lt;b>%T&lt;/b>: recipient's name&lt;/td> &lt;td>&lt;b>%t&lt;/b>: recipient's name and address&lt;/td> &lt;td>&lt;/td>&lt;/tr>&lt;tr> &lt;td>&lt;b>%C&lt;/b>: carbon copy names&lt;/td> &lt;td>&lt;b>%c&lt;/b>: carbon copy names and addresses&lt;/td> &lt;td>&lt;/td>&lt;/tr>&lt;tr> &lt;td>&lt;b>%%&lt;/b>: percent sign&lt;/td> &lt;td>&lt;b>%_&lt;/b>: space&lt;/td> &lt;td>&lt;b>%L&lt;/b>: linebreak&lt;/td>&lt;/tr>&lt;/table>&lt;/qt></string>
<string>
&lt;qt&gt;The following placeholders are supported in the quote indicator:
&lt;li&gt;%f: sender's initals&lt;/li&gt;
&lt;li&gt;%%: percent sign&lt;/li&gt;
&lt;li&gt;%_: space&lt;/li&gt;&lt;/qt&gt;
</string>
</property>
</widget>
</item>

Loading…
Cancel
Save