Akonadi::ETMViewStateSaver Class

Header: #include <Akonadi/ETMViewStateSaver>
CMake: find_package(KPim6 REQUIRED COMPONENTS AkonadiWidgets)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiWidgets)

Public Types

enum KeyFormat { IdKeys, RemotePathKeys }

Public Functions

ETMViewStateSaver(QObject *parent = nullptr)
Akonadi::ETMViewStateSaver::KeyFormat keyFormat() const
void saveState(KConfigGroup &configGroup)
void selectCollections(const Akonadi::Collection::List &list)
void selectCollections(const QList<Akonadi::Collection::Id> &list)
void selectItems(const Akonadi::Item::List &list)
void selectItems(const QList<Akonadi::Item::Id> &list)
void setCurrentCollection(const Akonadi::Collection &collection)
void setCurrentItem(const Akonadi::Item &item)
void setKeyFormat(Akonadi::ETMViewStateSaver::KeyFormat format)

Detailed Description

Member Type Documentation

enum ETMViewStateSaver::KeyFormat

How checked/selected collections are keyed in the config.

Member Function Documentation

[explicit] ETMViewStateSaver::ETMViewStateSaver(QObject *parent = nullptr)

Creates a new ETM view state saver. parent The parent object.

Akonadi::ETMViewStateSaver::KeyFormat ETMViewStateSaver::keyFormat() const

Returns the key format used when saving.

See also setKeyFormat().

void ETMViewStateSaver::saveState(KConfigGroup &configGroup)

Reimplemented to keep stable (RemotePathKeys) entries of the existing configuration whose collections are currently missing from the model.

Restoring is asynchronous, so an application that saves on shutdown would otherwise overwrite the stored selection with an empty one when it quits before the model is populated. Kept entries are limited to path keys; a missing id key is still dropped, because a stale id can later resolve to a different collection. configGroup The group to save to.

void ETMViewStateSaver::selectCollections(const Akonadi::Collection::List &list)

Selects the given collections in the view. list The list of collections to select.

void ETMViewStateSaver::selectCollections(const QList<Akonadi::Collection::Id> &list)

Selects the collections with the given IDs in the view. list The list of collection IDs to select.

void ETMViewStateSaver::selectItems(const Akonadi::Item::List &list)

Selects the given items in the view. list The list of items to select.

void ETMViewStateSaver::selectItems(const QList<Akonadi::Item::Id> &list)

Selects the items with the given IDs in the view. list The list of item IDs to select.

void ETMViewStateSaver::setCurrentCollection(const Akonadi::Collection &collection)

Sets the current collection in the view. collection The collection to set as current.

void ETMViewStateSaver::setCurrentItem(const Akonadi::Item &item)

Sets the current item in the view. item The item to set as current.

void ETMViewStateSaver::setKeyFormat(Akonadi::ETMViewStateSaver::KeyFormat format)

Sets how checked/selected collections are written to the config.

Only affects saving; reading always understands both formats, so a config written with IdKeys migrates automatically to RemotePathKeys on the next save. format The key format to write.

See also keyFormat().