Commit cef954a3 authored by Laurent Montel's avatar Laurent Montel 😁

Coding style

parent 548f610e
......@@ -24,12 +24,10 @@
ServerSieveSettingsTest::ServerSieveSettingsTest(QObject *parent)
: QObject(parent)
{
}
ServerSieveSettingsTest::~ServerSieveSettingsTest()
{
}
void ServerSieveSettingsTest::shouldHaveDefaultValue()
......@@ -101,7 +99,6 @@ void ServerSieveSettingsTest::shouldEmitSignalWithValueTrue()
widget.setServerName(QStringLiteral(" "));
QCOMPARE(spy.count(), 4);
QCOMPARE(spy.at(3).at(0).toBool(), false);
}
QTEST_MAIN(ServerSieveSettingsTest)
......@@ -26,12 +26,10 @@
SieveEditorConfigureServerPageTest::SieveEditorConfigureServerPageTest(QObject *parent)
: QObject(parent)
{
}
SieveEditorConfigureServerPageTest::~SieveEditorConfigureServerPageTest()
{
}
void SieveEditorConfigureServerPageTest::shouldHaveDefaultValue()
......
......@@ -24,12 +24,10 @@
SieveEditorUtilTest::SieveEditorUtilTest(QObject *parent)
: QObject(parent)
{
}
SieveEditorUtilTest::~SieveEditorUtilTest()
{
}
void SieveEditorUtilTest::shouldHaveDefaultValue()
......@@ -91,4 +89,3 @@ void SieveEditorUtilTest::shouldBeEqual()
}
QTEST_APPLESS_MAIN(SieveEditorUtilTest)
......@@ -28,12 +28,10 @@
ImportImapSettingFinishPageTest::ImportImapSettingFinishPageTest(QObject *parent)
: QObject(parent)
{
}
ImportImapSettingFinishPageTest::~ImportImapSettingFinishPageTest()
{
}
void ImportImapSettingFinishPageTest::shouldHaveDefaultValue()
......
......@@ -26,12 +26,10 @@
ImportImapSettingNoFoundPageTest::ImportImapSettingNoFoundPageTest(QObject *parent)
: QObject(parent)
{
}
ImportImapSettingNoFoundPageTest::~ImportImapSettingNoFoundPageTest()
{
}
void ImportImapSettingNoFoundPageTest::shouldHaveDefaultValue()
......
......@@ -33,7 +33,6 @@ ImportImapSettingProgressPageTest::ImportImapSettingProgressPageTest(QObject *pa
ImportImapSettingProgressPageTest::~ImportImapSettingProgressPageTest()
{
}
void ImportImapSettingProgressPageTest::shouldHaveDefaultValue()
......
......@@ -35,7 +35,6 @@ ImportImapSettingsAkonadiCheckJobTest::ImportImapSettingsAkonadiCheckJobTest(QOb
ImportImapSettingsAkonadiCheckJobTest::~ImportImapSettingsAkonadiCheckJobTest()
{
}
void ImportImapSettingsAkonadiCheckJobTest::initTestCase()
......
......@@ -33,7 +33,6 @@ ImportImapSettingSearchPageTest::ImportImapSettingSearchPageTest(QObject *parent
ImportImapSettingSearchPageTest::~ImportImapSettingSearchPageTest()
{
}
void ImportImapSettingSearchPageTest::shouldHaveDefaultValue()
......@@ -55,7 +54,9 @@ void ImportImapSettingSearchPageTest::shouldHaveDefaultValue()
void ImportImapSettingSearchPageTest::shouldAddCheckPrograms()
{
ImportImapSettingSearchPage w;
const QStringList lst { QStringLiteral("foo"), QStringLiteral("bla"), QStringLiteral("do") };
const QStringList lst {
QStringLiteral("foo"), QStringLiteral("bla"), QStringLiteral("do")
};
w.setProgramList(lst);
QListWidget *mFoundProgramList = w.findChild<QListWidget *>(QStringLiteral("foundprogramlist"));
......
......@@ -21,7 +21,6 @@
ImportImapSettingsPasswordTest::ImportImapSettingsPasswordTest()
{
}
void ImportImapSettingsPasswordTest::importPasswords(SieveEditorUtil::SieveServerConfig &config, const QString &filename, bool reuseImapSettings)
......
......@@ -36,7 +36,6 @@ ImportImapSettingsThunderbirdCheckJobTest::ImportImapSettingsThunderbirdCheckJob
ImportImapSettingsThunderbirdCheckJobTest::~ImportImapSettingsThunderbirdCheckJobTest()
{
}
void ImportImapSettingsThunderbirdCheckJobTest::shouldHaveDefaultValue()
......
......@@ -21,11 +21,10 @@
#include "abstractimapsettingspassword.h"
AbstractImapSettingsCheckJob::AbstractImapSettingsCheckJob(QObject *parent)
: QObject(parent),
mPasswordImporter(nullptr),
mSettingsWereImported(false)
: QObject(parent)
, mPasswordImporter(nullptr)
, mSettingsWereImported(false)
{
}
AbstractImapSettingsCheckJob::~AbstractImapSettingsCheckJob()
......
......@@ -21,12 +21,10 @@
AbstractImapSettingsPassword::AbstractImapSettingsPassword()
{
}
AbstractImapSettingsPassword::~AbstractImapSettingsPassword()
{
}
void AbstractImapSettingsPassword::importPasswords(SieveEditorUtil::SieveServerConfig &config, const QString &filename, bool reuseImapSettings)
......
......@@ -35,13 +35,12 @@ ImportImapSettingsAkonadiCheckJob::ImportImapSettingsAkonadiCheckJob(QObject *pa
ImportImapSettingsAkonadiCheckJob::~ImportImapSettingsAkonadiCheckJob()
{
}
bool ImportImapSettingsAkonadiCheckJob::resourceCanHaveSieveSupport(const QString &filename) const
{
return filename.startsWith(QStringLiteral("akonadi_kolab_resource")) ||
filename.startsWith(QStringLiteral("akonadi_imap_resource"));
return filename.startsWith(QStringLiteral("akonadi_kolab_resource"))
|| filename.startsWith(QStringLiteral("akonadi_imap_resource"));
}
void ImportImapSettingsAkonadiCheckJob::start()
......@@ -111,7 +110,9 @@ bool ImportImapSettingsAkonadiCheckJob::importSettings(const QString &directory,
if (reuseImapSettings) {
config.sieveSettings.serverName = imapServerName;
config.sieveSettings.userName = userName;
config.sieveSettings.authenticationType = static_cast<MailTransport::Transport::EnumAuthenticationType::type>(sieveGroup.readEntry(QStringLiteral("Authentication"), static_cast<int>(MailTransport::Transport::EnumAuthenticationType::PLAIN)));
config.sieveSettings.authenticationType
= static_cast<MailTransport::Transport::EnumAuthenticationType::type>(sieveGroup.readEntry(QStringLiteral("Authentication"),
static_cast<int>(MailTransport::Transport::EnumAuthenticationType::PLAIN)));
} else {
const QString sieveCustomUserName = sieveGroup.readEntry(QStringLiteral("SieveCustomUsername"));
config.sieveSettings.userName = sieveCustomUserName;
......
......@@ -24,12 +24,10 @@
ImportImapSettingsAkonadiPassword::ImportImapSettingsAkonadiPassword()
: AbstractImapSettingsPassword()
{
}
ImportImapSettingsAkonadiPassword::~ImportImapSettingsAkonadiPassword()
{
}
void ImportImapSettingsAkonadiPassword::importPasswords(SieveEditorUtil::SieveServerConfig &config, const QString &filename, bool reuseImapSettings)
......@@ -56,5 +54,4 @@ void ImportImapSettingsAkonadiPassword::importPasswords(SieveEditorUtil::SieveSe
}
}
}
}
......@@ -31,12 +31,10 @@ LIBSIEVEEDITOR_EXPORT QString sieveeditor_thunderbird_default_toplevel_path = QD
ImportImapSettingsThunderbirdCheckJob::ImportImapSettingsThunderbirdCheckJob(QObject *parent)
: AbstractImapSettingsCheckJob(parent)
{
}
ImportImapSettingsThunderbirdCheckJob::~ImportImapSettingsThunderbirdCheckJob()
{
}
//Copy from mailimporter
......@@ -107,19 +105,18 @@ bool ImportImapSettingsThunderbirdCheckJob::importSettings(const QString &direct
while (!stream.atEnd()) {
const QString line = stream.readLine();
if (line.startsWith(QStringLiteral("user_pref"))) {
if (line.contains(QStringLiteral("mail.server.")) ||
line.contains(QStringLiteral("mail.account.")) ||
line.contains(QStringLiteral("mail.accountmanager.")) ||
line.contains(QStringLiteral("extensions.sieve.account."))) {
if (line.contains(QStringLiteral("mail.server."))
|| line.contains(QStringLiteral("mail.account."))
|| line.contains(QStringLiteral("mail.accountmanager."))
|| line.contains(QStringLiteral("extensions.sieve.account."))) {
insertIntoMap(line);
}
} else {
if (!line.startsWith(QLatin1Char('#')) &&
line.isEmpty() &&
line.startsWith(QStringLiteral("/*")) &&
line.startsWith(QStringLiteral(" */")) &&
line.startsWith(QStringLiteral(" *"))) {
if (!line.startsWith(QLatin1Char('#'))
&& line.isEmpty()
&& line.startsWith(QStringLiteral("/*"))
&& line.startsWith(QStringLiteral(" */"))
&& line.startsWith(QStringLiteral(" *"))) {
qCDebug(SIEVEEDITOR_LOG) << " unstored line :" << line;
}
}
......@@ -200,7 +197,6 @@ bool ImportImapSettingsThunderbirdCheckJob::importSettings(const QString &direct
} else {
//qCDebug(SIEVEEDITOR_LOG) << "Account " << accountName << " is not a imap account. Skip it.";
}
}
return atLeastAnAccountFound;
}
......
......@@ -43,11 +43,9 @@ ImportImapSettingFinishPage::ImportImapSettingFinishPage(QWidget *parent)
ImportImapSettingFinishPage::~ImportImapSettingFinishPage()
{
}
void ImportImapSettingFinishPage::addSummary(const QString &name)
{
mTextEdit->append(name);
}
......@@ -41,5 +41,4 @@ ImportImapSettingNoFoundPage::ImportImapSettingNoFoundPage(QWidget *parent)
ImportImapSettingNoFoundPage::~ImportImapSettingNoFoundPage()
{
}
......@@ -25,8 +25,8 @@
#include <QTextEdit>
ImportImapSettingProgressPage::ImportImapSettingProgressPage(QWidget *parent)
: QWidget(parent),
mSettingsFound(false)
: QWidget(parent)
, mSettingsFound(false)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainlayout"));
......@@ -39,7 +39,6 @@ ImportImapSettingProgressPage::ImportImapSettingProgressPage(QWidget *parent)
ImportImapSettingProgressPage::~ImportImapSettingProgressPage()
{
}
void ImportImapSettingProgressPage::addProgressInfo(const QString &str)
......
......@@ -41,7 +41,6 @@ ImportImapSettingSearchPage::ImportImapSettingSearchPage(QWidget *parent)
ImportImapSettingSearchPage::~ImportImapSettingSearchPage()
{
}
void ImportImapSettingSearchPage::setProgramList(const QStringList &lst)
......
......@@ -28,4 +28,3 @@ int main(int argc, char *argv[])
ImportImapSettingWizard wizard;
return wizard.exec();
}
......@@ -34,7 +34,6 @@ ServerSieveListWidget::ServerSieveListWidget(QWidget *parent)
ServerSieveListWidget::~ServerSieveListWidget()
{
}
void ServerSieveListWidget::readConfig()
......@@ -104,12 +103,10 @@ void ServerSieveListWidget::addServerConfig()
ServerSieveListWidgetItem::ServerSieveListWidgetItem(QListWidget *parent)
: QListWidgetItem(parent)
{
}
ServerSieveListWidgetItem::~ServerSieveListWidgetItem()
{
}
SieveEditorUtil::SieveServerConfig ServerSieveListWidgetItem::serverConfig() const
......
......@@ -59,7 +59,7 @@ static void addAuthenticationItem(QComboBox *authCombo, MailTransport::Transport
static MailTransport::Transport::EnumAuthenticationType::type getCurrentAuthMode(QComboBox *authCombo)
{
MailTransport::Transport::EnumAuthenticationType::type authtype = (MailTransport::Transport::EnumAuthenticationType::type) authCombo->itemData(authCombo->currentIndex()).toInt();
MailTransport::Transport::EnumAuthenticationType::type authtype = (MailTransport::Transport::EnumAuthenticationType::type)authCombo->itemData(authCombo->currentIndex()).toInt();
//qCDebug(SIEVEEDITOR_LOG) << "current auth mode: " << authenticationModeString( authtype );
return authtype;
}
......@@ -73,15 +73,15 @@ static void setCurrentAuthMode(QComboBox *authCombo, MailTransport::Transport::E
}
//qCDebug(SIEVEEDITOR_LOG) << "found corresponding index: " << index << "with data" << authenticationModeString( (MailTransport::Transport::EnumAuthenticationType::type) authCombo->itemData( index ).toInt() );
authCombo->setCurrentIndex(index);
MailTransport::Transport::EnumAuthenticationType::type t = (MailTransport::Transport::EnumAuthenticationType::type) authCombo->itemData(authCombo->currentIndex()).toInt();
MailTransport::Transport::EnumAuthenticationType::type t = (MailTransport::Transport::EnumAuthenticationType::type)authCombo->itemData(authCombo->currentIndex()).toInt();
//qCDebug(SIEVEEDITOR_LOG) << "selected auth mode:" << authenticationModeString( t );
Q_ASSERT(t == authtype);
}
ServerSieveSettings::ServerSieveSettings(QWidget *parent) :
QWidget(parent),
ui(new Ui::ServerSieveSettings),
mServerTest(nullptr)
ServerSieveSettings::ServerSieveSettings(QWidget *parent)
: QWidget(parent)
, ui(new Ui::ServerSieveSettings)
, mServerTest(nullptr)
{
ui->setupUi(this);
ui->serversievelabel->setMinimumSize(ui->serversievelabel->sizeHint());
......@@ -375,7 +375,7 @@ void ServerSieveSettings::slotSafetyChanged()
QVector<int> protocols;
switch (ui->safeImapGroup->checkedId()) {
case KSieveUi::SieveImapAccountSettings::Unencrypted :
case KSieveUi::SieveImapAccountSettings::Unencrypted:
qCDebug(SIEVEEDITOR_LOG) << "safeImapGroup: unencrypted";
protocols = mServerTest->normalProtocols();
break;
......@@ -394,12 +394,12 @@ void ServerSieveSettings::slotSafetyChanged()
ui->imapAuthenticationCombo->clear();
addAuthenticationItem(ui->imapAuthenticationCombo, MailTransport::Transport::EnumAuthenticationType::CLEAR);
for (int prot : qAsConst(protocols)) {
addAuthenticationItem(ui->imapAuthenticationCombo, (MailTransport::Transport::EnumAuthenticationType::type) prot);
addAuthenticationItem(ui->imapAuthenticationCombo, (MailTransport::Transport::EnumAuthenticationType::type)prot);
}
if (protocols.isEmpty()) {
qCDebug(SIEVEEDITOR_LOG) << "no authmodes found";
} else {
setCurrentAuthMode(ui->imapAuthenticationCombo, (MailTransport::Transport::EnumAuthenticationType::type) protocols.constFirst());
setCurrentAuthMode(ui->imapAuthenticationCombo, (MailTransport::Transport::EnumAuthenticationType::type)protocols.constFirst());
}
mServerTest->deleteLater();
mServerTest = nullptr;
......
......@@ -24,12 +24,10 @@
#include "sieveeditorutil.h"
#include "libsieveeditor_private_export.h"
namespace Ui
{
namespace Ui {
class ServerSieveSettings;
}
namespace MailTransport
{
namespace MailTransport {
class ServerTest;
}
class QComboBox;
......
......@@ -25,11 +25,11 @@
#include <QDir>
SieveEditorBookmarks::SieveEditorBookmarks(SieveEditorMainWindow *mainWindow, KActionCollection *collection, QMenu *menu, QObject *parent)
: QObject(parent),
KBookmarkOwner(),
mBookmarkMenu(nullptr),
mMenu(menu),
mMainWindow(mainWindow)
: QObject(parent)
, KBookmarkOwner()
, mBookmarkMenu(nullptr)
, mMenu(menu)
, mMainWindow(mainWindow)
{
QString bookmarkFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("sieveeditor/bookmarks.xml"));
......@@ -71,4 +71,3 @@ QUrl SieveEditorBookmarks::currentUrl() const
{
return mMainWindow->currentHelpUrl();
}
......@@ -36,7 +36,6 @@ SieveEditorCentralWidget::SieveEditorCentralWidget(QWidget *parent, KActionColle
SieveEditorCentralWidget::~SieveEditorCentralWidget()
{
}
void SieveEditorCentralWidget::slotServerSieveFound(bool hasServer)
......
......@@ -46,5 +46,4 @@ SieveEditorConfigureServerPage::SieveEditorConfigureServerPage(QWidget *parent)
SieveEditorConfigureServerPage::~SieveEditorConfigureServerPage()
{
}
......@@ -24,9 +24,9 @@
#include <KLocalizedString>
#include <KMessageBox>
SieveEditorConfigureServerWidget::SieveEditorConfigureServerWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SieveEditorConfigureServerWidget)
SieveEditorConfigureServerWidget::SieveEditorConfigureServerWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::SieveEditorConfigureServerWidget)
{
ui->setupUi(this);
connect(ui->modifyServer, &QPushButton::clicked, this, &SieveEditorConfigureServerWidget::slotModifyServer);
......
......@@ -22,8 +22,7 @@
#include <QWidget>
namespace Ui
{
namespace Ui {
class SieveEditorConfigureServerWidget;
}
......
......@@ -28,7 +28,6 @@ SieveEditorEmptyTabWidgetLabel::SieveEditorEmptyTabWidgetLabel(QWidget *parent)
SieveEditorEmptyTabWidgetLabel::~SieveEditorEmptyTabWidgetLabel()
{
}
void SieveEditorEmptyTabWidgetLabel::init()
......
......@@ -28,8 +28,7 @@ class SieveEditorCentralWidget;
class QLabel;
class SieveEditorBookmarks;
class KActionMenu;
namespace PimCommon
{
namespace PimCommon {
class KActionMenuChangeCase;
}
......
......@@ -31,12 +31,10 @@ using namespace KSieveUi;
SieveEditorManageSieveWidget::SieveEditorManageSieveWidget(QWidget *parent)
: KSieveUi::ManageSieveWidget(parent)
{
}
SieveEditorManageSieveWidget::~SieveEditorManageSieveWidget()
{
}
bool SieveEditorManageSieveWidget::refreshList()
......@@ -71,4 +69,3 @@ bool SieveEditorManageSieveWidget::refreshList()
}
return noImapFound;
}
......@@ -31,9 +31,9 @@
#include <QVBoxLayout>
SieveEditorPageWidget::SieveEditorPageWidget(QWidget *parent)
: QWidget(parent),
mWasActive(false),
mIsNewScript(false)
: QWidget(parent)
, mWasActive(false)
, mIsNewScript(false)
{
QVBoxLayout *vbox = new QVBoxLayout;
setLayout(vbox);
......@@ -57,7 +57,6 @@ void SieveEditorPageWidget::slotCheckSyntaxClicked()
const QString script = mSieveEditorWidget->script();
if (script.isEmpty()) {
return;
}
mSieveEditorWidget->addNormalMessage(i18n("Uploading script to server for checking it, please wait..."));
......@@ -142,10 +141,10 @@ void SieveEditorPageWidget::slotPutResult(KManageSieve::SieveJob *job, bool succ
mSieveEditorWidget->setModified(false);
} else {
const QString msg = job->errorString();
if (msg.isEmpty())
if (msg.isEmpty()) {
KMessageBox::error(nullptr, i18n("Uploading the Sieve script failed.\n"
"The server responded:\n%1", msg, i18n("Sieve Error")));
else {
} else {
KMessageBox::error(nullptr, msg, i18n("Sieve Error"));
}
}
......
......@@ -22,12 +22,10 @@
#include <QWidget>
#include <QUrl>
#include "ksieveui/sieveeditorwidget.h"
namespace KManageSieve
{
namespace KManageSieve {
class SieveJob;
}
namespace KSieveUi
{
namespace KSieveUi {
class SieveEditorWidget;
}
......
......@@ -40,7 +40,6 @@ SieveEditorScriptManagerWidget::SieveEditorScriptManagerWidget(QWidget *parent)
SieveEditorScriptManagerWidget::~SieveEditorScriptManagerWidget()
{
}
void SieveEditorScriptManagerWidget::slotUpdateButtons(QTreeWidgetItem *item)
......
......@@ -25,8 +25,7 @@
class SieveEditorManageSieveWidget;
class QTreeWidgetItem;
namespace KSieveUi
{
namespace KSieveUi {
class SieveImapAccountSettings;
}
class SieveEditorScriptManagerWidget : public QWidget
......
......@@ -33,7 +33,6 @@ SieveEditorScriptWidget::SieveEditorScriptWidget(QWidget *parent)
SieveEditorScriptWidget::~SieveEditorScriptWidget()
{
}
void SieveEditorScriptWidget::setScript(const QString &script)
......
......@@ -21,8 +21,7 @@
#define SIEVEEDITORSCRIPTWIDGET_H
#include <QWidget>
namespace KSieveUi
{
namespace KSieveUi {
class SieveEditor;
}
class SieveEditorScriptWidget : public QWidget
......
......@@ -40,7 +40,6 @@ SieveEditorTabWidget::SieveEditorTabWidget(KActionCollection *ac, QWidget *paren
SieveEditorTabWidget::~SieveEditorTabWidget()
{
}
void SieveEditorTabWidget::slotTabContextMenuRequest(const QPoint &pos)
......
......@@ -72,10 +72,10 @@ QUrl SieveEditorUtil::SieveServerConfig::url() const
bool SieveEditorUtil::SieveServerConfig::operator ==(const SieveEditorUtil::SieveServerConfig &other) const
{
const bool result = (enabled == other.enabled) &&
(useImapCustomServer == other.useImapCustomServer) &&
(sieveSettings == other.sieveSettings) &&
(sieveImapAccountSettings == other.sieveImapAccountSettings);
const bool result = (enabled == other.enabled)
&& (useImapCustomServer == other.useImapCustomServer)
&& (sieveSettings == other.sieveSettings)
&& (sieveImapAccountSettings == other.sieveImapAccountSettings);
if (!result) {
qCDebug(SIEVEEDITOR_LOG) << "enabled " << enabled << " other.enabled " << other.enabled;
qCDebug(SIEVEEDITOR_LOG) << "useImapCustomServer " << useImapCustomServer << " other.useImapCustomServer " << other.useImapCustomServer;
......@@ -111,7 +111,9 @@ QVector<SieveEditorUtil::SieveServerConfig> SieveEditorUtil::readServerSieveConf
wallet->readPassword(walletEntry, passwd);
sieve.sieveSettings.password = passwd;
}
sieve.sieveSettings.authenticationType = static_cast<MailTransport::Transport::EnumAuthenticationType::type>(group.readEntry(QStringLiteral("Authentication"), static_cast<int>(MailTransport::Transport::EnumAuthenticationType::PLAIN)));