Skip to content

Commit

Permalink
Accessors should be const
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Adams committed Jul 1, 2020
1 parent 8a35584 commit e9ed37e
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/contacts/qcontactmanager.cpp
Expand Up @@ -815,7 +815,7 @@ QContactCollectionId QContactManager::defaultCollectionId() const
/*!
Returns the collection identified by the given \a collectionId which is managed by this manager.
*/
QContactCollection QContactManager::collection(const QContactCollectionId& collectionId)
QContactCollection QContactManager::collection(const QContactCollectionId& collectionId) const
{
QContactManagerSyncOpErrorHolder h(this);
return d->m_engine->collection(collectionId, &h.error);
Expand All @@ -824,7 +824,7 @@ QContactCollection QContactManager::collection(const QContactCollectionId& colle
/*!
Returns a list of all of the collections managed by this manager.
*/
QList<QContactCollection> QContactManager::collections()
QList<QContactCollection> QContactManager::collections() const
{
QContactManagerSyncOpErrorHolder h(this);
return d->m_engine->collections(&h.error);
Expand Down
4 changes: 2 additions & 2 deletions src/contacts/qcontactmanager.h
Expand Up @@ -151,8 +151,8 @@ class Q_CONTACTS_EXPORT QContactManager : public QObject

// collections
QContactCollectionId defaultCollectionId() const;
QContactCollection collection(const QContactCollectionId& collectionId);
QList<QContactCollection> collections();
QContactCollection collection(const QContactCollectionId& collectionId) const;
QList<QContactCollection> collections() const;
bool saveCollection(QContactCollection* collection);
bool removeCollection(const QContactCollectionId& collectionId);

Expand Down
1 change: 1 addition & 0 deletions src/contacts/qcontactmanager_p.cpp
Expand Up @@ -133,6 +133,7 @@ void QContactManagerData::createEngine(const QString &managerName, const QMap<QS

while (!found) {
foreach (QContactManagerEngineFactory* f, factories) {
if (!f) continue;
QList<int> versions = f->supportedImplementationVersions();
if (implementationVersion == -1 ||//no given implementation version required
versions.isEmpty() || //the manager engine factory does not report any version
Expand Down
4 changes: 2 additions & 2 deletions src/contacts/qcontactmanagerengine.cpp
Expand Up @@ -458,7 +458,7 @@ QContactCollectionId QContactManagerEngine::defaultCollectionId() const
\c QContactManager::DoesNotExistError.
*/
QContactCollection QContactManagerEngine::collection(const QContactCollectionId& collectionId, QContactManager::Error* error)
QContactCollection QContactManagerEngine::collection(const QContactCollectionId& collectionId, QContactManager::Error* error) const
{
Q_UNUSED(collectionId);
*error = QContactManager::NotSupportedError;
Expand All @@ -469,7 +469,7 @@ QContactCollection QContactManagerEngine::collection(const QContactCollectionId&
This function should be reimplemented to support synchronous calls to fetch all the collections
managed by this backend. Any errors encountered during this operation should be stored to \a error.
*/
QList<QContactCollection> QContactManagerEngine::collections(QContactManager::Error* error)
QList<QContactCollection> QContactManagerEngine::collections(QContactManager::Error* error) const
{
*error = QContactManager::NotSupportedError;
return QList<QContactCollection>();
Expand Down
4 changes: 2 additions & 2 deletions src/contacts/qcontactmanagerengine.h
Expand Up @@ -101,8 +101,8 @@ class Q_CONTACTS_EXPORT QContactManagerEngine : public QObject

// collections
virtual QContactCollectionId defaultCollectionId() const;
virtual QContactCollection collection(const QContactCollectionId &collectionId, QContactManager::Error *error);
virtual QList<QContactCollection> collections(QContactManager::Error *error);
virtual QContactCollection collection(const QContactCollectionId &collectionId, QContactManager::Error *error) const;
virtual QList<QContactCollection> collections(QContactManager::Error *error) const;
virtual bool saveCollection(QContactCollection *collection, QContactManager::Error *error);
virtual bool removeCollection(const QContactCollectionId &collectionId, QContactManager::Error *error);

Expand Down
4 changes: 2 additions & 2 deletions src/organizer/qorganizermanager.cpp
Expand Up @@ -649,7 +649,7 @@ QOrganizerCollectionId QOrganizerManager::defaultCollectionId() const
/*!
Returns the collection identified by the given \a collectionId which is managed by this manager.
*/
QOrganizerCollection QOrganizerManager::collection(const QOrganizerCollectionId& collectionId)
QOrganizerCollection QOrganizerManager::collection(const QOrganizerCollectionId& collectionId) const
{
QOrganizerManagerSyncOpErrorHolder h(this);
return d->m_engine->collection(collectionId, &h.error);
Expand All @@ -658,7 +658,7 @@ QOrganizerCollection QOrganizerManager::collection(const QOrganizerCollectionId&
/*!
Returns a list of all of the collections managed by this manager.
*/
QList<QOrganizerCollection> QOrganizerManager::collections()
QList<QOrganizerCollection> QOrganizerManager::collections() const
{
QOrganizerManagerSyncOpErrorHolder h(this);
return d->m_engine->collections(&h.error);
Expand Down
4 changes: 2 additions & 2 deletions src/organizer/qorganizermanager.h
Expand Up @@ -143,8 +143,8 @@ class Q_ORGANIZER_EXPORT QOrganizerManager : public QObject

// collections
QOrganizerCollectionId defaultCollectionId() const;
QOrganizerCollection collection(const QOrganizerCollectionId& collectionId);
QList<QOrganizerCollection> collections();
QOrganizerCollection collection(const QOrganizerCollectionId& collectionId) const;
QList<QOrganizerCollection> collections() const;
bool saveCollection(QOrganizerCollection* collection);
bool removeCollection(const QOrganizerCollectionId& collectionId);

Expand Down
4 changes: 2 additions & 2 deletions src/organizer/qorganizermanagerengine.cpp
Expand Up @@ -534,7 +534,7 @@ QOrganizerCollectionId QOrganizerManagerEngine::defaultCollectionId() const
\c QOrganizerManager::DoesNotExistError.
*/
QOrganizerCollection QOrganizerManagerEngine::collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error)
QOrganizerCollection QOrganizerManagerEngine::collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error) const
{
Q_UNUSED(collectionId);
*error = QOrganizerManager::NotSupportedError;
Expand All @@ -545,7 +545,7 @@ QOrganizerCollection QOrganizerManagerEngine::collection(const QOrganizerCollect
This function should be reimplemented to support synchronous calls to fetch all the collections
managed by this backend. Any errors encountered during this operation should be stored to \a error.
*/
QList<QOrganizerCollection> QOrganizerManagerEngine::collections(QOrganizerManager::Error* error)
QList<QOrganizerCollection> QOrganizerManagerEngine::collections(QOrganizerManager::Error* error) const
{
*error = QOrganizerManager::NotSupportedError;
return QList<QOrganizerCollection>();
Expand Down
4 changes: 2 additions & 2 deletions src/organizer/qorganizermanagerengine.h
Expand Up @@ -103,8 +103,8 @@ class Q_ORGANIZER_EXPORT QOrganizerManagerEngine : public QObject

// collections
virtual QOrganizerCollectionId defaultCollectionId() const;
virtual QOrganizerCollection collection(const QOrganizerCollectionId &collectionId, QOrganizerManager::Error *error);
virtual QList<QOrganizerCollection> collections(QOrganizerManager::Error *error);
virtual QOrganizerCollection collection(const QOrganizerCollectionId &collectionId, QOrganizerManager::Error *error) const;
virtual QList<QOrganizerCollection> collections(QOrganizerManager::Error *error) const;
virtual bool saveCollection(QOrganizerCollection *collection, QOrganizerManager::Error *error);
virtual bool removeCollection(const QOrganizerCollectionId &collectionId, QOrganizerManager::Error *error);

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/contacts/memory/qcontactmemorybackend.cpp
Expand Up @@ -519,7 +519,7 @@ QContactCollectionId QContactMemoryEngine::defaultCollectionId() const
return collectionId(id);
}

QContactCollection QContactMemoryEngine::collection(const QContactCollectionId &collectionId, QContactManager::Error *error)
QContactCollection QContactMemoryEngine::collection(const QContactCollectionId &collectionId, QContactManager::Error *error) const
{
if (d->m_idToCollectionHash.contains(collectionId)) {
*error = QContactManager::NoError;
Expand All @@ -530,7 +530,7 @@ QContactCollection QContactMemoryEngine::collection(const QContactCollectionId &
return QContactCollection();
}

QList<QContactCollection> QContactMemoryEngine::collections(QContactManager::Error *error)
QList<QContactCollection> QContactMemoryEngine::collections(QContactManager::Error *error) const
{
Q_ASSERT(!d->m_idToCollectionHash.isEmpty());
*error = QContactManager::NoError;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/contacts/memory/qcontactmemorybackend_p.h
Expand Up @@ -159,8 +159,8 @@ class QContactMemoryEngine : public QContactManagerEngine

// collections
QContactCollectionId defaultCollectionId() const;
QContactCollection collection(const QContactCollectionId &collectionId, QContactManager::Error *error);
QList<QContactCollection> collections(QContactManager::Error* error);
QContactCollection collection(const QContactCollectionId &collectionId, QContactManager::Error *error) const;
QList<QContactCollection> collections(QContactManager::Error* error) const;
bool saveCollection(QContactCollection* collection, QContactManager::Error* error);
bool removeCollection(const QContactCollectionId& collectionId, QContactManager::Error* error);

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp
Expand Up @@ -1045,7 +1045,7 @@ QOrganizerCollectionId QOrganizerItemMemoryEngine::defaultCollectionId() const
return collectionId(QByteArray(reinterpret_cast<const char *>(&id), sizeof(uint)));
}

QOrganizerCollection QOrganizerItemMemoryEngine::collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error)
QOrganizerCollection QOrganizerItemMemoryEngine::collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error) const
{
if (d->m_idToCollectionHash.contains(collectionId)) {
*error = QOrganizerManager::NoError;
Expand All @@ -1056,7 +1056,7 @@ QOrganizerCollection QOrganizerItemMemoryEngine::collection(const QOrganizerColl
return QOrganizerCollection();
}

QList<QOrganizerCollection> QOrganizerItemMemoryEngine::collections(QOrganizerManager::Error* error)
QList<QOrganizerCollection> QOrganizerItemMemoryEngine::collections(QOrganizerManager::Error* error) const
{
Q_ASSERT(!d->m_idToCollectionHash.isEmpty());
*error = QOrganizerManager::NoError;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/organizer/memory/qorganizeritemmemorybackend_p.h
Expand Up @@ -147,8 +147,8 @@ class QOrganizerItemMemoryEngine : public QOrganizerManagerEngine

// collections
QOrganizerCollectionId defaultCollectionId() const;
QOrganizerCollection collection(const QOrganizerCollectionId &collectionId, QOrganizerManager::Error *error);
QList<QOrganizerCollection> collections(QOrganizerManager::Error* error);
QOrganizerCollection collection(const QOrganizerCollectionId &collectionId, QOrganizerManager::Error *error) const;
QList<QOrganizerCollection> collections(QOrganizerManager::Error* error) const;
bool saveCollection(QOrganizerCollection* collection, QOrganizerManager::Error* error);
bool removeCollection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error);

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/organizer/skeleton/qorganizerskeleton.cpp
Expand Up @@ -258,7 +258,7 @@ QOrganizerCollectionId QOrganizerItemSkeletonEngine::defaultCollectionId() const
return QOrganizerManagerEngine::defaultCollectionId();
}

QOrganizerCollection QOrganizerItemSkeletonEngine::collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error)
QOrganizerCollection QOrganizerItemSkeletonEngine::collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error) const
{
/*
TODO
Expand All @@ -270,7 +270,7 @@ QOrganizerCollection QOrganizerItemSkeletonEngine::collection(const QOrganizerCo
return QOrganizerManagerEngine::collection(collectionId, error);
}

QList<QOrganizerCollection> QOrganizerItemSkeletonEngine::collections(QOrganizerManager::Error* error)
QList<QOrganizerCollection> QOrganizerItemSkeletonEngine::collections(QOrganizerManager::Error* error) const
{
/*
TODO
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/organizer/skeleton/qorganizerskeleton_p.h
Expand Up @@ -135,8 +135,8 @@ class QOrganizerItemSkeletonEngine : public QOrganizerManagerEngine

// collections
QOrganizerCollectionId defaultCollectionId() const;
QOrganizerCollection collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error);
QList<QOrganizerCollection> collections(QOrganizerManager::Error* error);
QOrganizerCollection collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error) const;
QList<QOrganizerCollection> collections(QOrganizerManager::Error* error) const;
bool saveCollection(QOrganizerCollection* collection, QOrganizerManager::Error* error);
bool removeCollection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error);

Expand Down

0 comments on commit e9ed37e

Please sign in to comment.