[pim/messagelib] messagelist/src/core: const'ify variable

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit acc9484488339e1315377bffdcc2f1194038b997 by Laurent Montel.
Committed on 30/07/2026 at 04:55.
Pushed by mlaurent into branch 'master'.

const'ify variable

M  +4    -4    messagelist/src/core/manager.cpp
M  +1    -1    messagelist/src/core/model.cpp
M  +7    -7    messagelist/src/core/sortorder.cpp
M  +3    -2    messagelist/src/core/storagemodelbase.cpp
M  +1    -1    messagelist/src/core/theme.cpp

https://invent.kde.org/pim/messagelib/-/commit/acc9484488339e1315377bffdcc2f1194038b997

diff --git a/messagelist/src/core/manager.cpp b/messagelist/src/core/manager.cpp
index f98ddc835..075c7e2ae 100644
--- a/messagelist/src/core/manager.cpp
+++ b/messagelist/src/core/manager.cpp
@@ -88,7 +88,7 @@ const Aggregation *Manager::aggregation(const QString &id)
 
 const Aggregation *Manager::defaultAggregation()
 {
-    KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelAggregationsGroup());
+    const KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelAggregationsGroup());
 
     const QString aggregationId = conf.readEntry(u"DefaultSet"_s, "");
 
@@ -169,7 +169,7 @@ const Aggregation *Manager::aggregationForStorageModel(const StorageModel *stora
 
 const Aggregation *Manager::aggregationForStorageModel(const QString &storageId, bool *storageUsesPrivateAggregation)
 {
-    KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelAggregationsGroup());
+    const KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelAggregationsGroup());
 
     const QString aggregationId = conf.readEntry(MessageList::Util::setForStorageModelConfigName().arg(storageId), "");
 
@@ -370,7 +370,7 @@ const Theme *Manager::theme(const QString &id)
 
 const Theme *Manager::defaultTheme()
 {
-    KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelThemesGroup());
+    const KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelThemesGroup());
 
     const QString themeId = conf.readEntry(u"DefaultSet"_s, "");
 
@@ -452,7 +452,7 @@ const Theme *Manager::themeForStorageModel(const StorageModel *storageModel, boo
 
 const Theme *Manager::themeForStorageModel(const QString &id, bool *storageUsesPrivateTheme)
 {
-    KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelThemesGroup());
+    const KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelThemesGroup());
     const QString themeId = conf.readEntry(MessageList::Util::setForStorageModelConfigName().arg(id), "");
 
     Theme *opt = nullptr;
diff --git a/messagelist/src/core/model.cpp b/messagelist/src/core/model.cpp
index 2b3efb413..f4ffb4a85 100644
--- a/messagelist/src/core/model.cpp
+++ b/messagelist/src/core/model.cpp
@@ -677,7 +677,7 @@ int Model::rowCount(const QModelIndex &parent) const
 class RecursionPreventer
 {
 public:
-    RecursionPreventer(int &counter)
+    explicit RecursionPreventer(int &counter)
         : mCounter(counter)
     {
         mCounter++;
diff --git a/messagelist/src/core/sortorder.cpp b/messagelist/src/core/sortorder.cpp
index d439cf1e4..00915dbfc 100644
--- a/messagelist/src/core/sortorder.cpp
+++ b/messagelist/src/core/sortorder.cpp
@@ -235,7 +235,7 @@ void SortOrder::readConfig(KConfigGroup &conf, const QString &storageId, bool *s
 {
     SortOrder privateSortOrder;
     SortOrder globalSortOrder;
-    globalSortOrder.readConfigHelper(conf, u"GlobalSortOrder"_s);
+    std::ignore = globalSortOrder.readConfigHelper(conf, u"GlobalSortOrder"_s);
     *storageUsesPrivateSortOrder = privateSortOrder.readConfigHelper(conf, storageId);
     if (*storageUsesPrivateSortOrder) {
         *this = privateSortOrder;
@@ -288,37 +288,37 @@ bool SortOrder::isValidMessageSorting(SortOrder::MessageSorting ms)
 
 const QString SortOrder::nameForSortDirection(SortDirection sortDirection)
 {
-    int index = staticMetaObject.indexOfEnumerator("SortDirection");
+    const int index = staticMetaObject.indexOfEnumerator("SortDirection");
     return QLatin1StringView(staticMetaObject.enumerator(index).valueToKey(sortDirection));
 }
 
 const QString SortOrder::nameForMessageSorting(MessageSorting messageSorting)
 {
-    int index = staticMetaObject.indexOfEnumerator("MessageSorting");
+    const int index = staticMetaObject.indexOfEnumerator("MessageSorting");
     return QLatin1StringView(staticMetaObject.enumerator(index).valueToKey(messageSorting));
 }
 
 const QString SortOrder::nameForGroupSorting(GroupSorting groupSorting)
 {
-    int index = staticMetaObject.indexOfEnumerator("GroupSorting");
+    const int index = staticMetaObject.indexOfEnumerator("GroupSorting");
     return QLatin1StringView(staticMetaObject.enumerator(index).valueToKey(groupSorting));
 }
 
 SortOrder::SortDirection SortOrder::sortDirectionForName(const QString &name)
 {
-    int index = staticMetaObject.indexOfEnumerator("SortDirection");
+    const int index = staticMetaObject.indexOfEnumerator("SortDirection");
     return static_cast<SortDirection>(staticMetaObject.enumerator(index).keyToValue(name.toLatin1().constData()));
 }
 
 SortOrder::MessageSorting SortOrder::messageSortingForName(const QString &name)
 {
-    int index = staticMetaObject.indexOfEnumerator("MessageSorting");
+    const int index = staticMetaObject.indexOfEnumerator("MessageSorting");
     return static_cast<MessageSorting>(staticMetaObject.enumerator(index).keyToValue(name.toLatin1().constData()));
 }
 
 SortOrder::GroupSorting SortOrder::groupSortingForName(const QString &name)
 {
-    int index = staticMetaObject.indexOfEnumerator("GroupSorting");
+    const int index = staticMetaObject.indexOfEnumerator("GroupSorting");
     return static_cast<GroupSorting>(staticMetaObject.enumerator(index).keyToValue(name.toLatin1().constData()));
 }
 
diff --git a/messagelist/src/core/storagemodelbase.cpp b/messagelist/src/core/storagemodelbase.cpp
index 1b20cf175..6f0da5d3b 100644
--- a/messagelist/src/core/storagemodelbase.cpp
+++ b/messagelist/src/core/storagemodelbase.cpp
@@ -10,6 +10,7 @@
 
 #include "messagelistsettings.h"
 #include "messagelistutil_p.h"
+#include <KConfigGroup>
 
 using namespace Qt::Literals::StringLiterals;
 using namespace MessageList::Core;
@@ -31,7 +32,7 @@ unsigned long StorageModel::preSelectedMessage() const
     const QString storageModelId = id();
     Q_ASSERT(!storageModelId.isEmpty());
 
-    KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelSelectedMessageGroup());
+    const KConfigGroup conf(MessageListSettings::self()->config(), MessageList::Util::storageModelSelectedMessageGroup());
 
     // QVariant supports unsigned int OR unsigned long long int, NOT unsigned long int... doh...
     qulonglong defValue = 0;
@@ -51,7 +52,7 @@ void StorageModel::savePreSelectedMessage(unsigned long uniqueIdOfMessage)
 
     if (uniqueIdOfMessage) {
         // QVariant supports unsigned int OR unsigned long long int, NOT unsigned long int... doh...
-        qulonglong val = uniqueIdOfMessage;
+        const qulonglong val = uniqueIdOfMessage;
 
         conf.writeEntry(MessageList::Util::messageUniqueIdConfigName().arg(storageModelId), val);
     } else {
diff --git a/messagelist/src/core/theme.cpp b/messagelist/src/core/theme.cpp
index 89c88e4c6..ee3b003a4 100644
--- a/messagelist/src/core/theme.cpp
+++ b/messagelist/src/core/theme.cpp
@@ -662,7 +662,7 @@ void Theme::Column::detach()
     if (mSharedRuntimeData->referenceCount() < 2) {
         return; // nothing to detach
     }
-    mSharedRuntimeData->deleteReference();
+    std::ignore = mSharedRuntimeData->deleteReference();
 
     mSharedRuntimeData = new SharedRuntimeData(mVisibleByDefault, -1);
     mSharedRuntimeData->addReference();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.