00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "resourcesendjob_p.h"
00021 #include "messagequeuejob.h"
00022 #include "transport.h"
00023
00024 #include <QDBusConnection>
00025 #include <QDBusConnectionInterface>
00026 #include <QDBusInterface>
00027 #include <QString>
00028
00029 #include <KLocalizedString>
00030
00031 #include <kmime/kmime_message.h>
00032
00033 #include <akonadi/collection.h>
00034 #include <akonadi/itemcreatejob.h>
00035 #include <akonadi/itemfetchjob.h>
00036 #include <akonadi/itemfetchscope.h>
00037 #include <akonadi/kmime/addressattribute.h>
00038
00039 using namespace Akonadi;
00040 using namespace KMime;
00041 using namespace MailTransport;
00042
00047 class MailTransport::ResourceSendJobPrivate
00048 {
00049 public:
00050 ResourceSendJobPrivate( ResourceSendJob *qq )
00051 : q( qq )
00052 {
00053 }
00054
00055 void slotEmitResult();
00056
00057 ResourceSendJob *const q;
00058 };
00059
00060 void ResourceSendJobPrivate::slotEmitResult()
00061 {
00062
00063 q->emitResult();
00064 }
00065
00066 ResourceSendJob::ResourceSendJob( Transport *transport, QObject *parent )
00067 : TransportJob( transport, parent ), d( new ResourceSendJobPrivate( this ) )
00068 {
00069 }
00070
00071 ResourceSendJob::~ResourceSendJob()
00072 {
00073 delete d;
00074 }
00075
00076 void ResourceSendJob::doStart()
00077 {
00078 Message::Ptr msg = Message::Ptr( new Message );
00079 msg->setContent( data() );
00080 MessageQueueJob *job = new MessageQueueJob;
00081 job->setMessage( msg );
00082 job->transportAttribute().setTransportId( transport()->id() );
00083
00084
00085 job->addressAttribute().setFrom( sender() );
00086 job->addressAttribute().setTo( to() );
00087 job->addressAttribute().setCc( cc() );
00088 job->addressAttribute().setBcc( bcc() );
00089 addSubjob( job );
00090
00091 connect( job, SIGNAL(result(KJob*)), this, SLOT(slotEmitResult()) );
00092 job->start();
00093 }
00094
00095 #include "resourcesendjob_p.moc"