1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*
* Copyright 2013 Canonical Ltd.
*
* This file is part of ubuntu-pim-service.
*
* contact-service-app is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* contact-service-app is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qorganizer-eds-fetchrequestdata.h"
#include <QtOrganizer/QOrganizerItemFetchRequest>
using namespace QtOrganizer;
FetchRequestData::FetchRequestData(QOrganizerEDSEngine *engine, QOrganizerAbstractRequest *req)
: RequestData(engine, req),
m_collections(engine->m_collectionsMap.values())
{
}
FetchRequestData::~FetchRequestData()
{
m_parent->m_pendingFetchRequest.removeOne(this);
}
QOrganizerEDSCollectionEngineId* FetchRequestData::nextCollection()
{
m_current = 0;
if (m_collections.size()) {
m_current = m_collections.takeFirst();
return m_current;
} else {
return 0;
}
}
QOrganizerEDSCollectionEngineId* FetchRequestData::collection() const
{
return m_current;
}
void FetchRequestData::finish(QOrganizerManager::Error error)
{
QOrganizerManagerEngine::updateItemFetchRequest(request<QOrganizerItemFetchRequest>(),
m_results,
error,
QOrganizerAbstractRequest::FinishedState);
// TODO: emit changeset???
}
void FetchRequestData::appendResults(QList<QOrganizerItem> results)
{
m_results += results;
}
QString FetchRequestData::dateFilter()
{
QString query = QString("(occur-in-time-range? "
"(make-time \"%1\") (make-time \"%2\"))")
.arg(isodate_from_time_t(request<QOrganizerItemFetchRequest>()->startDate().toTime_t()))
.arg(isodate_from_time_t(request<QOrganizerItemFetchRequest>()->endDate().toTime_t()));
return query;
}
|