D24929: [pop3 kioslave] Port KTcpSocket (deprecated) to QSslSocket
Volker Krause
noreply at phabricator.kde.org
Fri Nov 1 22:18:18 GMT 2019
vkrause added a comment.
In D24929#557692 <https://phabricator.kde.org/D24929#557692>, @ahmadsamir wrote:
> Yep, I agree, it is ugly; I spent some time trying to use several methods (ternaries and such) but came back empty handed; I'm genuinely interested in how this can be made smarter :)
Maybe something like this:
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::NoProxy);
if (QSslSocket *sock = qobject_cast<...>(...)) {
sock->setProxy(proxy);
} else if (KTCpSocket *sock = qobject_cast<...>(...)) {
sock->setProxy(proxy);
} else {
qWarning()
}
Limits nesting depth to 1 on the ifs, avoids the nested boolean condition in the final if altogether, reduces scope of the variables and avoids the duplicated proxy code, and makes the eventual removal of the KTcpSocket branch fairly simple.
REPOSITORY
R44 KDE PIM Runtime
REVISION DETAIL
https://phabricator.kde.org/D24929
To: ahmadsamir, mlaurent
Cc: vkrause, kde-pim, fbampaloukas, dvasin, rodsevich, winterz, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20191101/b182e2a1/attachment.html>
More information about the kde-pim
mailing list