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

Const'ify

parent 6c305a10
Pipeline #26060 passed with stage
in 4 minutes and 46 seconds
......@@ -67,23 +67,24 @@ bool Identity::isNull() const
bool empty = true;
QHash<QString, QVariant>::const_iterator i = mPropertiesMap.constBegin();
while (i != mPropertiesMap.constEnd()) {
const QString &key = i.key();
// Take into account that the defaultDomainName for a null identity is not empty
if (i.key() == QLatin1String(s_defaultDomainName)) {
if (key == QLatin1String(s_defaultDomainName)) {
++i;
continue;
}
// Take into account that the dictionary for a null identity is not empty
if (i.key() == QLatin1String(s_dict)) {
if (key == QLatin1String(s_dict)) {
++i;
continue;
}
// Take into account that disableFcc == false for a null identity
if (i.key() == QLatin1String(s_disabledFcc) && i.value().toBool() == false) {
if (key == QLatin1String(s_disabledFcc) && i.value().toBool() == false) {
++i;
continue;
}
// The uoid is 0 by default, so ignore this
if (!(i.key() == QLatin1String(s_uoid) && i.value().toUInt() == 0)) {
if (!(key == QLatin1String(s_uoid) && i.value().toUInt() == 0)) {
if (!i.value().isNull()
|| (i.value().type() == QVariant::String && !i.value().toString().isEmpty())) {
empty = false;
......@@ -101,11 +102,12 @@ void Identity::readConfig(const KConfigGroup &config)
QMap<QString, QString>::const_iterator i = entries.constBegin();
QMap<QString, QString>::const_iterator end = entries.constEnd();
while (i != end) {
if (i.key() == QLatin1String(s_emailAliases)) {
const QString &key = i.key();
if (key == QLatin1String(s_emailAliases)) {
// HACK: Read s_emailAliases as a stringlist
mPropertiesMap.insert(i.key(), config.readEntry(i.key(), QStringList()));
mPropertiesMap.insert(key, config.readEntry(key, QStringList()));
} else {
mPropertiesMap.insert(i.key(), config.readEntry(i.key()));
mPropertiesMap.insert(key, config.readEntry(key));
}
++i;
}
......
......@@ -55,8 +55,8 @@ public:
void reloadUoidList();
QList<uint> mUoidList;
IdentityManager *mIdentityManager = nullptr;
IdentityCombo *q = nullptr;
IdentityManager *const mIdentityManager = nullptr;
IdentityCombo *const q = nullptr;
};
void KIdentityManagement::IdentityComboPrivate::reloadCombo()
......
......@@ -80,7 +80,7 @@ public:
Q_REQUIRED_RESULT int newUoid();
bool mReadOnly = true;
KIdentityManagement::IdentityManager *q;
KIdentityManagement::IdentityManager *const q;
};
IdentityManager::Private::Private(KIdentityManagement::IdentityManager *manager)
......@@ -413,7 +413,7 @@ void IdentityManager::commit()
// find added and changed identities:
for (QVector<Identity>::ConstIterator it = d->shadowIdentities.constBegin();
it != d->shadowIdentities.constEnd(); ++it) {
int index = seenUOIDs.indexOf((*it).uoid());
const int index = seenUOIDs.indexOf((*it).uoid());
if (index != -1) {
uint uoid = seenUOIDs.at(index);
const Identity &orig = identityForUoid(uoid); // look up in mIdentities
......
......@@ -64,7 +64,7 @@ public:
Signature::Type type = Signature::Disabled;
bool enabled = false;
bool inlinedHtml = false;
Signature *q = nullptr;
Signature * const q = nullptr;
};
static bool isCursorAtEndOfLine(const QTextCursor &cursor)
......@@ -218,7 +218,7 @@ void SignaturePrivate::saveImages() const
{
if (inlinedHtml && !saveLocation.isEmpty()) {
for (const Signature::EmbeddedImagePtr &image : qAsConst(embeddedImages)) {
QString location = saveLocation + QLatin1Char('/') + image->name;
const QString location = saveLocation + QLatin1Char('/') + image->name;
if (!image->image.save(location, "PNG")) {
qCWarning(KIDENTITYMANAGEMENT_LOG) << "Failed to save image" << location;
}
......@@ -281,7 +281,7 @@ QString SignaturePrivate::textFromCommand(bool *ok) const
}
// get output:
QByteArray output = proc.readAllStandardOutput();
const QByteArray output = proc.readAllStandardOutput();
// TODO: hmm, should we allow other encodings, too?
return QString::fromLocal8Bit(output.data(), output.size());
......
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