Commit da987b35 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify variables

parent b8685210
Pipeline #174042 passed with stage
in 11 minutes and 56 seconds
......@@ -11,10 +11,10 @@
MailDispatcherConfig::MailDispatcherConfig(const KSharedConfigPtr &config, QWidget *parent, const QVariantList &cfg)
: Akonadi::AgentConfigurationBase(config, parent, cfg)
, mWidget(new KNotifyConfigWidget(parent))
{
auto w = new QWidget(parent);
mWidget = new KNotifyConfigWidget(parent);
mWidget->setApplication(QStringLiteral("akonadi_maildispatcher_agent"));
parent->layout()->addWidget(w);
}
......
......@@ -18,7 +18,7 @@ public:
bool save() const override;
private:
KNotifyConfigWidget *mWidget = nullptr;
KNotifyConfigWidget *const mWidget;
};
AKONADI_AGENTCONFIG_FACTORY(MailDispatcherConfigFactory, "maildispatcherconfig.json", MailDispatcherConfig)
......@@ -52,7 +52,7 @@ public:
/**
* Returns the size (in bytes) of all items in the queue.
*/
qulonglong totalSize() const;
Q_REQUIRED_RESULT qulonglong totalSize() const;
/**
* Fetches an item and emits itemReady() when done.
......
......@@ -69,7 +69,7 @@ private:
void doPostJob(bool transportSuccess, const QString &transportMessage);
void storeResult(bool success, const QString &message = QString());
void abortPostJob();
bool filterItem(int filterset);
Q_REQUIRED_RESULT bool filterItem(int filterset);
// slots
void doTransport();
......
......@@ -84,6 +84,9 @@ QHash<Akonadi::Collection, bool> NewMailNotifierCollectionProxyModel::notificati
NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWidget *parent)
: QWidget(parent)
, mFolderView(new QTreeView(this))
, mChangeRecorder(new Akonadi::ChangeRecorder(this))
, mCollectionFilter(new QSortFilterProxyModel(this))
{
Akonadi::AttributeFactory::registerAttribute<Akonadi::NewMailNotifierAttribute>();
auto vbox = new QVBoxLayout(this);
......@@ -92,7 +95,6 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
vbox->addWidget(label);
// Create a new change recorder.
mChangeRecorder = new Akonadi::ChangeRecorder(this);
mChangeRecorder->setMimeTypeMonitored(KMime::Message::mimeType());
mChangeRecorder->fetchCollection(true);
mChangeRecorder->setAllMonitored(true);
......@@ -111,7 +113,6 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
mNewMailNotifierProxyModel = new NewMailNotifierCollectionProxyModel(this);
mNewMailNotifierProxyModel->setSourceModel(mimeTypeProxy);
mCollectionFilter = new QSortFilterProxyModel(this);
mCollectionFilter->setRecursiveFilteringEnabled(true);
mCollectionFilter->setSourceModel(mNewMailNotifierProxyModel);
mCollectionFilter->setDynamicSortFilter(true);
......@@ -127,7 +128,6 @@ NewMailNotifierSelectCollectionWidget::NewMailNotifierSelectCollectionWidget(QWi
vbox->addWidget(searchLine);
mFolderView = new QTreeView(this);
mFolderView->setEditTriggers(QAbstractItemView::NoEditTriggers);
mFolderView->setAlternatingRowColors(true);
vbox->addWidget(mFolderView);
......
......@@ -53,9 +53,9 @@ private:
void slotCollectionTreeFetched();
void forceStatus(const QModelIndex &parent, bool status);
QTreeView *mFolderView = nullptr;
QTreeView *const mFolderView;
Akonadi::EntityTreeModel *mModel = nullptr;
Akonadi::ChangeRecorder *mChangeRecorder = nullptr;
QSortFilterProxyModel *mCollectionFilter = nullptr;
Akonadi::ChangeRecorder *const mChangeRecorder;
QSortFilterProxyModel *const mCollectionFilter;
NewMailNotifierCollectionProxyModel *mNewMailNotifierProxyModel = nullptr;
};
......@@ -39,6 +39,8 @@ static KLazyLocalizedString textToSpeakMessage = kli18n(
NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfigPtr &config, QWidget *parent, const QVariantList &args)
: Akonadi::AgentConfigurationBase(config, parent, args)
, mSelectCollection(new NewMailNotifierSelectCollectionWidget(parent))
{
NewMailNotifierAgentSettings::instance(config);
setObjectName(QStringLiteral("NewMailNotifierSettingsWidget"));
......@@ -139,7 +141,6 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
mNotify->setApplication(QStringLiteral("akonadi_newmailnotifier_agent"));
tab->addTab(mNotify, i18n("Notify"));
mSelectCollection = new NewMailNotifierSelectCollectionWidget(parent);
mSelectCollection->setObjectName(QStringLiteral("mSelectCollection"));
tab->addTab(mSelectCollection, i18n("Folders"));
......
......@@ -41,7 +41,7 @@ private:
#endif
QCheckBox *mReplyMail = nullptr;
QComboBox *mReplyMailTypeComboBox = nullptr;
NewMailNotifierSelectCollectionWidget *mSelectCollection = nullptr;
NewMailNotifierSelectCollectionWidget *const mSelectCollection;
};
AKONADI_AGENTCONFIG_FACTORY(NewMailNotifierSettingsFactory, "newmailnotifierconfig.json", NewMailNotifierSettingsWidget)
......@@ -17,7 +17,7 @@ class Collection;
class AkonadiSlave : public KIO::SlaveBase
{
public:
AkonadiSlave(const QByteArray &pool_socket, const QByteArray &app_socket);
explicit AkonadiSlave(const QByteArray &pool_socket, const QByteArray &app_socket);
~AkonadiSlave() override;
/**
......
......@@ -25,6 +25,7 @@
ConfigDialog::ConfigDialog(QWidget *parent)
: QDialog(parent)
, mModel(new QStandardItemModel(this))
{
setWindowIcon(QIcon::fromTheme(QStringLiteral("folder-remote")));
setWindowTitle(i18nc("@title:window", "DAV Resource Configuration"));
......@@ -40,7 +41,6 @@ ConfigDialog::ConfigDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfigDialog::onCancelClicked);
mainLayout->addWidget(buttonBox);
mModel = new QStandardItemModel(this);
const QStringList headers = {i18n("Protocol"), i18n("URL")};
mModel->setHorizontalHeaderLabels(headers);
......
......@@ -50,6 +50,6 @@ private:
KConfigDialogManager *mManager = nullptr;
QList<QPair<QString, KDAV::Protocol>> mAddedUrls;
QList<QPair<QString, KDAV::Protocol>> mRemovedUrls;
QStandardItemModel *mModel = nullptr;
QStandardItemModel *const mModel;
QPushButton *mOkButton = nullptr;
};
......@@ -62,10 +62,9 @@ static QString settingsToUrl(const QWizard *wizard, const QString &protocol)
return {};
}
QString pathPattern;
pathPattern.append(service->property(pathPropertyName).toString() + QLatin1Char('/'));
QString pathPattern = service->property(pathPropertyName).toString() + QLatin1Char('/');
QString username = wizard->field(QStringLiteral("credentialsUserName")).toString();
const QString username = wizard->field(QStringLiteral("credentialsUserName")).toString();
QString localPart(username);
localPart.remove(QRegularExpression(QStringLiteral("@.*$")));
pathPattern.replace(QLatin1String("$user$"), username);
......@@ -149,7 +148,7 @@ SetupWizard::SetupWizard(QWidget *parent)
QString SetupWizard::displayName() const
{
QString desktopFilePath = property("providerDesktopFilePath").toString();
const QString desktopFilePath = property("providerDesktopFilePath").toString();
if (desktopFilePath.isEmpty()) {
return {};
}
......@@ -214,11 +213,11 @@ CredentialsPage::CredentialsPage(QWidget *parent)
auto layout = new QFormLayout(this);
mUserName = new QLineEdit;
mUserName = new QLineEdit(this);
layout->addRow(i18n("User:"), mUserName);
registerField(QStringLiteral("credentialsUserName*"), mUserName);
mPassword = new KPasswordLineEdit;
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)));
......@@ -258,18 +257,18 @@ PredefinedProviderPage::PredefinedProviderPage(QWidget *parent)
auto layout = new QVBoxLayout(this);
mLabel = new QLabel;
mLabel = new QLabel(this);
layout->addWidget(mLabel);
mProviderGroup = new QButtonGroup(this);
mProviderGroup->setExclusive(true);
mUseProvider = new QRadioButton;
mUseProvider = new QRadioButton(this);
mProviderGroup->addButton(mUseProvider);
mUseProvider->setChecked(true);
layout->addWidget(mUseProvider);
mDontUseProvider = new QRadioButton(i18n("No, choose another server"));
mDontUseProvider = new QRadioButton(i18n("No, choose another server"), this);
mProviderGroup->addButton(mDontUseProvider);
layout->addWidget(mDontUseProvider);
}
......@@ -339,7 +338,7 @@ ServerTypePage::ServerTypePage(QWidget *parent)
mServerGroup->setExclusive(true);
auto hLayout = new QHBoxLayout;
auto button = new QRadioButton(i18n("Use one of those servers:"));
auto button = new QRadioButton(i18n("Use one of those servers:"), this);
registerField(QStringLiteral("templateConfiguration"), button);
mServerGroup->addButton(button);
mServerGroup->setId(button, 0);
......@@ -348,7 +347,7 @@ ServerTypePage::ServerTypePage(QWidget *parent)
hLayout->addWidget(mProvidersCombo);
layout->addLayout(hLayout);
button = new QRadioButton(i18n("Configure the resource manually"));
button = new QRadioButton(i18n("Configure the resource manually"), this);
connect(button, &QRadioButton::toggled, this, &ServerTypePage::manualConfigToggled);
registerField(QStringLiteral("manualConfiguration"), button);
mServerGroup->addButton(button);
......
......@@ -21,6 +21,7 @@
UrlConfigurationDialog::UrlConfigurationDialog(QWidget *parent)
: QDialog(parent)
, mModel(new QStandardItemModel(this))
, mRemoteProtocolGroup(new QButtonGroup(this))
{
auto mainWidget = new QWidget(this);
......@@ -38,7 +39,6 @@ UrlConfigurationDialog::UrlConfigurationDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::rejected, this, &UrlConfigurationDialog::reject);
mainLayout->addWidget(buttonBox);
mModel = new QStandardItemModel(this);
initModel();
mUi.discoveredUrls->setModel(mModel);
......
......@@ -58,7 +58,7 @@ private:
void readConfig();
Ui::UrlConfigurationDialog mUi;
QStandardItemModel *mModel = nullptr;
QStandardItemModel *const mModel;
QString mDefaultUsername;
QString mDefaultPassword;
QPushButton *mOkButton = nullptr;
......
......@@ -53,17 +53,17 @@ FolderArchiveAccountInfo::FolderArchiveType FolderArchiveComboBox::type() const
FolderArchiveSettingPage::FolderArchiveSettingPage(const QString &instanceName, QWidget *parent)
: QWidget(parent)
, mInstanceName(instanceName)
, mEnabled(new QCheckBox(i18n("Enable"), this))
, mArchiveNamed(new FolderArchiveComboBox(this))
, mArchiveFolder(new Akonadi::CollectionRequester(this))
{
auto lay = new QFormLayout(this);
mEnabled = new QCheckBox(i18n("Enable"), this);
connect(mEnabled, &QCheckBox::toggled, this, &FolderArchiveSettingPage::slotEnableChanged);
lay->addRow(QString(), mEnabled);
mArchiveFolder = new Akonadi::CollectionRequester(this);
mArchiveFolder->setMimeTypeFilter(QStringList() << KMime::Message::mimeType());
lay->addRow(i18nc("@label:chooser for the folder that messages will be archived under", "Archive into:"), mArchiveFolder);
mArchiveNamed = new FolderArchiveComboBox(this);
lay->addRow(i18nc("@label:listbox", "Archive folder name:"), mArchiveNamed);
}
......
......@@ -45,8 +45,8 @@ public:
private:
void slotEnableChanged(bool enabled);
const QString mInstanceName;
QCheckBox *mEnabled = nullptr;
QCheckBox *const mEnabled;
FolderArchiveComboBox *mArchiveNamed = nullptr;
Akonadi::CollectionRequester *mArchiveFolder = nullptr;
Akonadi::CollectionRequester *const mArchiveFolder;
FolderArchiveAccountInfo *mInfo = nullptr;
};
......@@ -66,7 +66,7 @@ void AddItemTask::onAppendMessageDone(KJob *job)
return;
}
qint64 uid = append->uid();
const qint64 uid = append->uid();
if (uid > 0) {
// We got it directly if UIDPLUS is supported...
......
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