1 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net>
3 This file is part of the Trojita Qt IMAP e-mail client,
4 http://trojita.flaska.net/
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License or (at your option) version 3 or any later version
10 accepted by the membership of KDE e.V. (or its successor approved
11 by the membership of KDE e.V.), which shall act as a proxy
12 defined in Section 14 of version 3 of the license.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 Fake::Fake(QObject
*parent
, FakeFactory
*factory
, const bool supportsBurl
, const bool supportsImap
):
28 AbstractMSA(parent
), m_factory(factory
), m_supportsBurl(supportsBurl
), m_supportsImap(supportsImap
)
36 void Fake::sendMail(const QByteArray
&from
, const QList
<QByteArray
> &to
, const QByteArray
&data
)
38 emit m_factory
->requestedSending(from
, to
, data
);
41 void Fake::sendBurl(const QByteArray
&from
, const QList
<QByteArray
> &to
, const QByteArray
&imapUrl
)
43 emit m_factory
->requestedBurlSending(from
, to
, imapUrl
);
48 emit m_factory
->requestedCancelling();
51 FakeFactory::FakeFactory(): m_supportsBurl(false), m_supportsImap(false)
55 FakeFactory::~FakeFactory()
59 AbstractMSA
*FakeFactory::create(QObject
*parent
) const
61 m_lastOne
= new Fake(parent
, const_cast<FakeFactory
*>(this), m_supportsBurl
, m_supportsImap
);
62 connect(m_lastOne
.data(), &AbstractMSA::connecting
, this, &FakeFactory::connecting
);
63 connect(m_lastOne
.data(), &AbstractMSA::sending
, this, &FakeFactory::sending
);
64 connect(m_lastOne
.data(), &AbstractMSA::sent
, this, &FakeFactory::sent
);
65 connect(m_lastOne
.data(), &AbstractMSA::error
, this, &FakeFactory::error
);
66 connect(m_lastOne
.data(), &AbstractMSA::progressMax
, this, &FakeFactory::progressMax
);
67 connect(m_lastOne
.data(), &AbstractMSA::progress
, this, &FakeFactory::progress
);
71 Fake
*FakeFactory::lastMSA() const
76 void FakeFactory::doEmitConnecting()
78 emit
lastMSA()->connecting();
81 void FakeFactory::doEmitSending()
83 emit
lastMSA()->sending();
86 void FakeFactory::doEmitSent()
88 emit
lastMSA()->sent();
91 void FakeFactory::doEmitError(const QString
&message
)
93 emit
lastMSA()->error(message
);
96 void FakeFactory::doEmitProgressMax(int max
)
98 emit
lastMSA()->progressMax(max
);
101 void FakeFactory::doEmitProgress(int num
)
103 emit
lastMSA()->progress(num
);
106 void FakeFactory::setBurlSupport(const bool enabled
)
108 m_supportsBurl
= enabled
;
111 void FakeFactory::setImapSupport(const bool enabled
)
113 m_supportsImap
= enabled
;