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

mailtransport

  • mailtransport
transportjob.cpp
1/*
2 Copyright (c) 2007 Volker Krause <vkrause@kde.org>
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 "transportjob.h"
21#include "transport.h"
22
23#include <QBuffer>
24
25#include <KLocalizedString>
26
27using namespace MailTransport;
28
29class MailTransport::TransportJob::Private
30{
31 public:
32 Transport *transport;
33 QString sender;
34 QStringList to;
35 QStringList cc;
36 QStringList bcc;
37 QByteArray data;
38 QBuffer *buffer;
39};
40
41TransportJob::TransportJob( Transport *transport, QObject *parent )
42 : KCompositeJob( parent ), d( new Private )
43{
44 d->transport = transport;
45 d->buffer = 0;
46}
47
48TransportJob::~ TransportJob()
49{
50 delete d->transport;
51 delete d;
52}
53
54void TransportJob::setSender( const QString &sender )
55{
56 d->sender = sender;
57}
58
59void TransportJob::setTo( const QStringList &to )
60{
61 d->to = to;
62}
63
64void TransportJob::setCc( const QStringList &cc )
65{
66 d->cc = cc;
67}
68
69void TransportJob::setBcc( const QStringList &bcc )
70{
71 d->bcc = bcc;
72}
73
74void TransportJob::setData( const QByteArray &data )
75{
76 d->data = data;
77}
78
79Transport *TransportJob::transport() const
80{
81 return d->transport;
82}
83
84QString TransportJob::sender() const
85{
86 return d->sender;
87}
88
89QStringList TransportJob::to() const
90{
91 return d->to;
92}
93
94QStringList TransportJob::cc() const
95{
96 return d->cc;
97}
98
99QStringList TransportJob::bcc() const
100{
101 return d->bcc;
102}
103
104QByteArray TransportJob::data() const
105{
106 return d->data;
107}
108
109QBuffer *TransportJob::buffer()
110{
111 if ( !d->buffer ) {
112 d->buffer = new QBuffer( this );
113 d->buffer->setData( d->data );
114 d->buffer->open( QIODevice::ReadOnly );
115 Q_ASSERT( d->buffer->isOpen() );
116 }
117 return d->buffer;
118}
119
120void TransportJob::start()
121{
122 if ( !transport()->isValid() ) {
123 setError( UserDefinedError );
124 setErrorText( i18n( "The outgoing account \"%1\" is not correctly configured.",
125 transport()->name() ) );
126 emitResult();
127 return;
128 }
129 doStart();
130}
MailTransport::TransportJob::transport
Transport * transport() const
Returns the Transport object containing the mail transport settings.
Definition: transportjob.cpp:79
MailTransport::TransportJob::setData
void setData(const QByteArray &data)
Sets the content of the mail.
Definition: transportjob.cpp:74
MailTransport::TransportJob::buffer
QBuffer * buffer()
Returns a QBuffer opened on the message data.
Definition: transportjob.cpp:109
MailTransport::TransportJob::doStart
virtual void doStart()=0
Do the actual work, implement in your subclass.
MailTransport::TransportJob::setBcc
void setBcc(const QStringList &bcc)
Sets the "Bcc" receiver(s) of the mail.
Definition: transportjob.cpp:69
MailTransport::TransportJob::data
QByteArray data() const
Returns the data of the mail.
Definition: transportjob.cpp:104
MailTransport::TransportJob::sender
QString sender() const
Returns the sender of the mail.
Definition: transportjob.cpp:84
MailTransport::TransportJob::bcc
QStringList bcc() const
Returns the "Bcc" receiver(s) of the mail.
Definition: transportjob.cpp:99
MailTransport::TransportJob::setSender
void setSender(const QString &sender)
Sets the sender of the mail.
Definition: transportjob.cpp:54
MailTransport::TransportJob::start
virtual void start()
Starts this job.
Definition: transportjob.cpp:120
MailTransport::TransportJob::setTo
void setTo(const QStringList &to)
Sets the "To" receiver(s) of the mail.
Definition: transportjob.cpp:59
MailTransport::TransportJob::TransportJob
TransportJob(Transport *transport, QObject *parent=0)
Creates a new mail transport job.
Definition: transportjob.cpp:41
MailTransport::TransportJob::to
QStringList to() const
Returns the "To" receiver(s) of the mail.
Definition: transportjob.cpp:89
MailTransport::TransportJob::cc
QStringList cc() const
Returns the "Cc" receiver(s) of the mail.
Definition: transportjob.cpp:94
MailTransport::TransportJob::setCc
void setCc(const QStringList &cc)
Sets the "Cc" receiver(s) of the mail.
Definition: transportjob.cpp:64
MailTransport::Transport
Represents the settings of a specific mail transport.
Definition: transport.h:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 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-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 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
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