Commit 7f0525b5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix save filter

parent fe8e2696
Pipeline #80671 passed with stage
in 43 minutes and 8 seconds
......@@ -155,10 +155,10 @@ QuickSearchLine::SearchOptions Filter::currentOptions() const
return mOptions;
}
void Filter::save(const KSharedConfig::Ptr &config, const QString &filtername, const QString &iconName)
void Filter::save(const KSharedConfig::Ptr &config, const QString &filtername, const QString &iconName, int numFilter)
{
KConfigGroup grp(config, "General");
int numberFilter = grp.readEntry("NumberFilter").toInt();
int numberFilter = (numFilter == -1) ? grp.readEntry("NumberFilter").toInt() : numFilter;
KConfigGroup newGroup(config, QStringLiteral("Filter_%1").arg(numberFilter++));
newGroup.writeEntry("name", filtername);
if (!iconName.isEmpty()) {
......
......@@ -91,7 +91,7 @@ public:
Q_REQUIRED_RESULT QuickSearchLine::SearchOptions currentOptions() const;
void save(const KSharedConfig::Ptr &config, const QString &filtername, const QString &iconName);
void save(const KSharedConfig::Ptr &config, const QString &filtername, const QString &iconName, int numFilter = -1);
static Q_REQUIRED_RESULT Filter *load(const KSharedConfig::Ptr &config, int filternumber);
void generateRandomIdentifier();
Q_REQUIRED_RESULT QString identifier() const;
......
......@@ -109,7 +109,7 @@ void FilterSavedManager::removeFilter(const QString &identifier)
int numberOfFilter = 0;
for (Filter *f : std::as_const(lst)) {
if ((f->identifier() != identifier) && !f->identifier().isEmpty()) {
f->save(KSharedConfig::openConfig(), f->filterName(), f->iconName());
f->save(KSharedConfig::openConfig(), f->filterName(), f->iconName(), numberOfFilter);
numberOfFilter++;
}
}
......
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