aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <[email protected]>2017-06-29 21:17:39 +0200
committerDaniel Vrátil <[email protected]>2017-06-29 22:23:09 +0200
commit8ff31452f778257660c34a60b6ae490ae7b667fe (patch)
tree38d0760a9c451748a644e792193c95fb1c48658e
parentbfbdd556bc9f82f0c353126ee34e950ebee9f484 (diff)
FetchJob: remove deprecated, no longer functional methods
-rw-r--r--src/fetchjob.cpp25
-rw-r--r--src/fetchjob.h12
-rw-r--r--tests/testimapserver.cpp70
3 files changed, 62 insertions, 45 deletions
diff --git a/src/fetchjob.cpp b/src/fetchjob.cpp
index 67051de..8975b6e 100644
--- a/src/fetchjob.cpp
+++ b/src/fetchjob.cpp
@@ -175,31 +175,6 @@ void FetchJob::setGmailExtensionsEnabled(bool enabled)
d->gmailEnabled = enabled;
}
-QMap<qint64, MessagePtr> FetchJob::messages() const
-{
- return QMap<qint64, MessagePtr>();
-}
-
-QMap<qint64, MessageParts> FetchJob::parts() const
-{
- return QMap<qint64, MessageParts>();
-}
-
-QMap<qint64, MessageFlags> FetchJob::flags() const
-{
- return QMap<qint64, MessageFlags>();
-}
-
-QMap<qint64, qint64> FetchJob::sizes() const
-{
- return QMap<qint64, qint64>();
-}
-
-QMap<qint64, qint64> FetchJob::uids() const
-{
- return QMap<qint64, qint64>();
-}
-
void FetchJob::doStart()
{
Q_D(FetchJob);
diff --git a/src/fetchjob.h b/src/fetchjob.h
index a14dd51..a815f05 100644
--- a/src/fetchjob.h
+++ b/src/fetchjob.h
@@ -245,18 +245,6 @@ public:
*/
bool setGmailExtensionsEnabled() const;
- // XXX: [alexmerry, 2010-07-24]: BIC? Behaviour change
- /** @deprecated returns an empty map; use the signals instead */
- KIMAP_DEPRECATED QMap<qint64, MessagePtr> messages() const;
- /** @deprecated returns an empty map; use the signals instead */
- KIMAP_DEPRECATED QMap<qint64, MessageParts> parts() const;
- /** @deprecated returns an empty map; use the signals instead */
- KIMAP_DEPRECATED QMap<qint64, MessageFlags> flags() const;
- /** @deprecated returns an empty map; use the signals instead */
- KIMAP_DEPRECATED QMap<qint64, qint64> sizes() const;
- /** @deprecated returns an empty map; use the signals instead */
- KIMAP_DEPRECATED QMap<qint64, qint64> uids() const;
-
Q_SIGNALS:
/**
* Provides header and message results.
diff --git a/tests/testimapserver.cpp b/tests/testimapserver.cpp
index bea620d..f365580 100644
--- a/tests/testimapserver.cpp
+++ b/tests/testimapserver.cpp
@@ -53,6 +53,15 @@
using namespace KIMAP;
+using PartsReceivedSignal = void(FetchJob::*)(const QString &, const QMap<qint64,qint64> &,
+ const QMap<qint64, MessageParts> &);
+
+using HeadersReceivedSignal = void(FetchJob::*)(const QString &,
+ const QMap<qint64, qint64> &,
+ const QMap<qint64, qint64> &,
+ const QMap<qint64, MessageFlags> &,
+ const QMap<qint64, MessagePtr> &);
+
class UiProxy: public SessionUiProxy
{
public:
@@ -242,8 +251,14 @@ void testAppendAndStore(Session *session)
scope.parts.clear();
scope.mode = FetchJob::FetchScope::Content;
fetch->setScope(scope);
+ MessagePtr message;
+ QObject::connect(fetch, static_cast<HeadersReceivedSignal>(&FetchJob::headersReceived),
+ fetch, [&](const QString &, const QMap<qint64, qint64> &,
+ const QMap<qint64, qint64> &, const QMap<qint64, MessageFlags> &,
+ const QMap<qint64, MessagePtr> &msgs) {
+ message = msgs[1];
+ });
fetch->exec();
- MessagePtr message = fetch->messages()[1];
Q_ASSERT_X(fetch->error() == 0, "FetchJob", fetch->errorString().toLocal8Bit().constData());
testMailContent.replace("\r\n", "\n");
Q_ASSERT_X(testMailContent == message->head() + "\n" + message->body(),
@@ -254,8 +269,14 @@ void testAppendAndStore(Session *session)
scope.parts.clear();
scope.mode = FetchJob::FetchScope::Flags;
fetch->setScope(scope);
+ MessageFlags expectedFlags;
+ QObject::connect(fetch, static_cast<HeadersReceivedSignal>(&FetchJob::headersReceived),
+ fetch, [&](const QString &, const QMap<qint64, qint64> &,
+ const QMap<qint64, qint64> &, const QMap<qint64, MessageFlags> &flags,
+ const QMap<qint64, MessagePtr> &) {
+ expectedFlags = flags[1];
+ });
fetch->exec();
- MessageFlags expectedFlags = fetch->flags()[1];
qDebug() << "Read the message flags:" << expectedFlags;
qDebug() << "Add the \\Deleted flag...";
@@ -482,12 +503,22 @@ int main(int argc, char **argv)
scope.parts.clear();
scope.mode = FetchJob::FetchScope::Headers;
fetch->setScope(scope);
+ QMap<qint64, qint64> sizes;
+ QMap<qint64, MessagePtr> messages;
+
+ QObject::connect(fetch, static_cast<HeadersReceivedSignal>(&FetchJob::headersReceived),
+ fetch, [&](const QString &, const QMap<qint64,qint64> &,
+ const QMap<qint64, qint64> &sizes_,
+ const QMap<qint64, MessageFlags> &,
+ const QMap<qint64, MessagePtr> &msgs_) {
+ sizes = sizes_;
+ messages = msgs_;
+ });
fetch->exec();
Q_ASSERT_X(fetch->error() == 0, "FetchJob", fetch->errorString().toLocal8Bit().constData());
Q_ASSERT(session.state() == Session::Selected);
- QMap<qint64, MessagePtr> messages = fetch->messages();
foreach (qint64 id, messages.keys()) {
- qDebug() << "* Message" << id << "(" << fetch->sizes()[id] << "bytes )";
+ qDebug() << "* Message" << id << "(" << sizes[id] << "bytes )";
qDebug() << " From :" << messages[id]->from()->asUnicodeString();
qDebug() << " To :" << messages[id]->to()->asUnicodeString();
qDebug() << " Date :" << messages[id]->date()->asUnicodeString();
@@ -502,10 +533,17 @@ int main(int argc, char **argv)
scope.parts.clear();
scope.mode = FetchJob::FetchScope::Flags;
fetch->setScope(scope);
+ QMap<qint64, MessageFlags> flags;
+ QObject::connect(fetch, static_cast<HeadersReceivedSignal>(&FetchJob::headersReceived),
+ fetch, [&](const QString &, const QMap<qint64,qint64> &,
+ const QMap<qint64, qint64> &,
+ const QMap<qint64, MessageFlags> &flags_,
+ const QMap<qint64, MessagePtr> &) {
+ flags = flags_;
+ });
fetch->exec();
Q_ASSERT_X(fetch->error() == 0, "FetchJob", fetch->errorString().toLocal8Bit().constData());
Q_ASSERT(session.state() == Session::Selected);
- QMap<qint64, MessageFlags> flags = fetch->flags();
foreach (qint64 id, flags.keys()) {
qDebug() << "* Message" << id << "flags:" << flags[id];
}
@@ -517,10 +555,17 @@ int main(int argc, char **argv)
scope.parts.clear();
scope.mode = FetchJob::FetchScope::Structure;
fetch->setScope(scope);
+ QObject::connect(fetch, static_cast<HeadersReceivedSignal>(&FetchJob::headersReceived),
+ fetch, [&](const QString &, const QMap<qint64,qint64> &,
+ const QMap<qint64, qint64> &,
+ const QMap<qint64, MessageFlags> &,
+ const QMap<qint64, MessagePtr> &msgs_) {
+ messages = msgs_;
+ });
fetch->exec();
Q_ASSERT_X(fetch->error() == 0, "FetchJob", fetch->errorString().toLocal8Bit().constData());
Q_ASSERT(session.state() == Session::Selected);
- MessagePtr message = fetch->messages()[1];
+ MessagePtr message = messages[1];
dumpContentHelper(message.data());
qDebug();
@@ -531,10 +576,15 @@ int main(int argc, char **argv)
scope.parts << "2";
scope.mode = FetchJob::FetchScope::Headers;
fetch->setScope(scope);
+ QMap<qint64, MessageParts> allParts;
+ QObject::connect(fetch, static_cast<PartsReceivedSignal>(&FetchJob::partsReceived),
+ fetch, [&](const QString &, const QMap<qint64, qint64> &,
+ const QMap<qint64, MessageParts> &parts_) {
+ allParts = parts_;
+ });
fetch->exec();
Q_ASSERT_X(fetch->error() == 0, "FetchJob", fetch->errorString().toLocal8Bit().constData());
Q_ASSERT(session.state() == Session::Selected);
- QMap<qint64, MessageParts> allParts = fetch->parts();
foreach (qint64 id, allParts.keys()) {
qDebug() << "* Message" << id << "parts headers";
MessageParts parts = allParts[id];
@@ -554,10 +604,14 @@ int main(int argc, char **argv)
scope.parts << "2";
scope.mode = FetchJob::FetchScope::Content;
fetch->setScope(scope);
+ QObject::connect(fetch, static_cast<PartsReceivedSignal>(&FetchJob::partsReceived),
+ fetch, [&](const QString &, const QMap<qint64, qint64> &,
+ const QMap<qint64, MessageParts> &parts_) {
+ allParts = parts_;
+ });
fetch->exec();
Q_ASSERT_X(fetch->error() == 0, "FetchJob", fetch->errorString().toLocal8Bit().constData());
Q_ASSERT(session.state() == Session::Selected);
- allParts = fetch->parts();
foreach (int id, allParts.keys()) {
MessageParts parts = allParts[id];
foreach (const QByteArray &partId, parts.keys()) {