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-fetchrequestdata.h"
21
#include <QtOrganizer/QOrganizerItemFetchRequest>
23
using namespace QtOrganizer;
25
FetchRequestData::FetchRequestData(QOrganizerEDSEngine *engine, QOrganizerAbstractRequest *req)
26
: RequestData(engine, req),
27
m_collections(engine->m_collectionsMap.values())
31
FetchRequestData::~FetchRequestData()
33
m_parent->m_pendingFetchRequest.removeOne(this);
36
QOrganizerEDSCollectionEngineId* FetchRequestData::nextCollection()
39
if (m_collections.size()) {
40
m_current = m_collections.takeFirst();
47
QOrganizerEDSCollectionEngineId* FetchRequestData::collection() const
52
void FetchRequestData::finish(QOrganizerManager::Error error)
54
QOrganizerManagerEngine::updateItemFetchRequest(request<QOrganizerItemFetchRequest>(),
57
QOrganizerAbstractRequest::FinishedState);
58
// TODO: emit changeset???
61
void FetchRequestData::appendResults(QList<QOrganizerItem> results)
66
QString FetchRequestData::dateFilter()
68
QString query = QString("(occur-in-time-range? "
69
"(make-time \"%1\") (make-time \"%2\"))")
70
.arg(isodate_from_time_t(request<QOrganizerItemFetchRequest>()->startDate().toTime_t()))
71
.arg(isodate_from_time_t(request<QOrganizerItemFetchRequest>()->endDate().toTime_t()));