1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtOrganizer module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
17
** GNU Lesser General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU Lesser
19
** General Public License version 2.1 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
40
****************************************************************************/
42
#include "qorganizerskeleton_p.h"
44
QT_BEGIN_NAMESPACE_ORGANIZER
46
QOrganizerManagerEngine* QOrganizerItemSkeletonFactory::engine(const QMap<QString, QString>& parameters, QOrganizerManager::Error* error)
51
/* TODO - if you understand any specific parameters. save them in the engine so that engine::managerParameters can return them */
53
QOrganizerItemSkeletonEngine* ret = new QOrganizerItemSkeletonEngine(); // manager takes ownership and will clean up.
57
QOrganizerItemEngineId* QOrganizerItemSkeletonFactory::createItemEngineId(const QMap<QString, QString>& parameters, const QString& idString) const
62
Instantiate your engine-specific item id in this function.
64
If idString is not empty, then you should deserialize the idString
65
(the opposite of your QOrganizerItemEngineId derived-class'
66
toString() function), otherwise you should instantiate an empty
67
engine-specific collection id.
69
This function allows clients to deserialize serialized ids from
73
QOrganizerItemSkeletonEngineId* retn = new QOrganizerItemSkeletonEngineId;
74
if (!idString.isEmpty())
75
retn->m_itemId = idString.toUInt();
79
QOrganizerCollectionEngineId* QOrganizerItemSkeletonFactory::createCollectionEngineId(const QMap<QString, QString>& parameters, const QString& idString) const
84
Instantiate your engine-specific collection id in this function.
86
If idString is not empty, then you should deserialize the idString
87
(the opposite of your QOrganizerCollectionEngineId derived-class'
88
toString() function), otherwise you should instantiate an empty
89
engine-specific collection id.
91
This function allows clients to deserialize serialized ids from
95
QOrganizerCollectionSkeletonEngineId* retn = new QOrganizerCollectionSkeletonEngineId;
96
if (!idString.isEmpty())
97
retn->m_collectionId = idString.toUInt();
101
QString QOrganizerItemSkeletonFactory::managerName() const
103
/* TODO - put your engine name here */
104
return QStringLiteral("skeleton");
107
QOrganizerItemSkeletonEngineId::QOrganizerItemSkeletonEngineId()
108
: QOrganizerItemEngineId(), m_itemId(0)
113
Initialize any data members of your engine-specific item id in the constructor.
115
This default constructor should not be used when returning a null id,
116
but is provided in order to allow use of the ids in a list, and as an
117
enabler for the implementation of QOrganizerItemId.
119
When returning a null id, the backend should simply return a default
120
constructed QOrganizerItemId.
122
In this example, we use just a single quint32 to identify the item,
123
however your engine may require more information in order to uniquely
124
identify an item within it (e.g., a collection identifier plus an item
125
identifier, and perhaps a datastore identifier which identifies the
126
datastore in which the collection can be found).
130
QOrganizerItemSkeletonEngineId::QOrganizerItemSkeletonEngineId(quint32 itemId)
131
: QOrganizerItemEngineId(), m_itemId(itemId)
136
Whatever data members your particular class has, should be passed as arguments
137
to a ctor of this type. This is the constructor which will be used by your
140
In particular, you will most likely be returning to clients an id by calling:
141
QOrganizerItemId id(new QOrganizerItemSkeletonEngineId(3));
142
or something similar. Note that the QOrganizerItemId constructor which
143
takes a QOrganizerItemEngineId pointer as a parameter takes ownership
144
of that pointer (and so controls its lifetime).
148
QOrganizerItemSkeletonEngineId::QOrganizerItemSkeletonEngineId(const QOrganizerItemSkeletonEngineId& other)
149
: QOrganizerItemEngineId(), m_itemId(other.m_itemId)
151
/* TODO - implement a copy constructor for your engine-specific id class */
154
QOrganizerItemSkeletonEngineId::~QOrganizerItemSkeletonEngineId()
156
/* TODO - Clean up any memory in use by your engine-specific id. */
159
bool QOrganizerItemSkeletonEngineId::isEqualTo(const QOrganizerItemEngineId* other) const
164
The isEqualTo(other) function is called by the QOrganizerItemId::operator==(other) function.
165
You must implement this in terms of the data members which your class contains.
167
An example implementation is provided below, for the case where only a single quint32
168
is required to uniquely identify an item in a manager.
171
quint32 otherItemId = static_cast<const QOrganizerItemSkeletonEngineId*>(other)->m_itemId;
172
if (m_itemId != otherItemId)
177
bool QOrganizerItemSkeletonEngineId::isLessThan(const QOrganizerItemEngineId* other) const
182
The isLessThan(other) function is called by the QOrganizerItemId::operator<(other) function.
183
You must implement this in terms of the data members which your class contains.
185
An example implementation is provided below, for the case where only a single quint32
186
is required to uniquely identify an item in a manager.
189
quint32 otherItemId = static_cast<const QOrganizerItemSkeletonEngineId*>(other)->m_itemId;
190
return (m_itemId < otherItemId);
193
QString QOrganizerItemSkeletonEngineId::managerUri() const
195
// TODO: make this return the actual managerUri (including params) of the
196
// engine it is associated with
197
static const QString uri(QStringLiteral("qtorganizer:skeleton:"));
201
QOrganizerItemEngineId* QOrganizerItemSkeletonEngineId::clone() const
206
When a QOrganizerItemId is copied or assigned, it performs a clone of
207
the engine-specific id. This function is called in that case.
209
Implement this function so that the data members of your engine-specific id
212
An example implementation for the case where an item can be uniquely identified
213
with just a single quint32 is given below.
216
QOrganizerItemSkeletonEngineId *myClone = new QOrganizerItemSkeletonEngineId;
217
myClone->m_itemId = m_itemId;
221
#ifndef QT_NO_DEBUG_STREAM
222
QDebug& QOrganizerItemSkeletonEngineId::debugStreamOut(QDebug& dbg) const
227
In order to allow clients to debug applications, you must implement this
228
function. We recommend streaming the name of your class followed by the
229
values of the data members in your engine-specific id class in
232
An example implementation for the case where an item can be uniquely identified
233
with just a single quint32 is given below.
235
Note that you must include the #ifndef QT_NO_DEBUG_STREAM preprocessor
236
directive block in order to ensure compilation in environments where that
237
directive is defined.
240
dbg.nospace() << "QOrganizerItemSkeletonEngineId(" << m_itemId << ")";
241
return dbg.maybeSpace();
245
QString QOrganizerItemSkeletonEngineId::toString() const
250
In order to allow clients to serialize QOrganizerItemId's, you must implement
253
An example implementation for the case where an item can be uniquely identified
254
with just a single quint32 is given below.
257
return QString::number(m_itemId);
260
uint QOrganizerItemSkeletonEngineId::hash() const
265
Provide a hash function for your engine-specific id.
266
Note that the hash doesn't strictly need to be unique, since isEqualTo()
267
ensures that individual id's in a single hash-bucket can be uniquely
268
determined; however a better hash function will result in better performance
269
because the ids will be distributed more randomly in a hash table.
271
In the example implementation below, we could simply return the id, since the
272
id is a quint32. In more complex id classes, however, you may need to
273
qHash() individual data members and combine the results somehow.
276
return QT_PREPEND_NAMESPACE(qHash)(m_itemId);
280
QOrganizerCollectionSkeletonEngineId::QOrganizerCollectionSkeletonEngineId()
281
: QOrganizerCollectionEngineId(), m_collectionId(0)
286
Initialize any data members of your engine-specific collection id in the constructor.
288
This default constructor should not be used when returning a null id,
289
but is provided in order to allow use of the ids in a list, and as an
290
enabler for the implementation of QOrganizerCollectionId.
292
When returning a null id, the backend should simply return a default
293
constructed QOrganizerCollectionId.
295
In this example, we use just a single quint32 to identify the collection,
296
however your engine may require more information in order to uniquely
297
identify a collection within it (e.g., a collection identifier plus a datastore
298
identifier which identifies the datastore in which the collection can be found).
302
QOrganizerCollectionSkeletonEngineId::QOrganizerCollectionSkeletonEngineId(quint32 collectionId)
303
: QOrganizerCollectionEngineId(), m_collectionId(collectionId)
308
Whatever data members your particular class has, should be passed as arguments
309
to a ctor of this type. This is the constructor which will be used by your
312
In particular, you will most likely be returning to clients an id by calling:
313
QOrganizerCollectionId id(new QOrganizerCollectionSkeletonEngineId(3));
314
or something similar. Note that the QOrganizerCollectionId constructor which
315
takes a QOrganizerCollectionEngineId pointer as a parameter takes ownership
316
of that pointer (and so controls its lifetime).
320
QOrganizerCollectionSkeletonEngineId::QOrganizerCollectionSkeletonEngineId(const QOrganizerCollectionSkeletonEngineId& other)
321
: QOrganizerCollectionEngineId(), m_collectionId(other.m_collectionId)
323
/* TODO - implement a copy constructor for your engine-specific id class */
326
QOrganizerCollectionSkeletonEngineId::~QOrganizerCollectionSkeletonEngineId()
328
/* TODO - Clean up any memory in use by your engine-specific id. */
331
bool QOrganizerCollectionSkeletonEngineId::isEqualTo(const QOrganizerCollectionEngineId* other) const
336
The isEqualTo(other) function is called by the QOrganizerCollectionId::operator==(other) function.
337
You must implement this in terms of the data members which your class contains.
339
An example implementation is provided below, for the case where only a single quint32
340
is required to uniquely identify a collection in a manager.
343
quint32 otherCollectionId = static_cast<const QOrganizerCollectionSkeletonEngineId*>(other)->m_collectionId;
344
if (m_collectionId != otherCollectionId)
349
bool QOrganizerCollectionSkeletonEngineId::isLessThan(const QOrganizerCollectionEngineId* other) const
354
The isLessThan(other) function is called by the QOrganizerCollectionId::operator<(other) function.
355
You must implement this in terms of the data members which your class contains.
357
An example implementation is provided below, for the case where only a single quint32
358
is required to uniquely identify a collection in a manager.
361
quint32 otherCollectionId = static_cast<const QOrganizerCollectionSkeletonEngineId*>(other)->m_collectionId;
362
if (m_collectionId < otherCollectionId)
367
QString QOrganizerCollectionSkeletonEngineId::managerUri() const
369
// TODO: make this return the actual managerUri (including params) of the
370
// engine it is associated with
371
static const QString uri(QStringLiteral("qtorganizer:skeleton:"));
375
QOrganizerCollectionEngineId* QOrganizerCollectionSkeletonEngineId::clone() const
380
When a QOrganizerCollectionId is copied or assigned, it performs a clone of
381
the engine-specific id. This function is called in that case.
383
Implement this function so that the data members of your engine-specific id
386
An example implementation for the case where a collection can be uniquely identified
387
with just a single quint32 is given below.
390
QOrganizerCollectionSkeletonEngineId *myClone = new QOrganizerCollectionSkeletonEngineId;
391
myClone->m_collectionId = m_collectionId;
395
#ifndef QT_NO_DEBUG_STREAM
396
QDebug& QOrganizerCollectionSkeletonEngineId::debugStreamOut(QDebug& dbg) const
401
In order to allow clients to debug applications, you must implement this
402
function. We recommend streaming the name of your class followed by the
403
values of the data members in your engine-specific id class in
406
An example implementation for the case where a collection can be uniquely identified
407
with just a single quint32 is given below.
409
Note that you must include the #ifndef QT_NO_DEBUG_STREAM preprocessor
410
directive block in order to ensure compilation in environments where that
411
directive is defined.
414
dbg.nospace() << "QOrganizerCollectionSkeletonEngineId(" << m_collectionId << ")";
415
return dbg.maybeSpace();
419
QString QOrganizerCollectionSkeletonEngineId::toString() const
424
In order to allow clients to serialize QOrganizerCollectionId's, you must implement
427
An example implementation for the case where a collection can be uniquely identified
428
with just a single quint32 is given below.
431
return QString::number(m_collectionId);
434
uint QOrganizerCollectionSkeletonEngineId::hash() const
439
Provide a hash function for your engine-specific id.
440
Note that the hash doesn't strictly need to be unique, since isEqualTo()
441
ensures that individual id's in a single hash-bucket can be uniquely
442
determined; however a better hash function will result in better performance
443
because the ids will be distributed more randomly in a hash table.
445
In the example implementation below, we could simply return the id, since the
446
id is a quint32. In more complex id classes, however, you may need to
447
qHash() individual data members and combine the results somehow.
450
return QT_PREPEND_NAMESPACE(qHash)(m_collectionId);
455
QOrganizerItemSkeletonEngine::~QOrganizerItemSkeletonEngine()
457
/* TODO clean up your stuff. Perhaps a QScopedPointer or QSharedDataPointer would be in order */
460
QString QOrganizerItemSkeletonEngine::managerName() const
462
/* TODO - put your engine name here */
463
return QStringLiteral("skeleton");
466
QMap<QString, QString> QOrganizerItemSkeletonEngine::managerParameters() const
468
/* TODO - in case you have any actual parameters that are relevant that you saved in the factory method, return them here */
469
return QMap<QString, QString>();
472
QList<QOrganizerItem> QOrganizerItemSkeletonEngine::itemOccurrences(const QOrganizerItem &parentItem,
473
const QDateTime &startDateTime,
474
const QDateTime &endDateTime, int maxCount,
475
const QOrganizerItemFetchHint &fetchHint,
476
QOrganizerManager::Error *error)
481
This function should create a list of occurrences that occur in the time period from the supplied item,
482
generated from the parent item.
484
The periodStart should always be valid, and either the periodEnd or the maxCount will be valid (if periodEnd is
485
valid, use that. Otherwise use the count). It's permissible to limit the number of items returned...
487
Basically, if the parent item is an Event, a list of EventOccurrences should be returned. Similarly for
490
If there are no instances, return an empty list.
492
The returned items should have a QOrganizerItemParent detail that points to the parentItem and the
493
original instance that the event would have occurred on (e.g. with an exception).
495
They should not have recurrence information details in them.
497
We might change the signature to split up the periodStart + periodEnd / periodStart + maxCount cases.
500
return QOrganizerManagerEngine::itemOccurrences(parentItem, startDateTime, endDateTime, maxCount, fetchHint, error);
503
QList<QOrganizerItem> QOrganizerItemSkeletonEngine::itemsForExport(const QDateTime &startDateTime,
504
const QDateTime &endDateTime,
505
const QOrganizerItemFilter &filter,
506
const QList<QOrganizerItemSortOrder> &sortOrders,
507
const QOrganizerItemFetchHint &fetchHint,
508
QOrganizerManager::Error *error)
510
return QOrganizerManagerEngine::itemsForExport(startDateTime, endDateTime, filter, sortOrders, fetchHint, error);
513
QList<QOrganizerItemId> QOrganizerItemSkeletonEngine::itemIds(const QOrganizerItemFilter &filter,
514
const QDateTime &startDateTime,
515
const QDateTime &endDateTime,
516
const QList<QOrganizerItemSortOrder> &sortOrders,
517
QOrganizerManager::Error *error)
522
Given the supplied filter and sort order, fetch the list of items [not instances] that correspond, and return their ids.
524
If you don't support the filter or sort orders, you can fetch a partially (or un-) filtered list and ask the helper
525
functions to filter and sort it for you.
527
If you do have to fetch, consider setting a fetch hint that restricts the information to that needed for filtering/sorting.
530
*error = QOrganizerManager::NotSupportedError; // TODO <- remove this
532
QList<QOrganizerItem> partiallyFilteredItems; // = ..., your code here.. [TODO]
533
QList<QOrganizerItem> ret;
535
foreach(const QOrganizerItem& item, partiallyFilteredItems) {
536
if (QOrganizerManagerEngine::isItemBetweenDates(item, startDateTime, endDateTime) && QOrganizerManagerEngine::testFilter(filter, item)) {
537
QOrganizerManagerEngine::addSorted(&ret, item, sortOrders);
541
return QOrganizerManager::extractIds(ret);
544
QList<QOrganizerItem> QOrganizerItemSkeletonEngine::items(const QOrganizerItemFilter &filter, const QDateTime &startDateTime,
545
const QDateTime &endDateTime, int maxCount,
546
const QList<QOrganizerItemSortOrder> &sortOrders,
547
const QOrganizerItemFetchHint &fetchHint, QOrganizerManager::Error *error)
552
Given the supplied filter and sort order, fetch the list of items [not instances] that correspond, and return them.
554
If you don't support the filter or sort orders, you can fetch a partially (or un-) filtered list and ask the helper
555
functions to filter and sort it for you.
557
The fetch hint suggests how much of the item to fetch. You can ignore the fetch hint and fetch everything (but you must
558
fetch at least what is mentioned in the fetch hint).
561
Q_UNUSED(startDateTime)
562
Q_UNUSED(endDateTime)
566
*error = QOrganizerManager::NotSupportedError; // TODO <- remove this
568
QList<QOrganizerItem> partiallyFilteredItems; // = ..., your code here.. [TODO]
569
QList<QOrganizerItem> ret;
571
foreach(const QOrganizerItem& item, partiallyFilteredItems) {
572
if (QOrganizerManagerEngine::isItemBetweenDates(item, startDateTime, endDateTime) && QOrganizerManagerEngine::testFilter(filter, item)) {
573
QOrganizerManagerEngine::addSorted(&ret, item, sortOrders);
577
/* An alternative formulation, depending on how your engine is implemented is just:
579
foreach(const QOrganizerItemId& id, itemIds(filter, sortOrders, error)) {
580
ret.append(item(id, fetchHint, error);
587
QList<QOrganizerItem> QOrganizerItemSkeletonEngine::items(const QList<QOrganizerItemId> &itemIds, const QOrganizerItemFetchHint &fetchHint,
588
QMap<int, QOrganizerManager::Error> *errorMap, QOrganizerManager::Error* error)
593
Fetch a single item by id.
595
The fetch hint suggests how much of the item to fetch. You can ignore the fetch hint and fetch everything (but you must
596
fetch at least what is mentioned in the fetch hint).
599
return QOrganizerManagerEngine::items(itemIds, fetchHint, errorMap, error);
602
bool QOrganizerItemSkeletonEngine::saveItems(QList<QOrganizerItem> *items, const QList<QOrganizerItemDetail::DetailType> &detailMask,
603
QMap<int, QOrganizerManager::Error>* errorMap, QOrganizerManager::Error* error)
608
Save a list of items into the collection specified in each (or their current collection
609
if no collection is specified and they already exist, or the default collection
610
if no collection is specified and they do not exist).
612
For each item, convert it to your type, assign an item id, and update the
613
QOrganizerItem's ID (in the list above - e.g. *items[idx] = updated item).
614
Then, examine the collection id specified in each item and save the item in that collection.
616
If you encounter an error (e.g. converting to type, or saving), insert an entry into
617
the map above at the corresponding index (e.g. errorMap->insert(idx, QOIM::InvalidDetailError).
618
You should set the "error" variable as well (first, last, most serious error etc).
620
The item passed in should be validated according to the schema.
622
return QOrganizerManagerEngine::saveItems(items, detailMask, errorMap, error);
625
bool QOrganizerItemSkeletonEngine::removeItems(const QList<QOrganizerItemId> &itemIds, QMap<int, QOrganizerManager::Error> *errorMap,
626
QOrganizerManager::Error *error)
631
Remove a list of items, given by their id.
633
If you encounter an error, insert an error into the appropriate place in the error map,
634
and update the error variable as well.
636
DoesNotExistError should be used if the id refers to a non existent item.
638
return QOrganizerManagerEngine::removeItems(itemIds, errorMap, error);
641
QOrganizerCollection QOrganizerItemSkeletonEngine::defaultCollection(QOrganizerManager::Error* error)
646
This allows clients to determine which collection an item will be saved,
647
if the item is saved via saveItems() without specifying a collection id
648
of a collection in which to save the item, via item->setCollectionId().
650
There is always at least one collection in a manager, and all items are
651
saved in exactly one collection.
653
return QOrganizerManagerEngine::defaultCollection(error);
656
QOrganizerCollection QOrganizerItemSkeletonEngine::collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error)
661
This allows clients to retrieve a collection by (manager) id.
662
Prior to saving items, clients will set which collection the item will/should
663
be saved by calling item->setCollectionId().
665
return QOrganizerManagerEngine::collection(collectionId, error);
668
QList<QOrganizerCollection> QOrganizerItemSkeletonEngine::collections(QOrganizerManager::Error* error)
673
This allows clients to retrieve a list of all of the collections currently
674
in this manager. Some backends will have a prepopulated list of valid
675
collections, others will not. A collection can have properties
676
like colour, description, perhaps a priority, etc etc.
678
return QOrganizerManagerEngine::collections(error);
681
bool QOrganizerItemSkeletonEngine::saveCollection(QOrganizerCollection* collection, QOrganizerManager::Error* error)
686
This allows clients to create or update collections if supported by the
689
return QOrganizerManagerEngine::saveCollection(collection, error);
692
bool QOrganizerItemSkeletonEngine::removeCollection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error)
697
This allows clients to remove collections if supported by the backend.
699
When a collection is removed, all items in the collection are removed.
700
That is, they are _not_ transferred to another collection.
702
If the user attempts to remove the collection which is the default collection,
703
the backend may decide whether to fail (with a permissions error) or to
704
succeed and arbitrarily choose another collection to be the default collection.
706
return QOrganizerManagerEngine::removeCollection(collectionId, error);
709
bool QOrganizerItemSkeletonEngine::startRequest(QOrganizerAbstractRequest* req)
714
This is the entry point to the async API. The request object describes the
715
type of request (switch on req->type()). Req will not be null when called
718
Generally, you can queue the request and process them at some later time
719
(probably in another thread).
721
Once you start a request, call the updateRequestState and/or the
722
specific updateXXXXXRequest functions to mark it in the active state.
724
If your engine is particularly fast, or the operation involves only in
725
memory data, you can process and complete the request here. That is
726
probably not the case, though.
728
Note that when the client is threaded, and the request might live on a
729
different thread, you might need to be careful with locking. In particular,
730
the request might be deleted while you are still working on it. In this case,
731
your requestDestroyed function will be called while the request is still valid,
732
and you should block in that function until your worker thread (etc) has been
733
notified not to touch that request any more.
735
We plan to provide some boiler plate code that will allow you to:
737
1) implement the sync functions, and have the async versions call the sync
740
2) or implement the async versions of the function, and have the sync versions
741
call the async versions.
743
It's not ready yet, though.
745
Return true if the request can be started, false otherwise. You can set an error
746
in the request if you like.
748
return QOrganizerManagerEngine::startRequest(req);
751
bool QOrganizerItemSkeletonEngine::cancelRequest(QOrganizerAbstractRequest* req)
756
Cancel an in progress async request. If not possible, return false from here.
758
return QOrganizerManagerEngine::cancelRequest(req);
761
bool QOrganizerItemSkeletonEngine::waitForRequestFinished(QOrganizerAbstractRequest* req, int msecs)
766
Wait for a request to complete (up to a max of msecs milliseconds).
768
Return true if the request is finished (including if it was already). False otherwise.
770
You should really implement this function, if nothing else than as a delay, since clients
771
may call this in a loop.
773
It's best to avoid processing events, if you can, or at least only process non-UI events.
775
return QOrganizerManagerEngine::waitForRequestFinished(req, msecs);
778
void QOrganizerItemSkeletonEngine::requestDestroyed(QOrganizerAbstractRequest* req)
783
This is called when a request is being deleted. It lets you know:
785
1) the client doesn't care about the request any more. You can still complete it if
787
2) you can't reliably access any properties of the request pointer any more. The pointer will
788
be invalid once this function returns.
790
This means that if you have a worker thread, you need to let that thread know that the
791
request object is not valid and block until that thread acknowledges it. One way to do this
792
is to have a QSet<QOIAR*> (or QMap<QOIAR, MyCustomRequestState>) that tracks active requests, and
793
insert into that set in startRequest, and remove in requestDestroyed (or when it finishes or is
794
cancelled). Protect that set/map with a mutex, and make sure you take the mutex in the worker
795
thread before calling any of the QOIAR::updateXXXXXXRequest functions. And be careful of lock
799
return QOrganizerManagerEngine::requestDestroyed(req);
802
QList<QOrganizerItemFilter::FilterType> QOrganizerItemSkeletonEngine::supportedFilters() const
804
// TODO if you engine can natively support the filter, return true. Otherwise you should emulate support in the item{Ids} functions.
805
return QList<QOrganizerItemFilter::FilterType>();
808
QList<QOrganizerItemDetail::DetailType> QOrganizerItemSkeletonEngine::supportedItemDetails(QOrganizerItemType::ItemType itemType) const
810
// TODO - return which [predefined] details this engine supports for this item type
813
return QList<QOrganizerItemDetail::DetailType>();
816
QList<QOrganizerItemType::ItemType> QOrganizerItemSkeletonEngine::supportedItemTypes() const
818
// TODO - return which [predefined] types this engine supports
819
QList<QOrganizerItemType::ItemType> ret;
821
ret << QOrganizerItemType::TypeEvent;
822
ret << QOrganizerItemType::TypeEventOccurrence;
823
ret << QOrganizerItemType::TypeJournal;
824
ret << QOrganizerItemType::TypeNote;
825
ret << QOrganizerItemType::TypeTodo;
826
ret << QOrganizerItemType::TypeTodoOccurrence;
831
#include "moc_qorganizerskeleton_p.cpp"
833
QT_END_NAMESPACE_ORGANIZER