2
* Copyright 2013 Canonical Ltd.
4
* This file is part of ubuntu-pim-service.
6
* contact-service-app is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* contact-service-app is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
#include "qorganizer-eds-saverequestdata.h"
21
#include <QtOrganizer/QOrganizerManagerEngine>
22
#include <QtOrganizer/QOrganizerItemSaveRequest>
24
using namespace QtOrganizer;
26
SaveRequestData::SaveRequestData(QOrganizerEDSEngine *engine,
27
QtOrganizer::QOrganizerAbstractRequest *req,
28
QOrganizerCollectionId collectionId)
29
: RequestData(engine, req),
30
m_collectionId(collectionId)
34
SaveRequestData::~SaveRequestData()
39
void SaveRequestData::finish(QtOrganizer::QOrganizerManager::Error error)
42
QOrganizerManagerEngine::updateItemSaveRequest(request<QOrganizerItemSaveRequest>(),
45
QMap<int, QOrganizerManager::Error>(),
46
QOrganizerAbstractRequest::FinishedState);
47
Q_FOREACH(QOrganizerItem item, m_result) {
48
qDebug() << "Item Added" << item.id();
49
m_changeSet.insertAddedItem(item.id());
51
m_changeSet.emitSignals(m_parent);
54
void SaveRequestData::appendResults(QList<QOrganizerItem> result)
59
QOrganizerCollectionId SaveRequestData::collectionId() const
61
return m_collectionId;
64
bool SaveRequestData::isNew() const
66
QList<QOrganizerItem> items = request<QOrganizerItemSaveRequest>()->items();
67
if (items.count() > 0) {
68
return items[0].id().isNull();