From aff41360ad4f7fbc5872581618402cf43ebc6e10 Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Wed, 25 Feb 2015 20:00:00 +0000
Subject: [PATCH] Fix the collection API

It was currently not working for all use case, and some
more constness made sense.

Refs #66482
---
 CMakeLists.txt                               |  2 +-
 src/backendmanagerinterface.hpp              | 14 +--
 src/bookmarkmodel.cpp                        | 24 ++---
 src/bookmarkmodel.h                          |  8 +-
 src/call.cpp                                 |  2 +-
 src/callmodel.cpp                            |  3 +-
 src/collectioneditor.h                       |  7 +-
 src/collectioneditor.hpp                     |  4 +-
 src/collectioninterface.h                    | 16 ++--
 src/collectionmanagerinterface.h             | 55 +++++------
 src/collectionmanagerinterface.hpp           | 58 ++++++------
 src/collectionmediator.h                     |  6 +-
 src/collectionmediator.hpp                   |  4 +-
 src/collectionmodel.cpp                      | 12 +--
 src/delegates/pixmapmanipulationdelegate.cpp |  1 +
 src/fallbackpersoncollection.cpp             | 23 ++---
 src/historymodel.cpp                         | 96 +++++---------------
 src/historymodel.h                           | 14 +--
 src/itembase.h                               |  4 +-
 src/itembase.hpp                             |  4 +-
 src/person.cpp                               |  2 +-
 src/personmodel.cpp                          | 28 +++---
 src/personmodel.h                            |  8 +-
 src/profilemodel.cpp                         | 25 ++---
 src/transitionalpersonbackend.cpp            | 19 ++--
 25 files changed, 183 insertions(+), 256 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4a5ca50..0654f84a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -215,7 +215,7 @@ SET( libringclient_LIB_SRCS
   src/audio/settings.cpp
 
 
-  #Data backends
+  #Data collections
   src/transitionalpersonbackend.cpp
   src/collectioninterface.cpp
   src/collectioneditor.cpp
diff --git a/src/backendmanagerinterface.hpp b/src/backendmanagerinterface.hpp
index 5bf70ba7..7818eb7e 100644
--- a/src/backendmanagerinterface.hpp
+++ b/src/backendmanagerinterface.hpp
@@ -57,7 +57,7 @@ CollectionInterface* BackendManagerInterface<T>::addBackend(const LoadOptions op
 
    if (options & LoadOptions::FORCE_ENABLED) { //TODO check is the backend is checked
 
-      //Some backends can fail to load directly
+      //Some collections can fail to load directly
       //eventually it will necessary to add an async version of this
       //to load the backend only when it is loaded
       if (backend->load())
@@ -74,32 +74,32 @@ BackendManagerInterface<T>::BackendManagerInterface() : d_ptr(new BackendManager
 }
 
 template<class T>
-const QVector< CollectionInterface* > BackendManagerInterface<T>::backends() const
+const QVector< CollectionInterface* > BackendManagerInterface<T>::collections() const
 {
    return d_ptr->m_lBackends;
 }
 
 template<class T>
-const QVector< CollectionInterface* > BackendManagerInterface<T>::enabledBackends() const
+const QVector< CollectionInterface* > BackendManagerInterface<T>::enabledCollections() const
 {
    return d_ptr->m_lEnabledBackends;
 }
 
-/// Do this manager have active backends
+/// Do this manager have active collections
 template<class T>
-bool BackendManagerInterface<T>::hasEnabledBackends() const
+bool BackendManagerInterface<T>::hasEnabledCollections() const
 {
    return d_ptr->m_lEnabledBackends.size();
 }
 
 template<class T>
-bool BackendManagerInterface<T>::hasBackends() const
+bool BackendManagerInterface<T>::hasCollections() const
 {
    return d_ptr->m_lBackends.size();
 }
 
 template<class T>
-bool BackendManagerInterface<T>::clearAllBackends() const
+bool BackendManagerInterface<T>::clearAllCollections() const
 {
    return false;
 }
diff --git a/src/bookmarkmodel.cpp b/src/bookmarkmodel.cpp
index 4c63b0a1..e0f45f4c 100644
--- a/src/bookmarkmodel.cpp
+++ b/src/bookmarkmodel.cpp
@@ -465,7 +465,7 @@ bool BookmarkModelPrivate::displayFrequentlyUsed() const
 
 QVector<ContactMethod*> BookmarkModelPrivate::bookmarkList() const
 {
-   return (q_ptr->backends().size() > 0) ? q_ptr->backends()[0]->items<ContactMethod>() : QVector<ContactMethod*>();
+   return (q_ptr->collections().size() > 0) ? q_ptr->collections()[0]->items<ContactMethod>() : QVector<ContactMethod*>();
 }
 
 BookmarkTopLevelItem::BookmarkTopLevelItem(QString name) 
@@ -499,8 +499,8 @@ bool BookmarkModel::removeRows( int row, int count, const QModelIndex & parent)
 void BookmarkModel::addBookmark(ContactMethod* number)
 {
    Q_UNUSED(number)
-   if (backends().size())
-      backends()[0]->editor<ContactMethod>()->append(number);
+   if (collections().size())
+      collections()[0]->editor<ContactMethod>()->addNew(number);
    else
       qWarning() << "No bookmark backend is set";
 }
@@ -539,12 +539,12 @@ void BookmarkModelPrivate::slotIndexChanged(const QModelIndex& idx)
 }
 
 
-// bool BookmarkModel::hasBackends() const
+// bool BookmarkModel::hasCollections() const
 // {
 //    return d_ptr->m_lBackends.size();
 // }
 
-// bool BookmarkModel::hasEnabledBackends() const
+// bool BookmarkModel::hasEnabledCollections() const
 // {
 //    foreach(CollectionInterface* b, d_ptr->m_lBackends) {
 //       if (b->isEnabled())
@@ -553,26 +553,26 @@ void BookmarkModelPrivate::slotIndexChanged(const QModelIndex& idx)
 //    return false;
 // }
 
-// const QVector<CollectionInterface*> BookmarkModel::backends() const
+// const QVector<CollectionInterface*> BookmarkModel::collections() const
 // {
 //    return d_ptr->m_lBackends;
 // }
 
 
-bool BookmarkModel::addItemCallback(ContactMethod* item)
+bool BookmarkModel::addItemCallback(const ContactMethod* item)
 {
    Q_UNUSED(item)
    reloadCategories(); //TODO this is far from optimal
    return true;
 }
 
-bool BookmarkModel::removeItemCallback(ContactMethod* item)
+bool BookmarkModel::removeItemCallback(const ContactMethod* item)
 {
    Q_UNUSED(item)
    return false;
 }
 
-// const QVector<CollectionInterface*> BookmarkModel::enabledBackends() const
+// const QVector<CollectionInterface*> BookmarkModel::enabledCollections() const
 // {
 //    return d_ptr->m_lBackends; //TODO filter them
 // }
@@ -582,9 +582,9 @@ bool BookmarkModel::removeItemCallback(ContactMethod* item)
 //    return nullptr; //TODO
 // }
 
-bool BookmarkModel::clearAllBackends() const
+bool BookmarkModel::clearAllCollections() const
 {
-   foreach (CollectionInterface* backend, backends()) {
+   foreach (CollectionInterface* backend, collections()) {
       if (backend->supportedFeatures() & CollectionInterface::ADD) {
          backend->clear();
       }
@@ -607,7 +607,7 @@ bool BookmarkModel::clearAllBackends() const
 //       backend->load();
 // }
 
-void BookmarkModel::backendAddedCallback(CollectionInterface* backend)
+void BookmarkModel::collectionAddedCallback(CollectionInterface* backend)
 {
    Q_UNUSED(backend)
 }
diff --git a/src/bookmarkmodel.h b/src/bookmarkmodel.h
index be9165c3..83067a30 100644
--- a/src/bookmarkmodel.h
+++ b/src/bookmarkmodel.h
@@ -53,7 +53,7 @@ public:
    void setShowAll(bool showAll);
 
    //Backend model implementation
-   virtual bool clearAllBackends() const override;
+   virtual bool clearAllCollections() const override;
 
    //Model implementation
    virtual bool          setData     ( const QModelIndex& index, const QVariant &value, int role   )       override;
@@ -88,9 +88,9 @@ private:
    Q_DECLARE_PRIVATE(BookmarkModel)
 
    //Backend interface
-   virtual void backendAddedCallback(CollectionInterface* backend) override;
-   virtual bool addItemCallback(ContactMethod* item) override;
-   virtual bool removeItemCallback(ContactMethod* item) override;
+   virtual void collectionAddedCallback(CollectionInterface* backend) override;
+   virtual bool addItemCallback(const ContactMethod* item) override;
+   virtual bool removeItemCallback(const ContactMethod* item) override;
 
 public Q_SLOTS:
    void reloadCategories();
diff --git a/src/call.cpp b/src/call.cpp
index 6ab460dc..3234bf80 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -1263,7 +1263,7 @@ void CallPrivate::call()
       //Warning: m_pDialNumber can become nullptr when linking directly
       callManager.placeCall(m_Account->id(), m_CallId, m_pDialNumber->uri());
 
-      if (PersonModel::instance()->hasBackends()) {
+      if (PersonModel::instance()->hasCollections()) {
          if (q_ptr->peerContactMethod()->contact())
             m_PeerName = q_ptr->peerContactMethod()->contact()->formattedName();
       }
diff --git a/src/callmodel.cpp b/src/callmodel.cpp
index dfea2898..4b55d17d 100644
--- a/src/callmodel.cpp
+++ b/src/callmodel.cpp
@@ -1015,7 +1015,8 @@ void CallModelPrivate::slotCallStateChanged(const QString& callID, const QString
 
    //Add to history
    if (call->lifeCycleState() == Call::LifeCycleState::FINISHED) {
-      HistoryModel::instance()->add(call);
+      //HistoryModel::instance()->add(call);
+      //FIXME check all collection with a "::ADD" filter and add the call
    }
 
    emit q_ptr->callStateChanged(call,previousState);
diff --git a/src/collectioneditor.h b/src/collectioneditor.h
index 776c8c58..b60b03bc 100644
--- a/src/collectioneditor.h
+++ b/src/collectioneditor.h
@@ -57,18 +57,17 @@ public:
    CollectionMediator<T>* mediator() const;
 
    virtual bool save(const T* item) =0;
-   virtual bool append(const T* item) =0;
    virtual bool batchSave(const QList<T*> contacts);
-   virtual bool remove(T* item);
+   virtual bool remove(const T* item);
 
    ///Edit 'item', the implementation may be a GUI or something else
    virtual bool edit       ( T*       item     ) = 0;
 
    ///Add a new item to the backend
-   virtual bool addNew     ( T*       item     ) = 0;
+   virtual bool addNew     (const  T*       item     ) = 0;
 
    ///Add an existing item to the collection
-   virtual bool addExisting( T*       item     ) = 0;
+   virtual bool addExisting(const  T*       item     ) = 0;
 
    ///Add a new phone number to an existing item
    virtual bool addContactMethod( T*       item , ContactMethod* number );
diff --git a/src/collectioneditor.hpp b/src/collectioneditor.hpp
index 64907230..d6caaf7f 100644
--- a/src/collectioneditor.hpp
+++ b/src/collectioneditor.hpp
@@ -46,7 +46,7 @@ QMetaObject metaObject()
    return T::staticMetaObject();
 }
 
-///Default batch saving implementation, some backends have better APIs
+///Default batch saving implementation, some collections have better APIs
 template <class T> bool CollectionEditor<T>::batchSave(const QList<T*> contacts)
 {
    bool ret = true;
@@ -65,7 +65,7 @@ bool CollectionEditor<T>::addContactMethod( T*       item , ContactMethod* numbe
 }
 
 template <class T>
-bool CollectionEditor<T>::remove(T* item)
+bool CollectionEditor<T>::remove(const T* item)
 {
    Q_UNUSED(item)
    return false;
diff --git a/src/collectioninterface.h b/src/collectioninterface.h
index 849ce031..3b70a3e5 100644
--- a/src/collectioninterface.h
+++ b/src/collectioninterface.h
@@ -34,7 +34,7 @@ template<typename T> class CollectionMediator;
 template<typename T> class ItemBase;
 
 /**
- * This is the interface that must be implemented by each item backends to
+ * This is the interface that must be implemented by each item collections to
  * be used by a CollectionManager.
  *
  * The class need to be extended with a template constructor:
@@ -42,7 +42,7 @@ template<typename T> class ItemBase;
  * MyBackend::MyBackend<Person>(CollectionMediator<Person>* mediator, CollectionInterface* parent = nullptr) :
  *    CollectionMediator<Person>(mediator,parent) {}
  *
- * Each backends also need to implement that constructor or they wont load.
+ * Each collections also need to implement that constructor or they wont load.
  */
 class LIB_EXPORT CollectionInterface
 {
@@ -61,13 +61,13 @@ public:
       LOAD        = 0x1 <<  0, /*!< Load this backend, DO NOT load anything before "load" is called         */
       SAVE        = 0x1 <<  1, /*!< Save an item                                                            */
       EDIT        = 0x1 <<  2, /*!< Edit, but **DOT NOT**, save an item)                                    */
-      PROBE       = 0x1 <<  3, /*!< Check if the backend has new items (some backends do this automagically)*/
+      PROBE       = 0x1 <<  3, /*!< Check if the backend has new items (some collections do this automagically)*/
       ADD         = 0x1 <<  4, /*!< Add (and save) a new item to the backend                                */
       SAVE_ALL    = 0x1 <<  5, /*!< Save all items at once, this may or may not be faster than "add"        */
       CLEAR       = 0x1 <<  6, /*!< Clear all items from this backend                                       */
       REMOVE      = 0x1 <<  7, /*!< Remove a single item                                                    */
-      EXPORT      = 0x1 <<  8, /*!< Export all items, format and output need to be defined by each backends */
-      IMPORT      = 0x1 <<  9, /*!< Import items from an external source, details defined by each backends  */
+      EXPORT      = 0x1 <<  8, /*!< Export all items, format and output need to be defined by each collections */
+      IMPORT      = 0x1 <<  9, /*!< Import items from an external source, details defined by each collections  */
       ENABLEABLE  = 0x1 << 10, /*!< Can be enabled, I know, it is not a word, but Java use it too           */
       DISABLEABLE = 0x1 << 11, /*!< Can be disabled, I know, it is not a word, but Java use it too          */
       MANAGEABLE  = 0x1 << 12, /*!< Can be managed the config GUI                                           */
@@ -88,7 +88,7 @@ public:
    virtual QString    name     () const = 0;
 
    /**
-    * Each MANAGEABLE backends can be part of a meta category. This category
+    * Each MANAGEABLE collections can be part of a meta category. This category
     * will be the top level element of the BackendManagerModel. This name
     * must never change once it is set.
     */
@@ -172,7 +172,7 @@ public:
    QVector<T*> items() const;
 
    /**
-    * Some backends can be hierarchical, for example, a email backend
+    * Some collections can be hierarchical, for example, a email backend
     * can have multiple "folders" where mails are stored, a contact backend
     * can have multiple contact groups and an history one can have an archived
     * section for previous years. This method return the parent when applicable.
@@ -181,7 +181,7 @@ public:
 
    /**
     * As explained in the "parent()" method, this method return the backend children
-    * backends. This can be used by a client to implement different behaviour depending
+    * collections. This can be used by a client to implement different behaviour depending
     * on the backend at a finer level.
     */
    QVector<CollectionInterface*>  children() const;
diff --git a/src/collectionmanagerinterface.h b/src/collectionmanagerinterface.h
index 572a354b..626ed064 100644
--- a/src/collectionmanagerinterface.h
+++ b/src/collectionmanagerinterface.h
@@ -43,27 +43,27 @@ template <class T>
 class CollectionManagerInterfacePrivate;
 
 /**
- * This is the base for all models based on the itembackend framework.
+ * This is the base for all models based on the itemcollection framework.
  *
  * This interface has to be implemented by each models. The abstract
- * private methods will be called when the managed backends need
+ * private methods will be called when the managed collections need
  * to interact with the model.
  *
- * All implementation should define their item backend type in the
+ * All implementation should define their item collection type in the
  * class declaration like:
  *
  * template <typename T > using CollectionMediator = CollectionMediator<Person>;
  *
- * And individual backends should extend that alias. For example:
+ * And individual collections should extend that alias. For example:
  *
  * class MyPersonSourceBackend : public CollectionInterface {
  *     public:
  *        MyPersonSourceBackend(CollectionInterfaceMediator* mediator)
  * };
  *
- * The mediator is used to bridge the model and the item backends. The mediator
+ * The mediator is used to bridge the model and the item collections. The mediator
  * implement the common logic that should otherwise have been copy pasted in each
- * backends.
+ * collections.
  */
 template <class T> class LIB_EXPORT CollectionManagerInterface {
    friend class CollectionMediator<T>;
@@ -81,50 +81,50 @@ public:
    virtual ~CollectionManagerInterface() {};
 
    /**
-    * This method is used to add a backend to a model. The LoadOptions
+    * This method is used to add a collection to a model. The LoadOptions
     * can be used to enforce some parameters. Please note this function is
-    * a variadic template. If the backend require some arguments to be passed
+    * a variadic template. If the collection require some arguments to be passed
     * to its constructor, they can be added as extra parameters.
     *
-    * Please note that each backend need to take a CollectionMediator as first
+    * Please note that each collection need to take a CollectionMediator as first
     * argument.
     *
-    * @return The newly created backend
+    * @return The newly created collection
     */
    template <class T2, typename ...Ts>
    T2* addBackend(Ts... args, const LoadOptions options = LoadOptions::NONE);
 
-   /// Do this manager have active backends
-   virtual bool hasEnabledBackends () const final;
-   virtual bool hasBackends        () const final;
+   /// Do this manager have active collections
+   virtual bool hasEnabledCollections () const final;
+   virtual bool hasCollections        () const final;
 
-   /// List all backends
-   virtual const QVector< CollectionInterface* > backends       () const final;
-   virtual const QVector< CollectionInterface* > enabledBackends() const final;
+   /// List all Collections
+   virtual const QVector< CollectionInterface* > collections       () const final;
+   virtual const QVector< CollectionInterface* > enabledCollections() const final;
 
-   ///Enable / disable a backend
-   virtual bool enableBackend( CollectionInterface*  backend, bool enabled) final;
+   ///Enable / disable a collection
+   virtual bool enableBackend( CollectionInterface*  collection, bool enabled) final;
 
-   virtual bool clearAllBackends() const;
+   virtual bool clearAllCollections() const;
 
    /**
-    * Delete the item from the model and from its backend. This
+    * Delete the item from the model and from its collection. This
     * is permanent and cannot be undone.
     *
     * Please note that certain type of items, while removed from the view
     * will continue to exist after being removed. This include items part
-    * of multiple backends or items generated from runtime data.
+    * of multiple Collections or items generated from runtime data.
     *
-    * @return true if successful, false is the backend doesn't support removing items or the operation failed.
+    * @return true if successful, false is the collection doesn't support removing items or the operation failed.
     */
    bool deleteItem(T* item);
 
 private:
    /**
-    * This method is called when a new backend is added. Some models
+    * This method is called when a new collection is added. Some models
     * may need to act on such action, other don't.
     */
-   virtual void backendAddedCallback(CollectionInterface* backend);
+   virtual void collectionAddedCallback(CollectionInterface* collection);
 
    /**
     * This method implement the logic necessary to add the item to
@@ -132,8 +132,11 @@ private:
     *
     * This method can be called with items already part of the model.
     * All implementation must handle that.
+    * 
+    * Please note that the constness is expected to be broken when using
+    * setData(), but not otherwise.
     */
-   virtual bool addItemCallback   (T* item) = 0;
+   virtual bool addItemCallback   (const T* item) = 0;
 
    /**
     * Remove an item from the model. Subclasses must implement the logic
@@ -142,7 +145,7 @@ private:
     * This function can be called with nullptr or with items not part
     * of the model. All implementations must handle that.
     */
-   virtual bool removeItemCallback(T* item) = 0;
+   virtual bool removeItemCallback(const T* item) = 0;
 
    CollectionManagerInterfacePrivate<T>* d_ptr;
 };
diff --git a/src/collectionmanagerinterface.hpp b/src/collectionmanagerinterface.hpp
index 9f77c5d8..39767768 100644
--- a/src/collectionmanagerinterface.hpp
+++ b/src/collectionmanagerinterface.hpp
@@ -26,8 +26,8 @@ public:
    {}
    ~CollectionManagerInterfacePrivate();
 
-   QVector< CollectionInterface* > m_lBackends;
-   QVector< CollectionInterface* > m_lEnabledBackends;
+   QVector< CollectionInterface* > m_lCollections;
+   QVector< CollectionInterface* > m_lEnabledCollections;
    mutable CollectionMediator<T>*  m_pMediator;
    QAbstractItemModel*             q_ptr;
    CollectionManagerInterface<T>*  i_ptr;
@@ -55,22 +55,22 @@ template<class T>
 template <class T2, typename ...Ts>
 T2* CollectionManagerInterface<T>::addBackend(Ts... args, const LoadOptions options)
 {
-   T2* backend = new T2(d_ptr->itemMediator(),args...);
+   T2* collection = new T2(d_ptr->itemMediator(),args...);
 
    //This will force the T2 to be a CollectionInterface subclass
-   CollectionInterface* b = backend;
-   d_ptr->m_lBackends << b;
+   CollectionInterface* b = collection;
+   d_ptr->m_lCollections << b;
 
-   if (options & LoadOptions::FORCE_ENABLED) { //TODO check is the backend is checked
+   if (options & LoadOptions::FORCE_ENABLED) { //TODO check is the collection is checked
 
-      //Some backends can fail to load directly
+      //Some collections can fail to load directly
       //eventually it will necessary to add an async version of this
-      //to load the backend only when it is loaded
-      if (backend->load())
-         d_ptr->m_lEnabledBackends << backend;
+      //to load the collection only when it is loaded
+      if (collection->load())
+         d_ptr->m_lEnabledCollections << collection;
    }
 
-   return backend;
+   return collection;
 }
 
 template<class T>
@@ -80,52 +80,52 @@ CollectionManagerInterface<T>::CollectionManagerInterface(QAbstractItemModel* se
 }
 
 template<class T>
-const QVector< CollectionInterface* > CollectionManagerInterface<T>::backends() const
+const QVector< CollectionInterface* > CollectionManagerInterface<T>::collections() const
 {
-   return d_ptr->m_lBackends;
+   return d_ptr->m_lCollections;
 }
 
 template<class T>
-const QVector< CollectionInterface* > CollectionManagerInterface<T>::enabledBackends() const
+const QVector< CollectionInterface* > CollectionManagerInterface<T>::enabledCollections() const
 {
-   return d_ptr->m_lEnabledBackends;
+   return d_ptr->m_lEnabledCollections;
 }
 
-/// Do this manager have active backends
+/// Do this manager have active collections
 template<class T>
-bool CollectionManagerInterface<T>::hasEnabledBackends() const
+bool CollectionManagerInterface<T>::hasEnabledCollections() const
 {
-   return d_ptr->m_lEnabledBackends.size();
+   return d_ptr->m_lEnabledCollections.size();
 }
 
 template<class T>
-bool CollectionManagerInterface<T>::hasBackends() const
+bool CollectionManagerInterface<T>::hasCollections() const
 {
-   return d_ptr->m_lBackends.size();
+   return d_ptr->m_lCollections.size();
 }
 
 template<class T>
-bool CollectionManagerInterface<T>::clearAllBackends() const
+bool CollectionManagerInterface<T>::clearAllCollections() const
 {
    return false;
 }
 
 template<class T>
-void CollectionManagerInterface<T>::backendAddedCallback(CollectionInterface* backend)
+void CollectionManagerInterface<T>::collectionAddedCallback(CollectionInterface* collection)
 {
-   Q_UNUSED(backend)
+   Q_UNUSED(collection)
 }
 
 template<class T>
 bool CollectionManagerInterface<T>::deleteItem(T* item)
 {
-   if (item->backend()->model() == (QAbstractItemModel*) this) {
-      if (item->backend()->supportedFeatures() & CollectionInterface::SupportedFeatures::REMOVE) {
-         static_cast<CollectionInterface*>(item->backend())->editor<T>()->remove(item);
+   if (item->collection()->model() == (QAbstractItemModel*) this) {
+      if (item->collection()->supportedFeatures() & CollectionInterface::SupportedFeatures::REMOVE) {
+         static_cast<CollectionInterface*>(item->collection())->editor<T>()->remove(item);
          return true;
       }
       else
-         qDebug() << item << "cannot be deleted, the backend doesn't support removing items";
+         qDebug() << item << "cannot be deleted, the collection doesn't support removing items";
    }
    else
       qDebug() << item << "cannot be deleted, it is not managed by" << this;
@@ -133,9 +133,9 @@ bool CollectionManagerInterface<T>::deleteItem(T* item)
 }
 
 template<class T>
-bool CollectionManagerInterface<T>::enableBackend( CollectionInterface*  backend, bool enabled)
+bool CollectionManagerInterface<T>::enableBackend( CollectionInterface*  collection, bool enabled)
 {
    Q_UNUSED(enabled) //TODO implement it
-   backend->load();
+   collection->load();
    return true;
 }
diff --git a/src/collectionmediator.h b/src/collectionmediator.h
index bbb3cf7b..ad1c61ea 100644
--- a/src/collectionmediator.h
+++ b/src/collectionmediator.h
@@ -29,7 +29,7 @@ class CollectionMediatorPrivate;
 /**
  * This is the base class for each BackendMediator. A backend mediator
  * is a intermediary object between the backend and the model responsible
- * to manage the backends objects. The purpose of this layer are:
+ * to manage the collections objects. The purpose of this layer are:
  *
  *  * Isolate the item gestion away from the manager public API
  *  * Work around the lack of polymorphic generics for template objects
@@ -40,8 +40,8 @@ template<typename T>
 class LIB_EXPORT CollectionMediator {
 public:
    CollectionMediator(CollectionManagerInterface<T>* parentManager, QAbstractItemModel* m);
-   bool addItem   (T* item);
-   bool removeItem(T* item);
+   bool addItem   (const T* item);
+   bool removeItem(const T* item);
 
    QAbstractItemModel* model() const;
 
diff --git a/src/collectionmediator.hpp b/src/collectionmediator.hpp
index f97732a9..56806cd8 100644
--- a/src/collectionmediator.hpp
+++ b/src/collectionmediator.hpp
@@ -35,13 +35,13 @@ CollectionMediator<T>::CollectionMediator(CollectionManagerInterface<T>* parentM
 }
 
 template<typename T>
-bool CollectionMediator<T>::addItem(T* item)
+bool CollectionMediator<T>::addItem(const T* item)
 {
    return d_ptr->m_pParent->addItemCallback(item);
 }
 
 template<typename T>
-bool CollectionMediator<T>::removeItem(T* item)
+bool CollectionMediator<T>::removeItem(const T* item)
 {
    return d_ptr->m_pParent->removeItemCallback(item); //TODO wrong
 }
diff --git a/src/collectionmodel.cpp b/src/collectionmodel.cpp
index 31da2772..535b3af2 100644
--- a/src/collectionmodel.cpp
+++ b/src/collectionmodel.cpp
@@ -121,11 +121,11 @@ QVariant CollectionModel::data (const QModelIndex& idx, int role) const
 int CollectionModel::rowCount (const QModelIndex& parent) const
 {
    if (!parent.isValid()) {
-      static bool init = false; //FIXME this doesn't allow dynamic backends
+      static bool init = false; //FIXME this doesn't allow dynamic collections
       static int result = 0;
       if (!init) {
-         for(int i=0;i<PersonModel::instance()->backends().size();i++)
-            result += PersonModel::instance()->backends()[i]->parent()==nullptr?1:0;
+         for(int i=0;i<PersonModel::instance()->collections().size();i++)
+            result += PersonModel::instance()->collections()[i]->parent()==nullptr?1:0;
          init = true;
       }
       return result;
@@ -216,11 +216,11 @@ QModelIndex CollectionModel::index( int row, int column, const QModelIndex& pare
          item = d_ptr->m_lTopLevelBackends[row];
       else {
 
-         if (row >= PersonModel::instance()->backends().size())
+         if (row >= PersonModel::instance()->collections().size())
             return QModelIndex();
 
          item = new CollectionModelPrivate::ProxyItem();
-         item->backend = PersonModel::instance()->backends()[row];
+         item->backend = PersonModel::instance()->collections()[row];
          d_ptr->m_lTopLevelBackends << item;
       }
       item->row = row;
@@ -249,7 +249,7 @@ bool CollectionModel::save()
 {
    if (ItemModelStateSerializationDelegate::instance()) {
 
-      //Load newly enabled backends
+      //Load newly enabled collections
       foreach(CollectionModelPrivate::ProxyItem* top, d_ptr->m_lTopLevelBackends) {
          CollectionInterface* current = top->backend;
          bool check = ItemModelStateSerializationDelegate::instance()->isChecked(current);
diff --git a/src/delegates/pixmapmanipulationdelegate.cpp b/src/delegates/pixmapmanipulationdelegate.cpp
index d94aa9e2..1578825f 100644
--- a/src/delegates/pixmapmanipulationdelegate.cpp
+++ b/src/delegates/pixmapmanipulationdelegate.cpp
@@ -80,6 +80,7 @@ QByteArray PixmapManipulationDelegate::toByteArray(const QVariant& pxm)
 QVariant PixmapManipulationDelegate::profilePhoto(const QByteArray& data, const QString& type)
 {
    Q_UNUSED(data)
+   Q_UNUSED(type)
    return QVariant();
 }
 
diff --git a/src/fallbackpersoncollection.cpp b/src/fallbackpersoncollection.cpp
index 55fe7b3d..bff3e538 100644
--- a/src/fallbackpersoncollection.cpp
+++ b/src/fallbackpersoncollection.cpp
@@ -38,11 +38,10 @@ class FallbackPersonBackendEditor : public CollectionEditor<Person>
 public:
    FallbackPersonBackendEditor(CollectionMediator<Person>* m) : CollectionEditor<Person>(m) {}
    virtual bool save       ( const Person* item ) override;
-   virtual bool append     ( const Person* item ) override;
-   virtual bool remove     ( Person*       item ) override;
+   virtual bool remove     ( const Person* item ) override;
    virtual bool edit       ( Person*       item ) override;
-   virtual bool addNew     ( Person*       item ) override;
-   virtual bool addExisting( Person*       item ) override;
+   virtual bool addNew     ( const Person* item ) override;
+   virtual bool addExisting( const Person* item ) override;
 
    QVector<Person*> m_lItems;
 
@@ -81,13 +80,7 @@ bool FallbackPersonBackendEditor::save(const Person* item)
    return true;
 }
 
-bool FallbackPersonBackendEditor::append(const Person* item)
-{
-   Q_UNUSED(item)
-   return false;
-}
-
-bool FallbackPersonBackendEditor::remove(Person* item)
+bool FallbackPersonBackendEditor::remove(const Person* item)
 {
    Q_UNUSED(item)
    return false;
@@ -99,17 +92,15 @@ bool FallbackPersonBackendEditor::edit( Person* item)
    return false;
 }
 
-bool FallbackPersonBackendEditor::addNew( Person* item)
+bool FallbackPersonBackendEditor::addNew(const Person* item)
 {
    Q_UNUSED(item)
    return false;
 }
 
-bool FallbackPersonBackendEditor::addExisting( Person* item)
+bool FallbackPersonBackendEditor::addExisting(const Person* item)
 {
-   Q_UNUSED(item)
-
-   m_lItems << item;
+   m_lItems << const_cast<Person*>(item);
    mediator()->addItem(item);
    return true;
 }
diff --git a/src/historymodel.cpp b/src/historymodel.cpp
index c305d01f..da0bb0d8 100644
--- a/src/historymodel.cpp
+++ b/src/historymodel.cpp
@@ -71,7 +71,6 @@ public:
 
    //Attributes
    static CallMap m_sHistoryCalls;
-   QVector<CollectionInterface*> m_lBackends;
 
    //Model categories
    QVector<HistoryTopLevelItem*>       m_lCategoryCounter ;
@@ -84,6 +83,7 @@ private:
    HistoryModel* q_ptr;
 
 public Q_SLOTS:
+   void add(Call* call);
    void reloadCategories();
    void slotChanged(const QModelIndex& idx);
 };
@@ -295,7 +295,7 @@ const CallMap HistoryModel::getHistoryCalls() const
 }
 
 ///Add to history
-void HistoryModel::add(Call* call)
+void HistoryModelPrivate::add(Call* call)
 {
    if (!call || call->lifeCycleState() != Call::LifeCycleState::FINISHED || !call->startTimeStamp()) {
       return;
@@ -306,33 +306,33 @@ void HistoryModel::add(Call* call)
 //       m_HavePersonModel = true;
 //    }//TODO implement reordering
 
-   emit newHistoryCall(call);
-   emit layoutAboutToBeChanged();
-   HistoryTopLevelItem* tl = d_ptr->getCategory(call);
-   const QModelIndex& parentIdx = index(tl->modelRow,0);
-   beginInsertRows(parentIdx,tl->m_lChildren.size(),tl->m_lChildren.size());
+   emit q_ptr->newHistoryCall(call);
+   emit q_ptr->layoutAboutToBeChanged();
+   HistoryTopLevelItem* tl = getCategory(call);
+   const QModelIndex& parentIdx = q_ptr->index(tl->modelRow,0);
+   q_ptr->beginInsertRows(parentIdx,tl->m_lChildren.size(),tl->m_lChildren.size());
    HistoryModelPrivate::HistoryItem* item = new HistoryModelPrivate::HistoryItem(call);
    item->m_pParent = tl;
-   item->m_pNode = new HistoryItemNode(this,call,item);
-   connect(item->m_pNode,SIGNAL(changed(QModelIndex)),d_ptr.data(),SLOT(slotChanged(QModelIndex)));
+   item->m_pNode = new HistoryItemNode(q_ptr,call,item);
+   connect(item->m_pNode,SIGNAL(changed(QModelIndex)),this,SLOT(slotChanged(QModelIndex)));
    item->m_Index = tl->m_lChildren.size();
    tl->m_lChildren << item;
 
    //Try to prevent startTimeStamp() collisions, it technically doesn't work as time_t are signed
    //we don't care
-   d_ptr->m_sHistoryCalls[(call->startTimeStamp() << 10)+qrand()%1024] = call;
-   endInsertRows();
-   emit layoutChanged();
+   m_sHistoryCalls[(call->startTimeStamp() << 10)+qrand()%1024] = call;
+   q_ptr->endInsertRows();
+   emit q_ptr->layoutChanged();
    LastUsedNumberModel::instance()->addCall(call);
-   emit historyChanged();
+   emit q_ptr->historyChanged();
 
    // Loop until it find a compatible backend
    //HACK only support a single active history backend
-   if (!call->backend()) {
-      foreach (CollectionInterface* backend, d_ptr->m_lBackends) {
+   if (!call->collection()) {
+      foreach (CollectionInterface* backend, q_ptr->collections()) {
          if (backend->supportedFeatures() & CollectionInterface::ADD) {
-            if (backend->editor<Call>()->append(call)) {
-               call->setBackend(backend);
+            if (backend->editor<Call>()->addNew(call)) {
+               call->setCollection(backend);
                break;
             }
          }
@@ -598,40 +598,15 @@ bool HistoryModel::dropMimeData(const QMimeData *mime, Qt::DropAction action, in
    return false;
 }
 
-
-// bool HistoryModel::hasBackends() const
-// {
-//    return d_ptr->m_lBackends.size();
-// }
-
-// bool HistoryModel::hasEnabledBackends() const
-// {
-//    return d_ptr->m_lBackends.size();
-// }
-
-// void HistoryModel::addBackend(CollectionInterface* backend, LoadOptions options)
-// {
-//    d_ptr->m_lBackends << backend;
-//    connect(backend,SIGNAL(newHistoryCallAdded(Call*)),this,SLOT(add(Call*)));
-//    if (options & LoadOptions::FORCE_ENABLED || ItemModelStateSerializationDelegate::instance()->isChecked(backend))
-//       backend->load();
-//    emit newBackendAdded(backend);
-// }
-
-// QString HistoryModel::backendCategoryName() const
-// {
-//    return tr("History");
-// }
-
-void HistoryModel::backendAddedCallback(CollectionInterface* backend)
+void HistoryModel::collectionAddedCallback(CollectionInterface* backend)
 {
    Q_UNUSED(backend)
 }
 
-///Call all backends that support clearing
-bool HistoryModel::clearAllBackends() const
+///Call all collections that support clearing
+bool HistoryModel::clearAllCollections() const
 {
-   foreach (CollectionInterface* backend, d_ptr->m_lBackends) {
+   foreach (CollectionInterface* backend, collections()) {
       if (backend->supportedFeatures() & CollectionInterface::ADD) {
          backend->clear();
       }
@@ -644,41 +619,18 @@ bool HistoryModel::clearAllBackends() const
    return true;
 }
 
-
-// bool HistoryModel::enableBackend(CollectionInterface* backend, bool enabled)
-// {
-//    Q_UNUSED(backend)
-//    Q_UNUSED(enabled)
-//    return false;//TODO
-// }
-
-// CommonCollectionModel* HistoryModel::backendModel() const
-// {
-//    return nullptr; //TODO
-// }
-
-// const QVector<CollectionInterface*> HistoryModel::backends() const
-// {
-//    return d_ptr->m_lBackends;
-// }
-
-bool HistoryModel::addItemCallback(Call* item)
+bool HistoryModel::addItemCallback(const Call* item)
 {
-   add(item);
+   d_ptr->add(const_cast<Call*>(item));
    return true;
 }
 
-bool HistoryModel::removeItemCallback(Call* item)
+bool HistoryModel::removeItemCallback(const Call* item)
 {
    Q_UNUSED(item)
    return false;
 }
 
-// const QVector<CollectionInterface*> HistoryModel::enabledBackends() const
-// {
-//    return d_ptr->m_lBackends;
-// }
-
 ///Return valid payload types
 int HistoryModel::acceptedPayloadTypes() const
 {
diff --git a/src/historymodel.h b/src/historymodel.h
index af0e0340..b7475493 100644
--- a/src/historymodel.h
+++ b/src/historymodel.h
@@ -48,7 +48,7 @@ public:
    friend class HistoryTopLevelItem;
 
    //Properties
-   Q_PROPERTY(bool hasBackends   READ hasBackends  )
+   Q_PROPERTY(bool hasCollections   READ hasCollections  )
 
    //Singleton
    static HistoryModel* instance();
@@ -60,7 +60,7 @@ public:
    const CallMap getHistoryCalls   () const;
 
    //Backend model implementation
-   virtual bool clearAllBackends   () const override;
+   virtual bool clearAllCollections() const override;
 
    //Setters
    void setCategoryRole(Call::Role role);
@@ -94,19 +94,15 @@ private:
    static HistoryModel* m_spInstance;
 
    //Backend interface
-   virtual void backendAddedCallback(CollectionInterface* backend) override;
-   virtual bool addItemCallback(Call* item) override;
-   virtual bool removeItemCallback(Call* item) override;
-
-public Q_SLOTS:
-   void add(Call* call);
+   virtual void collectionAddedCallback(CollectionInterface* collection) override;
+   virtual bool addItemCallback(const Call* item) override;
+   virtual bool removeItemCallback(const Call* item) override;
 
 Q_SIGNALS:
    ///Emitted when the history change (new items, cleared)
    void historyChanged          (            );
    ///Emitted when a new item is added to prevent full reload
    void newHistoryCall          ( Call* call );
-   void newBackendAdded(AbstractHistoryBackend* backend);
 };
 
 #endif
diff --git a/src/itembase.h b/src/itembase.h
index da876e06..808c2b8a 100644
--- a/src/itembase.h
+++ b/src/itembase.h
@@ -33,7 +33,7 @@ class LIB_EXPORT ItemBase : public T {
 public:
    //Constructor
    explicit ItemBase(T* parent = nullptr);
-   virtual CollectionInterface* backend() final;
+   virtual CollectionInterface* collection() const final;
 
    //Mutator methods
    bool save() const;
@@ -41,7 +41,7 @@ public:
    bool remove()    ;
 
    //Setter
-   void setBackend(CollectionInterface* backend);
+   void setCollection(CollectionInterface* backend);
 
 protected:
 private:
diff --git a/src/itembase.hpp b/src/itembase.hpp
index 1db529ac..ff7c946d 100644
--- a/src/itembase.hpp
+++ b/src/itembase.hpp
@@ -33,13 +33,13 @@ ItemBase<Base>::ItemBase(Base* parent) :Base(parent), d_ptr(new ItemBasePrivate(
 }
 
 template<typename Base>
-CollectionInterface* ItemBase<Base>::backend()
+CollectionInterface* ItemBase<Base>::collection() const
 {
    return d_ptr->m_pBackend;
 }
 
 template<typename Base>
-void ItemBase<Base>::setBackend(CollectionInterface* backend)
+void ItemBase<Base>::setCollection(CollectionInterface* backend)
 {
    d_ptr->m_pBackend = backend;
 }
diff --git a/src/person.cpp b/src/person.cpp
index 5bb4d83d..c05e5f8b 100644
--- a/src/person.cpp
+++ b/src/person.cpp
@@ -229,7 +229,7 @@ Person* Person::ContactMethods::contact() const
 Person::Person(CollectionInterface* parent): ItemBase<QObject>(nullptr),
    d_ptr(new PersonPrivate(this))
 {
-   setBackend(parent?parent:TransitionalPersonBackend::instance());
+   setCollection(parent?parent:TransitionalPersonBackend::instance());
    d_ptr->m_isPlaceHolder = false;
    d_ptr->m_lParents << this;
 }
diff --git a/src/personmodel.cpp b/src/personmodel.cpp
index 009ba075..d50002a2 100644
--- a/src/personmodel.cpp
+++ b/src/personmodel.cpp
@@ -45,7 +45,6 @@ public:
 
    //Attributes
 //    QVector<CollectionInterface*> m_lBackends;
-   CommonCollectionModel* m_pBackendModel;
    QHash<QByteArray,PersonPlaceHolder*> m_hPlaceholders;
 
    //Indexes
@@ -60,8 +59,7 @@ private Q_SLOTS:
 //    void slotPersonAdded(Person* c);
 };
 
-PersonModelPrivate::PersonModelPrivate(PersonModel* parent) : QObject(parent), q_ptr(parent),
-m_pBackendModel(nullptr)
+PersonModelPrivate::PersonModelPrivate(PersonModel* parent) : QObject(parent), q_ptr(parent)
 {
    
 }
@@ -239,7 +237,7 @@ Person* PersonModel::getPlaceHolder(const QByteArray& uid )
    return ct2;
 }
 
-///Return if there is backends
+///Return if there is collections
 // bool PersonModel::hasBackends() const
 // {
 //    return d_ptr->m_lBackends.size();
@@ -269,22 +267,22 @@ Person* PersonModel::getPlaceHolder(const QByteArray& uid )
 //    return tr("Persons");
 // }
 
-void PersonModel::backendAddedCallback(CollectionInterface* backend)
+void PersonModel::collectionAddedCallback(CollectionInterface* backend)
 {
    Q_UNUSED(backend)
 }
 
-// const QVector<CollectionInterface*> PersonModel::backends() const
+// const QVector<CollectionInterface*> PersonModel::collections() const
 // {
 //    return d_ptr->m_lBackends;
 // }
 
-bool PersonModel::addItemCallback(Person* c)
+bool PersonModel::addItemCallback(const Person* c)
 {
    //Add to the model
    beginInsertRows(QModelIndex(),d_ptr->m_lPersons.size(),d_ptr->m_lPersons.size());
-   d_ptr->m_lPersons << c;
-   d_ptr->m_hPersonsByUid[c->uid()] = c;
+   d_ptr->m_lPersons << const_cast<Person*>(c);
+   d_ptr->m_hPersonsByUid[c->uid()] = const_cast<Person*>(c);
    endInsertRows();
    emit newPersonAdded(c);
 
@@ -292,14 +290,14 @@ bool PersonModel::addItemCallback(Person* c)
    if (d_ptr->m_hPlaceholders.contains(c->uid())) {
       PersonPlaceHolder* c2 = d_ptr->m_hPlaceholders[c->uid()];
       if (c2) {
-         c2->merge(c);
+         c2->merge(const_cast<Person*>(c));
          d_ptr->m_hPlaceholders[c->uid()] = nullptr;
       }
    }
    return true;
 }
 
-bool PersonModel::removeItemCallback(Person* item)
+bool PersonModel::removeItemCallback(const Person* item)
 {
    Q_UNUSED(item)
    return false;
@@ -317,8 +315,8 @@ bool PersonModel::addPerson(Person* c)
 {
    if (!c)
       return false;
-   if (backends().size()) //TODO this is wrong, it work for now because profilemodel is [0]
-      backends()[0]->add(c);
+   if (collections().size()) //TODO this is wrong, it work for now because profilemodel is [0]
+      collections()[0]->add(c);
    return true;
 }
 
@@ -346,10 +344,10 @@ const PersonList PersonModel::contacts() const
 
 bool PersonModel::addNewPerson(Person* c, CollectionInterface* backend)
 {
-   if ((!backend) || (!backends().size()))
+   if ((!backend) || (!collections().size()))
       return false;
 
-   return (backend?backend:backends()[0])->editor<Person>()->addNew(c);
+   return (backend?backend:collections()[0])->editor<Person>()->addNew(c);
 }
 
 
diff --git a/src/personmodel.h b/src/personmodel.h
index 1888b91c..361629cb 100644
--- a/src/personmodel.h
+++ b/src/personmodel.h
@@ -95,16 +95,16 @@ private:
    static PersonModel* m_spInstance;
 
    //Backend interface
-   virtual void backendAddedCallback(CollectionInterface* backend) override;
-   virtual bool addItemCallback(Person* item) override;
-   virtual bool removeItemCallback(Person* item) override;
+   virtual void collectionAddedCallback(CollectionInterface* backend) override;
+   virtual bool addItemCallback(const Person* item) override;
+   virtual bool removeItemCallback(const Person* item) override;
 
 public Q_SLOTS:
    bool addNewPerson(Person* c, CollectionInterface* backend = nullptr);
 
 Q_SIGNALS:
    void reloaded();
-   void newPersonAdded(Person* c);
+   void newPersonAdded(const Person* c);
    void newBackendAdded(CollectionInterface* backend);
 };
 
diff --git a/src/profilemodel.cpp b/src/profilemodel.cpp
index 40f68ccb..458ba649 100644
--- a/src/profilemodel.cpp
+++ b/src/profilemodel.cpp
@@ -51,11 +51,10 @@ public:
    ProfileEditor(CollectionMediator<Person>* m) : CollectionEditor<Person>(m) {};
    ~ProfileEditor();
    virtual bool save       ( const Person* item ) override;
-   virtual bool append     ( const Person* item ) override;
-   virtual bool remove     ( Person*       item ) override;
-   virtual bool edit       ( Person*       item ) override;
-   virtual bool addNew     ( Person*       item ) override;
-   virtual bool addExisting( Person*       item ) override;
+   virtual bool remove     ( const Person* item ) override;
+   virtual bool edit       (       Person* item ) override;
+   virtual bool addNew     ( const Person* item ) override;
+   virtual bool addExisting( const Person* item ) override;
 
    Node* getProfileById(const QByteArray& id);
    QList<Account*> getAccountsForProfile(const QString& id);
@@ -144,13 +143,7 @@ ProfileEditor::~ProfileEditor()
    }
 }
 
-bool ProfileEditor::append(const Person* item)
-{
-   Q_UNUSED(item)
-   return false;
-}
-
-bool ProfileEditor::remove(Person* item)
+bool ProfileEditor::remove(const Person* item)
 {
    Q_UNUSED(item)
    mediator()->removeItem(item);
@@ -163,19 +156,19 @@ bool ProfileEditor::edit( Person* contact)
    return false;
 }
 
-bool ProfileEditor::addNew( Person* contact)
+bool ProfileEditor::addNew(const Person* contact)
 {
    qDebug() << "Creating new profile" << contact->uid();
-   m_lProfilePersons << contact;
+   m_lProfilePersons << const_cast<Person*>(contact);
    mediator()->addItem(contact);
    save(contact);
 //    load(); //FIXME
    return true;
 }
 
-bool ProfileEditor::addExisting( Person* contact)
+bool ProfileEditor::addExisting(const Person* contact)
 {
-   m_lProfilePersons << contact;
+   m_lProfilePersons << const_cast<Person*>(contact);
    mediator()->addItem(contact);
    return true;
 }
diff --git a/src/transitionalpersonbackend.cpp b/src/transitionalpersonbackend.cpp
index 95b933e5..1fe73981 100644
--- a/src/transitionalpersonbackend.cpp
+++ b/src/transitionalpersonbackend.cpp
@@ -30,11 +30,10 @@ class TransitionalPersonEditor : public CollectionEditor<Person>
 public:
    TransitionalPersonEditor(CollectionMediator<Person>* m) : CollectionEditor<Person>(m) {}
    virtual bool save       ( const Person* item ) override;
-   virtual bool append     ( const Person* item ) override;
-   virtual bool remove     ( Person*       item ) override;
+   virtual bool remove     ( const Person* item ) override;
    virtual bool edit       ( Person*       item ) override;
-   virtual bool addNew     ( Person*       item ) override;
-   virtual bool addExisting( Person*       item ) override;
+   virtual bool addNew     ( const Person* item ) override;
+   virtual bool addExisting( const Person* item ) override;
 
 private:
    virtual QVector<Person*> items() const override;
@@ -46,13 +45,7 @@ bool TransitionalPersonEditor::save(const Person* item)
    return false;
 }
 
-bool TransitionalPersonEditor::append(const Person* item)
-{
-   Q_UNUSED(item)
-   return false;
-}
-
-bool TransitionalPersonEditor::remove(Person* item)
+bool TransitionalPersonEditor::remove(const Person* item)
 {
    Q_UNUSED(item)
    return false;
@@ -64,13 +57,13 @@ bool TransitionalPersonEditor::edit( Person* item)
    return false;
 }
 
-bool TransitionalPersonEditor::addNew( Person* item)
+bool TransitionalPersonEditor::addNew(const  Person* item)
 {
    Q_UNUSED(item)
    return false;
 }
 
-bool TransitionalPersonEditor::addExisting( Person* item)
+bool TransitionalPersonEditor::addExisting(const  Person* item)
 {
    Q_UNUSED(item)
    return false;
-- 
GitLab