Changeset View
Changeset View
Standalone View
Standalone View
resources/pop3/jobs.cpp
Show All 23 Lines | |||||
24 | 24 | | |||
25 | #include <KIO/Scheduler> | 25 | #include <KIO/Scheduler> | ||
26 | #include <KIO/Slave> | 26 | #include <KIO/Slave> | ||
27 | #include <KIO/Job> | 27 | #include <KIO/Job> | ||
28 | #include <KIO/TransferJob> | 28 | #include <KIO/TransferJob> | ||
29 | #include "pop3resource_debug.h" | 29 | #include "pop3resource_debug.h" | ||
30 | #include <KLocalizedString> | 30 | #include <KLocalizedString> | ||
31 | 31 | | |||
32 | POPSession::POPSession(const QString &password) | 32 | POPSession::POPSession(Settings &settings, const QString &password) | ||
33 | : mCurrentJob(nullptr) | 33 | : mCurrentJob(nullptr) | ||
34 | , mPassword(password) | 34 | , mPassword(password) | ||
35 | , mSettings(settings) | ||||
35 | { | 36 | { | ||
36 | KIO::Scheduler::connect(SIGNAL(slaveError(KIO::Slave*,int,QString)), this, SLOT(slotSlaveError(KIO::Slave*,int,QString))); | 37 | KIO::Scheduler::connect(SIGNAL(slaveError(KIO::Slave*,int,QString)), this, SLOT(slotSlaveError(KIO::Slave*,int,QString))); | ||
37 | } | 38 | } | ||
38 | 39 | | |||
39 | POPSession::~POPSession() | 40 | POPSession::~POPSession() | ||
40 | { | 41 | { | ||
41 | closeSession(); | 42 | closeSession(); | ||
42 | } | 43 | } | ||
Show All 30 Lines | 73 | { | |||
73 | mCurrentJob = job; | 74 | mCurrentJob = job; | ||
74 | } | 75 | } | ||
75 | 76 | | |||
76 | KIO::MetaData POPSession::slaveConfig() const | 77 | KIO::MetaData POPSession::slaveConfig() const | ||
77 | { | 78 | { | ||
78 | KIO::MetaData m; | 79 | KIO::MetaData m; | ||
79 | 80 | | |||
80 | m.insert(QStringLiteral("progress"), QStringLiteral("off")); | 81 | m.insert(QStringLiteral("progress"), QStringLiteral("off")); | ||
81 | m.insert(QStringLiteral("tls"), Settings::self()->useTLS() ? QStringLiteral("on") : QStringLiteral("off")); | 82 | m.insert(QStringLiteral("tls"), mSettings.useTLS() ? QStringLiteral("on") : QStringLiteral("off")); | ||
82 | m.insert(QStringLiteral("pipelining"), (Settings::self()->pipelining()) ? QStringLiteral("on") : QStringLiteral("off")); | 83 | m.insert(QStringLiteral("pipelining"), (mSettings.pipelining()) ? QStringLiteral("on") : QStringLiteral("off")); | ||
83 | m.insert(QStringLiteral("useProxy"), Settings::self()->useProxy() ? QStringLiteral("on") : QStringLiteral("off")); | 84 | m.insert(QStringLiteral("useProxy"), mSettings.useProxy() ? QStringLiteral("on") : QStringLiteral("off")); | ||
84 | int type = Settings::self()->authenticationMethod(); | 85 | int type = mSettings.authenticationMethod(); | ||
85 | switch (type) { | 86 | switch (type) { | ||
86 | case MailTransport::Transport::EnumAuthenticationType::PLAIN: | 87 | case MailTransport::Transport::EnumAuthenticationType::PLAIN: | ||
87 | case MailTransport::Transport::EnumAuthenticationType::LOGIN: | 88 | case MailTransport::Transport::EnumAuthenticationType::LOGIN: | ||
88 | case MailTransport::Transport::EnumAuthenticationType::CRAM_MD5: | 89 | case MailTransport::Transport::EnumAuthenticationType::CRAM_MD5: | ||
89 | case MailTransport::Transport::EnumAuthenticationType::DIGEST_MD5: | 90 | case MailTransport::Transport::EnumAuthenticationType::DIGEST_MD5: | ||
90 | case MailTransport::Transport::EnumAuthenticationType::NTLM: | 91 | case MailTransport::Transport::EnumAuthenticationType::NTLM: | ||
91 | case MailTransport::Transport::EnumAuthenticationType::GSSAPI: | 92 | case MailTransport::Transport::EnumAuthenticationType::GSSAPI: | ||
92 | m.insert(QStringLiteral("auth"), QStringLiteral("SASL")); | 93 | m.insert(QStringLiteral("auth"), QStringLiteral("SASL")); | ||
Show All 34 Lines | 108 | { | |||
127 | } | 128 | } | ||
128 | return QString(); | 129 | return QString(); | ||
129 | } | 130 | } | ||
130 | 131 | | |||
131 | QUrl POPSession::getUrl() const | 132 | QUrl POPSession::getUrl() const | ||
132 | { | 133 | { | ||
133 | QUrl url; | 134 | QUrl url; | ||
134 | 135 | | |||
135 | if (Settings::self()->useSSL()) { | 136 | if (mSettings.useSSL()) { | ||
136 | url.setScheme(QStringLiteral("pop3s")); | 137 | url.setScheme(QStringLiteral("pop3s")); | ||
137 | } else { | 138 | } else { | ||
138 | url.setScheme(QStringLiteral("pop3")); | 139 | url.setScheme(QStringLiteral("pop3")); | ||
139 | } | 140 | } | ||
140 | 141 | | |||
141 | url.setUserName(Settings::self()->login()); | 142 | url.setUserName(mSettings.login()); | ||
142 | url.setPassword(mPassword); | 143 | url.setPassword(mPassword); | ||
143 | url.setHost(Settings::self()->host()); | 144 | url.setHost(mSettings.host()); | ||
144 | url.setPort(Settings::self()->port()); | 145 | url.setPort(mSettings.port()); | ||
145 | return url; | 146 | return url; | ||
146 | } | 147 | } | ||
147 | 148 | | |||
148 | bool POPSession::connectSlave() | 149 | bool POPSession::connectSlave() | ||
149 | { | 150 | { | ||
150 | mSlave = KIO::Scheduler::getConnectedSlave(getUrl(), slaveConfig()); | 151 | mSlave = KIO::Scheduler::getConnectedSlave(getUrl(), slaveConfig()); | ||
151 | return mSlave != nullptr; | 152 | return mSlave != nullptr; | ||
152 | } | 153 | } | ||
▲ Show 20 Lines • Show All 352 Lines • Show Last 20 Lines |