X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/8e55f2c2409fd6ca9ebc66a6568f4d3bcbef7576..9f233850beb60168e8773623e0b5ae052c5287e9:/src/selectionmode/actiontexthelper.cpp diff --git a/src/selectionmode/actiontexthelper.cpp b/src/selectionmode/actiontexthelper.cpp index 3eb868a8c..b54e9b004 100644 --- a/src/selectionmode/actiontexthelper.cpp +++ b/src/selectionmode/actiontexthelper.cpp @@ -1,6 +1,6 @@ /* This file is part of the KDE project - SPDX-FileCopyrightText: 2022 Felix Ernst + SPDX-FileCopyrightText: 2022 Felix Ernst SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ @@ -9,9 +9,10 @@ using namespace SelectionMode; -ActionTextHelper::ActionTextHelper(QObject *parent) : - QObject(parent) -{ } +ActionTextHelper::ActionTextHelper(QObject *parent) + : QObject(parent) +{ +} void ActionTextHelper::registerTextWhenNothingIsSelected(QAction *action, QString registeredText) { @@ -22,10 +23,13 @@ void ActionTextHelper::registerTextWhenNothingIsSelected(QAction *action, QStrin void ActionTextHelper::textsWhenNothingIsSelectedEnabled(bool enabled) { for (auto i = m_registeredActionTextChanges.begin(); i != m_registeredActionTextChanges.end(); ++i) { - if (!i->action) { + while (!i->action) { i = m_registeredActionTextChanges.erase(i); - continue; + if (i == m_registeredActionTextChanges.end()) { + break; + } } + if (enabled && i->textStateOfRegisteredText == TextWhenNothingIsSelected) { QString textWhenSomethingIsSelected = i->action->text(); i->action->setText(i->registeredText);