summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZsolt Simon <zsolt.simon@nokia.com>2011-01-06 12:40:35 +1000
committerZsolt Simon <zsolt.simon@nokia.com>2011-01-06 13:13:02 +1000
commitd3fe8436b3d2aa95dbcd8b87810ef5937754ba4f (patch)
tree6b72875f73d8852acb86ca6ed3fc752a8aad9530
parent360f7b302c08362c606ae2621a1abdf43e2602a5 (diff)
maemo5: fix QTMOBILITY-891: mkCal async engine implementation is used
- removed the maemo5 async implementation because it was causing 100% cpu overload - corrected async unit test for itemRemove() because it was failing with the new async engine Task-number: QTMOBILITY-891 Reviewed-by: Michael Goddard Change-Id: I9464335c8a36ca6ab2f3fa98928c2a4c8327db0d
-rw-r--r--plugins/organizer/maemo5/maemo5.pro4
-rw-r--r--plugins/organizer/maemo5/qorganizerasynchprocess.cpp410
-rw-r--r--plugins/organizer/maemo5/qorganizerasynchprocess.h135
-rw-r--r--plugins/organizer/maemo5/qorganizermaemo5.cpp12
-rw-r--r--plugins/organizer/maemo5/qorganizermaemo5_p.h4
-rw-r--r--plugins/organizer/maemo5/qorganizermaemo5ids_p.h4
-rw-r--r--plugins/organizer/mkcal/qorganizerasynchmanager.cpp2
-rw-r--r--tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp13
8 files changed, 18 insertions, 566 deletions
diff --git a/plugins/organizer/maemo5/maemo5.pro b/plugins/organizer/maemo5/maemo5.pro
index b084112dee..6bdf9d4ca6 100644
--- a/plugins/organizer/maemo5/maemo5.pro
+++ b/plugins/organizer/maemo5/maemo5.pro
@@ -22,14 +22,14 @@ HEADERS += qorganizermaemo5_p.h \
qorganizermaemo5ids_p.h \
qorganizerrecurrencetransform.h \
qorganizeritemtransform.h \
- qorganizerasynchprocess.h \
+ ../mkcal/qorganizerasynchmanager.h \
qorganizercaldbaccess.h \
qorganizerdbcache.h \
qorganizerdbcachewrappers.h
SOURCES += qorganizermaemo5.cpp \
qorganizerrecurrencetransform.cpp \
qorganizeritemtransform.cpp \
- qorganizerasynchprocess.cpp \
+ ../mkcal/qorganizerasynchmanager.cpp \
qorganizercaldbaccess.cpp \
qorganizerdbcache.cpp \
qorganizerdbcachewrappers.cpp
diff --git a/plugins/organizer/maemo5/qorganizerasynchprocess.cpp b/plugins/organizer/maemo5/qorganizerasynchprocess.cpp
deleted file mode 100644
index 9d1cc8be04..0000000000
--- a/plugins/organizer/maemo5/qorganizerasynchprocess.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qorganizerasynchprocess.h"
-#include "qtorganizer.h"
-#include "qorganizermaemo5_p.h"
-#include "qorganizermaemo5ids_p.h"
-#include <QtCore/qtimer.h>
-#include <QtCore/qcoreapplication.h>
-
-QTM_USE_NAMESPACE
-
-OrganizerRequestTimeoutTimer::OrganizerRequestTimeoutTimer(QOrganizerAbstractRequest *req, int msecs)
- : m_req(req)
-{
- m_timeoutTimer = new QTimer();
- connect(m_timeoutTimer, SIGNAL(timeout()), this, SLOT(internalTimeout()));
- m_timeoutTimer->setSingleShot(true);
- m_timeoutTimer->start(msecs);
-}
-
-OrganizerRequestTimeoutTimer::~OrganizerRequestTimeoutTimer()
-{
- delete m_timeoutTimer;
-}
-
-QOrganizerAbstractRequest* OrganizerRequestTimeoutTimer::request() const
-{
- return m_req;
-}
-
-void OrganizerRequestTimeoutTimer::internalTimeout()
-{
- emit timeout(this);
-}
-
-OrganizerAsynchProcess::OrganizerAsynchProcess(QOrganizerItemMaemo5Engine* engine)
- : m_engine(engine), m_quitNow(false)
-{
- start();
- QObject::moveToThread(this);
-}
-
-void OrganizerAsynchProcess::run()
-{
- while(!m_quitNow) {
- yieldCurrentThread();
- processRequest();
- }
-
- // Inform that the thread quits now
- m_quitNow = false;
-}
-
-OrganizerAsynchProcess::~OrganizerAsynchProcess()
-{
- // Tell thread to quit
- m_quitNow = true;
-
- // Wait for run() to exit
- while(m_quitNow)
- yieldCurrentThread();
-}
-
-void OrganizerAsynchProcess::requestDestroyed(QOrganizerAbstractRequest *req)
-{
- bool requestRemoved = false;
-
- m_mainMutex.lock();
- if (m_requestQueue.contains(req)) {
- m_requestQueue.removeOne(req);
- requestRemoved = true;
- }
- m_mainMutex.unlock();
-
- if (!requestRemoved && req->state() != QOrganizerAbstractRequest::FinishedState)
- waitForRequestFinished(req);
-}
-
-bool OrganizerAsynchProcess::addRequest(QOrganizerAbstractRequest *req)
-{
- m_mainMutex.lock();
- m_requestQueue.enqueue(req);
- m_mainMutex.unlock();
- QOrganizerManagerEngine::updateRequestState(req, QOrganizerAbstractRequest::ActiveState);
- return true;
-}
-
-bool OrganizerAsynchProcess::cancelRequest(QOrganizerAbstractRequest *req)
-{
- m_mainMutex.lock();
-
- if (m_requestQueue.contains(req)) {
- QOrganizerManagerEngine::updateRequestState(req, QOrganizerAbstractRequest::CanceledState);
- m_requestQueue.removeOne(req);
- m_mainMutex.unlock();
- return true;
- }
- else {
- // cannot cancel request when processing has already begun
- m_mainMutex.unlock();
- return false;
- }
-}
-
-bool OrganizerAsynchProcess::waitForRequestFinished(QOrganizerAbstractRequest *req, int msecs)
-{
- if (req->state() == QOrganizerAbstractRequest::FinishedState) {
- return true;
- }
- else if (req->state() == QOrganizerAbstractRequest::CanceledState
- || req->state() == req->state() == QOrganizerAbstractRequest::InactiveState) {
- return false;
- }
-
- // Multiple timers are created to make this method thread safe.
- // There's a timer for each calling thread.
- OrganizerRequestTimeoutTimer* newTimer = new OrganizerRequestTimeoutTimer(req, msecs);
- connect(newTimer, SIGNAL(timeout(OrganizerRequestTimeoutTimer*)), this, SLOT(timeout(OrganizerRequestTimeoutTimer*)));
- m_timers << newTimer;
- return waitForRequestFinished(req);
-}
-
-bool OrganizerAsynchProcess::waitForRequestFinished(QOrganizerAbstractRequest *req)
-{
- m_activeRequests.insert(req);
-
- do {
- yieldCurrentThread();
- // Process events to allow the timeout timers to work
- QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
- } while(m_activeRequests.contains(req) && req->state() == QOrganizerAbstractRequest::ActiveState);
-
- m_timeoutMutex.lock();
- if (!m_activeRequests.contains(req)) {
- // timeout occurred
- m_timeoutMutex.unlock();
- return false;
- }
- else {
- // timeout not occurred
- m_activeRequests.remove(req);
-
- // cancel and remove timer
- QList<OrganizerRequestTimeoutTimer *>::iterator timer;
- for (timer = m_timers.begin(); timer != m_timers.end(); ++timer)
- if ((*timer)->request() == req)
- break;
- if (timer != m_timers.end()) {
- m_timers.removeOne(*timer);
- delete *timer;
- }
- m_timeoutMutex.unlock();
- return true;
- }
-}
-
-void OrganizerAsynchProcess::timeout(OrganizerRequestTimeoutTimer *timer)
-{
- m_timeoutMutex.lock();
- if (m_activeRequests.contains(timer->request())) {
- m_activeRequests.remove(timer->request());
- m_timers.removeOne(timer);
- delete timer;
- }
- m_timeoutMutex.unlock();
-}
-
-void OrganizerAsynchProcess::processRequest()
-{
- m_mainMutex.lock();
-
- if (m_requestQueue.isEmpty()) {
- m_mainMutex.unlock();
- return;
- }
-
- QOrganizerAbstractRequest *req = m_requestQueue.dequeue();
- if (req->state() != QOrganizerAbstractRequest::ActiveState) {
- m_mainMutex.unlock();
- return;
- }
-
- switch(req->type()) {
- case QOrganizerAbstractRequest::ItemFetchRequest:
- handleItemFetchRequest(static_cast<QOrganizerItemFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemFetchForExportRequest:
- handleItemFetchForExportRequest(static_cast<QOrganizerItemFetchForExportRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemOccurrenceFetchRequest:
- handleItemOccurrenceFetchRequest(static_cast<QOrganizerItemOccurrenceFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemIdFetchRequest:
- handleIdFetchRequest(static_cast<QOrganizerItemIdFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemRemoveRequest:
- handleItemRemoveRequest(static_cast<QOrganizerItemRemoveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemSaveRequest:
- handleSaveRequest(static_cast<QOrganizerItemSaveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::DetailDefinitionFetchRequest:
- handleDefinitionFetchRequest(static_cast<QOrganizerItemDetailDefinitionFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::DetailDefinitionRemoveRequest:
- handleDefinitionRemoveRequest(static_cast<QOrganizerItemDetailDefinitionRemoveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::DetailDefinitionSaveRequest:
- handleDefinitionSaveRequest(static_cast<QOrganizerItemDetailDefinitionSaveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::CollectionFetchRequest:
- handleCollectionFetchRequest(static_cast<QOrganizerCollectionFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::CollectionRemoveRequest:
- handleCollectionRemoveRequest(static_cast<QOrganizerCollectionRemoveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::CollectionSaveRequest:
- handleCollectionSaveRequest(static_cast<QOrganizerCollectionSaveRequest *>(req));
- break;
-
- default:
- // invalid request
- break;
- }
-
- m_mainMutex.unlock();
-}
-
-void OrganizerAsynchProcess::handleItemFetchRequest(QOrganizerItemFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItem> items = m_engine->items(req->startDate(), req->endDate(), req->filter(), req->sorting(), req->fetchHint(), &err);
- QOrganizerManagerEngine::updateItemFetchRequest(req, items, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleItemFetchForExportRequest(QOrganizerItemFetchForExportRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItem> items = m_engine->itemsForExport(req->startDate(), req->endDate(), req->filter(), req->sorting(), req->fetchHint(), &err);
- QOrganizerManagerEngine::updateItemFetchForExportRequest(req, items, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleItemOccurrenceFetchRequest(QOrganizerItemOccurrenceFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItem> items = m_engine->itemOccurrences(req->parentItem(), req->startDate(), req->endDate(), req->maxOccurrences(), req->fetchHint(), &err);
- QOrganizerManagerEngine::updateItemOccurrenceFetchRequest(req, items, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleIdFetchRequest(QOrganizerItemIdFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItemId> ids = m_engine->itemIds(req->startDate(), req->endDate(), req->filter(), req->sorting(), &err);
- QOrganizerManagerEngine::updateItemIdFetchRequest(req, ids, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleItemRemoveRequest(QOrganizerItemRemoveRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- m_engine->removeItems(req->itemIds(), &errorMap, &err);
- QOrganizerManagerEngine::updateItemRemoveRequest(req, err, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleSaveRequest(QOrganizerItemSaveRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QList<QOrganizerItem> items = req->items();
- m_engine->saveItems(&items, &errorMap, &err);
- QOrganizerManagerEngine::updateItemSaveRequest(req, items, err, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleDefinitionFetchRequest(QOrganizerItemDetailDefinitionFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QMap<QString, QOrganizerItemDetailDefinition> definitions = m_engine->detailDefinitions(req->itemType(), &err);
- QMap<QString, QOrganizerItemDetailDefinition> retn;
- QMap<int, QOrganizerManager::Error> errorMap;
- QStringList keys = req->definitionNames();
- if (keys.isEmpty())
- keys = definitions.keys();
- int definitionsCount = keys.count();
- for (int i = 0; i < definitionsCount; ++i) {
- if (definitions.contains(keys.at(i)))
- retn.insert(keys.at(i), definitions[keys.at(i)]);
- else
- errorMap.insert(i, QOrganizerManager::DoesNotExistError);
- }
- QOrganizerManagerEngine::updateDefinitionFetchRequest(req, retn, err, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleDefinitionRemoveRequest(QOrganizerItemDetailDefinitionRemoveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QStringList definitionNames = req->definitionNames();
- int nameCount = definitionNames.count();
- for(int i = 0; i < nameCount; ++i) {
- m_engine->removeDetailDefinition(definitionNames.at(i), req->itemType(), &tempError);
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateDefinitionRemoveRequest(req, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleDefinitionSaveRequest(QOrganizerItemDetailDefinitionSaveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QList<QOrganizerItemDetailDefinition> definitions = req->definitions();
- int definitionCount = definitions.count();
- for (int i = 0; i < definitionCount; ++i) {
- m_engine->saveDetailDefinition(definitions.at(i), req->itemType(), &tempError);
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateDefinitionSaveRequest(req, definitions, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleCollectionFetchRequest(QOrganizerCollectionFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerCollection> collections = m_engine->collections(&err);
- QOrganizerManagerEngine::updateCollectionFetchRequest(req, collections, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleCollectionRemoveRequest(QOrganizerCollectionRemoveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QOrganizerCollectionId currentId;
- QList<QOrganizerCollectionId> colsToRemove = req->collectionIds();
- int collectionsCount = colsToRemove.count();
- for (int i = 0; i < collectionsCount; ++i) {
- currentId = colsToRemove.at(i);
- m_engine->removeCollection(currentId, &tempError);
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateCollectionRemoveRequest(req, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleCollectionSaveRequest(QOrganizerCollectionSaveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QList<QOrganizerCollection> collections = req->collections();
- QList<QOrganizerCollection> retn;
- int collectionsCount = collections.count();
- for (int i = 0; i < collectionsCount; ++i) {
- QOrganizerCollection collection = collections.at(i);
- m_engine->saveCollection(&collection, &tempError);
- retn << collection;
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateCollectionSaveRequest(req, retn, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
diff --git a/plugins/organizer/maemo5/qorganizerasynchprocess.h b/plugins/organizer/maemo5/qorganizerasynchprocess.h
deleted file mode 100644
index 1904140d7d..0000000000
--- a/plugins/organizer/maemo5/qorganizerasynchprocess.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QORGANIZERASYNCHPROCESS_H
-#define QORGANIZERASYNCHPROCESS_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qtorganizer.h"
-#include <QtCore/qthread.h>
-#include <QtCore/qqueue.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qtimer.h>
-
-QTM_USE_NAMESPACE
-
-class QOrganizerItemMaemo5Engine;
-
-class OrganizerRequestTimeoutTimer : public QObject
-{
- Q_OBJECT
-
-public:
- OrganizerRequestTimeoutTimer(QOrganizerAbstractRequest *req, int msecs);
- ~OrganizerRequestTimeoutTimer();
-
- QOrganizerAbstractRequest *request() const;
-
-private Q_SLOTS:
- void internalTimeout();
-
-Q_SIGNALS:
- void timeout(OrganizerRequestTimeoutTimer* timer);
-
-private:
- QTimer* m_timeoutTimer;
- QOrganizerAbstractRequest *m_req;
-};
-
-
-class OrganizerAsynchProcess : public QThread
-{
- Q_OBJECT
-
-public:
- OrganizerAsynchProcess(QOrganizerItemMaemo5Engine *engine);
- ~OrganizerAsynchProcess();
-
- void requestDestroyed(QOrganizerAbstractRequest *req);
- bool addRequest(QOrganizerAbstractRequest *req);
- bool cancelRequest(QOrganizerAbstractRequest *req);
- bool waitForRequestFinished(QOrganizerAbstractRequest *req, int msecs);
-
-protected:
- void processRequest();
- void run();
-
-private:
- bool waitForRequestFinished(QOrganizerAbstractRequest *req);
-
- void handleItemFetchRequest(QOrganizerItemFetchRequest *req);
- void handleItemFetchForExportRequest(QOrganizerItemFetchForExportRequest *req);
- void handleItemOccurrenceFetchRequest(QOrganizerItemOccurrenceFetchRequest *req);
- void handleIdFetchRequest(QOrganizerItemIdFetchRequest *req);
- void handleItemRemoveRequest(QOrganizerItemRemoveRequest *req);
- void handleSaveRequest(QOrganizerItemSaveRequest *req);
- void handleDefinitionFetchRequest(QOrganizerItemDetailDefinitionFetchRequest *req);
- void handleDefinitionRemoveRequest(QOrganizerItemDetailDefinitionRemoveRequest *req);
- void handleDefinitionSaveRequest(QOrganizerItemDetailDefinitionSaveRequest *req);
- void handleCollectionFetchRequest(QOrganizerCollectionFetchRequest *req);
- void handleCollectionRemoveRequest(QOrganizerCollectionRemoveRequest *req);
- void handleCollectionSaveRequest(QOrganizerCollectionSaveRequest *req);
-
-private Q_SLOTS:
- void timeout(OrganizerRequestTimeoutTimer* timer);
-
-private:
- QOrganizerItemMaemo5Engine* m_engine;
- QQueue<QOrganizerAbstractRequest *> m_requestQueue;
- QList<OrganizerRequestTimeoutTimer *> m_timers;
- QSet<QOrganizerAbstractRequest *> m_activeRequests;
- QMutex m_mainMutex;
- QMutex m_timeoutMutex;
- bool m_quitNow;
-};
-
-#endif // QORGANIZERASYNCHPROCESS_H
diff --git a/plugins/organizer/maemo5/qorganizermaemo5.cpp b/plugins/organizer/maemo5/qorganizermaemo5.cpp
index bd0aea7f3b..2cacdebd06 100644
--- a/plugins/organizer/maemo5/qorganizermaemo5.cpp
+++ b/plugins/organizer/maemo5/qorganizermaemo5.cpp
@@ -255,7 +255,7 @@ QOrganizerItemMaemo5Engine::QOrganizerItemMaemo5Engine()
connect(&m_waitTimer, SIGNAL(timeout()), this, SIGNAL(dataChanged()));
d->m_itemTransformer.setManagerUri(managerUri());
- d->m_asynchProcess = new OrganizerAsynchProcess(this);
+ d->m_asynchManager = new OrganizerAsynchManager(this);
d->m_dbCache = new OrganizerDbCache();
connect(databaseMonitor, SIGNAL(fileChanged(const QString &)), d->m_dbCache, SLOT(invalidate()));
@@ -283,7 +283,7 @@ void QOrganizerItemMaemo5Engine::databaseChanged()
QOrganizerItemMaemo5Engine::~QOrganizerItemMaemo5Engine()
{
- delete d->m_asynchProcess;
+ delete d->m_asynchManager;
}
QString QOrganizerItemMaemo5Engine::managerName() const
@@ -1085,23 +1085,23 @@ bool QOrganizerItemMaemo5Engine::internalRemoveCollection(const QOrganizerCollec
bool QOrganizerItemMaemo5Engine::startRequest(QOrganizerAbstractRequest* req)
{
- d->m_asynchProcess->addRequest(req);
+ d->m_asynchManager->startRequest(req);
return true;
}
bool QOrganizerItemMaemo5Engine::cancelRequest(QOrganizerAbstractRequest* req)
{
- return d->m_asynchProcess->cancelRequest(req);
+ return d->m_asynchManager->cancelRequest(req);
}
bool QOrganizerItemMaemo5Engine::waitForRequestFinished(QOrganizerAbstractRequest* req, int msecs)
{
- return d->m_asynchProcess->waitForRequestFinished(req, msecs);
+ return d->m_asynchManager->waitForRequestFinished(req, msecs);
}
void QOrganizerItemMaemo5Engine::requestDestroyed(QOrganizerAbstractRequest* req)
{
- return d->m_asynchProcess->requestDestroyed(req);
+ return d->m_asynchManager->requestDestroyed(req);
}
bool QOrganizerItemMaemo5Engine::hasFeature(QOrganizerManager::ManagerFeature feature, const QString &itemType) const
diff --git a/plugins/organizer/maemo5/qorganizermaemo5_p.h b/plugins/organizer/maemo5/qorganizermaemo5_p.h
index ca5f91bf3d..02c527829d 100644
--- a/plugins/organizer/maemo5/qorganizermaemo5_p.h
+++ b/plugins/organizer/maemo5/qorganizermaemo5_p.h
@@ -76,7 +76,7 @@
#include "qorganizeritemchangeset.h"
#include "qorganizeritemtransform.h"
-#include "qorganizerasynchprocess.h"
+#include "../mkcal/qorganizerasynchmanager.h"
#include "qorganizercaldbaccess.h"
#include "qorganizerjournal.h"
@@ -129,7 +129,7 @@ public:
OrganizerItemTransform m_itemTransformer;
// asynchronous request handler instance
- OrganizerAsynchProcess *m_asynchProcess;
+ OrganizerAsynchManager *m_asynchManager;
// calendar database accessor instance
OrganizerCalendarDatabaseAccess* m_dbAccess;
diff --git a/plugins/organizer/maemo5/qorganizermaemo5ids_p.h b/plugins/organizer/maemo5/qorganizermaemo5ids_p.h
index 77863b20d3..ab9a270c3d 100644
--- a/plugins/organizer/maemo5/qorganizermaemo5ids_p.h
+++ b/plugins/organizer/maemo5/qorganizermaemo5ids_p.h
@@ -51,7 +51,7 @@ QTM_USE_NAMESPACE
class OrganizerCalendarDatabaseAccess;
class OrganizerItemTransform; // forward declare maemo5 transform.
class QOrganizerItemMaemo5Engine; // forward declare maemo5 engine.
-class OrganizerAsynchProcess; // forward declare maemo5 asynchronous process.
+class OrganizerAsynchManager; // forward declare maemo5 asynchronous process.
class QOrganizerCollectionMaemo5EngineId : public QOrganizerCollectionEngineId
{
@@ -76,7 +76,6 @@ public:
public:
quint32 m_localCollectionId;
- friend class OrganizerAsynchProcess;
};
class QOrganizerItemMaemo5EngineId : public QOrganizerItemEngineId
@@ -102,7 +101,6 @@ public:
public:
quint32 m_localItemId; // the maemo5 backend can use a single quint32 to uniquely identify an item in it.
- friend class OrganizerAsynchProcess;
};
inline QOrganizerItemId makeItemLocalId(quint32 id) {
diff --git a/plugins/organizer/mkcal/qorganizerasynchmanager.cpp b/plugins/organizer/mkcal/qorganizerasynchmanager.cpp
index fb693c6800..09d9c3700d 100644
--- a/plugins/organizer/mkcal/qorganizerasynchmanager.cpp
+++ b/plugins/organizer/mkcal/qorganizerasynchmanager.cpp
@@ -41,8 +41,6 @@
#include "qorganizerasynchmanager.h"
#include "qtorganizer.h"
-#include "mkcalengine.h"
-#include "mkcalid.h"
QTM_USE_NAMESPACE
diff --git a/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp b/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp
index e53a18fd0f..f8f33c94e5 100644
--- a/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp
+++ b/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp
@@ -1495,7 +1495,7 @@ void tst_QOrganizerItemAsync::itemRemove()
// remove all items
dfil.setDetailDefinitionName(QOrganizerItemDisplayLabel::DefinitionName); // delete everything.
- irr.setItemIds(oim->itemIds(dfil));
+ irr.setItemIds(oim->itemIds());
QVERIFY(!irr.cancel()); // not started
QVERIFY(irr.start());
@@ -1510,12 +1510,13 @@ void tst_QOrganizerItemAsync::itemRemove()
spy.clear();
// cancelling
- QOrganizerItem temp;
+ QOrganizerTodo temp;
QOrganizerItemDescription description;
description.setDescription("Should not be removed");
temp.saveDetail(&description);
oim->saveItem(&temp);
- irr.setItemIds(oim->itemIds(dfil));
+ QCOMPARE(oim->itemIds().size(), 1);
+ irr.setItemIds(oim->itemIds());
int bailoutCount = MAX_OPTIMISTIC_SCHEDULING_LIMIT; // attempt to cancel 40 times. If it doesn't work due to threading, bail out.
while (true) {
@@ -1527,14 +1528,14 @@ void tst_QOrganizerItemAsync::itemRemove()
// due to thread scheduling, async cancel might be attempted
// after the request has already finished.. so loop and try again.
irr.waitForFinished();
- irr.setItemIds(oim->itemIds(dfil));
temp.setId(QOrganizerItemId());
if (!oim->saveItem(&temp)) {
QSKIP("Unable to save temporary item for remove request cancellation test!", SkipSingle);
}
+ irr.setItemIds(oim->itemIds());
bailoutCount -= 1;
if (!bailoutCount) {
-// qWarning("Unable to test cancelling due to thread scheduling!");
+// QSKIP("Unable to test cancelling due to thread scheduling!", SkipSingle);
bailoutCount = MAX_OPTIMISTIC_SCHEDULING_LIMIT;
break;
}
@@ -1561,9 +1562,9 @@ void tst_QOrganizerItemAsync::itemRemove()
// due to thread scheduling, async cancel might be attempted
// after the request has already finished.. so loop and try again.
irr.waitForFinished();
- irr.setItemIds(oim->itemIds(dfil));
temp.setId(QOrganizerItemId());
oim->saveItem(&temp);
+ irr.setItemIds(oim->itemIds());
bailoutCount -= 1;
if (!bailoutCount) {
// qWarning("Unable to test cancelling due to thread scheduling!");