Commit 48f07eae authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

[BIC] Let ETM be constructed with Monitor instead of ChangeRecorder

There is zero reason to require ETM to be constructed with
ChangeRecorder, when none of the recording features are actually
used there. Instead let ETM be created with Monitor.

Monitor is a baseclass of ChangeRecorder so no existing code needs to
be changed, but it's a binary incompatible change, so everything
linking Akonadi must be rebuilt.
parent dad52613
......@@ -22,7 +22,7 @@ include(CheckSymbolExists)
include(AkonadiMacros)
set(PIM_VERSION "5.3.44")
set(PIM_VERSION "5.3.45")
set(QT_REQUIRED_VERSION "5.5.0")
set(AKONADI_VERSION ${PIM_VERSION})
......
......@@ -33,7 +33,7 @@
#include <QUrlQuery>
#include "attributefactory.h"
#include "changerecorder.h"
#include "monitor.h"
#include "collectionmodifyjob.h"
#include "entitydisplayattribute.h"
#include "transactionsequence.h"
......@@ -49,7 +49,7 @@ Q_DECLARE_METATYPE(QSet<QByteArray>)
using namespace Akonadi;
EntityTreeModel::EntityTreeModel(ChangeRecorder *monitor, QObject *parent)
EntityTreeModel::EntityTreeModel(Monitor *monitor, QObject *parent)
: QAbstractItemModel(parent)
, d_ptr(new EntityTreeModelPrivate(this))
{
......@@ -57,7 +57,7 @@ EntityTreeModel::EntityTreeModel(ChangeRecorder *monitor, QObject *parent)
d->init(monitor);
}
EntityTreeModel::EntityTreeModel(ChangeRecorder *monitor, EntityTreeModelPrivate *d, QObject *parent)
EntityTreeModel::EntityTreeModel(Monitor *monitor, EntityTreeModelPrivate *d, QObject *parent)
: QAbstractItemModel(parent)
, d_ptr(d)
{
......
......@@ -31,7 +31,6 @@
namespace Akonadi
{
class ChangeRecorder;
class CollectionStatistics;
class Item;
class ItemFetchScope;
......@@ -71,14 +70,14 @@ class EntityTreeModelPrivate;
* <h3>Using EntityTreeModel in your application</h3>
*
* The responsibilities which fall to the application developer are
* - Configuring the ChangeRecorder and EntityTreeModel
* - Configuring the Monitor and EntityTreeModel
* - Making use of this class via proxy models
* - Subclassing for type specific display information
*
* <h3>Creating and configuring the EntityTreeModel</h3>
*
* This class is a wrapper around a Akonadi::ChangeRecorder object. The model represents a
* part of the collection and item tree configured in the ChangeRecorder. The structure of the
* This class is a wrapper around a Akonadi::Monitor object. The model represents a
* part of the collection and item tree configured in the Monitor. The structure of the
* model mirrors the structure of Collections and Items on the %Akonadi server.
*
* The following code creates a model which fetches items and collections relevant to
......@@ -86,12 +85,12 @@ class EntityTreeModelPrivate;
*
* @code
*
* ChangeRecorder *changeRecorder = new ChangeRecorder( this );
* changeRecorder->setCollectionMonitored( Collection::root() );
* changeRecorder->setMimeTypeMonitored( KContacts::addresseeMimeType() );
* changeRecorder->setSession( session );
* Monitor *monitor = new Monitor( this );
* monitor->setCollectionMonitored( Collection::root() );
* monitor->setMimeTypeMonitored( KContacts::addresseeMimeType() );
* monitor->setSession( session );
*
* EntityTreeModel *model = new EntityTreeModel( changeRecorder, this );
* EntityTreeModel *model = new EntityTreeModel( monitor, this );
*
* EntityTreeView *view = new EntityTreeView( this );
* view->setModel( model );
......@@ -101,7 +100,7 @@ class EntityTreeModelPrivate;
* The EntityTreeModel will show items of a different type by changing the line
*
* @code
* changeRecorder->setMimeTypeMonitored( KContacts::addresseeMimeType() );
* monitor->setMimeTypeMonitored( KContacts::addresseeMimeType() );
* @endcode
*
* to a different mimetype. KContacts::addresseeMimeType() is an alias for "text/directory". If changed to KMime::Message::mimeType()
......@@ -173,8 +172,8 @@ class EntityTreeModelPrivate;
* fetched. To fetch all item data, including all attributes:
*
* @code
* changeRecorder->itemFetchScope().fetchFullPayload();
* changeRecorder->itemFetchScope().fetchAllAttributes();
* monitor->itemFetchScope().fetchFullPayload();
* monitor->itemFetchScope().fetchAllAttributes();
* @endcode
*
* <h2>Using EntityTreeModel with Proxy models</h2>
......@@ -389,10 +388,10 @@ public:
/**
* Creates a new entity tree model.
*
* @param monitor The ChangeRecorder whose entities should be represented in the model.
* @param monitor The Monitor whose entities should be represented in the model.
* @param parent The parent object.
*/
explicit EntityTreeModel(ChangeRecorder *monitor, QObject *parent = Q_NULLPTR);
explicit EntityTreeModel(Monitor *monitor, QObject *parent = Q_NULLPTR);
/**
* Destroys the entity tree model.
......@@ -672,7 +671,7 @@ protected:
//@cond PRIVATE
Q_DECLARE_PRIVATE(EntityTreeModel)
EntityTreeModelPrivate *d_ptr;
EntityTreeModel(ChangeRecorder *monitor, EntityTreeModelPrivate *d, QObject *parent = Q_NULLPTR);
EntityTreeModel(Monitor *monitor, EntityTreeModelPrivate *d, QObject *parent = Q_NULLPTR);
//@endcond
private:
......
......@@ -30,7 +30,7 @@
#include "agentmanager.h"
#include "agenttype.h"
#include "changerecorder.h"
#include "monitor.h"
#include "collectioncopyjob.h"
#include "collectionfetchjob.h"
#include "collectionfetchscope.h"
......@@ -95,7 +95,7 @@ EntityTreeModelPrivate::~EntityTreeModelPrivate()
{
}
void EntityTreeModelPrivate::init(ChangeRecorder *monitor)
void EntityTreeModelPrivate::init(Monitor *monitor)
{
Q_Q(EntityTreeModel);
Q_ASSERT(!m_monitor);
......@@ -106,8 +106,6 @@ void EntityTreeModelPrivate::init(ChangeRecorder *monitor)
m_monitor->fetchCollection(true);
m_session = m_monitor->session();
m_monitor->setChangeRecordingEnabled(false);
m_rootCollectionDisplayName = QStringLiteral("[*]");
m_includeStatistics = true;
......
......@@ -38,7 +38,7 @@ Q_DECLARE_LOGGING_CATEGORY(DebugETM)
namespace Akonadi
{
class ItemFetchJob;
class ChangeRecorder;
class Monitor;
class AgentInstance;
}
......@@ -74,7 +74,7 @@ public:
Recursive
};
void init(ChangeRecorder *monitor);
void init(Monitor *monitor);
void fetchCollections(const Collection &collection, CollectionFetchJob::Type type = CollectionFetchJob::FirstLevel);
void fetchCollections(const Collection::List &collections, CollectionFetchJob::Type type = CollectionFetchJob::FirstLevel);
......@@ -149,7 +149,7 @@ public:
mutable QHash<QString, QIcon> m_iconCache;
mutable QString m_iconThemeName;
ChangeRecorder *m_monitor;
Monitor *m_monitor;
Collection m_rootCollection;
Node *m_rootNode;
QString m_rootCollectionDisplayName;
......
Supports Markdown
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