diff options
| author | Méven Car <[email protected]> | 2026-01-22 16:15:09 +0100 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-01-22 16:27:11 +0100 |
| commit | 1acd0dfe09a34817d8daf58db2c53b2262eec7b7 (patch) | |
| tree | 94cab48dc8ad7c79c4fed016b8d0935c4e8dc3e5 /src | |
| parent | a403c0c6058d5064b8cc439edb41eb52ae384046 (diff) | |
clang-tidy: avoid copy, use const references
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinpackageinstaller.cpp | 2 | ||||
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 2 | ||||
| -rw-r--r-- | src/itemactions/setfoldericonitemaction.cpp | 2 | ||||
| -rw-r--r-- | src/kitemviews/kfileitemmodelrolesupdater.cpp | 2 | ||||
| -rw-r--r-- | src/kitemviews/kfileitemmodelrolesupdater.h | 2 | ||||
| -rw-r--r-- | src/kitemviews/kitemset.cpp | 2 | ||||
| -rw-r--r-- | src/kitemviews/kitemset.h | 2 | ||||
| -rw-r--r-- | src/search/chip.cpp | 2 | ||||
| -rw-r--r-- | src/search/dolphinquery.cpp | 2 | ||||
| -rw-r--r-- | src/search/dolphinquery.h | 2 | ||||
| -rw-r--r-- | src/selectionmode/actiontexthelper.cpp | 2 | ||||
| -rw-r--r-- | src/selectionmode/actiontexthelper.h | 6 | ||||
| -rw-r--r-- | src/settings/contextmenu/servicemenuinstaller/servicemenuinstaller.cpp | 4 | ||||
| -rw-r--r-- | src/views/dolphinview.cpp | 4 |
14 files changed, 18 insertions, 18 deletions
diff --git a/src/dolphinpackageinstaller.cpp b/src/dolphinpackageinstaller.cpp index b70159663..4e01cb3c8 100644 --- a/src/dolphinpackageinstaller.cpp +++ b/src/dolphinpackageinstaller.cpp @@ -25,7 +25,7 @@ DolphinPackageInstaller::DolphinPackageInstaller(const QString &packageName, : KJob(parent) , m_packageName{packageName} , m_fallBackInstallationPageUrl{fallBackInstallationPageUrl} - , m_isPackageInstalledCheck{isPackageInstalledCheck} + , m_isPackageInstalledCheck{std::move(isPackageInstalledCheck)} { } diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index ad4f962ee..e69383804 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -796,7 +796,7 @@ void DolphinViewContainer::slotfileMiddleClickActivated(const KFileItem &item) } if (services.length() >= indexOfAppToOpenFileWith + 1) { - auto service = services.at(indexOfAppToOpenFileWith); + const auto &service = services.at(indexOfAppToOpenFileWith); KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service, this); job->setUrls({item.targetUrl()}); diff --git a/src/itemactions/setfoldericonitemaction.cpp b/src/itemactions/setfoldericonitemaction.cpp index ffe206ca6..feb6adc2b 100644 --- a/src/itemactions/setfoldericonitemaction.cpp +++ b/src/itemactions/setfoldericonitemaction.cpp @@ -78,7 +78,7 @@ public: { } - void setActions(const QList<QAction *> actions) + void setActions(const QList<QAction *> &actions) { m_actions = actions; } diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index b2c4646a1..679370455 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -1526,7 +1526,7 @@ void KFileItemModelRolesUpdater::resetSizeData(const int index, const int size) connect(m_model, &KFileItemModel::itemsChanged, this, &KFileItemModelRolesUpdater::slotItemsChanged); } -void KFileItemModelRolesUpdater::recountDirectoryItems(const QList<QUrl> directories) +void KFileItemModelRolesUpdater::recountDirectoryItems(const QList<QUrl> &directories) { for (const auto &dir : directories) { auto index = m_model->index(dir); diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index 56e28ce72..aadcb66f8 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -342,7 +342,7 @@ private: void resetSizeData(const int index, const int size = 0); - void recountDirectoryItems(const QList<QUrl> directories); + void recountDirectoryItems(const QList<QUrl> &directories); private: QSize cacheSize(); diff --git a/src/kitemviews/kitemset.cpp b/src/kitemviews/kitemset.cpp index c8c1ff076..c23ef55f5 100644 --- a/src/kitemviews/kitemset.cpp +++ b/src/kitemviews/kitemset.cpp @@ -94,7 +94,7 @@ KItemSet::iterator KItemSet::insert(int i) } } -KItemSet::iterator KItemSet::erase(iterator it) +KItemSet::iterator KItemSet::erase(const iterator &it) { KItemRangeList::iterator rangeIt = it.m_rangeIt; diff --git a/src/kitemviews/kitemset.h b/src/kitemviews/kitemset.h index 8dd134ec6..7e5fa4e6f 100644 --- a/src/kitemviews/kitemset.h +++ b/src/kitemviews/kitemset.h @@ -287,7 +287,7 @@ public: iterator find(int i); const_iterator constFind(int i) const; bool remove(int i); - iterator erase(iterator it); + iterator erase(const iterator &it); /** * Returns a new set which contains all items that are contained in this diff --git a/src/search/chip.cpp b/src/search/chip.cpp index f478a480f..69c166c9d 100644 --- a/src/search/chip.cpp +++ b/src/search/chip.cpp @@ -15,7 +15,7 @@ using namespace Search; ChipBase::ChipBase(std::shared_ptr<const DolphinQuery> dolphinQuery, QWidget *parent) : QWidget{parent} - , UpdatableStateInterface{dolphinQuery} + , UpdatableStateInterface{std::move(dolphinQuery)} { m_removeButton = new QToolButton{this}; m_removeButton->setText(i18nc("@action:button", "Remove Filter")); diff --git a/src/search/dolphinquery.cpp b/src/search/dolphinquery.cpp index c0967c8de..4b7627846 100644 --- a/src/search/dolphinquery.cpp +++ b/src/search/dolphinquery.cpp @@ -35,7 +35,7 @@ bool Search::isSupportedSearchScheme(const QString &urlScheme) bool g_testMode = false; -bool Search::isIndexingEnabledIn(QUrl directory) +bool Search::isIndexingEnabledIn(const QUrl &directory) { if (g_testMode) { return true; // For unit-testing, let's pretend everything is indexed correctly. diff --git a/src/search/dolphinquery.h b/src/search/dolphinquery.h index 6893e1855..73429a780 100644 --- a/src/search/dolphinquery.h +++ b/src/search/dolphinquery.h @@ -50,7 +50,7 @@ enum class SearchTool { }; /** @returns whether Baloo is configured to have indexed the @p directory. */ -bool isIndexingEnabledIn(QUrl directory); +bool isIndexingEnabledIn(const QUrl &directory); /** @returns whether Baloo is configured to index file contents. */ bool isContentIndexingEnabled(); diff --git a/src/selectionmode/actiontexthelper.cpp b/src/selectionmode/actiontexthelper.cpp index 1e331860a..0f7318db8 100644 --- a/src/selectionmode/actiontexthelper.cpp +++ b/src/selectionmode/actiontexthelper.cpp @@ -14,7 +14,7 @@ ActionTextHelper::ActionTextHelper(QObject *parent) { } -void ActionTextHelper::registerTextWhenNothingIsSelected(QAction *action, QString registeredText) +void ActionTextHelper::registerTextWhenNothingIsSelected(QAction *action, const QString ®isteredText) { Q_ASSERT(action); m_registeredActionTextChanges.emplace_back(action, registeredText, TextWhenNothingIsSelected); diff --git a/src/selectionmode/actiontexthelper.h b/src/selectionmode/actiontexthelper.h index aa6569411..17cff6e7e 100644 --- a/src/selectionmode/actiontexthelper.h +++ b/src/selectionmode/actiontexthelper.h @@ -33,7 +33,7 @@ public: * The texts can be changed back by calling textsWhenNothingIsSelectedEnabled(false). * @see textsWhenNothingIsSelectedEnabled() */ - void registerTextWhenNothingIsSelected(QAction *action, QString registeredText); + void registerTextWhenNothingIsSelected(QAction *action, const QString ®isteredText); /** * Changes all texts that were registered previously using registerTextWhenNothingIsSelected() to those @@ -57,8 +57,8 @@ private: RegisteredActionTextChange(QAction *action, QString registeredText, TextState state) : action{action} - , registeredText{registeredText} - , textStateOfRegisteredText{state} {}; + , registeredText{std::move(std::move(registeredText))} + , textStateOfRegisteredText{state} { }; }; /** diff --git a/src/settings/contextmenu/servicemenuinstaller/servicemenuinstaller.cpp b/src/settings/contextmenu/servicemenuinstaller/servicemenuinstaller.cpp index fa7369e06..dfacbd39a 100644 --- a/src/settings/contextmenu/servicemenuinstaller/servicemenuinstaller.cpp +++ b/src/settings/contextmenu/servicemenuinstaller/servicemenuinstaller.cpp @@ -445,8 +445,8 @@ int main(int argc, char *argv[]) fail(i18n("Path to archive is required.")); } - const QString cmd = args[0]; - const QString archive = args[1]; + const QString &cmd = args[0]; + const QString &archive = args[1]; QString errorText; if (cmd == QLatin1String("install")) { diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index e471c198d..11c3cd6d2 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -560,7 +560,7 @@ bool DolphinView::sortHiddenLast() const void DolphinView::setVisibleRoles(const QList<QByteArray> &roles) { - const QList<QByteArray> previousRoles = roles; + const QList<QByteArray> &previousRoles = roles; ViewProperties props(viewPropertiesUrl()); props.setVisibleRoles(roles); @@ -2169,7 +2169,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray &role, con } if (role == "text") { - const KFileItem oldItem = items.first(); + const KFileItem &oldItem = items.first(); const EditResult retVal = value.value<EditResult>(); const QString newName = retVal.newName; if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) { |
