Commit 822570fa authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Save/load status filter

parent 5b0b1b6b
Pipeline #64752 passed with stage
in 41 minutes and 9 seconds
...@@ -155,7 +155,12 @@ void Filter::save(const KSharedConfig::Ptr &config, const QString &filtername) ...@@ -155,7 +155,12 @@ void Filter::save(const KSharedConfig::Ptr &config, const QString &filtername)
newGroup.writeEntry("searchOptions", static_cast<int>(mOptions)); newGroup.writeEntry("searchOptions", static_cast<int>(mOptions));
newGroup.writeEntry("tagId", mTagId); newGroup.writeEntry("tagId", mTagId);
newGroup.writeEntry("identifier", mIdentifier); newGroup.writeEntry("identifier", mIdentifier);
// TODO mStatus.toQInt32() QList<qint32> lst;
lst.reserve(mStatus.count());
for (const auto s : qAsConst(mStatus)) {
lst << s.toQInt32();
}
newGroup.writeEntry("status", lst);
newGroup.sync(); newGroup.sync();
grp.writeEntry("NumberFilter", numberFilter); grp.writeEntry("NumberFilter", numberFilter);
grp.sync(); grp.sync();
...@@ -179,6 +184,16 @@ Filter *Filter::loadFromConfigGroup(const KConfigGroup &newGroup) ...@@ -179,6 +184,16 @@ Filter *Filter::loadFromConfigGroup(const KConfigGroup &newGroup)
filter->setTagId(newGroup.readEntry("tagId")); filter->setTagId(newGroup.readEntry("tagId"));
filter->setIdentifier(newGroup.readEntry("identifier")); filter->setIdentifier(newGroup.readEntry("identifier"));
filter->setFilterName(newGroup.readEntry("name")); filter->setFilterName(newGroup.readEntry("name"));
QList<qint32> lst;
lst = newGroup.readEntry("status", QList<qint32>());
QVector<Akonadi::MessageStatus> messageStatusLst;
messageStatusLst.reserve(lst.count());
for (const auto s : qAsConst(lst)) {
Akonadi::MessageStatus status;
status.fromQInt32(s);
messageStatusLst << status;
}
filter->setStatus(messageStatusLst);
filter->setOptions(static_cast<QuickSearchLine::SearchOptions>(newGroup.readEntry("searchOptions").toInt())); filter->setOptions(static_cast<QuickSearchLine::SearchOptions>(newGroup.readEntry("searchOptions").toInt()));
return filter; return filter;
} }
......
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