[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmail-account-wizard] src: GIT_SILENT: coding style (silent)
From: Montel Laurent <null () kde ! org>
Date: 2017-11-04 12:38:54
Message-ID: E1eAxiw-0002S1-4T () code ! kde ! org
[Download RAW message or body]
Git commit e577bc9e04bb12f2525a084818dc44c915e00de7 by Montel Laurent.
Committed on 04/11/2017 at 12:38.
Pushed by mlaurent into branch 'master'.
GIT_SILENT: coding style
M +1 -2 src/ispdb/autoconfigkolabfreebusy.cpp
M +3 -1 src/ispdb/autoconfigkolabfreebusy.h
M +2 -3 src/ispdb/autoconfigkolabldap.cpp
M +1 -1 src/ispdb/autoconfigkolabldap.h
M +5 -6 src/ispdb/autoconfigkolabmail.cpp
M +1 -1 src/ispdb/autoconfigkolabmail.h
M +6 -5 src/ispdb/autotests/autoconfigkolabfreebusy.cpp
M +5 -5 src/ispdb/autotests/autoconfigkolabldaptest.cpp
M +6 -5 src/ispdb/autotests/autoconfigkolabmailtest.cpp
M +13 -23 src/ispdb/ispdb.cpp
M +12 -4 src/ispdb/ispdb.h
M +2 -1 src/ispdb/main.cpp
M +0 -1 src/providerpage.h
https://commits.kde.org/kmail-account-wizard/e577bc9e04bb12f2525a084818dc44c915e00de7
diff --git a/src/ispdb/autoconfigkolabfreebusy.cpp \
b/src/ispdb/autoconfigkolabfreebusy.cpp index 6ccdcf2..ddbf224 100644
--- a/src/ispdb/autoconfigkolabfreebusy.cpp
+++ b/src/ispdb/autoconfigkolabfreebusy.cpp
@@ -23,7 +23,6 @@
AutoconfigKolabFreebusy::AutoconfigKolabFreebusy(QObject *parent)
: AutoconfigKolabMail(parent)
{
-
}
void AutoconfigKolabFreebusy::lookupInDb(bool auth, bool crypt)
@@ -85,7 +84,7 @@ freebusy AutoconfigKolabFreebusy::createFreebusyServer(const \
QDomElement &n) } else if (tagName == QLatin1String("authentication")) {
const QString type(f.text());
if (type == QLatin1String("none")
- || type == QLatin1String("plain")) {
+ || type == QLatin1String("plain")) {
s.authentication = Plain;
} else if (type == QLatin1String("basic")) {
s.authentication = Basic;
diff --git a/src/ispdb/autoconfigkolabfreebusy.h \
b/src/ispdb/autoconfigkolabfreebusy.h index b61e90d..b2e3b41 100644
--- a/src/ispdb/autoconfigkolabfreebusy.h
+++ b/src/ispdb/autoconfigkolabfreebusy.h
@@ -49,10 +49,12 @@ struct freebusy {
, authentication(Ispdb::Plain)
{
}
+
bool isValid() const
{
- return (port != -1);
+ return port != -1;
}
+
QString hostname;
QString username;
QString password;
diff --git a/src/ispdb/autoconfigkolabldap.cpp b/src/ispdb/autoconfigkolabldap.cpp
index c5fd3c2..37521c1 100644
--- a/src/ispdb/autoconfigkolabldap.cpp
+++ b/src/ispdb/autoconfigkolabldap.cpp
@@ -24,7 +24,6 @@
AutoconfigKolabLdap::AutoconfigKolabLdap(QObject *parent)
: AutoconfigKolabMail(parent)
{
-
}
void AutoconfigKolabLdap::lookupInDb(bool auth, bool crypt)
@@ -74,7 +73,7 @@ ldapServer AutoconfigKolabLdap::createLdapServer(const QDomElement \
&n) if (type == QLatin1String("plain")) {
s.socketType = KLDAP::LdapServer::None;
} else if (type == QLatin1String("SSL")) {
- s.socketType = KLDAP::LdapServer::SSL;
+ s.socketType = KLDAP::LdapServer::SSL;
} else if (type == QLatin1String("TLS")) {
s.socketType = KLDAP::LdapServer::TLS;
}
@@ -132,5 +131,5 @@ QHash< QString, ldapServer > AutoconfigKolabLdap::ldapServers() \
const
bool ldapServer::isValid() const
{
- return (port != -1);
+ return port != -1;
}
diff --git a/src/ispdb/autoconfigkolabldap.h b/src/ispdb/autoconfigkolabldap.h
index 14316ef..1f3399d 100644
--- a/src/ispdb/autoconfigkolabldap.h
+++ b/src/ispdb/autoconfigkolabldap.h
@@ -41,7 +41,6 @@ private:
ldapServer createLdapServer(const QDomElement &n);
QHash<QString, ldapServer> mLdapServers;
-
};
struct ldapServer {
@@ -55,6 +54,7 @@ struct ldapServer {
, sizeLimit(-1)
{
}
+
bool isValid() const;
QString hostname;
QString bindDn;
diff --git a/src/ispdb/autoconfigkolabmail.cpp b/src/ispdb/autoconfigkolabmail.cpp
index 0fe1875..e4d7888 100644
--- a/src/ispdb/autoconfigkolabmail.cpp
+++ b/src/ispdb/autoconfigkolabmail.cpp
@@ -23,7 +23,6 @@
AutoconfigKolabMail::AutoconfigKolabMail(QObject *parent)
: Ispdb(parent)
{
-
}
void AutoconfigKolabMail::startJob(const QUrl &url)
@@ -43,10 +42,10 @@ void AutoconfigKolabMail::startJob(const QUrl &url)
void AutoconfigKolabMail::slotResult(KJob *job)
{
if (job->error()) {
- if (job->error() == KIO::ERR_INTERNAL_SERVER || // error 500
- job->error() == KIO::ERR_UNKNOWN_HOST || // unknown host
- job->error() == KIO::ERR_COULD_NOT_CONNECT ||
- job->error() == KIO::ERR_DOES_NOT_EXIST) { // error 404
+ if (job->error() == KIO::ERR_INTERNAL_SERVER // error 500
+ || job->error() == KIO::ERR_UNKNOWN_HOST // unknown host
+ || job->error() == KIO::ERR_COULD_NOT_CONNECT
+ || job->error() == KIO::ERR_DOES_NOT_EXIST) { // error 404
if (serverType() == DataBase) {
setServerType(IspAutoConfig);
lookupInDb(false, false);
@@ -70,7 +69,7 @@ void AutoconfigKolabMail::slotResult(KJob *job)
if (responsecode == 401) {
lookupInDb(true, true);
return;
- } else if (responsecode != 200 && responsecode != 0 && responsecode != 304) {
+ } else if (responsecode != 200 && responsecode != 0 && responsecode != 304) {
//qCDebug(ACCOUNTWIZARD_LOG) << "Fetching failed with" << responsecode;
Q_EMIT finished(false);
return;
diff --git a/src/ispdb/autoconfigkolabmail.h b/src/ispdb/autoconfigkolabmail.h
index a6b102a..4711573 100644
--- a/src/ispdb/autoconfigkolabmail.h
+++ b/src/ispdb/autoconfigkolabmail.h
@@ -21,7 +21,7 @@
#include "ispdb.h"
-class AutoconfigKolabMail : public Ispdb
+class AutoconfigKolabMail : public Ispdb
{
Q_OBJECT
public:
diff --git a/src/ispdb/autotests/autoconfigkolabfreebusy.cpp \
b/src/ispdb/autotests/autoconfigkolabfreebusy.cpp index a27547e..e909e98 100644
--- a/src/ispdb/autotests/autoconfigkolabfreebusy.cpp
+++ b/src/ispdb/autotests/autoconfigkolabfreebusy.cpp
@@ -27,10 +27,10 @@
class TAutoconfFreebusy : public AutoconfigKolabFreebusy
{
public:
- void startJob(const QUrl &url) Q_DECL_OVERRIDE {
+ void startJob(const QUrl &url) Q_DECL_OVERRIDE
+ {
QCOMPARE(url, expectedUrls.takeFirst());
- if (replace.contains(url))
- {
+ if (replace.contains(url)) {
AutoconfigKolabFreebusy::startJob(replace[url]);
} else {
AutoconfigKolabFreebusy::startJob(url);
@@ -48,9 +48,9 @@ public:
AutoconfigKolabFreebusy *execIspdb(const QString &file)
{
const QString filePath = QStringLiteral(AUTOCONFIG_DATA_DIR) + \
QLatin1Char('/') + file;
- [](const QString & file) {
+ [](const QString &file) {
QVERIFY(QFile(file).exists());
- }(filePath);
+ } (filePath);
QEventLoop loop;
TAutoconfFreebusy *ispdb = new TAutoconfFreebusy();
@@ -177,6 +177,7 @@ private Q_SLOTS:
process.terminate();
process.waitForFinished();
}
+
public:
bool mReturn;
QProcess process;
diff --git a/src/ispdb/autotests/autoconfigkolabldaptest.cpp \
b/src/ispdb/autotests/autoconfigkolabldaptest.cpp index 221ca3f..c5b0461 100644
--- a/src/ispdb/autotests/autoconfigkolabldaptest.cpp
+++ b/src/ispdb/autotests/autoconfigkolabldaptest.cpp
@@ -27,10 +27,10 @@
class TAutoconfLdap : public AutoconfigKolabLdap
{
public:
- void startJob(const QUrl &url) Q_DECL_OVERRIDE {
+ void startJob(const QUrl &url) Q_DECL_OVERRIDE
+ {
QCOMPARE(url, expectedUrls.takeFirst());
- if (replace.contains(url))
- {
+ if (replace.contains(url)) {
AutoconfigKolabLdap::startJob(replace[url]);
} else {
AutoconfigKolabLdap::startJob(url);
@@ -48,9 +48,9 @@ public:
AutoconfigKolabLdap *execIspdb(const QString &file)
{
const QString filePath = QStringLiteral(AUTOCONFIG_DATA_DIR) + \
QLatin1Char('/') + file;
- [](const QString & file) {
+ [](const QString &file) {
QVERIFY(QFile(file).exists());
- }(filePath);
+ } (filePath);
QEventLoop loop;
TAutoconfLdap *ispdb = new TAutoconfLdap();
diff --git a/src/ispdb/autotests/autoconfigkolabmailtest.cpp \
b/src/ispdb/autotests/autoconfigkolabmailtest.cpp index 8390dcb..33d3aaa 100644
--- a/src/ispdb/autotests/autoconfigkolabmailtest.cpp
+++ b/src/ispdb/autotests/autoconfigkolabmailtest.cpp
@@ -28,10 +28,10 @@
class TAutoconfMail : public AutoconfigKolabMail
{
public:
- void startJob(const QUrl &url) Q_DECL_OVERRIDE {
+ void startJob(const QUrl &url) Q_DECL_OVERRIDE
+ {
QCOMPARE(url, expectedUrls.takeFirst());
- if (replace.contains(url))
- {
+ if (replace.contains(url)) {
AutoconfigKolabMail::startJob(replace[url]);
} else {
AutoconfigKolabMail::startJob(url);
@@ -54,9 +54,9 @@ public:
AutoconfigKolabMail *execIspdb(const QString &file)
{
const QString filePath = QStringLiteral(AUTOCONFIG_DATA_DIR) + \
QLatin1Char('/') + file;
- [](const QString & file) {
+ [](const QString &file) {
QVERIFY(QFile(file).exists());
- }(filePath);
+ } (filePath);
QEventLoop loop;
TAutoconfMail *ispdb = getAutoconf();
@@ -159,6 +159,7 @@ private Q_SLOTS:
process.terminate();
process.waitForFinished();
}
+
public:
bool mReturn;
QProcess process;
diff --git a/src/ispdb/ispdb.cpp b/src/ispdb/ispdb.cpp
index 5fcb9ac..d66408f 100644
--- a/src/ispdb/ispdb.cpp
+++ b/src/ispdb/ispdb.cpp
@@ -81,19 +81,16 @@ QUrl Ispdb::lookupUrl(const QString &type, const QString \
&version, bool auth, bo QUrl url;
const QString path = type + QStringLiteral("/config-v") + version + \
QStringLiteral(".xml"); switch (mServerType) {
- case IspAutoConfig: {
+ case IspAutoConfig:
url = QUrl(QStringLiteral("http://autoconfig.") + mAddr.domain.toLower() + \
QLatin1Char('/') + path); break;
- }
- case IspWellKnow: {
+ case IspWellKnow:
url = QUrl(QStringLiteral("http://") + mAddr.domain.toLower() + \
QStringLiteral("/.well-known/autoconfig/") + path); break;
- }
- case DataBase: {
+ case DataBase:
url = QUrl(QStringLiteral("https://autoconfig.thunderbird.net/v1.1/") + \
mAddr.domain.toLower()); break;
}
- }
if (mServerType != DataBase) {
if (crypt) {
url.setScheme(QStringLiteral("https"));
@@ -114,19 +111,16 @@ void Ispdb::slotResult(KJob *job)
bool lookupFinished = false;
switch (mServerType) {
- case IspAutoConfig: {
+ case IspAutoConfig:
mServerType = IspWellKnow;
break;
- }
- case IspWellKnow: {
+ case IspWellKnow:
lookupFinished = true;
break;
- }
- case DataBase: {
+ case DataBase:
mServerType = IspAutoConfig;
break;
}
- }
if (lookupFinished) {
Q_EMIT finished(false);
@@ -162,7 +156,6 @@ void Ispdb::parseResult(const QDomDocument &document)
QDomNode firstProvider = l.at(0);
QDomNode n = firstProvider.firstChild();
while (!n.isNull()) {
-
QDomElement e = n.toElement();
if (!e.isNull()) {
//qCDebug(ACCOUNTWIZARD_LOG) << qPrintable(e.tagName());
@@ -252,7 +245,7 @@ Server Ispdb::createServer(const QDomElement &n)
} else if (tagName == QLatin1String("authentication") && \
s.authentication == 0) { const QString type(f.text());
if (type == QLatin1String("password-cleartext")
- || type == QLatin1String("plain")) {
+ || type == QLatin1String("plain")) {
s.authentication = Plain;
} else if (type == QLatin1String("password-encrypted")
|| type == QLatin1String("secure")) {
@@ -282,7 +275,7 @@ identity Ispdb::createIdentity(const QDomElement &n)
//type="kolab" version="1.0" is the only identity that is defined
if (n.attribute(QStringLiteral("type")) != QStringLiteral("kolab")
- || n.attribute(QStringLiteral("version")) != QStringLiteral("1.0")) {
+ || n.attribute(QStringLiteral("version")) != QStringLiteral("1.0")) {
qCDebug(ACCOUNTWIZARD_LOG) << "unknown type of identity element.";
}
@@ -340,7 +333,7 @@ QString Ispdb::name(length l) const
if (l == Long) {
return mDisplayName;
} else if (l == Short) {
- return mDisplayShortName;
+ return mDisplayShortName;
} else {
return QString(); //make compiler happy. Not me.
}
@@ -375,21 +368,18 @@ void Ispdb::setServerType(Ispdb::searchServerType type)
{
if (type != mServerType || mStart) {
mServerType = type;
- mStart = false;
+ mStart = false;
switch (mServerType) {
- case IspAutoConfig: {
+ case IspAutoConfig:
Q_EMIT searchType(i18n("Lookup configuration: Email provider"));
break;
- }
- case IspWellKnow: {
+ case IspWellKnow:
Q_EMIT searchType(i18n("Lookup configuration: Trying common server \
name")); break;
- }
- case DataBase: {
+ case DataBase:
Q_EMIT searchType(i18n("Lookup configuration: Mozilla database"));
break;
}
- }
}
}
diff --git a/src/ispdb/ispdb.h b/src/ispdb/ispdb.h
index 875e984..02a3a1f 100644
--- a/src/ispdb/ispdb.h
+++ b/src/ispdb/ispdb.h
@@ -45,7 +45,9 @@ class Ispdb : public QObject
{
Q_OBJECT
public:
- enum socketType { None = 0, SSL, StartTLS };
+ enum socketType {
+ None = 0, SSL, StartTLS
+ };
/**
Ispdb uses custom authtyps, hence the enum here.
@@ -53,8 +55,12 @@ public:
In particular, note that Ispdb's Plain represents both Cleartext and AUTH Plain
We will always treat it as Cleartext
*/
- enum authType { Plain = 0, CramMD5, NTLM, GSSAPI, ClientIP, NoAuth, Basic, \
OAuth2 };
- enum length { Long = 0, Short };
+ enum authType {
+ Plain = 0, CramMD5, NTLM, GSSAPI, ClientIP, NoAuth, Basic, OAuth2
+ };
+ enum length {
+ Long = 0, Short
+ };
/** Constructor */
explicit Ispdb(QObject *parent = nullptr);
@@ -182,10 +188,12 @@ struct Server {
authentication = Ispdb::Plain;
socketType = Ispdb::None;
}
+
bool isValid() const
{
- return (port != -1);
+ return port != -1;
}
+
Ispdb::authType authentication;
Ispdb::socketType socketType;
QString hostname;
diff --git a/src/ispdb/main.cpp b/src/ispdb/main.cpp
index 54f840c..e1da426 100644
--- a/src/ispdb/main.cpp
+++ b/src/ispdb/main.cpp
@@ -71,6 +71,7 @@ QString authTypeToStr(Ispdb::authType authType)
}
return auth;
}
+
int main(int argc, char **argv)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
@@ -83,7 +84,7 @@ int main(int argc, char **argv)
KAboutLicense::LGPL,
i18n("(c) 2010 Omat Holding B.V."),
\
QStringLiteral("https://community.kde.org/KDE_PIM/Akonadi"));
- aboutData.addAuthor(i18n("Tom Albers"), i18n("Author"), \
QStringLiteral("toma@kde.org")); + aboutData.addAuthor(i18n("Tom Albers"), \
i18n("Author"), QStringLiteral("toma@kde.org"));
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("akonadi")));
QCommandLineParser parser;
diff --git a/src/providerpage.h b/src/providerpage.h
index c50db4f..0e5e92c 100644
--- a/src/providerpage.h
+++ b/src/providerpage.h
@@ -59,7 +59,6 @@ private:
void selectionChanged();
void providerStatusChanged(const KNS3::Entry &);
-
void findDesktopAndSetAssistant(const QStringList &list);
Ui::ProviderPage ui;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic