svn path=/branches/work/akonadi-ports/kdepim/; revision=1043406
wilder-work
Laurent Montel 17 years ago
parent 4fdace21e9
commit 920b30b94e
  1. 14
      foldercollection.cpp
  2. 1
      foldercollection.h
  3. 14
      kmcommands.cpp
  4. 40
      messagehelper.cpp
  5. 6
      messagehelper.h

@ -330,6 +330,20 @@ void FolderCollection::setReadExpireUnits( ExpireUnits units )
}
}
QString FolderCollection::mailingListPostAddress() const
{
if ( mMailingList.features() & MailingList::Post ) {
KUrl::List::const_iterator it;
KUrl::List post = mMailingList.postURLS();
for( it = post.constBegin(); it != post.constEnd(); ++it ) {
// We check for isEmpty because before 3.3 postAddress was just an
// email@kde.org and that leaves protocol() field in the kurl class
if ( (*it).protocol() == "mailto" || (*it).protocol().isEmpty() )
return (*it).path();
}
}
return QString();
}
void FolderCollection::setExpireAction( ExpireAction a )
{

@ -187,6 +187,7 @@ public:
bool ignoreNewMail() const { return mIgnoreNewMail; }
void setIgnoreNewMail( bool b ) { mIgnoreNewMail = b; }
QString mailingListPostAddress() const;
/** Mark all new messages as unread. */
void markNewAsUnread();

@ -1109,7 +1109,7 @@ KMCommand::Result KMReplyToCommand::execute()
KMime::Message::Ptr msg = KMail::Util::message( item );
if ( !msg )
return Failed;
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( &*msg, KMail::ReplySmart, mSelection );
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( item, &*msg, KMail::ReplySmart, mSelection );
KMail::Composer * win = KMail::makeComposer( reply.msg, replyContext( reply ), 0, mSelection );
#if 0 //Port to kmime::message
win->setCharset( msg->codec()->name(), true );
@ -1140,7 +1140,7 @@ KMCommand::Result KMNoQuoteReplyToCommand::execute()
KMime::Message::Ptr msg = KMail::Util::message( item );
if ( !msg )
return Failed;
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( &*msg, KMail::ReplySmart, "", true);
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( item, &*msg, KMail::ReplySmart, "", true);
KMail::Composer *win = KMail::makeComposer( reply.msg, replyContext( reply ) );
#if 0 //Port to akonadi
win->setCharset( msg->codec()->name(), true );
@ -1170,7 +1170,7 @@ KMCommand::Result KMReplyListCommand::execute()
KMime::Message::Ptr msg = KMail::Util::message( item );
if ( !msg )
return Failed;
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( &*msg, KMail::ReplyList, mSelection );
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( item, &*msg, KMail::ReplyList, mSelection );
KMail::Composer * win = KMail::makeComposer( reply.msg, replyContext( reply ),
0, mSelection );
#if 0
@ -1202,7 +1202,7 @@ KMCommand::Result KMReplyToAllCommand::execute()
KMime::Message::Ptr msg = KMail::Util::message( item );
if ( !msg )
return Failed;
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( &*msg, KMail::ReplyAll, mSelection );
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( item, &*msg, KMail::ReplyAll, mSelection );
KMail::Composer * win = KMail::makeComposer( reply.msg, replyContext( reply ), 0,
mSelection );
#if 0
@ -1233,7 +1233,7 @@ KMCommand::Result KMReplyAuthorCommand::execute()
KMime::Message::Ptr msg = KMail::Util::message( item );
if ( !msg )
return Failed;
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( &*msg, KMail::ReplyAuthor, mSelection );
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( item, &*msg, KMail::ReplyAuthor, mSelection );
KMail::Composer * win = KMail::makeComposer( reply.msg, replyContext( reply ), 0,
mSelection );
#if 0
@ -1534,7 +1534,7 @@ KMCommand::Result KMCustomReplyToCommand::execute()
KMime::Message::Ptr msg = KMail::Util::message( item );
if ( !msg )
return Failed;
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( &*msg, KMail::ReplySmart, mSelection,
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( item, &*msg, KMail::ReplySmart, mSelection,
false, true, false, mTemplate );
KMail::Composer * win = KMail::makeComposer( reply.msg, replyContext( reply ), 0,
mSelection, mTemplate );
@ -1568,7 +1568,7 @@ KMCommand::Result KMCustomReplyAllToCommand::execute()
KMime::Message::Ptr msg = KMail::Util::message( item );
if ( !msg )
return Failed;
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( &*msg, KMail::ReplyAll, mSelection,
KMail::MessageHelper::MessageReply reply = KMail::MessageHelper::createReply2( item, &*msg, KMail::ReplyAll, mSelection,
false, true, false, mTemplate );
KMail::Composer * win = KMail::makeComposer( reply.msg, replyContext( reply ), 0,
mSelection, mTemplate );

@ -27,6 +27,7 @@
#include "messageinfo.h"
#include "mdnadvicedialog.h"
#include "mailinglist-magic.h"
#include "foldercollection.h"
#include <messageviewer/objecttreeparser.h>
#include <messageviewer/kcursorsaver.h>
@ -450,13 +451,14 @@ msg->link( this, MessageStatus::statusReplied() );
return msg;
}
MessageReply createReply2( KMime::Message *origMsg,
KMail::ReplyStrategy replyStrategy,
const QString &selection /*.clear() */,
bool noQuote /* = false */,
bool allowDecryption /* = true */,
bool selectionIsBody /* = false */,
const QString &tmpl /* = QString() */ )
MessageReply createReply2(const Akonadi::Item &item,
KMime::Message *origMsg,
KMail::ReplyStrategy replyStrategy,
const QString &selection /*.clear() */,
bool noQuote /* = false */,
bool allowDecryption /* = true */,
bool selectionIsBody /* = false */,
const QString &tmpl /* = QString() */ )
{
KMime::Message* msg = new KMime::Message;
QString str, mailingListStr, replyToStr, toStr;
@ -469,15 +471,15 @@ MessageReply createReply2( KMime::Message *origMsg,
replyToStr = origMsg->replyTo()->asUnicodeString();
msg->contentType()->setCharset("utf-8");
#if 0 //TODO port to akonadi
// determine the mailing list posting address
if ( parent() && parent()->isMailingListEnabled() &&
!parent()->mailingListPostAddress().isEmpty() ) {
mailingListAddresses << parent()->mailingListPostAddress();
Akonadi::Collection parentCollection = item.parentCollection();
FolderCollection *fd = 0;
if ( parentCollection.isValid() ) {
fd = new FolderCollection( parentCollection, false /*don't save*/ );
if ( fd->isMailingListEnabled() && !fd->mailingListPostAddress().isEmpty() ) {
mailingListAddresses << fd->mailingListPostAddress();
}
}
#else
kDebug() << "AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
#endif
if ( origMsg->headerByType("List-Post") && origMsg->headerByType("List-Post")->asUnicodeString().contains( "mailto:", Qt::CaseInsensitive ) ) {
QString listPost = origMsg->headerByType("List-Post")->asUnicodeString();
@ -658,9 +660,12 @@ MessageReply createReply2( KMime::Message *origMsg,
}
#if 0 //TODO port to akonadi
msg->link( this, MessageStatus::statusReplied() );
if ( parent() && parent()->putRepliesInSameFolder() )
msg->setFcc( parent()->idString() );
#endif
if ( parentCollection.isValid() && fd->putRepliesInSameFolder() ) {
KMime::Headers::Generic *header = new KMime::Headers::Generic( "X-KMail-Fcc", msg, QString::number( parentCollection.id() ), "utf-8" );
msg->setHeader( header );
}
#if 0
// replies to an encrypted message should be encrypted as well
if ( encryptionState() == KMMsgPartiallyEncrypted ||
encryptionState() == KMMsgFullyEncrypted ) {
@ -674,6 +679,7 @@ MessageReply createReply2( KMime::Message *origMsg,
MessageReply reply;
reply.msg = msg;
reply.replyAll = replyAll;
delete fd;
return reply;
}

@ -22,7 +22,7 @@
#include <kmime/kmime_headers.h>
#include <kmime/kmime_mdn.h>
#include <akonadi/item.h>
namespace KMail {
/**
* Enumeration that defines the available reply "modes"
@ -68,7 +68,7 @@ namespace MessageHelper {
/** Create a new message that is a reply to this message, filling all
required header fields with the proper values. The returned message
is not stored in any folder. Marks this message as replied. */
KMime::Message* createReply( KMime::Message* origMsg, KMail::ReplyStrategy replyStrategy = KMail::ReplySmart,
KMime::Message* createReply(KMime::Message* origMsg, KMail::ReplyStrategy replyStrategy = KMail::ReplySmart,
const QString &selection=QString(), bool noQuote=false,
bool allowDecryption=true, bool selectionIsBody=false,
const QString &tmpl = QString() );
@ -82,7 +82,7 @@ namespace MessageHelper {
* @return the reply created, including the reply mode
*/
//TODO see if this can be merged with the above one!
MessageReply createReply2( KMime::Message* origMsg,
MessageReply createReply2( const Akonadi::Item & item, KMime::Message* origMsg,
KMail::ReplyStrategy replyStrategy = KMail::ReplySmart,
const QString &selection=QString(), bool noQuote=false,
bool allowDecryption=true, bool selectionIsBody=false,

Loading…
Cancel
Save