/usr/include/mailtransport/messagequeuejob.h is in kdepimlibs5-dev 4:4.14.10-7+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | /*
Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef MAILTRANSPORT_MESSAGEQUEUEJOB_H
#define MAILTRANSPORT_MESSAGEQUEUEJOB_H
#include <mailtransport/mailtransport_export.h>
#include "dispatchmodeattribute.h"
#include "sentactionattribute.h"
#include "sentbehaviourattribute.h"
#include "transportattribute.h"
#include <QtCore/QDateTime>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <KDE/KCompositeJob>
#include <akonadi/collection.h>
#include <akonadi/kmime/addressattribute.h>
#include <kmime/kmime_message.h>
#include <boost/shared_ptr.hpp>
namespace MailTransport {
/**
@short Provides an interface for sending email.
This class takes a KMime::Message and some related info such as sender and
recipient addresses, and places the message in the outbox. The mail
dispatcher agent will then take it from there and send it.
This is the preferred way for applications to send email.
This job requires some options to be set before being started. Modify the
attributes of this job to change these options.
You need to set the transport of the transport attribute, the from address of
the address attribute and one of the to, cc or bcc addresses of the address
attribute. Also, you need to call setMessage().
Optionally, you can change the dispatch mode attribute or the sent behaviour
attribute.
Example:
@code
MessageQueueJob *job = new MessageQueueJob( this );
job->setMessage( msg ); // msg is a Message::Ptr
job->transportAttribute().setTransportId( TransportManager::self()->defaultTransportId() );
// Use the default dispatch mode.
// Use the default sent-behaviour.
job->addressAttribute().setFrom( from ); // from is a QString
job->addressAttribute().setTo( to ); // to is a QStringList
connect( job, SIGNAL(result(KJob*)), this, SLOT(jobResult(KJob*)) );
job->start();
@endcode
@see DispatchModeAttribute
@see SentActionAttribute
@see SentBehaviourAttribute
@see TransportAttribute
@see AddressAttribute
@author Constantin Berzan <exit3219@gmail.com>
@since 4.4
*/
class MAILTRANSPORT_EXPORT MessageQueueJob : public KCompositeJob
{
Q_OBJECT
public:
/**
Creates a new MessageQueueJob.
@param parent the QObject parent
This is not an autostarting job; you need to call start() yourself.
*/
explicit MessageQueueJob( QObject *parent = 0 );
/**
Destroys the MessageQueueJob.
This job deletes itself after finishing.
*/
virtual ~MessageQueueJob();
/**
Returns the message to be sent.
*/
KMime::Message::Ptr message() const;
/**
Returns a reference to the dispatch mode attribue for this message.
Modify the returned attribute to change the dispatch mode.
*/
DispatchModeAttribute &dispatchModeAttribute();
/**
Returns a reference to the address attribue for this message.
Modify the returned attribute to change the receivers or the from
address.
*/
Akonadi::AddressAttribute &addressAttribute();
/**
Returns a reference to the transport attribue for this message.
Modify the returned attribute to change the transport used for
sending the mail.
*/
TransportAttribute &transportAttribute();
/**
Returns a reference to the sent behaviour attribue for this message.
Modify the returned attribute to change the sent behaviour.
*/
SentBehaviourAttribute &sentBehaviourAttribute();
/**
Returns a reference to the sent action attribue for this message.
Modify the returned attribute to change the sent actions.
*/
SentActionAttribute &sentActionAttribute();
/**
Sets the message to be sent.
*/
void setMessage( KMime::Message::Ptr message );
/**
Creates the item and places it in the outbox.
It is now queued for sending by the mail dispatcher agent.
*/
virtual void start();
protected Q_SLOTS:
/**
Called when the ItemCreateJob subjob finishes.
(reimplemented from KCompositeJob)
*/
virtual void slotResult( KJob * );
private:
class Private;
friend class Private;
Private *const d;
Q_PRIVATE_SLOT( d, void outboxRequestResult( KJob* ) )
};
} // namespace MailTransport
#endif // MAILTRANSPORT_MESSAGEQUEUEJOB_H
|