diff --git a/src/collectioneditor.h b/src/collectioneditor.h index b60b03bcabc7776be421bc19a14d0b764041c5ab..084c533249a65f4c578e91008fe6cac4ff5dc913 100644 --- a/src/collectioneditor.h +++ b/src/collectioneditor.h @@ -58,6 +58,7 @@ public: virtual bool save(const T* item) =0; virtual bool batchSave(const QList<T*> contacts); + virtual bool batchRemove(const QList<T*> contacts); virtual bool remove(const T* item); ///Edit 'item', the implementation may be a GUI or something else diff --git a/src/collectioneditor.hpp b/src/collectioneditor.hpp index d6caaf7fc42f56d68e21c100fe65e449649c3fdd..886f189bb9c4176af2e54af35394c56476b8fa4a 100644 --- a/src/collectioneditor.hpp +++ b/src/collectioneditor.hpp @@ -56,6 +56,16 @@ template <class T> bool CollectionEditor<T>::batchSave(const QList<T*> contacts) 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> bool CollectionEditor<T>::addContactMethod( T* item , ContactMethod* number ) {