transportjob.cpp 2.24 KB
Newer Older
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
/*
    Copyright (c) 2007 Volker Krause <vkrause@kde.org>

    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.
*/

#include "transport.h"
#include "transportjob.h"

#include <qbuffer.h>

using namespace KPIM;

class KPIM::TransportJob::Private
{
  public:
    Transport* transport;
    QString sender;
    QStringList to;
    QStringList cc;
    QStringList bcc;
    QByteArray data;
    QBuffer *buffer;
};

TransportJob::TransportJob( Transport* transport, QObject * parent ) :
    KCompositeJob( parent ),
    d( new Private )
{
  d->transport = transport;
  d->buffer = 0;
}

Volker Krause's avatar
Volker Krause committed
47
48
49
50
51
TransportJob::~ TransportJob()
{
  delete d;
}

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
void TransportJob::setSender(const QString & sender)
{
  d->sender = sender;
}

void TransportJob::setTo(const QStringList &to)
{
  d->to = to;
}

void TransportJob::setCc(const QStringList &cc)
{
  d->cc = cc;
}

void TransportJob::setBcc(const QStringList &bcc)
{
  d->bcc = bcc;
}

void TransportJob::setData(const QByteArray & data)
{
  d->data = data;
}

Transport* TransportJob::transport() const
{
  return d->transport;
}

QString TransportJob::sender() const
{
  return d->sender;
}

QStringList TransportJob::to() const
{
  return d->to;
}

QStringList TransportJob::cc() const
{
  return d->cc;
}

QStringList TransportJob::bcc() const
{
  return d->bcc;
}

QByteArray TransportJob::data() const
{
  return d->data;
}

QBuffer* TransportJob::buffer()
{
  if ( !d->buffer ) {
    d->buffer = new QBuffer( this );
    d->buffer->setData( d->data );
    Q_ASSERT( d->buffer->open( QIODevice::ReadOnly ) );
  }
  return d->buffer;
}