# HG changeset patch # User hgs # Date 1269380523 -7200 # Node ID 9d806967057c1c04b5121c9582e17484ff5ccd8d # Parent e492551a0d544bb756fb10304d77bca74b1edb1f 201007 diff -r e492551a0d54 -r 9d806967057c common.pri --- a/common.pri Tue Mar 23 23:28:12 2010 +0200 +++ b/common.pri Tue Mar 23 23:42:03 2010 +0200 @@ -82,7 +82,8 @@ $$PWD/homescreensrv_plat/contentstorage_api \ $$PWD/homescreensrv_plat/hswidgetmodel_api \ $$PWD/homescreensrv_plat/servicemodel_api \ - $$PWD/homescreensrv_plat/statemodel_api + $$PWD/homescreensrv_plat/statemodel_api \ + $$PWD/homescreensrv_plat/homescreen_information_api/inc } defineTest(exportResources) { @@ -110,8 +111,15 @@ } } +# support for NFT +nft:DEFINES += NFT + release:DEFINES+=QT_NO_DEBUG_OUTPUT +nft:release { +DEFINES -=QT_NO_DEBUG_OUTPUT +} + symbian { SYMBIAN_PLATFORMS = WINSCW ARMV5 # ONLY FOR DEVELOPMENT! REMOVE THIS BEFORE EACH HS_Domain RELEASE! diff -r e492551a0d54 -r 9d806967057c contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactsetutils.cpp --- a/contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactsetutils.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentpublishingsrv/contentharvester/factorysettingsplugin/src/chfactsetutils.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -17,8 +17,6 @@ // INCLUDE FILES -#include -#include #include "chfactsetutils.h" #include "chfactorysettingsglobals.h" diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caclienttest_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/inc/caclienttest_global.h Tue Mar 23 23:42:03 2010 +0200 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CACLIENTTEST_GLOBAL_H +#define CACLIENTTEST_GLOBAL_H + +#include +#include + +/*! + To enable logging of function entry and exit use the following flag for qmake: + -config nft + To include in logs extra information about RAM and heap usage, define an additional constant e.g. in ProductVariant.hrh: + #define NFT_RAM + */ + +#ifdef NFT +#ifdef Q_OS_SYMBIAN +#include +#include +#endif +#endif + +#ifdef NFT + +#define CACLIENTTEST(aText) qDebug() << QString(aText) + +#ifdef Q_OS_SYMBIAN +#ifdef NFT_RAM +#define CACLIENTTEST_FREERAM_ENTRY(function) \ + TInt CACLIENTTEST_ENTRY_RAM(0); \ + TInt CACLIENTTEST_ENTRY_HEAP(0); \ + TInt CACLIENTTEST_ENTRY_HEAP_SIZE(0); \ + { \ + TInt allRAM(0); \ + HAL::Get(HAL::EMemoryRAM, allRAM); \ + HAL::Get(HAL::EMemoryRAMFree, CACLIENTTEST_ENTRY_RAM); \ + RHeap &heap = User::Heap(); \ + TInt biggestBlock(0); \ + CACLIENTTEST_ENTRY_HEAP = heap.Available(biggestBlock); \ + CACLIENTTEST_ENTRY_HEAP_SIZE = heap.Size(); \ + qDebug("(nft) " function " - Memory (kB) - Free RAM: %d, Heap size: %d, Free heap: %d", \ + CACLIENTTEST_ENTRY_RAM >> 10, CACLIENTTEST_ENTRY_HEAP_SIZE >> 10, \ + CACLIENTTEST_ENTRY_HEAP >> 10); \ + } + +#define CACLIENTTEST_FREERAM_EXIT(function) \ + { \ + TInt allRAM(0); \ + TInt freeRAM(0); \ + HAL::Get(HAL::EMemoryRAM, allRAM); \ + HAL::Get(HAL::EMemoryRAMFree, freeRAM); \ + RHeap &heap = User::Heap(); \ + TInt biggestBlock(0); \ + TInt heapFree = heap.Available(biggestBlock); \ + TInt heapSize = heap.Size(); \ + qDebug("(nft) " function " - Memory (kB) - Free RAM: %d, Heap size: %d, Free heap: %d", \ + freeRAM >> 10, heapSize >> 10, heapFree >> 10); \ + qDebug("(nft) " function " - Memory (kB) - RAM diff: %d, Heap size diff: %d, Free heap diff: %d", \ + (freeRAM-CACLIENTTEST_ENTRY_RAM) >> 10, (heapSize-CACLIENTTEST_ENTRY_HEAP_SIZE) >> 10, \ + (heapFree-CACLIENTTEST_ENTRY_HEAP) >> 10); \ + } + +#else + +#define CACLIENTTEST_FREERAM_ENTRY(function) +#define CACLIENTTEST_FREERAM_EXIT(function) + +#endif + +#define CACLIENTTESTTIME_ENTRY(function) \ + TInt64 CACLIENTTEST_ENTRY_TIME(0); \ + { \ + TTime t; \ + t.UniversalTime(); \ + qDebug("\n" function " entry:%20lld", t.Int64()); \ + CACLIENTTEST_ENTRY_TIME = t.Int64(); \ + } + +#define CACLIENTTESTTIME_EXIT(function) { \ + TTime t; \ + t.UniversalTime(); \ + qDebug("\n" function " entry:%20lld\n" function " difference:%20lld", t.Int64(), \ + t.Int64()-CACLIENTTEST_ENTRY_TIME); \ + } + +#define CACLIENTTEST_FUNC_ENTRY(function) CACLIENTTEST_FREERAM_ENTRY(function) \ + CACLIENTTESTTIME_ENTRY(function) +#define CACLIENTTEST_FUNC_EXIT(function) CACLIENTTESTTIME_EXIT(function) \ + CACLIENTTEST_FREERAM_EXIT(function) + +#else //Q_OS_SYMBIAN +#define CACLIENTTEST_FUNC_ENTRY(function) qDebug()<< function << " entry"; +#define CACLIENTTEST_FUNC_EXIT(function) qDebug()<< function << " exit"; +#endif //Q_OS_SYMBIAN +#else //NFT +#define CACLIENTTEST_FUNC_ENTRY(function) +#define CACLIENTTEST_FUNC_EXIT(function) +#endif //NFT + +#endif //CACLIENTTEST_GLOBAL_H diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caentry_p.h --- a/contentstorage/caclient/inc/caentry_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/caentry_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -72,7 +72,7 @@ * Points to the CaEntry instance that uses * this private implementation. */ - CaEntry * const m_q; + CaEntry *const m_q; /*! * diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caiconcache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/inc/caiconcache.h Tue Mar 23 23:42:03 2010 +0200 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef ICONCACHE_H +#define ICONCACHE_H + +// System includes +#include +#include + +// User includes +#include "canotifier.h" + +// Forward declarations +class CaEntry; +class CaService; + +// Class declaration +class CaIconCache: public QObject +{ + Q_OBJECT +public: + + static CaIconCache *cache(); + bool exist(const CaEntry &entry, const QSize &size); + HbIcon icon(const CaEntry &entry, const QSize &size); + void insert(const CaEntry &entry, const QSize &size, const HbIcon &icon); + +private: + + explicit CaIconCache(QObject *parent = 0); + ~CaIconCache(); + QString key(const CaEntry &entry, const QSize &size = QSize()); + +private slots: + + void remove(const CaEntry &entry, ChangeType changeType); + +private: + static QSharedPointer mInstance; + + QCache mCache; //own + + QSharedPointer mService;//not own + + CaNotifier *mNotifier;//own + + friend class QtSharedPointer::ExternalRefCount; +}; + +#endif // ICONCACHE_H diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caicondescription_p.h --- a/contentstorage/caclient/inc/caicondescription_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/caicondescription_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -35,7 +35,7 @@ void setId(int id); QString filename() const; - void setFileName(const QString& fileName); + void setFileName(const QString &fileName); int bitmapId() const; void setBitmapId(int bitmapId); @@ -53,7 +53,7 @@ /*! * Points to the CaEntry instance that uses this private implementation. */ - CaIconDescription * const m_q; + CaIconDescription *const m_q; /*! * diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caitemmodel_p.h --- a/contentstorage/caclient/inc/caitemmodel_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/caitemmodel_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -37,29 +37,31 @@ class CaItemModelPrivate: public QObject { -Q_OBJECT + Q_OBJECT CA_CLIENT_TEST_FRIEND_CLASS(TestCaClient) public: // Function declarations explicit CaItemModelPrivate(const CaQuery &query, - CaItemModel *itemModelPublic); + CaItemModel *itemModelPublic); ~CaItemModelPrivate(); int rowCount() const; QModelIndex index(int row); QVariant data(const QModelIndex &modelIndex, int role) const; void setAutoUpdate(bool autoUpdate); void setSort(SortAttribute sortAttribute, Qt::SortOrder sortOrder = - Qt::AscendingOrder); + Qt::AscendingOrder); void setIconSize(const QSize &size); QSize getIconSize() const; QModelIndex root(); - CaEntry* entry(const QModelIndex &modelIndex) const; + CaEntry *entry(const QModelIndex &modelIndex) const; void setSecondLineVisibility(bool secondLineVisibility); bool secondLineVisibility() const; QVariant displayRole(const QModelIndex &modelIndex) const; void setParentId(int parentId); + void setFlagsOn(const EntryFlags &onFlags); + void setFlagsOff(const EntryFlags &offFlags); bool notifierExists() const; public slots: @@ -91,7 +93,7 @@ private: // data - CaItemModel * const m_q; + CaItemModel *const m_q; CaEntry *mParentEntry;//own CaQuery mQuery; QSharedPointer mService; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caitemmodellist.h --- a/contentstorage/caclient/inc/caitemmodellist.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/caitemmodellist.h Tue Mar 23 23:42:03 2010 +0200 @@ -46,7 +46,7 @@ void updateEntry(int id); void updateEntries(const CaQuery &query); int indexOf(const int &id) const; - void insert( int row, int id); + void insert(int row, int id); void remove(int id); const int &operator[](int row) const; @@ -61,7 +61,7 @@ QList mOrderedList; QHash mEntriesHash; QSharedPointer mService; - + }; #endif // CAITEMMODELLIST_P_H diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/canotifier_p.h --- a/contentstorage/caclient/inc/canotifier_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/canotifier_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -26,8 +26,7 @@ { public: - enum NotifierType - { + enum NotifierType { EntryChangedWithIdNotifierType = 0, EntryChangedWithEntryNotifierType, EntryTouchedNotifierType, diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/canotifierfilter_p.h --- a/contentstorage/caclient/inc/canotifierfilter_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/canotifierfilter_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -31,7 +31,7 @@ public: explicit - CaNotifierFilterPrivate(CaNotifierFilter *notifierFilterPublic); + CaNotifierFilterPrivate(CaNotifierFilter *notifierFilterPublic); CaNotifierFilterPrivate &operator=( const CaNotifierFilterPrivate ¬ifierFilterPrivate); ~CaNotifierFilterPrivate(); @@ -61,7 +61,7 @@ * Points to the CaNotifierFilter instance that uses * this private implementation. */ - CaNotifierFilter * const m_q; + CaNotifierFilter *const m_q; }; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caquery_p.h --- a/contentstorage/caclient/inc/caquery_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/caquery_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -44,15 +44,15 @@ void addEntryTypeName(const QString &entryTypeName); - void setFlagsOn(EntryFlags onFlags); + void setFlagsOn(const EntryFlags &onFlags); EntryFlags flagsOn() const; - void setFlagsOff(EntryFlags offFlags); + void setFlagsOff(const EntryFlags &offFlags); EntryFlags flagsOff() const; - void getSort(SortAttribute& sortAttribute, - Qt::SortOrder& sortOrder) const; - void setSort(SortAttribute sortAttribute, - Qt::SortOrder = Qt::AscendingOrder); + void getSort(SortAttribute &sortAttribute, + Qt::SortOrder &sortOrder) const; + void setSort(SortAttribute sortAttribute, + Qt::SortOrder = Qt::AscendingOrder); unsigned int count() const; void setCount(unsigned int count); @@ -64,7 +64,7 @@ /** * Points to the CaQuery instance that uses this private implementation. */ - CaQuery * const m_q; + CaQuery *const m_q; EntryRoles mEntryRoles; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/inc/caservice_p.h --- a/contentstorage/caclient/inc/caservice_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/inc/caservice_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -35,8 +35,8 @@ explicit CaServicePrivate(CaService *servicePublic); ~CaServicePrivate(); - QList getEntries(const QList &entryIdList) const; - QList getEntries(const CaQuery &query) const; + QList getEntries(const QList &entryIdList) const; + QList getEntries(const CaQuery &query) const; QList getEntryIds(const CaQuery &query) const; CaEntry *createEntry(const CaEntry &entry); @@ -48,7 +48,7 @@ bool touch(const CaEntry &entry); bool insertEntriesIntoGroup(int groupId, const QList &entryIdList, - int beforeEntryId); + int beforeEntryId); bool removeEntriesFromGroup(int groupId, const QList &entryIdList); @@ -58,7 +58,7 @@ bool executeCommand(const CaEntry &entry, const QString &command); - CaNotifier * createNotifier(const CaNotifierFilter &filter); + CaNotifier *createNotifier(const CaNotifierFilter &filter); bool customSort(int groupId, QList &entryIdList); @@ -69,12 +69,12 @@ /** * Points to the CaService instance that uses this private implementation. */ - CaService * const m_q; + CaService *const m_q; /** * Proxy to communicate with Symbian server. */ - CaClientProxy * mProxy; + CaClientProxy *mProxy; /** * code of error caused by last operation. diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/s60/inc/caclientnotifierproxy.h --- a/contentstorage/caclient/s60/inc/caclientnotifierproxy.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/s60/inc/caclientnotifierproxy.h Tue Mar 23 23:42:03 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * - * Description: + * Description: * */ @@ -43,7 +43,7 @@ * @param changeType change type. */ virtual void entryChanged(TInt entryId, - TChangeType changeType) const = 0; + TChangeType changeType) const = 0; /** * Method invoked when entry is changed. @@ -51,7 +51,7 @@ * @param changeType change type. */ virtual void entryChanged(const CCaInnerEntry &entry, - TChangeType changeType) const = 0; + TChangeType changeType) const = 0; /** * Method invoked when entry was changed. @@ -69,7 +69,7 @@ class CACLIENT_EXPORT CaClientNotifierProxy: public QObject, public IDataObserver { -Q_OBJECT + Q_OBJECT public: @@ -97,7 +97,7 @@ * @param changeType change type. */ virtual void entryChanged(const CCaInnerEntry &entry, - TChangeType changeType) const; + TChangeType changeType) const; /** * Method invoked when entry was changed. @@ -137,7 +137,7 @@ void signalEntryChanged(int entryId, ChangeType changeType) const; void signalEntryChanged(const CaEntry &entry, - ChangeType changeType) const; + ChangeType changeType) const; void signalEntryTouched(int id) const; void signalGroupContentChanged(int groupId) const; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/s60/inc/caclientproxy.h --- a/contentstorage/caclient/s60/inc/caclientproxy.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/s60/inc/caclientproxy.h Tue Mar 23 23:42:03 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * - * Description: + * Description: * */ @@ -43,8 +43,7 @@ /** * Insert into group type. */ - enum InsertType - { + enum InsertType { AfterTheLastEntry = -1, BeforeTheFirstEntry = 0 }; @@ -72,7 +71,7 @@ * @return error code. */ ErrorCode addData(const CaEntry &entryToAdd, - CaEntry &targetEntry); + CaEntry &targetEntry); /** * Method for removing entries. @@ -89,7 +88,7 @@ * @return error code. */ ErrorCode insertEntriesIntoGroup(int groupId, - const QList &entryIdList, int beforeEntryId); + const QList &entryIdList, int beforeEntryId); /** * Remove entries from group. @@ -98,7 +97,7 @@ * @return error code. */ ErrorCode removeEntriesFromGroup(int groupId, - const QList &entryIdList); + const QList &entryIdList); /** * Method for fetching entries. @@ -107,7 +106,7 @@ * @param sourceList List of results. * @return error code */ - ErrorCode getData(const QList &entryIdList, QList &sourceList); + ErrorCode getData(const QList &entryIdList, QList &sourceList); /** * Method for fetching entries. @@ -116,7 +115,7 @@ * @param sourceList List of results. * @return error code */ - ErrorCode getData(const CaQuery &query, QList &sourceList); + ErrorCode getData(const CaQuery &query, QList &sourceList); /** * Method for fetching entries. @@ -126,7 +125,7 @@ * @return error code */ ErrorCode getEntryIds(const CaQuery &query, - QList &sourceIdList); + QList &sourceIdList); /** * Method for executing command @@ -136,7 +135,7 @@ * @return error code */ ErrorCode executeCommand(const CaEntry &entry, - const QString &command); + const QString &command); /** * Method for touching entry. @@ -144,15 +143,15 @@ * @param aEntry entry to touch * @return error code */ - ErrorCode touch(const CaEntry& aEntry); - + ErrorCode touch(const CaEntry &aEntry); + /** * Method for custom sort. * @param entryIdList list of ids. - * @param groupId Group id. + * @param groupId Group id. * @return error code. */ - ErrorCode customSort(const QList &entryIdList, int groupId); + ErrorCode customSort(const QList &entryIdList, int groupId); private: @@ -163,7 +162,7 @@ * */ void addDataL(const CaEntry &entryToAdd, - CaEntry &targetEntry); + CaEntry &targetEntry); /** * Method for removing entries. Symbian specific. @@ -181,7 +180,7 @@ * */ void insertEntriesIntoGroupL(int groupId, - const QList &entryIdList, int beforeEntryId); + const QList &entryIdList, int beforeEntryId); /** * Method for removing entries from a group @@ -190,23 +189,23 @@ * */ void removeEntriesFromGroupL(int groupId, - const QList &entryIdList); + const QList &entryIdList); /** * Method for fetching entries. Symbian specific. * @param entryIdList list of ids * @param sourceList list of entries. */ - void getDataL(const QList &entryIdList, - QList &sourceList); + void getDataL(const QList &entryIdList, + QList &sourceList); /** * Method for fetching entries. Symbian specific. * @param entryIdList list of ids * @param sourceList list of entries. */ - void getDataL(const CaQuery &query, - QList &sourceList); + void getDataL(const CaQuery &query, + QList &sourceList); /** * Method for fetching entries. Symbian specific. @@ -214,7 +213,7 @@ * @param sourceList list of ids. */ void getEntryIdsL(const CaQuery &query, - QList &sourceIdList); + QList &sourceIdList); /** * Method for fetching entries. Symbian specific. @@ -222,19 +221,19 @@ * @param command command. */ void executeCommandL(const CaEntry &entry, - const QString &command); + const QString &command); /** * Touch. * @param aEntry entry to be touched. */ - void touchL(const CaEntry& aEntry); - + void touchL(const CaEntry &aEntry); + /** * Custom Sort. * @param aEntry entry to be touched. */ - void customSortL(const QList &entryIdList, int groupId); + void customSortL(const QList &entryIdList, int groupId); private: // Session to server. diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/s60/inc/caobjectadapter.h --- a/contentstorage/caclient/s60/inc/caobjectadapter.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/s60/inc/caobjectadapter.h Tue Mar 23 23:42:03 2010 +0200 @@ -54,16 +54,16 @@ * @param toEntry inner entry resulting from conversion */ static void convertL( - const CaEntry& fromEntry, - CCaInnerEntry& toEntry); + const CaEntry &fromEntry, + CCaInnerEntry &toEntry); /** * Converts inner entry to entry. * @param fromEntry inner entry to be converted * @param toEntry entry resulting from conversino */ - static void convert(const CCaInnerEntry& fromEntry, - CaEntry& toEntry); + static void convert(const CCaInnerEntry &fromEntry, + CaEntry &toEntry); /** * Converts query to inner query. @@ -71,8 +71,8 @@ * @param toQuery inner query resutling from conversion */ static void convertL( - const CaQuery& fromQuery, - CCaInnerQuery& toQuery); + const CaQuery &fromQuery, + CCaInnerQuery &toQuery); /** * Wraps a QString internal buffer into TPtrC object. @@ -81,14 +81,14 @@ * @param string QString. * @return descriptor. */ - static const TPtrC convertToDescriptor(const QString& string); + static const TPtrC convertToDescriptor(const QString &string); /** * Converts descriptor to QString. * @param des descriptor. * @return QString. */ - static QString convertToString(const TDesC& des); + static QString convertToString(const TDesC &des); /** * Converts inner entry table to QList of pointers to entries. @@ -98,7 +98,7 @@ */ static void convertL( const RPointerArray& fromEntriesArray, - QList& toEntriesArray); + QList& toEntriesArray); /** * Converts QList of ids to RArray of TInts. @@ -106,7 +106,7 @@ * @param toEntryIdArray array of entry ids */ static void convertL(const QList &fromEntryIdList, - RArray& toEntryIdArray); + RArray& toEntryIdArray); /** * Converts RArray of TInts to QList of ids. @@ -114,7 +114,7 @@ * @param toEntryIdList resulgin list of entry ids. */ static void convertL(const RArray& fromEntryIdList, - QList& toEntryIdList); + QList& toEntryIdList); /** * Converts symbian error code to error code (used in QT code). @@ -127,7 +127,7 @@ * @param entry entry. * @return HbIcon. */ - static HbIcon makeIcon(const CaEntry& entry, const QSize &size); + static HbIcon makeIcon(const CaEntry &entry, const QSize &size); /** * Converts notifier type to inner notifier type. @@ -136,7 +136,7 @@ */ static void convert( CaNotifierPrivate::NotifierType from, - CCaInnerNotifierFilter::TNotifierType& to); + CCaInnerNotifierFilter::TNotifierType &to); /** * Converts inner change type to change type. @@ -144,7 +144,7 @@ * @param to resulting change type. */ static void convert( - TChangeType src, ChangeType& dest); + TChangeType src, ChangeType &dest); /** * Converts filter to inner filter. @@ -158,17 +158,17 @@ /** * @return uid attribute name */ - static const QString& applicationUidAttributeName(); + static const QString &applicationUidAttributeName(); /** * @return attribute type name */ - static const QString& applicationEntryName(); - + static const QString &applicationEntryName(); + /** * @return widget type name */ - static const QString& widgetEntryName(); + static const QString &widgetEntryName(); /** * Set entry id. @@ -176,7 +176,7 @@ * @param id entry id. */ static void setId(CaEntry &entry, - int id); + int id); private: /** @@ -184,14 +184,14 @@ * @param entry entry. * @return HbIcon. */ - static HbIcon makeIconL(const CaEntry& entry, const QSize &size); + static HbIcon makeIconL(const CaEntry &entry, const QSize &size); /** * Make bitmap copy, used to get rid of compression for extended bitmap * @param input input bitmap. * @return copied bitmap. */ - static CFbsBitmap* copyBitmapLC(CFbsBitmap* input); + static CFbsBitmap *copyBitmapLC(CFbsBitmap *input); /** * Maps a given sort subject and the order to be applied diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/s60/src/caclientnotifierproxy.cpp --- a/contentstorage/caclient/s60/src/caclientnotifierproxy.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/s60/src/caclientnotifierproxy.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -39,10 +39,10 @@ // //---------------------------------------------------------------------------- void CaClientNotifierProxy::entryChanged(TInt entryId, - TChangeType changeType) const + TChangeType changeType) const { qDebug() << "CaClientProxy::entryChanged entryId:" - << entryId << "changeType:" << changeType; + << entryId << "changeType:" << changeType; int entryChangedId(entryId); ChangeType entryChangeType(AddChangeType); @@ -55,7 +55,7 @@ // //---------------------------------------------------------------------------- void CaClientNotifierProxy::entryChanged(const CCaInnerEntry &entry, - TChangeType changeType) const + TChangeType changeType) const { qDebug() << "CaClientProxy::entryChanged changeType:" << changeType; @@ -97,21 +97,21 @@ const CaClientNotifierProxy *notifierProxy) { qDebug() << "CaClientProxy::registerNotifier notifierType:" - << notifierType; + << notifierType; CCaInnerNotifierFilter::TNotifierType innerNotifierType( CCaInnerNotifierFilter::EEntryChangedWithId); CaObjectAdapter::convert(notifierType, - innerNotifierType); + innerNotifierType); CCaInnerNotifierFilter *innerNotifierFilter(NULL); TRAPD(error, - innerNotifierFilter = - CCaInnerNotifierFilter::NewLC(innerNotifierType); - CaObjectAdapter::convertL(*notifierFilter, *innerNotifierFilter); - CleanupStack::Pop(innerNotifierFilter) - ); + innerNotifierFilter = + CCaInnerNotifierFilter::NewLC(innerNotifierType); + CaObjectAdapter::convertL(*notifierFilter, *innerNotifierFilter); + CleanupStack::Pop(innerNotifierFilter) + ); if (!error) { // Lock the access to mSessions. @@ -123,7 +123,7 @@ } if (!error) { error = session->RegisterNotifier(innerNotifierFilter, - notifierFilter, notifierProxy); + notifierFilter, notifierProxy); } } @@ -136,11 +136,11 @@ // //---------------------------------------------------------------------------- void CaClientNotifierProxy::unregisterNotifier( - const CaNotifierFilter ¬ifierFilter, - CaNotifierPrivate::NotifierType notifierType) + const CaNotifierFilter ¬ifierFilter, + CaNotifierPrivate::NotifierType notifierType) { qDebug() << "CaClientProxy::unregisterNotifier notifierType:" - << notifierType; + << notifierType; CCaInnerNotifierFilter::TNotifierType innerNotifierType( CCaInnerNotifierFilter::EEntryChangedWithId); @@ -153,7 +153,7 @@ // It will be automatically unlocked at the end of the current range. QMutexLocker locker(&mMutex); mSessions[pos].UnregisterNotifier(¬ifierFilter, - innerNotifierType); + innerNotifierType); if (mSessions[pos].SubsessionsCount() == 0) { mSessions[pos].Close(); mSessions.Remove(pos); @@ -188,7 +188,7 @@ TInt pos(KErrNotFound); for (int i = 0; i < count; i++) { if (mSessions[i].ContainsSubsession(¬ifierFilter, - innerNotifierType)) { + innerNotifierType)) { pos = i; break; } @@ -210,8 +210,7 @@ session.Close(); qDebug("CaClientProxy::newSession: error (%d)", error); return NULL; - } - else { + } else { return &mSessions[mSessions.Count() - 1]; } } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/s60/src/caclientproxy.cpp --- a/contentstorage/caclient/s60/src/caclientproxy.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/s60/src/caclientproxy.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -72,12 +72,12 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::addData(const CaEntry &entryToAdd, - CaEntry &targetEntry) + CaEntry &targetEntry) { TRAPD(error, addDataL(entryToAdd, targetEntry)); USE_QDEBUG_IF(error) << "CaClientProxy::addData - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -90,7 +90,7 @@ TRAPD(error, removeDataL(entryIdList)); USE_QDEBUG_IF(error) << "CaClientProxy::removeData - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -99,13 +99,13 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::insertEntriesIntoGroup(int groupId, - const QList &entryIdList, int beforeEntryId) + const QList &entryIdList, int beforeEntryId) { TRAPD(error, - insertEntriesIntoGroupL(groupId, entryIdList, beforeEntryId)); + insertEntriesIntoGroupL(groupId, entryIdList, beforeEntryId)); USE_QDEBUG_IF(error)<< "CaClientProxy::insertEntriesIntoGroup - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -114,12 +114,12 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::removeEntriesFromGroup(int groupId, - const QList &entryIdList) + const QList &entryIdList) { TRAPD(error, removeEntriesFromGroupL(groupId, entryIdList)); USE_QDEBUG_IF(error)<< "CaClientProxy::removeEntriesFromGroup - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -128,12 +128,12 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::getData(const QList &entryIdList, - QList &sourceList) + QList &sourceList) { TRAPD(error, getDataL(entryIdList, sourceList)); USE_QDEBUG_IF(error) << "CaClientProxy::getData - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -142,12 +142,12 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::getData(const CaQuery &query, - QList &sourceList) + QList &sourceList) { TRAPD(error, getDataL(query, sourceList)); USE_QDEBUG_IF(error) << "CaClientProxy::getData - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -156,12 +156,12 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::getEntryIds(const CaQuery &query, - QList &sourceIdList) + QList &sourceIdList) { TRAPD(error, getEntryIdsL(query, sourceIdList)); USE_QDEBUG_IF(error) << "CaClientProxy::getEntryIds - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -170,12 +170,12 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::executeCommand(const CaEntry &entry, - const QString &command) + const QString &command) { TRAPD(error, executeCommandL(entry, command)); USE_QDEBUG_IF(error) << "CaClientProxy::executeCommand - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -183,12 +183,12 @@ //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- -ErrorCode CaClientProxy::touch(const CaEntry& aEntry) +ErrorCode CaClientProxy::touch(const CaEntry &aEntry) { TRAPD(error, touchL(aEntry)); USE_QDEBUG_IF(error) << "CaClientProxy::touch - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -197,12 +197,12 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::customSort(const QList &entryIdList, - int groupId) + int groupId) { TRAPD(error, customSortL(entryIdList, groupId)); USE_QDEBUG_IF(error)<< "CaClientProxy::customSort - Error (" - << error << ")"; + << error << ")"; return CaObjectAdapter::convertErrorCode(error); } @@ -211,7 +211,7 @@ // //---------------------------------------------------------------------------- void CaClientProxy::addDataL(const CaEntry &entryToAdd, - CaEntry &targetEntry) + CaEntry &targetEntry) { CCaInnerEntry *newEntryToAdd = CCaInnerEntry::NewLC(); @@ -235,7 +235,7 @@ } void CaClientProxy::insertEntriesIntoGroupL(int groupId, - const QList &entryIdList, int beforeEntryId) + const QList &entryIdList, int beforeEntryId) { RCaIdsArray array; CleanupClosePushL(array); @@ -251,7 +251,7 @@ default: if (beforeEntryId < 1) { qWarning("CaClientProxy::insertEntriesIntoGroupL" - "- wrong beforeEntryId: (%d)", beforeEntryId); + "- wrong beforeEntryId: (%d)", beforeEntryId); } operationType = TCaOperationParams::EInsert; break; @@ -265,14 +265,14 @@ // //---------------------------------------------------------------------------- void CaClientProxy::removeEntriesFromGroupL(int groupId, - const QList &entryIdList) + const QList &entryIdList) { RCaIdsArray array; CleanupClosePushL(array); CaObjectAdapter::convertL(entryIdList, array); TCaOperationParams params = { TCaOperationParams::ERemove, - groupId, 0 /*not used*/ - }; + groupId, 0 /*not used*/ + }; mSession.OrganizeL(array, params); CleanupStack::PopAndDestroy(&array); } @@ -281,7 +281,7 @@ // //---------------------------------------------------------------------------- void CaClientProxy::getDataL(const QList &entryIdList, - QList &sourceList) + QList &sourceList) { CCaInnerQuery *query = CCaInnerQuery::NewLC(); RArray array; @@ -301,7 +301,7 @@ // //---------------------------------------------------------------------------- void CaClientProxy::getDataL(const CaQuery &query, - QList &sourceList) + QList &sourceList) { CCaInnerQuery *innerQuery = CCaInnerQuery::NewLC(); CaObjectAdapter::convertL(query, *innerQuery); @@ -317,7 +317,7 @@ // //---------------------------------------------------------------------------- void CaClientProxy::getEntryIdsL(const CaQuery &query, - QList &sourceIdList) + QList &sourceIdList) { CCaInnerQuery *innerQuery = CCaInnerQuery::NewLC(); CaObjectAdapter::convertL(query, *innerQuery); @@ -333,15 +333,15 @@ // //---------------------------------------------------------------------------- void CaClientProxy::executeCommandL(const CaEntry &entry, - const QString &command) + const QString &command) { CCaInnerEntry *innerEntry = CCaInnerEntry::NewLC(); CaObjectAdapter::convertL(entry, *innerEntry); TPtrC16 commandPtr16( - reinterpret_cast (command.utf16())); + reinterpret_cast(command.utf16())); HBufC8 *convertedCommand = CnvUtfConverter::ConvertFromUnicodeToUtf7L( - commandPtr16, false); + commandPtr16, false); CleanupStack::PushL(convertedCommand); if (!mHandler) { mHandler = CCaHandlerEngine::NewL(); @@ -354,14 +354,14 @@ //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- -void CaClientProxy::touchL(const CaEntry& entry) +void CaClientProxy::touchL(const CaEntry &entry) { - CCaInnerEntry* innerEntry = CCaInnerEntry::NewLC(); + CCaInnerEntry *innerEntry = CCaInnerEntry::NewLC(); - CaObjectAdapter::convertL(entry, *innerEntry); - + CaObjectAdapter::convertL(entry, *innerEntry); + mSession.TouchL(*innerEntry); - + CleanupStack::PopAndDestroy(innerEntry); } @@ -373,7 +373,7 @@ RCaIdsArray array; CleanupClosePushL(array); CaObjectAdapter::convertL(entryIdList, array); - + mSession.CustomSortL(array, groupId); CleanupStack::PopAndDestroy(&array); } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/s60/src/caobjectadapter.cpp --- a/contentstorage/caclient/s60/src/caobjectadapter.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/s60/src/caobjectadapter.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -36,10 +36,11 @@ #include "camenuiconutility.h" #include "canotifierfilter.h" #include "cainnernotifierfilter.h" + static QImage::Format TDisplayMode2Format(TDisplayMode mode) { QImage::Format format; - switch(mode) { + switch (mode) { case EGray2: format = QImage::Format_MonoLSB; break; @@ -72,27 +73,27 @@ return format; } -QPixmap fromSymbianCFbsBitmap(CFbsBitmap* aBitmap) - { +QPixmap fromSymbianCFbsBitmap(CFbsBitmap *aBitmap) +{ aBitmap->BeginDataAccess(); - uchar *data = (uchar*)aBitmap->DataAddress(); + uchar *data = (uchar *)aBitmap->DataAddress(); TSize size = aBitmap->SizeInPixels(); - TDisplayMode displayMode = aBitmap->DisplayMode(); - + TDisplayMode displayMode = aBitmap->DisplayMode(); + // QImage format must match to bitmap format QImage image(data, size.iWidth, size.iHeight, TDisplayMode2Format(displayMode)); aBitmap->EndDataAccess(); - + // No data copying happens because image format matches native OpenVG format. // So QPixmap actually points to CFbsBitmap data. return QPixmap::fromImage(image); - } +} // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void CaObjectAdapter::convertL(const CaEntry &fromEntry, - CCaInnerEntry &toEntry) + CCaInnerEntry &toEntry) { toEntry.SetId(fromEntry.id()); @@ -103,9 +104,9 @@ toEntry.SetEntryTypeNameL( convertToDescriptor(fromEntry.entryTypeName())); - toEntry.SetFlags(static_cast (fromEntry.flags())); + toEntry.SetFlags(static_cast(fromEntry.flags())); - toEntry.SetRole(static_cast (fromEntry.role())); + toEntry.SetRole(static_cast(fromEntry.role())); const CaIconDescription fromIconDescription = fromEntry.iconDescription(); @@ -119,12 +120,11 @@ const QMap attributesMap = fromEntry.attributes(); - foreach (QString key, attributesMap.keys()) { + foreach(QString key, attributesMap.keys()) { if (key == applicationUidAttributeName()) { const TInt32 uid = attributesMap.value(key).toInt(); toEntry.SetUid(uid); - } - else { + } else { toEntry.AddAttributeL( convertToDescriptor(key), convertToDescriptor(attributesMap.value(key))); @@ -136,7 +136,7 @@ // //---------------------------------------------------------------------------- void CaObjectAdapter::convertL(const CaQuery &fromQuery, - CCaInnerQuery &toQuery) + CCaInnerQuery &toQuery) { toQuery.SetParentId(fromQuery.parentId()); @@ -151,10 +151,10 @@ const QStringList list = fromQuery.entryTypeNames(); CDesC16ArrayFlat *sourceList = - new (ELeave)CDesC16ArrayFlat(KDefaultGranularity); + new(ELeave)CDesC16ArrayFlat(KDefaultGranularity); CleanupStack::PushL(sourceList); - foreach (const QString str, list) { + foreach(const QString str, list) { sourceList->AppendL(convertToDescriptor(str)); } @@ -173,7 +173,7 @@ // //---------------------------------------------------------------------------- void CaObjectAdapter::convert(const CCaInnerEntry &fromEntry, - CaEntry &toEntry) + CaEntry &toEntry) { toEntry.setId(fromEntry.GetId()); @@ -200,9 +200,9 @@ const RCaEntryAttrArray &attributesArray = fromEntry.GetAttributes(); if (toEntry.entryTypeName() == applicationEntryName() - || toEntry.entryTypeName() == widgetEntryName()) { + || toEntry.entryTypeName() == widgetEntryName()) { toEntry.setAttribute(applicationUidAttributeName(), - QString::number(fromEntry.GetUid())); + QString::number(fromEntry.GetUid())); } const int attributesArrayCount = attributesArray.Count(); @@ -210,7 +210,7 @@ for (int i = 0; i < attributesArrayCount; ++i) { const CCaEntryAttribute *const attribute = attributesArray[i]; toEntry.setAttribute(convertToString(attribute->Name()), - convertToString(attribute->Value())); + convertToString(attribute->Value())); } } @@ -220,7 +220,7 @@ //---------------------------------------------------------------------------- const TPtrC CaObjectAdapter::convertToDescriptor(const QString &string) { - const TPtrC result(reinterpret_cast (string.utf16())); + const TPtrC result(reinterpret_cast(string.utf16())); return result; } @@ -236,7 +236,7 @@ // //---------------------------------------------------------------------------- void CaObjectAdapter::convertL(const CaNotifierFilter ¬ifierFilter, - CCaInnerNotifierFilter &source) + CCaInnerNotifierFilter &source) { source.SetParentId(static_cast(notifierFilter.getParentId())); @@ -258,7 +258,7 @@ source.SetEntryRole(ENoneEntryRole); break; } - CDesC16ArrayFlat *typeNames = new (ELeave) CDesC16ArrayFlat( + CDesC16ArrayFlat *typeNames = new(ELeave) CDesC16ArrayFlat( KDefaultGranularity); CleanupStack::PushL(typeNames); @@ -278,7 +278,7 @@ //---------------------------------------------------------------------------- void CaObjectAdapter::convertL( const RPointerArray &fromEntriesArray, - QList &toEntryList) + QList &toEntryList) { for (int i = 0; i < fromEntriesArray.Count(); ++i) { CaEntry *const toEntry = new CaEntry( @@ -294,19 +294,18 @@ // //---------------------------------------------------------------------------- void CaObjectAdapter::convertL(const QList &entryIdList, - RArray &source) + RArray &source) { - foreach(int id, entryIdList) - { - source.AppendL(static_cast(id)); - } + foreach(int id, entryIdList) { + source.AppendL(static_cast(id)); + } } //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- void CaObjectAdapter::convertL(const RArray &innerEntryIdList, - QList &idList) + QList &idList) { for (TInt i = 0; i < innerEntryIdList.Count(); ++i) { idList.append(innerEntryIdList[i]); @@ -318,11 +317,12 @@ //---------------------------------------------------------------------------- HbIcon CaObjectAdapter::makeIcon(const CaEntry &entry, const QSize &size) { + HbIcon icon; TRAPD(leaveCode, icon = makeIconL(entry, size)); USE_QDEBUG_IF(leaveCode) << "CaObjectAdapter::makeIcon leaveCode:" - << leaveCode; + << leaveCode; return icon; } @@ -385,7 +385,7 @@ //---------------------------------------------------------------------------- CFbsBitmap *CaObjectAdapter::copyBitmapLC(CFbsBitmap *input) { - CFbsBitmap *bmp = new (ELeave) CFbsBitmap(); + CFbsBitmap *bmp = new(ELeave) CFbsBitmap(); CleanupStack::PushL(bmp); bmp->Create(input->SizeInPixels(), input->DisplayMode()); @@ -421,16 +421,15 @@ //need to disable compression to properly convert the bitmap AknIconUtils::DisableCompression(aknIcon->Bitmap()); AknIconUtils::SetSize(aknIcon->Bitmap(), TSize(size.width(), - size.height()), EAspectRatioPreservedAndUnusedSpaceRemoved); + size.height()), EAspectRatioPreservedAndUnusedSpaceRemoved); if (aknIcon->Bitmap()->Header().iCompression - == ENoBitmapCompression) { + == ENoBitmapCompression) { pixmap = fromSymbianCFbsBitmap(aknIcon->Bitmap()); QPixmap mask = fromSymbianCFbsBitmap( - aknIcon->Mask()); + aknIcon->Mask()); pixmap.setAlphaChannel(mask); - } - else // we need special handling for icons in 9.2 (NGA) - { // let's hope that in future it will be in QT code + } else { // we need special handling for icons in 9.2 (NGA) + // let's hope that in future it will be in QT code CFbsBitmap *temp(NULL); temp = copyBitmapLC(aknIcon->Bitmap()); pixmap = fromSymbianCFbsBitmap(temp); @@ -456,7 +455,7 @@ CaNotifierPrivate::NotifierType src, CCaInnerNotifierFilter::TNotifierType &dest) { - switch(src){ + switch (src) { case CaNotifierPrivate::EntryChangedWithIdNotifierType: dest = CCaInnerNotifierFilter::EEntryChangedWithId; break; @@ -478,7 +477,7 @@ void CaObjectAdapter::convert( TChangeType src, ChangeType &dest) { - switch(src){ + switch (src) { case EAddChangeType: dest = AddChangeType; break; @@ -497,35 +496,30 @@ CCaInnerQuery::TSortAttribute sortCode(CCaInnerQuery::Default); switch (sortAttribute) { - case NameSortAttribute: - { + case NameSortAttribute: { sortCode = (sortOrder == Qt::AscendingOrder) ? CCaInnerQuery::Name - : CCaInnerQuery::NameDesc; + : CCaInnerQuery::NameDesc; break; } - case CreatedTimestampSortAttribute: - { + case CreatedTimestampSortAttribute: { sortCode = (sortOrder == Qt::AscendingOrder) - ? CCaInnerQuery::CreatedTimestamp - : CCaInnerQuery::CreatedTimestampDesc; + ? CCaInnerQuery::CreatedTimestamp + : CCaInnerQuery::CreatedTimestampDesc; break; } - case MostUsedSortAttribute: - { + case MostUsedSortAttribute: { sortCode = (sortOrder == Qt::AscendingOrder) - ? CCaInnerQuery::MostUsed : CCaInnerQuery::MostUsedDesc; + ? CCaInnerQuery::MostUsed : CCaInnerQuery::MostUsedDesc; break; } - case LastUsedSortAttribute: - { + case LastUsedSortAttribute: { sortCode = (sortOrder == Qt::AscendingOrder) - ? CCaInnerQuery::LastUsed : CCaInnerQuery::LastUsedDesc; + ? CCaInnerQuery::LastUsed : CCaInnerQuery::LastUsedDesc; break; } - case DefaultSortAttribute: - { + case DefaultSortAttribute: { sortCode = (sortOrder == Qt::AscendingOrder) - ? CCaInnerQuery::Default : CCaInnerQuery::DefaultDesc; + ? CCaInnerQuery::Default : CCaInnerQuery::DefaultDesc; break; } } @@ -537,7 +531,7 @@ // //---------------------------------------------------------------------------- void CaObjectAdapter::setId(CaEntry &entry, - int id) + int id) { entry.setId(id); } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/caentry.cpp --- a/contentstorage/caclient/src/caentry.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/src/caentry.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -22,6 +22,8 @@ #include "caentry.h" #include "caentry_p.h" #include "caobjectadapter.h" +#include "caiconcache.h" +#include "caclienttest_global.h" // ======== MEMBER FUNCTIONS ======== @@ -407,9 +409,18 @@ icon.size() == iconSize; \endcode */ -HbIcon CaEntry::makeIcon(const QSize& size) const +HbIcon CaEntry::makeIcon(const QSize &size) const { - return m_d->makeIcon(size); + CACLIENTTEST_FUNC_ENTRY("CaEntry::makeIcon"); + HbIcon icon; + if (CaIconCache::cache()->exist(*this,size)) { + icon = CaIconCache::cache()->icon(*this,size); + } else { + icon = m_d->makeIcon(size); + CaIconCache::cache()->insert(*this, size, icon); + } + CACLIENTTEST_FUNC_EXIT("CaEntry::makeIcon"); + return icon; } /*! @@ -460,7 +471,7 @@ \param entryPublic associated public entry */ CaEntryPrivate::CaEntryPrivate(CaEntry *entryPublic) : - m_q(entryPublic), mId(0), mText(), mDescription(), mIconDescription(), + m_q(entryPublic), mId(0), mText(), mDescription(), mIconDescription(), mFlags(RemovableEntryFlag|VisibleEntryFlag),mEntryTypeName(), mAttributes() { @@ -616,7 +627,7 @@ \param size icon size to display \retval created icon (HbIcon). */ -HbIcon CaEntryPrivate::makeIcon(const QSize& size) const +HbIcon CaEntryPrivate::makeIcon(const QSize &size) const { return CaObjectAdapter::makeIcon(*m_q, size); } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/caiconcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/src/caiconcache.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -0,0 +1,171 @@ +/* + * Copyright (c)2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: ?Description + * + */ + +#include +#include "caiconcache.h" +#include "caservice.h" +#include "caentry.h" +#include "caobjectadapter.h" +#include "caclienttest_global.h" + +// Constants +static const int maxCost = 250; +static const QChar separator = '*'; + +QSharedPointer CaIconCache::mInstance(0); + +/*! + * \class CaIconCache + * + * \brief This class provides icon caching mechanism + * + * Class implements singleton design patern. Use cache() method + * to get an instance of CaIconCache + * + */ + +/*! + Returns an instance of CaIconCache + \retval CaIconCache instance + + */ +CaIconCache *CaIconCache::cache() +{ + if (!mInstance.data()) { + mInstance = QSharedPointer(new CaIconCache()); + mInstance->setParent(QCoreApplication::instance()); + } + return mInstance.data(); +} + +/*! +Destructor + */ +CaIconCache::~CaIconCache() +{ + CACLIENTTEST_FUNC_ENTRY("CaIconCache::~CaIconCache"); + mCache.clear(); + delete mNotifier; + CACLIENTTEST_FUNC_EXIT("CaIconCache::~CaIconCache"); +} + +/*! +Constructor + */ +CaIconCache::CaIconCache(QObject *parent): QObject(parent), + mCache(), mService(CaService::instance()), mNotifier(0) +{ + mCache.setMaxCost(maxCost); + CaNotifierFilter filter; + mNotifier = mService->createNotifier(filter); + connect(mNotifier, SIGNAL(entryChanged(const CaEntry &,ChangeType)), + this, SLOT(remove(const CaEntry &,ChangeType))); + +} + +/*! + Checks if icon is already cached + \param entry an entry + \param size size of an icon + \retval true if icon exist in cache + + */ +bool CaIconCache::exist(const CaEntry &entry, const QSize &size) +{ + CACLIENTTEST_FUNC_ENTRY("CaIconCache::exist"); + bool result(false); + result = mCache.contains(key(entry,size)); + CACLIENTTEST_FUNC_EXIT("CaIconCache::exist"); + return result; +} + +/*! + Returns an icon from a cache + \param entry an entry + \param size size of an icon + \retval icon + + */ + +HbIcon CaIconCache::icon(const CaEntry &entry, const QSize &size) +{ + CACLIENTTEST_FUNC_ENTRY("CaIconCache::icon"); + HbIcon icon; + icon = *mCache.object(key(entry,size)); + CACLIENTTEST_FUNC_EXIT("CaIconCache::icon"); + return icon; +} + +/*! + Insert an icon to a cache + \param entry an entry + \param size size of an icon + \param icon icon to be cached + + */ +void CaIconCache::insert(const CaEntry &entry, const QSize &size, + const HbIcon &icon) +{ + CACLIENTTEST_FUNC_ENTRY("CaIconCache::insert"); + mCache.insert(key(entry,size),new HbIcon(icon)); + CACLIENTTEST_FUNC_EXIT("CaIconCache::insert"); +} + +/*! + Removes icon from a cache + \param entry an entry + \param changeTypa indicates if entry was updated, removed or added + */ +void CaIconCache::remove(const CaEntry &entry, ChangeType changeType) +{ + CACLIENTTEST_FUNC_ENTRY("CaIconCache::remove"); + if (changeType != AddChangeType) { + QString entryKey = key(entry); + entryKey.append(separator); + QList keys = mCache.keys(); + foreach(QString cacheKey,keys) { + if (cacheKey.contains(entryKey)) { + mCache.remove(cacheKey); + } + } + } + CACLIENTTEST_FUNC_EXIT("CaIconCache::remove"); +} + +/*! + Generates a key + \param entry an entry + \return key + */ + +QString CaIconCache::key(const CaEntry &entry, const QSize &size) +{ + QString key; + if (!entry.iconDescription().filename().isEmpty()) { + key.append(entry.iconDescription().filename()); + } else { + key.append(separator); + key.append(entry.id()); + } + if (size.isValid()) { + key.append(separator); + key.append(size.height()); + key.append(separator); + key.append(size.width()); + } + return key; +} diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/caicondescription.cpp --- a/contentstorage/caclient/src/caicondescription.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/src/caicondescription.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -248,7 +248,7 @@ Sets a file name. \param fileName file name */ -void CaIconDescriptionPrivate::setFileName(const QString& fileName) +void CaIconDescriptionPrivate::setFileName(const QString &fileName) { mFilename = fileName; } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/caitemmodel.cpp --- a/contentstorage/caclient/src/caitemmodel.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/src/caitemmodel.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -21,6 +21,7 @@ #include "caitemmodel_p.h" #include "canotifier.h" #include "canotifierfilter.h" +#include "caclienttest_global.h" // Constants const QSize defaultIconSize(30, 30); @@ -52,7 +53,7 @@ \param query query describing entries that should be present in a model. \param parent parent of a model */ -CaItemModel::CaItemModel(const CaQuery& query, QObject * parent) : +CaItemModel::CaItemModel(const CaQuery &query, QObject *parent) : QAbstractItemModel(parent), m_d(new CaItemModelPrivate(query, this)) { @@ -122,7 +123,7 @@ */ QModelIndex CaItemModel::index(int row, int column, - const QModelIndex &parent) const + const QModelIndex &parent) const { Q_UNUSED(column); Q_UNUSED(parent); @@ -263,7 +264,7 @@ */ void CaItemModel::setSort(SortAttribute sortAttribute, - Qt::SortOrder sortOrder) + Qt::SortOrder sortOrder) { m_d->setSort(sortAttribute, sortOrder); } @@ -330,6 +331,44 @@ } /*! + Sets flags to mQuery which should be enabled. + This method does not update current model - only mQuery member. + Now to do this setParentId have to be invoke. + \param onFlags flags. + + \code + ... + // to set a flags enabled + model->setFlagsOn(RemovableEntryFlag); + ... + \endcode + + */ +void CaItemModel::setFlagsOn(const EntryFlags &onFlags) +{ + m_d->setFlagsOn(onFlags); +} + +/*! + Sets flags to mQuery which should be disabled. + This method does not update current model - only mQuery member. + Now to do this setParentId have to be invoke. + \param offFlags flags. + + \code + ... + // to set a flags disabled + model->setFlagsOff(RemovableEntryFlag); + ... + \endcode + + */ +void CaItemModel::setFlagsOff(const EntryFlags &offFlags) +{ + m_d->setFlagsOff(offFlags); +} + +/*! Returns an entry from model \param index of entry in model \retval pointer to an entry @@ -343,7 +382,7 @@ \endcode */ -CaEntry* CaItemModel::entry(const QModelIndex &index) const +CaEntry *CaItemModel::entry(const QModelIndex &index) const { return m_d->entry(index); } @@ -354,7 +393,7 @@ \param pointer to public implementation object connected */ CaItemModelPrivate::CaItemModelPrivate(const CaQuery &query, - CaItemModel *itemModelPublic) : + CaItemModel *itemModelPublic) : QObject(), m_q(itemModelPublic), mParentEntry(0), mQuery(query), mService(CaService::instance()), mEntries(mService), mNotifier(NULL), mSize(defaultIconSize), mSecondLineVisibility(true) @@ -403,27 +442,36 @@ \retval models data as QVariant */ QVariant CaItemModelPrivate::data(const QModelIndex &modelIndex, - int role) const + int role) const { - if (!modelIndex.isValid()) - return QVariant(); - - switch (role) { - case Qt::DisplayRole: - return displayRole(modelIndex); - case Qt::DecorationRole: - return QVariant(HbIcon(entry(modelIndex)->makeIcon(mSize))); - case CaItemModel::IdRole: - return QVariant(entry(modelIndex)->id()); - case CaItemModel::TypeRole: - return QVariant(entry(modelIndex)->entryTypeName()); - case CaItemModel::FlagsRole: - return qVariantFromValue(entry(modelIndex)->flags()); - case CaItemModel::TextRole: - return QVariant(entry(modelIndex)->text()); - default: - return QVariant(QVariant::Invalid); + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::data"); + QVariant variant; + if (modelIndex.isValid()) { + switch (role) { + case Qt::DisplayRole: + variant = displayRole(modelIndex); + break; + case Qt::DecorationRole: + variant = QVariant(HbIcon(entry(modelIndex)->makeIcon(mSize))); + break; + case CaItemModel::IdRole: + variant = QVariant(entry(modelIndex)->id()); + break; + case CaItemModel::TypeRole: + variant = QVariant(entry(modelIndex)->entryTypeName()); + break; + case CaItemModel::FlagsRole: + variant = qVariantFromValue(entry(modelIndex)->flags()); + break; + case CaItemModel::TextRole: + variant = QVariant(entry(modelIndex)->text()); + break; + default: + variant = QVariant(QVariant::Invalid); + } } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::data"); + return variant; } /*! @@ -432,6 +480,7 @@ */ void CaItemModelPrivate::setAutoUpdate(bool autoUpdate) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::setAutoUpdate"); if (autoUpdate) { if (!mNotifier) { CaNotifierFilter filter(mQuery); @@ -443,6 +492,7 @@ delete mNotifier; mNotifier = NULL; } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::setAutoUpdate"); } /*! @@ -451,10 +501,12 @@ \param sortOrder sorting order (SortAttribute) */ void CaItemModelPrivate::setSort(SortAttribute sortAttribute, - Qt::SortOrder sortOrder) + Qt::SortOrder sortOrder) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::setSort"); mQuery.setSort(sortAttribute, sortOrder); updateLayout(); + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::setSort"); } /*! @@ -498,7 +550,7 @@ \param modelIndex index of entry in model \retval pointer to an entry */ -CaEntry* CaItemModelPrivate::entry(const QModelIndex &modelIndex) const +CaEntry *CaItemModelPrivate::entry(const QModelIndex &modelIndex) const { if (modelIndex.column() == 1) { return mParentEntry; @@ -536,6 +588,8 @@ */ QVariant CaItemModelPrivate::displayRole(const QModelIndex &modelIndex) const { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::displayRole") + QVariant result; if (mSecondLineVisibility) { if (entry(modelIndex)->description().isEmpty()) { @@ -549,6 +603,7 @@ } else { result = entry(modelIndex)->text(); } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::displayRole") return result; } @@ -558,6 +613,7 @@ */ void CaItemModelPrivate::setParentId(int parentId) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::setParentId"); mQuery.setParentId(parentId); if (mNotifier) { delete mNotifier; @@ -565,8 +621,36 @@ reconnectSlots(); } updateModel(); + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::setParentId"); + +} + +/*! + Sets flags to mQuery which should be enabled. + \param onFlags flags. + + */ +void CaItemModelPrivate::setFlagsOn(const EntryFlags &onFlags) +{ + mQuery.setFlagsOn(onFlags); } +/*! + Sets flags to mQuery which should be disabled. + \param offFlags flags. + + \code + ... + // to set a new parent id + model->setFlagsOff(RemovableEntryFlag); + ... + \endcode + + */ +void CaItemModelPrivate::setFlagsOff(const EntryFlags &offFlags) +{ + mQuery.setFlagsOff(offFlags); +} /*! Checks if notifier exists @@ -586,9 +670,13 @@ */ void CaItemModelPrivate::updateModel() { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModel"); + mEntries.reloadEntries(mQuery); updateParentEntry(); m_q->reset(); + + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModel"); } /*! @@ -596,10 +684,15 @@ */ void CaItemModelPrivate::updateParentEntry() { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateParentEntry"); + if (mQuery.parentId()) { delete mParentEntry; mParentEntry = mService->getEntry(mQuery.parentId()); } + + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateParentEntry"); + } /*! @@ -608,13 +701,15 @@ */ void CaItemModelPrivate::updateItemData(int id) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateItemData"); + mEntries.updateEntry(id); QList ids = mService->getEntryIds(mQuery); if (mEntries.indexOf(id) >= 0 && ids.indexOf(id) - == mEntries.indexOf(id)) { + == mEntries.indexOf(id)) { emit m_q->dataChanged(index(mEntries.indexOf(id)), index( - mEntries.indexOf(id))); + mEntries.indexOf(id))); } else { if (mParentEntry && id == mParentEntry->id()) { updateParentEntry(); @@ -623,6 +718,7 @@ updateLayout(); } } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateItemData"); } /*! @@ -631,6 +727,8 @@ */ void CaItemModelPrivate::addItem(int id) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::addItem"); + int row = itemRow(id); //we use beginInsertRows and endInsertRows to emit proper signal //(see Qt documentation of QAbstractItemModel) @@ -639,6 +737,7 @@ mEntries.insert(row, id); m_q->endInsertRows(); } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::addItem"); } /*! @@ -647,21 +746,26 @@ */ void CaItemModelPrivate::handleAddItems(QList &itemsList) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::handleAddItems"); + int entriesCount = mEntries.count(); if (entriesCount) { int lastRow = itemsList.indexOf(mEntries[entriesCount - 1]); if (itemsList.count() == entriesCount && lastRow == (entriesCount - - 1)) { + - 1)) { //count is same and last item is in same position //so we update whole model updateModel(); } else if ((itemsList.count() - entriesCount) == 1 && lastRow - == entriesCount) { + == entriesCount) { //just one item added - collection int i = 0; for (i = 0; i < entriesCount; i++) { if (itemsList[i] != mEntries[i]) { addItem(itemsList[i]); + updateLayout(); + emit m_q->scrollTo(i, + QAbstractItemView::PositionAtTop); } } while (i < itemsList.count()) { @@ -676,11 +780,12 @@ //some items were added updateLayout(); emit m_q->scrollTo(lastRow + 1, - QAbstractItemView::PositionAtTop); + QAbstractItemView::PositionAtTop); } } else { updateModel(); } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::handleAddItems"); } /*! @@ -690,7 +795,9 @@ */ int CaItemModelPrivate::itemRow(int id) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::itemRow"); QList ids = mService->getEntryIds(mQuery); + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::itemRow"); return ids.indexOf(id); } @@ -700,13 +807,18 @@ */ void CaItemModelPrivate::removeItem(int id) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::removeItem"); int row = mEntries.indexOf(id); if (row >= 0) { m_q->beginRemoveRows(QModelIndex(), mEntries.indexOf(id), - mEntries.indexOf(id)); + mEntries.indexOf(id)); mEntries.remove(id); m_q->endRemoveRows(); + } else { + updateLayout(); } + + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::removeItem"); } /*! @@ -715,6 +827,7 @@ */ void CaItemModelPrivate::removeItems(const QList &itemsList) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::removeItems"); int i = 0; for (i = 0; i < itemsList.count(); i++) { if (itemsList[i] != mEntries[i]) { @@ -725,6 +838,7 @@ removeItem(mEntries[i]); i++; } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::removeItems"); } /*! @@ -732,10 +846,12 @@ */ void CaItemModelPrivate::updateLayout() { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateLayout"); m_q->layoutAboutToBeChanged(); mEntries.updateEntries(mQuery); updateParentEntry(); m_q->layoutChanged(); + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateLayout"); } /*! @@ -743,13 +859,15 @@ */ void CaItemModelPrivate::connectSlots() { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::connectSlots"); connect(mNotifier, SIGNAL(entryChanged(int,ChangeType)), - this, SLOT(updateModelItem(int,ChangeType)) ); + this, SLOT(updateModelItem(int,ChangeType))); if (mQuery.parentId() > 0) { connect(mNotifier, SIGNAL(groupContentChanged(int)), - this, SLOT(updateModelContent(int)) ); + this, SLOT(updateModelContent(int))); } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::connectSlots"); } /*! @@ -757,12 +875,14 @@ */ void CaItemModelPrivate::disconnectSlots() { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::disconnectSlots"); disconnect(mNotifier, SIGNAL(entryChanged(int,ChangeType)), - this, SLOT(updateModelItem(int,ChangeType)) ); + this, SLOT(updateModelItem(int,ChangeType))); if (mQuery.parentId() > 0) { disconnect(mNotifier, SIGNAL(groupContentChanged(int)), - this, SLOT(updateModelContent(int)) ); + this, SLOT(updateModelContent(int))); } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::disconnectSlots"); } /*! @@ -770,8 +890,10 @@ */ void CaItemModelPrivate::reconnectSlots() { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::reconnectSlots"); disconnectSlots(); connectSlots(); + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::reconnectSlots"); } /*! @@ -781,6 +903,7 @@ */ void CaItemModelPrivate::updateModelItem(int id, ChangeType changeType) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelItem"); switch (changeType) { case AddChangeType: addItem(id); @@ -792,6 +915,7 @@ updateItemData(id); break; } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelItem"); } /*! @@ -801,7 +925,7 @@ void CaItemModelPrivate::updateModelContent(int id) { Q_UNUSED(id); - + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelContent"); QList ids = mService->getEntryIds(mQuery); if (ids.count() >= mEntries.count()) { @@ -809,4 +933,5 @@ } else { removeItems(ids); } + CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelContent"); } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/caitemmodellist.cpp --- a/contentstorage/caclient/src/caitemmodellist.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/src/caitemmodellist.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -21,6 +21,7 @@ #include "caitemmodel_p.h" #include "canotifier.h" #include "canotifierfilter.h" +#include "caclienttest_global.h" // ======== MEMBER FUNCTIONS ======== @@ -46,9 +47,11 @@ */ void CaItemModelList::clear() { + CACLIENTTEST_FUNC_ENTRY("CaItemModelList::clear"); mOrderedList.clear(); qDeleteAll(mEntriesHash); mEntriesHash.clear(); + CACLIENTTEST_FUNC_EXIT("CaItemModelList::clear"); } /*! @@ -77,14 +80,16 @@ */ void CaItemModelList::reloadEntries(const CaQuery &query) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelList::reloadEntries"); clear(); int id=0; - QList eList = mService->getEntries(query); + QList eList = mService->getEntries(query); for (int i = 0; i < eList.count(); i++) { id = eList[i]->id(); mOrderedList << id; mEntriesHash.insert(id, eList[i]); } + CACLIENTTEST_FUNC_EXIT("CaItemModelList::reloadEntries"); } /*! @@ -93,10 +98,12 @@ */ void CaItemModelList::updateEntry(int id) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelList::updateEntry"); if (mEntriesHash.contains(id)) { delete mEntriesHash.take(id); mEntriesHash.insert(id, mService->getEntry(id)); } + CACLIENTTEST_FUNC_EXIT("CaItemModelList::updateEntry"); } /*! @@ -105,13 +112,15 @@ */ void CaItemModelList::updateEntries(const CaQuery &query) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelList::updateEntries"); mOrderedList = mService->getEntryIds(query); for (int i = 0; i < mOrderedList.count(); i++) { if (!mEntriesHash.contains(mOrderedList[i])) { mEntriesHash.insert(mOrderedList[i], mService->getEntry( - mOrderedList[i])); + mOrderedList[i])); } } + CACLIENTTEST_FUNC_EXIT("CaItemModelList::updateEntries"); } /*! @@ -132,8 +141,10 @@ */ void CaItemModelList::insert(int row, int id) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelList::insert"); mOrderedList.insert(row, id); mEntriesHash.insert(id, mService->getEntry(id)); + CACLIENTTEST_FUNC_EXIT("CaItemModelList::insert"); } /*! @@ -142,10 +153,12 @@ */ void CaItemModelList::remove(int id) { + CACLIENTTEST_FUNC_ENTRY("CaItemModelList::remove"); if (mEntriesHash.contains(id)) { delete mEntriesHash.take(id); } mOrderedList.removeOne(id); + CACLIENTTEST_FUNC_EXIT("CaItemModelList::remove"); } /*! diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/canotifier.cpp --- a/contentstorage/caclient/src/canotifier.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/src/canotifier.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -92,7 +92,7 @@ Constructor. \param entryPrivate pointer to private implementation. */ -CaNotifier::CaNotifier(CaNotifierPrivate * const notifierPrivate) : +CaNotifier::CaNotifier(CaNotifierPrivate *const notifierPrivate) : QObject(0), m_d(notifierPrivate) { m_d->m_q = this; @@ -118,31 +118,28 @@ qDebug("CaNotifier::connectNotify"); qDebug("\tsignal: %s", signal); if (QLatin1String(signal) - == SIGNAL(entryChanged(int,ChangeType))) { - // signal is entryChanged(int, ChangeType) + == SIGNAL(entryChanged(int,ChangeType))) { + // signal is entryChanged(int, ChangeType) if (receivers(SIGNAL(entryChanged(int,ChangeType))) == 1) { m_d->registerNotifier( CaNotifierPrivate::EntryChangedWithIdNotifierType); } - } - else if (QLatin1String(signal) - == SIGNAL(entryChanged(CaEntry,ChangeType))) { + } else if (QLatin1String(signal) + == SIGNAL(entryChanged(CaEntry,ChangeType))) { // signal is entryChanged(const CaEntry &, ChangeType) if (receivers(SIGNAL(entryChanged(const CaEntry &,ChangeType))) == 1) { m_d->registerNotifier( CaNotifierPrivate::EntryChangedWithEntryNotifierType); } - } - else if (QLatin1String(signal) - == SIGNAL(entryTouched(int))) { + } else if (QLatin1String(signal) + == SIGNAL(entryTouched(int))) { // signal is entryTouched(int) if (receivers(SIGNAL(entryTouched(int)))) { m_d->registerNotifier( CaNotifierPrivate::EntryTouchedNotifierType); } - } - else if (QLatin1String(signal) - == SIGNAL(groupContentChanged(int))) { + } else if (QLatin1String(signal) + == SIGNAL(groupContentChanged(int))) { // signal is groupContentChanged(int) if (receivers(SIGNAL(groupContentChanged(int)))) { m_d->registerNotifier( @@ -161,31 +158,28 @@ qDebug("CaNotifier::disconnectNotify"); qDebug("\tsignal: %s", signal); if (QLatin1String(signal) - == SIGNAL(entryChanged(int,ChangeType))) { - // signal is entryChanged(int, ChangeType) - if(receivers(SIGNAL(entryChanged(int,ChangeType)))==0) { + == SIGNAL(entryChanged(int,ChangeType))) { + // signal is entryChanged(int, ChangeType) + if (receivers(SIGNAL(entryChanged(int,ChangeType)))==0) { m_d->unregisterNotifier( CaNotifierPrivate::EntryChangedWithIdNotifierType); } - } - else if (QLatin1String(signal) - == SIGNAL(entryChanged(CaEntry,ChangeType))) { + } else if (QLatin1String(signal) + == SIGNAL(entryChanged(CaEntry,ChangeType))) { // signal is entryChanged(const CaEntry &, ChangeType) if (receivers(SIGNAL(entryChanged(const CaEntry &,ChangeType)))==0) { m_d->unregisterNotifier( CaNotifierPrivate::EntryChangedWithEntryNotifierType); } - } - else if (QLatin1String(signal) - == SIGNAL(entryTouched(int))) { + } else if (QLatin1String(signal) + == SIGNAL(entryTouched(int))) { // signal is entryTouched(int) if (receivers(SIGNAL(entryTouched(int))) == 0) { m_d->unregisterNotifier( CaNotifierPrivate::EntryTouchedNotifierType); } - } - else if (QLatin1String(signal) - == SIGNAL(groupContentChanged(int))) { + } else if (QLatin1String(signal) + == SIGNAL(groupContentChanged(int))) { // signal is groupContentChanged(int) if (receivers(SIGNAL(groupContentChanged(int))) == 0) { m_d->unregisterNotifier( @@ -204,7 +198,7 @@ mNotifierFilter(NULL), mNotifierProxy(NULL) { - mNotifierFilter = new CaNotifierFilter(notifierFilter); + mNotifierFilter = new CaNotifierFilter(notifierFilter); } /*! @@ -214,13 +208,13 @@ { if (mNotifierProxy) { mNotifierProxy->unregisterNotifier(*mNotifierFilter, - EntryChangedWithIdNotifierType); + EntryChangedWithIdNotifierType); mNotifierProxy->unregisterNotifier(*mNotifierFilter, - EntryChangedWithEntryNotifierType); + EntryChangedWithEntryNotifierType); mNotifierProxy->unregisterNotifier(*mNotifierFilter, - EntryTouchedNotifierType); + EntryTouchedNotifierType); mNotifierProxy->unregisterNotifier(*mNotifierFilter, - GroupContentChangedNotifierType); + GroupContentChangedNotifierType); } delete mNotifierFilter; delete mNotifierProxy; @@ -233,9 +227,9 @@ { if (mNotifierProxy) { return mNotifierProxy->registerNotifier( - mNotifierFilter, - notifierType, - mNotifierProxy); + mNotifierFilter, + notifierType, + mNotifierProxy); } return 0; } @@ -261,21 +255,21 @@ mNotifierProxy = new CaClientNotifierProxy(); } m_q->connect(mNotifierProxy, - SIGNAL(signalEntryChanged(int,ChangeType)), - m_q, - SIGNAL(entryChanged(int,ChangeType))); + SIGNAL(signalEntryChanged(int,ChangeType)), + m_q, + SIGNAL(entryChanged(int,ChangeType))); m_q->connect(mNotifierProxy, - SIGNAL(signalEntryChanged(const CaEntry &,ChangeType)), - m_q, - SIGNAL(entryChanged(const CaEntry &,ChangeType))); + SIGNAL(signalEntryChanged(const CaEntry &,ChangeType)), + m_q, + SIGNAL(entryChanged(const CaEntry &,ChangeType))); m_q->connect(mNotifierProxy, - SIGNAL(signalEntryTouched(int)), - m_q, - SIGNAL(entryTouched(int))); + SIGNAL(signalEntryTouched(int)), + m_q, + SIGNAL(entryTouched(int))); m_q->connect(mNotifierProxy, - SIGNAL(signalGroupContentChanged(int)), - m_q, - SIGNAL(groupContentChanged(int))); + SIGNAL(signalGroupContentChanged(int)), + m_q, + SIGNAL(groupContentChanged(int))); } } /*! @@ -285,20 +279,20 @@ { if (m_q && mNotifierProxy) { m_q->disconnect(mNotifierProxy, - SIGNAL(signalEntryChanged(int,ChangeType)), - m_q, - SIGNAL(entryChanged(int,ChangeType))); + SIGNAL(signalEntryChanged(int,ChangeType)), + m_q, + SIGNAL(entryChanged(int,ChangeType))); m_q->disconnect(mNotifierProxy, - SIGNAL( signalEntryChanged(const CaEntry &,ChangeType)), - m_q, - SIGNAL(entryChanged(const CaEntry &,ChangeType))); + SIGNAL(signalEntryChanged(const CaEntry &,ChangeType)), + m_q, + SIGNAL(entryChanged(const CaEntry &,ChangeType))); m_q->disconnect(mNotifierProxy, - SIGNAL(signalEntryTouched(int)), - m_q, - SIGNAL(entryTouched(int))); + SIGNAL(signalEntryTouched(int)), + m_q, + SIGNAL(entryTouched(int))); m_q->disconnect(mNotifierProxy, - SIGNAL(signalGroupContentChanged(int)), - m_q, - SIGNAL(groupContentChanged(int))); + SIGNAL(signalGroupContentChanged(int)), + m_q, + SIGNAL(groupContentChanged(int))); } } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/caquery.cpp --- a/contentstorage/caclient/src/caquery.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/src/caquery.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -160,7 +160,7 @@ Sets flags which should be enabled. \param onFlags flags. */ -void CaQuery::setFlagsOn(EntryFlags onFlags) +void CaQuery::setFlagsOn(const EntryFlags &onFlags) { m_d->setFlagsOn(onFlags); } @@ -178,7 +178,7 @@ Sets flags which should be disabled. \param offFlags flags. */ -void CaQuery::setFlagsOff(EntryFlags offFlags) +void CaQuery::setFlagsOff(const EntryFlags &offFlags) { m_d->setFlagsOff(offFlags); } @@ -207,8 +207,8 @@ \param[out] sortAttribute enum describing what is taken into account to sort. \param[out] sortOrder sort order (ascending, descending). */ -void CaQuery::getSort(SortAttribute& sortAttribute, - Qt::SortOrder& sortOrder) const +void CaQuery::getSort(SortAttribute &sortAttribute, + Qt::SortOrder &sortOrder) const { m_d->getSort(sortAttribute, sortOrder); } @@ -347,7 +347,7 @@ Sets flags which should be enabled. \param onFlags flags. */ -void CaQueryPrivate::setFlagsOn(EntryFlags onFlags) +void CaQueryPrivate::setFlagsOn(const EntryFlags &onFlags) { mFlagsOn = onFlags; } @@ -365,7 +365,7 @@ Sets flags which should be disabled. \param offFlags flags. */ -void CaQueryPrivate::setFlagsOff(EntryFlags offFlags) +void CaQueryPrivate::setFlagsOff(const EntryFlags &offFlags) { mFlagsOff = offFlags; } @@ -385,7 +385,7 @@ \param[out] sortOrder sort order (ascending, descending). */ void CaQueryPrivate::getSort(SortAttribute &sortAttribute, - Qt::SortOrder &sortOrder) const + Qt::SortOrder &sortOrder) const { sortAttribute = mSortAttribute; sortOrder = mSortOrder; @@ -397,7 +397,7 @@ \param sortOrder sort order (ascending, descending). */ void CaQueryPrivate::setSort(SortAttribute sortAttribute, - Qt::SortOrder sortOrder) + Qt::SortOrder sortOrder) { mSortAttribute = sortAttribute; mSortOrder = sortOrder; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/src/caservice.cpp --- a/contentstorage/caclient/src/caservice.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/src/caservice.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -30,6 +30,7 @@ #include "caclientproxy.h" #include "caobjectadapter.h" +#include "caclienttest_global.h" // ======== MEMBER FUNCTIONS ======== @@ -102,15 +103,14 @@ \endcode */ -CaEntry * CaService::getEntry(int entryId) const +CaEntry *CaService::getEntry(int entryId) const { QList entries = getEntries(QList () << entryId); if (entries.count()) { // there should be exactly one entry with specified ID if present Q_ASSERT(entries.count() == 1); return entries[0]; - } - else { + } else { return NULL; } } @@ -216,7 +216,7 @@ ... \endcode */ -CaEntry * CaService::createEntry(const CaEntry &entry) const +CaEntry *CaService::createEntry(const CaEntry &entry) const { return m_d->createEntry(entry); } @@ -294,8 +294,8 @@ QList idList; CaEntry *entry(NULL); foreach(entry, entryList) { - idList << entry->id(); - } + idList << entry->id(); + } return removeEntries(idList); } @@ -358,10 +358,10 @@ \endcode */ bool CaService::insertEntryIntoGroup(int groupId, int entryId, - int beforeEntryId) const + int beforeEntryId) const { return insertEntriesIntoGroup(groupId, QList () << entryId, - beforeEntryId); + beforeEntryId); } /*! @@ -386,7 +386,7 @@ \endcode */ bool CaService::insertEntryIntoGroup(const CaEntry &group, - const CaEntry &entry, int beforeEntryId) const + const CaEntry &entry, int beforeEntryId) const { return insertEntryIntoGroup(group.id(), entry.id(), beforeEntryId); } @@ -414,17 +414,16 @@ \endcode */ bool CaService::insertEntriesIntoGroup(int groupId, - const QList &entryIdList, int beforeEntryId) const + const QList &entryIdList, int beforeEntryId) const { if (beforeEntryId < 0) { qWarning( "CaService::insertEntriesIntoGroup: beforeEntryId cannot be negative: %d", beforeEntryId); return false; - } - else { + } else { return m_d->insertEntriesIntoGroup(groupId, entryIdList, - beforeEntryId); + beforeEntryId); } } @@ -450,13 +449,13 @@ \endcode */ bool CaService::insertEntriesIntoGroup(const CaEntry &group, - const QList &entryList, int beforeEntryId) const + const QList &entryList, int beforeEntryId) const { QList idList; CaEntry *entry(NULL); foreach(entry, entryList) { - idList << entry->id(); - } + idList << entry->id(); + } return insertEntriesIntoGroup(group.id(), idList, beforeEntryId); } @@ -508,7 +507,7 @@ \endcode */ bool CaService::removeEntryFromGroup(const CaEntry &group, - const CaEntry &entry) const + const CaEntry &entry) const { return removeEntryFromGroup(group.id(), entry.id()); } @@ -536,7 +535,7 @@ \endcode */ bool CaService::removeEntriesFromGroup(int groupId, - const QList &entryIdList) const + const QList &entryIdList) const { return m_d->removeEntriesFromGroup(groupId, entryIdList); } @@ -564,13 +563,13 @@ \endcode */ bool CaService::removeEntriesFromGroup(const CaEntry &group, - const QList &entryList) const + const QList &entryList) const { QList idList; CaEntry *entry(NULL); foreach(entry, entryList) { - idList << entry->id(); - } + idList << entry->id(); + } return removeEntriesFromGroup(group.id(), idList); } @@ -579,7 +578,7 @@ \param entry to be touched \retval boolean with result of operation */ -bool CaServicePrivate::touch(const CaEntry& entry) +bool CaServicePrivate::touch(const CaEntry &entry) { qDebug() << "CaServicePrivate::touch" << "entryId: " << entry.id(); @@ -636,7 +635,7 @@ \endcode */ bool CaService::appendEntryToGroup(const CaEntry &group, - const CaEntry &entry) const + const CaEntry &entry) const { return appendEntryToGroup(group.id(), entry.id()); } @@ -663,7 +662,7 @@ \endcode */ bool CaService::appendEntriesToGroup(int groupId, - const QList &entryIdList) const + const QList &entryIdList) const { return m_d->appendEntriesToGroup(groupId, entryIdList); } @@ -689,13 +688,13 @@ \endcode */ bool CaService::appendEntriesToGroup(const CaEntry &group, - const QList &entryList) const + const QList &entryList) const { QList idList; CaEntry *entry(NULL); foreach(entry, entryList) { - idList << entry->id(); - } + idList << entry->id(); + } return appendEntriesToGroup(group.id(), idList); } @@ -745,7 +744,7 @@ \endcode */ bool CaService::prependEntryToGroup(const CaEntry &group, - const CaEntry &entry) const + const CaEntry &entry) const { return prependEntryToGroup(group.id(), entry.id()); } @@ -772,7 +771,7 @@ \endcode */ bool CaService::prependEntriesToGroup(int groupId, - const QList &entryIdList) const + const QList &entryIdList) const { return m_d->prependEntriesToGroup(groupId, entryIdList); } @@ -798,13 +797,13 @@ \endcode */ bool CaService::prependEntriesToGroup(const CaEntry &group, - const QList &entryList) const + const QList &entryList) const { QList idList; CaEntry *entry(NULL); foreach(entry, entryList) { - idList << entry->id(); - } + idList << entry->id(); + } return prependEntriesToGroup(group.id(), idList); } @@ -882,7 +881,7 @@ ... \endcode */ -CaNotifier * CaService::createNotifier(const CaNotifierFilter &filter) const +CaNotifier *CaService::createNotifier(const CaNotifierFilter &filter) const { return m_d->createNotifier(filter); } @@ -941,7 +940,7 @@ const ErrorCode connectionResult = mProxy->connect(); USE_QWARNING_IF(connectionResult) - << "CaServicePrivate::CaServicePrivate - unable to connect proxy"; + << "CaServicePrivate::CaServicePrivate - unable to connect proxy"; mErrorCode = connectionResult; } @@ -959,24 +958,27 @@ \param entryIdList list of entry ids \retval list of entries (pointers) */ -QList CaServicePrivate::getEntries(const QList &entryIdList) const +QList CaServicePrivate::getEntries(const QList &entryIdList) const { qDebug() << "CaServicePrivate::getEntries" - << "entryIdList:" << entryIdList; + << "entryIdList:" << entryIdList; - QList resultList; + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::getEntries"); + + QList resultList; mErrorCode = mProxy->getData(entryIdList, resultList); // figure out whether all entries have been retrieved and // store the operation status if (mErrorCode == NoErrorCode - && entryIdList.count() != resultList.count()) { + && entryIdList.count() != resultList.count()) { mErrorCode = NotFoundErrorCode; } + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::getEntries"); qDebug() << "CaServicePrivate::getEntries mErrorCode:" - << mErrorCode; + << mErrorCode; return resultList; } @@ -986,9 +988,9 @@ \param query the query information to select specific entries. \param placeholder list of entries for a specific select. */ -QList CaServicePrivate::getEntries(const CaQuery &query) const +QList CaServicePrivate::getEntries(const CaQuery &query) const { - QList resultList; + QList resultList; mErrorCode = mProxy->getData(query, resultList); @@ -1004,12 +1006,12 @@ */ QList CaServicePrivate::getEntryIds(const CaQuery &query) const { + CACLIENTTEST_FUNC_ENTRY("CaItemModelList::getEntryIds"); + QList resultList; - mErrorCode = mProxy->getEntryIds(query, resultList); - + CACLIENTTEST_FUNC_EXIT("CaItemModelList::getEntryIds"); qDebug() << "CaServicePrivate::getEntryIds mErrorCode:" << mErrorCode; - return resultList; } @@ -1018,12 +1020,14 @@ \param query const reference to entry to copy \retval pointer to newely created copy */ -CaEntry* CaServicePrivate::createEntry(const CaEntry &entry) +CaEntry *CaServicePrivate::createEntry(const CaEntry &entry) { qDebug() << "CaServicePrivate::createEntry" - << "entry id:" << entry.id(); + << "entry id:" << entry.id(); - CaEntry* newEntry = NULL; + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::createEntry"); + + CaEntry *newEntry = NULL; ErrorCode addDataResult = NoErrorCode; try { @@ -1037,9 +1041,7 @@ addDataResult = mProxy->addData(*entryClone, *newEntry); - } - catch(const std::bad_alloc&) - { + } catch (const std::bad_alloc &) { addDataResult = OutOfMemoryErrorCode; } @@ -1052,6 +1054,8 @@ qDebug() << "CaServicePrivate::createEntry mErrorCode:" << mErrorCode; + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::createEntry"); + return newEntry; } @@ -1063,7 +1067,9 @@ bool CaServicePrivate::updateEntry(const CaEntry &entry) { qDebug() << "CaServicePrivate::updateEntry" - << "entry id:" << entry.id(); + << "entry id:" << entry.id(); + + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::updateEntry"); ErrorCode updateEntryResult = UnknownErrorCode; @@ -1073,9 +1079,7 @@ updateEntryResult = mProxy->addData(entry, *updatedEntry); - } - catch(const std::bad_alloc&) - { + } catch (const std::bad_alloc &) { updateEntryResult = OutOfMemoryErrorCode; } } @@ -1083,7 +1087,8 @@ mErrorCode = updateEntryResult; qDebug() << "CaServicePrivate::updateEntry mErrorCode on return:" - << mErrorCode; + << mErrorCode; + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::updateEntry"); return (updateEntryResult == NoErrorCode); } @@ -1096,12 +1101,16 @@ bool CaServicePrivate::removeEntries(const QList &entryIdList) { qDebug() << "CaServicePrivate::removeEntries" - << "entryIdList: " << entryIdList; + << "entryIdList: " << entryIdList; + + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::removeEntries"); mErrorCode = mProxy->removeData(entryIdList); qDebug() << "CaServicePrivate::removeEntries mErrorCode:" << mErrorCode; + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::removeEntries"); + return (mErrorCode == NoErrorCode); } @@ -1118,13 +1127,17 @@ int beforeEntryId) // all others are convenience methods implemented in terms of this one { qDebug() << "CaServicePrivate::insertEntriesIntoGroup" - << "groupId: " << groupId << " beforeEntryId: " << beforeEntryId - << "entryIdList: " << entryIdList; + << "groupId: " << groupId << " beforeEntryId: " << beforeEntryId + << "entryIdList: " << entryIdList; + + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::insertEntriesIntoGroup"); mErrorCode = mProxy->insertEntriesIntoGroup(groupId, entryIdList, beforeEntryId); qDebug() << "CaServicePrivate::insertEntriesIntoGroup mErrorCode:" - << mErrorCode; + << mErrorCode; + + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::insertEntriesIntoGroup"); return (mErrorCode == NoErrorCode); } @@ -1141,12 +1154,16 @@ const QList &entryIdList) { qDebug() << "CaServicePrivate::removeEntriesFromGroup" - << "groupId: " << groupId << "entryIdList" << entryIdList; + << "groupId: " << groupId << "entryIdList" << entryIdList; + + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::removeEntriesFromGroup"); mErrorCode = mProxy->removeEntriesFromGroup(groupId, entryIdList); qDebug() << "CaServicePrivate::removeEntriesFromGroup mErrorCode:" - << mErrorCode; + << mErrorCode; + + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::removeEntriesFromGroup"); return (mErrorCode == NoErrorCode); } @@ -1162,15 +1179,19 @@ const QList &entryIdList) { qDebug() << "CaServicePrivate::appendEntriesToGroup" - << "groupId: " << groupId << "entryIdList: " << entryIdList; + << "groupId: " << groupId << "entryIdList: " << entryIdList; + + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::appendEntriesToGroup"); const bool result = insertEntriesIntoGroup( - groupId, - entryIdList, - CaClientProxy::AfterTheLastEntry); + groupId, + entryIdList, + CaClientProxy::AfterTheLastEntry); qDebug() << "CaServicePrivate::appendEntriesToGroup result:" - << QString(result ? "true" : "false"); + << QString(result ? "true" : "false"); + + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::appendEntriesToGroup"); return result; } @@ -1182,19 +1203,23 @@ \retval true if operation was successful. */ bool CaServicePrivate::prependEntriesToGroup(int groupId, - const QList &entryIdList) + const QList &entryIdList) { qDebug() << "CaServicePrivate::prependEntriesToGroup" - << "groupId: " << groupId << "entryIdList: " << entryIdList; + << "groupId: " << groupId << "entryIdList: " << entryIdList; + + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::prependEntriesToGroup"); const bool result = - insertEntriesIntoGroup( - groupId, - entryIdList, - CaClientProxy::BeforeTheFirstEntry); + insertEntriesIntoGroup( + groupId, + entryIdList, + CaClientProxy::BeforeTheFirstEntry); qDebug() << "CaServicePrivate::prependEntriesToGroup result:" - << QString(result ? "PASS" : "FAIL"); + << QString(result ? "PASS" : "FAIL"); + + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::prependEntriesToGroup"); return result; } @@ -1206,17 +1231,23 @@ \retval boolean which is used as an error code return value, true means positive result */ bool CaServicePrivate::executeCommand(const CaEntry &entry, - const QString &command) + const QString &command) { qDebug() << "CaServicePrivate::executeCommand" - << "entry id:" << entry.id() << "command:" << command; + << "entry id:" << entry.id() << "command:" << command; + + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::executeCommand"); - touch(entry); + if (command == caCmdOpen) { + touch(entry); + } mErrorCode = mProxy->executeCommand(entry, command); qDebug() << "CaServicePrivate::executeCommand mErrorCode on return:" - << mErrorCode; + << mErrorCode; + + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::executeCommand"); return (mErrorCode == NoErrorCode); } @@ -1226,7 +1257,7 @@ \param CaNotifierFilter which is used be new notifier \retval pointer to new Notifier */ -CaNotifier * CaServicePrivate::createNotifier(const CaNotifierFilter &filter) +CaNotifier *CaServicePrivate::createNotifier(const CaNotifierFilter &filter) { return new CaNotifier(new CaNotifierPrivate(filter)); } @@ -1240,7 +1271,12 @@ */ bool CaServicePrivate::customSort(int groupId, QList &entryIdList) { + CACLIENTTEST_FUNC_ENTRY("CaServicePrivate::customSort"); + mErrorCode = mProxy->customSort(entryIdList, groupId); + + CACLIENTTEST_FUNC_EXIT("CaServicePrivate::customSort"); + return (mErrorCode == NoErrorCode); } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/inc/caclientnotifierproxy.h --- a/contentstorage/caclient/stub/inc/caclientnotifierproxy.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/inc/caclientnotifierproxy.h Tue Mar 23 23:42:03 2010 +0200 @@ -41,7 +41,7 @@ * @param changeType change type. */ virtual void entryChanged(int entryId, - ChangeType changeType) const = 0; + ChangeType changeType) const = 0; /** * Method invoked when entry is changed. @@ -49,7 +49,7 @@ * @param changeType change type. */ virtual void entryChanged(const CaEntry &entry, - ChangeType changeType) const = 0; + ChangeType changeType) const = 0; /** * Method invoked when entry was changed. @@ -67,7 +67,7 @@ class CACLIENT_EXPORT CaClientNotifierProxy: public QObject { -Q_OBJECT + Q_OBJECT public: @@ -95,7 +95,7 @@ * @param changeType change type. */ virtual void entryChanged(const CaEntry &entry, - ChangeType changeType) const; + ChangeType changeType) const; /** * Method invoked when entry was changed. @@ -135,7 +135,7 @@ void signalEntryChanged(int entryId, ChangeType changeType) const; void signalEntryChanged(const CaEntry &entry, - ChangeType changeType) const; + ChangeType changeType) const; void signalEntryTouched(int id) const; void signalGroupContentChanged(int groupId) const; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/inc/caclientproxy.h --- a/contentstorage/caclient/stub/inc/caclientproxy.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/inc/caclientproxy.h Tue Mar 23 23:42:03 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * - * Description: + * Description: * */ @@ -38,8 +38,7 @@ /** * Insert into group type. */ - enum InsertType - { + enum InsertType { AfterTheLastEntry = -1, BeforeTheFirstEntry = 0 }; @@ -71,8 +70,8 @@ * @param targetEntry entry. * @return error code. */ - ErrorCode addData(const CaEntry& entryToAdd, - CaEntry& targetEntry); + ErrorCode addData(const CaEntry &entryToAdd, + CaEntry &targetEntry); /** * Method for removing entries. @@ -89,7 +88,7 @@ * @return error code. */ ErrorCode insertEntriesIntoGroup(int groupId, - const QList &entryIdList, int beforeEntryId); + const QList &entryIdList, int beforeEntryId); /** * Remove entries from group. @@ -100,8 +99,8 @@ * @return error code. */ ErrorCode removeEntriesFromGroup(int groupId, - const QList &entryIdList, - bool calledDirectly = true); + const QList &entryIdList, + bool calledDirectly = true); /** * Method for fetching entries. @@ -110,7 +109,7 @@ * @param sourceList List of results. * @return error code */ - ErrorCode getData(const QList& entryIdList, QList& sourceList); + ErrorCode getData(const QList& entryIdList, QList& sourceList); /** * Method for fetching entries. @@ -119,7 +118,7 @@ * @param sourceList List of results. * @return error code */ - ErrorCode getData(const CaQuery &query, QList& sourceList); + ErrorCode getData(const CaQuery &query, QList& sourceList); /** * Method for fetching entries. @@ -129,7 +128,7 @@ * @return error code */ ErrorCode getEntryIds(const CaQuery &query, - QList& sourceIdList); + QList& sourceIdList); /** * Method for executing command @@ -138,8 +137,8 @@ * @param command command to execute * @return error code */ - ErrorCode executeCommand(const CaEntry& entry, - const QString& command); + ErrorCode executeCommand(const CaEntry &entry, + const QString &command); /** * Method for touching entry. @@ -147,12 +146,12 @@ * @param entry entry to touch * @return error code */ - ErrorCode touch(const CaEntry& entry); - + ErrorCode touch(const CaEntry &entry); + /** * Method for custom sort. * @param entryIdList list of ids. - * @param groupId Group id. + * @param groupId Group id. * @return error code. */ ErrorCode customSort(const QList &entryIdList, int groupId); @@ -163,23 +162,23 @@ * @param parentIds a list of parent ids. * @return true if the operation is successful. */ - bool GetParentsIds( const QList &entryIds, - QList &parentIds); + bool GetParentsIds(const QList &entryIds, + QList &parentIds); private: bool hsWidgetExists(int uid); void addWidgetEntry(const HsWidgetToken &widgetToken); - - void modifyQueryForSortOrder(QString& queryString, - const CaQuery &query, bool parent) const; - bool setIconInDb(CaEntry* entryClone) const; - bool setEntryInDb(CaEntry* entryClone) const; - bool setAttributesInDb(CaEntry* entryClone) const; + + void modifyQueryForSortOrder(QString &queryString, + const CaQuery &query, bool parent) const; + bool setIconInDb(CaEntry *entryClone) const; + bool setEntryInDb(CaEntry *entryClone) const; + bool setAttributesInDb(CaEntry *entryClone) const; void CreateGetParentsIdsQuery( const QList &entryIds, const QList &parentIds, QString &query); - + private: QString mWidgetRegistryPath; }; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/inc/canotifiers.h --- a/contentstorage/caclient/stub/inc/canotifiers.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/inc/canotifiers.h Tue Mar 23 23:42:03 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * - * Description: + * Description: * */ @@ -30,27 +30,27 @@ { public: static int addNotifier(const CaNotifierFilter *notifierFilter, - CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy); + CaNotifierPrivate::NotifierType notifierType, + const CaClientNotifierProxy *notifierProxy); static void removeNotifier(const CaNotifierFilter *notifierFilter, - CaNotifierPrivate::NotifierType notifierType); + CaNotifierPrivate::NotifierType notifierType); static void Notify(int groupId); static void Notify(const CaEntry &targetEntry, - ChangeType changeType, - QList &parentIds); + ChangeType changeType, + QList &parentIds); private: static bool isRegisterdForNotification( const CaNotifierFilter &filter, const CaEntry &entry, const QList &parentIds); - + private: typedef QPair NotifierKey; + CaNotifierPrivate::NotifierType> NotifierKey; typedef QHash NotifierHash; private: diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/inc/caobjectadapter.h --- a/contentstorage/caclient/stub/inc/caobjectadapter.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/inc/caobjectadapter.h Tue Mar 23 23:42:03 2010 +0200 @@ -41,7 +41,7 @@ * @return QPixmap. */ static HbIcon makeIcon( - const CaEntry& entry, + const CaEntry &entry, const QSize &size); /** @@ -50,7 +50,7 @@ * @param id entry id. */ static void setId(CaEntry &entry, - int id); + int id); /** * Set icon description id. @@ -58,7 +58,7 @@ * @param id icon description id. */ static void setId(CaIconDescription &iconDescription, - int id); + int id); }; diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/inc/hswidgetregistryservice.h --- a/contentstorage/caclient/stub/inc/hswidgetregistryservice.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/inc/hswidgetregistryservice.h Tue Mar 23 23:42:03 2010 +0200 @@ -31,9 +31,9 @@ Q_OBJECT public: - + HsWidgetRegistryService(const QString &installationPath, - QObject *parent = 0); + QObject *parent = 0); virtual ~HsWidgetRegistryService(); @@ -62,7 +62,7 @@ friend class HsWidgetRegistryServicePrivate; }; -Q_DECLARE_METATYPE(HsWidgetRegistryService*) +Q_DECLARE_METATYPE(HsWidgetRegistryService *) #endif diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/inc/hswidgetregistryservice_p.h --- a/contentstorage/caclient/stub/inc/hswidgetregistryservice_p.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/inc/hswidgetregistryservice_p.h Tue Mar 23 23:42:03 2010 +0200 @@ -32,11 +32,11 @@ class HsWidgetRegistryServicePrivate : public QObject { Q_OBJECT - + public: - HsWidgetRegistryServicePrivate(const QString& installationPath, - HsWidgetRegistryService *ptrToPublic, QObject *parent=0); + HsWidgetRegistryServicePrivate(const QString &installationPath, + HsWidgetRegistryService *ptrToPublic, QObject *parent=0); ~HsWidgetRegistryServicePrivate(); @@ -45,19 +45,19 @@ private: Q_DISABLE_COPY(HsWidgetRegistryServicePrivate) - - IHsWidgetProvider* loadProviderFromPlugin(const QString &pluginName); + + IHsWidgetProvider *loadProviderFromPlugin(const QString &pluginName); QStringList readManifestDirectories(const QString &path); void doWidgetRemove(const QString &path, const QStringList &originalList, - const QStringList ¤tList); + const QStringList ¤tList); QList readManifestFile(const QString &path); void ensureWidgetRegistryPaths(); - -public slots: + +public slots: private slots: @@ -66,12 +66,12 @@ void installerStateChanged(int newValue); private: - - QString mInstallationPath; + + QString mInstallationPath; - QMap mManifestDirectories; + QMap mManifestDirectories; - HsWidgetRegistryService *mPublic; + HsWidgetRegistryService *mPublic; }; #endif //HSWIDGETREGISTRYSERVICE_P_H diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/src/caclientnotifierproxy.cpp --- a/contentstorage/caclient/stub/src/caclientnotifierproxy.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/src/caclientnotifierproxy.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -41,10 +41,10 @@ // //---------------------------------------------------------------------------- void CaClientNotifierProxy::entryChanged(int entryId, - ChangeType changeType) const + ChangeType changeType) const { qDebug() << "CaClientProxy::entryChanged entryId:" - << entryId << "changeType:" << changeType; + << entryId << "changeType:" << changeType; emit signalEntryChanged(entryId, changeType); } @@ -52,7 +52,7 @@ // //---------------------------------------------------------------------------- void CaClientNotifierProxy::entryChanged(const CaEntry &entry, - ChangeType changeType) const + ChangeType changeType) const { qDebug() << "CaClientProxy::entryChanged changeType:" << changeType; CaEntry *caEntry = new CaEntry(entry); @@ -86,7 +86,7 @@ const CaClientNotifierProxy *notifierProxy) { qDebug() << "CaClientProxy::registerNotifier notifierType:" - << notifierType; + << notifierType; QMutexLocker locker(&mMutex); return CaNotifiers::addNotifier(notifierFilter, notifierType, notifierProxy); } @@ -95,11 +95,11 @@ // //---------------------------------------------------------------------------- void CaClientNotifierProxy::unregisterNotifier( - const CaNotifierFilter ¬ifierFilter, - CaNotifierPrivate::NotifierType notifierType) + const CaNotifierFilter ¬ifierFilter, + CaNotifierPrivate::NotifierType notifierType) { qDebug() << "CaClientProxy::unregisterNotifier notifierType:" - << notifierType; + << notifierType; QMutexLocker locker(&mMutex); CaNotifiers::removeNotifier(¬ifierFilter, notifierType); } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/src/caclientproxy.cpp --- a/contentstorage/caclient/stub/src/caclientproxy.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/src/caclientproxy.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -34,9 +34,9 @@ #include "hswidgetregistryservice.h" -const char* DATABASE_CONNECTION_NAME = "CaService"; -const char* DATABASE_TYPE = "QSQLITE"; -const char* DATABASE_NAME = "castoragedb"; +const char *DATABASE_CONNECTION_NAME = "CaService"; +const char *DATABASE_TYPE = "QSQLITE"; +const char *DATABASE_NAME = "castoragedb"; static QSqlDatabase dbConnection() { @@ -70,7 +70,7 @@ { ErrorCode errorCode = NotFoundErrorCode; QSqlDatabase db = QSqlDatabase::addDatabase(DATABASE_TYPE, - DATABASE_CONNECTION_NAME); + DATABASE_CONNECTION_NAME); if (db.isValid()) { db.setDatabaseName(DATABASE_NAME); if (db.open()) { @@ -90,23 +90,23 @@ void CaClientProxy::updateWidgets() { qDebug("CaClientProxy::updateWidgets start"); - + HsWidgetRegistryService *rs = new HsWidgetRegistryService(mWidgetRegistryPath); QList widgets = rs->widgets(); - + // Read widgets in order to add synchronize the content of the widgets // registry with Content Storage database. - foreach (const HsWidgetToken &widgetToken, widgets) { + foreach(const HsWidgetToken &widgetToken, widgets) { int uid = widgetToken.mUid; - + if (!hsWidgetExists(uid)) { // The given widget does not have a corresonding entry // in the databse, so such an entry needs do be created. addWidgetEntry(widgetToken); } } - + delete rs; qDebug("CaClientProxy::updateWidgets end"); } @@ -127,71 +127,71 @@ QString hexUid; hexUid.setNum(uid,16); QDir currentDir = QDir::current(); - + // Add icon. QString queryAddIcon = "INSERT INTO CA_ICON " \ - "(IC_FILENAME) " \ + "(IC_FILENAME) " \ "VALUES " \ - "(?)"; + "(?)"; query.prepare(queryAddIcon); query.addBindValue(iconUri); query.exec(); qDebug() << query.executedQuery(); - + // Add entry. QString queryAddEntry = "INSERT INTO CA_ENTRY " \ - "(EN_TEXT, EN_DESCRIPTION, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID) " \ + "(EN_TEXT, EN_DESCRIPTION, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID) " \ "VALUES " \ - "(?, ?, 1, 'widget', last_insert_rowid())"; + "(?, ?, 1, 'widget', last_insert_rowid())"; - query.prepare(queryAddEntry); + query.prepare(queryAddEntry); query.addBindValue(title); query.addBindValue(description); query.exec(); qDebug() << query.executedQuery(); - - // Get last id + + // Get last id QString queryLastId = "SELECT last_insert_rowid() AS LAST_ID"; query.prepare(queryLastId); query.exec(); query.next(); int lastId = query.value(query.record().indexOf("LAST_ID")).toInt(); - + // Add attribute packageuid QString queryAddAttribute1 = "INSERT INTO CA_ATTRIBUTE " \ - "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \ + "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \ "VALUES " \ - "(?, 'packageuid', ?)"; + "(?, 'packageuid', ?)"; query.prepare(queryAddAttribute1); query.addBindValue(lastId); query.addBindValue(hexUid); query.exec(); qDebug() << query.executedQuery(); - + // Add attribute widget uri QString queryAddAttribute2 = "INSERT INTO CA_ATTRIBUTE " \ - "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \ + "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \ "VALUES " \ - "(?, 'widget:uri', ?)"; + "(?, 'widget:uri', ?)"; query.prepare(queryAddAttribute2); query.addBindValue(lastId); query.addBindValue(uri); query.exec(); qDebug() << query.executedQuery(); - + // Add attribute widget library QString queryAddAttribute3 = "INSERT INTO CA_ATTRIBUTE " \ - "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \ + "(AT_ENTRY_ID, AT_NAME, AT_VALUE) " \ "VALUES " \ - "(?, 'widget:library', ?)"; + "(?, 'widget:library', ?)"; query.prepare(queryAddAttribute3); query.addBindValue(lastId); @@ -208,20 +208,20 @@ bool exists(false); QSqlDatabase db = dbConnection(); QSqlQuery query(db); - QString hexUid; + QString hexUid; hexUid.setNum(uid,16); - + QString queryString = "SELECT " \ - "AT_ENTRY_ID " \ + "AT_ENTRY_ID " \ "FROM " \ - "CA_ATTRIBUTE " \ + "CA_ATTRIBUTE " \ "WHERE " \ - "AT_VALUE LIKE ?"; - + "AT_VALUE LIKE ?"; + query.prepare(queryString); query.addBindValue(hexUid); - + if (query.exec() && query.next()) { // Query returned a non empty result. exists = true; @@ -229,9 +229,9 @@ // The widget with the given uid was not found. exists = false; } - + qDebug() << query.executedQuery(); - + return exists; } @@ -239,10 +239,10 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::addData(const CaEntry &entryToAdd, - CaEntry &targetEntry) + CaEntry &targetEntry) { qDebug() << "CaClientProxy::addData" << "entry id: " - << entryToAdd.id(); + << entryToAdd.id(); targetEntry = entryToAdd; QSqlDatabase db = dbConnection(); @@ -252,8 +252,8 @@ } query.exec("begin"); bool success = (setIconInDb(&targetEntry) - && setEntryInDb(&targetEntry) - && setAttributesInDb(&targetEntry)); + && setEntryInDb(&targetEntry) + && setAttributesInDb(&targetEntry)); if (success) { query.exec("commit"); QList parentIds; @@ -276,12 +276,12 @@ ErrorCode CaClientProxy::removeData(const QList &entryIdList) { qDebug() << "CaClientProxy::removeData" << "entryIdList: " - << entryIdList; + << entryIdList; - QList entryList; + QList entryList; getData(entryIdList, entryList); QList > parentsIds; - foreach (CaEntry *entry, entryList) { + foreach(CaEntry *entry, entryList) { QList parentIds; GetParentsIds(QList() << entry->id(), parentIds); parentsIds.append(parentIds); @@ -299,8 +299,8 @@ success = query.exec(); if (success && query.next()) { success - = query.value(query.record().indexOf("ENTRY_ID")).toInt() - > 0; + = query.value(query.record().indexOf("ENTRY_ID")).toInt() + > 0; } if (!success) { break; @@ -311,9 +311,9 @@ query.addBindValue(entryId); int iconId(0); success = query.exec(); - if (success && query.next()){ + if (success && query.next()) { iconId - = query.value(query.record().indexOf("EN_ICON_ID")).toInt(); + = query.value(query.record().indexOf("EN_ICON_ID")).toInt(); } else { break; } @@ -323,7 +323,7 @@ success = query.exec(); if (success) { qDebug() << query.lastQuery() << " rows deleted: " - << query.numRowsAffected(); + << query.numRowsAffected(); } else { break; } @@ -334,7 +334,7 @@ success = query.exec(); if (success) { qDebug() << query.lastQuery() << " rows deleted: " - << query.numRowsAffected(); + << query.numRowsAffected(); } else { break; } @@ -345,7 +345,7 @@ success = query.exec(); if (success) { qDebug() << query.lastQuery() << " rows deleted: " - << query.numRowsAffected(); + << query.numRowsAffected(); } else { break; } @@ -355,7 +355,7 @@ success = query.exec(); if (success) { qDebug() << query.lastQuery() << " rows deleted: " - << query.numRowsAffected(); + << query.numRowsAffected(); } else { break; } @@ -365,7 +365,7 @@ success = query.exec(); if (success) { qDebug() << query.lastQuery() << " rows deleted: " - << query.numRowsAffected(); + << query.numRowsAffected(); } else { break; } @@ -376,7 +376,7 @@ success = query.exec(); if (success) { qDebug() << query.lastQuery() << " rows deleted: " - << query.numRowsAffected(); + << query.numRowsAffected(); } else { // ignore, this means that the icon cannot be removed // because some other entry has the same icon. @@ -406,23 +406,23 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::insertEntriesIntoGroup(int groupId, - const QList &entryIdList, int beforeEntryId) + const QList &entryIdList, int beforeEntryId) { qDebug() << "CaClientProxy::insertEntriesIntoGroup" << "groupId: " - << groupId << "beforeEntryId: " << beforeEntryId << "entryIdList: " - << entryIdList; + << groupId << "beforeEntryId: " << beforeEntryId << "entryIdList: " + << entryIdList; removeEntriesFromGroup(groupId, entryIdList, false); QString queryText; if (beforeEntryId == AfterTheLastEntry) { queryText = QString("INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID,GE_ENTRY_ID,GE_POSITION) " - "VALUES ( ?, ?,(SELECT MAX(DATA) FROM ( SELECT MAX(GE_POSITION)+ 1 AS DATA FROM CA_GROUP_ENTRY " - "WHERE GE_GROUP_ID = %1 UNION SELECT 1 AS DATA FROM CA_GROUP_ENTRY ) ) )").arg(groupId); + "VALUES ( ?, ?,(SELECT MAX(DATA) FROM ( SELECT MAX(GE_POSITION)+ 1 AS DATA FROM CA_GROUP_ENTRY " + "WHERE GE_GROUP_ID = %1 UNION SELECT 1 AS DATA FROM CA_GROUP_ENTRY ) ) )").arg(groupId); } else if (beforeEntryId == BeforeTheFirstEntry) { queryText = "INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID,GE_ENTRY_ID,GE_POSITION) VALUES ( ?, ?, 0 ) "; } else { queryText = QString("INSERT INTO CA_GROUP_ENTRY (GE_GROUP_ID,GE_ENTRY_ID,GE_POSITION) VALUES ( " - "?, ?, ( SELECT GE_POSITION FROM CA_GROUP_ENTRY WHERE GE_ENTRY_ID = %1 ) ) ").arg(beforeEntryId); + "?, ?, ( SELECT GE_POSITION FROM CA_GROUP_ENTRY WHERE GE_ENTRY_ID = %1 ) ) ").arg(beforeEntryId); } bool success = true; @@ -451,11 +451,11 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::removeEntriesFromGroup(int groupId, - const QList &entryIdList, - bool calledDirectly) + const QList &entryIdList, + bool calledDirectly) { qDebug() << "CaClientProxy::removeEntriesFromGroup" << "groupId: " - << groupId << "entryIdList: " << entryIdList; + << groupId << "entryIdList: " << entryIdList; bool success = true; QSqlDatabase db = dbConnection(); @@ -486,15 +486,15 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::getData(const QList &entryIdList, - QList &sourceList) + QList &sourceList) { qDebug() << "CaClientProxy::getData" << "entryIdList: " - << entryIdList; + << entryIdList; QSqlDatabase db = dbConnection(); bool success(true); - foreach (int i, entryIdList) { + foreach(int i, entryIdList) { QSqlQuery query(db); query.prepare( "SELECT ENTRY_ID, EN_TEXT, EN_DESCRIPTION, EN_TYPE_NAME, EN_FLAGS, EN_ROLE, EN_UID, \ @@ -507,39 +507,39 @@ qDebug() << query.executedQuery(); int role = query.value(query.record().indexOf("EN_ROLE")).toInt(); - CaEntry* entry = new CaEntry((EntryRole) role); + CaEntry *entry = new CaEntry((EntryRole) role); CaObjectAdapter::setId(*entry, - query.value(query.record().indexOf("ENTRY_ID")).toInt()); + query.value(query.record().indexOf("ENTRY_ID")).toInt()); entry->setText(query.value( - query.record().indexOf("EN_TEXT")).toString()); + query.record().indexOf("EN_TEXT")).toString()); entry->setDescription(query.value( - query.record().indexOf("EN_DESCRIPTION")).toString()); + query.record().indexOf("EN_DESCRIPTION")).toString()); entry->setEntryTypeName(query.value(query.record().indexOf( - "EN_TYPE_NAME")).toString()); - entry->setFlags(static_cast (query.value( - query.record().indexOf("EN_FLAGS")).toUInt())); + "EN_TYPE_NAME")).toString()); + entry->setFlags(static_cast(query.value( + query.record().indexOf("EN_FLAGS")).toUInt())); CaIconDescription icon; CaObjectAdapter::setId(icon, - query.value(query.record().indexOf("ICON_ID")).toInt()); + query.value(query.record().indexOf("ICON_ID")).toInt()); icon.setBitmapId(query.value(query.record().indexOf( - "IC_BITMAP_ID")).toInt()); + "IC_BITMAP_ID")).toInt()); icon.setMaskId(query.value(query.record().indexOf( - "IC_MASK_ID")).toInt()); + "IC_MASK_ID")).toInt()); icon.setSkinMajorId(query.value(query.record().indexOf( - "IC_SKINMAJOR_ID")).toInt()); + "IC_SKINMAJOR_ID")).toInt()); icon.setSkinMinorId(query.value(query.record().indexOf( - "IC_SKINMINOR_ID")).toInt()); + "IC_SKINMINOR_ID")).toInt()); icon.setFilename(query.value(query.record().indexOf( - "IC_FILENAME")).toString()); + "IC_FILENAME")).toString()); entry->setIconDescription(icon); // attributes // UID as attribute if (query.value(query.record().indexOf("EN_UID")).toString().length() - > 0) { + > 0) { entry->setAttribute("application:uid", query.value( - query.record().indexOf("EN_UID")).toString()); + query.record().indexOf("EN_UID")).toString()); } // fetch from DB attributes @@ -574,7 +574,7 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::getData(const CaQuery &query, - QList &sourceList) + QList &sourceList) { QList entryIdList; ErrorCode errorCode = getEntryIds(query, entryIdList); @@ -588,7 +588,7 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::getEntryIds(const CaQuery &query, - QList &sourceIdList) + QList &sourceIdList) { qDebug() << "CaClientProxy::getEntryIds"; @@ -598,16 +598,16 @@ QString whereStatement; if (query.flagsOn() != 0) whereStatement.append(" AND ").append(QString().setNum( - query.flagsOn())).append(" & EN_FLAGS == ").append( - QString().setNum(query.flagsOn())); + query.flagsOn())).append(" & EN_FLAGS == ").append( + QString().setNum(query.flagsOn())); if (query.flagsOff() != 0) whereStatement.append(" AND ").append(QString().setNum( - query.flagsOff())).append(" & (~EN_FLAGS) == ").append( - QString().setNum(query.flagsOff())); + query.flagsOff())).append(" & (~EN_FLAGS) == ").append( + QString().setNum(query.flagsOff())); if (query.entryRoles() != 0) whereStatement.append(" AND ").append(QString().setNum( - query.entryRoles())) .append(" | EN_ROLE == ").append( - QString().setNum(query.entryRoles())); + query.entryRoles())) .append(" | EN_ROLE == ").append( + QString().setNum(query.entryRoles())); //TODO: by uid??? if (query.entryTypeNames().count()) { @@ -629,40 +629,39 @@ if (query.count() > 0) queryString.append(" LIMIT ").append(query.count()); qDebug() << "CaServicePrivate::getEntryIds query text: " - << queryString; + << queryString; success = sqlquery.prepare(queryString); success = sqlquery.exec(); if (success) { while (sqlquery.next()) { sourceIdList << sqlquery.value(sqlquery.record().indexOf( - "ENTRY_ID")).toInt(); + "ENTRY_ID")).toInt(); } } - } - else { + } else { QString - queryString( - "SELECT ENTRY_ID FROM CA_ENTRY \ + queryString( + "SELECT ENTRY_ID FROM CA_ENTRY \ LEFT JOIN CA_GROUP_ENTRY ON GE_ENTRY_ID = ENTRY_ID WHERE GE_GROUP_ID = ? "); queryString.append(whereStatement); modifyQueryForSortOrder(queryString, query, true); if (query.count() > 0) queryString.append(" LIMIT ").append(query.count()); qDebug() << "CaServicePrivate::getEntryIds query text: " - << queryString; + << queryString; sqlquery.prepare(queryString); sqlquery.addBindValue(query.parentId()); success = sqlquery.exec(); if (success) { while (sqlquery.next()) { sourceIdList << sqlquery.value(sqlquery.record().indexOf( - "ENTRY_ID")).toInt(); + "ENTRY_ID")).toInt(); } } } ErrorCode error = UnknownErrorCode; if (success) { - error = NoErrorCode; + error = NoErrorCode; } return error; } @@ -671,11 +670,11 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::executeCommand(const CaEntry &entry, - const QString &command) + const QString &command) { qDebug() << "CaClientProxy::executeCommand" << "entry id: " - << entry.id() << "command: " << command; - return touch(entry); + << entry.id() << "command: " << command; + return NoErrorCode; } //---------------------------------------------------------------------------- @@ -718,7 +717,7 @@ query.exec("rollback"); error = UnknownErrorCode; } - + return error; } @@ -726,7 +725,7 @@ // //---------------------------------------------------------------------------- ErrorCode CaClientProxy::customSort(const QList &entryIdList, - int groupId) + int groupId) { bool success = true; QSqlDatabase db = dbConnection(); @@ -735,7 +734,7 @@ for (int i = 0; i < entryIdList.count(); i++) { int position = i+1; query.prepare( - "UPDATE CA_GROUP_ENTRY SET GE_POSITION = ? WHERE GE_ENTRY_ID = ? AND GE_GROUP_ID = ?" ); + "UPDATE CA_GROUP_ENTRY SET GE_POSITION = ? WHERE GE_ENTRY_ID = ? AND GE_GROUP_ID = ?"); query.addBindValue(position); query.addBindValue(entryIdList.at(i)); query.addBindValue(groupId); @@ -759,8 +758,8 @@ /*! //TODO: */ -void CaClientProxy::modifyQueryForSortOrder(QString& queryString, - const CaQuery &query, bool parent) const +void CaClientProxy::modifyQueryForSortOrder(QString &queryString, + const CaQuery &query, bool parent) const { SortAttribute sortAttribute; Qt::SortOrder sortOrder; @@ -770,40 +769,34 @@ if (sortAttribute == NameSortAttribute) { queryString.append(oldQueryString).append(" ORDER BY EN_TEXT "); - } - else if (sortAttribute == CreatedTimestampSortAttribute) { + } else if (sortAttribute == CreatedTimestampSortAttribute) { queryString.append(oldQueryString).append( " ORDER BY EN_CREATION_TIME "); - } - else if (sortAttribute == MostUsedSortAttribute) { + } else if (sortAttribute == MostUsedSortAttribute) { queryString.append("SELECT ENTRY_ID FROM (").append(oldQueryString).append( " \ ) LEFT JOIN \ (SELECT LA_ENTRY_ID, COUNT(*) AS USAGE_DATA FROM CA_LAUNCH GROUP BY LA_ENTRY_ID) \ ON ENTRY_ID = LA_ENTRY_ID ORDER BY USAGE_DATA "); - } - else if (sortAttribute == LastUsedSortAttribute) { + } else if (sortAttribute == LastUsedSortAttribute) { queryString.append("SELECT ENTRY_ID FROM (").append(oldQueryString).append( " \ ) LEFT JOIN \ (SELECT LA_ENTRY_ID, MAX(LA_LAUNCH_TIME) AS USAGE_DATA FROM CA_LAUNCH GROUP BY LA_ENTRY_ID) \ ON ENTRY_ID = LA_ENTRY_ID ORDER BY USAGE_DATA "); - } - else if (parent && sortAttribute == DefaultSortAttribute) { + } else if (parent && sortAttribute == DefaultSortAttribute) { queryString.append(oldQueryString).append( " ORDER BY GE_GROUP_ID, GE_POSITION "); - } - else if (!parent && sortAttribute == DefaultSortAttribute) { + } else if (!parent && sortAttribute == DefaultSortAttribute) { queryString.append(oldQueryString).append(" ORDER BY ENTRY_ID "); - } - else { + } else { queryString.append(oldQueryString); } if (sortAttribute == NameSortAttribute || sortAttribute - == CreatedTimestampSortAttribute || sortAttribute - == MostUsedSortAttribute || sortAttribute == LastUsedSortAttribute - || (sortAttribute == DefaultSortAttribute && parent)) { + == CreatedTimestampSortAttribute || sortAttribute + == MostUsedSortAttribute || sortAttribute == LastUsedSortAttribute + || (sortAttribute == DefaultSortAttribute && parent)) { if (sortOrder == Qt::AscendingOrder) queryString.append(" ASC "); else @@ -826,14 +819,14 @@ AND IC_SKINMAJOR_ID = :IC_SKINMAJOR_ID \ AND IC_SKINMINOR_ID = :IC_SKINMINOR_ID"); query.bindValue(":IC_FILENAME", - entryClone->iconDescription().filename()); + entryClone->iconDescription().filename()); query.bindValue(":IC_BITMAP_ID", - entryClone->iconDescription().bitmapId()); + entryClone->iconDescription().bitmapId()); query.bindValue(":IC_MASK_ID", entryClone->iconDescription().maskId()); query.bindValue(":IC_SKINMAJOR_ID", - entryClone->iconDescription().skinMajorId()); + entryClone->iconDescription().skinMajorId()); query.bindValue(":IC_SKINMINOR_ID", - entryClone->iconDescription().skinMinorId()); + entryClone->iconDescription().skinMinorId()); bool success = query.exec(); if (success && query.next()) { @@ -842,9 +835,9 @@ qDebug() << "iconId = " << iconId; CaIconDescription iconDescription = entryClone->iconDescription(); if (iconId <= 0 && (iconDescription.filename() != "" - || iconDescription.bitmapId() != 0 || iconDescription.maskId() != 0 - || iconDescription.skinMajorId() != 0 - || iconDescription.skinMinorId() != 0)) { + || iconDescription.bitmapId() != 0 || iconDescription.maskId() != 0 + || iconDescription.skinMajorId() != 0 + || iconDescription.skinMinorId() != 0)) { query.prepare( "INSERT INTO CA_ICON \ (IC_FILENAME,IC_BITMAP_ID,IC_MASK_ID,IC_SKINMAJOR_ID,IC_SKINMINOR_ID) \ @@ -872,17 +865,16 @@ QSqlQuery query(dbConnection()); bool isNewEntry(entryClone->id() <= 0); QString - queryText( - "INSERT INTO CA_ENTRY \ + queryText( + "INSERT INTO CA_ENTRY \ (EN_TEXT,EN_ROLE,EN_TYPE_NAME,EN_FLAGS,EN_ICON_ID ) VALUES ( ?, ?, ?, ?, "); if (!isNewEntry) queryText - = "REPLACE INTO CA_ENTRY \ + = "REPLACE INTO CA_ENTRY \ (ENTRY_ID,EN_TEXT,EN_ROLE,EN_TYPE_NAME,EN_FLAGS,EN_ICON_ID ) VALUES ( ?, ?, ?, ?, ?, "; if (entryClone->iconDescription().id() > 0) { queryText.append("?"); - } - else { + } else { queryText.append("NULL"); } queryText.append(")"); @@ -913,7 +905,7 @@ query.addBindValue(newEntryId); success = query.exec(); qDebug() << "CaServicePrivate::setEntryInDb" - << query.executedQuery(); + << query.executedQuery(); } } return success; @@ -928,24 +920,24 @@ QSqlQuery query(dbConnection()); if (entryClone->attributes().count() > 0) { QMap attributesMap = entryClone->attributes(); - foreach (QString key, attributesMap.keys()) { - query.prepare( - "REPLACE INTO CA_ATTRIBUTE (AT_ENTRY_ID,AT_NAME,AT_VALUE) VALUES ( \ + foreach(QString key, attributesMap.keys()) { + query.prepare( + "REPLACE INTO CA_ATTRIBUTE (AT_ENTRY_ID,AT_NAME,AT_VALUE) VALUES ( \ :AT_ENTRY_ID,\ :AT_NAME,\ :AT_VALUE )"); - query.bindValue(":AT_ENTRY_ID", entryClone->id()); - query.bindValue(":AT_NAME", key); - query.bindValue(":AT_VALUE", attributesMap.value(key)); - success = query.exec(); - if (!success) { - break; - } - qDebug() << "CaServicePrivate::setAttributesInDb" - << query.boundValues(); + query.bindValue(":AT_ENTRY_ID", entryClone->id()); + query.bindValue(":AT_NAME", key); + query.bindValue(":AT_VALUE", attributesMap.value(key)); + success = query.exec(); + if (!success) { + break; } + qDebug() << "CaServicePrivate::setAttributesInDb" + << query.boundValues(); + } } - return success; + return success; } @@ -964,7 +956,7 @@ entryIdList.append(QString::number(entryIds[lastItemIndex])); } query = QString("SELECT GE_GROUP_ID FROM CA_GROUP_ENTRY " - "WHERE GE_ENTRY_ID IN ( %1 )").arg(entryIdList); + "WHERE GE_ENTRY_ID IN ( %1 )").arg(entryIdList); int lastParentIndex = parentIds.count()-1; if (lastParentIndex >= 0) { @@ -979,8 +971,8 @@ } -bool CaClientProxy::GetParentsIds( const QList &entryIds, - QList &parentIds) +bool CaClientProxy::GetParentsIds(const QList &entryIds, + QList &parentIds) { QString getParentIdsQuery; CreateGetParentsIdsQuery(entryIds, parentIds, getParentIdsQuery); diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/src/canotifiers.cpp --- a/contentstorage/caclient/stub/src/canotifiers.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/src/canotifiers.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -24,8 +24,8 @@ CaNotifiers::NotifierHash CaNotifiers::mNotifiers; int CaNotifiers::addNotifier(const CaNotifierFilter *notifierFilter, - CaNotifierPrivate::NotifierType notifierType, - const CaClientNotifierProxy *notifierProxy) + CaNotifierPrivate::NotifierType notifierType, + const CaClientNotifierProxy *notifierProxy) { NotifierKey key = NotifierKey(notifierFilter, notifierType); if (!mNotifiers.contains(key)) { @@ -35,7 +35,7 @@ } void CaNotifiers::removeNotifier(const CaNotifierFilter *notifierFilter, - CaNotifierPrivate::NotifierType notifierType) + CaNotifierPrivate::NotifierType notifierType) { mNotifiers.remove(NotifierKey(notifierFilter, notifierType)); } @@ -43,12 +43,12 @@ void CaNotifiers::Notify(int groupId) { for (NotifierHash::const_iterator i = mNotifiers.constBegin(); - i != mNotifiers.constEnd(); - ++i) { + i != mNotifiers.constEnd(); + ++i) { const CaNotifierFilter *filter = i.key().first; if (filter->getIds().isEmpty() || filter->getIds().contains(groupId)) { if (i.key().second - == CaNotifierPrivate::GroupContentChangedNotifierType) { + == CaNotifierPrivate::GroupContentChangedNotifierType) { i.value()->groupContentChanged(groupId); } } @@ -56,22 +56,22 @@ } void CaNotifiers::Notify(const CaEntry &targetEntry, - ChangeType changeType, - QList &parentIds) + ChangeType changeType, + QList &parentIds) { for (NotifierHash::const_iterator i = mNotifiers.constBegin(); - i != mNotifiers.constEnd(); - ++i) { + i != mNotifiers.constEnd(); + ++i) { if (isRegisterdForNotification( - *i.key().first, targetEntry, parentIds)) { + *i.key().first, targetEntry, parentIds)) { if (i.key().second - == CaNotifierPrivate::EntryChangedWithIdNotifierType) { + == CaNotifierPrivate::EntryChangedWithIdNotifierType) { i.value()->entryChanged(targetEntry.id(), changeType); } else if (i.key().second - == CaNotifierPrivate::EntryChangedWithEntryNotifierType) { + == CaNotifierPrivate::EntryChangedWithEntryNotifierType) { i.value()->entryChanged(targetEntry, changeType); } else if (i.key().second - == CaNotifierPrivate::EntryTouchedNotifierType) { + == CaNotifierPrivate::EntryTouchedNotifierType) { i.value()->entryChanged(targetEntry.id(), changeType); } } @@ -85,7 +85,7 @@ { bool ret = true; if (!filter.getIds().isEmpty()) { - ret = ret && filter.getIds().contains(entry.id()); + ret = ret && filter.getIds().contains(entry.id()); } if (filter.getParentId() > 0) { if (entry.id() == filter.getParentId()) { diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/src/caobjectadapter.cpp --- a/contentstorage/caclient/stub/src/caobjectadapter.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/src/caobjectadapter.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -1,4 +1,4 @@ - /* +/* * Copyright (c)2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available @@ -31,7 +31,7 @@ { HbIcon icon; QString filename(entry.iconDescription().filename()); - if(!filename.isEmpty()) { + if (!filename.isEmpty()) { icon = HbIcon(filename); } if (icon.isNull() || !(icon.size().isValid())) { @@ -45,7 +45,7 @@ // //---------------------------------------------------------------------------- void CaObjectAdapter::setId(CaEntry &entry, - int id) + int id) { entry.setId(id); } @@ -54,7 +54,7 @@ // //---------------------------------------------------------------------------- void CaObjectAdapter::setId(CaIconDescription &iconDescription, - int id) + int id) { iconDescription.setId(id); } diff -r e492551a0d54 -r 9d806967057c contentstorage/caclient/stub/src/hswidgetregistryservice.cpp --- a/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/caclient/stub/src/hswidgetregistryservice.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -36,27 +36,27 @@ ?Qt_style_documentation */ HsWidgetRegistryServicePrivate::HsWidgetRegistryServicePrivate( - const QString& installationPath, HsWidgetRegistryService* ptrToPublic, - QObject* parent) : QObject(parent) + const QString &installationPath, HsWidgetRegistryService *ptrToPublic, + QObject *parent) : QObject(parent) { Q_UNUSED(ptrToPublic); QStringList manifestPaths; - + this->mInstallationPath = installationPath; QDir currentDir = QDir::current(); QString currentPath = currentDir.absolutePath(); - + //Check widget installation dirs from root of different drives QFileInfoList drives = QDir::drives(); - + // ? - for(int i=0; i < drives.count(); i++) { + for (int i=0; i < drives.count(); i++) { QFileInfo drive = drives.at(i); QString driveLetter = drive.absolutePath(); QString path = currentPath + "/" + mInstallationPath; QDir registryDir(path); - if(registryDir.exists()) { + if (registryDir.exists()) { // ? mManifestDirectories[path] = readManifestDirectories(path); } @@ -74,17 +74,18 @@ /*! ?Qt_style_documentation */ -QList HsWidgetRegistryServicePrivate::widgets() { - QList widgets; - QMapIterator i(mManifestDirectories); +QList HsWidgetRegistryServicePrivate::widgets() +{ + QList widgets; + QMapIterator i(mManifestDirectories); - while (i.hasNext()) { + while (i.hasNext()) { i.next(); QStringList manifestFileList = i.value(); QDir manifestDir(i.key()); - // ? - for(int h=0; h < manifestFileList.count(); h++) { + // ? + for (int h=0; h < manifestFileList.count(); h++) { widgets << readManifestFile(manifestDir.absoluteFilePath(manifestFileList.at(h))); } } @@ -94,15 +95,15 @@ /*! ?Qt_style_documentation */ -IHsWidgetProvider* HsWidgetRegistryServicePrivate::loadProviderFromPlugin( - const QString& pluginName) -{ +IHsWidgetProvider *HsWidgetRegistryServicePrivate::loadProviderFromPlugin( + const QString &pluginName) +{ QPluginLoader loader(pluginName); QObject *plugin = loader.instance(); IHsWidgetProvider *provider = qobject_cast(plugin); - + if (provider) { - // ? + // ? return provider; } @@ -111,7 +112,7 @@ //qDebug("Widget provider load - !provider, deleting plugin.") delete plugin; } - + // qDebug("Widget provider load failed - Not found.") return 0; } @@ -123,10 +124,10 @@ { QStringList widgetDirPaths; QDir registryDir(path); - QStringList widgetDirs = registryDir.entryList(QDir::AllDirs); - - // ? - for (int i=0; i < widgetDirs.count(); ++i) { + QStringList widgetDirs = registryDir.entryList(QDir::AllDirs); + + // ? + for (int i=0; i < widgetDirs.count(); ++i) { widgetDirPaths << registryDir.absoluteFilePath(widgetDirs.at(i)); } return widgetDirPaths; @@ -135,8 +136,8 @@ /*! ?Qt_style_documentation */ -void HsWidgetRegistryServicePrivate::doWidgetRemove(const QString &path, - const QStringList &originalList, const QStringList ¤tList) +void HsWidgetRegistryServicePrivate::doWidgetRemove(const QString &path, + const QStringList &originalList, const QStringList ¤tList) { Q_UNUSED(path); const int originalCount = originalList.count(); @@ -167,7 +168,7 @@ QStringList manifestDir = dir.entryList(filters, QDir::Files); if (!manifestDir.isEmpty()) { - // ? + // ? QString fileName = manifestDir.first(); if (fileName != "hsposterwidgetprovider.manifest") { @@ -177,18 +178,18 @@ widgets = manifest.widgets(); int widgetUid = dir.dirName().toUInt(0, 16); - // ? - for (int i=0; i HsWidgetRegistryService::widgets() { - return mPrivate->widgets(); + return mPrivate->widgets(); } /*! \fn HsWidgetRegistryService::widgetAddedToRegistry(const QList &widgetTokenList); Emitted when new widgets are added to registry. \a widgetTokenList contains list of widget tokens. -*/ +*/ /*! \fn HsWidgetRegistryService::widgetRemovedFromRegistry(int uid) - Emitted when a widget is removed from registry - -*/ + Emitted when a widget is removed from registry - +*/ + + /*! \fn HsWidgetRegistryService::posterWidgetRemovedFromRegistry(int posterWidgetId) - Emitted when a poster widget publisher is removed from cps + Emitted when a poster widget publisher is removed from cps \a posterWidgetId Poster widget id. -*/ +*/ /*! Emits the widgetAddedToRegistry() signal \a widgetsAdded Identifies the added widgets. -*/ +*/ void HsWidgetRegistryService::emitWidgetAddedToRegistry(const QList &widgetsAdded) { emit widgetAddedToRegistry(widgetsAdded); @@ -342,7 +343,7 @@ /*! Emits the widgetRemovedFromRegistry() signal \a uid HsWidget uid. -*/ +*/ void HsWidgetRegistryService::emitWidgetRemovedFromRegistry(int uid) { emit widgetRemovedFromRegistry(uid); diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/caappscanner/inc/casrvappscanner.h --- a/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Tue Mar 23 23:42:03 2010 +0200 @@ -170,12 +170,6 @@ */ void RemoveEntryFromDownloadedL( TInt aEntryId ); - /** - * Handles removal of stub items from download collection - * @param aEntryId application entry id. - */ - void HandleStubUpdatesL (); - TBool HandleLockDeleteFlagUpdateL( CCaInnerEntry* aItem ); /** @@ -225,10 +219,11 @@ void GetApaItemsL( RArray& aArray ); /** - * Remove sat applications from array(found in AppArc) + * Remove application from array (found in AppArc) * @param aArray RArray with application + * @param aUid uid of application to remove */ - void RemoveSatApp( RArray& aArray ); + void RemoveApp( RArray& aArray, TInt32 aUid ); /** * Get applications from CaStorage @@ -243,6 +238,16 @@ * contains applications */ void RemoveSatAppL( RPointerArray& aArray ); + + /** + * Ensure that HsApplicaiton is not visible: Add HsApplication + * as hidden to CaStorage or remove HsApplication entry + * from array (found in CaStorage). + * @param aArray RPointerArray with CCaInnerEntries + * contains application + */ + void HandleHsAppEntryL( RPointerArray& aArray ); + /** * Get application with specified uid from CaStorage * @param aUid RPointerArray with CCaInnerEntries diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/caappscanner/src/casrvappscanner.cpp --- a/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -186,14 +186,12 @@ // This app is not in the storage, add it now. // We don't add hidden items, there are too many of them! // do not display Menu app - if( !resultArray.Count() - //TODO still needed? - && appuid != KMmUid3.iUid ) + if( !resultArray.Count() ) { AddAppEntryL( appuid, aMmcId ); }//if - // "hidden", "missing" and "lock_delete" flags update + // "removable", "missing" and "visible" flags update for( TInt j = 0; j < resultArray.Count(); j++ ) { //we need to handle first run of appscanner, @@ -333,12 +331,14 @@ RPointerArray resultArray; CleanupResetAndDestroyPushL( resultArray ); GetCaAppEntriesL( resultArray ); + HandleHsAppEntryL( resultArray ); RemoveSatAppL( resultArray ); RArray apaItems; CleanupClosePushL( apaItems ); GetApaItemsL( apaItems ); - RemoveSatApp( apaItems ); + RemoveApp( apaItems, KSatUid.iUid ); + RemoveApp( apaItems, KHsAppUid.iUid ); //for every item in apaAndCrItems array for( TInt i = 0; i < apaItems.Count(); i++ ) @@ -350,48 +350,10 @@ } // Here the big list cwith items that refer to missing apps. HandleMissingItemsL( resultArray ); - HandleStubUpdatesL( ); CleanupStack::PopAndDestroy( &apaItems ); CleanupStack::PopAndDestroy( &resultArray ); } - -// --------------------------------------------------------- -// CCaSrvAppScanner::HandleStubUpdatesL -// --------------------------------------------------------- -// -void CCaSrvAppScanner::HandleStubUpdatesL() - { - RPointerArray downloadedArray; - CleanupResetAndDestroyPushL( downloadedArray ); - - CCaInnerQuery* query = CCaInnerQuery::NewLC(); - CDesC16ArrayFlat* appType = new (ELeave) CDesC16ArrayFlat( 1 ); - CleanupStack::PushL( appType ); - appType->AppendL( KCaTypeApp ); - query->SetEntryTypeNames( appType ); - CleanupStack::Pop( appType ); - query->SetParentId( GetCollectionDownloadIdL() ); - query->SetFlagsOn( EVisible ); - query->SetFlagsOff( EMissing ); - query->SetFlagsOff( ERemovable ); - iCaStorageProxy.GetEntriesL( query, downloadedArray ); - - for(TInt i=0; iGetUid() ) ) - { - RemoveEntryFromDownloadedL( downloadedArray[i]->GetId() ); - } - } - - CleanupStack::PopAndDestroy( query ); - CleanupStack::PopAndDestroy( &downloadedArray ); - - } - - - // --------------------------------------------------------- // CCaSrvAppScanner::HandleLockDeleteFlagUpdateL // --------------------------------------------------------- @@ -438,13 +400,13 @@ } // --------------------------------------------------------- -// CCaSrvAppScanner::RemoveSatApp +// CCaSrvAppScanner::RemoveApp // --------------------------------------------------------- // -void CCaSrvAppScanner::RemoveSatApp( RArray& aArray ) +void CCaSrvAppScanner::RemoveApp( RArray& aArray, TInt32 aUid ) { - TCaAppAtributes sat( KSatUid.iUid ); - TInt id = aArray.Find( sat, TCaAppAtributes::MatchItems ); + TCaAppAtributes app( aUid ); + TInt id = aArray.Find( app, TCaAppAtributes::MatchItems ); if( id != KErrNotFound ) { aArray.Remove( id ); @@ -470,6 +432,39 @@ } // --------------------------------------------------------- +// CCaSrvAppScanner::HandleHsAppEntryL +// --------------------------------------------------------- +// +void CCaSrvAppScanner::HandleHsAppEntryL( RPointerArray& aArray ) + { + CCaInnerEntry* appEntry = CCaInnerEntry::NewLC(); + appEntry->SetUid( KHsAppUid.iUid ); + TInt index = aArray.Find( + appEntry, TIdentityRelation( UidMatch ) ); + + if ( index != KErrNotFound ) + { // hs app already in storage - ensure it is hidden and remove from resultArray + if ( ( aArray[index]->GetFlags() & EVisible ) != 0 ) + { + aArray[index]->SetFlags( aArray[index]->GetFlags() & ~EVisible); + iCaStorageProxy.AddL( aArray[index] ); + } + delete aArray[index]; + aArray.Remove( index ); + } + else + { // if not found add as not visible to the storage + appEntry->SetEntryTypeNameL( KCaTypeApp ); + appEntry->SetFlags( 0 ); + appEntry->SetRole( EItemEntryRole ); + SetApaAppInfoL( appEntry ); + iCaStorageProxy.AddL( appEntry ); + } + CleanupStack::PopAndDestroy( appEntry ); + } + + +// --------------------------------------------------------- // CCaSrvAppScanner::GetApaItemsL // --------------------------------------------------------- // diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro --- a/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Tue Mar 23 23:42:03 2010 +0200 @@ -14,7 +14,7 @@ # Description: # -include(.\..\..\..\common.pri) +include(./../../../common.pri) TRANSLATIONS=contentstorage.ts @@ -45,9 +45,9 @@ MMP_RULES += rssResource MMP_RULES -= EXPORTUNFROZEN MMP_RULES += "$${LITERAL_HASH}if defined(WINSCW)" \ - "DEFFILE .\bwins\calocalizerscanner.def" \ + "DEFFILE ./bwins/calocalizerscanner.def" \ "$${LITERAL_HASH}else" \ - "DEFFILE .\eabi\calocalizerscanner.def" \ + "DEFFILE ./eabi/calocalizerscanner.def" \ "$${LITERAL_HASH}endif" HEADERS += ./inc/*.h SOURCES += ./src/*.cpp @@ -55,9 +55,8 @@ -lecom \ -lcautils \ -lcamenu - - } +CONFIG += symbian_i18n exportResources(./*.qm, resource/qt/translations) diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/causifscanner/data/causifscanner.rss --- a/contentstorage/casrv/causifscanner/data/causifscanner.rss Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/causifscanner/data/causifscanner.rss Tue Mar 23 23:42:03 2010 +0200 @@ -18,7 +18,7 @@ * */ -#include +#include #include "casrvpluginuids.hrh" #include "causifscanner.hrh" diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Tue Mar 23 23:42:03 2010 +0200 @@ -120,6 +120,12 @@ void SetVisible( TBool aVisible ); /* + * Used flag setter + * @param aUsed flag + */ + void SetUsed( TBool aUsed ); + + /* * Content arsenal entry id getter * @return CA entry id */ @@ -168,10 +174,28 @@ TBool IsMissing( ) const; /* + * Used flag + * @return ETrue if flag used is set + */ + TBool IsUsed( ) const; + + /* * Entry getter * @return entry representing widget */ CCaInnerEntry* GetEntryLC( ) const; + + /* + * Modification time setter + * @param aModificationTime + */ + void SetModificationTimeL( const TDesC& aModificationTime ); + + /* + * Modification time getter + * @return widget Modification time + */ + TPtrC GetModificationTime( ) const; private: @@ -250,6 +274,11 @@ * Widgets flags. */ TInt iFlags; + + /* + * Modification time. + */ + RBuf iModificationTime; }; typedef RPointerArray RWidgetArray; diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/inc/cawidgetmmcwatcher.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetmmcwatcher.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetmmcwatcher.h Tue Mar 23 23:42:03 2010 +0200 @@ -44,8 +44,8 @@ * @since S60 S60 v3.1 */ class CCaWidgetMmcWatcher : public CActive - { - + { + public: /** @@ -53,52 +53,52 @@ * @param aObserver Pointer to notifier interface. * @param aFs file server session. */ - static CCaWidgetMmcWatcher* NewL( RFs& aFs, - MWidgetMmcWatcherCallback* aObserver ); + static CCaWidgetMmcWatcher* NewL( RFs& aFs, + MWidgetMmcWatcherCallback* aObserver ); /** * Two-phased constructor. * @param aObserver Pointer to notifier interface. * @param aFs file server session. */ - static CCaWidgetMmcWatcher* NewLC( RFs& aFs, - MWidgetMmcWatcherCallback* aObserver ); - + static CCaWidgetMmcWatcher* NewLC( RFs& aFs, + MWidgetMmcWatcherCallback* aObserver ); + /** * Destructor */ - ~CCaWidgetMmcWatcher(); - + ~CCaWidgetMmcWatcher(); + private: - + /** * C++ default constructor * @param aObserver Pointer to notifier interface. * @param aFs file server session. */ - CCaWidgetMmcWatcher( RFs& aFs, MWidgetMmcWatcherCallback* aObserver ); + CCaWidgetMmcWatcher( RFs& aFs, MWidgetMmcWatcherCallback* aObserver ); /** * By default Symbian OS constructor is private. */ - void ConstructL(); - + void ConstructL(); + /** * Set notification request */ - void WaitForChangeL(); + void WaitForChangeL(); /** * From CActive. */ - void DoCancel(); + void DoCancel(); /** * From CActive. */ - void RunL(); - - /** + void RunL(); + + /** * From CActive. */ TInt RunError( TInt aError ); @@ -109,14 +109,14 @@ * File server session. * Not Own */ - RFs iFs; - + RFs iFs; + /** * MMC events observer * Not own. */ - MWidgetMmcWatcherCallback* iObserver; - }; + MWidgetMmcWatcherCallback* iObserver; + }; #endif // C_CAWIDGETMMCWATCHER_H diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Tue Mar 23 23:42:03 2010 +0200 @@ -85,10 +85,12 @@ /** * Parse a widget, store parsed object in an internal array + * @param aFilePath full file path to manifest file * @param aElement widget element * @param aPackageUid descriptor containing package uid */ - void ParseWidgetL( TXmlEngElement aElement, const TDesC& aPackageUid ); + void ParseWidgetL( const TDesC& aFilePath, + TXmlEngElement aElement, const TDesC& aPackageUid ); /** * Gets all directories from import folder @@ -126,7 +128,7 @@ * @param aWidget widget to set value */ void SetLibraryL( TXmlEngElement & aElement, const TDesC & aPackageUid, - CCaWidgetDescription * aWidget ); + CCaWidgetDescription * aWidget ); /** * Sets widgets title @@ -134,7 +136,7 @@ * @param aWidget widget to set value */ void SetTitleL( TXmlEngElement & aElement, - CCaWidgetDescription * aWidget ); + CCaWidgetDescription * aWidget ); /** * Sets widgets description @@ -142,7 +144,7 @@ * @param aWidget widget to set value */ void SetDescriptionL( TXmlEngElement & aElement, - CCaWidgetDescription * aWidget ); + CCaWidgetDescription * aWidget ); /** * Sets widgets visibility @@ -150,7 +152,7 @@ * @param aWidget widget to set value */ void SetVisibilityL( TXmlEngElement & aElement, - CCaWidgetDescription * aWidget ); + CCaWidgetDescription * aWidget ); /** * Sets icons URI diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Tue Mar 23 23:42:03 2010 +0200 @@ -38,7 +38,7 @@ class CCaWidgetStorageHandler : public CBase { public: - CA_STORAGE_TEST_FRIEND_CLASS (T_CaWidgetScanner) + CA_STORAGE_TEST_FRIEND_CLASS (T_CaWidgetScanner) public: // Constructors and destructor diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -63,10 +63,10 @@ TBuf uidDesc; aEntry->FindAttribute( KCaPackageUid, uidDesc ); if ( uidDesc.Length() ) - { - TLex uidLex(uidDesc); - User::LeaveIfError( uidLex.Val( iPackageUid, EHex )); - } + { + TLex uidLex(uidDesc); + User::LeaveIfError( uidLex.Val( iPackageUid, EHex )); + } iTitle.CreateL(aEntry->GetText().Length()); iTitle = aEntry->GetText(); iIconUri.CreateL(aEntry->GetIcon().iFileName.Length()); @@ -80,14 +80,21 @@ //mmc id TBuf mmcId; if( aEntry->FindAttribute( KCaAttrMmcId, mmcId ) ) - { + { TLex mmcLex( mmcId ); User::LeaveIfError( mmcLex.Val( iMmcId, EHex )); - } + } if( aEntry->GetFlags() & EMissing ) { iFlags = iFlags | EMissing; } + if( aEntry->GetFlags() & EUsed ) + { + iFlags = iFlags | EUsed; + } + + iModificationTime.CreateL(KCaMaxAttrValueLen); + aEntry->FindAttribute( KCaAttrInstallationTime, iModificationTime ); } // ----------------------------------------------------------------------------- @@ -139,6 +146,7 @@ iUri.Close(); iIconUri.Close(); iLibrary.Close(); + iModificationTime.Close(); } // ---------------------------------------------------------------------------- @@ -169,7 +177,9 @@ aToCompare.GetUri() == GetUri() && aToCompare.GetIconUri() == GetIconUri() && aToCompare.GetTitle() == GetTitle() && - aToCompare.GetLibrary() != KNoLibrary ) + aToCompare.GetLibrary() != KNoLibrary && + aToCompare.GetModificationTime() == GetModificationTime() + ) { return ETrue; } @@ -268,6 +278,15 @@ // // ----------------------------------------------------------------------------- // +void CCaWidgetDescription::SetUsed( TBool aUsed ) + { + SetFlag( EUsed, aUsed ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// void CCaWidgetDescription::SetFlag( TInt aFlag, TBool aValue ) { if( aValue ) @@ -284,6 +303,16 @@ // // ----------------------------------------------------------------------------- // +void CCaWidgetDescription::SetModificationTimeL( const TDesC& aModificationTime ) + { + iModificationTime.Close(); + iModificationTime.CreateL( aModificationTime ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// TInt CCaWidgetDescription::GetEntryId( ) const { return iEntryId; @@ -341,13 +370,22 @@ TPtrC CCaWidgetDescription::GetTitle( ) const { if ( iTitle == KNullDesC ) - { - return GetLibraryName(); + { + return GetLibraryName(); } else - { - return iTitle; - } + { + return iTitle; + } + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TPtrC CCaWidgetDescription::GetModificationTime( ) const + { + return iModificationTime; } @@ -360,6 +398,16 @@ return iFlags & EMissing; } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool CCaWidgetDescription::IsUsed( ) const + { + return iFlags & EUsed; + } + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -375,11 +423,11 @@ } if ( iPackageUid ) - { - TBuf uidDesc; - uidDesc.AppendNum( iPackageUid,EHex ); - entry->AddAttributeL( KCaPackageUid, uidDesc ); - } + { + TBuf uidDesc; + uidDesc.AppendNum( iPackageUid,EHex ); + entry->AddAttributeL( KCaPackageUid, uidDesc ); + } if ( iEntryId != KNoId ) { @@ -426,6 +474,12 @@ { entry->SetIconDataL(0, 0, 0, 0, iIconUri); } + + if( iModificationTime != KNullDesC ) + { + entry->AddAttributeL( KCaAttrInstallationTime, iModificationTime ); + } + return entry; } diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/src/cawidgetmmcwatcher.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetmmcwatcher.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetmmcwatcher.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -28,12 +28,12 @@ // CCaWidgetMmcWatcher* CCaWidgetMmcWatcher::NewL( RFs& aFs, MWidgetMmcWatcherCallback* aObserver ) - { - CCaWidgetMmcWatcher* self = NewLC( aFs, aObserver ); - CleanupStack::Pop( self ); - return self; - } - + { + CCaWidgetMmcWatcher* self = NewLC( aFs, aObserver ); + CleanupStack::Pop( self ); + return self; + } + // --------------------------------------------------------- // CCaWidgetMmcWatcher::NewLC // Second phase constructor @@ -41,23 +41,23 @@ // CCaWidgetMmcWatcher* CCaWidgetMmcWatcher::NewLC( RFs& aFs, MWidgetMmcWatcherCallback* aObserver ) - { - CCaWidgetMmcWatcher* self = new (ELeave) CCaWidgetMmcWatcher( aFs, - aObserver ); - CleanupStack::PushL ( self ); - self->ConstructL(); - return self; - } - + { + CCaWidgetMmcWatcher* self = new (ELeave) CCaWidgetMmcWatcher( aFs, + aObserver ); + CleanupStack::PushL ( self ); + self->ConstructL(); + return self; + } + // --------------------------------------------------------- // CCaWidgetMmcWatcher::~CCaWidgetMmcWatcher // Destructor // --------------------------------------------------------- // CCaWidgetMmcWatcher::~CCaWidgetMmcWatcher() - { - Cancel(); - } + { + Cancel(); + } // --------------------------------------------------------- // CCaWidgetMmcWatcher::CCaWidgetMmcWatcher @@ -66,12 +66,12 @@ // CCaWidgetMmcWatcher::CCaWidgetMmcWatcher( RFs& aFs, MWidgetMmcWatcherCallback* aObserver ) - : CActive( CActive::EPriorityStandard ), - iFs(aFs), - iObserver(aObserver) - { - CActiveScheduler::Add(this); - } + : CActive( CActive::EPriorityStandard ), + iFs(aFs), + iObserver(aObserver) + { + CActiveScheduler::Add(this); + } // --------------------------------------------------------- // CCaWidgetMmcWatcher::ConstructL @@ -79,34 +79,34 @@ // --------------------------------------------------------- // void CCaWidgetMmcWatcher::ConstructL() - { - WaitForChangeL(); - } + { + WaitForChangeL(); + } // --------------------------------------------------------- // CCaWidgetMmcWatcher::WaitForChangeL // Request notification for disk change // --------------------------------------------------------- -// +// void CCaWidgetMmcWatcher::WaitForChangeL() - { - TInt mmcDrive; - User::LeaveIfError( DriveInfo::GetDefaultDrive( - DriveInfo::EDefaultRemovableMassStorage, mmcDrive ) ); - TDriveName mmcDriveName( TDriveUnit( mmcDrive ).Name() ); - iFs.NotifyChange( ENotifyEntry, iStatus, mmcDriveName ); - SetActive(); - } + { + TInt mmcDrive; + User::LeaveIfError( DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultRemovableMassStorage, mmcDrive ) ); + TDriveName mmcDriveName( TDriveUnit( mmcDrive ).Name() ); + iFs.NotifyChange( ENotifyEntry, iStatus, mmcDriveName ); + SetActive(); + } // --------------------------------------------------------- // CCaWidgetMmcWatcher::DoCancel // --------------------------------------------------------- // void CCaWidgetMmcWatcher::DoCancel() - { - iFs.NotifyChangeCancel(); - } - + { + iFs.NotifyChangeCancel(); + } + // --------------------------------------------------------------------------- // CCaWidgetMmcWatcher::RunError // --------------------------------------------------------------------------- @@ -115,19 +115,19 @@ { // No need to do anything return KErrNone; - } + } // --------------------------------------------------------- // CCaWidgetMmcWatcher::RunL // --------------------------------------------------------- -// +// void CCaWidgetMmcWatcher::RunL() { - TInt status( iStatus.Int() ); - WaitForChangeL(); - if ( status >= KErrNone ) - { - iObserver->MmcChangeL(); - } - } - + TInt status( iStatus.Int() ); + WaitForChangeL(); + if ( status >= KErrNone ) + { + iObserver->MmcChangeL(); + } + } + diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -31,6 +31,7 @@ const TInt KChunkSize = 8192; const TInt KDriveLetterLength = 2; +const TInt KModificationTimeLength = 17; _LIT( KManifest, ".manifest"); _LIT( KColen, ":" ); @@ -212,7 +213,7 @@ element = elementList.Next(); if ( element.HasAttributes() ) { - ParseWidgetL( element, aPackageUid ); + ParseWidgetL( aFilePath, element, aPackageUid ); } } CleanupStack::PopAndDestroy(&elementList); @@ -225,7 +226,8 @@ // ---------------------------------------------------------------------------- // void CCaWidgetScannerParser::ParseWidgetL( - TXmlEngElement aElement, const TDesC& aPackageUid ) + const TDesC& aFilePath, TXmlEngElement aElement, + const TDesC& aPackageUid ) { CCaWidgetDescription* widget = CCaWidgetDescription::NewLC(); @@ -236,7 +238,17 @@ SetVisibilityL( aElement, widget ); SetIconUriL( aElement, aPackageUid, widget); widget->SetPackageUidL( aPackageUid ); - SetMmcIdL( widget); + SetMmcIdL( widget ); + + TTime modificationTime; + iFs.Modified( aFilePath, modificationTime); + TInt64 modificationIntTime = modificationTime.Int64(); + RBuf16 rBuf; + rBuf.CleanupClosePushL(); + rBuf.CreateL( KModificationTimeLength ); + rBuf.AppendNum( modificationIntTime ); + widget->SetModificationTimeL( rBuf ); + CleanupStack::PopAndDestroy( &rBuf ); TInt index = iWidgets.Find( widget, CCaWidgetDescription::Compare ); if ( index != KErrNotFound ) diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/src/cawidgetscannerplugin.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerplugin.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerplugin.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -117,7 +117,7 @@ // ---------------------------------------------------------------------------- // // ---------------------------------------------------------------------------- -// +// void CCaWidgetScannerPlugin::SynchronizeL() { iStorageHandler->SynchronizeL( iParser->WidgetsScanL() ); diff -r e492551a0d54 -r 9d806967057c contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -122,10 +122,14 @@ { CCaInnerEntry* entry = aWidget->GetEntryLC(); entry->SetId( aEntryId ); - if( !aWidget->IsMissing() ) + if( !aWidget->IsMissing() && ( aWidget->GetLibrary() != KNoLibrary ) ) { entry->SetFlags( entry->GetFlags() & ~EUsed ); } + else if(aWidget->IsUsed()) + { + entry->SetFlags( entry->GetFlags() | EUsed ); + } entry->SetFlags( entry->GetFlags() & ~EMissing ); iStorage->AddL( entry ); if( !aWidget->IsMissing() ) @@ -152,6 +156,7 @@ iWidgets[index]->IsMissing() ) { aWidgets[i]->SetMissing( iWidgets[index]->IsMissing() ); + aWidgets[i]->SetUsed( iWidgets[index]->IsUsed() ); UpdateL( aWidgets[i], iWidgets[index]->GetEntryId() ); } iUpdatedIndexes.AppendL( index ); @@ -267,6 +272,10 @@ { CCaInnerEntry* entry = aWidget->GetEntryLC(); entry->SetFlags( entry->GetFlags() | EMissing ); + if(aWidget->IsUsed()) + { + entry->SetFlags( entry->GetFlags() | EUsed ); + } iStorage->AddL( entry ); CleanupStack::PopAndDestroy( entry ); } diff -r e492551a0d54 -r 9d806967057c contentstorage/extinc/casathandler.h --- a/contentstorage/extinc/casathandler.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/extinc/casathandler.h Tue Mar 23 23:42:03 2010 +0200 @@ -20,7 +20,7 @@ #include -#include +#include #include #ifdef SIM_ATK_SERVICE_API_V1 #include // MCL diff -r e492551a0d54 -r 9d806967057c contentstorage/extsrc/caiconutility.cpp --- a/contentstorage/extsrc/caiconutility.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/extsrc/caiconutility.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -18,7 +18,7 @@ // INCLUDE FILES #include #include -#include +#include #include #include #include diff -r e492551a0d54 -r 9d806967057c contentstorage/group/camenu.mmp --- a/contentstorage/group/camenu.mmp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/group/camenu.mmp Tue Mar 23 23:42:03 2010 +0200 @@ -12,7 +12,7 @@ * Contributors: * * Description: -* Version : %version: ou1s60ui#19.1.1 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: 19.1.2 % << Don't touch! Updated by Synergy at check-out. * */ @@ -32,7 +32,6 @@ SOURCEPATH ../srvsrc SOURCE casrvsession.cpp SOURCE casrv.cpp -SOURCE catimeout.cpp SOURCE casrvmmchistory.cpp SOURCE cainstallnotifier.cpp SOURCE casrvengutils.cpp diff -r e492551a0d54 -r 9d806967057c contentstorage/inc/cadef.h --- a/contentstorage/inc/cadef.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/inc/cadef.h Tue Mar 23 23:42:03 2010 +0200 @@ -12,7 +12,7 @@ * Contributors: * * Description: Definition of different constants - * Version : %version: ou1s60ui#10.1.1 % << Don't touch! Updated by Synergy at check-out. + * Version : %version: 10.1.4 % << Don't touch! Updated by Synergy at check-out. * */ @@ -61,6 +61,7 @@ _LIT( KCaAttrWindowGroupId, "window_group_id" ); _LIT( KCaTypeCollectionDownload, "collection::downloaded" ); _LIT( KCaPackageUid,"packageuid"); +_LIT( KCaAttrInstallationTime, "installationTime"); const TInt KGranularityOne = 1; const TInt KUidChars = 10; @@ -77,16 +78,17 @@ // CONSTANTS -const TUid KMmUid3 = - { - 0x101f4cd2 - }; const TUid KSatUid = { 0x101F4CE0 }; +const TUid KHsAppUid = + { + 0x20022F35 + }; + const TInt KCenRepBufferSize = 255; // // Attributes commonly used for all items. diff -r e492551a0d54 -r 9d806967057c contentstorage/srvinc/casrv.h --- a/contentstorage/srvinc/casrv.h Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/srvinc/casrv.h Tue Mar 23 23:42:03 2010 +0200 @@ -22,7 +22,6 @@ #include // FORWARD DECLARATION -class CTimeout; class CCaSrvEngUtils; class CCaSrvManager; class CCaStorageProxy; @@ -101,11 +100,6 @@ // Data /** - * Exit timer. Own. - */ - CTimeout* iExitTimer; - - /** * Data storage proxy. Own. */ CCaStorageProxy* iStorageProxy; diff -r e492551a0d54 -r 9d806967057c contentstorage/srvinc/catimeout.h --- a/contentstorage/srvinc/catimeout.h Tue Mar 23 23:28:12 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: ?Description - * - */ - -#ifndef TIMEOUT_H -#define TIMEOUT_H - -// INCLUDE FILES - -#include - -// CLASS DECLARATION - -/** - * Timeout timer. - */ -NONSHARABLE_CLASS( CTimeout ): public CTimer - { -public: - // Construct / destruct - - /** - * Two phase constructor. Leaves on failure. - * @param aPriority Active object priority. - * @param aCallback Callback to be called when timer expires. - * This callback must return EFalse - it will NOT be called only again. - * @return The constructed timeout timer. - */ - static CTimeout* NewL( TInt aPriority, TCallBack aCallBack ); - - /** - * Destructor. - */ - virtual ~CTimeout(); - -protected: - // from CActive - - /** - * Outstanding request completed (timed out). - */ - virtual void RunL(); - -protected: - // Construct / destruct - - /** - * Constructor. - * @param aPriority Active object priority. - * @param aCallback Callback to be called when timer expires. - */ - CTimeout( TInt aPriority, TCallBack aCallBack ); - -private: - // data - - TCallBack iCallBack; ///< Callback. - }; - -#endif // TIMEOUT_H -// End of File diff -r e492551a0d54 -r 9d806967057c contentstorage/srvsrc/casrv.cpp --- a/contentstorage/srvsrc/casrv.cpp Tue Mar 23 23:28:12 2010 +0200 +++ b/contentstorage/srvsrc/casrv.cpp Tue Mar 23 23:42:03 2010 +0200 @@ -22,7 +22,6 @@ #include "casrvdef.h" #include "casrvsession.h" #include "casrvengutils.h" -#include "catimeout.h" #include "castorageproxy.h" #include "casrvmanager.h" @@ -139,7 +138,6 @@ delete iSrvManager; delete iSrvEngUtils; delete iStorageProxy; - delete iExitTimer; } // --------------------------------------------------------- @@ -167,8 +165,6 @@ void CCaSrv::ConstructL() { iSessionCount = 0; - iExitTimer = CTimeout::NewL( CActive::EPriorityStandard, TCallBack( - StopScheduler, NULL ) ); iStorageProxy = CCaStorageProxy::NewL(); iSrvEngUtils = CCaSrvEngUtils::NewL(); TRAPD( err, iSrvManager = CCaSrvManager::NewL( @@ -196,7 +192,6 @@ } CSession2* session; session = CCaSrvSession::NewL( const_cast ( *this ) ); - iExitTimer->Cancel(); // We have a client, cancel exit (if pending). return session; } @@ -216,17 +211,6 @@ void CCaSrv::DecreaseSessionCount() { iSessionCount--; - if( iSessionCount == 0 ) - { - iExitTimer->Cancel(); - CActiveScheduler* currentScheduler = CActiveScheduler::Current(); - // No more sessions; schedule self-deletion. - if( currentScheduler ) - { - iExitTimer->After( - TTimeIntervalMicroSeconds32( KCaSrvExitDelay ) ); - } - } } // End of File diff -r e492551a0d54 -r 9d806967057c contentstorage/srvsrc/catimeout.cpp --- a/contentstorage/srvsrc/catimeout.cpp Tue Mar 23 23:28:12 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: ?Description - * - */ - -// INCLUDE FILES -#include "catimeout.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CTimeout::NewL() -// --------------------------------------------------------- -// -CTimeout* CTimeout::NewL( TInt aPriority, TCallBack aCallBack ) - { - CTimeout* timeout = new ( ELeave ) CTimeout( aPriority, aCallBack ); - CleanupStack::PushL( timeout ); - timeout->ConstructL(); - CleanupStack::Pop( timeout ); - return timeout; - } - -// --------------------------------------------------------- -// CTimeout::~CTimeout() -// --------------------------------------------------------- -// -CTimeout::~CTimeout() - { - Cancel(); - } - -// --------------------------------------------------------- -// CTimeout::RunL() -// --------------------------------------------------------- -// -void CTimeout::RunL() - { -#ifdef _DEBUG - TBool again = -#endif /* def _DEBUG */ - iCallBack.CallBack(); - // Assert that this is a "once-only" callback. - __ASSERT_DEBUG( !again, User::Invariant() ); - } - -// --------------------------------------------------------- -// CTimeout::CTimeout() -// --------------------------------------------------------- -// -CTimeout::CTimeout( TInt aPriority, TCallBack aCallBack ) : - CTimer( aPriority ), iCallBack( aCallBack ) - { - CActiveScheduler::Add( this ); - } - -// End of File diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/contentstorage_api/cadefs.h --- a/homescreensrv_plat/contentstorage_api/cadefs.h Tue Mar 23 23:28:12 2010 +0200 +++ b/homescreensrv_plat/contentstorage_api/cadefs.h Tue Mar 23 23:42:03 2010 +0200 @@ -69,6 +69,8 @@ UnknownErrorCode }; +const QString caCmdOpen("open"); + #ifndef QT_NO_DEBUG_OUTPUT # define USE_QDEBUG_IF(predicate) if (!predicate) {} else qDebug() #else diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/contentstorage_api/caitemmodel.h --- a/homescreensrv_plat/contentstorage_api/caitemmodel.h Tue Mar 23 23:28:12 2010 +0200 +++ b/homescreensrv_plat/contentstorage_api/caitemmodel.h Tue Mar 23 23:42:03 2010 +0200 @@ -73,6 +73,8 @@ QSize getIconSize() const; void updateModel(); void setParentId(int parentId); + void setFlagsOn(const EntryFlags &onFlags); + void setFlagsOff(const EntryFlags &offFlags); CaEntry* entry(const QModelIndex &index) const; signals: diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/contentstorage_api/caquery.h --- a/homescreensrv_plat/contentstorage_api/caquery.h Tue Mar 23 23:28:12 2010 +0200 +++ b/homescreensrv_plat/contentstorage_api/caquery.h Tue Mar 23 23:42:03 2010 +0200 @@ -45,9 +45,9 @@ void addEntryTypeName(const QString &entryTypeName); - void setFlagsOn(EntryFlags onFlags); + void setFlagsOn(const EntryFlags &onFlags); EntryFlags flagsOn() const; - void setFlagsOff(EntryFlags offFlags); + void setFlagsOff(const EntryFlags &offFlags); EntryFlags flagsOff() const; void setSort(SortAttribute sortAttribute, diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/contentstorage_api/caservice.h --- a/homescreensrv_plat/contentstorage_api/caservice.h Tue Mar 23 23:28:12 2010 +0200 +++ b/homescreensrv_plat/contentstorage_api/caservice.h Tue Mar 23 23:42:03 2010 +0200 @@ -92,9 +92,10 @@ bool prependEntriesToGroup(const CaEntry &group, const QList &entryList) const; - bool executeCommand(int entryId, const QString &command = "open") const; + bool executeCommand(int entryId, const QString &command = + caCmdOpen) const; bool executeCommand(const CaEntry &entry, const QString &command = - "open") const; + caCmdOpen) const; CaNotifier * createNotifier(const CaNotifierFilter &filter) const; diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/homescreen_information_api/homescreen_information_api.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/homescreen_information_api/homescreen_information_api.pri Tue Mar 23 23:42:03 2010 +0200 @@ -0,0 +1,23 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +PLATFORM_HEADERS += \ + homescreen_information_api/inc/homescreendomainpskeys.h +symbian { + #qcrml export + BLD_INF_RULES.prj_exports += \ + "homescreen_information_api/inc/homescreeninformation.qcrml c:/resource/qt/crml/homescreeninformation.qcrml " +} \ No newline at end of file diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/homescreen_information_api/inc/homescreendomainpskeys.h Tue Mar 23 23:42:03 2010 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: declaration of functions providing string constants + * + */ + +#ifndef HOMESCREEN_DOMAIN_PS_KEYS_H +#define HOMESCREEN_DOMAIN_PS_KEYS_H + +/** + * P&S UID for all Home Screen state information keys provided by this API. + */ +const QUuid KPSUidHsState("0x20022F75"); + +/** + * P&S Key path for all Home Screen state information keys provided by this API. + */ +const QString HsStatePSKeyPath = "/homescreeninformation"; + +/** + * P&S Key sub path to represent the state of the Home Screen. This property is updated when + * Home screen state is changed. Valid values are defined by the enum EPSHsState + * and range from 0 to 1. + * + * @see EPSHsState + */ +const QString HsStatePSKeySubPath = "resources/homescreen/state"; + +/** + * Home screen state. + */ +enum EPSHsState + { + /** + Invalid state. P&S key not initialized. + */ + EHomeScreenInvalidState = 0, + /** + Home Screen inactive + */ + EHomeScreenInactive = 1, + /** + Home Screen in idle state + */ + EHomeScreenIdleState = 2 + }; + +#endif //HOMESCREEN_DOMAIN_PS_KEYS_H \ No newline at end of file diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/homescreen_information_api/inc/homescreeninformation.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/homescreen_information_api/inc/homescreeninformation.qcrml Tue Mar 23 23:42:03 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r e492551a0d54 -r 9d806967057c homescreensrv_plat/homescreensrv_plat.pro --- a/homescreensrv_plat/homescreensrv_plat.pro Tue Mar 23 23:28:12 2010 +0200 +++ b/homescreensrv_plat/homescreensrv_plat.pro Tue Mar 23 23:42:03 2010 +0200 @@ -23,6 +23,7 @@ include(servicemodel_api/servicemodel_api.pri) include(statemodel_api/statemodel_api.pri) include(menu_sat_interface_api/menu_sat_interface_api.pri) +include(homescreen_information_api/homescreen_information_api.pri) for(filename,PLATFORM_HEADERS){ BLD_INF_RULES.prj_exports *= "$$filename MW_LAYER_PLATFORM_EXPORT_PATH($$basename(filename))" diff -r e492551a0d54 -r 9d806967057c inc/hstest_global.h --- a/inc/hstest_global.h Tue Mar 23 23:28:12 2010 +0200 +++ b/inc/hstest_global.h Tue Mar 23 23:42:03 2010 +0200 @@ -39,7 +39,7 @@ #endif //HOMESCREEN_TEST #define HSCATCHDEBUG qDebug("Catched in: %s on line: %d",__FILE__,__LINE__); -#define HSDEBUG(a) qDebug("%s in: %s on line: %d", (a), __FILE__,__LINE__); +#define HSDEBUG(a) qDebug() << a << " in: " << __FILE__ << " on line: " << __LINE__; #ifdef NFT diff -r e492551a0d54 -r 9d806967057c rom/homescreensrv_core.iby --- a/rom/homescreensrv_core.iby Tue Mar 23 23:28:12 2010 +0200 +++ b/rom/homescreensrv_core.iby Tue Mar 23 23:42:03 2010 +0200 @@ -61,4 +61,6 @@ // ---- bagetmodel -------------------------------------------- file=ABI_DIR\BUILD_DIR\bagetmodel.dll SHARED_LIB_DIR\bagetmodel.dll +// ---- homescreen_information_api -------------------------------------------- +data=\epoc32\data\c\resource\qt\crml\homescreeninformation.qcrml resource\qt\crml\homescreeninformation.qcrml #endif // __HOMESCREENSRV_CORE_IBY__