File indexing completed on 2024-05-19 05:16:10
0001 /* 0002 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "resourcesendjob_p.h" 0008 #include <MailTransport/Transport> 0009 0010 #include <KMime/KMimeMessage> 0011 0012 #include <Akonadi/AddressAttribute> 0013 #include <Akonadi/Collection> 0014 #include <Akonadi/MessageQueueJob> 0015 0016 using namespace Akonadi; 0017 using namespace KMime; 0018 using namespace MailTransport; 0019 0020 ResourceSendJob::ResourceSendJob(Transport *transport, QObject *parent) 0021 : TransportJob(transport, parent) 0022 { 0023 } 0024 0025 ResourceSendJob::~ResourceSendJob() = default; 0026 0027 void ResourceSendJob::doStart() 0028 { 0029 Message::Ptr msg = Message::Ptr(new Message); 0030 msg->setContent(data()); 0031 auto job = new MessageQueueJob; 0032 job->setMessage(msg); 0033 job->transportAttribute().setTransportId(transport()->id()); 0034 // Default dispatch mode (send now). 0035 // Move to default sent-mail collection. 0036 job->addressAttribute().setFrom(sender()); 0037 job->addressAttribute().setTo(to()); 0038 job->addressAttribute().setCc(cc()); 0039 job->addressAttribute().setBcc(bcc()); 0040 addSubjob(job); 0041 // Once the item is in the outbox, there is nothing more we can do. 0042 connect(job, &KJob::result, this, &ResourceSendJob::slotEmitResult); 0043 job->start(); 0044 } 0045 0046 void ResourceSendJob::slotEmitResult() 0047 { 0048 // KCompositeJob took care of the error. 0049 emitResult(); 0050 } 0051 0052 #include "moc_resourcesendjob_p.cpp"