Skip to content
Snippets Groups Projects
Commit a123a9fc authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

collection: Add batchRemove()

To complement batchSave()

Refs #66840
parent 9a98db2c
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ public: ...@@ -58,6 +58,7 @@ public:
virtual bool save(const T* item) =0; virtual bool save(const T* item) =0;
virtual bool batchSave(const QList<T*> contacts); virtual bool batchSave(const QList<T*> contacts);
virtual bool batchRemove(const QList<T*> contacts);
virtual bool remove(const T* item); virtual bool remove(const T* item);
///Edit 'item', the implementation may be a GUI or something else ///Edit 'item', the implementation may be a GUI or something else
......
...@@ -56,6 +56,16 @@ template <class T> bool CollectionEditor<T>::batchSave(const QList<T*> contacts) ...@@ -56,6 +56,16 @@ template <class T> bool CollectionEditor<T>::batchSave(const QList<T*> contacts)
return ret; return ret;
} }
///Default batch saving implementation, some collections have better APIs
template <class T> bool CollectionEditor<T>::batchRemove(const QList<T*> contacts)
{
bool ret = true;
foreach(const T* c, contacts) {
ret &= remove(c);
}
return ret;
}
template <class T> template <class T>
bool CollectionEditor<T>::addContactMethod( T* item , ContactMethod* number ) bool CollectionEditor<T>::addContactMethod( T* item , ContactMethod* number )
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment