Commit 4e2022eb authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Const'ify pointer + fix mem leak

parent b9b6f81a
Pipeline #96853 skipped
......@@ -20,6 +20,7 @@ K_PLUGIN_CLASS_WITH_JSON(KCMLdap, "kcmldap.json")
KCMLdap::KCMLdap(QWidget *parent, const QVariantList &)
: KCModule(parent)
, mLdapConfigureWidget(new KLDAP::LdapConfigureWidget(this))
{
setButtons(KCModule::Apply);
auto about = new KAboutData(QStringLiteral("kcmldap"),
......@@ -33,7 +34,6 @@ KCMLdap::KCMLdap(QWidget *parent, const QVariantList &)
auto layout = new QVBoxLayout(this);
layout->setContentsMargins({});
mLdapConfigureWidget = new KLDAP::LdapConfigureWidget(this);
layout->addWidget(mLdapConfigureWidget);
connect(mLdapConfigureWidget, &KLDAP::LdapConfigureWidget::changed, this, qOverload<bool>(&KCMLdap::changed));
......
......@@ -28,6 +28,6 @@ public:
void save() override;
private:
KLDAP::LdapConfigureWidget *mLdapConfigureWidget = nullptr;
KLDAP::LdapConfigureWidget *const mLdapConfigureWidget;
};
......@@ -40,7 +40,7 @@ ConfigDialog::ConfigDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfigDialog::onCancelClicked);
mainLayout->addWidget(buttonBox);
mModel = new QStandardItemModel();
mModel = new QStandardItemModel(this);
const QStringList headers = {i18n("Protocol"), i18n("URL")};
mModel->setHorizontalHeaderLabels(headers);
......@@ -202,8 +202,8 @@ void ConfigDialog::onRemoveButtonClicked()
return;
}
QString proto = mModel->index(indexes.at(0).row(), 0).data().toString();
QString url = mModel->index(indexes.at(0).row(), 1).data().toString();
const QString proto = mModel->index(indexes.at(0).row(), 0).data().toString();
const QString url = mModel->index(indexes.at(0).row(), 1).data().toString();
mRemovedUrls << QPair<QString, KDAV::Protocol>(url, Utils::protocolByTranslatedName(proto));
mModel->removeRow(indexes.at(0).row());
......
......@@ -83,7 +83,7 @@ void DavFreeBusyHandler::retrieveFreeBusy(const QString &email, const QDateTime
void DavFreeBusyHandler::onPrincipalSearchJobFinished(KJob *job)
{
QString email = job->property("email").toString();
const QString email = job->property("email").toString();
int handlingJobCount = --mRequestsTracker[email].handlingJobCount;
if (job->error()) {
......@@ -128,7 +128,7 @@ void DavFreeBusyHandler::onPrincipalSearchJobFinished(KJob *job)
void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
{
QString email = job->property("email").toString();
const QString email = job->property("email").toString();
uint requestId = job->property("request-id").toUInt();
int retrievalJobCount = --mRequestsTracker[email].retrievalJobCount;
......@@ -200,7 +200,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
return;
}
QString rawData = calendarDataElement.text();
const QString rawData = calendarDataElement.text();
KCalendarCore::ICalFormat format;
KCalendarCore::FreeBusy::Ptr fb = format.parseFreeBusy(rawData);
......
......@@ -57,13 +57,13 @@ static QString settingsToUrl(const QWizard *wizard, const QString &protocol)
return QString();
}
QString pathPattern;
const QString pathPropertyName(QStringLiteral("X-DavGroupware-") + protocol + QStringLiteral("Path"));
if (service->property(pathPropertyName).isNull()) {
return QString();
}
QString pathPattern;
pathPattern.append(service->property(pathPropertyName).toString() + QLatin1Char('/'));
QString username = wizard->field(QStringLiteral("credentialsUserName")).toString();
......@@ -167,7 +167,7 @@ SetupWizard::Url::List SetupWizard::urls() const
{
Url::List urls;
QString desktopFilePath = property("providerDesktopFilePath").toString();
const QString desktopFilePath = property("providerDesktopFilePath").toString();
if (desktopFilePath.isEmpty()) {
return urls;
}
......
......@@ -38,7 +38,7 @@ UrlConfigurationDialog::UrlConfigurationDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::rejected, this, &UrlConfigurationDialog::reject);
mainLayout->addWidget(buttonBox);
mModel = new QStandardItemModel();
mModel = new QStandardItemModel(this);
initModel();
mUi.discoveredUrls->setModel(mModel);
......
......@@ -17,7 +17,6 @@ using namespace KGAPI2;
static const QString googleWalletFolder = QStringLiteral("Akonadi Google");
GoogleSettings::GoogleSettings()
: m_winId(0)
{
m_wallet = Wallet::openWallet(Wallet::NetworkWallet(), m_winId, Wallet::Asynchronous);
if (m_wallet) {
......
......@@ -55,7 +55,7 @@ private Q_SLOTS:
void slotWalletOpened(bool success);
private:
WId m_winId;
WId m_winId = 0;
QString m_resourceId;
bool m_isReady = false;
KGAPI2::AccountPtr m_account;
......
......@@ -24,6 +24,6 @@ public:
private:
PasswordRequesterInterface *requesterImpl();
PasswordRequesterInterface *mImpl = nullptr;
ImapResourceBase *mResource = nullptr;
ImapResourceBase *const mResource;
};
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