Commit 6ca0a66b authored by Laurent Montel's avatar Laurent Montel
Browse files

Add explicit, const'ify pointer, initialize variable in headers

parent 007dbc98
Pipeline #231293 failed with stage
in 8 minutes and 40 seconds
......@@ -207,17 +207,17 @@ SetupWizard::Url::List SetupWizard::urls() const
CredentialsPage::CredentialsPage(QWidget *parent)
: QWizardPage(parent)
, mUserName(new QLineEdit(this))
, mPassword(new KPasswordLineEdit(this))
{
setTitle(i18n("Login Credentials"));
setSubTitle(i18n("Enter your credentials to login to the groupware server"));
auto layout = new QFormLayout(this);
mUserName = new QLineEdit(this);
layout->addRow(i18n("User:"), mUserName);
registerField(QStringLiteral("credentialsUserName*"), mUserName);
mPassword = new KPasswordLineEdit(this);
mPassword->setRevealPasswordAvailable(KAuthorized::authorize(QStringLiteral("lineedit_reveal_password")));
layout->addRow(i18n("Password:"), mPassword);
registerField(QStringLiteral("credentialsPassword*"), mPassword, "password", SIGNAL(passwordChanged(QString)));
......@@ -251,24 +251,24 @@ int CredentialsPage::nextId() const
PredefinedProviderPage::PredefinedProviderPage(QWidget *parent)
: QWizardPage(parent)
, mLabel(new QLabel(this))
, mProviderGroup(new QButtonGroup(this))
, mUseProvider(new QRadioButton(this))
, mDontUseProvider(new QRadioButton(i18n("No, choose another server"), this))
{
setTitle(i18n("Predefined provider found"));
setSubTitle(i18n("Select if you want to use the auto-detected provider"));
auto layout = new QVBoxLayout(this);
mLabel = new QLabel(this);
layout->addWidget(mLabel);
mProviderGroup = new QButtonGroup(this);
mProviderGroup->setExclusive(true);
mUseProvider = new QRadioButton(this);
mProviderGroup->addButton(mUseProvider);
mUseProvider->setChecked(true);
layout->addWidget(mUseProvider);
mDontUseProvider = new QRadioButton(i18n("No, choose another server"), this);
mProviderGroup->addButton(mDontUseProvider);
layout->addWidget(mDontUseProvider);
}
......@@ -499,6 +499,7 @@ void ConnectionPage::urlElementChanged()
CheckPage::CheckPage(QWidget *parent)
: QWizardPage(parent)
, mStatusLabel(new QTextBrowser(this))
{
setTitle(i18n("Test Connection"));
setSubTitle(i18n("You can test now whether the groupware server can be accessed with the current configuration"));
......@@ -506,10 +507,9 @@ CheckPage::CheckPage(QWidget *parent)
auto layout = new QVBoxLayout(this);
auto button = new QPushButton(i18n("Test Connection"));
auto button = new QPushButton(i18n("Test Connection"), this);
layout->addWidget(button);
mStatusLabel = new QTextBrowser;
layout->addWidget(mStatusLabel);
connect(button, &QRadioButton::clicked, this, &CheckPage::checkConnection);
......
......@@ -62,10 +62,10 @@ public:
int nextId() const override;
private:
QLabel *mLabel = nullptr;
QButtonGroup *mProviderGroup = nullptr;
QRadioButton *mUseProvider = nullptr;
QRadioButton *mDontUseProvider = nullptr;
QLabel *const mLabel;
QButtonGroup *const mProviderGroup;
QRadioButton *const mUseProvider;
QRadioButton *const mDontUseProvider;
};
class CredentialsPage : public QWizardPage
......@@ -75,8 +75,8 @@ public:
int nextId() const override;
private:
QLineEdit *mUserName = nullptr;
KPasswordLineEdit *mPassword = nullptr;
QLineEdit *const mUserName;
KPasswordLineEdit *const mPassword;
};
class ServerTypePage : public QWizardPage
......@@ -129,5 +129,5 @@ public:
private:
void checkConnection();
void onFetchDone(KJob *);
QTextBrowser *mStatusLabel = nullptr;
QTextBrowser *const mStatusLabel;
};
......@@ -49,7 +49,7 @@ public:
/**
* Returns the base url the DAV manager uses.
*/
QUrl baseUrl() const;
Q_REQUIRED_RESULT QUrl baseUrl() const;
/**
* Returns a new DAV find job.
......
......@@ -39,9 +39,6 @@ FakeServer *FakeServerThread::server() const
FakeServer::FakeServer(QObject *parent)
: QObject(parent)
, mConnections(0)
, mProgress(0)
, mGotDisconnected(false)
{
mTcpServer = new QTcpServer();
if (!mTcpServer->listen(QHostAddress(QHostAddress::LocalHost), 5989)) {
......
......@@ -17,7 +17,7 @@ class FakeServer : public QObject
Q_OBJECT
public:
FakeServer(QObject *parent = nullptr);
explicit FakeServer(QObject *parent = nullptr);
~FakeServer() override;
void setNextConversation(const QString &conversation, const QList<int> &exceptions = QList<int>());
......@@ -56,8 +56,8 @@ private:
QList<QByteArray> mMails;
QTcpServer *mTcpServer = nullptr;
QTcpSocket *mTcpServerConnection = nullptr;
int mConnections;
int mProgress;
int mConnections = 0;
int mProgress = 0;
bool mGotDisconnected = false;
// We use one big mutex to protect everything
......
Supports Markdown
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