• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

mailtransport

  • sources
  • kde-4.14
  • kdepimlibs
  • mailtransport
resourcesendjob.cpp
1 /*
2  Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "resourcesendjob_p.h"
21 #include "messagequeuejob.h"
22 #include "transport.h"
23 
24 #include <QDBusConnection>
25 #include <QDBusConnectionInterface>
26 
27 
28 #include <kmime/kmime_message.h>
29 
30 #include <akonadi/collection.h>
31 #include <akonadi/itemcreatejob.h>
32 #include <akonadi/itemfetchjob.h>
33 #include <akonadi/itemfetchscope.h>
34 #include <akonadi/kmime/addressattribute.h>
35 
36 using namespace Akonadi;
37 using namespace KMime;
38 using namespace MailTransport;
39 
44 class MailTransport::ResourceSendJobPrivate
45 {
46  public:
47  ResourceSendJobPrivate( ResourceSendJob *qq )
48  : q( qq )
49  {
50  }
51 
52  void slotEmitResult(); // slot
53 
54  ResourceSendJob *const q;
55 };
56 
57 void ResourceSendJobPrivate::slotEmitResult()
58 {
59  // KCompositeJob took care of the error.
60  q->emitResult();
61 }
62 
63 ResourceSendJob::ResourceSendJob( Transport *transport, QObject *parent )
64  : TransportJob( transport, parent ), d( new ResourceSendJobPrivate( this ) )
65 {
66 }
67 
68 ResourceSendJob::~ResourceSendJob()
69 {
70  delete d;
71 }
72 
73 void ResourceSendJob::doStart()
74 {
75  Message::Ptr msg = Message::Ptr( new Message );
76  msg->setContent( data() );
77  MessageQueueJob *job = new MessageQueueJob;
78  job->setMessage( msg );
79  job->transportAttribute().setTransportId( transport()->id() );
80  // Default dispatch mode (send now).
81  // Move to default sent-mail collection.
82  job->addressAttribute().setFrom( sender() );
83  job->addressAttribute().setTo( to() );
84  job->addressAttribute().setCc( cc() );
85  job->addressAttribute().setBcc( bcc() );
86  addSubjob( job );
87  // Once the item is in the outbox, there is nothing more we can do.
88  connect( job, SIGNAL(result(KJob*)), this, SLOT(slotEmitResult()) );
89  job->start();
90 }
91 
92 #include "moc_resourcesendjob_p.cpp"
MailTransport::TransportJob::bcc
QStringList bcc() const
Returns the "Bcc" receiver(s) of the mail.
Definition: transportjob.cpp:99
MailTransport::ResourceSendJob::~ResourceSendJob
virtual ~ResourceSendJob()
Destroys this job.
Definition: resourcesendjob.cpp:68
MailTransport::MessageQueueJob
Provides an interface for sending email.
Definition: messagequeuejob.h:86
MailTransport::TransportAttribute::setTransportId
void setTransportId(int id)
Sets the transport id to use for sending this message.
Definition: transportattribute.cpp:77
MailTransport::MessageQueueJob::transportAttribute
TransportAttribute & transportAttribute()
Returns a reference to the transport attribue for this message.
Definition: messagequeuejob.cpp:185
MailTransport::TransportJob::cc
QStringList cc() const
Returns the "Cc" receiver(s) of the mail.
Definition: transportjob.cpp:94
QObject
MailTransport::TransportJob::sender
QString sender() const
Returns the sender of the mail.
Definition: transportjob.cpp:84
MailTransport::ResourceSendJob::doStart
virtual void doStart()
reimpl
Definition: resourcesendjob.cpp:73
MailTransport::ResourceSendJob
Mail transport job for an Akonadi resource-based transport.
Definition: resourcesendjob_p.h:44
MailTransport::TransportJob
Abstract base class for all mail transport jobs.
Definition: transportjob.h:41
MailTransport::TransportJob::data
QByteArray data() const
Returns the data of the mail.
Definition: transportjob.cpp:104
MailTransport::MessageQueueJob::start
virtual void start()
Creates the item and places it in the outbox.
Definition: messagequeuejob.cpp:205
MailTransport::MessageQueueJob::setMessage
void setMessage(KMime::Message::Ptr message)
Sets the message to be sent.
Definition: messagequeuejob.cpp:200
MailTransport::MessageQueueJob::addressAttribute
Akonadi::AddressAttribute & addressAttribute()
Returns a reference to the address attribue for this message.
Definition: messagequeuejob.cpp:180
MailTransport::Transport
Represents the settings of a specific mail transport.
Definition: transport.h:50
MailTransport::TransportJob::to
QStringList to() const
Returns the "To" receiver(s) of the mail.
Definition: transportjob.cpp:89
MailTransport::TransportJob::transport
Transport * transport() const
Returns the Transport object containing the mail transport settings.
Definition: transportjob.cpp:79
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailtransport

Skip menu "mailtransport"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal