Commit 8268bcc1 authored by Laurent Montel's avatar Laurent Montel 😁

Modernize code

parent 1c0d57ab
Pipeline #33746 passed with stage
in 17 minutes and 8 seconds
......@@ -25,8 +25,6 @@ public:
};
Response()
: m_type(None)
, m_quantity(0)
{
}
......@@ -51,8 +49,8 @@ public:
bool parseResponse(const QByteArray &line);
private:
Type m_type;
uint m_quantity;
Type m_type = None;
uint m_quantity = 0;
QByteArray m_key;
QByteArray m_value;
QByteArray m_extra;
......
......@@ -29,11 +29,6 @@ Q_DECLARE_METATYPE(KSslErrorUiData)
Session::Session(QObject *parent)
: QObject(parent)
, m_thread(new SessionThread(this))
, m_currentJob(nullptr)
, m_state(None)
, m_supportsStartTls(false)
, m_connected(false)
, m_disconnected(true)
{
qRegisterMetaType<KManageSieve::AuthDetails>();
qRegisterMetaType<KManageSieve::Response>();
......
......@@ -46,7 +46,7 @@ public:
void killJob(SieveJob *job, KJob::KillVerbosity verbosity);
void sendData(const QByteArray &data);
QStringList sieveExtensions() const;
Q_REQUIRED_RESULT QStringList sieveExtensions() const;
/**
* @return true if we are not connected nor currently connecting, i.e. it's ok to call connectToHost()
......@@ -54,15 +54,15 @@ public:
bool disconnected() const;
private:
bool requestCapabilitiesAfterStartTls() const;
Q_REQUIRED_RESULT bool requestCapabilitiesAfterStartTls() const;
QStringList requestedSaslMethod() const;
bool allowUnencrypted() const;
Q_REQUIRED_RESULT QStringList requestedSaslMethod() const;
Q_REQUIRED_RESULT bool allowUnencrypted() const;
private Q_SLOTS:
void setErrorMessage(int error, const QString &msg);
void processResponse(const KManageSieve::Response &response, const QByteArray &data);
KManageSieve::AuthDetails requestAuthDetails(const QUrl &url);
Q_REQUIRED_RESULT KManageSieve::AuthDetails requestAuthDetails(const QUrl &url);
void authenticationDone();
void sslError(const KSslErrorUiData &data);
void sslDone();
......@@ -85,10 +85,10 @@ private:
StartTls,
Authenticating
};
State m_state;
State m_state = None;
bool m_supportsStartTls = false;
bool m_connected = false;
bool m_disconnected = false;
bool m_disconnected = true;
friend class SessionThread;
};
......
......@@ -36,10 +36,6 @@ static const sasl_callback_t callbacks[] = {
SessionThread::SessionThread(Session *session, QObject *parent)
: QObject(parent)
, m_session(session)
, m_sasl_conn(nullptr)
, m_sasl_client_interact(nullptr)
, m_pendingQuantity(-1)
, m_sslCheck(nullptr)
{
static bool saslInitialized = false;
if (!saslInitialized) {
......
......@@ -84,7 +84,7 @@ private:
QByteArray m_data;
Response m_lastResponse;
qint64 m_pendingQuantity;
qint64 m_pendingQuantity = -1;
QTimer *m_sslCheck = nullptr;
};
......
......@@ -54,8 +54,8 @@ Q_SIGNALS:
private:
Q_DISABLE_COPY(SieveCommonActionCondition)
QString mName;
QString mLabel;
const QString mName;
const QString mLabel;
QString mComment;
};
}
......
......@@ -85,7 +85,7 @@ private:
void reconnectWidget(SieveActionWidget *w);
void updateAddRemoveButton();
SieveEditorGraphicalModeWidget *mSieveGraphicalModeWidget = nullptr;
SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget;
};
}
......
......@@ -26,7 +26,6 @@ using namespace KSieveUi;
SieveScriptBlockWidget::SieveScriptBlockWidget(SieveEditorGraphicalModeWidget *graphicalModeWidget, QWidget *parent)
: SieveWidgetPageAbstract(parent)
, mMatchCondition(AndCondition)
, mSieveGraphicalModeWidget(graphicalModeWidget)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
......
......@@ -52,7 +52,7 @@ private:
void slotAddBlock();
void updateWidget();
void updateCondition();
MatchCondition mMatchCondition;
MatchCondition mMatchCondition = AndCondition;
QGroupBox *mConditions = nullptr;
SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget;
SieveConditionWidgetLister *mScriptConditionLister = nullptr;
......
......@@ -23,7 +23,6 @@ qreal zoomBy()
}
SieveEditorHelpHtmlWidget::SieveEditorHelpHtmlWidget(QWidget *parent)
: QWidget(parent)
, mZoomFactor(100)
{
QVBoxLayout *lay = new QVBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
......
......@@ -57,7 +57,7 @@ private:
SieveEditorLoadProgressIndicator *mProgressIndicator = nullptr;
KPIMTextEdit::SlideContainer *mSliderContainer = nullptr;
KSieveUi::FindBarWebEngineView *mFindBar = nullptr;
qreal mZoomFactor;
qreal mZoomFactor = 100;
};
}
......
......@@ -12,7 +12,6 @@
using namespace KSieveUi;
SieveEditorLoadProgressIndicator::SieveEditorLoadProgressIndicator(QObject *parent)
: QObject(parent)
, mProgressCount(0)
{
mProgressPix = KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), KIconLoader::SizeSmallMedium);
mProgressTimer = new QTimer(this);
......
......@@ -27,7 +27,7 @@ Q_SIGNALS:
private:
Q_DISABLE_COPY(SieveEditorLoadProgressIndicator)
void slotTimerDone();
int mProgressCount;
int mProgressCount = 0;
KPixmapSequence mProgressPix;
QTimer *mProgressTimer = nullptr;
};
......
......@@ -15,15 +15,10 @@ using namespace KSieveUi;
class KSieveUi::CheckScriptJobPrivate
{
public:
CheckScriptJobPrivate()
: mIsActive(false)
{
}
QUrl mUrl;
QString mOriginalScript;
QString mCurrentScript;
bool mIsActive;
bool mIsActive = false;
};
CheckScriptJob::CheckScriptJob(QObject *parent)
......
......@@ -38,7 +38,7 @@ private:
void writeMasterScript();
void writeUserScript();
QStringList mListUserActiveScripts;
QUrl mCurrentUrl;
const QUrl mCurrentUrl;
KManageSieve::SieveJob *mMasterJob = nullptr;
KManageSieve::SieveJob *mUserJob = nullptr;
};
......
......@@ -43,9 +43,9 @@ private:
void slotGetResult(KManageSieve::SieveJob *job, bool, const QString &, bool);
void emitSuccess(const QStringList &activeScriptList);
void emitError(const QString &msgError);
QString loadInclude();
QStringList extractActiveScript(const QString &doc);
QUrl mCurrentUrl;
Q_REQUIRED_RESULT QString loadInclude();
Q_REQUIRED_RESULT QStringList extractActiveScript(const QString &doc);
const QUrl mCurrentUrl;
KManageSieve::SieveJob *mSieveJob = nullptr;
QXmlStreamReader *mStreamReader = nullptr;
QStringList mActiveScripts;
......
......@@ -13,15 +13,10 @@ using namespace KSieveUi;
class KSieveUi::RenameScriptJobPrivate
{
public:
RenameScriptJobPrivate()
: mIsActive(false)
{
}
QString mNewName;
QUrl mOldUrl;
QUrl mNewUrl;
bool mIsActive;
bool mIsActive = false;
};
RenameScriptJob::RenameScriptJob(QObject *parent)
......
......@@ -7,7 +7,6 @@
#include "sieveimapinstance.h"
using namespace KSieveUi;
SieveImapInstance::SieveImapInstance()
: mStatus(Idle)
{
}
......
......@@ -50,7 +50,7 @@ private:
QStringList mCapabilities;
QString mName;
QString mIdentifier;
Status mStatus;
Status mStatus = Idle;
};
}
Q_DECLARE_TYPEINFO(KSieveUi::SieveImapInstance, Q_MOVABLE_TYPE);
......
......@@ -50,8 +50,8 @@ private:
QStringList mActiveScripts;
QStringList mSieveCapabilities;
QString mScript;
QString mServerName;
QUrl mUrl;
const QString mServerName;
const QUrl mUrl;
KManageSieve::SieveJob *mSieveJob = nullptr;
ParseUserScriptJob *mParseJob = nullptr;
int mScriptPos = -1;
......
......@@ -33,7 +33,7 @@ private:
Q_DISABLE_COPY(VacationHelperJob)
void slotGetScriptList(KManageSieve::SieveJob *job, bool success, const QStringList &scriptList, const QString &activeScript);
void killJob();
QUrl mUrl;
const QUrl mUrl;
KManageSieve::SieveJob *mSieveJob = nullptr;
};
}
......
......@@ -11,16 +11,6 @@
using namespace KSieveUi;
VacationDataExtractor::VacationDataExtractor()
: KSieve::ScriptBuilder()
, mContext(None)
, mNotificationInterval(0)
, mActive(true)
, mInIfBlock(false)
, mFoundInBlock(false)
, mBlockLevel(0)
, mLineStart(0)
, mLineEnd(0)
, mMailAction(VacationUtils::Keep)
, mMailActionContext(None)
{
qCDebug(LIBKSIEVE_LOG);
}
......
......@@ -729,21 +729,21 @@ private:
void stringListArgumentEnd() override;
private:
Context mContext;
int mNotificationInterval;
Context mContext = None;
int mNotificationInterval = 0;
QString mMessageText;
QString mSubject;
QStringList mAliases;
bool mActive;
bool mInIfBlock;
bool mFoundInBlock;
int mBlockLevel;
bool mActive = true;
bool mInIfBlock = false;
bool mFoundInBlock = false;
int mBlockLevel = 0;
QString mIfComment;
int mLineStart;
int mLineEnd;
int mLineStart = 0;
int mLineEnd = 0;
VacationUtils::MailAction mMailAction;
Context mMailActionContext;
VacationUtils::MailAction mMailAction = VacationUtils::Keep;
Context mMailActionContext = None;
QString mMailActionRecipient;
void reset();
......
......@@ -35,8 +35,7 @@ class KSieveUi::ManageSieveWidgetPrivate
{
public:
ManageSieveWidgetPrivate()
: mTreeView(nullptr)
, mClearAll(false)
: mClearAll(false)
, mBlockSignal(false)
{
}
......
......@@ -36,9 +36,8 @@ namespace KSieve {
//
Lexer::Lexer(const char *scursor, const char *send, int options)
: i(nullptr)
: i(new Impl(scursor, send, options))
{
i = new Impl(scursor, send, options);
}
Lexer::~Lexer()
......
......@@ -28,9 +28,9 @@ namespace KSieve {
//
Parser::Parser(const char *scursor, const char *const send, int options)
: i(nullptr)
: i(new Impl(scursor, send, options))
{
i = new Impl(scursor, send, options);
}
Parser::~Parser()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment