summaryrefslogtreecommitdiffstats
path: root/src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp
diff options
context:
space:
mode:
authorMatt Vogt <matthew.vogt@jollamobile.com>2014-05-22 19:18:55 +1000
committerMatthew Vogt <matthew.vogt@qinetic.com.au>2014-07-18 08:45:20 +0200
commit3b77fe17a82590627d306d5e58ecd5d83fee7893 (patch)
tree555f1e48aa66c18e65748805311bdb90e5f1a706 /src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp
parent69065fa9fd53ea6955537f5b5dad7f5b88ec2071 (diff)
Extend changed signals to optionally report changed types
Add a parameter to the contactsChanged and itemsChanged signals, which allow a manager to optionally report the extent of changes involved in a contact or organizer item modification. If no changes are explicitly reported by the manager, the receiver must assume that any or all details of the contacts or organizer items may have been modified. Change-Id: Ie8a0d051c3f82a5911dea68213d78c2b173e762e Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Diffstat (limited to 'src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp')
-rw-r--r--src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp b/src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp
index 344880906..f1d27e38f 100644
--- a/src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp
+++ b/src/plugins/organizer/memory/qorganizeritemmemorybackend.cpp
@@ -703,7 +703,7 @@ void QOrganizerItemMemoryEngine::addItemRecurrences(QList<QOrganizerItem>& sorte
/*! Saves the given organizeritem \a theOrganizerItem, storing any error to \a error and
filling the \a changeSet with ids of changed organizeritems as required */
-bool QOrganizerItemMemoryEngine::saveItem(QOrganizerItem* theOrganizerItem, QOrganizerItemChangeSet& changeSet, QOrganizerManager::Error* error)
+bool QOrganizerItemMemoryEngine::storeItem(QOrganizerItem* theOrganizerItem, QOrganizerItemChangeSet& changeSet, const QList<QOrganizerItemDetail::DetailType> &detailMask, QOrganizerManager::Error* error)
{
QOrganizerCollectionId targetCollectionId = theOrganizerItem->collectionId();
@@ -749,7 +749,7 @@ bool QOrganizerItemMemoryEngine::saveItem(QOrganizerItem* theOrganizerItem, QOrg
}
// Looks ok, so continue
d->m_idToItemHash.insert(theOrganizerItemId, *theOrganizerItem); // replacement insert.
- changeSet.insertChangedItem(theOrganizerItemId);
+ changeSet.insertChangedItem(theOrganizerItemId, detailMask);
// cross-check if stored exception occurrences are still valid
if (itemHasReccurence(oldOrganizerItem)) {
@@ -836,7 +836,7 @@ bool QOrganizerItemMemoryEngine::saveItem(QOrganizerItem* theOrganizerItem, QOrg
recurrence.setExceptionDates(currentExceptionDates);
parentItem.saveDetail(&recurrence);
d->m_idToItemHash.insert(parentId, parentItem); // replacement insert
- changeSet.insertChangedItem(parentId); // is this correct? it's an exception, so change parent?
+ changeSet.insertChangedItem(parentId, detailMask); // is this correct? it's an exception, so change parent?
}
}
@@ -950,7 +950,8 @@ bool QOrganizerItemMemoryEngine::typesAreRelated(QOrganizerItemType::ItemType oc
&& occurrenceType == QOrganizerItemType::TypeTodoOccurrence));
}
-bool QOrganizerItemMemoryEngine::saveItems(QList<QOrganizerItem>* organizeritems, QMap<int, QOrganizerManager::Error>* errorMap, QOrganizerManager::Error* error)
+bool QOrganizerItemMemoryEngine::storeItems(QList<QOrganizerItem>* organizeritems, const QList<QOrganizerItemDetail::DetailType> &detailMask,
+ QMap<int, QOrganizerManager::Error>* errorMap, QOrganizerManager::Error* error)
{
Q_ASSERT(errorMap);
@@ -966,7 +967,7 @@ bool QOrganizerItemMemoryEngine::saveItems(QList<QOrganizerItem>* organizeritems
QOrganizerManager::Error operationError = QOrganizerManager::NoError;
for (int i = 0; i < organizeritems->count(); i++) {
current = organizeritems->at(i);
- if (!saveItem(&current, changeSet, error)) {
+ if (!storeItem(&current, changeSet, detailMask, error)) {
operationError = *error;
errorMap->insert(i, operationError);
} else {
@@ -988,7 +989,7 @@ bool QOrganizerItemMemoryEngine::saveItems(QList<QOrganizerItem> *items, const Q
// TODO should the default implementation do the right thing, or return false?
if (detailMask.isEmpty()) {
// Non partial, just pass it on
- return saveItems(items, errorMap, error);
+ return storeItems(items, detailMask, errorMap, error);
} else {
// Partial item save.
// Basically
@@ -1083,7 +1084,7 @@ bool QOrganizerItemMemoryEngine::saveItems(QList<QOrganizerItem> *items, const Q
// Now save them
QMap<int, QOrganizerManager::Error> saveErrors;
QOrganizerManager::Error saveError = QOrganizerManager::NoError;
- saveItems(&itemsToSave, &saveErrors, &saveError);
+ storeItems(&itemsToSave, detailMask, &saveErrors, &saveError);
// Now update the passed in arguments, where necessary
// Update IDs of the items list
@@ -1163,7 +1164,7 @@ bool QOrganizerItemMemoryEngine::removeOccurrence(const QOrganizerItem &organize
recurrenceDetail.setExceptionDates(exceptionDates);
parentItem.saveDetail(&recurrenceDetail);
d->m_idToItemHash.insert(parentDetail.parentId(), parentItem);
- changeSet.insertChangedItem(parentDetail.parentId());
+ changeSet.insertChangedItem(parentDetail.parentId(), QList<QOrganizerItemDetail::DetailType>());
}
*error = QOrganizerManager::NoError;
return true;
@@ -1554,7 +1555,7 @@ void QOrganizerItemMemoryEngine::performAsynchronousOperation(QOrganizerAbstract
QOrganizerManager::Error operationError = QOrganizerManager::NoError;
QMap<int, QOrganizerManager::Error> errorMap;
- saveItems(&organizeritems, &errorMap, &operationError);
+ saveItems(&organizeritems, r->detailMask(), &errorMap, &operationError);
updateItemSaveRequest(r, organizeritems, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
}