Version: unspecified (using Devel) OS: Windows CE version: 20101219 svn 1207720 Reproducible: Always Steps to Reproduce: 1. Select a mail. 2. Open Actions flap, long click on forward. Redirect. Actual Results: A composer opens. Expected Results: But I just want to redirect the mail and not to change it, so I would expect a mail address dialog pops up and let me redirect the mail.
commit 7f0dbc5f5c8981be9c5110ba2b1fff8c624e6507 branch master Author: Tobias Koenig <tokoe@kde.org> Date: Thu Dec 23 13:20:00 2010 +0100 Implement proper 'Redirect' functionality kmail-mobile uses the redirect dialog from mailcommon/ now and doesn't open the message composer instead when redirecting a mail. BUG: 261052 diff --git a/mobile/mail/mainview.cpp b/mobile/mail/mainview.cpp index 0a1fb42..b6c1881 100644 --- a/mobile/mail/mainview.cpp +++ b/mobile/mail/mainview.cpp @@ -37,9 +37,11 @@ #include "mailactionmanager.h" #include "mailcommon/collectiongeneralpage.h" #include "mailcommon/mailkernel.h" +#include "mailcommon/redirectdialog.h" #include "mailcommon/sendmdnhandler.h" #include "mailthreadgroupercomparator.h" #include "messagecomposer/messagehelper.h" +#include "messagecomposer/messagecomposersettings.h" #include "messagecore/messagehelpers.h" #include "messagelistproxy.h" #include "messagelistsettingscontroller.h" @@ -90,6 +92,7 @@ #include <kselectionproxymodel.h> #include <kstandarddirs.h> #include <mailcommon/expirypropertiesdialog.h> +#include <mailcommon/filteraction.h> #include <mailcommon/filtermanager.h> #include <mailcommon/foldercollection.h> #include <mailcommon/mailutil.h> @@ -775,27 +778,55 @@ void MainView::forwardFetchResult( KJob* job ) MessageComposer::MessageFactory factory( item.payload<KMime::Message::Ptr>(), item.id() ); factory.setIdentityManager( MobileKernel::self()->identityManager() ); - ComposerView *composer = new ComposerView; const ForwardMode mode = fetchJob->property( "forwardMode" ).value<ForwardMode>(); - switch ( mode ) { - case InLine: - composer->setMessage( factory.createForward() ); - break; - case AsAttachment: { - QPair< KMime::Message::Ptr, QList< KMime::Content* > > forwardMessage = factory.createAttachedForward( QList< KMime::Message::Ptr >() << item.payload<KMime::Message::Ptr>()); - //the invokeMethods are there to be sure setMessage and addAttachment is called after composer->delayedInit - QMetaObject::invokeMethod( composer, "setMessage", Qt::QueuedConnection, Q_ARG( KMime::Message::Ptr, forwardMessage.first ) ); - foreach ( KMime::Content* attach, forwardMessage.second ) - QMetaObject::invokeMethod( composer, "addAttachment", Qt::QueuedConnection, Q_ARG( KMime::Content*, attach ) ); - break; + if ( mode == Redirect ) { + const MailCommon::RedirectDialog::SendMode sendMode = MessageComposer::MessageComposerSettings::self()->sendImmediate() + ? MailCommon::RedirectDialog::SendNow + : MailCommon::RedirectDialog::SendLater; + + MailCommon::RedirectDialog dlg( sendMode, this ); + if ( !dlg.exec() ) + return; + + if ( !MailTransport::TransportManager::self()->showTransportCreationDialog( this, MailTransport::TransportManager::IfNoTransportExists ) ) + return; + + factory.setFolderIdentity( MailCommon::Util::folderIdentity( item ) ); + const KMime::Message::Ptr redirectMessage = factory.createRedirect( dlg.to() ); + if ( !redirectMessage ) + return; + + MessageStatus status; + status.setStatusFromFlags( item.flags() ); + if ( !status.isRead() ) + MailCommon::FilterAction::sendMDN( item, KMime::MDN::Dispatched ); + + const MessageSender::SendMethod method = (dlg.sendMode() == MailCommon::RedirectDialog::SendNow) + ? MessageSender::SendImmediate + : MessageSender::SendLater; + + MobileKernel::self()->msgSender()->send( redirectMessage, method ); + + } else { + ComposerView *composer = new ComposerView; + switch ( mode ) { + case InLine: + composer->setMessage( factory.createForward() ); + break; + case AsAttachment: { + QPair< KMime::Message::Ptr, QList< KMime::Content* > > forwardMessage = factory.createAttachedForward( QList< KMime::Message::Ptr >() << item.payload<KMime::Message::Ptr>()); + //the invokeMethods are there to be sure setMessage and addAttachment is called after composer->delayedInit + QMetaObject::invokeMethod( composer, "setMessage", Qt::QueuedConnection, Q_ARG( KMime::Message::Ptr, forwardMessage.first ) ); + foreach ( KMime::Content* attach, forwardMessage.second ) + QMetaObject::invokeMethod( composer, "addAttachment", Qt::QueuedConnection, Q_ARG( KMime::Content*, attach ) ); + break; + } } - case Redirect: - composer->setMessage( factory.createRedirect( "" ) ); - break; + + composer->show(); + composer->setIdentity( currentFolderIdentity() ); } - composer->show(); - composer->setIdentity( currentFolderIdentity() ); } void MainView::markImportant( bool checked )
version 2011-01-12 redirect works now.