Commit 630c8111 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Load filter

parent 6d361335
Pipeline #60248 passed with stage
in 39 minutes and 51 seconds
......@@ -136,6 +136,23 @@ void Filter::save(const KSharedConfig::Ptr &config, const QString &filtername)
newGroup.writeEntry("currentFolder", mCurrentFolder.id());
// TODO mStatus.toQInt32()
newGroup.sync();
grp.writeEntry("NumberFilter", numberFilter);
grp.sync();
}
Filter *Filter::load(const KSharedConfig::Ptr &config, int filternumber)
{
KConfigGroup grp(config, "General");
int numberFilter = grp.readEntry("NumberFilter").toInt();
if (filternumber < numberFilter) {
auto filter = new Filter();
KConfigGroup newGroup(config, QStringLiteral("Filter_%1").arg(filternumber));
filter->setSearchString(newGroup.readEntry("searchString"), static_cast<QuickSearchLine::SearchOptions>(newGroup.readEntry("searchOptions").toInt()));
filter->setCurrentFolder(Akonadi::Collection(newGroup.readEntry("currentFolder").toInt()));
filter->setTagId(newGroup.readEntry("tagId"));
return filter;
}
return nullptr;
}
void Filter::setSearchString(const QString &search, QuickSearchLine::SearchOptions options)
......
......@@ -90,6 +90,7 @@ public:
Q_REQUIRED_RESULT QuickSearchLine::SearchOptions currentOptions() const;
void save(const KSharedConfig::Ptr &config, const QString &filtername);
static Q_REQUIRED_RESULT Filter *load(const KSharedConfig::Ptr &config, int filternumber);
Q_SIGNALS:
void finished();
......
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