# HG changeset patch # User hgs # Date 1286370022 -10800 # Node ID 26079c1bb5616bea4be2b6964d9f5cbfe1b937cf # Parent d1dadafc5584f6bc47c853344bc769cef1bf87cc 201039_01 diff -r d1dadafc5584 -r 26079c1bb561 activityfw/activityserviceplugin/activityserviceplugin.pro --- a/activityfw/activityserviceplugin/activityserviceplugin.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/activityserviceplugin/activityserviceplugin.pro Wed Oct 06 16:00:22 2010 +0300 @@ -111,3 +111,6 @@ "$${LITERAL_HASH}endif" MMP_RULES += defBlock } + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 activityfw/activityserviceplugin/src/afactivation.cpp --- a/activityfw/activityserviceplugin/src/afactivation.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/activityserviceplugin/src/afactivation.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -24,7 +24,10 @@ { QSharedPointer connection(new AfStorageProxy()); QT_TRAP_THROWING( - User::LeaveIfError(connection->waitActivity()); + if(!connection->waitActivity()) + { + User::Leave(KErrGeneral); + } ) d_ptr = new AfActivationPrivate(connection, this); diff -r d1dadafc5584 -r 26079c1bb561 activityfw/afactivitylauncher/group/afactivitylauncher.mmp --- a/activityfw/afactivitylauncher/group/afactivitylauncher.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/afactivitylauncher/group/afactivitylauncher.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -45,3 +45,6 @@ STATICLIBRARY afstoragecommon.lib DEBUGLIBRARY flogger.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro --- a/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugin.pro Wed Oct 06 16:00:22 2010 +0300 @@ -38,3 +38,6 @@ TARGET.EPOCALLOWDLLDATA = 1 TARGET.CAPABILITY = ALL -TCB } + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 activityfw/rom.pri --- a/activityfw/rom.pri Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/rom.pri Wed Oct 06 16:00:22 2010 +0300 @@ -15,6 +15,6 @@ # BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " -BLD_INF_RULES.prj_exports += "rom/activitymanager_core.iby CORE_APP_LAYER_IBY_EXPORT_PATH(activitymanager_core.iby)" +BLD_INF_RULES.prj_exports += "rom/activitymanager_core.iby CORE_MW_LAYER_IBY_EXPORT_PATH(activitymanager_core.iby)" BLD_INF_RULES.prj_exports += "./sis/stubs/activitymanager_stub.sis /epoc32/release/winscw/udeb/z/system/install/activitymanager_stub.sis" BLD_INF_RULES.prj_exports += "./sis/stubs/activitymanager_stub.sis /epoc32/data/z/system/install/activitymanager_stub.sis" \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/client/group/client.mmp --- a/activityfw/storage/client/group/client.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/client/group/client.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -42,3 +42,6 @@ #ifdef ENABLE_ABIV2_MODE DEBUGGABLE_UDEBONLY #endif + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/common/group/common.mmp --- a/activityfw/storage/common/group/common.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/common/group/common.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -30,3 +30,6 @@ #ifdef ENABLE_ABIV2_MODE DEBUGGABLE_UDEBONLY #endif + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/common/inc/afcmd.h --- a/activityfw/storage/common/inc/afcmd.h Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/common/inc/afcmd.h Wed Oct 06 16:00:22 2010 +0300 @@ -28,7 +28,8 @@ enum ActivityCmd { - RemoveActivity=0, + SaveActivity =0, + RemoveActivity, RemoveApplicationActivities, Activities, ApplicationActivities, @@ -39,8 +40,7 @@ GetData, NotifyChange, CancelWait, - CancelNotify, - SaveActivity + CancelNotify }; #endif //AFCMD_H diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/server/group/server.mmp --- a/activityfw/storage/server/group/server.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/server/group/server.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -56,4 +56,6 @@ #ifdef ENABLE_ABIV2_MODE DEBUGGABLE_UDEBONLY -#endif \ No newline at end of file +#endif + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/server/inc/afserver.h --- a/activityfw/storage/server/inc/afserver.h Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/server/inc/afserver.h Wed Oct 06 16:00:22 2010 +0300 @@ -29,7 +29,7 @@ class CAfStorage; -class CAfServer : public CServer2, +class CAfServer : public CPolicyServer, public MAfTaskStorage { public: diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/server/src/afserver.cpp --- a/activityfw/storage/server/src/afserver.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/server/src/afserver.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -21,17 +21,52 @@ #include "afstorage.h" #include "aftask.h" #include "afapplicationsengine.h" +#include "afcmd.h" _LIT( KActivityServerName, "hsactivitydbserver" ); _LIT(KObserverAlreadyExists, "Observer task exists"); + + +const TInt KSecureServerRanges[] = + { + SaveActivity, + Activities, + ApplicationActivities, + CancelNotify + 1 + }; + +const TUint8 KSecureServerElementsIndex[] = + { + 0, + 1, + CPolicyServer::EAlwaysPass, + CPolicyServer::ENotSupported + }; + +const TInt KSecureServerRangeCount(sizeof(KSecureServerRanges) / sizeof(TInt)); + +const CPolicyServer::TPolicyElement KSecureServerElements[] = + { + {_INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData), CPolicyServer::EFailClient}, + {_INIT_SECURITY_POLICY_C1(ECapabilityReadDeviceData ), CPolicyServer::EFailClient} + }; + +const CPolicyServer::TPolicy KSecureServerPolicy = + { + CPolicyServer::EAlwaysPass, + KSecureServerRangeCount, + KSecureServerRanges, + KSecureServerElementsIndex, + KSecureServerElements + }; // ----------------------------------------------------------------------------- /** * Constructor for performing 1st stage construction */ CAfServer::CAfServer() : -CServer2( EPriorityStandard ) +CPolicyServer( EPriorityStandard, KSecureServerPolicy ) { // No implementation required } diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/server/src/afsession.cpp --- a/activityfw/storage/server/src/afsession.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/server/src/afsession.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -130,10 +130,6 @@ case GetData: AfDataProviderTask::ExecuteL(*this,message); break; - - default: - message.Complete(CServer2::EBadMessageNumber); - break; } } diff -r d1dadafc5584 -r 26079c1bb561 activityfw/storage/server/src/afstoragesynctask.cpp --- a/activityfw/storage/server/src/afstoragesynctask.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/activityfw/storage/server/src/afstoragesynctask.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -67,36 +67,47 @@ CAfEntry *entry = CAfEntry::NewLC(msg); msg.ReadL(1, bitmapHdl); - TInt hdl = bitmapHdl(); - if (0 >= hdl) { - User::Leave(KErrCorrupt); - } + const TBool isValidBitmapHdl( 0 < bitmapHdl() ); CFbsBitmap *bitmap = new (ELeave) CFbsBitmap; CleanupStack::PushL(bitmap); - User::LeaveIfError(bitmap->Duplicate(hdl)); + if( !isValidBitmapHdl ) + { + if( !(entry->Flags() & CAfEntry::Invisible) ) + { + User::Leave(KErrCorrupt); + } + } + else + { + User::LeaveIfError( bitmap->Duplicate( bitmapHdl() ) ); + } //all data is retrieved. compleate message to improve response time msg.Complete(KErrNone); // trap all other leaving methods to prevent completing message in ServiceError TRAP_IGNORE( - RBuf thumbnailPath; - CleanupClosePushL(thumbnailPath); DeleteActivityScreenshotL(dataStorage, entry->ApplicationId(), entry->ActivityId()); - dataStorage.ThumbnailPathL(thumbnailPath, - dataStorage.Fs(), - entry->ApplicationId(), - entry->ActivityId(), - entry->Flags() & CAfEntry::Persistent); - - User::LeaveIfError(bitmap->Save(thumbnailPath)); - - entry->SetImageSrcL(thumbnailPath); + if( isValidBitmapHdl ) + { + RBuf thumbnailPath; + CleanupClosePushL(thumbnailPath); + + dataStorage.ThumbnailPathL(thumbnailPath, + dataStorage.Fs(), + entry->ApplicationId(), + entry->ActivityId(), + entry->Flags() & CAfEntry::Persistent); + + User::LeaveIfError(bitmap->Save(thumbnailPath)); + entry->SetImageSrcL(thumbnailPath); + CleanupStack::PopAndDestroy(&thumbnailPath); + } + dataStorage.SaveActivityL(*entry); - CleanupStack::PopAndDestroy(&thumbnailPath); ) CleanupStack::PopAndDestroy(bitmap); CleanupStack::PopAndDestroy(entry); diff -r d1dadafc5584 -r 26079c1bb561 common.pri --- a/common.pri Mon Sep 27 11:31:59 2010 +0300 +++ b/common.pri Wed Oct 06 16:00:22 2010 +0300 @@ -76,7 +76,7 @@ } else { # add platfrom API for windows INCLUDEPATH += \ - $$PWD/homescreensrv_plat/contentstorage_api \ + $$PWD/homescreensrv_plat/contentstorage_api/inc \ $$PWD/homescreensrv_plat/hswidgetmodel_api \ $$PWD/homescreensrv_plat/homescreen_information_api/inc } diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/bwins/caclientu.def --- a/contentstorage/caclient/bwins/caclientu.def Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/bwins/caclientu.def Wed Oct 06 16:00:22 2010 +0300 @@ -197,4 +197,5 @@ ??_ECaService@@UAE@I@Z @ 196 NONAME ; CaService::~CaService(unsigned int) ?removeEntryFromGroup@CaService@@QBE_NHH@Z @ 197 NONAME ; bool CaService::removeEntryFromGroup(int, int) const ?index@CaItemModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 198 NONAME ; class QModelIndex CaItemModel::index(int, int, class QModelIndex const &) const + ?removeAttribute@CaEntry@@QAEXABVQString@@@Z @ 199 NONAME ; void CaEntry::removeAttribute(class QString const &) diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/caclient.pri --- a/contentstorage/caclient/caclient.pri Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/caclient.pri Wed Oct 06 16:00:22 2010 +0300 @@ -15,15 +15,15 @@ # HEADERS += ./inc/*.h \ - ./../homescreensrv_plat/contentstorage_api/caclient_global.h \ - ./../homescreensrv_plat/contentstorage_api/cadefs.h \ - ./../homescreensrv_plat/contentstorage_api/caentry.h \ - ./../homescreensrv_plat/contentstorage_api/caicondescription.h \ - ./../homescreensrv_plat/contentstorage_api/caitemmodel.h \ - ./../homescreensrv_plat/contentstorage_api/camenuiconutility.h \ - ./../homescreensrv_plat/contentstorage_api/canotifier.h \ - ./../homescreensrv_plat/contentstorage_api/canotifierfilter.h \ - ./../homescreensrv_plat/contentstorage_api/caquery.h \ - ./../homescreensrv_plat/contentstorage_api/caservice.h + ./../homescreensrv_plat/contentstorage_api/inc/caclient_global.h \ + ./../homescreensrv_plat/contentstorage_api/inc/cadefs.h \ + ./../homescreensrv_plat/contentstorage_api/inc/caentry.h \ + ./../homescreensrv_plat/contentstorage_api/inc/caicondescription.h \ + ./../homescreensrv_plat/contentstorage_api/inc/caitemmodel.h \ + ./../homescreensrv_plat/contentstorage_api/inc/camenuiconutility.h \ + ./../homescreensrv_plat/contentstorage_api/inc/canotifier.h \ + ./../homescreensrv_plat/contentstorage_api/inc/canotifierfilter.h \ + ./../homescreensrv_plat/contentstorage_api/inc/caquery.h \ + ./../homescreensrv_plat/contentstorage_api/inc/caservice.h SOURCES += ./src/*.cpp diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/caclient.pro --- a/contentstorage/caclient/caclient.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/caclient.pro Wed Oct 06 16:00:22 2010 +0300 @@ -57,9 +57,7 @@ -lapgrfx \ -lapparc \ -lSatClient - - include(caclient_s60.pri) } @@ -73,3 +71,6 @@ include(caclient_stub.pri) include(installs_win32.pri) } + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/eabi/caclientu.def --- a/contentstorage/caclient/eabi/caclientu.def Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/eabi/caclientu.def Wed Oct 06 16:00:22 2010 +0300 @@ -214,4 +214,5 @@ _ZTV21CaClientNotifierProxy @ 213 NONAME _ZTV7CaEntry @ 214 NONAME _ZTV9CaService @ 215 NONAME + _ZN7CaEntry15removeAttributeERK7QString @ 216 NONAME diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/inc/caentry_p.h --- a/contentstorage/caclient/inc/caentry_p.h Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/inc/caentry_p.h Wed Oct 06 16:00:22 2010 +0300 @@ -60,7 +60,8 @@ QMap attributes() const; QString attribute(const QString &name) const; void setAttribute(const QString &name, const QString &value); - + void removeAttribute(const QString &name); + HbIcon makeIcon(const QSizeF &size) const; EntryRole role() const; diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/src/caentry.cpp --- a/contentstorage/caclient/src/caentry.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/src/caentry.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -403,6 +403,27 @@ } /*! + Removes attribute. + \param name name of an attribute. + + \code + ... + QString attrName_1( "name_1" ); + QString attrValue_1( "value_1" ); + QString attrName_2( "name_2" ); + QString attrValue_2( "value_2" ); + resultEntry->setAttribute( attrName_1, attrValue_1 ); + resultEntry->setAttribute( attrName_2, attrValue_2 ); + resultEntry->removeAttribute( attrName_2 ); + + \endcode + */ +void CaEntry::removeAttribute(const QString &name) +{ + m_d->removeAttribute(name); +} + +/*! Creates an icon. \param size icon size to display \retval created icon (HbIcon). @@ -641,6 +662,14 @@ } /*! + Removes attribute. + \param name name of an attribute. + */ +void CaEntryPrivate::removeAttribute(const QString &name) +{ + mAttributes.remove(name); +} +/*! Creates an icon. \param size icon size to display \retval created icon (HbIcon). diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/src/caiconcache.cpp --- a/contentstorage/caclient/src/caiconcache.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/src/caiconcache.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -153,7 +153,11 @@ QString CaIconCache::key(const CaEntry &entry, const QSizeF &size) { QString key; - if (!entry.iconDescription().filename().isEmpty()) { + if (!entry.iconDescription().skinId().isEmpty()) { + key.append(entry.iconDescription().skinId()); + key.append(separator); + key.append(entry.entryTypeName()); + } else if (!entry.iconDescription().filename().isEmpty()) { key.append(entry.iconDescription().filename()); key.append(separator); key.append(entry.entryTypeName()); @@ -161,8 +165,8 @@ key.append(separator); key.append(entry.id()); } + key.append(separator); if (size.isValid()) { - key.append(separator); key += QString::number(size.height()); key.append(separator); key += QString::number(size.width()); diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/src/caitemmodel.cpp --- a/contentstorage/caclient/src/caitemmodel.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/src/caitemmodel.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -16,7 +16,7 @@ */ #include - +#include #include "caclient_defines.h" #include "caitemmodel.h" #include "caitemmodel_p.h" @@ -489,8 +489,9 @@ break; case CaItemModel::CollectionTitleRole: if (!pEntry->attribute(COLLECTION_TITLE_NAME).isNull()) { - variant = QVariant(pEntry-> - attribute(COLLECTION_TITLE_NAME).toUtf8()); + variant = QVariant( + HbParameterLengthLimiter(pEntry->attribute(COLLECTION_TITLE_NAME)) + .arg(this->rowCount()).arg(pEntry->text())); } else { variant = QVariant(pEntry->text()); @@ -893,9 +894,9 @@ { CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::removeItem"); int row = mEntries.indexOf(id); - if (row >= 0) { + if (row >= 0 && rowCount() > 1) { m_q->beginRemoveRows(QModelIndex(), mEntries.indexOf(id), - mEntries.indexOf(id)); + mEntries.indexOf(id)); mEntries.remove(id); m_q->endRemoveRows(); } else { @@ -1032,6 +1033,7 @@ break; } emitEmpty(previousCount); + emitCountChange(previousCount); CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelItem"); } diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/caclient/src/caservice.cpp --- a/contentstorage/caclient/src/caservice.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/caclient/src/caservice.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -369,14 +369,7 @@ */ bool CaService::touch(const CaEntry &entry) const { - if (entry.flags() & RemovableEntryFlag && - (entry.flags() & UsedEntryFlag) == 0 && - entry.role() == ItemEntryRole && - entry.entryTypeName() != QString(Hs::packageTypeName)) { - return m_d->touch(entry); - } else { - return true; - } + return m_d->touch(entry); } /*! @@ -1132,15 +1125,22 @@ bool CaServicePrivate::touch(const CaEntry &entry) { qDebug() << "CaServicePrivate::touch" << "entryId: " << entry.id(); - - mErrorCode = mProxy->touch(entry); - if (mErrorCode == ServerTerminated) { - if (!mProxy->connect()) { - if (mNotifierProxy) { - mNotifierProxy->connectSessions(); + + mErrorCode = NoErrorCode; + if (entry.flags() & RemovableEntryFlag && + (entry.flags() & UsedEntryFlag) == 0 && + entry.role() == ItemEntryRole && + entry.entryTypeName() != QString(Hs::packageTypeName)) { + + mErrorCode = mProxy->touch(entry); + if (mErrorCode == ServerTerminated) { + if (!mProxy->connect()) { + if (mNotifierProxy) { + mNotifierProxy->connectSessions(); + } + mErrorCode = mProxy->touch(entry); } - mErrorCode = mProxy->touch(entry); - } + } } qDebug() << "CaServicePrivate::touch mErrorCode:" << mErrorCode; @@ -1368,14 +1368,13 @@ return 0; } - if (command == caCmdOpen) { - touch(entry); - } - int errorCode = mCommandHandler->execute(entry, command, receiver, member); mErrorCode = CaObjectAdapter::convertErrorCode(errorCode); + if (command == caCmdOpen) { + touch(entry); + } qDebug() << "CaServicePrivate::executeCommand mErrorCode on return:" << mErrorCode; diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/cahandler/app/app.pro --- a/contentstorage/cahandler/app/app.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/cahandler/app/app.pro Wed Oct 06 16:00:22 2010 +0300 @@ -52,3 +52,6 @@ } + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/cahandler/tapp/src/catapphandler.cpp --- a/contentstorage/cahandler/tapp/src/catapphandler.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/cahandler/tapp/src/catapphandler.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -41,7 +41,7 @@ */ CaTappHandler::CaTappHandler(QObject *parent) { - Q_UNUSED(parent); + Q_UNUSED(parent); mAiwMgr = new XQApplicationManager(); } diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/cahandler/tapp/tapp.pro --- a/contentstorage/cahandler/tapp/tapp.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/cahandler/tapp/tapp.pro Wed Oct 06 16:00:22 2010 +0300 @@ -47,3 +47,6 @@ include(tapp.pri) + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/cahandler/url/url.pro --- a/contentstorage/cahandler/url/url.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/cahandler/url/url.pro Wed Oct 06 16:00:22 2010 +0300 @@ -50,3 +50,6 @@ } + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/camificonengine/camificonengine.pro --- a/contentstorage/camificonengine/camificonengine.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/camificonengine/camificonengine.pro Wed Oct 06 16:00:22 2010 +0300 @@ -57,4 +57,6 @@ symbian:TARGET.UID3=0x2002DCF8 -include(camificonengine.pri) \ No newline at end of file +include(camificonengine.pri) + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casatinterface/group/MenuInterface.mmp --- a/contentstorage/casatinterface/group/MenuInterface.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casatinterface/group/MenuInterface.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -36,3 +36,6 @@ LIBRARY euser.lib LANG SC + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casoftwareregistry/casoftwareregistry.pri --- a/contentstorage/casoftwareregistry/casoftwareregistry.pri Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casoftwareregistry/casoftwareregistry.pri Wed Oct 06 16:00:22 2010 +0300 @@ -14,6 +14,6 @@ # Description: # -HEADERS += ../../homescreensrv_plat/contentstorage_api/casoftwareregistry.h -HEADERS += ../../homescreensrv_plat/contentstorage_api/cauninstallnotifier.h +HEADERS += ../../homescreensrv_plat/contentstorage_api/inc/casoftwareregistry.h +HEADERS += ../../homescreensrv_plat/contentstorage_api/inc/cauninstallnotifier.h SOURCES += ./src/*.cpp diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casoftwareregistry/casoftwareregistry.pro --- a/contentstorage/casoftwareregistry/casoftwareregistry.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casoftwareregistry/casoftwareregistry.pro Wed Oct 06 16:00:22 2010 +0300 @@ -56,4 +56,6 @@ INCLUDEPATH += ./stub/inc include(casoftwareregistry_stub.pri) -} \ No newline at end of file +} + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp --- a/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -293,7 +293,6 @@ XQConversions::s60DescToQString(entry.Vendor()); QString drives; - QString drv; TChar drive; const TInt driveListLen(entry.InstalledDrives().Length()); @@ -301,9 +300,8 @@ if (entry.InstalledDrives()[i] != '\0') { if (!drives.isEmpty()) { - drives = drives.append(","); + drives = drives.append("\n"); } - drv = QString(QChar('A'+ i)).append(":"); if (DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone && QChar('A'+ i) == QChar(drive)) { diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casoftwareregistry/src/casoftwareregistry.cpp --- a/contentstorage/casoftwareregistry/src/casoftwareregistry.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casoftwareregistry/src/casoftwareregistry.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -18,8 +18,9 @@ #include #include -#include "cauninstallnotifier.h" -#include "casoftwareregistry.h" +#include +#include + #include "casoftwareregistry_p.h" diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/caappscanner/group/caappscanner.mmp --- a/contentstorage/casrv/caappscanner/group/caappscanner.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/caappscanner/group/caappscanner.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -56,3 +56,6 @@ LIBRARY efsrv.lib LIBRARY platformenv.lib LIBRARY scrclient.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro --- a/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/calocalizerscanner/calocalizerscanner.pro Wed Oct 06 16:00:22 2010 +0300 @@ -58,3 +58,6 @@ + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/calocalizerscanner/contentstorage.qm Binary file contentstorage/casrv/calocalizerscanner/contentstorage.qm has changed diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/calocalizerscanner/contentstorage.ts --- a/contentstorage/casrv/calocalizerscanner/contentstorage.ts Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/calocalizerscanner/contentstorage.ts Wed Oct 06 16:00:22 2010 +0300 @@ -1,66 +1,97 @@ - + - - GroupBox widget, shows the label for the Office collection. - Office - Office - - applib_09 - subtitle - ap - False - - - GroupBox widget, shows the label for the Games collection. - Games - Games - - applib_09 - subtitle - ap - False - - - List item primary text. Predefined collection for products that have more than 4 items to be grouped under "Office". - Office - Office - - applib_03 - dblist_1 - ap - False - - - List item primary text. Predefined collection for products that have more than 4 games preinstalled. - Games - Games - - applib_03 - dblist_1 - ap - False - - - List item primary text. Predefined, dynamic collection for post-installed applications. - Downloads - Downloads - - applib_03 - dblist_1 - ap - False - - - GroupBox widget, shows the label for the Downloads collection. - Downloads - Downloads - - applib_05 - subtitle - ap - False - + + + Recently added + Primary list item widget, shows the label for the Recently added collection. + Recently added + applib_005 + dblist_1 + app + qtl_list_pri_large_graphic + False + + + Games + List item primary text. Predefined collection for products that have more than 4 games preinstalled. + Games + applib_003 + dblist_1 + app + qtl_list_pri_large_graphic + False + + + Office + List item primary text. Predefined collection for products that have more than 4 items to be grouped under "Office". + Office + applib_003 + dblist_1 + app + qtl_list_pri_large_graphic + False + + + Collections > Recently added (%L1) + GroupBox widget, shows the label for the Downloads collection. + Collections > Recently added (%L1) + applib_005 + subtitle + app + qtl_groupbox_simple_sec + False + + + Collections > Games (%L1) + GroupBox widget, shows the label for the Games collection.. + Collections > Games (%L1) + applib_009 + subtitle + app + qtl_groupbox_simple_sec + False + + + Collections > Office (%L1) + GroupBox widget, shows the label for the Office collection. + Collections > Office (%L1) + applib_009 + subtitle + app + qtl_groupbox_simple_sec + False + + + Essentials + Primary list item widget, shows the label for the Essentials collection. + Essentials + applib_003 + dblist_1 + app + qtl_list_pri_large_graphic + False + + + Collections > Essentials (%L1) + GroupBox widget, shows the label for the Essentials collection. + Collections > Essentials (%L1) + applib_009 + subtitle + app + qtl_groupbox_simple_sec + False + + + Collections > %2 (%L1) + GroupBox widget, shows the label for the user-created collection. %2 is the name of the collection and %L1 is the number of applications. + Collections > %2 (%L1) + applib_009 + subtitle + app + qtl_groupbox_simple_sec + False + diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/casatmonitor/group/casatmonitor.mmp --- a/contentstorage/casrv/casatmonitor/group/casatmonitor.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/casatmonitor/group/casatmonitor.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -53,3 +53,6 @@ LIBRARY camenu.lib LIBRARY bafl.lib LIBRARY estor.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/casrvmgr/group/casrvmanager.mmp --- a/contentstorage/casrv/casrvmgr/group/casrvmanager.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/casrvmgr/group/casrvmanager.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -38,3 +38,6 @@ DEBUGLIBRARY flogger.lib // End of File + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/causifscanner/group/causifscanner.mmp --- a/contentstorage/casrv/causifscanner/group/causifscanner.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/causifscanner/group/causifscanner.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -53,3 +53,6 @@ LIBRARY camenu.lib LIBRARY bafl.lib LIBRARY efsrv.lib + +LIBRARY PlatformEnv.lib +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/causifscanner/src/causifscanner.cpp --- a/contentstorage/casrv/causifscanner/src/causifscanner.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/causifscanner/src/causifscanner.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -18,6 +18,7 @@ #include #include #include +#include #include "causifscanner.h" #include "cainnerentry.h" @@ -162,7 +163,48 @@ if( aEntry->IsRemovable() ) { aCaEntry->SetFlags( aCaEntry->GetFlags() | ERemovable ); + + TChar drive; + RBuf drives; + drives.CreateL(KMaxFileName); + CleanupClosePushL( drives ); + const TInt driveListLen(aEntry->InstalledDrives().Length()); + for (TInt i( 0 ); i < driveListLen; ++i) + { + // Skip PhoneMemory and if we have some icon resolved + if (aEntry->InstalledDrives()[i] != '\0' && drives.Length() == 0 + && (DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone + && TChar('A'+ i) != TChar(drive))) + { + TUint drvStatus( 0 ); + int err = DriveInfo::GetDriveStatus( iFs, i, drvStatus ); + if ( ( drvStatus & DriveInfo::EDriveInternal ) && + ( drvStatus & DriveInfo::EDriveExternallyMountable ) ){ + // Mass Storage + drives.Append(_L("qtg_mono_hard_disk")); + } + else if(drvStatus & DriveInfo::EDriveRemote || + drvStatus & DriveInfo::EDriveUsbMemory) + { + // Usb or remote drive + drives.Append(_L("qtg_mono_usb")); + } + else if( ( drvStatus & DriveInfo::EDriveRemovable ) && + ( drvStatus & DriveInfo::EDriveExternallyMountable ) ) + { + // MMC + drives.Append(_L("qtg_mono_memory_in_use")); + } + } + } + if (drives.Length() > 0) { + aCaEntry->AddAttributeL( KCaAttrDrivesIconIds, drives ); } + CleanupStack::PopAndDestroy( &drives ); + } + + // entries obtained with usif should have component id. //it's needed for uninstalling RBuf compIdDesc; @@ -367,3 +409,4 @@ iStorageProxy.RemoveL( entriesId ); CleanupStack::PopAndDestroy( &entriesId ); } + diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp --- a/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -67,3 +67,6 @@ // End of file + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h Wed Oct 06 16:00:22 2010 +0300 @@ -236,8 +236,6 @@ const TDesC & aPackageUid, TChar& aDrive ) const; - - private: // Data diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Wed Oct 06 16:00:22 2010 +0300 @@ -150,6 +150,18 @@ void UpdateCompIdAndRemovableFlagL( const TDesC& aManifestFilePathName, CCaInnerEntry& aEntry ) const; + /** + * Make not empty collections with not hidden items visible. + */ + void MakeNotEmptyCollectionsVisibleL(); + + /** + * Make collection visible if it has visible entry. + * @param aEntry a collection entry. + */ + void MakeCollectionVisibleIfHasVisibleEntryL( + CCaInnerEntry* aEntry ); + private: // Data diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -163,7 +163,7 @@ // CCaWidgetDescription *CCaWidgetDescription::CloneL() { - CCaWidgetDescription* clone = CCaWidgetDescription::NewL(); + CCaWidgetDescription* clone = CCaWidgetDescription::NewLC(); clone->SetPathL( GetPath() ); clone->SetMmcIdL( GetMmcId() ); @@ -181,6 +181,7 @@ clone->SetServiceXmlL( GetServiceXml() ); clone->SetManifestFilePathNameL( GetManifestFilePathName() ); + CleanupStack::Pop( clone ); return clone; } diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -109,8 +109,6 @@ ScanOnDriveL( currentDriveLetter ); } } - - return iWidgets; } @@ -204,8 +202,8 @@ } else { - TRAP_IGNORE( ParseManifestFileL( manifestFilePathName, aDirectoryName, - aDrive ) ); + TRAP_IGNORE( ParseManifestFileL( + manifestFilePathName, aDirectoryName, aDrive ) ); } CleanupStack::PopAndDestroy( &manifestFilePathName ); } @@ -297,7 +295,7 @@ } CleanupStack::PopAndDestroy( &childElementList ); - //set path for hs to use, trim last 2 chars (doubleslash) + // Set path for hs to use, trim the last character (backslash). HBufC *libraryPath = GetManifestDirectoryPathLC( aPackageUid, aDrive ); widgetDescriptor->SetPathL(libraryPath->Mid(0,libraryPath->Length()-1)); CleanupStack::PopAndDestroy(libraryPath); @@ -773,5 +771,4 @@ return result; } - // End of File diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -103,6 +103,7 @@ FetchWidgetsL(); AddWidgetsL( iParser->WidgetsScanL( iWidgetDBCache ) ); RemoveWidgetsL(); + MakeNotEmptyCollectionsVisibleL(); } // ---------------------------------------------------------------------------- @@ -368,7 +369,6 @@ // // ---------------------------------------------------------------------------- // - void CCaWidgetStorageHandler::SetLocalizationsL( const CCaWidgetDescription* aWidget, TInt aEntryId ) { @@ -415,7 +415,6 @@ // // ---------------------------------------------------------------------------- // - void CCaWidgetStorageHandler::UpdateCompIdAndRemovableFlagL( const TDesC& aManifestFilePathName, CCaInnerEntry& aEntry ) const { @@ -462,4 +461,61 @@ CleanupStack::PopAndDestroy( &componentIds ); } +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +void CCaWidgetStorageHandler::MakeNotEmptyCollectionsVisibleL() + { + RPointerArray resultArray; + CleanupResetAndDestroyPushL( resultArray ); + CCaInnerQuery* hiddenCollectionsQuery = CCaInnerQuery::NewLC(); + CDesC16ArrayFlat* entryType = new ( ELeave ) CDesC16ArrayFlat( + KGranularityOne ); + CleanupStack::PushL( entryType ); + entryType->AppendL( KCaTypeCollection ); + hiddenCollectionsQuery->SetEntryTypeNames( entryType ); + hiddenCollectionsQuery->SetFlagsOff( EVisible ); + iStorage->GetEntriesL( hiddenCollectionsQuery, resultArray ); + CleanupStack::Pop( entryType ); + CleanupStack::PopAndDestroy( hiddenCollectionsQuery ); + if( resultArray.Count()>0 ) + { + for( TInt i=0; i resultEntriesArray; + CleanupResetAndDestroyPushL( resultEntriesArray ); + CCaInnerQuery* visibleEntriesQuery = CCaInnerQuery::NewLC(); + visibleEntriesQuery->SetParentId( aEntry->GetId() ); + visibleEntriesQuery->SetFlagsOn( EVisible ); + visibleEntriesQuery->SetFlagsOff( EMissing ); + iStorage->GetEntriesL( visibleEntriesQuery, resultEntriesArray ); + if( resultEntriesArray.Count()>0 ) + { + // set collection visible if hidden + if( !( aEntry->GetFlags() & EVisible ) ) + { + aEntry->SetFlags( aEntry->GetFlags() | EVisible ); + // update here this collection + iStorage->AddL( aEntry ); + } + } + CleanupStack::PopAndDestroy( visibleEntriesQuery ); + CleanupStack::PopAndDestroy( &resultEntriesArray ); + } + // End of File diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql --- a/contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql Wed Oct 06 16:00:22 2010 +0300 @@ -45,24 +45,24 @@ {%- set LocalizeNames = false -%} {%- if Collections == "Collections" -%} {%- set LocalizeNames = feat_tree.CaStorageDbSetting[Collections].LocalizeNames._value[col] or false -%} - {%- set TranslationFile = feat_tree.CaStorageDbSetting[Collections].TranslationFile._value[col]|string|reverse|replace('_','',1)|reverse~'_' or ''-%} - {%- endif %} + {%- set TranslationFile = feat_tree.CaStorageDbSetting[Collections].TranslationFile._value[col] or '' -%} + {%- if TranslationFile != "" -%} + {%- set TranslationFile = TranslationFile~'_' -%} + {%- endif -%} + {%- endif -%} {%- set IconFileName = feat_tree.CaStorageDbSetting[Collections].Icon.localPath._value[col] or '' -%} {%- set IconSkinId = feat_tree.CaStorageDbSetting[Collections].IconSkinId._value[col] or '' -%} {%- if IconFileName != "" -%} {%- set IconFileName = stripPath(IconFileName) -%} - {%- endif %} + {%- endif -%} {%- if ShortName == "" -%} {%- set ShortName = Name -%} - {%- endif %} - {%- if TitleName == "" -%} - {%- set TitleName = Name -%} - {%- endif %} + {%- endif -%} {%- if GroupName == "" -%} {%- set GroupName = Name -%} - {%- endif %} - INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS, COL_TITLE_NAME {% if LocalizeNames -%}, TRANSLATION_FILE{%- endif %}, COL_SHORT_NAME, ICON_FILENAME, ICON_SKIN_ID) - VALUES ( '{{Name}}', '{{GroupName}}', {% if Locked -%} 0 {% else %} 4 {%- endif %}, "{{TitleName}}"{% if LocalizeNames -%}, "{{TranslationFile}}"{%- endif %}, "{{ShortName}}", "{{IconFileName}}", "{{IconSkinId}}"); + {%- endif -%} + INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS{%- if TitleName -%}, COL_TITLE_NAME{%- endif %} {% if LocalizeNames -%}, TRANSLATION_FILE{%- endif %}, COL_SHORT_NAME, ICON_FILENAME, ICON_SKIN_ID) + VALUES ( '{{Name}}', '{{GroupName}}', {% if Locked -%} 0 {% else %} 4 {%- endif %}{%- if TitleName -%}, "{{TitleName}}"{%- endif %}{% if LocalizeNames -%}, "{{TranslationFile}}"{%- endif %}, "{{ShortName}}", "{{IconFileName}}", "{{IconSkinId}}"); {% endfor %} {%- endmacro %} diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/castorage/data/castoragedb_create.sql --- a/contentstorage/castorage/data/castoragedb_create.sql Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/castorage/data/castoragedb_create.sql Wed Oct 06 16:00:22 2010 +0300 @@ -211,8 +211,8 @@ ( (IC_FILENAME = "" AND IC_SKIN_ID = "") OR (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME AND IC_SKIN_ID = new.ICON_SKIN_ID AND ICON_ID <> last_insert_rowid()) IS NOT NULL); -- INSERT ENTRY - INSERT OR IGNORE INTO CA_ENTRY (EN_TEXT, EN_ROLE, EN_TYPE_NAME, EN_ICON_ID ) - VALUES ( new.ITEM_NAME, 1, "widget", (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME AND IC_SKIN_ID = new.ICON_SKIN_ID )); + INSERT OR IGNORE INTO CA_ENTRY (EN_TEXT, EN_ROLE, EN_TYPE_NAME, EN_FLAGS, EN_ICON_ID ) + VALUES ( new.ITEM_NAME, 1, "widget", 0, (SELECT ICON_ID FROM CA_ICON WHERE IC_FILENAME = new.ICON_FILENAME AND IC_SKIN_ID = new.ICON_SKIN_ID )); -- INSERT ATTRIBUTES INSERT OR IGNORE INTO CA_ATTRIBUTE (AT_ENTRY_ID, AT_NAME, AT_VALUE ) VALUES ( ( SELECT ENTRY_ID FROM CA_ENTRY WHERE EN_TEXT = new.ITEM_NAME ) ,"packageuid",new.PACKAGE_UID); diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/castorage/group/castorage.mmp --- a/contentstorage/castorage/group/castorage.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/castorage/group/castorage.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -44,3 +44,6 @@ DEBUGLIBRARY flogger.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/cautils/cautils.pro --- a/contentstorage/cautils/cautils.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/cautils/cautils.pro Wed Oct 06 16:00:22 2010 +0300 @@ -40,3 +40,6 @@ CONFIG -= stl include(cautils.pri) } + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/group/camenu.mmp --- a/contentstorage/group/camenu.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/group/camenu.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: -* Version : %version: 19.1.12 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: 19.1.13 % << Don't touch! Updated by Synergy at check-out. * */ @@ -72,3 +72,6 @@ LIBRARY HbCore.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/group/camenusrv.mmp --- a/contentstorage/group/camenusrv.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/group/camenusrv.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -43,3 +43,6 @@ LIBRARY cautils.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/inc/cadef.h --- a/contentstorage/inc/cadef.h Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/inc/cadef.h Wed Oct 06 16:00:22 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: Definition of different constants - * Version : %version: 10.1.28 % << Don't touch! Updated by Synergy at check-out. + * Version : %version: 10.1.30 % << Don't touch! Updated by Synergy at check-out. * */ @@ -85,6 +85,7 @@ _LIT( KCaAttrAppTypeValueCWRT, "cwrt"); _LIT( KCaAttrAppTypeValueNative, "native"); _LIT( KCaAttrComponentId, "component_id" ); +_LIT( KCaAttrDrivesIconIds, "drivesIconIds"); _LIT( KCaAttrAppSettingsPlugin, "app_settings_plugin"); _LIT( KCaScrPropertyAppSettings, "settingsName"); _LIT( KPreviewImageAttrName, "preview_image_name" ); @@ -110,6 +111,10 @@ _LIT( KLocalizationEnDescription, "EN_DESCRIPTION" ); const TInt charsToFilename= 6; // loc://email/qtn_gmail_mail_account +_LIT( KCaQmFile, "contentstorage_" );//default content storage qm file +//Defaul localize string for collection +_LIT( KDefaultLocTitleName, "txt_applib_subtitle_collections_user" ); + const TInt KGranularityOne = 1; const TInt KUidChars = 10; @@ -160,6 +165,7 @@ // Menu clients always need to check that the necessary attributes are present. // _LIT( KCaAttrShortName, "short_name" ); ///< Short name. +_LIT( KCaAttrTitleName, "title_name" ); ///< Title name. _LIT( KCaComponentId, "component_id" ); ///< Component Id. // Built-in types and attributes. diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/srvinc/castorageproxy.h --- a/contentstorage/srvinc/castorageproxy.h Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/srvinc/castorageproxy.h Wed Oct 06 16:00:22 2010 +0300 @@ -201,7 +201,9 @@ CCaLocalizationEntry* LocalizeDescriptionL( CCaInnerEntry* aEntry ); - TBool InitializeTranslatorL( TDesC& aQmFilename ); + void AddTitleNameL( CCaInnerEntry* aEntry ); + + TBool InitializeTranslatorL( const TDesC& aQmFilename ); private: //Data @@ -215,6 +217,11 @@ * Sessions using this engine. Own. */ RPointerArray iHandlerNotifier; + + /** + * Translated user collection name. Own. + */ + RBuf iTitleUserColName; CA_STORAGE_TEST_FRIEND_CLASS( TestCaClient ) diff -r d1dadafc5584 -r 26079c1bb561 contentstorage/srvsrc/castorageproxy.cpp --- a/contentstorage/srvsrc/castorageproxy.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/contentstorage/srvsrc/castorageproxy.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -75,6 +75,7 @@ // CCaStorageProxy::~CCaStorageProxy() { + iTitleUserColName.Close(); delete iStorage; iHandlerNotifier.Close(); } @@ -87,6 +88,17 @@ RPointerArray& aResultContainer ) { iStorage->GetEntriesL( aQuery, aResultContainer ); + if( aResultContainer.Count() == 1 + && aResultContainer[0]-> + GetEntryTypeName().Compare( KCaTypeCollection ) == KErrNone ) + { + TPtrC titleName; + if( !aResultContainer[0]->FindAttribute( KCaAttrTitleName, titleName ) ) + { + AddTitleNameL( aResultContainer[0] ); + } + } + } // --------------------------------------------------------------------------- @@ -454,7 +466,7 @@ { CCaLocalizationEntry* result = NULL; TInt textLength = aEntry->GetText().Length(); - if (textLength > 0) + if( textLength > 0 ) { TChar delimiter = '/'; // cannot add it as global RBuf title; @@ -464,12 +476,14 @@ if ( pos > 0 && pos + 1 < textLength ) // 1 is for delimiters { TPtrC16 logString = title.Mid( pos + 1 ); - TInt qmFileNameLength = textLength - charsToFilename - 1 - logString.Length(); + TInt qmFileNameLength = + textLength - charsToFilename - 1 - logString.Length(); TPtrC16 qmFile = title.Mid( charsToFilename, qmFileNameLength ); if ( InitializeTranslatorL( qmFile ) ) { result = CCaLocalizationEntry::NewLC(); - HBufC* translatedString = HbTextResolverSymbian::LoadLC( logString ); + HBufC* translatedString = + HbTextResolverSymbian::LoadLC( logString ); if ( translatedString->Compare( logString ) ) { result->SetStringIdL( logString ); @@ -505,7 +519,7 @@ { CCaLocalizationEntry* result = NULL; TInt dscLength = aEntry->GetDescription().Length(); - if ( dscLength ) + if( dscLength ) { TChar delimiter = '/'; // cannot add it as global RBuf description; @@ -551,7 +565,32 @@ // // --------------------------------------------------------- // -TBool CCaStorageProxy::InitializeTranslatorL( TDesC& aQmFilename ) +void CCaStorageProxy::AddTitleNameL( CCaInnerEntry* aEntry ) + { + if( !iTitleUserColName.Length() ) + { + if ( InitializeTranslatorL( KCaQmFile ) ) + { + HBufC* translatedString = + HbTextResolverSymbian::LoadLC( KDefaultLocTitleName ); + if ( translatedString->Compare( KDefaultLocTitleName ) ) + { + iTitleUserColName.CreateL( *translatedString ); + } + CleanupStack::PopAndDestroy( translatedString ); + } + } + if( iTitleUserColName.Length() ) + { + aEntry->AddAttributeL( KCaAttrTitleName, iTitleUserColName ); + } + } + +// --------------------------------------------------------- +// +// --------------------------------------------------------- +// +TBool CCaStorageProxy::InitializeTranslatorL( const TDesC& aQmFilename ) { TBool result = HbTextResolverSymbian::Init( aQmFilename, KLocalizationFilepathC ); if ( !result ) @@ -560,6 +599,7 @@ TChar currentDriveLetter; TDriveList driveList; RFs fs; + CleanupClosePushL( fs ); User::LeaveIfError( fs.Connect() ); User::LeaveIfError( fs.DriveList( driveList ) ); @@ -583,7 +623,7 @@ path.Zero(); } CleanupStack::PopAndDestroy( &path ); - fs.Close(); + CleanupStack::PopAndDestroy( &fs ); if( !result ) { diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv.pro --- a/homescreensrv.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/homescreensrv.pro Wed Oct 06 16:00:22 2010 +0300 @@ -23,7 +23,6 @@ symbian:SUBDIRS += activityfw symbian:SUBDIRS += taskswitcher symbian:SUBDIRS += hsappkeyhandler -symbian:SUBDIRS += tsdevicedialog exists(tsrc/tsrc.pro): SUBDIRS += tsrc diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/afactivities_global.h --- a/homescreensrv_plat/activity_framework_api/afactivities_global.h Mon Sep 27 11:31:59 2010 +0300 +++ b/homescreensrv_plat/activity_framework_api/afactivities_global.h Wed Oct 06 16:00:22 2010 +0300 @@ -19,6 +19,7 @@ #define AFACTIVITIES_GLOBAL_H #include +#include #ifdef AFACTIVITIES_LIB #define AFACTIVITIES_EXPORT Q_DECL_EXPORT @@ -43,4 +44,6 @@ const char KActivityUriBackgroundKey[] = "activityinbackground"; } +Q_DECLARE_METATYPE( Af::ActivationReason ) + #endif // AFACTIVITIES_GLOBAL_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/mocks/inc/afstorageclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/mocks/inc/afstorageclient.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,88 @@ +/* +* 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 AFSTORAGECLIENT_H +#define AFSTORAGECLIENT_H + +#include + +class CAfEntry; +class MAfAsyncRequestObserver; + +class CAfStorageClient : public CBase +{ +public: + static CAfStorageClient *NewL(MAfAsyncRequestObserver &observer); + virtual ~CAfStorageClient(); + +private: + CAfStorageClient(MAfAsyncRequestObserver &observer); + +public: + int saveActivity(const CAfEntry &entry, TInt imageHandle); + int removeActivity(const CAfEntry &entry); + int removeApplicationActivities(const CAfEntry &entry); + int activities(RPointerArray &dst, int limit = 0); + int applicationActivities(RPointerArray &dst, const CAfEntry &entry); + int activityData(CAfEntry *&dst, const CAfEntry &entry); + int waitActivity(); + int launchActivity(const CAfEntry &entry); + int getThumbnail(const TDesC &imagePath, void *userData); + int notifyDataChange(); + +private: + MAfAsyncRequestObserver &mObserver; + +private: + void updateLastEntry(const CAfEntry &entry); + +public: + void invokeWaitActivityCallback(int result, const TDesC8 &data); + void invokeGetThumbnailCallback(int result, int bitmapHandle, void *userData); + void invokeDataChangeCallback(int result); + + static void clearLastCallInfo(); + +public: + enum LastMethodCalled { + NoCall, + SaveActivityMethod, + RemoveActivityMethod, + RemoveApplicationActivitiesMethod, + ActivitiesMethod, + ApplicationActivitiesMethod, + ActivityDataMethod, + WaitActivityMethod, + LaunchActivityMethod, + GetThumbnailMethod, + NotifyDataChangeMethod, + }; + +public: + static TInt constructorError; + static TInt expectedReturnCode; + + static CAfEntry *lastCallEntry; + static TInt lastCallImageHandle; + static TSize lastCallThumbnailSize; + static HBufC *lastCallThumbnailPath; + static void *lastCallUserData; + + static LastMethodCalled lastMethodCalled; +}; + +#endif //AFSTORAGECLIENT_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/mocks/inc/afstorageproxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/mocks/inc/afstorageproxy.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,60 @@ +/* +* 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 AFSTORAGEPROXY_H +#define AFSTORAGEPROXY_H + +#include +#include +#include + +class AfStorageProxy : public QObject +{ + Q_OBJECT + +public: + AfStorageProxy(QObject *parent = 0); + virtual ~AfStorageProxy(); + +public: + bool saveActivity(int applicationId, const QString &activityId, const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, const QPixmap &screenshot); + bool removeActivity(int applicationId, const QString &activityId); + bool removeApplicationActivities(int applicationId); + bool activities(QList &list, int limit = 0); + bool applicationActivities(QStringList &list, int applicationId); + bool activityData(QVariant &data, int applicationId, const QString &activityId); + bool activityMetaData(QVariantHash &metadata, int applicationId, const QString &activityId); + bool waitActivity(); + bool launchActivity(int applicationId, const QString &activityUri); + bool getThumbnail(const QString &imagePath, void *userData); + bool notifyDataChange(); + +signals: + void activityRequested(const QString &activityUri); + void thumbnailRequested(const QPixmap &thumbnailPixmap, void *userData); + void dataChanged(); + +public: // additional mocked implementation members + void emitActivityRequested(const QString &activityUri); + + QVariantHash mLastCallParams; + //for generating leave in afactivattion + static bool waitFailed; + static AfStorageProxy *instance; +}; + +#endif //AFSTORAGEPROXY_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/mocks/inc/applicationlauncher_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/mocks/inc/applicationlauncher_p.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,46 @@ +/* +* 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 APPLICATIONLAUNCHER_P_H +#define APPLICATIONLAUNCHER_P_H + +#include +#include + +class ApplicationLauncherPrivate +{ + +public: + ApplicationLauncherPrivate(); + ~ApplicationLauncherPrivate(); + +public: + static ApplicationLauncherPrivate *instance; + static bool isRunningReturnValue; + +public: + bool isRunning(int applicationId); + void startApplication(int applicationId, const QUrl &uri); + void bringToForeground(int applicationId); + +public: + QList isRunningCalls; + QList startApplicationCalls; + QList bringToForegroundCalls; + +}; + +#endif // APPLICATIONLAUNCHER_P_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/mocks/src/afstorageclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/mocks/src/afstorageclient.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,202 @@ +/* +* 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: +* +*/ + +#include "afstorageclient.h" + +#include +#include +#include + +TInt CAfStorageClient::constructorError(KErrNone); +TInt CAfStorageClient::expectedReturnCode(KErrNone); + +CAfEntry *CAfStorageClient::lastCallEntry(0); +TInt CAfStorageClient::lastCallImageHandle(0); +TSize CAfStorageClient::lastCallThumbnailSize(0, 0); +HBufC *CAfStorageClient::lastCallThumbnailPath(0); +void *CAfStorageClient::lastCallUserData(0); +CAfStorageClient::LastMethodCalled CAfStorageClient::lastMethodCalled = CAfStorageClient::NoCall; + +CAfStorageClient *CAfStorageClient::NewL(MAfAsyncRequestObserver &observer) +{ + User::LeaveIfError(CAfStorageClient::constructorError); + return new CAfStorageClient(observer); +} + +CAfStorageClient::~CAfStorageClient() +{ + clearLastCallInfo(); +} + +CAfStorageClient::CAfStorageClient(MAfAsyncRequestObserver &observer) : mObserver(observer) +{ +} + +int CAfStorageClient::saveActivity(const CAfEntry &entry, TInt imageHandle) +{ + lastMethodCalled = CAfStorageClient::SaveActivityMethod; + updateLastEntry(entry); + lastCallImageHandle = imageHandle; + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::removeActivity(const CAfEntry &entry) +{ + lastMethodCalled = CAfStorageClient::RemoveActivityMethod; + updateLastEntry(entry); + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::removeApplicationActivities(const CAfEntry &entry) +{ + lastMethodCalled = CAfStorageClient::RemoveApplicationActivitiesMethod; + updateLastEntry(entry); + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::activities(RPointerArray &dst, int /*limit*/) +{ + if (lastMethodCalled == CAfStorageClient::SaveActivityMethod && CAfStorageClient::lastCallEntry) { + dst.Append(CAfStorageClient::lastCallEntry); + CAfStorageClient::lastCallEntry =0; + } + lastMethodCalled = CAfStorageClient::ActivitiesMethod; + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::applicationActivities(RPointerArray &dst, const CAfEntry &entry) +{ + if (lastMethodCalled == CAfStorageClient::SaveActivityMethod && CAfStorageClient::lastCallEntry) { + dst.Append(CAfStorageClient::lastCallEntry); + CAfStorageClient::lastCallEntry =0; + } + lastMethodCalled = CAfStorageClient::ApplicationActivitiesMethod; + updateLastEntry(entry); + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::activityData(CAfEntry *&dst, const CAfEntry &entry) +{ + if (lastMethodCalled == CAfStorageClient::SaveActivityMethod && CAfStorageClient::lastCallEntry) { + dst =CAfStorageClient::lastCallEntry; + CAfStorageClient::lastCallEntry =0; + } + lastMethodCalled = CAfStorageClient::ActivityDataMethod; + // @todo return something in dst + updateLastEntry(entry); + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::waitActivity() +{ + if(lastMethodCalled == CAfStorageClient::NoCall) { + lastMethodCalled = CAfStorageClient::WaitActivityMethod; + mObserver.waitActivityRequestCompleted(CAfStorageClient::expectedReturnCode, KNullDesC8); + } + + lastMethodCalled = CAfStorageClient::WaitActivityMethod; + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::launchActivity(const CAfEntry &entry) +{ + lastMethodCalled = CAfStorageClient::LaunchActivityMethod; + updateLastEntry(entry); + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::getThumbnail(const TDesC &imagePath, void *userData) +{ + lastMethodCalled = CAfStorageClient::GetThumbnailMethod; + delete lastCallThumbnailPath; + lastCallThumbnailPath = imagePath.Alloc(); + lastCallUserData = userData; + CFbsBitmap *bitmap = new (ELeave)CFbsBitmap(); + CleanupStack::PushL(bitmap); + User::LeaveIfError(bitmap->Create(TSize(128, 128), EColor4K)); + mObserver.getThumbnailRequestCompleted(CAfStorageClient::expectedReturnCode, bitmap->Handle(), userData); + CleanupStack::PopAndDestroy(bitmap); + return CAfStorageClient::expectedReturnCode; +} + +int CAfStorageClient::notifyDataChange() +{ + if(lastMethodCalled == CAfStorageClient::NoCall) { + lastMethodCalled = CAfStorageClient::NotifyDataChangeMethod; + mObserver.dataChangeNotificationCompleted(CAfStorageClient::expectedReturnCode); + } + lastMethodCalled = CAfStorageClient::NotifyDataChangeMethod; + return CAfStorageClient::expectedReturnCode; +} + +// --------------------------------------------------------------------------- +// Invoking callbacks +// --------------------------------------------------------------------------- +// +void CAfStorageClient::invokeWaitActivityCallback(int result, const TDesC8 &data) +{ + mObserver.waitActivityRequestCompleted(result, data); +} + +void CAfStorageClient::invokeGetThumbnailCallback(int result, int bitmapHandle, void *userData) +{ + mObserver.getThumbnailRequestCompleted(result, bitmapHandle, userData); +} + +void CAfStorageClient::invokeDataChangeCallback(int result) +{ + mObserver.dataChangeNotificationCompleted(result); +} + +// --------------------------------------------------------------------------- +// Helper methods +// --------------------------------------------------------------------------- +// +void CAfStorageClient::clearLastCallInfo() +{ + CAfStorageClient::constructorError = EFalse; + CAfStorageClient::expectedReturnCode = KErrNone; + + delete CAfStorageClient::lastCallEntry; + CAfStorageClient::lastCallEntry = 0; + + CAfStorageClient::lastCallImageHandle = 0; + CAfStorageClient::lastCallThumbnailSize = TSize(0,0); + + delete CAfStorageClient::lastCallThumbnailPath; + CAfStorageClient::lastCallThumbnailPath = 0; + + CAfStorageClient::lastCallUserData = 0; + + lastMethodCalled = CAfStorageClient::NoCall; +} + +void CAfStorageClient::updateLastEntry(const CAfEntry &entry) +{ + delete CAfStorageClient::lastCallEntry; + + CAfStorageClient::lastCallEntry = CAfEntry::NewL( + entry.Flags(), + entry.ApplicationId(), + entry.ActivityId(), + entry.CustomActivityName(), + entry.ImageSrc(), + entry.Data(CAfEntry::Private), + entry.Data(CAfEntry::Public), + entry.Timestamp() + ); +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/mocks/src/afstorageproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/mocks/src/afstorageproxy.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,141 @@ +/* + * 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: + * + */ + +#include "afstorageproxy.h" + +#include + +bool AfStorageProxy::waitFailed = false; +AfStorageProxy *AfStorageProxy::instance = 0; + +AfStorageProxy::AfStorageProxy(QObject *parent) : + QObject(parent) +{ + instance = this; +} + +AfStorageProxy::~AfStorageProxy() +{ + instance = 0; +} + +bool AfStorageProxy::saveActivity(int applicationId, const QString &activityId, + const QString &customActivityName, const QVariant &activityData, const QVariantHash &metadata, + const QPixmap &screenshot) +{ + mLastCallParams.clear(); + mLastCallParams.insert("applicationId", applicationId); + mLastCallParams.insert("activityId", activityId); + mLastCallParams.insert("customActivityName", customActivityName); + mLastCallParams.insert("activityData", activityData); + mLastCallParams.insert("metadata", metadata); + mLastCallParams.insert("screenshot", QVariant::fromValue(screenshot)); + return true; +} + +bool AfStorageProxy::removeActivity(int applicationId, const QString &activityId) +{ + mLastCallParams.clear(); + mLastCallParams.insert("applicationId", applicationId); + mLastCallParams.insert("activityId", activityId); + return true; +} + +bool AfStorageProxy::removeApplicationActivities(int applicationId) +{ + mLastCallParams.clear(); + mLastCallParams.insert("applicationId", applicationId); + return true; +} + +bool AfStorageProxy::activities(QList &list, int limit) +{ + Q_UNUSED(list); + mLastCallParams.clear(); + mLastCallParams.insert("limit", limit); + return true; +} + +bool AfStorageProxy::applicationActivities(QStringList &list, int applicationId) +{ + Q_UNUSED(list); + mLastCallParams.clear(); + mLastCallParams.insert("applicationId", applicationId); + return true; +} + +bool AfStorageProxy::activityData(QVariant &data, int applicationId, const QString &activityId) +{ + Q_UNUSED(data); + mLastCallParams.clear(); + mLastCallParams.insert("applicationId", applicationId); + mLastCallParams.insert("activityId", activityId); + return true; +} + +bool AfStorageProxy::activityMetaData(QVariantHash &metadata, int applicationId, + const QString &activityId) +{ + Q_UNUSED(metadata); + mLastCallParams.clear(); + mLastCallParams.insert("applicationId", applicationId); + mLastCallParams.insert("activityId", activityId); + return true; +} + +bool AfStorageProxy::waitActivity() +{ + if (waitFailed) { + waitFailed = false; + return false; + } + mLastCallParams.clear(); + return true; +} + +bool AfStorageProxy::launchActivity(int applicationId, const QString &activityUri) +{ + mLastCallParams.clear(); + mLastCallParams.insert("applicationId", applicationId); + mLastCallParams.insert("activityUri", activityUri); + return true; +} + +bool AfStorageProxy::getThumbnail(const QString &imagePath, void *userData) +{ + mLastCallParams.clear(); + mLastCallParams.insert("imagePath", imagePath); + mLastCallParams.insert("userData", (uint) (userData)); + emit + thumbnailRequested(QPixmap(), userData); + return true; +} + +bool AfStorageProxy::notifyDataChange() +{ + mLastCallParams.clear(); + return true; +} + +// --------------------------------------------------------------------------- +// Mock implementation +// --------------------------------------------------------------------------- +// +void AfStorageProxy::emitActivityRequested(const QString &activityId) +{ + emit activityRequested(activityId); +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/mocks/src/applicationlauncher_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/mocks/src/applicationlauncher_p.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -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: +* +*/ +#include "applicationlauncher_p.h" +#include + +ApplicationLauncherPrivate *ApplicationLauncherPrivate::instance = NULL; +bool ApplicationLauncherPrivate::isRunningReturnValue = false; + +ApplicationLauncherPrivate::ApplicationLauncherPrivate() +{ + if (instance) { + delete instance; + } + instance = this; +} + +ApplicationLauncherPrivate::~ApplicationLauncherPrivate() +{ + // create copy so we can check output even when original object is deleted + instance = new ApplicationLauncherPrivate(*this); +} + +bool ApplicationLauncherPrivate::isRunning(int applicationId) +{ + QVariantHash call; + call.insert("applicationId", applicationId); + isRunningCalls.append(call); + + return isRunningReturnValue; +} + +void ApplicationLauncherPrivate::startApplication(int applicationId, const QUrl &uri) +{ + QVariantHash call; + call.insert("applicationId", applicationId); + call.insert("uri", uri); + startApplicationCalls.append(call); +} + +void ApplicationLauncherPrivate::bringToForeground(int applicationId) +{ + QVariantHash call; + call.insert("applicationId", applicationId); + bringToForegroundCalls.append(call); +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivation/inc/t_afactivation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivation/inc/t_afactivation.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,53 @@ +/* +* 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 TESTAFACTIVATION_H +#define TESTAFACTIVATION_H + +#include +#include + +#include "afstorageproxy.h" +class AfActivation; + +class TestAfActivation : public QObject +{ + Q_OBJECT + +public: + TestAfActivation(); + +private slots: + //QTest specific slots + void init(); + void cleanup(); + + //test functions + void invokeActivationPublicInterface(); + void invokeActivationPublicInterfaceCorrupt(); + void testDefaultValuesAfterCreation(); + void testSignalIsEmittedWhenActivityIsRequested(); + void testValuesChangeWhenActivityIsRequested(); + void testValuesChangeWhenActivityIsRequestedNoName(); + void testChangingActivityInBackground(); + +private: + AfStorageProxy* mServiceProvider; + AfActivation *mActivation; + QString mDefaultActivityName; +}; + +#endif // TESTAFACTIVATION_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivation/src/t_afactivation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivation/src/t_afactivation.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,141 @@ +/* + * 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: + * + */ +#include "t_afactivation.h" + +#include + +#include "afactivation.h" +#include "afactivation_p.h" +#include "applicationlauncher_p.h" + +TestAfActivation::TestAfActivation() +{ + mDefaultActivityName = QString("appto://EBADC0DE?%1=TestActivity&TestParam=TestValue").arg( + Af::KActivityUriNameKey); + qRegisterMetaType ("Af::ActivationReason"); +} + +void TestAfActivation::init() +{ + mActivation = new AfActivation(); + mServiceProvider = AfStorageProxy::instance; +} + +void TestAfActivation::cleanup() +{ + delete mActivation; + mActivation = NULL; +} + +void TestAfActivation::invokeActivationPublicInterface() +{ + // AfActivation is only responsible of correct creation of AfActivationPrivate and + // forwarding requests. Since it's impossible to verify the effects of the member + // calls, just invoke the methods. + AfActivation activation; + + activation.parameters(); + activation.reason(); + activation.name(); +} + +void TestAfActivation::invokeActivationPublicInterfaceCorrupt() +{ + bool errorReceived = false; + //af storage proxy is mocked so I can set static variable making it leave + AfStorageProxy::waitFailed = true; + try + { + AfActivation *activation = new AfActivation(); + } + catch(...) + { + errorReceived = true; + } + QVERIFY(errorReceived); + } + + void TestAfActivation::testDefaultValuesAfterCreation() + { + QCOMPARE(mActivation->parameters(), QVariantHash()); + QCOMPARE(mActivation->reason(), Af::ActivationReasonNormal); + QCOMPARE(mActivation->name(), QString()); + } + + void TestAfActivation::testSignalIsEmittedWhenActivityIsRequested() + { + QSignalSpy activatedSpy(mActivation, + SIGNAL(activated(Af::ActivationReason,QString,QVariantHash))); + QVERIFY(activatedSpy.isValid()); + + mServiceProvider->emitActivityRequested(mDefaultActivityName); + + QCOMPARE(activatedSpy.count(), 1); + } + + void TestAfActivation::testValuesChangeWhenActivityIsRequested() + { + QSignalSpy activatedSpy(mActivation, + SIGNAL(activated(Af::ActivationReason,QString,QVariantHash))); + QVERIFY(activatedSpy.isValid()); + + mServiceProvider->emitActivityRequested(mDefaultActivityName); + + QCOMPARE(activatedSpy.count(), 1); + QCOMPARE(mActivation->reason(), Af::ActivationReasonActivity); + QCOMPARE(mActivation->name(), QString("TestActivity")); + QVERIFY(mActivation->parameters().contains("TestParam")); + QCOMPARE(mActivation->parameters().value("TestParam").toString(), QString("TestValue")); + } + + void TestAfActivation::testValuesChangeWhenActivityIsRequestedNoName() + { + QString activityname("appto://EBADC0DE?TestParam=TestValue"); + QSignalSpy activatedSpy(mActivation, + SIGNAL(activated(Af::ActivationReason,QString,QVariantHash))); + QVERIFY(activatedSpy.isValid()); + + mServiceProvider->emitActivityRequested(activityname); + QCOMPARE(activatedSpy.count(), 1); + + QCOMPARE(mActivation->reason(), Af::ActivationReasonActivity); + QCOMPARE(mActivation->name(), QString()); + QVERIFY(mActivation->parameters().contains("TestParam")); + QCOMPARE(mActivation->parameters().value("TestParam").toString(), QString("TestValue")); + } + + void TestAfActivation::testChangingActivityInBackground() + { + // bring to foreground is called by default + mServiceProvider->emitActivityRequested(mDefaultActivityName); + + ApplicationLauncherPrivate *launcher = ApplicationLauncherPrivate::instance; + QVERIFY(launcher); + QCOMPARE(launcher->bringToForegroundCalls.count(), 1); + launcher->bringToForegroundCalls.clear(); + + // bring to foreground is not called if background parameter is present + mServiceProvider->emitActivityRequested( + QString("appto://EBADC0DE?%1=TestActivity&%2=").arg(Af::KActivityUriNameKey).arg( + Af::KActivityUriBackgroundKey)); + + launcher = ApplicationLauncherPrivate::instance; + QVERIFY(launcher); + QCOMPARE(launcher->bringToForegroundCalls.count(), 0); + } + + QTEST_MAIN(TestAfActivation) diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivation/t_afactivation.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivation/t_afactivation.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,43 @@ +# +# 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: +# + +INCLUDEPATH += ./inc \ + ../mocks/inc + +SOURCES += ./src/t_afactivation.cpp +HEADERS += ./inc/t_afactivation.h + +SOURCES += ../../../activityfw/activityserviceplugin/src/aflauncher.cpp \ + ../../../activityfw/activityserviceplugin/src/afactivation.cpp \ + ../../../activityfw/activityserviceplugin/src/afactivation_p.cpp \ + ../../../activityfw/activityserviceplugin/src/afcommandlineparser.cpp \ + ../mocks/src/applicationlauncher_p.cpp \ + ../mocks/src/afstorageproxy.cpp \ + +HEADERS += ../../../activityfw/activityserviceplugin/inc/aflauncher.h \ + ../../afactivities_global.h \ + ../../afactivation.h \ + ../../../activityfw/activityserviceplugin/inc/afactivation_p.h \ + ../../../activityfw/activityserviceplugin/inc/afcommandlineparser.h \ + ../mocks/inc/applicationlauncher_p.h \ + ../mocks/inc/afstorageproxy.h \ + +include(../tsrc_common.pri) + +symbian:!coverage:CONFIG += symbian_test + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/inc/t_afactivitylauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/inc/t_afactivitylauncher.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,52 @@ +/* +* 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 T_AFACTIVITYLAUNCHER_H +#define T_AFACTIVITYLAUNCHER_H + +#include + +#include +#include + +class CAfActivityLauncher; + +class TestAfActivityLauncher : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + + void init(); + void cleanup(); + + void testScheme(); + void testUidParsing(); + void testRunningCase(); + void testStartupCase(); + + void callUnusedCallbacks(); + +private: + CAfActivityLauncher *mLauncher; + + RApaLsSession mApaLsSession; + RWsSession mWsSession; +}; + +#endif // T_AFACTIVITYLAUNCHER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/inc/afapplicationlauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/inc/afapplicationlauncher.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,43 @@ +/* +* 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 AFAPPLICATIONLAUNCHER_H +#define AFAPPLICATIONLAUNCHER_H + +#include + +class RApaLsSession; +class RWsSession; + +class TAfApplicationLauncher +{ + +public: + TAfApplicationLauncher(RApaLsSession &apaLsSession, RWsSession &wsSession); + +public: + TBool isRunning(TUid applicationId); + void startApplicationL(TUid applicationId, const TDesC &uri); + +public: + static TBool expectedIsRunningResult; + + static TInt lastStartAppId; + static HBufC *lastStartUri; + +}; + +#endif // AFAPPLICATIONLAUNCHER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/inc/afstorageclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/inc/afstorageclient.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,44 @@ +/* +* 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 AFSTORAGECLIENT_H +#define AFSTORAGECLIENT_H + +#include "afasyncrequestobserver.h" + +class CAfEntry; + +class CAfStorageClient : public CBase +{ +public: + static CAfStorageClient *NewL(MAfAsyncRequestObserver &observer); + static CAfStorageClient *NewLC(MAfAsyncRequestObserver &observer); + virtual ~CAfStorageClient(); + +private: + CAfStorageClient(); + +public: + int launchActivity(const CAfEntry &entry); + +public: + static TInt lastLaunchAppId; + static HBufC *lastLaunchUri; + +}; + +#endif //AFSTORAGECLIENT_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/src/afapplicationlauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/src/afapplicationlauncher.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,44 @@ +/* +* 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: +* +*/ +#include "afapplicationlauncher.h" + +TBool TAfApplicationLauncher::expectedIsRunningResult = EFalse; +TInt TAfApplicationLauncher::lastStartAppId = 0; +HBufC* TAfApplicationLauncher::lastStartUri = 0; + +// ----------------------------------------------------------------------------- +// Public part of Construction, destructor +// ----------------------------------------------------------------------------- +// +TAfApplicationLauncher::TAfApplicationLauncher(RApaLsSession &/*apaLsSession*/, RWsSession &/*wsSession*/) +{ +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool TAfApplicationLauncher::isRunning(TUid /*applicationId*/) +{ + return expectedIsRunningResult; +} + +void TAfApplicationLauncher::startApplicationL(TUid applicationId, const TDesC &uri) +{ + lastStartAppId = applicationId.iUid; + lastStartUri = uri.Alloc(); +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/src/afstorageclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/mocks/src/afstorageclient.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,55 @@ +/* +* 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: +* +*/ + +#include "afstorageclient.h" + +#include + +TInt CAfStorageClient::lastLaunchAppId = 0; +HBufC* CAfStorageClient::lastLaunchUri = 0; + +CAfStorageClient *CAfStorageClient::NewL(MAfAsyncRequestObserver &observer) +{ + CAfStorageClient *self = CAfStorageClient::NewLC(observer); + CleanupStack::Pop(self); + return self; +} + +CAfStorageClient *CAfStorageClient::NewLC(MAfAsyncRequestObserver &/*observer*/) +{ + CAfStorageClient *self = new (ELeave) CAfStorageClient(); + CleanupStack::PushL(self); + return self; +} + +CAfStorageClient::~CAfStorageClient() +{ + delete lastLaunchUri; + lastLaunchUri = 0; +} + +CAfStorageClient::CAfStorageClient() +{ +} + +int CAfStorageClient::launchActivity(const CAfEntry &entry) +{ + lastLaunchAppId = entry.ApplicationId(); + lastLaunchUri = entry.ActivityId().Alloc(); + + return KErrNone; +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/src/t_afactivitylauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/src/t_afactivitylauncher.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,114 @@ +/* +* 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: +* +*/ +#include "t_afactivitylauncher.h" + +#include +#include "afapplicationlauncher.h" +#include +#include "afactivitylauncher.h" +#include "afactivitylauncher_p.h" + + +void TestAfActivityLauncher::initTestCase() +{ + QCOMPARE(mApaLsSession.Connect(), KErrNone); + QCOMPARE(mWsSession.Connect(), KErrNone); +} + +void TestAfActivityLauncher::cleanupTestCase() +{ + mApaLsSession.Close(); + mWsSession.Close(); +} + +void TestAfActivityLauncher::init() +{ + QT_TRAP_THROWING(mLauncher = CAfActivityLauncher::NewL(mApaLsSession, mWsSession)); +} + +void TestAfActivityLauncher::cleanup() +{ + delete TAfApplicationLauncher::lastStartUri; + TAfApplicationLauncher::lastStartUri = 0; + TAfApplicationLauncher::lastStartAppId = 0; + + delete CAfStorageClient::lastLaunchUri; + CAfStorageClient::lastLaunchUri = 0; + CAfStorageClient::lastLaunchAppId = 0; + + delete mLauncher; + mLauncher = 0; +} + +void TestAfActivityLauncher::testScheme() +{ + TAfApplicationLauncher::expectedIsRunningResult = ETrue; + + TInt error; + TRAP(error, mLauncher->launchActivityL(_L("appto://DEADBEEF"))); + QCOMPARE(error, KErrNone); + + TRAP(error, mLauncher->launchActivityL(_L("bzzzt://DEADBEEF"))); + QCOMPARE(error, KErrArgument); +} + +void TestAfActivityLauncher::testUidParsing() +{ + TAfApplicationLauncher::expectedIsRunningResult = ETrue; + + TInt error; + TRAP(error, mLauncher->launchActivityL(_L("appto://DEADBEEF"))); + QCOMPARE(error, KErrNone); + + TRAP(error, mLauncher->launchActivityL(_L("appto://INVALID"))); + QCOMPARE(error, KErrGeneral); +} + +void TestAfActivityLauncher::testRunningCase() +{ + TAfApplicationLauncher::expectedIsRunningResult = ETrue; + + _LIT(KActivityUri, "appto://DEADBEEF"); + TRAPD(error, mLauncher->launchActivityL(KActivityUri)); + QCOMPARE(error, KErrNone); + + QCOMPARE(CAfStorageClient::lastLaunchAppId, TInt(0xDEADBEEF)); + QVERIFY(CAfStorageClient::lastLaunchUri->Compare(KActivityUri()) == 0); +} + +void TestAfActivityLauncher::testStartupCase() +{ + TAfApplicationLauncher::expectedIsRunningResult = EFalse; + + _LIT(KActivityUri, "appto://DEADBEEF"); + TRAPD(error, mLauncher->launchActivityL(KActivityUri)); + QCOMPARE(error, KErrNone); + + QCOMPARE(TAfApplicationLauncher::lastStartAppId, TInt(0xDEADBEEF)); + QVERIFY(TAfApplicationLauncher::lastStartUri->Compare(KActivityUri()) == 0); +} + +void TestAfActivityLauncher::callUnusedCallbacks() +{ + CAfActivityLauncherPrivate* imp = CAfActivityLauncherPrivate::NewL(mApaLsSession, mWsSession); + imp->waitActivityRequestCompleted(0, KNullDesC8()); + imp->getThumbnailRequestCompleted(0, 0, 0); + imp->dataChangeNotificationCompleted(0); + delete imp; +} + +QTEST_MAIN(TestAfActivityLauncher) diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/t_afactivitylauncher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitylauncher/t_afactivitylauncher.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,46 @@ +# +# 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: +# + +CONFIG += qtestlib console + +INCLUDEPATH += ./inc \ + mocks/inc/ \ + ../../../../activityfw/afactivitylauncher/inc/ \ + ../../../../activityfw/inc/ \ + ../../../../activityfw/storage/common/inc/ \ + ../../../../activityfw/storage/client/inc/ + +HEADERS += ./inc/t_afactivitylauncher.h \ + ../../../../activityfw/storage/common/inc/afentry.h + +SOURCES += mocks/src/afapplicationlauncher.cpp \ + ./src/t_afactivitylauncher.cpp \ + ../../../../activityfw/afactivitylauncher/src/afactivitylauncher.cpp \ + ../../../../activityfw/afactivitylauncher/src/afactivitylauncher_p.cpp \ + mocks/src/afstorageclient.cpp \ + ../../../../activityfw/storage/common/src/afentry.cpp + + + +LIBS += -linetprotutil \ + -lestor \ + -lapgrfx \ + -lws32 \ + +symbian:!coverage: CONFIG += symbian_test + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitystorage/inc/t_afactivitystorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitystorage/inc/t_afactivitystorage.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,46 @@ +/* +* 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 TESTAFACTIVITYSTORAGE_H +#define TESTAFACTIVITYSTORAGE_H + +#include +#include +#include "afstorageproxy.h" +#include "afactivitystorage.h" + +class TestAfActivityStorage : public QObject +{ + Q_OBJECT + +private slots: + void init(); + void cleanup(); + + void testSaveActivity(); + void testRemoveActivity(); + void testAllActivities(); + void testActivityData(); + void testActivityMetaData(); + void testActivityMetaDataPublicClient(); + +private: + QSharedPointer mServiceProvider; + AfActivityStoragePrivate *mStorage; + +}; + +#endif // TESTAFACTIVITYSTORAGE_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitystorage/src/t_afactivitystorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitystorage/src/t_afactivitystorage.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,106 @@ +/* +* 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: +* +*/ +#include "t_afactivitystorage.h" + +#include + +#include "afactivitystorage_p.h" + +const char DefaultActivityName [] = "DefaultTestActivityName"; +const char DefaultActivityPrivate [] = "DefaultTestActivityPrivateData"; +const char DefaultActivityPublic [] = "DefaultTestActivityPublicData"; +const char DefaultActivityPublicKey [] = "FakeData"; + +void TestAfActivityStorage::init() +{ + mServiceProvider = QSharedPointer(new AfStorageProxy()); + mStorage = new AfActivityStoragePrivate(mServiceProvider); +} + +void TestAfActivityStorage::cleanup() +{ + delete mStorage; + mStorage = NULL; +} + +void TestAfActivityStorage::testSaveActivity() +{ + const int applicationId(RProcess().SecureId().iId); + QString activityId(DefaultActivityName); + QVariant privateData(DefaultActivityPrivate); + QVariantHash publicData; + publicData.insert(DefaultActivityPublicKey, QVariant(DefaultActivityPublic)); + + mStorage->saveActivity(activityId, privateData, publicData); + + QVERIFY(applicationId == mServiceProvider->mLastCallParams.value("applicationId").toInt()); + QVERIFY(activityId == mServiceProvider->mLastCallParams.value("activityId").toString()); + QVERIFY(privateData == mServiceProvider->mLastCallParams.value("activityData")); + QVERIFY(publicData.count() <= mServiceProvider->mLastCallParams.value("metadata").toHash().count()); +} + +void TestAfActivityStorage::testRemoveActivity() +{ + const int applicationId(RProcess().SecureId().iId); + QString activityId(DefaultActivityName); + + mStorage->removeActivity(activityId); + + QVERIFY(applicationId == mServiceProvider->mLastCallParams.value("applicationId").toInt()); + QVERIFY(activityId == mServiceProvider->mLastCallParams.value("activityId").toString()); +} + +void TestAfActivityStorage::testAllActivities() +{ + const int applicationId(RProcess().SecureId().iId); + + mStorage->allActivities(); + + QVERIFY(applicationId == mServiceProvider->mLastCallParams.value("applicationId").toInt()); +} + +void TestAfActivityStorage::testActivityData() +{ + const int applicationId(RProcess().SecureId().iId); + QString activityId(DefaultActivityName); + + mStorage->activityData(activityId); + + QVERIFY(applicationId == mServiceProvider->mLastCallParams.value("applicationId").toInt()); + QVERIFY(activityId == mServiceProvider->mLastCallParams.value("activityId").toString()); +} + +void TestAfActivityStorage::testActivityMetaData() +{ + const int applicationId(RProcess().SecureId().iId); + QString activityId(DefaultActivityName); + + mStorage->activityMetaData(activityId); + + QVERIFY(applicationId == mServiceProvider->mLastCallParams.value("applicationId").toInt()); + QVERIFY(activityId == mServiceProvider->mLastCallParams.value("activityId").toString()); +} + +//to ensure coverage for AfActivityStorage public implementation +void TestAfActivityStorage::testActivityMetaDataPublicClient() +{ + AfActivityStorage *storage = new AfActivityStorage(); + storage->activityMetaData("testId"); + delete storage; +} + +QTEST_MAIN(TestAfActivityStorage) diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/t_afactivitystorage/t_afactivitystorage.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/t_afactivitystorage/t_afactivitystorage.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,37 @@ +# +# 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: +# + +INCLUDEPATH += ./inc \ + ../mocks/inc + +SOURCES += ./src/t_afactivitystorage.cpp +HEADERS += ./inc/t_afactivitystorage.h + +SOURCES += ../../../activityfw/activityserviceplugin/src/afactivitystorage.cpp \ + ../../../activityfw/activityserviceplugin/src/afactivitystorage_p.cpp \ + ../mocks/src/afstorageproxy.cpp \ + +HEADERS += ../../afactivities_global.h \ + ../../afactivitystorage.h \ + ../../../activityfw/activityserviceplugin/inc/afactivitystorage_p.h \ + ../mocks/inc/afstorageproxy.h \ + +include(../tsrc_common.pri) + +symbian:!coverage: CONFIG += symbian_test + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/tsrc.pro Wed Oct 06 16:00:22 2010 +0300 @@ -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: +# + +TEMPLATE = subdirs + +SUBDIRS = t_afactivation \ + t_afactivitystorage \ + t_afactivitylauncher \ + +CONFIG += ordered diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/activity_framework_api/tsrc/tsrc_common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/activity_framework_api/tsrc/tsrc_common.pri Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,24 @@ +# +# 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: +# + +include(../../../activityfw/activityserviceplugin/activityserviceplugin.pri) + +CONFIG += qtestlib console + +INCLUDEPATH *= $$PWD/../inc +DEPENDPATH *= $$PWD/../inc + +DEFINES += AFACTIVITIES_TEST diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/caclient_global.h --- a/homescreensrv_plat/contentstorage_api/caclient_global.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * 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 CACLIENT_GLOBAL_H -#define CACLIENT_GLOBAL_H - - -#ifdef CACLIENT_LIB -#define CACLIENT_EXPORT Q_DECL_EXPORT -#else -#ifdef CACLIENT_TEST -#define CACLIENT_EXPORT -#else -#define CACLIENT_EXPORT Q_DECL_IMPORT -#endif -#endif - -#ifndef CONTENTARSENAL_UNITTEST -#define CA_CLIENT_TEST_CLASS(aClassName) -#else -#define CA_CLIENT_TEST_CLASS(aClassName) class aClassName; -#endif - -#ifndef CONTENTARSENAL_UNITTEST -#define CA_CLIENT_TEST_FRIEND_CLASS(aClassName) -#else -#define CA_CLIENT_TEST_FRIEND_CLASS(aClassName) friend class aClassName; -#endif - -#endif // CACLIENT_GLOBAL_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/cadefs.h --- a/homescreensrv_plat/contentstorage_api/cadefs.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * 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: cadefs.h - * - */ - -#ifndef CADEFS_H -#define CADEFS_H - -#include -#include - -enum ChangeType -{ - AddChangeType, - RemoveChangeType, - UpdateChangeType -}; - -enum EntryRole -{ - ItemEntryRole = 1, - GroupEntryRole = 2 -}; -Q_DECLARE_FLAGS(EntryRoles, EntryRole) -Q_DECLARE_OPERATORS_FOR_FLAGS(EntryRoles) - -enum SortAttribute -{ - NameSortAttribute, - CreatedTimestampSortAttribute, - MostUsedSortAttribute, - LastUsedSortAttribute, - DefaultSortAttribute -// default - return items in custom order -}; - -enum EntryFlag -{ - UsedEntryFlag = 1, - UninstallEntryFlag = 2, - RemovableEntryFlag = 4, - VisibleEntryFlag = 8, - ReservedEntryFlag = 16, //flag is unused, stays for compatibility - NativeEntryFlag = 32, - MissingEntryFlag = 64 -}; - -enum LocalizationType -{ - NameLocalized, - DescriptionLocalized -}; - -Q_DECLARE_FLAGS(EntryFlags, EntryFlag) -Q_DECLARE_OPERATORS_FOR_FLAGS(EntryFlags) -Q_DECLARE_METATYPE(EntryFlags) - -enum ErrorCode -{ - NoErrorCode = 0, - NotFoundErrorCode, - OutOfMemoryErrorCode, - BadArgumentErrorCode, - ServerTerminated, - UnknownErrorCode -}; - -const char caCmdOpen[] = "open"; -const char caCmdRemove[] = "remove"; - -#ifndef QT_NO_DEBUG_OUTPUT -# define USE_QDEBUG_IF(predicate) if (!predicate) {} else qDebug() -#else -# define USE_QDEBUG_IF(predicate) if (1) {} else qDebug() -#endif - -#ifndef QT_NO_WARNING_OUTPUT -# define USE_QWARNING_IF(predicate) if (!predicate) {} else qWarning() -#else -# define USE_QWARNING_IF(predicate) if (1) {} else qWarning() -#endif - -#endif // CADEFS_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/caentry.h --- a/homescreensrv_plat/contentstorage_api/caentry.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * 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: caentry.h - * - */ - -#ifndef CAENTRY_H -#define CAENTRY_H - -#include -#include -#include - -#include "caclient_global.h" -#include "cadefs.h" -#include "caicondescription.h" - -CA_CLIENT_TEST_CLASS( TestCaClient ) - -class CaObjectAdapter; -class CaEntryPrivate; -class HbIcon; - -class CACLIENT_EXPORT CaEntry -{ - /*! - * This class is not intended to be derived. - */ - -public: - - explicit CaEntry(EntryRole entryRole = ItemEntryRole); - - virtual ~CaEntry(); - - int id() const; - - QString text() const; - void setText(const QString &text, bool localized = false); - - QString description() const; - void setDescription(const QString &text, bool localized = false); - - CaIconDescription iconDescription() const; - void setIconDescription(const CaIconDescription &iconDescription); - - EntryFlags flags() const; - void setFlags(EntryFlags flags); - - QString entryTypeName() const; - void setEntryTypeName(const QString &entryTypeName); - - QMap attributes() const; - - QString attribute(const QString &name) const; - void setAttribute(const QString &name, const QString &value); - - HbIcon makeIcon(const QSizeF &size = QSizeF(70.0, 70.0)) const; - - EntryRole role() const; - - CaEntry(const CaEntry &entry); - CaEntry &operator=(const CaEntry &entry); - -private: - - void setId(int id); - bool isLocalized(LocalizationType localized) const; - -private: - /*! - * A special kind of pointer, supporting sharing data, to a private - * implementation. - */ - QSharedDataPointer m_d; - - friend class CaEntryPrivate; - friend class ::CaObjectAdapter; - - CA_CLIENT_TEST_FRIEND_CLASS( TestCaClient ) - -}; - - -#endif // CAENTRY_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/caicondescription.h --- a/homescreensrv_plat/contentstorage_api/caicondescription.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * 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: caicondescription.h - * - */ - -#ifndef CAICONDESCRIPTION_H -#define CAICONDESCRIPTION_H - -#include - -#include "caclient_global.h" - -class CaObjectAdapter; - -class CaIconDescriptionPrivate; - -class CACLIENT_EXPORT CaIconDescription -{ - -public: - - CaIconDescription(); - CaIconDescription(const CaIconDescription &iconDescription); - ~CaIconDescription(); - - CaIconDescription &operator=(const CaIconDescription &iconDescription); - - int id() const; - - QString filename() const; - void setFilename(const QString &filename); - - QString skinId() const; - void setSkinId(const QString &skinId); - - QString applicationId() const; - void setApplicationId(const QString &applicationId); - -private: - - void setId(int id); - -private: - /** - * Pointer to a private implementation. - */ - QSharedDataPointer m_d; - - friend class CaIconDescriptionPrivate; - friend class ::CaObjectAdapter; -}; - -#endif // CAICONDESCRIPTION_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/caitemmodel.h --- a/homescreensrv_plat/contentstorage_api/caitemmodel.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * 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: caitemmodel.h - * - */ - -#ifndef CASTANDARDITEMMODEL_H -#define CASTANDARDITEMMODEL_H - -// System includes -#include -#include - -// User includes -#include "caclient_global.h" -#include "caquery.h" - -// Forward declarations -class CaEntry; -class CaItemModelPrivate; -CA_CLIENT_TEST_CLASS(TestCaClient) - -// Class declaration -class CACLIENT_EXPORT CaItemModel: public QAbstractItemModel -{ - -Q_OBJECT - CA_CLIENT_TEST_FRIEND_CLASS(TestCaClient) - -public: - - // Data types - enum CaItemRole - { - IdRole = Qt::UserRole + 1, - ParentIdRole, - TypeRole, - FlagsRole, - TextRole,//contains title represented as QString, - DescriptionRole, // contains item description - FullTextRole, //'title description' convinient for operations such as search - UninstalRole, //contains progress status as decimal number in QString - CollectionTitleRole //contains title represented as QString, - - }; - - // Function declarations - CaItemModel(const CaQuery &query, QObject *parent = 0); - ~CaItemModel(); - - int columnCount(const QModelIndex &parent = QModelIndex()) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual QModelIndex index(int row, int column = 0, - const QModelIndex &parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex &index) const; - QModelIndex root() const; - virtual QVariant data(const QModelIndex &index, int role = - Qt::DisplayRole) const; - void setAutoUpdate(bool autoUpdate); - void setSecondLineVisibility(bool secondLineVisible); - bool secondLineVisibility() const; - bool isAutoUpdate() const; - void setSort(SortAttribute sortAttribute, Qt::SortOrder sortOrder = - Qt::AscendingOrder); - void setIconSize(const QSizeF &size); - QSizeF getIconSize() const; - void updateModel(); - void setParentId(int parentId); - void setFlagsOn(const EntryFlags &onFlags); - void setFlagsOff(const EntryFlags &offFlags); - QSharedPointer entry(const QModelIndex &index) const; - - QList getUninstallingEntriesIds(int componentId); - void updateProgress(int id, int valueOfProgress); - - -signals: - - void scrollTo(int row, QAbstractItemView::ScrollHint hint = - QAbstractItemView::EnsureVisible); - void empty(bool value); - void countChange(); - -protected: - // data - - CaItemModelPrivate * const m_d; - friend class CaItemModelPrivate; - -}; - -#endif // CASTANDARDITEMMODEL_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/camenuiconutility.h --- a/homescreensrv_plat/contentstorage_api/camenuiconutility.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +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: The API supports requesting raw bitmaps - * -*/ - - -#ifndef __CAMENUICONUTILITY_H__ -#define __CAMENUICONUTILITY_H__ - -#include "caclient_global.h" - -class CaEntry; -class HbIcon; - -class CACLIENT_EXPORT CaMenuIconUtility -{ -public: - static HbIcon getApplicationIcon(int uid, - const QSizeF &size = QSizeF(50,80)); - - static HbIcon getEntryIcon(const CaEntry& entry, - const QSizeF &size = QSizeF(50,80)); - - - - - -}; - -#endif // __CAMENUICONUTILITY_H__ diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/canotifier.h --- a/homescreensrv_plat/contentstorage_api/canotifier.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * 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: canotifier.h - * - */ - -#ifndef CANOTIFIER_H -#define CANOTIFIER_H - -#include -#include "cadefs.h" -#include "caclient_global.h" -#include "caentry.h" - -CA_CLIENT_TEST_CLASS( TestCaClient ) - - -class CaNotifierPrivate; -class CaNotifierFilter; - -class CACLIENT_EXPORT CaNotifier: public QObject -{ -Q_OBJECT - -public: - - explicit CaNotifier(CaNotifierPrivate *const notifierPrivate); - - virtual ~CaNotifier(); - -signals: - - /*! - A signal emited when the entry is changed. - \param entryId entry id. - \param changeType the type of the change. - */ - void entryChanged(int entryId, ChangeType changeType); - - /*! - A signal emited when the entry is changed. - \param entry changed entry. - \param changeType the type of the change. - */ - void entryChanged(const CaEntry &entry, ChangeType changeType); - - /*! - A signal emited when the entry is touched. - \param id entry id. - */ - void entryTouched(int id); - - /*! - A signal emited when group content is changed. - \param groupId group id. - */ - void groupContentChanged(int groupId); - -protected: - - virtual void connectNotify(const char * signal); - - virtual void disconnectNotify(const char * signal); - -private: - - CaNotifierPrivate * const m_d; - - Q_DISABLE_COPY(CaNotifier) - - friend class CaNotifierPrivate; - - CA_CLIENT_TEST_FRIEND_CLASS( TestCaClient ) - -}; - - -#endif // CANOTIFIER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/canotifierfilter.h --- a/homescreensrv_plat/contentstorage_api/canotifierfilter.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * 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: canotifierfilter.h - * - */ - -#ifndef CANOTIFIERFILTER_H -#define CANOTIFIERFILTER_H - -#include - -#include "cadefs.h" -#include "caclient_global.h" -#include "caentry.h" - -class CaNotifierFilterPrivate; -class CaQuery; - -class CACLIENT_EXPORT CaNotifierFilter -{ - friend class CaNotifierFilterPrivate; - -public: - - CaNotifierFilter(); - CaNotifierFilter(const CaNotifierFilter ¬ifierFilter); - explicit CaNotifierFilter(const CaQuery &query); - CaNotifierFilter &operator=(const CaNotifierFilter ¬ifierFilter); - virtual ~CaNotifierFilter(); - - int getParentId() const; - void setParentId(int parentId); - - QList getIds() const; - void setIds(const QList &ids); - - EntryRoles getEntryRole() const; - void setEntryRole(EntryRoles entryRole); - - QStringList getTypeNames() const; - void setTypeNames(const QStringList &typeNames); - -private: - - CaNotifierFilterPrivate * const m_d; - -}; - -#endif // CANOTIFIERFILTER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/caquery.h --- a/homescreensrv_plat/contentstorage_api/caquery.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * 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: caquery.h - * - */ - -#ifndef CAQUERY_H -#define CAQUERY_H - -#include -#include "caclient_global.h" -#include "cadefs.h" - -class CaQueryPrivate; - -class CACLIENT_EXPORT CaQuery -{ - -public: - - CaQuery(); - CaQuery(const CaQuery &query); - CaQuery &operator=(const CaQuery &query); - ~CaQuery(); - - void setEntryRoles(EntryRoles entryRoles); - EntryRoles entryRoles() const; - - void setParentId(int id); - int parentId() const; - - void setChildId(int id); - int childId() const; - - void setEntryTypeNames(const QStringList &entryTypeNames); - QStringList entryTypeNames() const; - - void addEntryTypeName(const QString &entryTypeName); - - void setFlagsOn(const EntryFlags &onFlags); - EntryFlags flagsOn() const; - void setFlagsOff(const EntryFlags &offFlags); - EntryFlags flagsOff() const; - - void setSort(SortAttribute sortAttribute, - Qt::SortOrder sortOrder = Qt::AscendingOrder); - void getSort(SortAttribute& sortAttribute, - Qt::SortOrder& sortOrder) const; - - unsigned int count() const; - void setCount(unsigned int count); - - QMap attributes() const; - QString attribute(const QString &name) const; - void setAttribute(const QString &name, const QString &value); - void removeAttribute(const QString &name); - - void clear(); - -private: - - /** - * Pointer to a private implementation. - */ - CaQueryPrivate * const m_d; - friend class CaQueryPrivate; - -}; - -#endif // CAQUERY_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/caservice.h --- a/homescreensrv_plat/contentstorage_api/caservice.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* - * 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: caservice.h - * - */ - -#ifndef CASERVICE_H -#define CASERVICE_H - -#include -#include - -#include - -#include "caclient_global.h" -#include "canotifierfilter.h" - -class CaQuery; -class CaEntry; -class CaServicePrivate; -class CaNotifier; - -class CACLIENT_EXPORT CaService: public QObject -{ - -Q_OBJECT - - explicit CaService(QObject *parent = 0); - - ~CaService(); - -public: - - static QSharedPointer instance(); - - QSharedPointer getEntry(int entryId) const; - QList< QSharedPointer > getEntries(const QList &entryIdList) const; - QList< QSharedPointer > getEntries(const CaQuery &query) const; - QList getEntryIds(const CaQuery &query) const; - - QSharedPointer createEntry(const CaEntry &entry) const; - - bool removeEntry(int entryId) const; - bool removeEntry(const CaEntry &entry) const; - bool removeEntries(const QList &entryIdList) const; - bool removeEntries(const QList< QSharedPointer > &entryList) const; - - bool updateEntry(const CaEntry &entry) const; - bool touch(const CaEntry &entry) const; - - bool insertEntryIntoGroup(int groupId, int entryId, - int beforeEntryId) const; - bool insertEntryIntoGroup(const CaEntry &group, const CaEntry &entry, - int beforeEntryId) const; - bool insertEntriesIntoGroup(int groupId, const QList &entryIdList, - int beforeEntryId) const; - bool insertEntriesIntoGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList, int beforeEntryId) const; - - bool removeEntryFromGroup(int groupId, int entryId) const; - bool removeEntryFromGroup(const CaEntry &group, - const CaEntry &entry) const; - bool removeEntriesFromGroup(int groupId, - const QList &entryIdList) const; - bool removeEntriesFromGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList) const; - - bool appendEntryToGroup(int groupId, int entryId) const; - bool appendEntryToGroup(const CaEntry &group, - const CaEntry &entry) const; - bool appendEntriesToGroup(int groupId, - const QList &entryIdList) const; - bool appendEntriesToGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList) const; - - bool prependEntryToGroup(int groupId, int entryId) const; - bool prependEntryToGroup(const CaEntry &group, - const CaEntry &entry) const; - bool prependEntriesToGroup(int groupId, - const QList &entryIdList) const; - bool prependEntriesToGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList) const; - - int executeCommand(int entryId, const QString &command = - caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const; - int executeCommand(const CaEntry &entry, const QString &command = - caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const; - - CaNotifier * createNotifier(const CaNotifierFilter &filter) const; - - bool customSort(int groupId, QList &entryIdList) const; - - ErrorCode lastError() const; - - signals: - - void entryChanged(int entryId, ChangeType changeType); - void entryChanged(const CaEntry &entry, ChangeType changeType); - void entryTouched(int id); - void groupContentChanged(int groupId); - -private: - - /** - * Pointer to a private implementation. - */ - CaServicePrivate * const m_d; - - /** - * The static pointer to the instance of CaService. - */ - static QWeakPointer m_instance; - - friend class CaServicePrivate; - friend class QtSharedPointer::ExternalRefCount; - - Q_DISABLE_COPY(CaService) - -}; - - -#endif // CASERVICE_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/casoftwareregistry.h --- a/homescreensrv_plat/contentstorage_api/casoftwareregistry.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2010 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 CA_SOFTWARE_REGISTRY_H -#define CA_SOFTWARE_REGISTRY_H - -#include -#include -#include -#include - -#include "caclient_global.h" - -//FORWARD DECLARATIONS -class QStringList; -class CaSoftwareRegistryPrivate; -class CaUninstallNotifier; - -/** - * Class provides Usif specific services - */ -class CACLIENT_EXPORT CaSoftwareRegistry: public QObject -{ - -Q_OBJECT - - explicit CaSoftwareRegistry(QObject *parent = 0); - - ~CaSoftwareRegistry(); - -public: - - static QSharedPointer create(); - - typedef QHash DetailMap; - - bool getUninstallDetails(int componentId, - QString &componentName, - QStringList &applicationsUids, - QString &confirmationMessage); - - bool getApplicationsUids(int componentId, QStringList &applicationsUids); - - DetailMap entryDetails(int componentId) const; - - QList retrieveLogEntries() const; - - CaUninstallNotifier *createUninstallNotifier() const; - - static QString componentNameKey(); - static QString componentVersionKey(); - static QString componentVendorKey(); - static QString componentDriveInfoKey(); - static QString componentProtectionDomainKey(); - static QString componentSizeKey(); - static QString componentTypeKey(); - static QString componentDescriptionKey(); - static QString componentTimeKey(); - static QString componentOperationTypeKey(); - static QString componentInstallValue(); - static QString componentUninstallValue(); - static QString componentUpgradeValue(); - static QString componentHiddenValue(); -private: - /** - * Pointer to a private implementation. - */ - CaSoftwareRegistryPrivate *const m_d; - - /** - * The static pointer to the instance of CaSoftwareRegistry. - */ - static QWeakPointer m_instance; - - friend class CaSoftwareRegistryPrivate; - friend class QtSharedPointer::ExternalRefCount; - - Q_DISABLE_COPY(CaSoftwareRegistry) - -}; - -#endif // CA_SOFTWARE_REGISTRY_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/cauninstallnotifier.h --- a/homescreensrv_plat/contentstorage_api/cauninstallnotifier.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * 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: canotifier.h - * - */ - -#ifndef CAUINSTALLNOTIFIER_H -#define CAUINSTALLNOTIFIER_H - -#include -#include - -#include "caclient_global.h" -class CaUninstallNotifierPrivate; - -class CaUninstallNotifier: public QObject -{ -Q_OBJECT - -public: - - static CaUninstallNotifier* notifier(); - -private: - - explicit CaUninstallNotifier(CaUninstallNotifierPrivate *const notifierPrivate); - - virtual ~CaUninstallNotifier(); - -signals: - - /*! - A signal emited when the entry is changed. - \param entryId entry id. - \param changeType the type of the change. - */ - void progressChange(int componentId, int progressValue); - -private: - - CaUninstallNotifierPrivate * const m_d; - - static QSharedPointer mInstance; - - Q_DISABLE_COPY(CaUninstallNotifier) - - friend class CaUninstallNotifierPrivate; - - friend class QtSharedPointer::ExternalRefCount; -}; - - -#endif // CAUINSTALLNOTIFIER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/contentstorage_api.pri --- a/homescreensrv_plat/contentstorage_api/contentstorage_api.pri Mon Sep 27 11:31:59 2010 +0300 +++ b/homescreensrv_plat/contentstorage_api/contentstorage_api.pri Wed Oct 06 16:00:22 2010 +0300 @@ -15,15 +15,15 @@ # PLATFORM_HEADERS += \ - contentstorage_api/caclient_global.h \ - contentstorage_api/cadefs.h \ - contentstorage_api/caentry.h \ - contentstorage_api/caicondescription.h \ - contentstorage_api/canotifier.h \ - contentstorage_api/canotifierfilter.h \ - contentstorage_api/caquery.h \ - contentstorage_api/caservice.h \ - contentstorage_api/caitemmodel.h \ - contentstorage_api/camenuiconutility.h \ - contentstorage_api/casoftwareregistry.h \ - contentstorage_api/cauninstallnotifier.h \ No newline at end of file + contentstorage_api/inc/caclient_global.h \ + contentstorage_api/inc/cadefs.h \ + contentstorage_api/inc/caentry.h \ + contentstorage_api/inc/caicondescription.h \ + contentstorage_api/inc/canotifier.h \ + contentstorage_api/inc/canotifierfilter.h \ + contentstorage_api/inc/caquery.h \ + contentstorage_api/inc/caservice.h \ + contentstorage_api/inc/caitemmodel.h \ + contentstorage_api/inc/camenuiconutility.h \ + contentstorage_api/inc/casoftwareregistry.h \ + contentstorage_api/inc/cauninstallnotifier.h \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/caclient_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/caclient_global.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,44 @@ +/* + * 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 CACLIENT_GLOBAL_H +#define CACLIENT_GLOBAL_H + + +#ifdef CACLIENT_LIB +#define CACLIENT_EXPORT Q_DECL_EXPORT +#else +#ifdef CACLIENT_TEST +#define CACLIENT_EXPORT +#else +#define CACLIENT_EXPORT Q_DECL_IMPORT +#endif +#endif + +#ifndef CONTENTARSENAL_UNITTEST +#define CA_CLIENT_TEST_CLASS(aClassName) +#else +#define CA_CLIENT_TEST_CLASS(aClassName) class aClassName; +#endif + +#ifndef CONTENTARSENAL_UNITTEST +#define CA_CLIENT_TEST_FRIEND_CLASS(aClassName) +#else +#define CA_CLIENT_TEST_FRIEND_CLASS(aClassName) friend class aClassName; +#endif + +#endif // CACLIENT_GLOBAL_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/cadefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/cadefs.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,95 @@ +/* + * 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: cadefs.h + * + */ + +#ifndef CADEFS_H +#define CADEFS_H + +#include +#include + +enum ChangeType +{ + AddChangeType, + RemoveChangeType, + UpdateChangeType +}; + +enum EntryRole +{ + ItemEntryRole = 1, + GroupEntryRole = 2 +}; +Q_DECLARE_FLAGS(EntryRoles, EntryRole) +Q_DECLARE_OPERATORS_FOR_FLAGS(EntryRoles) + +enum SortAttribute +{ + NameSortAttribute, + CreatedTimestampSortAttribute, + MostUsedSortAttribute, + LastUsedSortAttribute, + DefaultSortAttribute +// default - return items in custom order +}; + +enum EntryFlag +{ + UsedEntryFlag = 1, + UninstallEntryFlag = 2, + RemovableEntryFlag = 4, + VisibleEntryFlag = 8, + ReservedEntryFlag = 16, //flag is unused, stays for compatibility + NativeEntryFlag = 32, + MissingEntryFlag = 64 +}; + +enum LocalizationType +{ + NameLocalized, + DescriptionLocalized +}; + +Q_DECLARE_FLAGS(EntryFlags, EntryFlag) +Q_DECLARE_OPERATORS_FOR_FLAGS(EntryFlags) +Q_DECLARE_METATYPE(EntryFlags) + +enum ErrorCode +{ + NoErrorCode = 0, + NotFoundErrorCode, + OutOfMemoryErrorCode, + BadArgumentErrorCode, + ServerTerminated, + UnknownErrorCode +}; + +const char caCmdOpen[] = "open"; +const char caCmdRemove[] = "remove"; + +#ifndef QT_NO_DEBUG_OUTPUT +# define USE_QDEBUG_IF(predicate) if (!predicate) {} else qDebug() +#else +# define USE_QDEBUG_IF(predicate) if (1) {} else qDebug() +#endif + +#ifndef QT_NO_WARNING_OUTPUT +# define USE_QWARNING_IF(predicate) if (!predicate) {} else qWarning() +#else +# define USE_QWARNING_IF(predicate) if (1) {} else qWarning() +#endif + +#endif // CADEFS_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/caentry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/caentry.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,96 @@ +/* + * 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: caentry.h + * + */ + +#ifndef CAENTRY_H +#define CAENTRY_H + +#include +#include +#include + +#include "caclient_global.h" +#include "cadefs.h" +#include "caicondescription.h" + +CA_CLIENT_TEST_CLASS( TestCaClient ) + +class CaObjectAdapter; +class CaEntryPrivate; +class HbIcon; + +class CACLIENT_EXPORT CaEntry +{ + /*! + * This class is not intended to be derived. + */ + +public: + + explicit CaEntry(EntryRole entryRole = ItemEntryRole); + + virtual ~CaEntry(); + + int id() const; + + QString text() const; + void setText(const QString &text, bool localized = false); + + QString description() const; + void setDescription(const QString &text, bool localized = false); + + CaIconDescription iconDescription() const; + void setIconDescription(const CaIconDescription &iconDescription); + + EntryFlags flags() const; + void setFlags(EntryFlags flags); + + QString entryTypeName() const; + void setEntryTypeName(const QString &entryTypeName); + + QMap attributes() const; + QString attribute(const QString &name) const; + void setAttribute(const QString &name, const QString &value); + void removeAttribute(const QString &name); + + HbIcon makeIcon(const QSizeF &size = QSizeF(70.0, 70.0)) const; + + EntryRole role() const; + + CaEntry(const CaEntry &entry); + CaEntry &operator=(const CaEntry &entry); + +private: + + void setId(int id); + bool isLocalized(LocalizationType localized) const; + +private: + /*! + * A special kind of pointer, supporting sharing data, to a private + * implementation. + */ + QSharedDataPointer m_d; + + friend class CaEntryPrivate; + friend class ::CaObjectAdapter; + + CA_CLIENT_TEST_FRIEND_CLASS( TestCaClient ) + +}; + + +#endif // CAENTRY_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/caicondescription.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/caicondescription.h Wed Oct 06 16:00:22 2010 +0300 @@ -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: caicondescription.h + * + */ + +#ifndef CAICONDESCRIPTION_H +#define CAICONDESCRIPTION_H + +#include + +#include "caclient_global.h" + +class CaObjectAdapter; + +class CaIconDescriptionPrivate; + +class CACLIENT_EXPORT CaIconDescription +{ + +public: + + CaIconDescription(); + CaIconDescription(const CaIconDescription &iconDescription); + ~CaIconDescription(); + + CaIconDescription &operator=(const CaIconDescription &iconDescription); + + int id() const; + + QString filename() const; + void setFilename(const QString &filename); + + QString skinId() const; + void setSkinId(const QString &skinId); + + QString applicationId() const; + void setApplicationId(const QString &applicationId); + +private: + + void setId(int id); + +private: + /** + * Pointer to a private implementation. + */ + QSharedDataPointer m_d; + + friend class CaIconDescriptionPrivate; + friend class ::CaObjectAdapter; +}; + +#endif // CAICONDESCRIPTION_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/caitemmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/caitemmodel.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,103 @@ +/* + * 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: caitemmodel.h + * + */ + +#ifndef CASTANDARDITEMMODEL_H +#define CASTANDARDITEMMODEL_H + +// System includes +#include +#include + +// User includes +#include "caclient_global.h" +#include "caquery.h" + +// Forward declarations +class CaEntry; +class CaItemModelPrivate; +CA_CLIENT_TEST_CLASS(TestCaClient) + +// Class declaration +class CACLIENT_EXPORT CaItemModel: public QAbstractItemModel +{ + +Q_OBJECT + CA_CLIENT_TEST_FRIEND_CLASS(TestCaClient) + +public: + + // Data types + enum CaItemRole + { + IdRole = Qt::UserRole + 1, + ParentIdRole, + TypeRole, + FlagsRole, + TextRole,//contains title represented as QString, + DescriptionRole, // contains item description + FullTextRole, //'title description' convinient for operations such as search + UninstalRole, //contains progress status as decimal number in QString + CollectionTitleRole //contains title represented as QString, + + }; + + // Function declarations + CaItemModel(const CaQuery &query, QObject *parent = 0); + ~CaItemModel(); + + int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex index(int row, int column = 0, + const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &index) const; + QModelIndex root() const; + virtual QVariant data(const QModelIndex &index, int role = + Qt::DisplayRole) const; + void setAutoUpdate(bool autoUpdate); + void setSecondLineVisibility(bool secondLineVisible); + bool secondLineVisibility() const; + bool isAutoUpdate() const; + void setSort(SortAttribute sortAttribute, Qt::SortOrder sortOrder = + Qt::AscendingOrder); + void setIconSize(const QSizeF &size); + QSizeF getIconSize() const; + void updateModel(); + void setParentId(int parentId); + void setFlagsOn(const EntryFlags &onFlags); + void setFlagsOff(const EntryFlags &offFlags); + QSharedPointer entry(const QModelIndex &index) const; + + QList getUninstallingEntriesIds(int componentId); + void updateProgress(int id, int valueOfProgress); + + +signals: + + void scrollTo(int row, QAbstractItemView::ScrollHint hint = + QAbstractItemView::EnsureVisible); + void empty(bool value); + void countChange(); + +protected: + // data + + CaItemModelPrivate * const m_d; + friend class CaItemModelPrivate; + +}; + +#endif // CASTANDARDITEMMODEL_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/camenuiconutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/camenuiconutility.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,37 @@ +/* +* 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: The API supports requesting raw bitmaps + * +*/ + + +#ifndef __CAMENUICONUTILITY_H__ +#define __CAMENUICONUTILITY_H__ + +#include "caclient_global.h" + +class CaEntry; +class HbIcon; + +class CACLIENT_EXPORT CaMenuIconUtility +{ +public: + static HbIcon getApplicationIcon(int uid, + const QSizeF &size = QSizeF(50,80)); + + static HbIcon getEntryIcon(const CaEntry& entry, + const QSizeF &size = QSizeF(50,80)); +}; + +#endif // __CAMENUICONUTILITY_H__ diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/canotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/canotifier.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,89 @@ +/* + * 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: canotifier.h + * + */ + +#ifndef CANOTIFIER_H +#define CANOTIFIER_H + +#include +#include "cadefs.h" +#include "caclient_global.h" +#include "caentry.h" + +CA_CLIENT_TEST_CLASS( TestCaClient ) + + +class CaNotifierPrivate; +class CaNotifierFilter; + +class CACLIENT_EXPORT CaNotifier: public QObject +{ +Q_OBJECT + +public: + + explicit CaNotifier(CaNotifierPrivate *const notifierPrivate); + + virtual ~CaNotifier(); + +signals: + + /*! + A signal emited when the entry is changed. + \param entryId entry id. + \param changeType the type of the change. + */ + void entryChanged(int entryId, ChangeType changeType); + + /*! + A signal emited when the entry is changed. + \param entry changed entry. + \param changeType the type of the change. + */ + void entryChanged(const CaEntry &entry, ChangeType changeType); + + /*! + A signal emited when the entry is touched. + \param id entry id. + */ + void entryTouched(int id); + + /*! + A signal emited when group content is changed. + \param groupId group id. + */ + void groupContentChanged(int groupId); + +protected: + + virtual void connectNotify(const char * signal); + + virtual void disconnectNotify(const char * signal); + +private: + + CaNotifierPrivate * const m_d; + + Q_DISABLE_COPY(CaNotifier) + + friend class CaNotifierPrivate; + + CA_CLIENT_TEST_FRIEND_CLASS( TestCaClient ) + +}; + + +#endif // CANOTIFIER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/canotifierfilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/canotifierfilter.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,60 @@ +/* + * 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: canotifierfilter.h + * + */ + +#ifndef CANOTIFIERFILTER_H +#define CANOTIFIERFILTER_H + +#include + +#include "cadefs.h" +#include "caclient_global.h" +#include "caentry.h" + +class CaNotifierFilterPrivate; +class CaQuery; + +class CACLIENT_EXPORT CaNotifierFilter +{ + friend class CaNotifierFilterPrivate; + +public: + + CaNotifierFilter(); + CaNotifierFilter(const CaNotifierFilter ¬ifierFilter); + explicit CaNotifierFilter(const CaQuery &query); + CaNotifierFilter &operator=(const CaNotifierFilter ¬ifierFilter); + virtual ~CaNotifierFilter(); + + int getParentId() const; + void setParentId(int parentId); + + QList getIds() const; + void setIds(const QList &ids); + + EntryRoles getEntryRole() const; + void setEntryRole(EntryRoles entryRole); + + QStringList getTypeNames() const; + void setTypeNames(const QStringList &typeNames); + +private: + + CaNotifierFilterPrivate * const m_d; + +}; + +#endif // CANOTIFIERFILTER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/caquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/caquery.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,81 @@ +/* + * 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: caquery.h + * + */ + +#ifndef CAQUERY_H +#define CAQUERY_H + +#include +#include "caclient_global.h" +#include "cadefs.h" + +class CaQueryPrivate; + +class CACLIENT_EXPORT CaQuery +{ + +public: + + CaQuery(); + CaQuery(const CaQuery &query); + CaQuery &operator=(const CaQuery &query); + ~CaQuery(); + + void setEntryRoles(EntryRoles entryRoles); + EntryRoles entryRoles() const; + + void setParentId(int id); + int parentId() const; + + void setChildId(int id); + int childId() const; + + void setEntryTypeNames(const QStringList &entryTypeNames); + QStringList entryTypeNames() const; + + void addEntryTypeName(const QString &entryTypeName); + + void setFlagsOn(const EntryFlags &onFlags); + EntryFlags flagsOn() const; + void setFlagsOff(const EntryFlags &offFlags); + EntryFlags flagsOff() const; + + void setSort(SortAttribute sortAttribute, + Qt::SortOrder sortOrder = Qt::AscendingOrder); + void getSort(SortAttribute& sortAttribute, + Qt::SortOrder& sortOrder) const; + + unsigned int count() const; + void setCount(unsigned int count); + + QMap attributes() const; + QString attribute(const QString &name) const; + void setAttribute(const QString &name, const QString &value); + void removeAttribute(const QString &name); + + void clear(); + +private: + + /** + * Pointer to a private implementation. + */ + CaQueryPrivate * const m_d; + friend class CaQueryPrivate; + +}; + +#endif // CAQUERY_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/caservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/caservice.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,133 @@ +/* + * 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: caservice.h + * + */ + +#ifndef CASERVICE_H +#define CASERVICE_H + +#include +#include + +#include + +#include "caclient_global.h" +#include "canotifierfilter.h" + +class CaQuery; +class CaEntry; +class CaServicePrivate; +class CaNotifier; + +class CACLIENT_EXPORT CaService: public QObject +{ + +Q_OBJECT + + explicit CaService(QObject *parent = 0); + + ~CaService(); + +public: + + static QSharedPointer instance(); + + QSharedPointer getEntry(int entryId) const; + QList< QSharedPointer > getEntries(const QList &entryIdList) const; + QList< QSharedPointer > getEntries(const CaQuery &query) const; + QList getEntryIds(const CaQuery &query) const; + + QSharedPointer createEntry(const CaEntry &entry) const; + + bool removeEntry(int entryId) const; + bool removeEntry(const CaEntry &entry) const; + bool removeEntries(const QList &entryIdList) const; + bool removeEntries(const QList< QSharedPointer > &entryList) const; + + bool updateEntry(const CaEntry &entry) const; + bool touch(const CaEntry &entry) const; + + bool insertEntryIntoGroup(int groupId, int entryId, + int beforeEntryId) const; + bool insertEntryIntoGroup(const CaEntry &group, const CaEntry &entry, + int beforeEntryId) const; + bool insertEntriesIntoGroup(int groupId, const QList &entryIdList, + int beforeEntryId) const; + bool insertEntriesIntoGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList, int beforeEntryId) const; + + bool removeEntryFromGroup(int groupId, int entryId) const; + bool removeEntryFromGroup(const CaEntry &group, + const CaEntry &entry) const; + bool removeEntriesFromGroup(int groupId, + const QList &entryIdList) const; + bool removeEntriesFromGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList) const; + + bool appendEntryToGroup(int groupId, int entryId) const; + bool appendEntryToGroup(const CaEntry &group, + const CaEntry &entry) const; + bool appendEntriesToGroup(int groupId, + const QList &entryIdList) const; + bool appendEntriesToGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList) const; + + bool prependEntryToGroup(int groupId, int entryId) const; + bool prependEntryToGroup(const CaEntry &group, + const CaEntry &entry) const; + bool prependEntriesToGroup(int groupId, + const QList &entryIdList) const; + bool prependEntriesToGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList) const; + + int executeCommand(int entryId, const QString &command = + caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const; + int executeCommand(const CaEntry &entry, const QString &command = + caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const; + + CaNotifier * createNotifier(const CaNotifierFilter &filter) const; + + bool customSort(int groupId, QList &entryIdList) const; + + ErrorCode lastError() const; + +signals: + + void entryChanged(int entryId, ChangeType changeType); + void entryChanged(const CaEntry &entry, ChangeType changeType); + void entryTouched(int id); + void groupContentChanged(int groupId); + +private: + + /** + * Pointer to a private implementation. + */ + CaServicePrivate * const m_d; + + /** + * The static pointer to the instance of CaService. + */ + static QWeakPointer m_instance; + + friend class CaServicePrivate; + friend class QtSharedPointer::ExternalRefCount; + + Q_DISABLE_COPY(CaService) + +}; + + +#endif // CASERVICE_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/casoftwareregistry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/casoftwareregistry.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2010 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 CA_SOFTWARE_REGISTRY_H +#define CA_SOFTWARE_REGISTRY_H + +#include +#include +#include +#include + +#include "caclient_global.h" + +//FORWARD DECLARATIONS +class QStringList; +class CaSoftwareRegistryPrivate; +class CaUninstallNotifier; + +/** + * Class provides Usif specific services + */ +class CACLIENT_EXPORT CaSoftwareRegistry: public QObject +{ + +Q_OBJECT + + explicit CaSoftwareRegistry(QObject *parent = 0); + + ~CaSoftwareRegistry(); + +public: + + static QSharedPointer create(); + + typedef QHash DetailMap; + + bool getUninstallDetails(int componentId, + QString &componentName, + QStringList &applicationsUids, + QString &confirmationMessage); + + bool getApplicationsUids(int componentId, QStringList &applicationsUids); + + DetailMap entryDetails(int componentId) const; + + QList retrieveLogEntries() const; + + CaUninstallNotifier *createUninstallNotifier() const; + + static QString componentNameKey(); + static QString componentVersionKey(); + static QString componentVendorKey(); + static QString componentDriveInfoKey(); + static QString componentProtectionDomainKey(); + static QString componentSizeKey(); + static QString componentTypeKey(); + static QString componentDescriptionKey(); + static QString componentTimeKey(); + static QString componentOperationTypeKey(); + static QString componentInstallValue(); + static QString componentUninstallValue(); + static QString componentUpgradeValue(); + static QString componentHiddenValue(); + +private: + /** + * Pointer to a private implementation. + */ + CaSoftwareRegistryPrivate *const m_d; + + /** + * The static pointer to the instance of CaSoftwareRegistry. + */ + static QWeakPointer m_instance; + + friend class CaSoftwareRegistryPrivate; + friend class QtSharedPointer::ExternalRefCount; + + Q_DISABLE_COPY(CaSoftwareRegistry) + +}; + +#endif // CA_SOFTWARE_REGISTRY_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/inc/cauninstallnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/inc/cauninstallnotifier.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,64 @@ +/* + * 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: canotifier.h + * + */ + +#ifndef CAUINSTALLNOTIFIER_H +#define CAUINSTALLNOTIFIER_H + +#include +#include + +#include "caclient_global.h" +class CaUninstallNotifierPrivate; + +class CaUninstallNotifier: public QObject +{ +Q_OBJECT + +public: + + static CaUninstallNotifier* notifier(); + +private: + + explicit CaUninstallNotifier(CaUninstallNotifierPrivate *const notifierPrivate); + + virtual ~CaUninstallNotifier(); + +signals: + + /*! + A signal emited when the entry is changed. + \param entryId entry id. + \param changeType the type of the change. + */ + void progressChange(int componentId, int progressValue); + +private: + + CaUninstallNotifierPrivate * const m_d; + + static QSharedPointer mInstance; + + Q_DISABLE_COPY(CaUninstallNotifier) + + friend class CaUninstallNotifierPrivate; + + friend class QtSharedPointer::ExternalRefCount; +}; + + +#endif // CAUINSTALLNOTIFIER_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/armv5/sapiapp_S60_3_X_v_1_0_0.SISX Binary file homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/armv5/sapiapp_S60_3_X_v_1_0_0.SISX has changed diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/castorage.db Binary file homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/castorage.db has changed diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/emailTest.qm Binary file homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/emailTest.qm has changed diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/winscw/sapiapp_S60_3_X_v_1_0_0.sisx Binary file homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/data/winscw/sapiapp_S60_3_X_v_1_0_0.sisx has changed diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/inc/t_caclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/inc/t_caclient.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,124 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + +#ifndef T_CACLIENT_H +#define T_CACLIENT_H + +#include +#include "cadefs.h" + +#ifdef Q_OS_SYMBIAN +#include +#endif + +class CaService; +class CaEntry; +class CaItemModel; + +/** + * @test Test class for hsmcsserviceprovider library. + */ +class TestCaClient : public QObject +{ + Q_OBJECT + +private slots: + + /** + * initialize + */ + void initTestCase(); + + // contentsorage_api - caservice + void Test_instance(); + + void Test_getEntry(); + void Test_getEntries_ByIds(); + void Test_getEntries_ByQuery(); + + void Test_createEntry(); + + void Test_removeEntry_ById(); + void Test_removeEntry_ByEntry(); + void Test_removeEntries_ByIds(); + void Test_RemoveEntries_ByEntries(); + + void Test_epdateEntry(); + void Test_touch(); + + void Test_insertEntryIntoGroup_ById(); + void Test_insertEntryIntoGroup_ByEntry(); + void Test_insertEntriesIntoGroup_ByIds(); + void Test_insertEntriesIntoGroup_ByEntries(); + + void Test_removeEntryFromGroup_ById(); + void Test_removeEntryFromGroup_ByEntry(); + void Test_removeEntriesFromGroup_ByIds(); + void Test_removeEntriesFromGroup_ByEntries(); + + void Test_appendEntryToGroup_ById(); + void Test_appendEntryToGroup_ByEntry(); + void Test_appendEntriesToGroup_ByIds(); + void Test_appendEntriesToGroup_ByEntries(); + + void Test_prependEntryToGroup_ById(); + void Test_prependEntryToGroup_ByEntry(); + void Test_prependEntriesToGroup_ByIds(); + void Test_prependEntriesToGroup_ByEntries(); +#ifdef Q_OS_SYMBIAN + void Test_executeCommand_ById(); + void Test_executeCommand_ByEntry(); +#endif //Q_OS_SYMBIAN + + void Test_createNotifier(); + void Test_customSort(); + void Test_lastError(); + + // contentsorage_api - camenuiconutility + void Test_getApplicationIcon(); + void Test_getEntryIcon(); + + /** + * cleanup + */ + void cleanupTestCase(); + +private: + void startThread(); + void stopThread(); + // utility methods + QSharedPointer createGroup(const QString &groupName, const QString &typeName); + QSharedPointer createItem(const QString &itemName, const QString &description, + const QString &typeName, EntryFlags flags); + QSharedPointer createItem(const QString &itemName, const QString &typeName); + void addItemToGroup(int groupId, int itemId); + void removeItemFromGroup(int groupId, int itemId); + void removeEntry(int entryId); + bool removeEntry(const QString &entryName); + QString itemName(const CaItemModel &model, int row); + void terminatServer(); + +#ifdef Q_OS_SYMBIAN + RThread iThread; +#endif //Q_OS_SYMBIAN + +private: + QSharedPointer mService; +}; + + +#endif//T_CACLIENT_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/inc/t_caclientnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/inc/t_caclientnotifier.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,76 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + +#ifndef T_CACLIENTNOTIFIER_H +#define T_CACLIENTNOTIFIER_H + +#include +#include +#include "cadefs.h" + +class CaEntry; +class CaNotifierFilter; +class CaNotifier; +class CaService; + +/** + * @test Test class for hsmcsserviceprovider library. + */ +class TestCaClientNotifier : public QObject +{ + Q_OBJECT + +public: + + TestCaClientNotifier(); + TestCaClientNotifier(const CaService &service, CaNotifierFilter *filter = 0); + ~TestCaClientNotifier(); + + CaNotifier *getNotifier() const; + CaNotifierFilter *getFilter() const; + void clean(); + +public slots: + + void entryChanged(int entryId, ChangeType changeType); + void entryChanged(const CaEntry &entry, ChangeType changeType); + void entryTouched(int id); + void groupContentChanged(int groupId); + +public: + + int mEntryId; + int mGroupId; + ChangeType mChangeType; + CaEntry *mEntry; + + int mCount; + QList *mEntryIds; + QList *mGroupIds; + QList *mChangeTypes; + QList *mEntries; + + CaNotifierFilter *mFilter; + CaNotifier *mNotifier; + +private: + + Q_DISABLE_COPY(TestCaClientNotifier) + +}; + +#endif diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_createupdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_createupdate.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,231 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + + +#include "t_caclient.h" +#include "caservice.h" +#include "caquery.h" + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_instance() +{ + { + QSharedPointer service = CaService::instance(); + QVERIFY(!service.isNull()); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_lastError() +{ + { + //create item + CaEntry item; + item.setText("testName"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + item.setDescription("description"); + CaIconDescription iconDescription; + iconDescription.setFilename("iconFileName"); + iconDescription.setSkinId("iconSkinId"); + iconDescription.setApplicationId("268458321"); + + item.setIconDescription(iconDescription); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem = service->createEntry(item); + QCOMPARE(service->lastError(), NoErrorCode); + + //Cleanup + service->removeEntry(*resultItem); + QCOMPARE(service->lastError(), NoErrorCode); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_createEntry() +{ + { + const CaEntry constItem; + QCOMPARE(constItem.role(), ItemEntryRole); + + //create item + //check if proper entry returned + CaEntry item; + item.setText("testName"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + item.setDescription("description"); + CaIconDescription iconDescription; + iconDescription.setFilename("iconFileName"); + iconDescription.setSkinId("iconSkinId"); + iconDescription.setApplicationId("268458321"); + + item.setIconDescription(iconDescription); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem = service->createEntry(item); + QCOMPARE(service->lastError(), NoErrorCode); + QVERIFY(!resultItem.isNull()); + QCOMPARE(resultItem->role(), ItemEntryRole); + QCOMPARE(item.text(),resultItem->text()); + QCOMPARE(item.description(),resultItem->description()); + QCOMPARE(item.entryTypeName(),resultItem->entryTypeName()); + QCOMPARE(QString("attrVal1"),resultItem->attribute("attrName1")); + QCOMPARE(item.flags(),resultItem->flags()); + int itId =item.id(); + int resItId =resultItem->id(); + QVERIFY(itId != resItId); + QCOMPARE(iconDescription.filename(),resultItem->iconDescription().filename()); + QCOMPARE(iconDescription.skinId(),resultItem->iconDescription().skinId()); + QCOMPARE(iconDescription.applicationId(),resultItem->iconDescription().applicationId()); + + // entry from storage + QSharedPointer storageItem1 = service->getEntry(resultItem->id()); + QVERIFY(storageItem1); + QCOMPARE(QString("testName"),storageItem1->text()); + QCOMPARE(QString("description"),storageItem1->description()); + QCOMPARE(QString("test"),storageItem1->entryTypeName()); + QCOMPARE(QString("attrVal1"),storageItem1->attribute("attrName1")); + EntryFlags flags = item.flags(); + EntryFlags storageFlags = storageItem1->flags(); + QCOMPARE(iconDescription.filename(),storageItem1->iconDescription().filename()); + QCOMPARE(iconDescription.skinId(),storageItem1->iconDescription().skinId()); + QCOMPARE(iconDescription.applicationId(),storageItem1->iconDescription().applicationId()); + QVERIFY(storageItem1->iconDescription().id() > 0); + + QCOMPARE(flags ,storageFlags); + + //Cleanup + service->removeEntry(*resultItem); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_epdateEntry() +{ + { + CaEntry item1; + item1.setText("testName"); + item1.setAttribute("attrName1", "attrVal1"); + item1.setEntryTypeName("test"); + item1.setFlags(RemovableEntryFlag); + CaIconDescription iconDescription1; + iconDescription1.setFilename("iconFileName"); + iconDescription1.setSkinId("iconSkinId"); + iconDescription1.setApplicationId("268458321"); //Bluetouth app UID + item1.setIconDescription(iconDescription1); + + CaIconDescription iconDescription2; + iconDescription2.setFilename("iconFileName2"); + iconDescription2.setSkinId("iconSkinId2"); + iconDescription2.setApplicationId("537001519"); //SW update app UID + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem1 = service->createEntry(item1); + QCOMPARE(service->lastError(), NoErrorCode); + + QVERIFY(!resultItem1.isNull()); + + int id1 = resultItem1->id(); + resultItem1->setText("testName2"); + resultItem1->setAttribute("attrName2", "attrVal2"); + resultItem1->setAttribute("attrName1", "attrVal2"); + resultItem1->setEntryTypeName("test2"); + resultItem1->setFlags(UninstallEntryFlag); + resultItem1->setIconDescription(iconDescription2); + + bool updateResult1 = service->updateEntry(item1); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(!updateResult1); // no id -> return false + + bool updateResult2 = service->updateEntry(*resultItem1); + QCOMPARE(service->lastError(), NoErrorCode); + QVERIFY(updateResult2); // id present -> true + + QSharedPointer resultItem2 = service->createEntry(*resultItem1); + QCOMPARE(service->lastError(), NoErrorCode); + QVERIFY(!resultItem2.isNull()); + + int id2 = resultItem2->id(); + QVERIFY(id1 != id2); //entry clone created + + QSharedPointer storageItem1 = service->getEntry(id1); + QVERIFY(!storageItem1.isNull()); + + QSharedPointer storageItem2 = service->getEntry(id2); + QVERIFY(!storageItem2.isNull()); + + // check if attributes were updated + QCOMPARE(QString("testName2"),storageItem1->text()); + QCOMPARE(QString("test2"),storageItem1->entryTypeName()); + + QCOMPARE(QString("attrVal2"),storageItem1->attribute("attrName1")); + QCOMPARE(QString("attrVal2"),storageItem1->attribute("attrName2")); + QCOMPARE(resultItem1->flags(),storageItem1->flags()); + QCOMPARE(iconDescription2.filename(),storageItem1->iconDescription().filename()); + QCOMPARE(iconDescription2.skinId(),storageItem1->iconDescription().skinId()); + QCOMPARE(iconDescription2.applicationId(),storageItem1->iconDescription().applicationId()); + // cloned item should have the same attributes + QCOMPARE(QString("testName2"),storageItem2->text()); + QCOMPARE(QString("test2"),storageItem2->entryTypeName()); + QCOMPARE(QString("attrVal2"),storageItem2->attribute("attrName1")); + QCOMPARE(QString("attrVal2"),storageItem2->attribute("attrName2")); + QCOMPARE(resultItem1->flags(),storageItem2->flags()); + + //Cleanup + service->removeEntry(id1); + service->removeEntry(id2); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::terminatServer() +{ + TFindProcess processFinder; + processFinder.Find(_L("camenuserver*")); + TFullName caName; + while ( KErrNone == processFinder.Next( caName ) ) { + RProcess caProcess; + TInt err = caProcess.Open(caName); + if( KErrNone == err ) { + caProcess.Terminate(0); + } + caProcess.Close(); + } +} + +QTEST_MAIN(TestCaClient) diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_entryquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_entryquery.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -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: Main test class for hspluginmodel library. +* +*/ + +#include +#include "t_caclient.h" +#include "caservice.h" +#include "caquery.h" +#include "calocalizationentry.h" +#include "camenuiconutility.h" + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_getEntryIcon() +{ + { + CaEntry entry; + entry.setEntryTypeName(QString("application")); + QSizeF size(50,50); + + HbIcon icon = CaMenuIconUtility::getEntryIcon(entry, size); + QVERIFY(icon.size().isValid()); + QVERIFY(icon.height() > 0); + QVERIFY(icon.width() > 0); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_getApplicationIcon() +{ + { + int uid = 270495019; // contest mbm icon + QSizeF size(50,50); + + HbIcon icon = CaMenuIconUtility::getApplicationIcon(uid,size); + + QVERIFY(icon.size().isValid()); + QVERIFY(icon.height() > 0); + QVERIFY(icon.width() > 0); + + int uid2 = 537006483; // AknConf mif icon + HbIcon icon2 = CaMenuIconUtility::getApplicationIcon(uid2,size); + QVERIFY(icon2.size().isValid()); + } +} + diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_executecommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_executecommand.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,140 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + +#include "t_caclient.h" +#include "caservice.h" +#include "caquery.h" + +#ifdef Q_OS_SYMBIAN +//s60 +#include + +#include +#include + +#include "t_cainstaller.h" + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_executeCommand_ById() +{ + { + QSharedPointer service = CaService::instance(); + QSharedPointer entry; + CaQuery query; + query.setEntryRoles(ItemEntryRole); + QList< QSharedPointer > items = service->getEntries(query); + int itemsCount = items.count(); + QVERIFY(itemsCount >0); + for (int i=0; i< itemsCount; i++) { + QString tmp = items[i]->text(); + if (items[i]->text() == "Contacts") { + entry=items[i]; + break; + } + } + QVERIFY(entry); + bool result = service->executeCommand(entry->id(), "open") == 0; + QTest::qWait(2500); + QVERIFY2(result, "Command *open* failed"); + RWsSession session; + TInt error = session.Connect(); + TApaTaskList taskList(session); + TApaTask task = taskList.FindApp(_L("Contacts")); + QTest::qWait(250); + bool taskExists(false); + if (task.Exists()) { + taskExists = true; + task.EndTask(); + } + QTest::qWait(250); + session.Close(); + QTest::qWait(250); + QVERIFY(taskExists); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_executeCommand_ByEntry() +{ + { + + _LIT(KAppTestFile, "c:\\testing\\data\\t_caclient\\installs\\sapiapp_S60_3_X_v_1_0_0.sisx"); + CaQuery query; + QSharedPointer service = CaService::instance(); + CaEntry *entry; + CaEntry *entryPhonebook; + QTest::qWait(250); + QStringList list("application"); + query.setEntryTypeNames(list); + query.setFlagsOn(VisibleEntryFlag); + RFs TheFs; + User::LeaveIfError(TheFs.Connect()); + + QScopedPointer installer; + QT_TRAP_THROWING(installer.reset(T_CaInstaller::NewL())); + + installer->InstallL( KAppTestFile ); + + QTest::qWait(30000); + + QList< QSharedPointer > items = service->getEntries(query); + + int itemsCountAndOne = items.count(); + + for (int i=0; i< items.count(); i++) { + QString tmp = items[i]->text(); + if (items[i]->text() == "Contacts") { + entryPhonebook=items[i].data(); + break; + } + } + + for (int i=0; i< itemsCountAndOne; i++) { + if (items[i]->text() == "sapiapp") { + entry=items[i].data(); + break; + } + } + //entry attribute will be removed by appscanner + //after "sapiapp" entry is removed + QVERIFY2(entry, "Sapi app has not installed"); + entryPhonebook->setAttribute("mmc_id","0x12345678"); + service->updateEntry(*entryPhonebook); + bool result = false; + if (entry->id() > 0) { + result = service->executeCommand(*entry, "remove") == 0; + } + QVERIFY2(result, "Remove command returns false"); + QTest::qWait(40000); + + QList< QSharedPointer > itemsNew = service->getEntries(query); + int itemsCount = itemsNew.count(); + + QVERIFY2(itemsCountAndOne == itemsCount +1 , "Remove unsuccessful"); + + } +} + + +#endif //Q_OS_SYMBIAN diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_getentries.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_getentries.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,188 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + + +#include "t_caclient.h" +#include "caservice.h" +#include "caquery.h" + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_getEntry() +{ + { + CaEntry item; + item.setText("testName"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + + CaIconDescription iconDescription; + iconDescription.setFilename("iconFileName"); + iconDescription.setSkinId("iconSkinId"); + iconDescription.setApplicationId("268458321"); + item.setIconDescription(iconDescription); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem = service->createEntry(item); + + QVERIFY(!resultItem.isNull()); + // entry from storage + QSharedPointer storageItem1 = service->getEntry(resultItem->id()); + QCOMPARE(service->lastError(), NoErrorCode); + QVERIFY(storageItem1); + QCOMPARE(storageItem1->role(), ItemEntryRole); + QCOMPARE(QString("testName"),storageItem1->text()); + QCOMPARE(QString("test"),storageItem1->entryTypeName()); + QCOMPARE(QString("attrVal1"),storageItem1->attribute("attrName1")); + QCOMPARE(item.flags(),storageItem1->flags()); + QCOMPARE(iconDescription.filename(),storageItem1->iconDescription().filename()); + QCOMPARE(iconDescription.skinId(),storageItem1->iconDescription().skinId()); + QCOMPARE(iconDescription.applicationId(),storageItem1->iconDescription().applicationId()); + QSharedPointer storageItem2 = service->getEntry(9999); + QVERIFY(service->lastError() != NoErrorCode); + QVERIFY(!storageItem2); + + //Cleanup + service->removeEntry(*resultItem); + + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_getEntries_ByIds() +{ + { + CaEntry item; + item.setText("testName1"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem1 = service->createEntry(item); + item.setText("testName2"); + QSharedPointer resultItem2 = service->createEntry(item); + item.setText("testName3"); + QSharedPointer resultItem3 = service->createEntry(item); + QVERIFY(!resultItem1.isNull()); + QVERIFY(!resultItem2.isNull()); + QVERIFY(!resultItem3.isNull()); + + QList ids; + ids.append(resultItem1->id()); + ids.append(resultItem3->id()); + ids.append(resultItem2->id()); + + QList< QSharedPointer > entries = service->getEntries(ids) ; + QCOMPARE(entries.count(), 3); + QCOMPARE(service->lastError(), NoErrorCode); + + QVERIFY(entries.at(0)); + QCOMPARE(entries.at(0)->role(), ItemEntryRole); + QCOMPARE(QString("testName1"),entries.at(0)->text()); + QCOMPARE(QString("test"),entries.at(0)->entryTypeName()); + QCOMPARE(QString("attrVal1"),entries.at(0)->attribute("attrName1")); + QCOMPARE(item.flags(),entries.at(0)->flags()); + QVERIFY(entries.at(1)); + QCOMPARE(entries.at(1)->role(), ItemEntryRole); + QCOMPARE(QString("testName3"),entries.at(1)->text()); + QCOMPARE(QString("test"),entries.at(1)->entryTypeName()); + QCOMPARE(QString("attrVal1"),entries.at(1)->attribute("attrName1")); + QCOMPARE(item.flags(),entries.at(1)->flags()); + QVERIFY(entries.at(2)); + QCOMPARE(entries.at(2)->role(), ItemEntryRole); + QCOMPARE(QString("testName2"),entries.at(2)->text()); + QCOMPARE(QString("test"),entries.at(2)->entryTypeName()); + QCOMPARE(QString("attrVal1"),entries.at(2)->attribute("attrName1")); + QCOMPARE(item.flags(),entries.at(2)->flags()); + + QCOMPARE(entries.at(0)->id(),resultItem1->id()); + QCOMPARE(entries.at(1)->id(),resultItem3->id()); + QCOMPARE(entries.at(2)->id(),resultItem2->id()); + + QList ids2; + ids2.append(resultItem1->id()); + ids2.append(9999); + + QList< QSharedPointer > entries2 = service->getEntries(ids2) ; + QCOMPARE(entries2.count(), 1); + QVERIFY(service->lastError() != NoErrorCode); + + //Cleanup + service->removeEntry(*resultItem1); + service->removeEntry(*resultItem2); + service->removeEntry(*resultItem3); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_getEntries_ByQuery() +{ + { + //CHECK INITIAL STATE IN DB + QSharedPointer service = CaService::instance(); + CaQuery query; + QStringList strList; + strList << QString("test_item1"); + query.setEntryTypeNames(strList); + query.addEntryTypeName(QString("test_item2")); + QList< QSharedPointer > entries12 = service->getEntries(query); + int count12Before = entries12.count(); + + //ADD TEST DATA TO THE STORAGE + CaEntry item1; + item1.setText("testName_item1"); + item1.setAttribute("attrName1_item", "attrVal1_item"); + item1.setEntryTypeName("test_item1"); + CaEntry item2; + item2.setText("testName_item2"); + item2.setAttribute("attrName2_item", "attrVal2_item"); + item2.setEntryTypeName("test_item2"); + + QSharedPointer resultEntry1 = service->createEntry(item1); + QSharedPointer resultEntry2 = service->createEntry(item2); + QVERIFY(!resultEntry1.isNull()); + QVERIFY(!resultEntry2.isNull()); + + //GET STATE FROM THE STORAGE AFTER ADD + strList.clear(); + strList << QString("test_item1"); + query.setEntryTypeNames(strList); + query.addEntryTypeName(QString("test_item2")); + entries12 = service->getEntries(query); + QCOMPARE(service->lastError(), NoErrorCode); + int count12After = entries12.count(); + + //CHECK RESULTS + QCOMPARE(count12Before+2,count12After); + + //CLEANUP THE STORAGE AFTER THE TEST + service->removeEntry(*resultEntry1); + service->removeEntry(*resultEntry2); + } +} + diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_notifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_notifier.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,206 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + +#include +#include + +#include "t_caclient.h" +#include "caservice.h" +#include "canotifier.h" +#include "canotifierfilter.h" +#include "caquery.h" +#include "t_caclientNotifier.h" + +const int entryIdFake(-1); +const int waitTime500ms(500); +const int waitTime1sec(1000); + +QTM_USE_NAMESPACE + +QStringList pluginPaths; +QString xmlName("caapphandlerplugin.xml"); + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::initTestCase() +{ +#ifdef Q_OS_SYMBIAN + startThread(); +#endif //Q_OS_SYMBIAN + mService = CaService::instance(); +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::cleanupTestCase() +{ +#ifdef Q_OS_SYMBIAN + stopThread(); +#endif //Q_OS_SYMBIAN + QSharedPointer serviceNull(NULL); + mService = serviceNull; + QTest::qWait(5000); +} + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +int threadFunction(void */*params*/) +{ +#ifdef Q_OS_SYMBIAN + while (ETrue) { + User::ResetInactivityTime();//it should help for Viewserver11 panic + User::After(5000000); + } +#endif //Q_OS_SYMBIAN + return 0; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::startThread() +{ +#ifdef Q_OS_SYMBIAN + User::LeaveIfError(iThread.Create( + _L("thread_kill_viewsrv11"), + threadFunction, + 16384, + 4000, + 4000, + NULL)); + iThread.Resume(); +#endif //Q_OS_SYMBIAN +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::stopThread() +{ +#ifdef Q_OS_SYMBIAN + iThread.Close(); +#endif //Q_OS_SYMBIAN +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_createNotifier() +{ +#ifdef Q_OS_SYMBIAN +#ifdef UT_MEMORY_CHECK +// __UHEAP_MARK; +#endif//UT_MEMORY_CHECK +#endif//Q_OS_SYMBIAN + { + + CaNotifierFilter *filter = new CaNotifierFilter(); + filter->setEntryRole(GroupEntryRole); + filter->setTypeNames(QStringList() << "TypeName"); + TestCaClientNotifier *clientNotifier = new TestCaClientNotifier(*mService, filter); + CaNotifier *notifier = clientNotifier->getNotifier(); + + connect(notifier, SIGNAL(entryChanged(int,ChangeType)), + clientNotifier, SLOT(entryChanged(int,ChangeType))); + QTest::qWait(waitTime500ms); + CaEntry group(GroupEntryRole); + group.setText("Text"); + group.setEntryTypeName("TypeName"); + + QSharedPointer entry = mService->createEntry(group); + QTest::qWait(waitTime1sec); + + QCOMPARE(clientNotifier->mChangeType, AddChangeType); + QVERIFY(clientNotifier->mEntryId > 0); + QCOMPARE(clientNotifier->mEntryId, entry->id()); + + // cleanup + disconnect(notifier, SIGNAL(entryChanged(int,ChangeType)), + clientNotifier, SLOT(entryChanged(int,ChangeType))); + QTest::qWait(waitTime500ms); + delete clientNotifier; + mService->removeEntry(entry->id()); + } +#ifdef Q_OS_SYMBIAN +#ifdef UT_MEMORY_CHECK +// __UHEAP_MARKEND; +#endif//UT_MEMORY_CHECK +#endif//Q_OS_SYMBIAN +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_touch() +{ +#ifdef Q_OS_SYMBIAN +#ifdef UT_MEMORY_CHECK +// __UHEAP_MARK; +#endif//UT_MEMORY_CHECK +#endif//Q_OS_SYMBIAN + + CaEntry item; + item.setText("Text"); + item.setEntryTypeName("TypeName"); + QSharedPointer entry = mService->createEntry(item); + QTest::qWait(waitTime1sec); + + CaNotifierFilter *filter = new CaNotifierFilter(); + filter->setEntryRole(ItemEntryRole); + filter->setIds(QList() << entry->id()); + TestCaClientNotifier *clientNotifier = new TestCaClientNotifier(*mService, filter); + CaNotifier *notifier = clientNotifier->getNotifier(); + + connect(notifier, SIGNAL(entryTouched(int)), + clientNotifier, SLOT(entryTouched(int))); + QTest::qWait(waitTime500ms); + + bool touched = mService->touch(*entry); + QTest::qWait(waitTime1sec); + + QVERIFY(clientNotifier->mEntryId > 0); + QCOMPARE(clientNotifier->mEntryId, entry->id()); + QCOMPARE(touched, TRUE); + + // cleanup + disconnect(notifier, SIGNAL(entryTouched(int)), + clientNotifier, SLOT(entryTouched(int))); + QTest::qWait(waitTime500ms); + delete clientNotifier; + delete filter; + mService->removeEntry(entry->id()); + QTest::qWait(waitTime1sec); + +#ifdef Q_OS_SYMBIAN +#ifdef UT_MEMORY_CHECK +// __UHEAP_MARKEND; +#endif//UT_MEMORY_CHECK +#endif//Q_OS_SYMBIAN +} + +//QTEST_MAIN(homescreen::test::TestCaClient) diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_organize.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_organize.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,859 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + + +#include "t_caclient.h" +#include "caservice.h" +#include "caquery.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_appendEntryToGroup_ById() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->appendEntryToGroup(9999, entry1->id())); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(!service->appendEntryToGroup(group->id(), 9999)); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(service->appendEntryToGroup(group->id(), entry1->id())); + QCOMPARE(service->lastError() , NoErrorCode); + + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),1); + QVERIFY(service->appendEntryToGroup(group->id(), entry2->id())); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QCOMPARE(entries.at(0),entry1->id()); + QCOMPARE(entries.at(1),entry2->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_appendEntryToGroup_ByEntry() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->appendEntryToGroup(groupEntry, *entry1)); + QVERIFY(!service->appendEntryToGroup(*group , itemEntry)); + QVERIFY(service->appendEntryToGroup(*group , *entry1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),1); + QVERIFY(service->appendEntryToGroup(*group, *entry2)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QCOMPARE(entries.at(0),entry1->id()); + QCOMPARE(entries.at(1),entry2->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_appendEntriesToGroup_ByIds() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer entry3 = service->createEntry(itemEntry); + QSharedPointer entry4 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList entries1; + entries1.append(entry1->id()); + entries1.append(entry2->id()); + QList entries2; + entries2.append(entry3->id()); + entries2.append(entry4->id()); + QList wrongEntries1; + wrongEntries1.append(entry1->id()); + wrongEntries1.append(9999); + + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->appendEntriesToGroup(9999, entries1)); + QVERIFY(!service->appendEntriesToGroup(group->id(), wrongEntries1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + + QVERIFY(service->appendEntriesToGroup(group->id(), entries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QVERIFY(service->appendEntriesToGroup(group->id(), entries2)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),4); + + QCOMPARE(entries.at(0),entry1->id()); + QCOMPARE(entries.at(1),entry2->id()); + QCOMPARE(entries.at(2),entry3->id()); + QCOMPARE(entries.at(3),entry4->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*entry3); + service->removeEntry(*entry4); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_appendEntriesToGroup_ByEntries() +{ + { + QSharedPointer itemEntry (new CaEntry()); + itemEntry->setText("item"); + itemEntry->setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(*itemEntry); + QSharedPointer entry2 = service->createEntry(*itemEntry); + QSharedPointer entry3 = service->createEntry(*itemEntry); + QSharedPointer entry4 = service->createEntry(*itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList< QSharedPointer > entries1; + entries1.append(entry1); + entries1.append(entry2); + QList< QSharedPointer > entries2; + entries2.append(entry3); + entries2.append(entry4); + QList > wrongEntries1; + wrongEntries1.append(entry1); + wrongEntries1.append(itemEntry); //this item has unspecified id + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->appendEntriesToGroup(groupEntry, entries1)); + QVERIFY(!service->appendEntriesToGroup(*group, wrongEntries1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + QVERIFY(service->appendEntriesToGroup(*group, entries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QVERIFY(service->appendEntriesToGroup(*group, entries2)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),4); + + QCOMPARE(entries.at(0),entry1->id()); + QCOMPARE(entries.at(1),entry2->id()); + QCOMPARE(entries.at(2),entry3->id()); + QCOMPARE(entries.at(3),entry4->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*entry3); + service->removeEntry(*entry4); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_prependEntryToGroup_ById() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->prependEntryToGroup(9999, entry1->id())); + QVERIFY(service->lastError() != NoErrorCode); + QVERIFY(!service->prependEntryToGroup(group->id(), 9999)); + QVERIFY(service->lastError() != NoErrorCode); + QVERIFY(service->prependEntryToGroup(group->id(), entry1->id())); + QCOMPARE(service->lastError() , NoErrorCode); + + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),1); + QVERIFY(service->prependEntryToGroup(group->id(), entry2->id())); + entries = service->getEntryIds(query); + + QCOMPARE(entries.count(),2); + QCOMPARE(entries.at(0),entry2->id()); + QCOMPARE(entries.at(1),entry1->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_prependEntryToGroup_ByEntry() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->prependEntryToGroup(groupEntry, *entry1)); + QVERIFY(!service->prependEntryToGroup(*group , itemEntry)); + QVERIFY(service->prependEntryToGroup(*group , *entry1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),1); + QVERIFY(service->prependEntryToGroup(*group, *entry2)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QCOMPARE(entries.at(0),entry2->id()); + QCOMPARE(entries.at(1),entry1->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_prependEntriesToGroup_ByIds() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer entry3 = service->createEntry(itemEntry); + QSharedPointer entry4 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList entries1; + entries1.append(entry1->id()); + entries1.append(entry2->id()); + QList entries2; + entries2.append(entry3->id()); + entries2.append(entry4->id()); + QList wrongEntries1; + wrongEntries1.append(entry1->id()); + wrongEntries1.append(9999); + + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->prependEntriesToGroup(9999, entries1)); + QVERIFY(!service->prependEntriesToGroup(group->id(), wrongEntries1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + + QVERIFY(service->prependEntriesToGroup(group->id(), entries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QVERIFY(service->prependEntriesToGroup(group->id(), entries2)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),4); + + QCOMPARE(entries.at(0),entry3->id()); + QCOMPARE(entries.at(1),entry4->id()); + QCOMPARE(entries.at(2),entry1->id()); + QCOMPARE(entries.at(3),entry2->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*entry3); + service->removeEntry(*entry4); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_prependEntriesToGroup_ByEntries() +{ + { + QSharedPointer itemEntry (new CaEntry()); + itemEntry->setText("item"); + itemEntry->setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(*itemEntry); + QSharedPointer entry2 = service->createEntry(*itemEntry); + QSharedPointer entry3 = service->createEntry(*itemEntry); + QSharedPointer entry4 = service->createEntry(*itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList< QSharedPointer > entries1; + entries1.append(entry1); + entries1.append(entry2); + QList< QSharedPointer > entries2; + entries2.append(entry3); + entries2.append(entry4); + QList< QSharedPointer > wrongEntries1; + wrongEntries1.append(entry1); + wrongEntries1.append(itemEntry); //this item has unspecified id + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->prependEntriesToGroup(groupEntry, entries1)); + QVERIFY(!service->prependEntriesToGroup(*group, wrongEntries1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + QVERIFY(service->prependEntriesToGroup(*group, entries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QVERIFY(service->prependEntriesToGroup(*group, entries2)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),4); + + QCOMPARE(entries.at(0),entry3->id()); + QCOMPARE(entries.at(1),entry4->id()); + QCOMPARE(entries.at(2),entry1->id()); + QCOMPARE(entries.at(3),entry2->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*entry3); + service->removeEntry(*entry4); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_insertEntryIntoGroup_ById() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(service->prependEntryToGroup(group->id(), entry1->id())); + + QVERIFY(!service->insertEntryIntoGroup(9999, entry2->id(), entry1->id())); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(!service->insertEntryIntoGroup(group->id(), 9999, entry1->id())); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(!service->insertEntryIntoGroup(group->id(), entry2->id(), 9999)); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(service->insertEntryIntoGroup(group->id(), entry2->id(), entry1->id())); + QCOMPARE(service->lastError() , NoErrorCode); + + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QCOMPARE(entries.at(0),entry2->id()); + QCOMPARE(entries.at(1),entry1->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_insertEntryIntoGroup_ByEntry() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(service->prependEntryToGroup(*group, *entry1)); + + QVERIFY(!service->insertEntryIntoGroup(groupEntry, *entry2, entry1->id())); + QVERIFY(!service->insertEntryIntoGroup(*group, itemEntry, entry1->id())); + QVERIFY(!service->insertEntryIntoGroup(*group, *entry2, 9999)); + + QVERIFY(service->insertEntryIntoGroup(*group, *entry2, entry1->id())); + + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QCOMPARE(entries.at(0),entry2->id()); + QCOMPARE(entries.at(1),entry1->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_insertEntriesIntoGroup_ByIds() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry3 = service->createEntry(itemEntry); + QSharedPointer entry4 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList entries2; + entries2.append(entry3->id()); + entries2.append(entry4->id()); + QList wrongEntries1; + wrongEntries1.append(entry1->id()); + wrongEntries1.append(9999); + + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(service->prependEntryToGroup(group->id(), entry1->id())); + + QVERIFY(!service->insertEntriesIntoGroup(9999, entries2, entry1->id())); + QVERIFY(!service->insertEntriesIntoGroup(group->id(), wrongEntries1, entry1->id())); + QVERIFY(!service->insertEntriesIntoGroup(group->id(), entries2, 9999)); + + QVERIFY(service->insertEntriesIntoGroup(group->id(), entries2, entry1->id())); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),3); + + QCOMPARE(entries.at(0),entry3->id()); + QCOMPARE(entries.at(1),entry4->id()); + QCOMPARE(entries.at(2),entry1->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry3); + service->removeEntry(*entry4); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_insertEntriesIntoGroup_ByEntries() +{ + { + QSharedPointer itemEntry (new CaEntry()); + itemEntry->setText("item"); + itemEntry->setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(*itemEntry); + QSharedPointer entry3 = service->createEntry(*itemEntry); + QSharedPointer entry4 = service->createEntry(*itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList< QSharedPointer > entries2; + entries2.append(entry3); + entries2.append(entry4); + QList< QSharedPointer > wrongEntries1; + wrongEntries1.append(entry1); + wrongEntries1.append(itemEntry); //this item has unspecified id + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(service->prependEntryToGroup(group->id(), entry1->id())); + + QVERIFY(!service->insertEntriesIntoGroup(groupEntry, entries2, entry1->id())); + QVERIFY(!service->insertEntriesIntoGroup(*group, wrongEntries1, entry1->id())); + QVERIFY(!service->insertEntriesIntoGroup(*group, entries2, 9999)); + + QVERIFY(service->insertEntriesIntoGroup(*group, entries2, entry1->id())); + + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),3); + + QCOMPARE(entries.at(0),entry3->id()); + QCOMPARE(entries.at(1),entry4->id()); + QCOMPARE(entries.at(2),entry1->id()); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry3); + service->removeEntry(*entry4); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_removeEntryFromGroup_ById() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->removeEntryFromGroup(9999, entry1->id())); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(!service->removeEntryFromGroup(group->id(), 9999)); + QVERIFY(service->lastError() != NoErrorCode); + + QVERIFY(service->prependEntryToGroup(group->id(), entry1->id())); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),1); + QVERIFY(service->removeEntryFromGroup(group->id(), entry1->id())); + QCOMPARE(service->lastError() , NoErrorCode); + + + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_removeEntryFromGroup_ByEntry() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(!service->removeEntryFromGroup(groupEntry, *entry1)); + QVERIFY(!service->removeEntryFromGroup(*group, itemEntry)); + + QVERIFY(service->prependEntryToGroup(group->id(), entry1->id())); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),1); + QVERIFY(service->removeEntryFromGroup(*group, *entry1)); + + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_removeEntriesFromGroup_ByIds() +{ + { + CaEntry itemEntry; + itemEntry.setText("item"); + itemEntry.setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(itemEntry); + QSharedPointer entry2 = service->createEntry(itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList entries1; + entries1.append(entry1->id()); + entries1.append(entry2->id()); + QList wrongEntries1; + wrongEntries1.append(entry1->id()); + wrongEntries1.append(9999); + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(service->prependEntriesToGroup(group->id(), entries1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + QVERIFY(!service->removeEntriesFromGroup(9999, entries1)); + QVERIFY(!service->removeEntriesFromGroup(group->id(), wrongEntries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + + QVERIFY(service->removeEntriesFromGroup(group->id(), entries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_removeEntriesFromGroup_ByEntries() +{ + { + QSharedPointer itemEntry (new CaEntry); + itemEntry->setText("item"); + itemEntry->setEntryTypeName("typeok"); + CaEntry groupEntry(GroupEntryRole); + groupEntry.setText("group"); + groupEntry.setEntryTypeName("typeok"); + QSharedPointer service = CaService::instance(); + + QSharedPointer entry1 = service->createEntry(*itemEntry); + QSharedPointer entry2 = service->createEntry(*itemEntry); + QSharedPointer group = service->createEntry(groupEntry); + + QList > entries1; + entries1.append(entry1); + entries1.append(entry2); + QList > wrongEntries1; + wrongEntries1.append(entry1); + wrongEntries1.append(itemEntry); //this item has unspecified id + + CaQuery query; + query.setParentId(group->id()); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QVERIFY(service->prependEntriesToGroup(*group, entries1)); + QList entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + + QVERIFY(!service->removeEntriesFromGroup(groupEntry, entries1)); + QVERIFY(!service->removeEntriesFromGroup(*group, wrongEntries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),2); + + QVERIFY(service->removeEntriesFromGroup(*group, entries1)); + entries = service->getEntryIds(query); + QCOMPARE(entries.count(),0); + + //Cleanup + service->removeEntry(*entry1); + service->removeEntry(*entry2); + service->removeEntry(*group); + + } +} + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_customSort() +{ + CaQuery collectionQuery; + collectionQuery.addEntryTypeName("collection"); + QSharedPointer service = CaService::instance(); + QList collectionIds = service->getEntryIds(collectionQuery); + QVERIFY(collectionIds.count()); + + const int groupId = collectionIds.at(0); + + CaQuery query; + query.setParentId(groupId); + query.setSort(DefaultSortAttribute, Qt::AscendingOrder); + + QList idsBefore = service->getEntryIds(query); + QVERIFY(idsBefore.count()); + + int first = idsBefore.takeFirst(); + idsBefore.append(first); + + // sort entries is group in custom order + QVERIFY(service->customSort(groupId, idsBefore)); + + // check results + QList idsAfter = service->getEntryIds(query); + QVERIFY(idsAfter.count()); + + QCOMPARE(idsAfter.count(),idsBefore.count()); + QCOMPARE(idsAfter, idsBefore); +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_remove.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclient_remove.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,156 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + +#include "t_caclient.h" +#include "caservice.h" +#include "caquery.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_removeEntry_ById() +{ + { + CaEntry item; + item.setText("testName"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem1 = service->createEntry(item); + QVERIFY(!resultItem1.isNull()); + QVERIFY(!service->removeEntry(9999)); + QVERIFY(service->removeEntry(resultItem1->id())); + QCOMPARE(service->lastError() , NoErrorCode); + + QSharedPointer storageItem1 = service->getEntry(resultItem1->id()); + QVERIFY(storageItem1.isNull()); // entry not present in the storage + QVERIFY(!service->removeEntry(resultItem1->id())); + QVERIFY(service->lastError() != NoErrorCode); + + QSharedPointer resultItem2 = service->createEntry(item); + QVERIFY(!resultItem2.isNull()); + + QVERIFY(service->removeEntry(*resultItem2)); + QSharedPointer storageItem2 = service->getEntry(resultItem2->id()); + QVERIFY(storageItem2.isNull()); // entry not present in the storage + QVERIFY(!service->removeEntry(*resultItem2)); + + //cleanup + service->removeEntry(*resultItem1); + service->removeEntry(*resultItem2); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_removeEntry_ByEntry() +{ + { + CaEntry item; + item.setText("testName"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem1 = service->createEntry(item); + QVERIFY(!resultItem1.isNull()); + + QVERIFY(service->removeEntry(*resultItem1)); + QCOMPARE(service->lastError() , NoErrorCode); + + QSharedPointer storageItem1 = service->getEntry(resultItem1->id()); + QVERIFY(storageItem1.isNull()); // entry not present in the storage + + //cleanup + service->removeEntry(*resultItem1); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_removeEntries_ByIds() +{ + { + CaEntry item; + item.setText("testName"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem1 = service->createEntry(item); + QSharedPointer resultItem2 = service->createEntry(item); + QVERIFY(!resultItem1.isNull()); + QVERIFY(!resultItem2.isNull()); + + QList ids; + ids.append(resultItem1->id()); + ids.append(resultItem2->id()); + QVERIFY(service->removeEntries(ids)); + QSharedPointer storageItem1 = service->getEntry(resultItem1->id()); + QSharedPointer storageItem2 = service->getEntry(resultItem2->id()); + QVERIFY(storageItem1.isNull()); // entry not present in the storage + QVERIFY(storageItem2.isNull()); // entry not present in the storage + + //cleanup + service->removeEntry(*resultItem1); + service->removeEntry(*resultItem2); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClient::Test_RemoveEntries_ByEntries() +{ + { + CaEntry item; + item.setText("testName"); + item.setAttribute("attrName1", "attrVal1"); + item.setEntryTypeName("test"); + item.setFlags(RemovableEntryFlag); + + QSharedPointer service = CaService::instance(); + QSharedPointer resultItem3 = service->createEntry(item); + QSharedPointer resultItem4 = service->createEntry(item); + QVERIFY(!resultItem3.isNull()); + QVERIFY(!resultItem4.isNull()); + + QList > entries; + entries.append(resultItem3); + entries.append(resultItem4); + + QVERIFY(service->removeEntries(entries)); + QSharedPointer storageItem3 = service->getEntry(resultItem3->id()); + QSharedPointer storageItem4 = service->getEntry(resultItem4->id()); + QVERIFY(storageItem3.isNull()); // entry not present in the storage + QVERIFY(storageItem4.isNull()); // entry not present in the storage + + //cleanup + service->removeEntry(*resultItem3); + service->removeEntry(*resultItem4); + } +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclientnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/src/t_caclientnotifier.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,182 @@ +/* +* 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: Main test class for hspluginmodel library. +* +*/ + +#include "t_caclientnotifier.h" +#include "caentry.h" +#include "canotifier.h" +#include "canotifierfilter.h" +#include "caservice.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TestCaClientNotifier::TestCaClientNotifier(): + mEntryId(0), + mGroupId(0), + mChangeType(AddChangeType), + mEntry(NULL), + mCount(0), + mEntryIds(new QList()), + mGroupIds(new QList()), + mChangeTypes(new QList()), + mEntries(new QList()), + mFilter(NULL), + mNotifier(NULL) +{ + +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TestCaClientNotifier::TestCaClientNotifier(const CaService &service, CaNotifierFilter *filter): + mEntryId(0), + mGroupId(0), + mChangeType(AddChangeType), + mEntry(NULL), + mCount(0), + mEntryIds(new QList()), + mGroupIds(new QList()), + mChangeTypes(new QList()), + mEntries(new QList()) +{ + if (!filter) { + mFilter = new CaNotifierFilter(); + mNotifier = service.createNotifier(*mFilter); + } else { + mFilter = NULL; + mNotifier = service.createNotifier(*filter); + } +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClientNotifier::clean() +{ + mEntryId = 0; + mGroupId = 0; + mChangeType = AddChangeType; + mCount = 0; + delete mEntryIds; + mEntryIds = new QList(); + delete mGroupIds; + mGroupIds = new QList(); + delete mChangeTypes; + mChangeTypes = new QList(); + delete mEntries; + mEntries = new QList(); + delete mEntry; + mEntry = NULL; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TestCaClientNotifier::~TestCaClientNotifier() +{ + delete mEntry; + delete mFilter; + delete mNotifier; + delete mEntryIds; + delete mGroupIds; + delete mChangeTypes; + delete mEntries; + +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CaNotifier *TestCaClientNotifier::getNotifier() const +{ + return mNotifier; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CaNotifierFilter *TestCaClientNotifier::getFilter() const +{ + return mFilter; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClientNotifier::entryChanged(int entryId, ChangeType changeType) +{ + mEntryId = entryId; + mChangeType = changeType; + mEntryIds->append(entryId); + mChangeTypes->append(changeType); + mEntries->append(NULL); + mGroupIds->append(0); + mCount++; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClientNotifier::entryChanged(const CaEntry &entry, ChangeType changeType) +{ + delete mEntry; + mEntry = new CaEntry(entry); + mEntryId = entry.id(); + mChangeType = changeType; + mEntryIds->append(entry.id()); + mChangeTypes->append(changeType); + mEntries->append(&entry); + mGroupIds->append(0); + mCount++; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClientNotifier::entryTouched(int id) +{ + mEntryId = id; + mEntryIds->append(id); + mChangeTypes->append(AddChangeType); + mEntries->append(NULL); + mGroupIds->append(0); + mCount++; +} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void TestCaClientNotifier::groupContentChanged(int groupId) +{ + mGroupId = groupId; + mEntryIds->append(0); + mChangeTypes->append(AddChangeType); + mEntries->append(NULL); + mGroupIds->append(groupId); + mCount++; +} diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api.pri Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,30 @@ +# +# 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: +# + +HEADERS += ./inc/*.h +SOURCES += ./src/*.cpp +symbian: +{ + HEADERS += ../../../../contentstorage/tsrc/testutils/inc/*.h + SOURCES += ../../../../contentstorage/tsrc/testutils/src/*.cpp + SOURCES += ../../../../contentstorage/srvsrc/castorageproxy.cpp + SOURCES += ../../../../contentstorage/srvsrc/cabackupnotifier.cpp + SOURCES += ../../../../contentstorage/castorage/src/*.cpp + + + BLD_INF_RULES.prj_testexports += "data/winscw/sapiapp_S60_3_X_v_1_0_0.sisx c:/testing/data/t_caclient/installs/sapiapp_S60_3_X_v_1_0_0.sisx" + BLD_INF_RULES.prj_exports += "data/winscw/sapiapp_S60_3_X_v_1_0_0.sisx c:/testing/data/t_caclient/installs/sapiapp_S60_3_X_v_1_0_0.sisx" +} \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,99 @@ +# +# 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: +# + +TEMPLATE = app +CONFIG += hb mobility +MOBILITY = serviceframework +HB = hbcore +include(../../../../common.pri) +include(../../../../contentstorage/tsrc/testutils/testutils.pri) +CONFIG(debug, debug|release) { + DESTDIR = debug +} else { + DESTDIR = release +} + +CONFIG += debug_and_release \ + console +QT += testlib xml + +DEFINES += CONTENTARSENAL_UNITTEST +DEFINES += CONTENT_ARSENAL_STORAGE_UT + +coverage:DEFINES += COVERAGE_MEASUREMENT +DEPENDPATH += . \ + ./inc \ + ./src +INCLUDEPATH += . \ + ./inc \ + ../../../../contentstorage/caclient/inc \ + ../../../../contentstorage_api \ + ../../../../contentstorage/srvinc \ + ../../../../contentstorage/inc \ + ../../../../contentstorage/cautils/inc \ + ../../../../contentstorage/castorage/inc \ + ../../../../contentstorage/inc + +LIBS += -lcaclient + +symbian: { + CONFIG += symbian_test + ### get rid of localization warnings + CONFIG -= hb + load(hb.prf) + CONFIG -= symbian_i18n + ### + + TARGET.UID2 = 0x100039CE + TARGET.UID3 = 0x2002DCFA + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCSTACKSIZE = 0x14000 // 80kB + TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB + + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + + LIBS += \ + -lapgrfx \ + -lefsrv \ + -lws32 \ + -lcautils \ + -lsqldb \ + -lbafl \ + -lflogger \ + -lsysutil + + export.sources = ./data/armv5/*.sisx + export.path = /testing/data/t_caclient/installs + + exportDB.sources = ./data/castorage.db + exportDB.path = /testing/data/t_caclient/ + + exportQM.sources = ./data/emailTest.qm + exportQM.path = /resource/qt/translations/ + + + DEPLOYMENT += export \ + exportDB \ + exportQM + +} + +include(t_contentstorage_api.pri) +!win32:include(t_contentstorage_api_installs_win32.pri) +!symbian:unix:include(t_contentstorage_api_installs_unix.pri) + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api_installs_unix.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api_installs_unix.pri Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,30 @@ +# +# 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: +# +# + +# Release - deploy only release version of the tests + +# + + + +r01.path = ../../../../bin/hstests + +r01.files = ./release/t_hsmcsserviceprovider \ + + + +INSTALLS += r01 \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api_installs_win32.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/t_contentstorage_api/t_contentstorage_api_installs_win32.pri Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,24 @@ +# +# 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: +# + +testfiles.path = ../../../../../bin/debug/ + +testfiles.files = ./release/t_caclient.exe \ + +testfiles.files = ./debug/t_caclient.exe + +INSTALLS += testfiles + diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/contentstorage_api/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/contentstorage_api/tsrc/tsrc.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,21 @@ +# +# 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: +# + +TEMPLATE = subdirs + +SUBDIRS = t_contentstorage_api + +CONFIG += ordered diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/hswidgetmodel_api/hswidgetmodel_api.metaxml --- a/homescreensrv_plat/hswidgetmodel_api/hswidgetmodel_api.metaxml Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - hswidgetmodel_api - Home screen widget model api - c++ - - - - no - no - - diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/taskswitcher_api/taskswitcher_api.pri --- a/homescreensrv_plat/taskswitcher_api/taskswitcher_api.pri Mon Sep 27 11:31:59 2010 +0300 +++ b/homescreensrv_plat/taskswitcher_api/taskswitcher_api.pri Wed Oct 06 16:00:22 2010 +0300 @@ -19,7 +19,7 @@ taskswitcher_api/tspropertydefs.h \ symbian { - crml.sources = taskswitcher_api/tsdevicedialog.qcrml + crml.sources = tsdevicedialog.qcrml crml.path = /resource/qt/crml DEPLOYMENT += crml } diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/taskswitcher_api/tsrc/t_tstasksettings/inc/t_tstasksettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/taskswitcher_api/tsrc/t_tstasksettings/inc/t_tstasksettings.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,57 @@ +/* +* 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 T_TSTASKSETTINGS_H +#define T_TSTASKSETTINGS_H + +#include +#include +#include + +#include "tstaskmonitor.h" +#include "tstasksettings.h" + +/** +* @test Test class for TsTaskSettings +*/ +class T_TsTaskSettings : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void testRegisteringScreenshotTriggersTaskListChangeSignal(); + void testUnregisteringScreenshotTriggersTaskListChangeSignal(); + void testIconIsReturnedAfterUnregisteringScreenshot(); + void testRegisteringEmptyPixmapReturnsFalse(); + void testRegisteringTheSameScreenshotTwiceTriggersTaskListChangeSignal(); + void testRegisteringOverwritesOldScreenshot(); + void testRegisteringFailsIfHigherPriorityScreenshotIsRegistered(); + + void testChangingVisibilityOfApplication(); + +private: + QSharedPointer unitTestTask(); + QPixmap imageWithCircle(); + bool registerHighPriorityScreenshot(const QPixmap &screenshot); + +private: + TsTaskSettings mTaskSettings; + TsTaskMonitor mTaskMonitor; + +}; + +#endif //T_TSTASKSETTINGS_H diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/taskswitcher_api/tsrc/t_tstasksettings/src/t_tstasksettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/taskswitcher_api/tsrc/t_tstasksettings/src/t_tstasksettings.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,225 @@ +/* +* 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: +* +*/ + +#include "t_tstasksettings.h" + +#include + +#include +#include +#include + +#include +#include + +#if defined (Q_OS_SYMBIAN) +#include +#include "tstaskmonitorclient.h" +#include "tsscreenshotclient.h" +#include "tsutils.h" +using TaskSwitcher::CleanupResetAndDestroyPushL; +#endif + +#include "tstask.h" +#include "tstaskchangeinfo.h" +#include "tstestutils.h" + +void T_TsTaskSettings::initTestCase() +{ + while (!unitTestTask().data()) + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); +} + +void T_TsTaskSettings::testRegisteringScreenshotTriggersTaskListChangeSignal() +{ + QVERIFY(mTaskSettings.registerScreenshot(imageWithCircle())); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); +} + +void T_TsTaskSettings::testUnregisteringScreenshotTriggersTaskListChangeSignal() +{ + QVERIFY(mTaskSettings.registerScreenshot(imageWithCircle())); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + + QVERIFY(mTaskSettings.unregisterScreenshot()); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); +} + +void T_TsTaskSettings::testIconIsReturnedAfterUnregisteringScreenshot() +{ + // get icon + QSharedPointer taskBefore = unitTestTask(); + QVERIFY(taskBefore.data()); + QPixmap icon = taskBefore->screenshot(); + QVERIFY(!icon.isNull()); + + // register and unregister screenshot + QVERIFY(mTaskSettings.registerScreenshot(imageWithCircle())); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + QVERIFY(mTaskSettings.unregisterScreenshot()); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + + // compare pixmap returned after register/unregister with icon + QSharedPointer taskAfter = unitTestTask(); + QVERIFY(taskAfter.data()); + QVERIFY(taskAfter->screenshot().toImage() == icon.toImage()); +} + +void T_TsTaskSettings::testRegisteringEmptyPixmapReturnsFalse() +{ + QVERIFY(!mTaskSettings.registerScreenshot(QPixmap())); +} + +void T_TsTaskSettings::testRegisteringTheSameScreenshotTwiceTriggersTaskListChangeSignal() +{ + QPixmap image = imageWithCircle(); + + QVERIFY(mTaskSettings.registerScreenshot(image)); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + QVERIFY(mTaskSettings.registerScreenshot(image)); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); +} + +void T_TsTaskSettings::testRegisteringOverwritesOldScreenshot() +{ + QPixmap previousScreenshot; + { + QSharedPointer myTask = unitTestTask(); + QVERIFY(myTask.data()); + previousScreenshot = myTask->screenshot(); + } + + QVERIFY(mTaskSettings.registerScreenshot(imageWithCircle())); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + + QPixmap screenshotAfterFirstRegistration; + { + QSharedPointer myTask = unitTestTask(); + QVERIFY(myTask.data()); + screenshotAfterFirstRegistration = myTask->screenshot(); + } + + QVERIFY(previousScreenshot.toImage() != screenshotAfterFirstRegistration.toImage()); + + QVERIFY(mTaskSettings.registerScreenshot(imageWithCircle())); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + + QPixmap screenshotAfterSecondRegistration; + { + QSharedPointer myTask = unitTestTask(); + QVERIFY(myTask.data()); + screenshotAfterSecondRegistration = myTask->screenshot(); + } + + QVERIFY(screenshotAfterSecondRegistration.toImage() != screenshotAfterFirstRegistration.toImage()); +} + +void T_TsTaskSettings::testRegisteringFailsIfHigherPriorityScreenshotIsRegistered() +{ + QPixmap highPriorityScreenshot = imageWithCircle(); + registerHighPriorityScreenshot(highPriorityScreenshot); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + + QVERIFY(!mTaskSettings.registerScreenshot(imageWithCircle())); + + // clean up and verify the screenshots can be registered + QVERIFY(mTaskSettings.unregisterScreenshot()); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + QVERIFY(mTaskSettings.registerScreenshot(imageWithCircle())); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); +} + +void T_TsTaskSettings::testChangingVisibilityOfApplication() +{ + { + QSharedPointer myTask = unitTestTask(); + QVERIFY(myTask.data()); + } + + // hide unit test task + mTaskSettings.setVisibility(false); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + { + QSharedPointer myTask = unitTestTask(); + QVERIFY(!myTask.data()); + } + + // show unit test task + mTaskSettings.setVisibility(true); + QVERIFY(TsTestUtils::waitForSignal(&mTaskMonitor, SIGNAL(taskListChanged()))); + { + QSharedPointer myTask = unitTestTask(); + QVERIFY(myTask.data()); + } +} + +QSharedPointer T_TsTaskSettings::unitTestTask() +{ + // find unit test task + QSharedPointer myTask; + foreach(TsTaskChange taskChange, mTaskMonitor.changeList(true)) { + if (!taskChange.second.isNull()) { + if (taskChange.second->name() == "t_tstasksettings") { + myTask = taskChange.second; + break; + } + } + } + return myTask; +} + +bool T_TsTaskSettings::registerHighPriorityScreenshot(const QPixmap &screenshot) +{ +#if defined (Q_OS_SYMBIAN) + int wgId = QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId(); + + QScopedPointer bitmap(screenshot.toSymbianCFbsBitmap()); + if (bitmap.isNull()) + return false; + + int error(KErrGeneral); + + QT_TRAP_THROWING ( + CTsScreenshotClient* screenshotClient = CTsScreenshotClient::NewLC(); + error = screenshotClient->RegisterScreenshot(bitmap.data(), wgId, High); + CleanupStack::PopAndDestroy(screenshotClient); + ); + + return error == KErrNone; +#else + return false; +#endif +} + +QPixmap T_TsTaskSettings::imageWithCircle() +{ + static int hue = 0; + QPixmap screenshot(10, 10); + + { + QPainter painter(&screenshot); + painter.setBrush(Qt::black); + painter.drawRect(screenshot.rect()); + painter.setBrush(QColor::fromHsv(hue, 255, 255)); + painter.drawEllipse(screenshot.rect()); + } + + hue += 17; + return screenshot; +} + +QTEST_MAIN(T_TsTaskSettings) diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/taskswitcher_api/tsrc/t_tstasksettings/t_tstasksettings.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/taskswitcher_api/tsrc/t_tstasksettings/t_tstasksettings.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,55 @@ +# +# 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: +# + +TEMPLATE = app + +QT *= testlib +CONFIG += console + +INCLUDEPATH += . \ + +HEADERS += inc/t_tstasksettings.h \ + +SOURCES += src/t_tstasksettings.cpp \ + +DEFINES += TSTASKMONITOR_TEST + +symbian { + CONFIG += symbian_test + coverage: CONFIG -= symbian_test + TARGET.EPOCSTACKSIZE = 0x14000 // 80kB + TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB + + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA=1 + + LIBS += -lcone \ + -lapgrfx \ # for RApaLsSession + -lws32 \ # for RWsSession + +} + +INCLUDEPATH += ../../../../internal/tstestutils/inc +LIBS += -ltstestutils.lib + +coverage { + DEFINES += COVERAGE_MEASUREMENT + DEFINES += QT_NO_DEBUG # omit ASSERTS in coverage measurements +} + +include(../../../../taskswitcher/client/client.pri) + +symbian:MMP_RULES += SMPSAFE \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 homescreensrv_plat/taskswitcher_api/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreensrv_plat/taskswitcher_api/tsrc/tsrc.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,21 @@ +# +# 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: +# + +TEMPLATE = subdirs + +SUBDIRS = t_tstasksettings + +CONFIG += ordered diff -r d1dadafc5584 -r 26079c1bb561 hsappkeyhandler/group/hsappkeyplugin.mmp --- a/hsappkeyhandler/group/hsappkeyplugin.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/hsappkeyhandler/group/hsappkeyplugin.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -49,3 +49,6 @@ LIBRARY afactivitylauncher.lib DEBUGLIBRARY flogger.lib // End of file + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 package_definition.xml --- a/package_definition.xml Mon Sep 27 11:31:59 2010 +0300 +++ b/package_definition.xml Wed Oct 06 16:00:22 2010 +0300 @@ -76,15 +76,13 @@ + + + - - - - - - + diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/activitytsplugin/activitytsplugin.pro --- a/taskswitcher/activitytsplugin/activitytsplugin.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/activitytsplugin/activitytsplugin.pro Wed Oct 06 16:00:22 2010 +0300 @@ -27,6 +27,7 @@ INCLUDEPATH += inc \ ../../../inc \ + ../utils/inc HEADERS += inc/activitytsplugin.h \ inc/activitytsmodel.h \ @@ -35,6 +36,7 @@ SOURCES += src/activitytsplugin.cpp \ src/activitytsmodel.cpp \ src/activitytsentry.cpp \ + symbian { load(data_caging_paths) @@ -56,4 +58,6 @@ #temporary workaround BLD_INF_RULES.prj_exports += "data/activitytsplugin.xml z:/resource/taskswitcher/activitytsplugin.xml" + + MMP_RULES += SMPSAFE } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/activitytsplugin/inc/activitytsmodel.h --- a/taskswitcher/activitytsplugin/inc/activitytsmodel.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/activitytsplugin/inc/activitytsmodel.h Wed Oct 06 16:00:22 2010 +0300 @@ -22,8 +22,12 @@ #include #include "activitytsentry.h" +#include "tswindowgroupsobserver.h" -class ActivityTsModel : public QObject +class MTsWindowGroupsMonitor; + +class ActivityTsModel : public QObject, + public MTsWindowGroupsObserver { Q_OBJECT @@ -31,6 +35,14 @@ ActivityTsModel(QObject *parent = 0); virtual ~ActivityTsModel(); +public: //from MTsWindowGroupsObserver + void HandleWindowGroupChanged(MTsResourceManager& resources, + const MTsRunningApplicationStorage& storage); + +private: + bool filterActivity(); + ActivityTsEntry *findEntryWithScreenshot(const QList &entryList, const QVariantHash &activityEntry); + public slots: QList taskList() const; QList taskList(int limit) const; @@ -42,21 +54,24 @@ void dataChanged(); private slots: - void getActivities(); + void getActivities(); -public slots: +public slots: void convertScreenshotToThumbnail(const QPixmap &thumbnail, void *userData); void thumbnailCreated(const QPixmap &thumbnail, const void *userData); - + void setResources(MTsResourceManager& resources); + signals: void createThumbnail(const QPixmap &source, int angle, const void *userData); private: + MTsWindowGroupsMonitor* mMonitor; QObject *mAfManager; int mMaxItems; + QList mData; + QList mPublishedData; - QList mData; - + QList mRunningAppsUid; }; #endif // ACTIVITYTSMODEL_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/activitytsplugin/src/activitytsentry.cpp --- a/taskswitcher/activitytsplugin/src/activitytsentry.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/activitytsplugin/src/activitytsentry.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -46,6 +46,9 @@ mData.insert("TaskName", activityData.value(ActivityApplicationName)); mData.insert("TaskScreenshot", -1); + + mData.insert(ActivityApplicationKeyword, activityData.value(ActivityApplicationKeyword)); + mData.insert(ActivityActivityKeyword, activityData.value(ActivityActivityKeyword)); } ActivityTsEntry::~ActivityTsEntry() diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/activitytsplugin/src/activitytsmodel.cpp --- a/taskswitcher/activitytsplugin/src/activitytsmodel.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/activitytsplugin/src/activitytsmodel.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -26,6 +26,10 @@ #include #include "afstorageglobals.h" +#include "tsrunningapp.h" +#include "tsrunningappstorage.h" +#include "tswindowgroupsmonitor.h" +#include "tsresourcemanager.h" QTM_USE_NAMESPACE @@ -36,7 +40,11 @@ const int KItemsLimit = 0x00000001; } -ActivityTsModel::ActivityTsModel(QObject *parent) : QObject(parent), mAfManager(0) , mMaxItems(10) +ActivityTsModel::ActivityTsModel(QObject *parent) : +QObject(parent), +mMonitor(0), +mAfManager(0) , +mMaxItems(10) { { QServiceManager serviceManager; @@ -67,23 +75,53 @@ ActivityTsModel::~ActivityTsModel() { + if (mMonitor) { + mMonitor->Cancel(*this); + } qDeleteAll(mData); } +void ActivityTsModel::HandleWindowGroupChanged( + MTsResourceManager& resources, + const MTsRunningApplicationStorage& storage) +{ + Q_UNUSED(resources); + mRunningAppsUid.clear(); + for (int i(0); i < storage.Count(); ++i) { + mRunningAppsUid.append(storage[i].UidL().iUid); + } + if(filterActivity()) { + emit dataChanged(); + } +} + +bool ActivityTsModel::filterActivity() +{ + bool retVal(false); + mPublishedData.clear(); + for (int i(0); i < mData.count(); ++i) { + if(!mRunningAppsUid.contains(mData[i]->data().value(ActivityApplicationKeyword).toInt())) { + mPublishedData.append(mData[i]); + retVal = true; + } + } + return retVal; +} + QList ActivityTsModel::taskList() const { - return taskList(mData.count()); + return taskList(mPublishedData.count()); } QList ActivityTsModel::taskList(int limit) const { QList result; - for (int i(0); i < limit && i < mData.count(); ++i) { - result.append(mData[i]->data()); + for (int i(0); i < limit && i < mPublishedData.count(); ++i) { + result.append(mPublishedData[i]->data()); } return result; } - + bool ActivityTsModel::openTask(const QVariant &id) { foreach (const ActivityTsEntry *entry, mData) { @@ -105,8 +143,8 @@ } void ActivityTsModel::getActivities() -{ - qDeleteAll(mData); +{ + QList oldData(mData); mData.clear(); QList activities; @@ -114,27 +152,49 @@ "activitiesList", Q_RETURN_ARG(QList, activities), Q_ARG(int, mMaxItems)); - + foreach (const QVariantHash &activityEntry, activities) { - mData.append(new ActivityTsEntry(activityEntry)); + ActivityTsEntry *reusableEntry = findEntryWithScreenshot(oldData, activityEntry); + if (reusableEntry) { + mData.append(reusableEntry); + oldData.removeAll(reusableEntry); + } else { + mData.append(new ActivityTsEntry(activityEntry)); - QMetaObject::invokeMethod( + QMetaObject::invokeMethod( mAfManager, "getThumbnail", Q_ARG(QString, activityEntry.value(ActivityScreenshotKeyword).toString()), Q_ARG(void *, mData.last())); + } } + qDeleteAll(oldData); + filterActivity(); emit dataChanged(); } +ActivityTsEntry *ActivityTsModel::findEntryWithScreenshot(const QList &entryList, const QVariantHash &activityEntry) +{ + foreach (ActivityTsEntry *entry, entryList) { + const QVariantHash data = entry->data(); + if ((data.value(ActivityApplicationKeyword) == activityEntry.value(ActivityApplicationKeyword)) && + (data.value(ActivityActivityKeyword) == activityEntry.value(ActivityActivityKeyword)) && + (data.value("TaskTimestamp") == activityEntry.value(ActivityTimestamp)) && + (data.value("TaskScreenshot") != -1)) { + return entry; + } + } + return 0; +} + void ActivityTsModel::convertScreenshotToThumbnail(const QPixmap &thumbnail, void *userData) { emit createThumbnail(thumbnail, 0, userData); } void ActivityTsModel::thumbnailCreated(const QPixmap &thumbnail, const void *userData) -{ +{ foreach (ActivityTsEntry *activity, mData) { if (activity == userData) { activity->setThumbnail(thumbnail.toSymbianCFbsBitmap()); @@ -143,3 +203,12 @@ } } } + +void ActivityTsModel::setResources(MTsResourceManager& resources) +{ + if (mMonitor) { + mMonitor->Cancel(*this); + } + mMonitor = &resources.WsMonitor(); + mMonitor->SubscribeL(*this); +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/backstepping/eabi/tsbacksteppingu.def --- a/taskswitcher/backstepping/eabi/tsbacksteppingu.def Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/backstepping/eabi/tsbacksteppingu.def Wed Oct 06 16:00:22 2010 +0300 @@ -5,4 +5,6 @@ _ZN25CTsBacksteppingActivationD2Ev @ 4 NONAME _ZTI25CTsBacksteppingActivation @ 5 NONAME _ZTV25CTsBacksteppingActivation @ 6 NONAME + _ZTI27CTsWindowGroupsObserverBase @ 7 NONAME + _ZTV27CTsWindowGroupsObserverBase @ 8 NONAME diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/backstepping/group/tsbackstepping.mmp --- a/taskswitcher/backstepping/group/tsbackstepping.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/backstepping/group/tsbackstepping.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -35,14 +35,15 @@ SOURCE tsbacksteppingactivation.cpp SOURCEPATH ../../utils/src -SOURCE tswindowgroupsobserver.cpp -SOURCE tsresourcemanager.cpp +SOURCE tswindowgroupsobserverbase.cpp SOURCE tsidlist.cpp LIBRARY euser.lib LIBRARY ws32.lib // for RWsSession -LIBRARY apgrfx.lib // for TApaTask / TApaTasksList LIBRARY afactivitylauncher.lib LIBRARY estor.lib DEBUGLIBRARY flogger.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/backstepping/inc/tsbackstepping.h --- a/taskswitcher/backstepping/inc/tsbackstepping.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/backstepping/inc/tsbackstepping.h Wed Oct 06 16:00:22 2010 +0300 @@ -19,11 +19,11 @@ #define __CBACKSTEPPING_H #include -#include +#include "tswindowgroupsobserverbase.h" class CTsBacksteppingFilter; -NONSHARABLE_CLASS(CTsBackstepping) : public CTsWindowGroupsObserver +NONSHARABLE_CLASS(CTsBackstepping) : public CTsWindowGroupsObserverBase { public: static CTsBackstepping* NewL( MTsWindowGroupsMonitor& ); diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/backstepping/src/tsbackstepping.cpp --- a/taskswitcher/backstepping/src/tsbackstepping.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/backstepping/src/tsbackstepping.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -28,7 +28,9 @@ #include #include "tsbacksteppingfilter.h" - +#include "tsrunningapp.h" +#include "tsrunningappstorage.h" +#include "tsresourcemanager.h" /** * String to switch hsapplication to IDLE state using activity framework */ @@ -69,7 +71,7 @@ */ CTsBackstepping::CTsBackstepping( MTsWindowGroupsMonitor &aMonitor ) : -CTsWindowGroupsObserver( aMonitor ), iHsWasFirst(ETrue) +CTsWindowGroupsObserverBase( aMonitor ), iHsWasFirst(ETrue) { } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/backstepping/src/tsbacksteppingactivation.cpp --- a/taskswitcher/backstepping/src/tsbacksteppingactivation.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/backstepping/src/tsbacksteppingactivation.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -22,7 +22,7 @@ #include "tsbacksteppingactivation.h" #include "tsbackstepping.h" - // ============================ MEMBER FUNCTIONS =============================== + // ----------------------------------------------------------------------------- // CBacksteppingActivation::NewL // Two-phased constructor. diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/client/client.pro --- a/taskswitcher/client/client.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/client/client.pro Wed Oct 06 16:00:22 2010 +0300 @@ -38,3 +38,6 @@ } include(client.pri) + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/inc/tstaskmonitorglobals.h --- a/taskswitcher/inc/tstaskmonitorglobals.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/inc/tstaskmonitorglobals.h Wed Oct 06 16:00:22 2010 +0300 @@ -37,7 +37,7 @@ OpenTaskMessage, CloseTaskMessage, WindowGroupToBackgroundMessage, - IgnoreWindowGroups + AllowedWindowGroups }; enum UpdatePriority { diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/rom.pri --- a/taskswitcher/rom.pri Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/rom.pri Wed Oct 06 16:00:22 2010 +0300 @@ -15,6 +15,8 @@ # BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " -BLD_INF_RULES.prj_exports += "rom/tstaskmonitor_core.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tstaskmonitor_core.iby)" +BLD_INF_RULES.prj_exports += "rom/tstaskmonitor_core.iby CORE_MW_LAYER_IBY_EXPORT_PATH(tstaskmonitor_core.iby)" BLD_INF_RULES.prj_exports += "./sis/stubs/taskmonitor_stub.sis /epoc32/release/winscw/udeb/z/system/install/taskmonitor_stub.sis" BLD_INF_RULES.prj_exports += "./sis/stubs/taskmonitor_stub.sis /epoc32/data/z/system/install/taskmonitor_stub.sis" +BLD_INF_RULES.prj_exports += "rom/tsdevicedialog_core.iby CORE_MW_LAYER_IBY_EXPORT_PATH(tsdevicedialog_core.iby)" +BLD_INF_RULES.prj_exports += "rom/tsdevicedialog_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(tsdevicedialog_resources.iby)" diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/rom/bld.inf --- a/taskswitcher/rom/bld.inf Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/rom/bld.inf Wed Oct 06 16:00:22 2010 +0300 @@ -19,7 +19,9 @@ PRJ_EXPORTS -tstaskmonitor_core.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tstaskmonitor_core.iby) +tstaskmonitor_core.iby CORE_MW_LAYER_IBY_EXPORT_PATH(tstaskmonitor_core.iby) +tsdevicedialog_core.iby CORE_MW_LAYER_IBY_EXPORT_PATH(tsdevicedialog_core.iby) +tsdevicedialog_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(tsdevicedialog_resources.iby) ../sis/stubs/taskmonitor_stub.sis /epoc32/release/winscw/udeb/z/system/install/taskmonitor_stub.sis ../sis/stubs/taskmonitor_stub.sis /epoc32/data/z/system/install/taskmonitor_stub.sis diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/rom/tsdevicedialog_core.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/rom/tsdevicedialog_core.iby Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,29 @@ +/* +* 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 __TSDEVICEDIALOG_CORE_IBY__ +#define __TSDEVICEDIALOG_CORE_IBY__ + +file=ABI_DIR\BUILD_DIR\tsdevicedialogplugin.dll SHARED_LIB_DIR\tsdevicedialogplugin.dll +data=\epoc32\data\z\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin + +// stub sis +data=ZSYSTEM/install/taskswitcher_stub.sis system/install/taskswitcher_stub.sis + +// qcrml +data=\epoc32\data\z\resource\qt\crml\tsdevicedialog.qcrml resource\qt\crml\tsdevicedialog.qcrml + +#endif //__TSAPP_CORE_IBY__ diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/rom/tsdevicedialog_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/rom/tsdevicedialog_resources.iby Wed Oct 06 16:00:22 2010 +0300 @@ -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: +* +*/ +#ifndef __TSDEVICEDIALOG_LANGUAGE_IBY__ +#define __TSDEVICEDIALOG_LANGUAGE_IBY__ + +// -------- hsapplication +data=DATAZ_\resource\qt\translations\taskswitcher.qm resource\qt\translations\taskswitcher.qm + +#endif //__TSAPP_LANGUAGE_IBY__ diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/screenshotplugin/group/tsscreenshotplugin.mmp --- a/taskswitcher/screenshotplugin/group/tsscreenshotplugin.mmp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/screenshotplugin/group/tsscreenshotplugin.mmp Wed Oct 06 16:00:22 2010 +0300 @@ -51,3 +51,6 @@ LIBRARY sensrvutil.lib LIBRARY centralrepository.lib DEBUGLIBRARY flogger.lib + + +SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/screenshotplugin/inc/tsscreenshotplugin.h --- a/taskswitcher/screenshotplugin/inc/tsscreenshotplugin.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/screenshotplugin/inc/tsscreenshotplugin.h Wed Oct 06 16:00:22 2010 +0300 @@ -55,7 +55,7 @@ void SendMessageL( const TDesC8& aMessage ); private: - CTsIdList* iBlockedList; + CTsIdList* iAllowedList; RPointerArray iCache; TInt iWindowGroupId; }; diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/screenshotplugin/src/tsscreenshotplugin.cpp --- a/taskswitcher/screenshotplugin/src/tsscreenshotplugin.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/screenshotplugin/src/tsscreenshotplugin.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -58,7 +58,7 @@ TWservCrEvent::EWindowGroupChanged | TWservCrEvent::EDeviceOrientationChanged); iWindowGroupId = KInvalidGroupId; - iBlockedList = CTsIdList::NewL(); + iAllowedList = CTsIdList::NewL(); } @@ -68,7 +68,7 @@ */ CTsScreenshotPlugin::~CTsScreenshotPlugin() { - delete iBlockedList; + delete iAllowedList; Env().UnregisterEventHandler(this); iCache.ResetAndDestroy(); } @@ -118,11 +118,11 @@ } CleanupStack::PopAndDestroy( screenshotMsg ); } - else if( IgnoreWindowGroups == function ) + else if( AllowedWindowGroups == function ) { CTsIdList* list = CTsIdList::NewLC( msgStream ); - delete iBlockedList; - iBlockedList = list; + delete iAllowedList; + iAllowedList = list; CleanupStack::Pop( list ); } CleanupStack::PopAndDestroy( &msgStream ); @@ -140,12 +140,15 @@ if( KInvalidGroupId != iWindowGroupId ) { NotifyWindowGroupToBackground( iWindowGroupId ); - TakeScreenshot( iWindowGroupId ); + if(iAllowedList->IsPresent(iWindowGroupId)) + { + TakeScreenshot( iWindowGroupId ); + } } iWindowGroupId = aEvent.WindowGroupIdentifier(); break; case TWservCrEvent::EDeviceOrientationChanged: - if( !iBlockedList->IsPresent( iWindowGroupId ) ) + if( iAllowedList->IsPresent( iWindowGroupId ) ) { TakeScreenshot( iWindowGroupId ); } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsdatalist.h --- a/taskswitcher/server/inc/tsdatalist.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/inc/tsdatalist.h Wed Oct 06 16:00:22 2010 +0300 @@ -23,7 +23,7 @@ #include -#include "tswindowgroupsobserver.h" +#include "tswindowgroupsobserverbase.h" #include "tsentry.h" #include "tsdatastorage.h" #include "tsdataobserver.h" @@ -31,13 +31,13 @@ class CApaWindowGroupName; class CFbsBitmap; +class MTsRunningApplication; -NONSHARABLE_CLASS( CTsDataList ) : public CTsWindowGroupsObserver, +NONSHARABLE_CLASS( CTsDataList ) : public CTsWindowGroupsObserverBase, public MTsDataStorage { public: static CTsDataList* NewL( MTsResourceManager& aResources, - MTsWindowGroupsMonitor& aMonitor, MTsDataObserver& aObserver, TsEnv& aEnv ); @@ -45,7 +45,6 @@ private: CTsDataList( MTsResourceManager& aResources, - MTsWindowGroupsMonitor& aMonitor, MTsDataObserver& aObserver, TsEnv& aEnv); diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsresourcemanagerimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/inc/tsresourcemanagerimp.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,70 @@ +/* + * 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 TSRESOURCEMANAGERIMP_H +#define TSRESOURCEMANAGERIMP_H + +#include +#include +#include + +#include "tsresourcemanager.h" + +class CTsWindowGroupsMonitor; + +/** + * Resource manager implemetatioin + */ +class CTsResourceManager: public CBase, + public MTsResourceManager + { +public: + /** + * Two phase constructor + */ + static CTsResourceManager* NewL(); + + /** + * Destructor + */ + ~CTsResourceManager(); + + /** + * @see MTsResourceManager::WsSession + */ + RWsSession& WsSession(); + + /** + * @see MTsResourceManager::ApaSession + */ + RApaLsSession& ApaSession(); + + MTsWindowGroupsMonitor& WsMonitor(); + +private: + /** + * Second phase constructor + */ + void ConstructL(); + +private: + RWsSession mWsSession; + RApaLsSession mApaSeesion; + CTsWindowGroupsMonitor* iMonitor; + + }; + +#endif // TSRESOURCEMANAGER_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsrunningapp.h --- a/taskswitcher/server/inc/tsrunningapp.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * 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 TSRUNNINGAPP_H -#define TSRUNNINGAPP_H - -#include - -#include "tswindowgroupsobserver.h" - -class CApaWindowGroupName; - -class CTsRunningApp: public CBase, - public MTsRunningApplication -{ -public: - static CTsRunningApp* NewLC( MTsResourceManager& aResources, - const RWsSession::TWindowGroupChainInfo& aInfo ); - ~CTsRunningApp(); - -private: - CTsRunningApp( MTsResourceManager& aResources, - const RWsSession::TWindowGroupChainInfo& aInfo ); - const CApaWindowGroupName& WindowGroupNameL() const; - -public://from MTsRunningApplication - TUid UidL()const; - const TDesC& CaptionL() const; - TBool IsHiddenL() const; - TBool IsSystemL() const; - TInt WindowGroupId() const; - TInt ParentWindowGroupId() const; - TBool IsEmbeded() const; - - -private: - MTsResourceManager& iResources; - const RWsSession::TWindowGroupChainInfo iWindowGroupInfo; - mutable CApaWindowGroupName* iWindowGroupName; - mutable TPtrC iCaption; -}; - -#endif//TSRUNNINGAPP_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsrunningappimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/inc/tsrunningappimp.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,58 @@ +/* + * 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 TSRUNNINGAPP_H +#define TSRUNNINGAPP_H + +#include +#include + +#include "tsrunningapp.h" + +class CApaWindowGroupName; +class MTsResourceManager; + +class CTsRunningApp: public CBase, + public MTsRunningApplication +{ +public: + static CTsRunningApp* NewLC( MTsResourceManager& aResources, + const RWsSession::TWindowGroupChainInfo& aInfo ); + ~CTsRunningApp(); + +private: + CTsRunningApp( MTsResourceManager& aResources, + const RWsSession::TWindowGroupChainInfo& aInfo ); + const CApaWindowGroupName& WindowGroupNameL() const; + +public://from MTsRunningApplication + TUid UidL()const; + const TDesC& CaptionL() const; + TBool IsHiddenL() const; + TBool IsSystemL() const; + TInt WindowGroupId() const; + TInt ParentWindowGroupId() const; + TBool IsEmbeded() const; + + +private: + MTsResourceManager& iResources; + const RWsSession::TWindowGroupChainInfo iWindowGroupInfo; + mutable CApaWindowGroupName* iWindowGroupName; + mutable TPtrC iCaption; +}; + +#endif//TSRUNNINGAPP_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsrunningappmodel.h --- a/taskswitcher/server/inc/tsrunningappmodel.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/inc/tsrunningappmodel.h Wed Oct 06 16:00:22 2010 +0300 @@ -21,8 +21,7 @@ #include "tsdatastorage.h" #include "tsdataobserver.h" -#include "tswindowgroupsobserver.h" - +class MTsResourceManager; class CTsDataList; class CTsScreenshotProvider; class TsEnv; @@ -35,25 +34,20 @@ public: static CTsRunningAppModel *NewL( MTsResourceManager &aResources, - MTsWindowGroupsMonitor &aMonitor, TsEnv& aEnv ); static CTsRunningAppModel *NewLC( MTsResourceManager &aResources, - MTsWindowGroupsMonitor &aMonitor, TsEnv& aEnv ); ~CTsRunningAppModel(); private: CTsRunningAppModel( MTsResourceManager &aResources ); void ConstructL( MTsResourceManager &aResources, - MTsWindowGroupsMonitor &aMonitor, TsEnv& aEnv); -// MHsDataObserver interface implementation -public: +public: // MHsDataObserver interface implementation virtual void DataChanged(); - -// MTsDataStorage interface implementation -public: + +public: // MTsDataStorage interface implementation TBool IsSupported( TInt aFunction ) const; void HandleDataL( TInt aFunction, RReadStream& aDataStream ); diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsrunningappserver.h --- a/taskswitcher/server/inc/tsrunningappserver.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/inc/tsrunningappserver.h Wed Oct 06 16:00:22 2010 +0300 @@ -25,7 +25,6 @@ #include "tsenv.h" class CTsResourceManager; -class CTsWindowGroupsMonitor; class MTsModel; class CTsRunningAppModel; class CTsStorage; @@ -57,7 +56,6 @@ private: TsEnv iEnv; CTsResourceManager* iResources; - CTsWindowGroupsMonitor* iMonitor; CTsSerializedDataProvider* iSerializer; CTsStorage* iStorage; CTsServiceProvider* iServiceProvider; diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsrunningappstorage.h --- a/taskswitcher/server/inc/tsrunningappstorage.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * 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 TSREUNNINGAPPSTORAGE_H -#define TSREUNNINGAPPSTORAGE_H - -#include "tswindowgroupsobserver.h" - -class CTsRunningApp; - -class CTsRunningAppStorage: public CBase, - public MTsRunningApplicationStorage -{ -public: - static CTsRunningAppStorage* NewLC(); - ~CTsRunningAppStorage(); - void HandleWindowGroupChanged( - MTsResourceManager &aResources, - const TArray & aWindowGroups ); - void HandleWindowGroupChanged( - MTsResourceManager &aResources, - const TArray& aWindowGroups, - const TArray& aFilteredWindowGroups); -public: - const MTsRunningApplication& operator[] (TInt aOffset) const; - TInt Count() const; - TInt ParentIndex( const MTsRunningApplication& aRunningApp ) const; - TArray BlockedWindowGroups() const; - -private: - TInt ParentIndex( TInt aOffset ) const; - TInt Find(TInt aWindowGroupId, TInt aOffset =0) const; - -private: - CTsRunningAppStorage(); - -private: - RPointerArray iRunningApps; - RArray iBlockedWindowGroups; -}; -#endif//TSREUNNINGAPPSTORAGE_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsrunningappstorageimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/inc/tsrunningappstorageimp.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,54 @@ +/* + * 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 TSREUNNINGAPPSTORAGEIMP_H +#define TSREUNNINGAPPSTORAGEIMP_H + +#include "tsrunningappstorage.h" +#include "tsrunningappimp.h" + +class CTsRunningAppStorage: public CBase, + public MTsRunningApplicationStorage +{ +public: + static CTsRunningAppStorage* NewLC(); + ~CTsRunningAppStorage(); + void HandleWindowGroupChanged( + MTsResourceManager &aResources, + const TArray & aWindowGroups ); + void HandleWindowGroupChanged( + MTsResourceManager &aResources, + const TArray& aWindowGroups, + const TArray& aFilteredWindowGroups); +public: + const MTsRunningApplication& operator[] (TInt aOffset) const; + TInt Count() const; + TInt ParentIndex( const MTsRunningApplication& aRunningApp ) const; + TArray BlockedWindowGroups() const; + +private: + TInt ParentIndex( TInt aOffset ) const; + TInt Find(TInt aWindowGroupId, TInt aOffset =0) const; + +private: + CTsRunningAppStorage(); + +private: + RPointerArray iRunningApps; + RArray iBlockedWindowGroups; + +}; +#endif//TSREUNNINGAPPSTORAGEIMP_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsscreenshotprovider.h --- a/taskswitcher/server/inc/tsscreenshotprovider.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/inc/tsscreenshotprovider.h Wed Oct 06 16:00:22 2010 +0300 @@ -16,9 +16,14 @@ */ #ifndef TSSCREENSHOTPROVIDER_H #define TSSCREENSHOTPROVIDER_H + +#include + #include "tsdatastorage.h" #include "tswindowgroupsobserver.h" -#include + +class MTsWindowGroupsMonitor; +class CTsIdList; class CTsScreenshotProvider: public CWsGraphic, public MTsWindowGroupsObserver @@ -36,6 +41,7 @@ private: CTsScreenshotProvider(MTsDataStorage&, MTsWindowGroupsMonitor&); + void ConstructL(); void HandleMessageL(const TDesC8&); void HandleWindowGroupChangedL( MTsResourceManager &aResources, const MTsRunningApplicationStorage& aStorage ); @@ -44,6 +50,7 @@ private: MTsDataStorage& iStorage; MTsWindowGroupsMonitor& iMonitor; + CTsIdList* iCache; }; #endif //TSSCREENSHOTTASK_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsservice.h --- a/taskswitcher/server/inc/tsservice.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/inc/tsservice.h Wed Oct 06 16:00:22 2010 +0300 @@ -24,13 +24,14 @@ class QObject; class TsAbstractModel; +class MTsResourceManager; class CTsService: public CBase, public MTsModel, public MTsDataObserver { public: - static CTsService* NewLC( QObject* model ); + static CTsService* NewLC( MTsResourceManager& aResources, QObject* model ); ~CTsService(); public: //from MTsDataObserver @@ -54,7 +55,7 @@ private: CTsService(); - void ConstructL( QObject* aModel ); + void ConstructL( MTsResourceManager& aResources, QObject* aModel ); TInt IntValueL( TInt aOffset, const char* aKey ) const; TTime TimeValueL( TInt aOffset, const char* aKey ) const; const TDesC& StringValueL( TInt aOffset, const char* aKey ) const; diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tsservicesprovider.h --- a/taskswitcher/server/inc/tsservicesprovider.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/inc/tsservicesprovider.h Wed Oct 06 16:00:22 2010 +0300 @@ -21,18 +21,21 @@ #include "tsservicesproviderconfig.h" class CTsService; +class MTsResourceManager; class CTsServiceProvider: public CBase { public: - static CTsServiceProvider* NewL( const CTsServiceProviderConfig& aConfig ); + static CTsServiceProvider* NewL( MTsResourceManager& aResources, + const CTsServiceProviderConfig& aConfig ); ~CTsServiceProvider(); MTsModel& operator[]( TInt aOffset ) const; TInt Count() const; private: CTsServiceProvider(); - void Construct( const CTsServiceProviderConfig& aConfig ); + void Construct( MTsResourceManager& aResources, + const CTsServiceProviderConfig& aConfig ); private: RPointerArray iServices; diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tswindowgroupsmonitor.h --- a/taskswitcher/server/inc/tswindowgroupsmonitor.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * 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 TSWINDOWGROUPMONITOR_H -#define TSWINDOWGROUPMONITOR_H - -#include "tswindowgroupsobserver.h" - -/** - * Window server monitor implementation. - */ -class CTsWindowGroupsMonitor: public CActive, - public MTsWindowGroupsMonitor - -{ -public: - /** - * Two phase constructor - */ - static CTsWindowGroupsMonitor* NewL(MTsResourceManager &); - - /** - * Destructor - */ - ~CTsWindowGroupsMonitor(); - - /** - * @see MTsWindowGroupsMonitor::SubscribeL - */ - void SubscribeL(MTsWindowGroupsObserver &); - - /** - * @see MTsWindowGroupsMonitor::Cancel - */ - void Cancel(MTsWindowGroupsObserver &); - -protected: - /** - * @see CActive::RunL - */ - void RunL(); - - /** - * @see CActive::DoCancel - */ - void DoCancel(); - - /** - * @see CActive::RunError - */ - TInt RunError(TInt error); - -private: - /** - * First phase constructor - */ - CTsWindowGroupsMonitor(MTsResourceManager &); - - /** - * Second phase constructor - */ - void ConstructL(); - - /** - * Function subscribe for event to window server and activate object - */ - void Subscribe(); - - /** - * Function provide window server event to observers - */ - void ProvideEventL(); - -private: - /** - * Registry of subscribed observers - */ - RPointerArray iObservers; - - /** - * Resources manager - */ - MTsResourceManager &iResources; - - /** - * Monitor window group - */ - RWindowGroup iWg; -}; -#endif//TSWINDOWGROUPMONITOR_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/inc/tswindowgroupsmonitorimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/inc/tswindowgroupsmonitorimp.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,103 @@ +/* + * 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 TSWINDOWGROUPMONITORIMP_H +#define TSWINDOWGROUPMONITORIMP_H + +#include "tswindowgroupsmonitor.h" + +/** + * Window server monitor implementation. + */ +class CTsWindowGroupsMonitor: public CActive, + public MTsWindowGroupsMonitor + +{ +public: + /** + * Two phase constructor + */ + static CTsWindowGroupsMonitor* NewL(MTsResourceManager &); + + /** + * Destructor + */ + ~CTsWindowGroupsMonitor(); + + /** + * @see MTsWindowGroupsMonitor::SubscribeL + */ + void SubscribeL(MTsWindowGroupsObserver &); + + /** + * @see MTsWindowGroupsMonitor::Cancel + */ + void Cancel(MTsWindowGroupsObserver &); + +protected: + /** + * @see CActive::RunL + */ + void RunL(); + + /** + * @see CActive::DoCancel + */ + void DoCancel(); + + /** + * @see CActive::RunError + */ + TInt RunError(TInt error); + +private: + /** + * First phase constructor + */ + CTsWindowGroupsMonitor(MTsResourceManager &); + + /** + * Second phase constructor + */ + void ConstructL(); + + /** + * Function subscribe for event to window server and activate object + */ + void Subscribe(); + + /** + * Function provide window server event to observers + */ + void ProvideEventL(); + +private: + /** + * Registry of subscribed observers + */ + RPointerArray iObservers; + + /** + * Resources manager + */ + MTsResourceManager& iResources; + + /** + * Monitor window group + */ + RWindowGroup iWg; +}; +#endif//TSWINDOWGROUPMONITORIMP_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/server.pro --- a/taskswitcher/server/server.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/server.pro Wed Oct 06 16:00:22 2010 +0300 @@ -49,17 +49,17 @@ src/tsservicesproviderconfig.cpp \ src/tsserviceobserver.cpp \ src/tsmodelitemkeymsg.cpp \ - src/tswindowgroupsmonitor.cpp \ - src/tsrunningapp.cpp \ - src/tsrunningappstorage.cpp \ + src/tswindowgroupsmonitorimp.cpp \ + src/tsrunningappimp.cpp \ + src/tsrunningappstorageimp.cpp \ + src/tsresourcemanagerimp.cpp \ ../utils/src/tsentrykey.cpp \ ../utils/src/tsentrykeygenerator.cpp \ ../utils/src/tsentry.cpp \ ../utils/src/tsscreenshotmsg.cpp \ ../utils/src/tsunregscreenshotmsg.cpp \ ../utils/src/tsvisibilitymsg.cpp \ - ../utils/src/tswindowgroupsobserver.cpp \ - ../utils/src/tsresourcemanager.cpp \ + ../utils/src/tswindowgroupsobserverbase.cpp \ ../utils/src/tsthumbnailprovider.cpp \ ../utils/src/tsidlist.cpp \ @@ -85,9 +85,10 @@ inc/tsservicesproviderconfig.h \ inc/tsserviceobserver.h \ inc/tsmodelitemkeymsg.h \ - inc/tswindowgroupsmonitor.h \ - inc/tsrunningapp.h \ - inc/tsrunningappstorage.h \ + inc/tswindowgroupsmonitorimp.h \ + inc/tsrunningappimp.h \ + inc/tsrunningappstorageimp.h \ + inc/tsresourcemanagerimp.h \ ../utils/inc/tsdataobserver.h \ ../utils/inc/tsentry.h \ ../utils/inc/tsentrykey.h \ @@ -96,8 +97,7 @@ ../utils/inc/tsscreenshotmsg.h \ ../utils/inc/tsunregscreenshotmsg.h \ ../utils/inc/tsvisibilitymsg.h \ - ../utils/inc/tsresourcemanager.h \ - ../utils/inc/tswindowgroupsobserver.h \ + ../utils/inc/tswindowgroupsobserverbase.h \ ../utils/inc/tsthumbnailprovider.h \ ../utils/inc/tsthumbnailobserver.h \ ../utils/inc/tsidlist.h \ @@ -119,3 +119,6 @@ TARGET.CAPABILITY = All -TCB } + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsdatalist.cpp --- a/taskswitcher/server/src/tsdatalist.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/src/tsdatalist.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -27,12 +27,16 @@ #include #include #include +#include #include "tsdatalist.h" #include "tsentrykeygenerator.h" #include "tsscreenshotmsg.h" #include "tsunregscreenshotmsg.h" #include "tsvisibilitymsg.h" +#include "tsresourcemanager.h" +#include "tsrunningapp.h" +#include "tsrunningappstorage.h" // size for the created app icons const TInt KAppIconWidth = 128; @@ -48,12 +52,10 @@ * Two-phased constructor. */ CTsDataList* CTsDataList::NewL( MTsResourceManager& aResources, - MTsWindowGroupsMonitor& aMonitor, MTsDataObserver& aObserver, TsEnv& aEnv ) { CTsDataList* self = new (ELeave) CTsDataList( aResources, - aMonitor, aObserver, aEnv); CleanupStack::PushL( self ); @@ -67,11 +69,10 @@ * Constructor. */ CTsDataList::CTsDataList(MTsResourceManager& aResources, - MTsWindowGroupsMonitor &aMonitor, MTsDataObserver& aObserver, TsEnv& aEnv) : - CTsWindowGroupsObserver( aMonitor ), + CTsWindowGroupsObserverBase( aResources.WsMonitor() ), iResources( aResources ), iObserver( aObserver ), iEnv( aEnv ) diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsresourcemanagerimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/src/tsresourcemanagerimp.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,77 @@ +/* + * 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 : + * + */ +#include "tsresourcemanagerimp.h" +#include "tswindowgroupsmonitorimp.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsResourceManager* CTsResourceManager::NewL() +{ + CTsResourceManager* self =new(ELeave) CTsResourceManager(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsResourceManager::ConstructL() +{ + User::LeaveIfError(mWsSession.Connect()); + User::LeaveIfError(mApaSeesion.Connect()); + iMonitor = CTsWindowGroupsMonitor::NewL(*this); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsResourceManager::~CTsResourceManager() +{ + delete iMonitor; + mApaSeesion.Close(); + mWsSession.Close(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +RWsSession& CTsResourceManager::WsSession() +{ + return mWsSession; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +RApaLsSession& CTsResourceManager::ApaSession() +{ + return mApaSeesion; +} + +// ----------------------------------------------------------------------------- +MTsWindowGroupsMonitor& CTsResourceManager::WsMonitor() + { + return *iMonitor; + } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsrunningapp.cpp --- a/taskswitcher/server/src/tsrunningapp.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* - * 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 : - * - */ - -#include -#include "tsrunningapp.h" - -//------------------------------------------------------------------------------ -CTsRunningApp* CTsRunningApp::NewLC( - MTsResourceManager& aResources, - const RWsSession::TWindowGroupChainInfo& aInfo ) - { - CTsRunningApp* self = new(ELeave) CTsRunningApp(aResources, aInfo); - CleanupStack::PushL( self ); - return self; - } - -//------------------------------------------------------------------------------ -CTsRunningApp::~CTsRunningApp() - { - delete iWindowGroupName; - } - -//------------------------------------------------------------------------------ -CTsRunningApp::CTsRunningApp( MTsResourceManager& aResources, - const RWsSession::TWindowGroupChainInfo& aInfo ) -: -iResources(aResources), -iWindowGroupInfo(aInfo) - { - //No implementation required - } - -//------------------------------------------------------------------------------ -const CApaWindowGroupName& CTsRunningApp::WindowGroupNameL() const - { - if( 0 == iWindowGroupName ) - { - iWindowGroupName = CApaWindowGroupName::NewL( iResources.WsSession(), - WindowGroupId() ); - } - return *iWindowGroupName; - } - -//------------------------------------------------------------------------------ -TUid CTsRunningApp::UidL()const - { - return WindowGroupNameL().AppUid(); - } - -//------------------------------------------------------------------------------ -const TDesC& CTsRunningApp::CaptionL() const - { - iCaption.Set(WindowGroupNameL().Caption()); - return iCaption; - - } - -//------------------------------------------------------------------------------ -TInt CTsRunningApp::WindowGroupId() const - { - return iWindowGroupInfo.iId; - } - -//------------------------------------------------------------------------------ -TInt CTsRunningApp::ParentWindowGroupId() const - { - return iWindowGroupInfo.iParentId; - } - -//------------------------------------------------------------------------------ -TBool CTsRunningApp::IsEmbeded() const - { - return 0 < iWindowGroupInfo.iParentId; - } - -//------------------------------------------------------------------------------ -TBool CTsRunningApp::IsHiddenL() const - { - return WindowGroupNameL().Hidden(); - } - -//------------------------------------------------------------------------------ -TBool CTsRunningApp::IsSystemL() const - { - return WindowGroupNameL().IsSystem(); - } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsrunningappimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/src/tsrunningappimp.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,102 @@ +/* + * 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 : + * + */ + +#include + +#include "tsrunningappimp.h" +#include "tsresourcemanager.h" + +//------------------------------------------------------------------------------ +CTsRunningApp* CTsRunningApp::NewLC( + MTsResourceManager& aResources, + const RWsSession::TWindowGroupChainInfo& aInfo ) + { + CTsRunningApp* self = new(ELeave) CTsRunningApp(aResources, aInfo); + CleanupStack::PushL( self ); + return self; + } + +//------------------------------------------------------------------------------ +CTsRunningApp::~CTsRunningApp() + { + delete iWindowGroupName; + } + +//------------------------------------------------------------------------------ +CTsRunningApp::CTsRunningApp( MTsResourceManager& aResources, + const RWsSession::TWindowGroupChainInfo& aInfo ) +: +iResources(aResources), +iWindowGroupInfo(aInfo) + { + //No implementation required + } + +//------------------------------------------------------------------------------ +const CApaWindowGroupName& CTsRunningApp::WindowGroupNameL() const + { + if( 0 == iWindowGroupName ) + { + iWindowGroupName = CApaWindowGroupName::NewL( iResources.WsSession(), + WindowGroupId() ); + } + return *iWindowGroupName; + } + +//------------------------------------------------------------------------------ +TUid CTsRunningApp::UidL()const + { + return WindowGroupNameL().AppUid(); + } + +//------------------------------------------------------------------------------ +const TDesC& CTsRunningApp::CaptionL() const + { + iCaption.Set(WindowGroupNameL().Caption()); + return iCaption; + + } + +//------------------------------------------------------------------------------ +TInt CTsRunningApp::WindowGroupId() const + { + return iWindowGroupInfo.iId; + } + +//------------------------------------------------------------------------------ +TInt CTsRunningApp::ParentWindowGroupId() const + { + return iWindowGroupInfo.iParentId; + } + +//------------------------------------------------------------------------------ +TBool CTsRunningApp::IsEmbeded() const + { + return 0 < iWindowGroupInfo.iParentId; + } + +//------------------------------------------------------------------------------ +TBool CTsRunningApp::IsHiddenL() const + { + return WindowGroupNameL().Hidden(); + } + +//------------------------------------------------------------------------------ +TBool CTsRunningApp::IsSystemL() const + { + return WindowGroupNameL().IsSystem(); + } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsrunningappmodel.cpp --- a/taskswitcher/server/src/tsrunningappmodel.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/src/tsrunningappmodel.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -20,29 +20,26 @@ #include #include "tsrunningappmodel.h" - -#include "tsrunningappstorage.h" - +#include "tsrunningappstorageimp.h" #include "tsdatalist.h" #include "tsmodelobserver.h" #include "tsscreenshotprovider.h" +#include "tsresourcemanager.h" CTsRunningAppModel *CTsRunningAppModel::NewL( MTsResourceManager& aResources, - MTsWindowGroupsMonitor& aMonitor, TsEnv& aEnv ) { - CTsRunningAppModel *self = CTsRunningAppModel::NewLC( aResources, aMonitor, aEnv ); + CTsRunningAppModel *self = CTsRunningAppModel::NewLC( aResources, aEnv ); CleanupStack::Pop( self ); return self; } CTsRunningAppModel *CTsRunningAppModel::NewLC( MTsResourceManager& aResources, - MTsWindowGroupsMonitor& aMonitor, TsEnv& aEnv ) { CTsRunningAppModel *self = new (ELeave) CTsRunningAppModel( aResources ); CleanupStack::PushL( self ); - self->ConstructL( aResources, aMonitor, aEnv ); + self->ConstructL( aResources, aEnv ); return self; } @@ -59,11 +56,11 @@ } void CTsRunningAppModel::ConstructL( MTsResourceManager& aResources, - MTsWindowGroupsMonitor& aMonitor, TsEnv& aEnv) { - iDataList = CTsDataList::NewL( aResources, aMonitor, *this, aEnv ); - iScreenshotProvider = CTsScreenshotProvider::NewL(*iDataList, aMonitor ); + iDataList = CTsDataList::NewL( aResources, *this, aEnv ); + iScreenshotProvider = + CTsScreenshotProvider::NewL(*iDataList, aResources.WsMonitor()); RArray wgList; CleanupClosePushL( wgList ); diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsrunningappserver.cpp --- a/taskswitcher/server/src/tsrunningappserver.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/src/tsrunningappserver.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -18,8 +18,9 @@ #include "tstaskmonitorglobals.h" #include "tsrunningappserver.h" #include "tsrunningappsession.h" +#include "tsresourcemanagerimp.h" #include "tsbacksteppingactivation.h" -#include "tswindowgroupsmonitor.h" +#include "tswindowgroupsmonitorimp.h" #include "tsmodel.h" #include "tsstorage.h" #include "tsservicesprovider.h" @@ -48,7 +49,6 @@ delete iAppsModel; delete iServiceProvider; delete iSerializer; - delete iMonitor; } // ----------------------------------------------------------------------------- @@ -71,18 +71,17 @@ { StartL(KRunningAppServerName); iResources = CTsResourceManager::NewL(); - iMonitor = CTsWindowGroupsMonitor::NewL(*iResources); iSerializer = CTsSerializedDataProvider::NewL(*this); RPointerArray providers; CleanupClosePushL(providers); - iAppsModel = CTsRunningAppModel::NewL(*iResources, *iMonitor, iEnv); + iAppsModel = CTsRunningAppModel::NewL(*iResources, iEnv); providers.AppendL(iAppsModel); CTsServiceProviderConfig *cfg = CTsServiceProviderConfig::NewLC(&iEnv); - iServiceProvider = CTsServiceProvider::NewL(*cfg); + iServiceProvider = CTsServiceProvider::NewL( *iResources, *cfg); CleanupStack::PopAndDestroy(cfg); addProviders(providers, *iServiceProvider); @@ -93,7 +92,7 @@ // load initial data iStorage->DataChanged(); - TRAP_IGNORE(iBacksteppingEngine = CTsBacksteppingActivation::NewL(*iMonitor);) + TRAP_IGNORE(iBacksteppingEngine = CTsBacksteppingActivation::NewL(iResources->WsMonitor());) } // ----------------------------------------------------------------------------- diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsrunningappstorage.cpp --- a/taskswitcher/server/src/tsrunningappstorage.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* - * 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 : - * - */ -#include "tsrunningappstorage.h" -#include "tsrunningapp.h" -//------------------------------------------------------------------------------ -CTsRunningAppStorage* CTsRunningAppStorage::NewLC() - { - CTsRunningAppStorage* self = new(ELeave) CTsRunningAppStorage(); - CleanupStack::PushL( self ); - return self; - } - -//------------------------------------------------------------------------------ -CTsRunningAppStorage::CTsRunningAppStorage() - { - //No implementation required - } - -//------------------------------------------------------------------------------ -CTsRunningAppStorage::~CTsRunningAppStorage() -{ - iRunningApps.ResetAndDestroy(); -} - -//------------------------------------------------------------------------------ -void CTsRunningAppStorage::HandleWindowGroupChanged( - MTsResourceManager &aResources, - const TArray & aWindowGroups ) - { - CTsRunningApp* app(0); - iRunningApps.ResetAndDestroy(); - iBlockedWindowGroups.Reset(); - TRAP_IGNORE( - for( TInt iter(0); iter < aWindowGroups.Count(); ++iter ) - { - app = CTsRunningApp::NewLC(aResources, aWindowGroups[iter]); - iRunningApps.AppendL(app); - CleanupStack::Pop(app); - } - )//TRAP_IGNORE - } - -//------------------------------------------------------------------------------ -void CTsRunningAppStorage::HandleWindowGroupChanged( - MTsResourceManager &aResources, - const TArray& aFull, - const TArray& aFiltered) - { - TInt filtered(0); - HandleWindowGroupChanged(aResources, aFiltered); - for(TInt full(0); full < aFull.Count(); ++full) - { - for(filtered = 0; filtered < aFiltered.Count(); ++filtered) - { - if(aFull[full].iId == aFiltered[ filtered].iId) - { - break; - } - } - if(aFiltered.Count() == filtered) - { - iBlockedWindowGroups.Append(aFull[full].iId); - } - } - } -//------------------------------------------------------------------------------ -const MTsRunningApplication& CTsRunningAppStorage::operator[] (TInt aOffset) const - { - return *iRunningApps[aOffset]; - } - -//------------------------------------------------------------------------------ -TInt CTsRunningAppStorage::Count() const - { - return iRunningApps.Count(); - } - -//------------------------------------------------------------------------------ -TInt CTsRunningAppStorage::ParentIndex( const MTsRunningApplication& aRunningApp ) const - { - const TInt applicationIndex(Find(aRunningApp.WindowGroupId())); - return KErrNotFound == applicationIndex ? - applicationIndex : ParentIndex(applicationIndex); - } - -//------------------------------------------------------------------------------ -TArray CTsRunningAppStorage::BlockedWindowGroups() const - { - return iBlockedWindowGroups.Array(); - } - -//------------------------------------------------------------------------------ -TInt CTsRunningAppStorage::ParentIndex( TInt aOffset ) const - { - TInt retval(aOffset); - if(iRunningApps[aOffset]->IsEmbeded()) - { - const TInt parentIndex( Find(iRunningApps[aOffset]->ParentWindowGroupId(), - aOffset + 1) ); - if( KErrNotFound != parentIndex ) - { - retval = ParentIndex( parentIndex ); - } - } - return retval; - } - -//------------------------------------------------------------------------------ -TInt CTsRunningAppStorage::Find(TInt aWindowGroupId, TInt aOffset) const - { - TInt retVal(KErrNotFound); - for( TInt iter(aOffset); - KErrNotFound == retVal && iter < iRunningApps.Count(); - ++iter ) - { - if( iRunningApps[iter]->WindowGroupId() == aWindowGroupId ) - { - retVal = iter; - } - } - return retVal; - } - - diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsrunningappstorageimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/src/tsrunningappstorageimp.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,137 @@ +/* + * 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 : + * + */ +#include "tsrunningappstorageimp.h" +//------------------------------------------------------------------------------ +CTsRunningAppStorage* CTsRunningAppStorage::NewLC() + { + CTsRunningAppStorage* self = new(ELeave) CTsRunningAppStorage(); + CleanupStack::PushL( self ); + return self; + } + +//------------------------------------------------------------------------------ +CTsRunningAppStorage::CTsRunningAppStorage() + { + //No implementation required + } + +//------------------------------------------------------------------------------ +CTsRunningAppStorage::~CTsRunningAppStorage() +{ + iRunningApps.ResetAndDestroy(); +} + +//------------------------------------------------------------------------------ +void CTsRunningAppStorage::HandleWindowGroupChanged( + MTsResourceManager &aResources, + const TArray & aWindowGroups ) + { + CTsRunningApp* app(0); + iRunningApps.ResetAndDestroy(); + iBlockedWindowGroups.Reset(); + TRAP_IGNORE( + for( TInt iter(0); iter < aWindowGroups.Count(); ++iter ) + { + app = CTsRunningApp::NewLC(aResources, aWindowGroups[iter]); + iRunningApps.AppendL(app); + CleanupStack::Pop(app); + } + )//TRAP_IGNORE + } + +//------------------------------------------------------------------------------ +void CTsRunningAppStorage::HandleWindowGroupChanged( + MTsResourceManager &aResources, + const TArray& aFull, + const TArray& aFiltered) + { + TInt filtered(0); + HandleWindowGroupChanged(aResources, aFiltered); + for(TInt full(0); full < aFull.Count(); ++full) + { + for(filtered = 0; filtered < aFiltered.Count(); ++filtered) + { + if(aFull[full].iId == aFiltered[ filtered].iId) + { + break; + } + } + if(aFiltered.Count() == filtered) + { + iBlockedWindowGroups.Append(aFull[full].iId); + } + } + } +//------------------------------------------------------------------------------ +const MTsRunningApplication& CTsRunningAppStorage::operator[] (TInt aOffset) const + { + return *iRunningApps[aOffset]; + } + +//------------------------------------------------------------------------------ +TInt CTsRunningAppStorage::Count() const + { + return iRunningApps.Count(); + } + +//------------------------------------------------------------------------------ +TInt CTsRunningAppStorage::ParentIndex( const MTsRunningApplication& aRunningApp ) const + { + const TInt applicationIndex(Find(aRunningApp.WindowGroupId())); + return KErrNotFound == applicationIndex ? + applicationIndex : ParentIndex(applicationIndex); + } + +//------------------------------------------------------------------------------ +TArray CTsRunningAppStorage::BlockedWindowGroups() const + { + return iBlockedWindowGroups.Array(); + } + +//------------------------------------------------------------------------------ +TInt CTsRunningAppStorage::ParentIndex( TInt aOffset ) const + { + TInt retval(aOffset); + if(iRunningApps[aOffset]->IsEmbeded()) + { + const TInt parentIndex( Find(iRunningApps[aOffset]->ParentWindowGroupId(), + aOffset + 1) ); + if( KErrNotFound != parentIndex ) + { + retval = ParentIndex( parentIndex ); + } + } + return retval; + } + +//------------------------------------------------------------------------------ +TInt CTsRunningAppStorage::Find(TInt aWindowGroupId, TInt aOffset) const + { + TInt retVal(KErrNotFound); + for( TInt iter(aOffset); + KErrNotFound == retVal && iter < iRunningApps.Count(); + ++iter ) + { + if( iRunningApps[iter]->WindowGroupId() == aWindowGroupId ) + { + retVal = iter; + } + } + return retVal; + } + + diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsscreenshotprovider.cpp --- a/taskswitcher/server/src/tsscreenshotprovider.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/src/tsscreenshotprovider.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -16,6 +16,9 @@ */ #include +#include "tswindowgroupsmonitor.h" +#include "tsrunningapp.h" +#include "tsrunningappstorage.h" #include "tsscreenshotprovider.h" #include "tstaskmonitorglobals.h" #include "tsscreenshotmsg.h" @@ -23,7 +26,8 @@ const TUid KPluginUID = {0x200267AE}; -const TInt KSkippedApp [] = {0x20022F35 /* <-- hsapplication */}; +const TInt KSkippedApp [] = {0x20022F35 /* <-- hsapplication */, + 0x100058F3 /* <-- sysapp*/}; // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -33,8 +37,7 @@ { CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(aStorage, aMonitor); CleanupStack::PushL( self ); - self->BaseConstructL(KPluginUID, KNullDesC8); - aMonitor.SubscribeL(*self); + self->ConstructL(); CleanupStack::Pop( self ); return self; } @@ -49,9 +52,19 @@ //No implementation required } +// ----------------------------------------------------------------------------- +void CTsScreenshotProvider::ConstructL() + { + BaseConstructL(KPluginUID, KNullDesC8); + iCache = CTsIdList::NewL(); + iMonitor.SubscribeL(*this); + } + +// ----------------------------------------------------------------------------- CTsScreenshotProvider::~CTsScreenshotProvider() { iMonitor.Cancel(*this); + delete iCache; } // ----------------------------------------------------------------------------- @@ -75,39 +88,40 @@ { const TInt count(sizeof( KSkippedApp ) / sizeof(TInt)); CTsIdList* list = CTsIdList::NewLC(); - list->AppendL(aStorage.BlockedWindowGroups());//filtered servers - for( TInt iter(0); iter < aStorage.Count(); ++iter ) + for( TInt allowed(0); allowed < aStorage.Count(); ++allowed ) { - if(aStorage[iter].IsHiddenL()) + if(!aStorage[allowed].IsHiddenL()) { - list->AppendL(aStorage[iter].WindowGroupId()); - } - else - { - for(TInt blocked(0); blocked < count; ++blocked) + TBool isBlocked(EFalse); + for( TInt blocked(0); !isBlocked && blocked < count; ++blocked ) { - if(aStorage[iter].UidL().iUid == KSkippedApp[blocked]) - { - list->AppendL(aStorage[iter].WindowGroupId()); - } + isBlocked = (KSkippedApp[blocked] == aStorage[allowed].UidL().iUid); + } + if(!isBlocked) + { + list->AppendL(aStorage[allowed].WindowGroupId()); } } } - - RBuf8 message; - CleanupClosePushL(message); - message.CreateL(list->Size() + sizeof(TInt)); - - RDesWriteStream stream; - CleanupClosePushL(stream); - stream.Open(message); - stream.WriteInt32L(IgnoreWindowGroups); - stream << (*list); - CleanupStack::PopAndDestroy(&stream); - - SendMessage(message); - CleanupStack::PopAndDestroy(&message); - CleanupStack::PopAndDestroy(list); + if( *iCache != *list ) + { + RBuf8 message; + CleanupClosePushL(message); + message.CreateL(list->Size() + sizeof(TInt)); + + RDesWriteStream stream; + CleanupClosePushL(stream); + stream.Open(message); + stream.WriteInt32L(AllowedWindowGroups); + stream << (*list); + CleanupStack::PopAndDestroy(&stream); + + SendMessage(message); + CleanupStack::PopAndDestroy(&message); + } + delete iCache; + iCache = list; + CleanupStack::Pop(list); } // ----------------------------------------------------------------------------- diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsservice.cpp --- a/taskswitcher/server/src/tsservice.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/src/tsservice.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -23,6 +23,8 @@ #include "tsservice.h" #include "tsmodelobserver.h" #include "tsserviceobserver.h" +#include "tsresourcemanager.h" + // ----------------------------------------------------------------------------- LOCAL_C QVariantHash valueL( QObject *aModel, TInt aOffset ) @@ -40,11 +42,11 @@ } // ----------------------------------------------------------------------------- -CTsService* CTsService::NewLC(QObject* model) +CTsService* CTsService::NewLC(MTsResourceManager& resources, QObject* model) { CTsService *self = new (ELeave)CTsService(); CleanupStack::PushL(self); - self->ConstructL(model); + self->ConstructL(resources, model); return self; } @@ -55,7 +57,7 @@ } // ----------------------------------------------------------------------------- -void CTsService::ConstructL( QObject* model ) +void CTsService::ConstructL( MTsResourceManager& resources, QObject* model ) { iModel = model; User::LeaveIfNull(iModel); @@ -67,6 +69,9 @@ SIGNAL(dataChanged()), iServiceObserver, SLOT(dataChanged())); + QMetaObject::invokeMethod(iModel, + "setResources", + Q_ARG(MTsResourceManager&, resources)); } // ----------------------------------------------------------------------------- @@ -146,7 +151,9 @@ // ----------------------------------------------------------------------------- TBool CTsService::IsMandatoryL( TInt aOffset ) const { - return IntValueL(aOffset, "TaskIsMandatory" ); + const QVariantHash values(valueL(iModel, aOffset)); + const QString key("TaskIsMandatory"); + return values.contains(key) ? values.value(key).toInt() : ETrue; } // ----------------------------------------------------------------------------- diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tsservicesprovider.cpp --- a/taskswitcher/server/src/tsservicesprovider.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/server/src/tsservicesprovider.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -24,10 +24,11 @@ * @return address to initialized services provider instance */ CTsServiceProvider* CTsServiceProvider::NewL( + MTsResourceManager& aResources, const CTsServiceProviderConfig& aConfig ) { CTsServiceProvider* self = new (ELeave)CTsServiceProvider(); - self->Construct( aConfig ); + self->Construct( aResources, aConfig ); return self; } @@ -46,12 +47,13 @@ * @param aConfig - serivces provider configurator * */ -void CTsServiceProvider::Construct( const CTsServiceProviderConfig& aConfig ) +void CTsServiceProvider::Construct( MTsResourceManager& aResources, + const CTsServiceProviderConfig& aConfig ) { CTsService* srvPtr(0); for( TInt iter(0); iter < aConfig.Count(); ++iter ) { - TRAP_IGNORE( srvPtr = CTsService::NewLC( aConfig.LoadL( iter ) ); + TRAP_IGNORE( srvPtr = CTsService::NewLC(aResources, aConfig.LoadL( iter ) ); iServices.AppendL( srvPtr ); CleanupStack::Pop( srvPtr ); ) } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tswindowgroupsmonitor.cpp --- a/taskswitcher/server/src/tswindowgroupsmonitor.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/* - * 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 : - * - */ -#include -#include "tswindowgroupsobserver.h" -#include "tswindowgroupsmonitor.h" -#include "tsrunningappstorage.h" - - -const int KOrdinalPositionNoZOrder(-1); -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CTsWindowGroupsMonitor* CTsWindowGroupsMonitor::NewL(MTsResourceManager &resources) -{ - CTsWindowGroupsMonitor* self = new (ELeave) CTsWindowGroupsMonitor(resources); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CTsWindowGroupsMonitor::CTsWindowGroupsMonitor(MTsResourceManager &resources) -: - CActive(EPriorityStandard), - iResources(resources) -{ - CActiveScheduler::Add(this); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsMonitor::ConstructL() -{ - - // Initial window group - iWg = RWindowGroup (iResources.WsSession()); - User::LeaveIfError (iWg.Construct ((TUint32)&iWg, EFalse)); - iWg.SetOrdinalPosition (KOrdinalPositionNoZOrder); - iWg.EnableReceiptOfFocus (EFalse); - - // Hide window - CApaWindowGroupName* wn = CApaWindowGroupName::NewLC(iResources.WsSession()); - wn->SetHidden (ETrue); - wn->SetWindowGroupName (iWg); - CleanupStack::PopAndDestroy (wn); - - // Window group change event - User::LeaveIfError (iWg.EnableGroupListChangeEvents()); - Subscribe(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CTsWindowGroupsMonitor::~CTsWindowGroupsMonitor() -{ - CActive::Cancel(); - iWg.Close(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsMonitor::SubscribeL(MTsWindowGroupsObserver &observer) -{ - const TInt offset(iObservers.Find(&observer)); - KErrNotFound == offset ? iObservers.InsertL(&observer, 0) : - User::Leave(KErrAlreadyExists); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsMonitor::Cancel(MTsWindowGroupsObserver & observer) -{ - const TInt offset(iObservers.Find(&observer)); - if (KErrNotFound != offset) { - iObservers.Remove(offset); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsMonitor::RunL() -{ - User::LeaveIfError(iStatus.Int()); - ProvideEventL(); - Subscribe(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsMonitor::DoCancel() -{ - if (IsActive()) { - iResources.WsSession().EventReadyCancel(); - } -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TInt CTsWindowGroupsMonitor::RunError(TInt error) -{ - if (!IsActive() && KErrCancel != error) { - Subscribe(); - } - return KErrNone; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsMonitor::Subscribe() -{ - iResources.WsSession().EventReady( &iStatus ); - SetActive(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsMonitor::ProvideEventL() -{ - TWsEvent wsEvent; - iResources.WsSession().GetEvent(wsEvent); - if( EEventWindowGroupListChanged == wsEvent.Type() ) - { - - CTsRunningAppStorage *storage = CTsRunningAppStorage::NewLC(); - - RArray filteredWgInfo, fullWgInfo; - CleanupClosePushL(filteredWgInfo); - CleanupClosePushL(fullWgInfo); - User::LeaveIfError(iResources.WsSession().WindowGroupList(0, &filteredWgInfo)); - User::LeaveIfError(iResources.WsSession().WindowGroupList(&fullWgInfo)); - storage->HandleWindowGroupChanged(iResources, - fullWgInfo.Array(), - filteredWgInfo.Array()); - CleanupStack::PopAndDestroy( &fullWgInfo ); - CleanupStack::PopAndDestroy( &filteredWgInfo ); - - for( TInt iter(0); iter < iObservers.Count(); ++iter ) - { - iObservers[iter]->HandleWindowGroupChanged( iResources, *storage ); - } - CleanupStack::PopAndDestroy( storage ); - - } -} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/server/src/tswindowgroupsmonitorimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/server/src/tswindowgroupsmonitorimp.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,182 @@ +/* + * 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 : + * + */ +#include + +#include "tswindowgroupsmonitorimp.h" +#include "tsrunningappstorageimp.h" +#include "tsresourcemanager.h" + + +const int KOrdinalPositionNoZOrder(-1); +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsWindowGroupsMonitor* CTsWindowGroupsMonitor::NewL(MTsResourceManager &resources) +{ + CTsWindowGroupsMonitor* self = new (ELeave) CTsWindowGroupsMonitor(resources); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsWindowGroupsMonitor::CTsWindowGroupsMonitor(MTsResourceManager &resources) +: + CActive(EPriorityStandard), + iResources(resources) +{ + CActiveScheduler::Add(this); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsWindowGroupsMonitor::ConstructL() +{ + + // Initial window group + iWg = RWindowGroup (iResources.WsSession()); + User::LeaveIfError (iWg.Construct ((TUint32)&iWg, EFalse)); + iWg.SetOrdinalPosition (KOrdinalPositionNoZOrder); + iWg.EnableReceiptOfFocus (EFalse); + + // Hide window + CApaWindowGroupName* wn = CApaWindowGroupName::NewLC(iResources.WsSession()); + wn->SetHidden (ETrue); + wn->SetWindowGroupName (iWg); + CleanupStack::PopAndDestroy (wn); + + // Window group change event + User::LeaveIfError (iWg.EnableGroupListChangeEvents()); + Subscribe(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsWindowGroupsMonitor::~CTsWindowGroupsMonitor() +{ + CActive::Cancel(); + iWg.Close(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsWindowGroupsMonitor::SubscribeL(MTsWindowGroupsObserver &observer) +{ + const TInt offset(iObservers.Find(&observer)); + KErrNotFound == offset ? iObservers.InsertL(&observer, 0) : + User::Leave(KErrAlreadyExists); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsWindowGroupsMonitor::Cancel(MTsWindowGroupsObserver & observer) +{ + const TInt offset(iObservers.Find(&observer)); + if (KErrNotFound != offset) { + iObservers.Remove(offset); + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsWindowGroupsMonitor::RunL() +{ + User::LeaveIfError(iStatus.Int()); + ProvideEventL(); + Subscribe(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsWindowGroupsMonitor::DoCancel() +{ + if (IsActive()) { + iResources.WsSession().EventReadyCancel(); + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TInt CTsWindowGroupsMonitor::RunError(TInt error) +{ + if (!IsActive() && KErrCancel != error) { + Subscribe(); + } + return KErrNone; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsWindowGroupsMonitor::Subscribe() +{ + iResources.WsSession().EventReady( &iStatus ); + SetActive(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsWindowGroupsMonitor::ProvideEventL() +{ + TWsEvent wsEvent; + iResources.WsSession().GetEvent(wsEvent); + if( EEventWindowGroupListChanged == wsEvent.Type() ) + { + + CTsRunningAppStorage *storage = CTsRunningAppStorage::NewLC(); + + RArray filteredWgInfo, fullWgInfo; + CleanupClosePushL(filteredWgInfo); + CleanupClosePushL(fullWgInfo); + User::LeaveIfError(iResources.WsSession().WindowGroupList(0, &filteredWgInfo)); + User::LeaveIfError(iResources.WsSession().WindowGroupList(&fullWgInfo)); + storage->HandleWindowGroupChanged(iResources, + fullWgInfo.Array(), + filteredWgInfo.Array()); + CleanupStack::PopAndDestroy( &fullWgInfo ); + CleanupStack::PopAndDestroy( &filteredWgInfo ); + + for( TInt iter(0); iter < iObservers.Count(); ++iter ) + { + iObservers[iter]->HandleWindowGroupChanged( iResources, *storage ); + } + CleanupStack::PopAndDestroy( storage ); + + } +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/sis/stubs/taskmonitor_stub.pkg --- a/taskswitcher/sis/stubs/taskmonitor_stub.pkg Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/sis/stubs/taskmonitor_stub.pkg Wed Oct 06 16:00:22 2010 +0300 @@ -41,3 +41,7 @@ "" - "Z:\sys\bin\activitytsplugin.dll" "" - "Z:\resource\qt\plugins\activitytsplugin.qtplugin" "" - "Z:\resource\taskswitcher\activitytsplugin.xml" + +""-"Z:\resource\qt\translations\taskswitcher.qm" +""-"Z:\sys\bin\tsdevicedialogplugin.dll" +""-"Z:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin" diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/sis/stubs/taskmonitor_stub.sis Binary file taskswitcher/sis/stubs/taskmonitor_stub.sis has changed diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/sis/taskmonitor.pkg --- a/taskswitcher/sis/taskmonitor.pkg Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/sis/taskmonitor.pkg Wed Oct 06 16:00:22 2010 +0300 @@ -36,3 +36,7 @@ "/epoc32/release/armv5/urel/activitytsplugin.dll" - "!:\sys\bin\activitytsplugin.dll" "/epoc32/data/z/resource/qt/plugins/activitytsplugin.qtplugin" - "!:\resource\qt\plugins\activitytsplugin.qtplugin" "/epoc32/data/z/resource/taskswitcher/activitytsplugin.xml" - "!:\resource\taskswitcher\activitytsplugin.xml" + +"/epoc32/data/z/resource/qt/translations/taskswitcher.qm"-"!:\resource\qt\translations\taskswitcher.qm" +"/epoc32/release/armv5/urel/tsdevicedialogplugin.dll"-"!:\sys\bin\tsdevicedialogplugin.dll" +"/epoc32/data/z/resource/plugins/devicedialogs/tsdevicedialogplugin.qtplugin"-"!:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin" diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/taskswitcher.pro --- a/taskswitcher/taskswitcher.pro Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/taskswitcher.pro Wed Oct 06 16:00:22 2010 +0300 @@ -23,6 +23,7 @@ server \ screenshotplugin \ activitytsplugin \ + tsdevicedialogplugin \ BLD_INF_RULES.prj_exports += "inc/tstaskmonitorglobals.h |../inc/tstaskmonitorglobals.h" diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/conf/tsdevicedialog.confml Binary file taskswitcher/tsdevicedialogplugin/conf/tsdevicedialog.confml has changed diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/conf/tsdevicedialog_2002677F.crml Binary file taskswitcher/tsdevicedialogplugin/conf/tsdevicedialog_2002677F.crml has changed diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tsdataroles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tsdataroles.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,28 @@ +/* +* 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 TSDATAROLES_H +#define TSDATAROLES_H + +namespace TsDataRoles +{ + enum EntryAttributes { + Closable = Qt::UserRole + 1, + Active, + }; +} + +#endif // TSDATAROLES_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,66 @@ +/* +* 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 TSDEVICEDIALOGCONTAINER_H +#define TSDEVICEDIALOGCONTAINER_H + +#include +#include +#include +#include + +#include "tsdocumentloader.h" + +QTM_USE_NAMESPACE + +class QAbstractListModel; + +class TsDeviceDialogContainer : public QObject, + public HbDeviceDialogInterface +{ + Q_OBJECT +public: + explicit TsDeviceDialogContainer(QAbstractListModel *model, + QObject *parent = 0); + ~TsDeviceDialogContainer(); + +public: + virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); + virtual int deviceDialogError() const; + virtual void closeDeviceDialog(bool byClient); + virtual HbPopup *deviceDialogWidget() const; + virtual QObject *signalSender() const; + +signals: + void deviceDialogClosed(); + +public slots: + void changeOrientation(Qt::Orientation orientation); + +private slots: + void notifyDialogClosed(); + void switchViewOnModelChange(); + void handleDismissRequest(); + +private: + TsDocumentLoader mLoader; + QValueSpacePublisher mVisibilityPublisher; + QValueSpaceSubscriber mDismissRequestSubscriber; + + Q_DISABLE_COPY(TsDeviceDialogContainer) +}; + +#endif // TSDEVICEDIALOGCONTAINER_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tsdevicedialogplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tsdevicedialogplugin.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,60 @@ +/* +* 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 TSDEVICEDIALOGPLUGIN_H +#define TSDEVICEDIALOGPLUGIN_H + +#include + +#include + +#include "tsdocumentloader.h" + +class QAbstractListModel; +class TsTaskMonitor; + +class TsDeviceDialogPlugin : public HbDeviceDialogPlugin +{ + Q_OBJECT + +public: + TsDeviceDialogPlugin(); + ~TsDeviceDialogPlugin(); + + bool accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, + const QVariantMap &securityInfo) const; + HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, + const QVariantMap ¶meters); + bool deviceDialogInfo(const QString &deviceDialogType, + const QVariantMap ¶meters, + DeviceDialogInfo *info) const; + QStringList deviceDialogTypes() const; + PluginFlags pluginFlags() const; + int error() const; + +private: + TsDocumentLoader mLoader; + QAbstractListModel *mModel; + TsTaskMonitor *mStorage; + + bool mTriedToLoadTranslation; + + Q_DISABLE_COPY(TsDeviceDialogPlugin) +}; + +#endif // TSDEVICEDIALOGPLUGIN_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tsdocumentloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tsdocumentloader.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,32 @@ +/* +* 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: Screensaver custom document loader. +* +*/ + +#ifndef TSDOCUMENTLOADER_H +#define TSDOCUMENTLOADER_H + +#include + +class TsDocumentLoader : public HbDocumentLoader +{ + +private: + virtual QObject *createObject(const QString &type, + const QString &name); + +}; + +#endif // TSDOCUMENTLOADER_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tsentrymodelitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tsentrymodelitem.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,43 @@ +/* +* 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: tsentrymodelitem.h +* +*/ + +#ifndef TSENTRYMODELITEM_H +#define TSENTRYMODELITEM_H + +#include "tsmodelitem.h" + +#include + +class TsTask; + +/*! + Class implements model item which represents Content Arsenal entry +*/ +class TsEntryModelItem : public TsModelItem +{ +public: + TsEntryModelItem(QSharedPointer entry); + ~TsEntryModelItem(); + QVariant data(int role) const; + void close(); + void open(); + +private: + const QSharedPointer mEntry; +}; + +#endif // TSMODEL_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tsmodel.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,75 @@ +/* +* 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: tsmodel.h +* +*/ + +#ifndef TSMODEL_H +#define TSMODEL_H + +#include +#include +#include +#include + +#include + +class CaNotifier; +class TsModelItem; + +class TsModel : public QAbstractListModel +{ + Q_OBJECT + +public: + TsModel(TsTaskMonitor &applicationSrv, + QObject *parent = 0); + ~TsModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, + int role = Qt::DisplayRole) const; + // from QAbstractModel + virtual bool insertRows(int row, int count, TsModelItem *item, + const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, + const QModelIndex &parent = QModelIndex()); + + + bool moveRows(int oldPosition, int newPosition, + const QModelIndex &parent = QModelIndex()); + bool updateRows(int row, TsModelItem *item); + void fullUpdate(); + +public slots: + void openApplication(const QModelIndex &index); + void closeApplication(const QModelIndex &index); + void updateApplications(); + +private: + TsModelItem *entry(const QModelIndex &index) const; + void getApplications(); + +private: + /* + * List containing result + */ + QList mEntries; + + TsTaskMonitor &mApplicationService; + + Q_DISABLE_COPY(TsModel) +}; + +#endif // TSMODEL_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tsmodelitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tsmodelitem.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,46 @@ +/* +* 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: tsmodelitem.h +* +*/ +#ifndef TSMODELITEM_H +#define TSMODELITEM_H + +#include +#include + +#include "tsmodelitem.h" + +class TsTask; + +/*! + Abstract class which define model item for taskswitcher +*/ +class TsModelItem +{ + +public: + TsModelItem(QSharedPointer entry); + ~TsModelItem(); + QVariant data(int role) const; + void close(); + void open(); + +private: + const QSharedPointer mEntry; + Q_DISABLE_COPY(TsModelItem) + +}; + +#endif // TSMODELITEM_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tstasksgrid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tstasksgrid.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,34 @@ +/* +* 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 TSTASKSGRID_H +#define TSTASKSGRID_H + +#include + +class TsTasksGrid : public HbGridView +{ + Q_OBJECT + +signals: + void deleteButtonClicked(const QModelIndex &index); + +protected: + virtual void polish(HbStyleParameters ¶ms); + +}; + +#endif // TSTASKSGRID_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/inc/tstasksgriditem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/inc/tstasksgriditem.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,54 @@ +/* +* 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 TSTASKSGRIDITEM_H +#define TSTASKSGRIDITEM_H + +#include + +class HbTextItem; +class HbIconItem; +class HbFrameItem; +class HbPushButton; + +class TsTasksGridItem : public HbAbstractViewItem +{ + Q_OBJECT + +public: + TsTasksGridItem(); + TsTasksGridItem(const TsTasksGridItem &item); + + HbAbstractViewItem *createItem(); + void updateChildItems(); + +private slots: + void handleDeleteClicked(); + +signals: + void deleteClicked(const QModelIndex &index); + +private: + HbIconItem *mScreenshotLabel; + HbTextItem *mApplicationNameLabel; + HbPushButton *mDeleteButton; + + HbFrameItem *mActiveLabelFrame; + HbTextItem *mActiveLabel; + +}; + +#endif //TSTASKSGRIDITEM_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/resource/hbdialog.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/resource/hbdialog.css Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,14 @@ +HbDialog#tsdevicedialog::heading { + left: 0un; + right: 0un; + top: 0un; + bottom: 0un; + fixed-height: expr(var(hb-param-text-height-primary)+2*var(hb-param-margin-gene-popup)); +} + +HbDialog#tsdevicedialog::content { + left: -0.25un; + right: 0.25un; + bottom: 0un; + top: 0un; +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/resource/layout.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/resource/layout.docml Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + +
+
diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/resource/tstasksgriditem.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/resource/tstasksgriditem.css Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,53 @@ +TsTasksGridItem { + layout:custom; +} + +TsTasksGridItem::appname { + text-align: center; + color: var(qtc_default_main_pane_normal); + font-variant: secondary; + text-height: var(hb-param-text-height-tiny); + text-wrap-mode: no-wrap; +} + +TsTasksGridItem > HbPushButton#closebadge { + min-width: 7un; + min-height: 7un; +} + +TsTasksGridItem::screenshotFrame { + zvalue: -1; +} + +TsTasksGridItem > HbPushButton#closebadge::toucharea { + left: 1un; + right: -1un; + top: 1un; + bottom: -1un; +} + +TsTasksGridItem > HbPushButton#closebadge::icon { + max-width: var(hb-param-graphic-size-primary-small); + max-height: var(hb-param-graphic-size-primary-small); +} + +TsTasksGridItem::screenshot { + alignment: center; +} + +TsTasksGridItem::activeLabel { + text-align: center; + color: var(qtc_multimedia_trans_normal); + text-height: var(hb-param-text-height-tiny); + font-variant: secondary; + + zvalue: 2; + + /* workaround for mesh layout limitations */ + max-height: 4un; + min-height: 4un; +} + +TsTasksGridItem::activeLabelFrame { + zvalue: 1; +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/resource/tstasksgriditem.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/resource/tstasksgriditem.widgetml Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,196 @@ +/* +* 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: +* +*/ + +#include "tsdevicedialogcontainer.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "tstasksgrid.h" +#include "tstasksgriditem.h" + +namespace +{ + const char KDocmlPath[] = ":/resource/layout.docml"; +} + +TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, + QObject *parent) + : + QObject(parent), + mVisibilityPublisher(TsProperty::KTsPath), + mDismissRequestSubscriber(QString("%1/%2").arg(TsProperty::KTsPath).arg(TsProperty::KDismissRequestPath)) +{ + bool ok(true); + mLoader.load(KDocmlPath, &ok); + Q_ASSERT(ok); + + HbDialog *dialog = + qobject_cast(mLoader.findWidget("tsdevicedialog")); + TsTasksGrid *grid = + qobject_cast(mLoader.findWidget("taskgrid")); + Q_ASSERT(dialog); + Q_ASSERT(grid); + + bool cssLoaded = HbStyleLoader::registerFilePath(":/resource/hbdialog.css"); + Q_ASSERT(cssLoaded); + { + HbLabel *dialogHeading = qobject_cast(dialog->headingWidget()); + Q_ASSERT(dialogHeading); + HbFrameDrawer *headingFrame = new HbFrameDrawer(QLatin1String("qtg_fr_popup_heading"), HbFrameDrawer::ThreePiecesHorizontal); + dialogHeading->setBackgroundItem(new HbFrameItem(headingFrame)); + } + + grid->setEnabledAnimations(HbAbstractItemView::None); + grid->setModel(model); + + changeOrientation(dialog->mainWindow()->orientation()); + switchViewOnModelChange(); + + // needed because of Qt::QueuedConnection used below + // @todo: check if we actually need queued connections + qRegisterMetaType("QModelIndex"); + + // connect the grid and model + connect(grid, + SIGNAL(activated(QModelIndex)), + model, + SLOT(openApplication(QModelIndex))); + connect(grid, + SIGNAL(activated(QModelIndex)), + dialog, + SLOT(close())); + connect(grid, + SIGNAL(deleteButtonClicked(QModelIndex)), + model, SLOT(closeApplication(QModelIndex)), + Qt::QueuedConnection); + + connect(dialog->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(changeOrientation(Qt::Orientation))); + connect(dialog, + SIGNAL(aboutToClose()), + this, + SIGNAL(deviceDialogClosed())); + + // switch between grid and "no items" label when model is updated + connect(model, SIGNAL(modelReset()), this, SLOT(switchViewOnModelChange())); + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange())); + connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange())); + + connect(this, + SIGNAL(deviceDialogClosed()), + this, + SLOT(notifyDialogClosed())); + mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, + static_cast(true)); + mVisibilityPublisher.sync(); + + connect(&mDismissRequestSubscriber, + SIGNAL(contentsChanged()), + this, + SLOT(handleDismissRequest())); +} + +TsDeviceDialogContainer::~TsDeviceDialogContainer() +{ + delete deviceDialogWidget(); +} + +bool TsDeviceDialogContainer::setDeviceDialogParameters( + const QVariantMap ¶meters) +{ + Q_UNUSED(parameters); + return false; +} + +int TsDeviceDialogContainer::deviceDialogError() const +{ + return 0; +} + +void TsDeviceDialogContainer::closeDeviceDialog(bool byClient) +{ + Q_UNUSED(byClient) + // @todo: should there be hide calls? deviceDialogWidget->hide(); + emit deviceDialogClosed(); +} + +HbPopup *TsDeviceDialogContainer::deviceDialogWidget() const +{ + HbDialog *widget = + qobject_cast(mLoader.findWidget("tsdevicedialog")); + Q_ASSERT(widget); + return widget; +} + +QObject *TsDeviceDialogContainer::signalSender() const +{ + return const_cast(this); +} + +void TsDeviceDialogContainer::changeOrientation(Qt::Orientation orientation) +{ + bool ok(true); + if (orientation == Qt::Horizontal) { + mLoader.load(KDocmlPath, "landscape", &ok); + } else { + mLoader.load(KDocmlPath, "portrait", &ok); + } + Q_ASSERT(ok); +} + +void TsDeviceDialogContainer::notifyDialogClosed() +{ + mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, + static_cast(false)); + mVisibilityPublisher.sync(); +} + +void TsDeviceDialogContainer::switchViewOnModelChange() +{ + TsTasksGrid *grid = + qobject_cast(mLoader.findWidget("taskgrid")); + HbWidget *noItemsWidget = + qobject_cast(mLoader.findWidget("noitemswidget")); + Q_ASSERT(grid); + Q_ASSERT(noItemsWidget); + + if (grid->model() && grid->model()->rowCount()) { + noItemsWidget->hide(); + grid->show(); + } else { + noItemsWidget->show(); + grid->hide(); + } +} + +void TsDeviceDialogContainer::handleDismissRequest() +{ + if (mDismissRequestSubscriber.value().toBool()) { + emit deviceDialogClosed(); + } +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,193 @@ +/* +* 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: +* +*/ + +#include "tsdevicedialogplugin.h" + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include "tsdevicedialogcontainer.h" +#include "tstasksgrid.h" +#include "tstasksgriditem.h" +#include "tsdocumentloader.h" +#include "tsmodel.h" + +QTM_USE_NAMESPACE + +/*! + \class TsDeviceDialogPlugin + \ingroup group_tsdevicedialogplugin + \brief TaskSwitcher Device Dialog Plug-in. + */ + +namespace +{ + const char KTranslationPath[] = "resource/qt/translations"; + const char KTsDialogType[] = "com.nokia.taskswitcher.tsdevicedialogplugin/1.0"; +} + +/*! + Constructor. + */ +TsDeviceDialogPlugin::TsDeviceDialogPlugin() + : + mModel(0), + mStorage(0), + mTriedToLoadTranslation(false) +{ + // ensure the visibility property is set to false, so the TaskSwitcher + // in case when hbdevicedialogappserver crashes when TS is visible. + QValueSpacePublisher visibilityPublisher(TsProperty::KTsPath); + visibilityPublisher.setValue(TsProperty::KVisibilityPath, static_cast(false)); + visibilityPublisher.sync(); +} + +TsDeviceDialogPlugin::~TsDeviceDialogPlugin() +{ +} +/*! + \reimp + */ +bool TsDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, + const QVariantMap &securityInfo) const +{ + Q_UNUSED(deviceDialogType) + Q_UNUSED(parameters) + Q_UNUSED(securityInfo) + + // This plugin doesn't perform operations that may compromise security. + // All clients are allowed to use it. + return true; +} + +/*! + \reimp + */ +HbDeviceDialogInterface * +TsDeviceDialogPlugin::createDeviceDialog(const QString &deviceDialogType, + const QVariantMap ¶meters) +{ + Q_UNUSED(parameters) + HbDeviceDialogInterface *dialogInterface(0); + if (deviceDialogType == QString(KTsDialogType)) { + // lazy loading of translation + if (!mTriedToLoadTranslation) { + mTriedToLoadTranslation = true; + + QTranslator *translator = new QTranslator(this); + QString translationFile = + QString("taskswitcher_%1").arg(QLocale::system().name()); + + bool translationLoaded(false); +#ifdef Q_OS_SYMBIAN + translationLoaded = + translator->load(translationFile, + QString("z:/") + KTranslationPath); + if (!translationLoaded) { + translationLoaded = + translator->load(translationFile, + QString("c:/") + KTranslationPath); + } +#else + translationLoaded = + translator->load(translationFile, + QString(KTranslationPath)); +#endif //Q_OS_SYMBIAN + + Q_ASSERT(translationLoaded); + qApp->installTranslator(translator); + } + + // lazy loading of model + if (!mModel) { + mStorage = new TsTaskMonitor(this); + mModel = new TsModel(*mStorage, this); + } + + // ensure the dismiss request property is set to false + + QValueSpacePublisher dismissRequestPublisher(TsProperty::KTsPath); + dismissRequestPublisher.setValue(TsProperty::KDismissRequestPath, static_cast(false)); + dismissRequestPublisher.sync(); + + + // create device dialog + dialogInterface = new TsDeviceDialogContainer(mModel); + } + return dialogInterface; +} + +/*! + \reimp + */ +bool TsDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, + const QVariantMap ¶meters, + DeviceDialogInfo *info) const +{ + Q_UNUSED(parameters) + Q_UNUSED(deviceDialogType) + + info->group = GenericDeviceDialogGroup; + info->flags = SingleInstance; + info->priority = DefaultPriority; + + return true; +} + +/*! + \reimp + */ +QStringList TsDeviceDialogPlugin::deviceDialogTypes() const +{ + return QStringList(QString(KTsDialogType)); +} + +/*! + \reimp + */ +HbDeviceDialogPlugin::PluginFlags TsDeviceDialogPlugin::pluginFlags() const +{ + return PluginFlags(PreloadPlugin | KeepPluginLoaded); +} + +/*! + \reimp + */ +int TsDeviceDialogPlugin::error() const +{ + return 0; +} + +#ifdef COVERAGE_MEASUREMENT +#pragma CTC SKIP +#endif //COVERAGE_MEASUREMENT + +Q_EXPORT_PLUGIN2(tsdevicedialogplugin, TsDeviceDialogPlugin) + +#ifdef COVERAGE_MEASUREMENT +#pragma CTC ENDSKIP +#endif //COVERAGE_MEASUREMENT diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/src/tsdocumentloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/src/tsdocumentloader.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,44 @@ +/* +* 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: Screensaver custom document loader. +* +*/ + +#include "tsdocumentloader.h" +#include "tstasksgrid.h" +#include "tstasksgriditem.h" + +/*! + \class TsDocumentLoader + \ingroup group_tsdevicedialogplugin + \brief Document loader. + + TS implementation of document loader. It is creating TS objects used in UI +*/ + +QObject *TsDocumentLoader::createObject(const QString &type, + const QString &name) +{ + if (type == TsTasksGrid::staticMetaObject.className()) { + QObject *object = new TsTasksGrid(); + object->setObjectName(name); + return object; + } else if (type == TsTasksGridItem::staticMetaObject.className()) { + QObject *object = new TsTasksGridItem(); + object->setObjectName(name); + return object; + } + + return HbDocumentLoader::createObject(type, name); +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/src/tsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/src/tsmodel.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,216 @@ +/* +* 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: tsmodel.cpp +* +*/ +#include "tsmodel.h" + +#include +#include + +#include + +#include + +#include "tsmodelitem.h" +#include "tsdataroles.h" +#include "tstaskchangeinfo.h" + +/*! + \class TsModel + \ingroup group_tsdevicedialogplugin + \brief Model storing running tasks. +*/ + +/*! + Constructor + \param query used to create model + \param pointer to parent object +*/ +TsModel::TsModel(TsTaskMonitor &applicationSrv, QObject *parent) : + QAbstractListModel(parent), + mEntries(), + mApplicationService(applicationSrv) +{ + connect(&applicationSrv, + SIGNAL(taskListChanged()), + this, + SLOT(updateApplications())); + + fullUpdate(); +} + +/*! + Destructor +*/ +TsModel::~TsModel() +{ + qDeleteAll(mEntries); +} + +/*! + Returns count of rows in model + \retval number of rows +*/ +int TsModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mEntries.count(); +} + +bool TsModel::insertRows(int row, int count, TsModelItem *item, const QModelIndex &parent) +{ + beginInsertRows(parent, row, row+count-1); + mEntries.insert(row, item); + endInsertRows(); + return true; +} + +bool TsModel::removeRows(int row, int count, const QModelIndex &parent) +{ + TsModelItem *oldItem = mEntries.at(row); + beginRemoveRows(parent, row, row + count - 1); + mEntries.removeAt(row); + delete oldItem; + endRemoveRows(); + return true; +} + + +bool TsModel::moveRows(int oldPosition, int newPosition, const QModelIndex &parent) +{ + beginMoveRows(parent, oldPosition, oldPosition, parent, newPosition); + mEntries.move(oldPosition, newPosition); + endMoveRows(); + return true; +} + + +bool TsModel::updateRows(int row, TsModelItem *item) +{ + TsModelItem *oldItem = mEntries.at(row); + mEntries[row] = item; + delete oldItem; + + emit dataChanged(index(row),index(row)); + return true; +} + +/*! + Returns appropiate model's data + \param index model index + \param role which data role to return + \retval models data +*/ +QVariant TsModel::data(const QModelIndex &index, int role) const +{ + return index.isValid() ? entry(index)->data(role) : QVariant(); +} + +/*! + Activate one of model entries +*/ +void TsModel::openApplication(const QModelIndex &index) +{ + if (!index.isValid()) { + return; + } + entry(index)->open(); +} + +/*! + Close one of moder entries +*/ +void TsModel::closeApplication(const QModelIndex &index) +{ + if (!index.isValid() || + !entry(index)->data(TsDataRoles::Closable).toBool()) { + return; + } + entry(index)->close(); +} + +/*! + Updates model with fresh entries +*/ +void TsModel::updateApplications() +{ + QList changes(mApplicationService.changeList()); + + if (changes.count() == 0) { + return; + } + //check 1st item whether we have cancel change - if so reset model + if (changes[0].first.changeType() == TsTaskChangeInfo::EChangeCancel) { + fullUpdate(); + return; + } + for (int iter(0); iter < changes.count(); iter++) { + switch (changes[iter].first.changeType()) { + case TsTaskChangeInfo::EChangeDelete : + removeRows(changes[iter].first.oldOffset(), 1); + break; + case TsTaskChangeInfo::EChangeInsert : + insertRows(changes[iter].first.newOffset(), 1, + new TsModelItem(changes[iter].second)); + break; + case TsTaskChangeInfo::EChangeMove : + moveRows(changes[iter].first.oldOffset(), changes[iter].first.newOffset()); + break; + case TsTaskChangeInfo::EChangeUpdate : + updateRows(changes[iter].first.oldOffset(), + new TsModelItem(changes[iter].second)); + break; + default: + break; + } + } +} + +/*! + reset model +*/ +void TsModel::fullUpdate() +{ + beginResetModel(); + qDeleteAll(mEntries); + mEntries.clear(); + getApplications(); + endResetModel(); + +} + +/*! + Read list of running applications +*/ +void TsModel::getApplications() +{ + //get all running applications and append to entries list + QList tasks(mApplicationService.changeList(true)); + foreach(TsTaskChange taskData, tasks) { + if (!taskData.second.isNull()) { + mEntries.append(new TsModelItem(taskData.second)); + } + } +} + +/*! + Returns an entry from model + \param index of entry in model + \retval pointer to an entry +*/ +TsModelItem *TsModel::entry(const QModelIndex &index) const +{ + return mEntries.at(index.row()); +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/src/tsmodelitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/src/tsmodelitem.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,84 @@ +/* +* 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: tsmodelitem.cpp +* +*/ + +#include "tsmodelitem.h" + +#include + +#include + +#include "tsdataroles.h" + +/*! + \class TsModelItem + \ingroup group_tsdevicedialogplugin + \brief Item presenting running apps in the grid. +*/ + +/*! + Standard C++ constructor + /param entry - Task Monitor data +*/ +TsModelItem::TsModelItem(QSharedPointer entry) + : mEntry(entry) +{ + //no implementation required +} + +/*! + Standard C++ destructor +*/ +TsModelItem::~TsModelItem() +{ +} + +/*! + Returns the data stored under the given role. + /param role - requested data role + /return data encapulated by QVariant +*/ +QVariant TsModelItem::data(int role) const +{ + switch (role) { + case Qt::DisplayRole: + return QVariant(mEntry->name()); + case Qt::DecorationRole: + return QVariant::fromValue(HbIcon(mEntry->screenshot())); + case TsDataRoles::Closable: + return QVariant(mEntry->isClosable()); + case TsDataRoles::Active: + return QVariant(mEntry->isActive()); + default: + return QVariant(QVariant::Invalid); + } +} + +/*! + Close running application repesented by entry +*/ +void TsModelItem::close() +{ + mEntry->close(); +} + +/*! + Open or move to foreground application repesented by entry +*/ +void TsModelItem::open() +{ + mEntry->open(); +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/src/tstasksgrid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/src/tstasksgrid.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,28 @@ +/* +* 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: +* +*/ + +#include "tstasksgrid.h" + +void TsTasksGrid::polish(HbStyleParameters ¶ms) +{ + HbGridView::polish(params); + + // center second item when dialog is shown + if (model()) { + scrollTo(model()->index(1, 0), PositionAtCenter); + } +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/src/tstasksgriditem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/src/tstasksgriditem.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,112 @@ +/* +* 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: +* +*/ +#include "tstasksgriditem.h" + +#include +#include +#include +#include +#include +#include + +#include "tsdataroles.h" + +/*! + \class TsTasksGridItem + \ingroup group_tsdevicedialogplugin + \brief Item that should be presented in grid. +*/ + +TsTasksGridItem::TsTasksGridItem() + : + HbAbstractViewItem(), + mScreenshotLabel(0), + mApplicationNameLabel(0), + mDeleteButton(0), + mActiveLabelFrame(0), + mActiveLabel(0) +{ + // Register the custom docml and css to provide our own style to the list items + bool widgetmlLoaded = + HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.widgetml"); + Q_ASSERT(widgetmlLoaded); + bool cssLoaded = + HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.css"); + Q_ASSERT(cssLoaded); +} + +TsTasksGridItem::TsTasksGridItem(const TsTasksGridItem &item) : HbAbstractViewItem(item) +{ + mScreenshotLabel = new HbIconItem(this); + mApplicationNameLabel = new HbTextItem(this); + mDeleteButton = new HbPushButton(this); + HbFrameItem *screenshotFrame = new HbFrameItem(this); + screenshotFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); + screenshotFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); + + mActiveLabel = new HbTextItem(hbTrId("txt_ts_label_active"), this); + mActiveLabelFrame = new HbFrameItem(this); + mActiveLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); + mActiveLabelFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); + + mDeleteButton->setIcon(HbIcon("qtg_mono_exit")); + + HbStyle::setItemName(mScreenshotLabel, "screenshot"); + HbStyle::setItemName(mApplicationNameLabel, "appname"); + HbStyle::setItemName(mDeleteButton, "closebadge"); + mDeleteButton->setObjectName("closebadge"); + HbStyle::setItemName(screenshotFrame, "screenshotFrame"); + HbStyle::setItemName(mActiveLabel, "activeLabel"); + HbStyle::setItemName(mActiveLabelFrame, "activeLabelFrame"); + connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(handleDeleteClicked())); +} + +HbAbstractViewItem *TsTasksGridItem::createItem() +{ + TsTasksGridItem *newItem = new TsTasksGridItem(*this); + connect(newItem, SIGNAL(deleteClicked(QModelIndex)), itemView(), SIGNAL(deleteButtonClicked(QModelIndex))); + return newItem; +} + +void TsTasksGridItem::handleDeleteClicked() +{ + emit deleteClicked(modelIndex()); +} + +void TsTasksGridItem::updateChildItems() +{ + mScreenshotLabel->setIcon(modelIndex().data(Qt::DecorationRole).value()); + mApplicationNameLabel->setText(modelIndex().data(Qt::DisplayRole).toString()); + + QVariant closableData(modelIndex().data(TsDataRoles::Closable)); + const bool isClosable(closableData.isValid() && closableData.toBool()); + if (isClosable) { + mDeleteButton->show(); + } else { + mDeleteButton->hide(); + } + + QVariant activeData(modelIndex().data(TsDataRoles::Active)); + const bool isActive(activeData.isValid() && activeData.toBool()); + if (isActive) { + mActiveLabel->show(); + mActiveLabelFrame->show(); + } else { + mActiveLabel->hide(); + mActiveLabelFrame->hide(); + } +} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/tsdevicedialogplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/tsdevicedialogplugin.pro Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,70 @@ +# +# 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: tsdevicedialogplugin.pro +# + +TEMPLATE = lib +CONFIG += hb plugin mobility +MOBILITY = publishsubscribe + +HEADERS += inc/tsdevicedialogcontainer.h \ + inc/tsdevicedialogplugin.h \ + inc/tsmodel.h \ + inc/tsmodelitem.h \ + inc/tstasksgrid.h \ + inc/tstasksgriditem.h \ + inc/tsdocumentloader.h \ + inc/tsdataroles.h \ + +SOURCES += src/tsdevicedialogcontainer.cpp \ + src/tsdevicedialogplugin.cpp \ + src/tsmodel.cpp \ + src/tsmodelitem.cpp \ + src/tstasksgrid.cpp \ + src/tstasksgriditem.cpp \ + src/tsdocumentloader.cpp \ + +INCLUDEPATH += . \ + ./inc \ + ../../inc \ + +LIBS += -ltstaskmonitorclient + +TRANSLATIONS = taskswitcher.ts + +RESOURCES += tsdevicedialogplugin.qrc + +DOCML += resource/layout.docml + +symbian { + TARGET.CAPABILITY = CAP_ECOM_PLUGIN + TARGET.EPOCALLOWDLLDATA=1 + TARGET.UID3 = 0x2002677F + pluginstub.sources = tsdevicedialogplugin.dll + pluginstub.path = /resource/plugins/devicedialogs + DEPLOYMENT += pluginstub + + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "conf/tsdevicedialog.confml APP_LAYER_CONFML(tsdevicedialog.confml)" \ + "conf/tsdevicedialog_2002677F.crml APP_LAYER_CRML(tsdevicedialog_2002677F.crml)" +} + +win32 { + include ($$[QMAKE_MKSPECS]/features/hb_install.prf) + DESTDIR = $$HB_PLUGINS_DIR/devicedialogs +} + + +symbian:MMP_RULES += SMPSAFE diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/tsdevicedialogplugin/tsdevicedialogplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/tsdevicedialogplugin/tsdevicedialogplugin.qrc Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,8 @@ + + + resource/layout.docml.bin + resource/tstasksgriditem.widgetml + resource/tstasksgriditem.css + resource/hbdialog.css + + diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tsentry.h --- a/taskswitcher/utils/inc/tsentry.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/inc/tsentry.h Wed Oct 06 16:00:22 2010 +0300 @@ -70,8 +70,9 @@ private: CTsEntry(const TTsEntryKey &aKey, MTsDataObserver &observer); void ConstructL(QObject* object); -public: - void thumbnailCreated(const CFbsBitmap& aThumbnail); + +public://from MTsThumbnailObserver + void ThumbnailCreated(const CFbsBitmap& aThumbnail); private: TUid mAppUid; diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tsidlist.h --- a/taskswitcher/utils/inc/tsidlist.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/inc/tsidlist.h Wed Oct 06 16:00:22 2010 +0300 @@ -34,6 +34,8 @@ TInt Size() const; void ExternalizeL(RWriteStream &aStream) const; void InternalizeL(RReadStream &aStream); + TBool operator ==( const CTsIdList& aList) const; + TBool operator !=( const CTsIdList& aList) const; private: CTsIdList(); diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tsresourcemanager.h --- a/taskswitcher/utils/inc/tsresourcemanager.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/inc/tsresourcemanager.h Wed Oct 06 16:00:22 2010 +0300 @@ -17,16 +17,15 @@ #ifndef TSRESOURCEMANAGER_H #define TSRESOURCEMANAGER_H -#include -#include -#include -#include +class RApaLsSession; +class RWsSession; +class MTsWindowGroupsMonitor; /** - * Interface decalre methods to access initialized OS resources + * Interface declare methods to access initialized OS resources */ class MTsResourceManager -{ + { public: /** * Access to initialized window server session @@ -37,46 +36,10 @@ * Access to initilaized APA session */ virtual RApaLsSession& ApaSession() =0; -}; - -/** - * Resource manager implemetatioin - */ -class CTsResourceManager: public CBase, - public MTsResourceManager -{ -public: - /** - * Two phase constructor - */ - static CTsResourceManager* NewL(); - - /** - * Destructor - */ - ~CTsResourceManager(); /** - * @see MTsResourceManager::WsSession - */ - RWsSession& WsSession(); - - /** - * @see MTsResourceManager::ApaSession + * Access to window groups monitor */ - RApaLsSession& ApaSession(); - -private: - /** - * Second phase constructor - */ - void ConstructL(); - -private: - RWsSession mWsSession; - RApaLsSession mApaSeesion; -}; - - - + virtual MTsWindowGroupsMonitor& WsMonitor() =0; + }; #endif // TSRESOURCEMANAGER_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tsrunningapp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/utils/inc/tsrunningapp.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,71 @@ +/* + * 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 TSRUNNINGAPPLICATION_H +#define TSRUNNINGAPPLICATION_H + +#include + +/** + * Abstract interface of container with data to describe running application + */ +class MTsRunningApplication + { +public: + /** + * Provide access to application unique identifier + * @return running application identyfier + */ + virtual TUid UidL()const =0; + + /** + * Provide access to application caption + * @return running application caption + */ + virtual const TDesC& CaptionL() const =0; + + /** + * Provide information if application is hidden from application library + * @return EFalse if it's not hidden, other values it is. + */ + virtual TBool IsHiddenL() const =0; + + /** + * Provide information if application is required by the system and should be closed + * @return EFalse if it's not system, other values it is. + */ + virtual TBool IsSystemL() const =0; + + /** + * Provide access to process window group identifier + * @return process window group identyfier + */ + virtual TInt WindowGroupId() const =0; + + /** + * Provide access to "parent" application window group identifier if entry is embeded application + * @return parent application window group id + */ + virtual TInt ParentWindowGroupId() const =0; + + /** + * Provide information if application is running embeded-mode + * @return EFalse if application isn't embeded, other values it is + */ + virtual TBool IsEmbeded() const =0; + + }; +#endif //TSRUNNINGAPPLICATION_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tsrunningappstorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/utils/inc/tsrunningappstorage.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,56 @@ +/* + * 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 TSRUNNINGAPPLICATIONSTORAGE_H +#define TSRUNNINGAPPLICATIONSTORAGE_H + +#include +class MTsRunningApplication; + +/** + * Abstract interface of container with running applications desctiptors + */ +class MTsRunningApplicationStorage + { +public: + /** + * Provide access to running applications + * @param aOffset - index of running application + * @return running application entry + */ + virtual const MTsRunningApplication& operator[] ( TInt aOffset ) const=0; + + /** + * Provide information about number of running applications + * @return number of running applications + */ + virtual TInt Count() const =0; + + /** + * @param aRunningApp embeded application entry + * @return index of parent of embeded application + */ + virtual TInt ParentIndex( const MTsRunningApplication& aRunningApp ) const =0; + + /** + * Provide access to windows groups that were blocked( servers, applications without UI ) + * @return list of blocked window groups + */ + virtual TArray BlockedWindowGroups() const =0; + + }; + +#endif //TSRUNNINGAPPLICATIONSTORAGE_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tsthumbnailobserver.h --- a/taskswitcher/utils/inc/tsthumbnailobserver.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/inc/tsthumbnailobserver.h Wed Oct 06 16:00:22 2010 +0300 @@ -20,9 +20,12 @@ class CFbsBitmap; class MTsThumbnailObserver -{ + { public: - virtual void thumbnailCreated(const CFbsBitmap& aThumbnail) =0; - -}; + /** + * + */ + virtual void ThumbnailCreated(const CFbsBitmap& aThumbnail) =0; + + }; #endif //TSTHUMBNAILOBSERVER_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tswindowgroupsmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/utils/inc/tswindowgroupsmonitor.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,41 @@ +/* + * 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 TSWINDOWGROUPSMONITOR_H +#define TSWINDOWGROUPSMONITOR_H + +#include "tswindowgroupsobserver.h" + +/** + * Interface declare methods to subscribe window server events + */ +class MTsWindowGroupsMonitor +{ +public: + /** + * Method make subscription for window server events + * @param aObserver - events observer + */ + virtual void SubscribeL(MTsWindowGroupsObserver & aObserver) =0; + + /** + * Method cancel subscription for window server events + * @param aObserver - events observer + */ + virtual void Cancel(MTsWindowGroupsObserver & aObserver) =0; +}; + +#endif //TSWINDOWGROUPSMONITOR_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tswindowgroupsobserver.h --- a/taskswitcher/utils/inc/tswindowgroupsobserver.h Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/inc/tswindowgroupsobserver.h Wed Oct 06 16:00:22 2010 +0300 @@ -17,95 +17,22 @@ #ifndef TSWINDOWGROUPSOBSERVER_H #define TSWINDOWGROUPSOBSERVER_H -#include "tsresourcemanager.h" - -class MTsRunningApplication - { -public: - virtual TUid UidL()const =0; - virtual const TDesC& CaptionL() const =0; - virtual TBool IsHiddenL() const =0; - virtual TBool IsSystemL() const =0; - virtual TInt WindowGroupId() const =0; - virtual TInt ParentWindowGroupId() const =0; - virtual TBool IsEmbeded() const =0; - - - }; - -class MTsRunningApplicationStorage - { -public: - virtual const MTsRunningApplication& operator[] (TInt aOffset) const=0; - virtual TInt Count() const =0; - virtual TInt ParentIndex( const MTsRunningApplication& aRaunningApp ) const =0; - virtual TArray BlockedWindowGroups() const =0; - - }; - +class MTsResourceManager; +class MTsRunningApplicationStorage; /** * Interface declare mathods to notify about window server events */ class MTsWindowGroupsObserver -{ + { public: /** * Method notify about window group changes. * @param aResources - resource manager * @param aStorage - list of running applications */ - virtual void HandleWindowGroupChanged(MTsResourceManager &aResources, - const MTsRunningApplicationStorage& aStorage) =0; -}; - -/** - * Interface declare methods to subscribe windo server events - */ -class MTsWindowGroupsMonitor -{ -public: - /** - * Method make subscription for window server events - * @param observer - events observer - */ - virtual void SubscribeL(MTsWindowGroupsObserver & observer) =0; - - /** - * Method cancel subscription for window server events - * @param observer - events observer - */ - virtual void Cancel(MTsWindowGroupsObserver &) =0; -}; - -/** - * Window server observer implementation. Class automaticly subscribe / cancel subscription - * at construction / destruction level. - * - */ -class CTsWindowGroupsObserver: public CBase, - public MTsWindowGroupsObserver -{ -public: - /** - * Destructor - * Function automaticly cancel subscrption to window server events - */ - ~CTsWindowGroupsObserver(); - -protected: - /** - * First phase constructor - */ - CTsWindowGroupsObserver(MTsWindowGroupsMonitor &); - - /** - * Second phase constructor. - * Function automaticly subscribe window server events - */ - void BaseConstructL(); - -private: - MTsWindowGroupsMonitor & mMonitor; -}; + virtual void HandleWindowGroupChanged( + MTsResourceManager& aResources, + const MTsRunningApplicationStorage& aStorage) =0; + }; #endif //TSWINDOWGROUPSOBSERVER_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/inc/tswindowgroupsobserverbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/utils/inc/tswindowgroupsobserverbase.h Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,45 @@ +/* + * 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 TSWINDOWGROUPSOBSERVERBASE_H +#define TSWINDOWGROUPSOBSERVERBASE_H + +#include + +#include "tswindowgroupsobserver.h" +#include "tswindowgroupsmonitor.h" + +/** + * Window server observer implementation. Class automaticly subscribe / cancel subscription + * at construction / destruction level. + * + */ +class CTsWindowGroupsObserverBase: public CBase, + public MTsWindowGroupsObserver + { +public: + ~CTsWindowGroupsObserverBase(); + +protected: + CTsWindowGroupsObserverBase( MTsWindowGroupsMonitor & aMonitor); + void BaseConstructL(); + +private: + MTsWindowGroupsMonitor & iMonitor; + + }; + +#endif //TSWINDOWGROUPSOBSERVERBASE_H diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/src/tsentry.cpp --- a/taskswitcher/utils/src/tsentry.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/src/tsentry.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -265,15 +265,16 @@ } // -------------------------------------------------------------------------- -// CTsFswEntry::thumbnailCreated -// -------------------------------------------------------------------------- -// -void CTsEntry::thumbnailCreated(const CFbsBitmap& aThumbnail) -{ +/** + * Interface implementation + * @see MTsThumbnailObserver::ThumbnailCreated( const CFbsBitmap& ) + */ +void CTsEntry::ThumbnailCreated(const CFbsBitmap& aThumbnail) + { mScreenshot->Reset(); mScreenshot->Duplicate(aThumbnail.Handle()); RefreshUpdateTimestamp(); mObserver.DataChanged(); -} + } // end of file diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/src/tsentrykeygenerator.cpp --- a/taskswitcher/utils/src/tsentrykeygenerator.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/src/tsentrykeygenerator.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -15,6 +15,8 @@ * */ #include "tsentrykeygenerator.h" +#include "tsrunningapp.h" +#include "tsrunningappstorage.h" // ----------------------------------------------------------------------------- // diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/src/tsidlist.cpp --- a/taskswitcher/utils/src/tsidlist.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/src/tsidlist.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -118,3 +118,18 @@ } } +//------------------------------------------------------------------------------ +TBool CTsIdList::operator ==( const CTsIdList& aList) const + { + TBool retVal(aList.iIds.Count() == iIds.Count()); + for( TInt offset(0); retVal && offset < iIds.Count(); ++offset ) + { + retVal = (KErrNotFound != aList.iIds.Find(iIds[offset])); + } + return retVal; + } +//------------------------------------------------------------------------------ +TBool CTsIdList::operator !=( const CTsIdList& aList) const + { + return !(*this ==aList); + } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/src/tsresourcemanager.cpp --- a/taskswitcher/utils/src/tsresourcemanager.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - * 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 : - * - */ -#include "tswindowgroupsobserver.h" -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CTsResourceManager* CTsResourceManager::NewL() -{ - CTsResourceManager* self =new(ELeave) CTsResourceManager(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsResourceManager::ConstructL() -{ - User::LeaveIfError(mWsSession.Connect()); - User::LeaveIfError(mApaSeesion.Connect()); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CTsResourceManager::~CTsResourceManager() -{ - mApaSeesion.Close(); - mWsSession.Close(); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -RWsSession& CTsResourceManager::WsSession() -{ - return mWsSession; -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -RApaLsSession& CTsResourceManager::ApaSession() -{ - return mApaSeesion; -} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/src/tsthumbnailprovider.cpp --- a/taskswitcher/utils/src/tsthumbnailprovider.cpp Mon Sep 27 11:31:59 2010 +0300 +++ b/taskswitcher/utils/src/tsthumbnailprovider.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -17,6 +17,11 @@ #include #include "tsthumbnailprovider.h" //------------------------------------------------------------------------------ +/** + * Constructor - initialize provider instance + * @param observer - thumnail observer + * @param obj - object which request and receive new thumnails using signal/slot interface + */ TsThumbnailProvider::TsThumbnailProvider(MTsThumbnailObserver& observer, QObject* obj) : mObserver(observer) @@ -32,6 +37,9 @@ SLOT(thumbnailCreated(QPixmap, const void*))); } //------------------------------------------------------------------------------ +/** + * Function create interface for Symbian clients. + */ void TsThumbnailProvider::createThumbnail(CFbsBitmap& source, int angle) { emit createThumbnail(QPixmap::fromSymbianCFbsBitmap(&source), @@ -40,6 +48,9 @@ } //------------------------------------------------------------------------------ +/** + * Retrieve requests done by Symbian interface and forward results to observer + */ void TsThumbnailProvider::thumbnailCreated(const QPixmap& thumbnail, const void *userData) { @@ -48,7 +59,7 @@ } CFbsBitmap *bitmap(thumbnail.toSymbianCFbsBitmap()); if(0 != bitmap) { - mObserver.thumbnailCreated(*bitmap); + mObserver.ThumbnailCreated(*bitmap); } delete bitmap; } diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/src/tswindowgroupsobserver.cpp --- a/taskswitcher/utils/src/tswindowgroupsobserver.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * 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 : - * - */ -#include "tswindowgroupsobserver.h" -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CTsWindowGroupsObserver::CTsWindowGroupsObserver(MTsWindowGroupsMonitor & monitor) -: - mMonitor(monitor) -{} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CTsWindowGroupsObserver::BaseConstructL() -{ - mMonitor.SubscribeL(*this); -} - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -CTsWindowGroupsObserver::~CTsWindowGroupsObserver() -{ - mMonitor.Cancel(*this); -} diff -r d1dadafc5584 -r 26079c1bb561 taskswitcher/utils/src/tswindowgroupsobserverbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/utils/src/tswindowgroupsobserverbase.cpp Wed Oct 06 16:00:22 2010 +0300 @@ -0,0 +1,47 @@ +/* + * 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 : + * + */ +#include "tswindowgroupsobserverbase.h" + +// ----------------------------------------------------------------------------- +/** + * First phase constructor + */ +CTsWindowGroupsObserverBase::CTsWindowGroupsObserverBase( + MTsWindowGroupsMonitor & aMonitor) +: + iMonitor(aMonitor) +{} + +// ----------------------------------------------------------------------------- +/** + * Second phase constructor. + * Function automaticly subscribe window server events + */ +void CTsWindowGroupsObserverBase::BaseConstructL() +{ + iMonitor.SubscribeL(*this); +} + +// ----------------------------------------------------------------------------- +/** + * Destructor + * Function automaticly cancel subscrption to window server events + */ +CTsWindowGroupsObserverBase::~CTsWindowGroupsObserverBase() +{ + iMonitor.Cancel(*this); +} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/common.pri --- a/tsdevicedialog/common.pri Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -# -# 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: taskswitcherapp project - common QMake settings -# - -CONFIG += debug_and_release - -# On win32 and mac, debug and release libraries are named differently. -# We must follow the debug and release settings Qt was compiled with: -# build debug iff Qt built debug, build release iff Qt built release. -win32|mac { - !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { - CONFIG -= debug_and_release debug release - contains(QT_CONFIG,debug): CONFIG+=debug - contains(QT_CONFIG,release):CONFIG+=release - } -} - -CONFIG(debug, debug|release) { - SUBDIRPART = debug -} else { - SUBDIRPART = release -} - -win32: OUTPUT_DIR = $$PWD/../../bin/$$SUBDIRPART -symbian: OUTPUT_DIR = $$PWD/bin - -#test whether we have a unit test -!testcase { - OBJECTS_DIR = $$OUTPUT_DIR/tmp/$$TARGET - DESTDIR = $$OUTPUT_DIR - MOC_DIR = $$OUTPUT_DIR/tmp/$$TARGET/moc - RCC_DIR = $$OUTPUT_DIR/tmp/$$TARGET/rcc - UI_DIR = $$OUTPUT_DIR/tmp/$$TARGET/ui -} else { # test part is NOT DONE - QT *= testlib - CONFIG += console - CONFIG -= app_bundle - OBJECTS_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET - DESTDIR = $$OUTPUT_DIR - MOC_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/moc - RCC_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/rcc - UI_DIR = $$OUTPUT_DIR/tests/tmp/$$TARGET/ui - coverage { - DEFINES += COVERAGE_MEASUREMENT - DEFINES += QT_NO_DEBUG # omit ASSERTS in coverage measurements - } -} - -# Add the output dirs to the link path too -LIBS += -L$$DESTDIR - -#For some reason the default include path doesn't include MOC_DIR on symbian -symbian { - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - INCLUDEPATH += $$MOC_DIR - TARGET.CAPABILITY = ALL -TCB - TARGET.EPOCALLOWDLLDATA=1 -} - -win32 { - # add platfrom API for windows - INCLUDEPATH += \ - $$PWD/../../homescreensrv/homescreensrv_plat/contentstorage_api -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/rom.pri --- a/tsdevicedialog/rom.pri Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -# -# 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: -# - -BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " -BLD_INF_RULES.prj_exports += "rom/tsdevicedialog_core.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tsdevicedialog_core.iby)" -BLD_INF_RULES.prj_exports += "rom/tsdevicedialog_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(tsdevicedialog_resources.iby)" -BLD_INF_RULES.prj_exports += "./sis/stubs/taskswitcher_stub.sis /epoc32/release/winscw/udeb/z/system/install/taskswitcher_stub.sis" -BLD_INF_RULES.prj_exports += "./sis/stubs/taskswitcher_stub.sis /epoc32/data/z/system/install/taskswitcher_stub.sis" \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/rom/tsdevicedialog_core.iby --- a/tsdevicedialog/rom/tsdevicedialog_core.iby Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* 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 __TSDEVICEDIALOG_CORE_IBY__ -#define __TSDEVICEDIALOG_CORE_IBY__ - -file=ABI_DIR\BUILD_DIR\tsdevicedialogplugin.dll SHARED_LIB_DIR\tsdevicedialogplugin.dll -data=\epoc32\data\z\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin - -// stub sis -data=ZSYSTEM/install/taskswitcher_stub.sis system/install/taskswitcher_stub.sis - -// qcrml -data=\epoc32\data\z\resource\qt\crml\tsdevicedialog.qcrml resource\qt\crml\tsdevicedialog.qcrml - -#endif //__TSAPP_CORE_IBY__ diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/rom/tsdevicedialog_resources.iby --- a/tsdevicedialog/rom/tsdevicedialog_resources.iby Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* 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 __TSDEVICEDIALOG_LANGUAGE_IBY__ -#define __TSDEVICEDIALOG_LANGUAGE_IBY__ - -// -------- hsapplication -data=DATAZ_\resource\qt\translations\taskswitcher.qm resource\qt\translations\taskswitcher.qm - -#endif //__TSAPP_LANGUAGE_IBY__ diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/sis/buildSis.cmd --- a/tsdevicedialog/sis/buildSis.cmd Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem -@echo off -setlocal EnableDelayedExpansion -set openpar=( -set closepar=) - -if exist *.sis* ( del *.sis* ) -if exist tmp.pkg ( del tmp.pkg ) - -copy /Y taskswitcher.pkg tmp.pkg > NUL - -echo Creating sis for each component: -for /R .. %%i IN (*_template.pkg) DO set tmpname=%%~ni && set modulename=!tmpname:~0,-10!&& call createpackage %%i release-armv5 cert.cer key.pem > NUL && set sisname=%%~dpi!modulename!_release-armv5.sis && if exist !sisname! ( echo [SUCCEEDED] !modulename! [SUCCEEDED] && move !sisname! . && FOR /F "eol=( tokens=4 delims=({}" %%j IN (%%i) DO FOR /F "tokens=1 delims=)" %%k IN ("%%j") DO echo @"!modulename!_release-armv5.sis",!openpar!%%k!closepar! >> tmp.pkg ) else ( echo [FAILED] !modulename! [FAILED] ) - -REM echo. - -echo Embedding all sis files into single sis -makesis tmp.pkg taskswitcher.sis >NUL -signsis taskswitcher.sis taskswitcher.sisx cert.cer key.pem >NUL - -echo Cleaning up -del tmp.pkg -del taskswitcher.sis -del *_release-armv5.sis* -pause diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/sis/edit_pkg.pl --- a/tsdevicedialog/sis/edit_pkg.pl Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -# -# 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: -# -#Options: -# -version -adds Qt version (4,6,0) intp pkg files -# -target -replaces $(PLATFORM)/$(TARGET) into armv5/urel -# -module -creates script for module tests sis -# -module -delete module tests pkg -# default -version - -use strict; -use File::Find; -my $base = `cd`; -$base =~ s/\\\w+\s+$//; #move one dir upper -my $modulebase = `cd`; -$modulebase =~s/(\s+)$//; #remove linefeed from end -print $base;; -my $qtversion = "\, 4\, 6\, 0\,"; -my $target = "armv5\/urel"; - -my $qtversionchnage = 0; -my $qtversionarg = "-version"; -my $targetchnage = 0; -my $targetarg = "-target"; -my $module = 0; -my $modulearg = "-module"; -my $delmodule = 0; -my $delmodulearg = "-delmodule"; -my $moduledir = "modulesis"; -my $modulepath = $base."\\".$moduledir; -my $ccert = $modulebase."\\"."cert.cer"; -my $ckey = $modulebase."\\"."key.pem"; -my $modulebatpath = $modulebase."\\".$moduledir."\\createmodulesis.bat"; - -checkCmdLine(); - -if ( $qtversionchnage == 1 || $targetchnage == 1 ) - { - find( \&edits, $base ); - } -if ( $module == 1 ) - { - system "mkdir $moduledir"; - if ( not ( open (FWM, ">$modulebatpath") ) ) - { - print "\n***Error: Couldn't open $modulebatpath file to write\n"; - return; - } - binmode FWM; - print FWM "del /S/Q *.SIS\r\n"; - print FWM "del /S/Q *.SISX\r\n"; - close FWM; - find( \&moduleSis, $base ); - } -if ( $delmodule == 1 ) - { - find( \&delModuleSis, $base ); - } - -sub edits() - { - my $file=$_; - my $winpath=$File::Find::name; - $winpath=~s/\//\\/g; - if( -f $file && $file=~/(_template\.pkg)$/i ) - { - print "$winpath "; - system "attrib -R $winpath"; - if ( not ( open (FR, $winpath) ) ) - { - print "Error: Couldn't open $winpath file to read\n"; - return; - } - binmode FR; - my $buf=""; - my $length = 0; - $length = -s $winpath; - read( FR, $buf, $length ); - close FR; - if ( $qtversionchnage == 1 ) - { - $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si; - } - if ( $targetchnage == 1 ) - { - $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si; - } - - if ( not ( open (FW, ">$winpath") ) ) - { - print "\n***Error: Couldn't open $winpath file to write\n"; - return; - } - binmode FW; - print FW $buf; - close FW; - - print "\r\n"; - } - } - -sub checkCmdLine() - { - my $numArgs = $#ARGV + 1; - if ( $numArgs == 0 ) - { - $qtversionchnage = 1; - } - else - { - foreach my $argnum ( 0 .. $#ARGV ) - { - my $argName = lc $ARGV[$argnum]; - if ( $argName eq $qtversionarg ) - { - $qtversionchnage = 1; - } - elsif ( $argName eq $targetarg ) - { - $targetchnage = 1; - } - elsif ( $argName eq $modulearg ) - { - $module = 1; - } - elsif ( $argName eq $delmodulearg ) - { - $delmodule = 1; - } - else - { - die "\n***Error: Bad arguments\n"; - } - } - } - } - -sub moduleSis() - { - my $file=$_; - my $winpath=$File::Find::name; - $winpath=~s/\//\\/g; - - - if( -f $file && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) ) - { - print "$winpath "; - system "attrib -R $winpath"; - if ( not ( open (FR, $winpath) ) ) - { - print "Error: Couldn't open $winpath file to read\n"; - return; - } - binmode FR; - my $buf=""; - my $length = 0; - $length = -s $winpath; - read( FR, $buf, $length ); - close FR; - $buf =~s/\,\s*\,\s*\,\s*\,\s*\{\"Qt\"\}/$qtversion \{\"Qt\"\}/si; - $buf =~s/\$\(PLATFORM\)\/\$\(TARGET\)/$target/si; - - if ( not ( open (FW, ">$winpath") ) ) - { - print "Error: Couldn't open $winpath file to write\n"; - return; - } - binmode FW; - print FW $buf; - close FW; - print "\r\n"; - - my $pkgname = sisName( $winpath ); - - if ( not ( open (FWM2, ">>$modulebatpath") ) ) - { - print "Error: Couldn't open $modulebatpath file to append\n"; - return; - } - binmode FWM2; - print FWM2 "makesis $winpath $pkgname\.SIS\r\n"; - print FWM2 "signsis $pkgname\.SIS $pkgname\.SISX $ccert $ckey\r\n"; - close FWM2; - } - } - -sub sisName() - { - my $path = shift; - my $name = ""; - if ( $path =~ /\\(\w+)\.pkg/i ) - { - $name = $1; - } - return $name; - } - -sub delModuleSis() - { - my $file=$_; - my $winpath=$File::Find::name; - $winpath=~s/\//\\/g; - - - if( -f $file && $file=~/(_template\.pkg)$/i && ( $file=~/^(t_)/i || $file=~/test/i ) ) - { - print "Deleting: "; - print "$winpath "; - system "attrib -R $winpath"; - system "del /S/Q $winpath"; - print "\r\n"; - } - } \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/sis/stubs/createstubs.bat --- a/tsdevicedialog/sis/stubs/createstubs.bat Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -for %%f in (*.pkg) do makesis -s %%f diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/sis/stubs/taskswitcher_stub.pkg --- a/tsdevicedialog/sis/stubs/taskswitcher_stub.pkg Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -; -; 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: -; -; ------------------------------------------------------------------------------ -; Taskswitcher stub SIS package file. -; Used to enable Taskswitcher to be updated from ROM with a SIS package. -; When you add new files into this stub, please remember to update -; SIS stub with "makesis -s" command. -; ------------------------------------------------------------------------------ -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"taskswitcher"},(0x2002677F),1,0,0,TYPE=SA - -;Localized Vendor Name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -""-"Z:\resource\qt\translations\taskswitcher.qm" -""-"Z:\resource\qt\crml\tsexternalactivation.qcrml" - -""-"Z:\sys\bin\tsdevicedialogplugin.dll" -""-"Z:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin" diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/sis/stubs/taskswitcher_stub.sis Binary file tsdevicedialog/sis/stubs/taskswitcher_stub.sis has changed diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/sis/taskswitcher.pkg --- a/tsdevicedialog/sis/taskswitcher.pkg Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -; -; 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: -; - -;Language - standard language definitions -&EN - -; standard SIS file header -#{"taskswitcher"},(0x2002677F),1,0,0,TYPE=SA, RU - -;Localized Vendor Name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -"/epoc32/data/z/resource/qt/translations/taskswitcher.qm"-"!:\resource\qt\translations\taskswitcher.qm" -"/epoc32/data/z/resource/qt/crml/tsexternalactivation.qcrml"-"!:\resource\qt\crml\tsexternalactivation.qcrml" - -"/epoc32/release/armv5/urel/tsdevicedialogplugin.dll"-"!:\sys\bin\tsdevicedialogplugin.dll" -"/epoc32/data/z/resource/plugins/devicedialogs/tsdevicedialogplugin.qtplugin"-"!:\resource\plugins\devicedialogs\tsdevicedialogplugin.qtplugin" \ No newline at end of file diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialog.pro --- a/tsdevicedialog/tsdevicedialog.pro Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -# -# 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: -# - -TEMPLATE = subdirs - -coverage { - SUBDIRS += ../homescreensrv_plat - SUBDIRS += ../activityfw - SUBDIRS += ../hsappkeyhandler - SUBDIRS += ../taskswitcher -} - -SUBDIRS += tsdevicedialogplugin - -tests { - SUBDIRS += ../internal/tstestutils - SUBDIRS += internal/tstestrunner - SUBDIRS += tsdevicedialogplugin/tsrc - SUBDIRS += ../activityfw/activityserviceplugin/tsrc - SUBDIRS += ../activityfw/storage/client/t_afstorageclient - SUBDIRS += ../activityfw/storage/server/tsrc - SUBDIRS += ../activityfw/afactivitylauncher/tsrc - SUBDIRS += ../hsappkeyhandler/tsrc/t_hsappkeyhandler - SUBDIRS += ../taskswitcher/client/tsrc - SUBDIRS += ../taskswitcher/server/tsrc - SUBDIRS += ../taskswitcher/screenshotplugin/tsrc - SUBDIRS += ../taskswitcher/utils/tsrc - SUBDIRS += ../taskswitcher/backstepping/tsrc -} - -symbian:include(rom.pri) - -CONFIG += ordered diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog.confml Binary file tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog.confml has changed diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog_2002677F.crml Binary file tsdevicedialog/tsdevicedialogplugin/conf/tsdevicedialog_2002677F.crml has changed diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsdataroles.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdataroles.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* 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 TSDATAROLES_H -#define TSDATAROLES_H - -namespace TsDataRoles -{ - enum EntryAttributes { - Closable = Qt::UserRole + 1, - Active, - }; -} - -#endif // TSDATAROLES_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogcontainer.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* 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 TSDEVICEDIALOGCONTAINER_H -#define TSDEVICEDIALOGCONTAINER_H - -#include -#include -#include -#include - -#include "tsdocumentloader.h" - -QTM_USE_NAMESPACE - -class QAbstractListModel; - -class TsDeviceDialogContainer : public QObject, - public HbDeviceDialogInterface -{ - Q_OBJECT -public: - explicit TsDeviceDialogContainer(QAbstractListModel *model, - QObject *parent = 0); - ~TsDeviceDialogContainer(); - -public: - virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); - virtual int deviceDialogError() const; - virtual void closeDeviceDialog(bool byClient); - virtual HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -signals: - void deviceDialogClosed(); - -public slots: - void changeOrientation(Qt::Orientation orientation); - -private slots: - void notifyDialogClosed(); - void switchViewOnModelChange(); - void handleDismissRequest(); - -private: - TsDocumentLoader mLoader; - QValueSpacePublisher mVisibilityPublisher; - QValueSpaceSubscriber mDismissRequestSubscriber; - - Q_DISABLE_COPY(TsDeviceDialogContainer) -}; - -#endif // TSDEVICEDIALOGCONTAINER_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogplugin.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdevicedialogplugin.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* 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 TSDEVICEDIALOGPLUGIN_H -#define TSDEVICEDIALOGPLUGIN_H - -#include - -#include - -#include "tsdocumentloader.h" - -class QAbstractListModel; -class TsTaskMonitor; - -class TsDeviceDialogPlugin : public HbDeviceDialogPlugin -{ - Q_OBJECT - -public: - TsDeviceDialogPlugin(); - ~TsDeviceDialogPlugin(); - - bool accessAllowed(const QString &deviceDialogType, - const QVariantMap ¶meters, - const QVariantMap &securityInfo) const; - HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, - const QVariantMap ¶meters); - bool deviceDialogInfo(const QString &deviceDialogType, - const QVariantMap ¶meters, - DeviceDialogInfo *info) const; - QStringList deviceDialogTypes() const; - PluginFlags pluginFlags() const; - int error() const; - -private: - TsDocumentLoader mLoader; - QAbstractListModel *mModel; - TsTaskMonitor *mStorage; - - bool mTriedToLoadTranslation; - - Q_DISABLE_COPY(TsDeviceDialogPlugin) -}; - -#endif // TSDEVICEDIALOGPLUGIN_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsdocumentloader.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsdocumentloader.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* 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: Screensaver custom document loader. -* -*/ - -#ifndef TSDOCUMENTLOADER_H -#define TSDOCUMENTLOADER_H - -#include - -class TsDocumentLoader : public HbDocumentLoader -{ - -private: - virtual QObject *createObject(const QString &type, - const QString &name); - -}; - -#endif // TSDOCUMENTLOADER_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsentrymodelitem.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsentrymodelitem.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* 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: tsentrymodelitem.h -* -*/ - -#ifndef TSENTRYMODELITEM_H -#define TSENTRYMODELITEM_H - -#include "tsmodelitem.h" - -#include - -class TsTask; - -/*! - Class implements model item which represents Content Arsenal entry -*/ -class TsEntryModelItem : public TsModelItem -{ -public: - TsEntryModelItem(QSharedPointer entry); - ~TsEntryModelItem(); - QVariant data(int role) const; - void close(); - void open(); - -private: - const QSharedPointer mEntry; -}; - -#endif // TSMODEL_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* 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: tsmodel.h -* -*/ - -#ifndef TSMODEL_H -#define TSMODEL_H - -#include -#include -#include -#include - -#include - -class CaNotifier; -class TsModelItem; - -class TsModel : public QAbstractListModel -{ - Q_OBJECT - -public: - TsModel(TsTaskMonitor &applicationSrv, - QObject *parent = 0); - ~TsModel(); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, - int role = Qt::DisplayRole) const; - // from QAbstractModel - virtual bool insertRows(int row, int count, TsModelItem *item, - const QModelIndex &parent = QModelIndex()); - virtual bool removeRows(int row, int count, - const QModelIndex &parent = QModelIndex()); - - - bool moveRows(int oldPosition, int newPosition, - const QModelIndex &parent = QModelIndex()); - bool updateRows(int row, TsModelItem *item); - void fullUpdate(); - -public slots: - void openApplication(const QModelIndex &index); - void closeApplication(const QModelIndex &index); - void updateApplications(); - -private: - TsModelItem *entry(const QModelIndex &index) const; - void getApplications(); - -private: - /* - * List containing result - */ - QList mEntries; - - TsTaskMonitor &mApplicationService; - - Q_DISABLE_COPY(TsModel) -}; - -#endif // TSMODEL_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsmodelitem.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsmodelitem.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* 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: tsmodelitem.h -* -*/ -#ifndef TSMODELITEM_H -#define TSMODELITEM_H - -#include -#include - -#include "tsmodelitem.h" - -class TsTask; - -/*! - Abstract class which define model item for taskswitcher -*/ -class TsModelItem -{ - -public: - TsModelItem(QSharedPointer entry); - ~TsModelItem(); - QVariant data(int role) const; - void close(); - void open(); - -private: - const QSharedPointer mEntry; - Q_DISABLE_COPY(TsModelItem) - -}; - -#endif // TSMODELITEM_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tsnoitemslabel.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tsnoitemslabel.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* 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 TSNOITEMSLABEL_H -#define TSNOITEMSLABEL_H - -#include - -class TsNoItemsLabel : public HbLabel -{ - Q_OBJECT - -public: - explicit TsNoItemsLabel(QGraphicsItem *parent = 0); - -private: - Q_DISABLE_COPY(TsNoItemsLabel) - -}; - -#endif //TSNOITEMSLABEL_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tstasksgrid.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tstasksgrid.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* 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 TSTASKSGRID_H -#define TSTASKSGRID_H - -#include - -class TsTasksGrid : public HbGridView -{ - Q_OBJECT - -signals: - void deleteButtonClicked(const QModelIndex &index); - -protected: - virtual void polish(HbStyleParameters ¶ms); - -}; - -#endif // TSTASKSGRID_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/inc/tstasksgriditem.h --- a/tsdevicedialog/tsdevicedialogplugin/inc/tstasksgriditem.h Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* 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 TSTASKSGRIDITEM_H -#define TSTASKSGRIDITEM_H - -#include - -class HbTextItem; -class HbIconItem; -class HbFrameItem; -class HbPushButton; - -class TsTasksGridItem : public HbAbstractViewItem -{ - Q_OBJECT - -public: - TsTasksGridItem(); - TsTasksGridItem(const TsTasksGridItem &item); - - HbAbstractViewItem *createItem(); - void updateChildItems(); - -private slots: - void handleDeleteClicked(); - -signals: - void deleteClicked(const QModelIndex &index); - -private: - HbIconItem *mScreenshotLabel; - HbTextItem *mApplicationNameLabel; - HbPushButton *mDeleteButton; - - HbFrameItem *mActiveLabelFrame; - HbTextItem *mActiveLabel; - -}; - -#endif //TSTASKSGRIDITEM_H diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/resource/hbdialog.css --- a/tsdevicedialog/tsdevicedialogplugin/resource/hbdialog.css Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -HbDialog#tsdevicedialog::heading { - left: 0; - right: 0; - top: 0; - bottom: 0un; - fixed-height: expr(var(hb-param-text-height-primary)+2*var(hb-param-margin-gene-popup)); -} - -HbDialog#tsdevicedialog::content { - left: 0; - right: 0; - bottom: 0un; -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/resource/layout.docml --- a/tsdevicedialog/tsdevicedialogplugin/resource/layout.docml Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - -
-
diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.css --- a/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.css Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -TsTasksGridItem { - layout:custom; -} - -TsTasksGridItem::appname { - text-align: center; - color: var(qtc_default_main_pane_normal); - font-variant: secondary; - text-height: var(hb-param-text-height-tiny); - text-wrap-mode: no-wrap; -} - -TsTasksGridItem > HbPushButton#closebadge { - min-width: 7un; - min-height: 7un; -} - -TsTasksGridItem::screenshotFrame { - zvalue: -1; -} - -TsTasksGridItem::applicationLabelFrame { - zvalue: -1; -} - -TsTasksGridItem > HbPushButton#closebadge::toucharea { - left: 1un; - right: -1un; - top: 1un; - bottom: -1un; -} - -TsTasksGridItem > HbPushButton#closebadge::icon { - max-width: var(hb-param-graphic-size-primary-small); - max-height: var(hb-param-graphic-size-primary-small); -} - -TsTasksGridItem::screenshot { - alignment: center; -} - -TsTasksGridItem::activeLabel { - text-align: center; - color: var(qtc_multimedia_trans_normal); - text-height: var(hb-param-text-height-tiny); - font-variant: secondary; - - zvalue: 2; - - /* workaround for mesh layout limitations */ - max-height: 4un; - min-height: 4un; -} - -TsTasksGridItem::activeLabelFrame { - zvalue: 1; -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.widgetml --- a/tsdevicedialog/tsdevicedialogplugin/resource/tstasksgriditem.widgetml Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogcontainer.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -/* -* 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: -* -*/ - -#include "tsdevicedialogcontainer.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include "tstasksgrid.h" -#include "tstasksgriditem.h" - -namespace -{ - const char KDocmlPath[] = ":/resource/layout.docml"; -} - -TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model, - QObject *parent) - : - QObject(parent), - mVisibilityPublisher(TsProperty::KTsPath), - mDismissRequestSubscriber(QString("%1/%2").arg(TsProperty::KTsPath).arg(TsProperty::KDismissRequestPath)) -{ - bool ok(true); - mLoader.load(KDocmlPath, &ok); - Q_ASSERT(ok); - - HbDialog *dialog = - qobject_cast(mLoader.findWidget("tsdevicedialog")); - TsTasksGrid *grid = - qobject_cast(mLoader.findWidget("taskgrid")); - Q_ASSERT(dialog); - Q_ASSERT(grid); - - bool cssLoaded = HbStyleLoader::registerFilePath(":/resource/hbdialog.css"); - Q_ASSERT(cssLoaded); - { - HbLabel *dialogHeading = qobject_cast(dialog->headingWidget()); - Q_ASSERT(dialogHeading); - HbFrameDrawer *headingFrame = new HbFrameDrawer(QLatin1String("qtg_fr_popup_heading"), HbFrameDrawer::ThreePiecesHorizontal); - dialogHeading->setBackgroundItem(new HbFrameItem(headingFrame)); - } - - grid->setEnabledAnimations(HbAbstractItemView::None); - grid->setModel(model); - - changeOrientation(dialog->mainWindow()->orientation()); - switchViewOnModelChange(); - - // needed because of Qt::QueuedConnection used below - // @todo: check if we actually need queued connections - qRegisterMetaType("QModelIndex"); - - // connect the grid and model - connect(grid, - SIGNAL(activated(QModelIndex)), - model, - SLOT(openApplication(QModelIndex))); - connect(grid, - SIGNAL(activated(QModelIndex)), - dialog, - SLOT(close())); - connect(grid, - SIGNAL(deleteButtonClicked(QModelIndex)), - model, SLOT(closeApplication(QModelIndex)), - Qt::QueuedConnection); - - connect(dialog->mainWindow(), - SIGNAL(orientationChanged(Qt::Orientation)), - this, - SLOT(changeOrientation(Qt::Orientation))); - connect(dialog, - SIGNAL(aboutToClose()), - this, - SIGNAL(deviceDialogClosed())); - - // switch between grid and "no items" label when model is updated - connect(model, SIGNAL(modelReset()), this, SLOT(switchViewOnModelChange())); - connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange())); - connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange())); - - connect(this, - SIGNAL(deviceDialogClosed()), - this, - SLOT(notifyDialogClosed())); - mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, - static_cast(true)); - mVisibilityPublisher.sync(); - - connect(&mDismissRequestSubscriber, - SIGNAL(contentsChanged()), - this, - SLOT(handleDismissRequest())); -} - -TsDeviceDialogContainer::~TsDeviceDialogContainer() -{ - delete deviceDialogWidget(); -} - -bool TsDeviceDialogContainer::setDeviceDialogParameters( - const QVariantMap ¶meters) -{ - Q_UNUSED(parameters); - return false; -} - -int TsDeviceDialogContainer::deviceDialogError() const -{ - return 0; -} - -void TsDeviceDialogContainer::closeDeviceDialog(bool byClient) -{ - Q_UNUSED(byClient) - // @todo: should there be hide calls? deviceDialogWidget->hide(); - emit deviceDialogClosed(); -} - -HbPopup *TsDeviceDialogContainer::deviceDialogWidget() const -{ - HbDialog *widget = - qobject_cast(mLoader.findWidget("tsdevicedialog")); - Q_ASSERT(widget); - return widget; -} - -QObject *TsDeviceDialogContainer::signalSender() const -{ - return const_cast(this); -} - -void TsDeviceDialogContainer::changeOrientation(Qt::Orientation orientation) -{ - bool ok(true); - if (orientation == Qt::Horizontal) { - mLoader.load(KDocmlPath, "landscape", &ok); - } else { - mLoader.load(KDocmlPath, "portrait", &ok); - } - Q_ASSERT(ok); -} - -void TsDeviceDialogContainer::notifyDialogClosed() -{ - mVisibilityPublisher.setValue(TsProperty::KVisibilityPath, - static_cast(false)); - mVisibilityPublisher.sync(); -} - -void TsDeviceDialogContainer::switchViewOnModelChange() -{ - TsTasksGrid *grid = - qobject_cast(mLoader.findWidget("taskgrid")); - HbWidget *noItemsWidget = - qobject_cast(mLoader.findWidget("noitemswidget")); - Q_ASSERT(grid); - Q_ASSERT(noItemsWidget); - - if (grid->model() && grid->model()->rowCount()) { - noItemsWidget->hide(); - grid->show(); - } else { - noItemsWidget->show(); - grid->hide(); - } -} - -void TsDeviceDialogContainer::handleDismissRequest() -{ - if (mDismissRequestSubscriber.value().toBool()) { - emit deviceDialogClosed(); - } -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tsdevicedialogplugin.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* -* 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: -* -*/ - -#include "tsdevicedialogplugin.h" - -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include "tsdevicedialogcontainer.h" -#include "tstasksgrid.h" -#include "tstasksgriditem.h" -#include "tsdocumentloader.h" -#include "tsmodel.h" - -QTM_USE_NAMESPACE - -/*! - \class TsDeviceDialogPlugin - \ingroup group_tsdevicedialogplugin - \brief TaskSwitcher Device Dialog Plug-in. - */ - -namespace -{ - const char KTranslationPath[] = "resource/qt/translations"; - const char KTsDialogType[] = "com.nokia.taskswitcher.tsdevicedialogplugin/1.0"; -} - -/*! - Constructor. - */ -TsDeviceDialogPlugin::TsDeviceDialogPlugin() - : - mModel(0), - mStorage(0), - mTriedToLoadTranslation(false) -{ - // ensure the visibility property is set to false, so the TaskSwitcher - // in case when hbdevicedialogappserver crashes when TS is visible. - QValueSpacePublisher visibilityPublisher(TsProperty::KTsPath); - visibilityPublisher.setValue(TsProperty::KVisibilityPath, static_cast(false)); - visibilityPublisher.sync(); -} - -TsDeviceDialogPlugin::~TsDeviceDialogPlugin() -{ -} -/*! - \reimp - */ -bool TsDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType, - const QVariantMap ¶meters, - const QVariantMap &securityInfo) const -{ - Q_UNUSED(deviceDialogType) - Q_UNUSED(parameters) - Q_UNUSED(securityInfo) - - // This plugin doesn't perform operations that may compromise security. - // All clients are allowed to use it. - return true; -} - -/*! - \reimp - */ -HbDeviceDialogInterface * -TsDeviceDialogPlugin::createDeviceDialog(const QString &deviceDialogType, - const QVariantMap ¶meters) -{ - Q_UNUSED(parameters) - HbDeviceDialogInterface *dialogInterface(0); - if (deviceDialogType == QString(KTsDialogType)) { - // lazy loading of translation - if (!mTriedToLoadTranslation) { - mTriedToLoadTranslation = true; - - QTranslator *translator = new QTranslator(this); - QString translationFile = - QString("taskswitcher_%1").arg(QLocale::system().name()); - - bool translationLoaded(false); -#ifdef Q_OS_SYMBIAN - translationLoaded = - translator->load(translationFile, - QString("z:/") + KTranslationPath); - if (!translationLoaded) { - translationLoaded = - translator->load(translationFile, - QString("c:/") + KTranslationPath); - } -#else - translationLoaded = - translator->load(translationFile, - QString(KTranslationPath)); -#endif //Q_OS_SYMBIAN - - Q_ASSERT(translationLoaded); - qApp->installTranslator(translator); - } - - // lazy loading of model - if (!mModel) { - mStorage = new TsTaskMonitor(this); - mModel = new TsModel(*mStorage, this); - } - - // ensure the dismiss request property is set to false - - QValueSpacePublisher dismissRequestPublisher(TsProperty::KTsPath); - dismissRequestPublisher.setValue(TsProperty::KDismissRequestPath, static_cast(false)); - dismissRequestPublisher.sync(); - - - // create device dialog - dialogInterface = new TsDeviceDialogContainer(mModel); - } - return dialogInterface; -} - -/*! - \reimp - */ -bool TsDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, - const QVariantMap ¶meters, - DeviceDialogInfo *info) const -{ - Q_UNUSED(parameters) - Q_UNUSED(deviceDialogType) - - info->group = GenericDeviceDialogGroup; - info->flags = SingleInstance; - info->priority = DefaultPriority; - - return true; -} - -/*! - \reimp - */ -QStringList TsDeviceDialogPlugin::deviceDialogTypes() const -{ - return QStringList(QString(KTsDialogType)); -} - -/*! - \reimp - */ -HbDeviceDialogPlugin::PluginFlags TsDeviceDialogPlugin::pluginFlags() const -{ - return PluginFlags(PreloadPlugin | KeepPluginLoaded); -} - -/*! - \reimp - */ -int TsDeviceDialogPlugin::error() const -{ - return 0; -} - -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT - -Q_EXPORT_PLUGIN2(tsdevicedialogplugin, TsDeviceDialogPlugin) - -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tsdocumentloader.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tsdocumentloader.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* 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: Screensaver custom document loader. -* -*/ - -#include "tsdocumentloader.h" -#include "tstasksgrid.h" -#include "tstasksgriditem.h" -#include "tsnoitemslabel.h" - -/*! - \class TsDocumentLoader - \ingroup group_tsdevicedialogplugin - \brief Document loader. - - TS implementation of document loader. It is creating TS objects used in UI -*/ - -QObject *TsDocumentLoader::createObject(const QString &type, - const QString &name) -{ - if (type == TsTasksGrid::staticMetaObject.className()) { - QObject *object = new TsTasksGrid(); - object->setObjectName(name); - return object; - } else if (type == TsTasksGridItem::staticMetaObject.className()) { - QObject *object = new TsTasksGridItem(); - object->setObjectName(name); - return object; - } else if (type == TsNoItemsLabel::staticMetaObject.className()) { - QObject *object = new TsNoItemsLabel(); - object->setObjectName(name); - return object; - } - - return HbDocumentLoader::createObject(type, name); -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tsmodel.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tsmodel.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -/* -* 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: tsmodel.cpp -* -*/ -#include "tsmodel.h" - -#include -#include - -#include - -#include - -#include "tsmodelitem.h" -#include "tsdataroles.h" -#include "tstaskchangeinfo.h" - -/*! - \class TsModel - \ingroup group_tsdevicedialogplugin - \brief Model storing running tasks. -*/ - -/*! - Constructor - \param query used to create model - \param pointer to parent object -*/ -TsModel::TsModel(TsTaskMonitor &applicationSrv, QObject *parent) : - QAbstractListModel(parent), - mEntries(), - mApplicationService(applicationSrv) -{ - connect(&applicationSrv, - SIGNAL(taskListChanged()), - this, - SLOT(updateApplications())); - - fullUpdate(); -} - -/*! - Destructor -*/ -TsModel::~TsModel() -{ - qDeleteAll(mEntries); -} - -/*! - Returns count of rows in model - \retval number of rows -*/ -int TsModel::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return mEntries.count(); -} - -bool TsModel::insertRows(int row, int count, TsModelItem *item, const QModelIndex &parent) -{ - beginInsertRows(parent, row, row+count-1); - mEntries.insert(row, item); - endInsertRows(); - return true; -} - -bool TsModel::removeRows(int row, int count, const QModelIndex &parent) -{ - TsModelItem *oldItem = mEntries.at(row); - beginRemoveRows(parent, row, row + count - 1); - mEntries.removeAt(row); - delete oldItem; - endRemoveRows(); - return true; -} - - -bool TsModel::moveRows(int oldPosition, int newPosition, const QModelIndex &parent) -{ - beginMoveRows(parent, oldPosition, oldPosition, parent, newPosition); - mEntries.move(oldPosition, newPosition); - endMoveRows(); - return true; -} - - -bool TsModel::updateRows(int row, TsModelItem *item) -{ - TsModelItem *oldItem = mEntries.at(row); - mEntries[row] = item; - delete oldItem; - - emit dataChanged(index(row),index(row)); - return true; -} - -/*! - Returns appropiate model's data - \param index model index - \param role which data role to return - \retval models data -*/ -QVariant TsModel::data(const QModelIndex &index, int role) const -{ - return index.isValid() ? entry(index)->data(role) : QVariant(); -} - -/*! - Activate one of model entries -*/ -void TsModel::openApplication(const QModelIndex &index) -{ - if (!index.isValid()) { - return; - } - entry(index)->open(); -} - -/*! - Close one of moder entries -*/ -void TsModel::closeApplication(const QModelIndex &index) -{ - if (!index.isValid() || - !entry(index)->data(TsDataRoles::Closable).toBool()) { - return; - } - entry(index)->close(); -} - -/*! - Updates model with fresh entries -*/ -void TsModel::updateApplications() -{ - QList changes(mApplicationService.changeList()); - - if (changes.count() == 0) { - return; - } - //check 1st item whether we have cancel change - if so reset model - if (changes[0].first.changeType() == TsTaskChangeInfo::EChangeCancel) { - fullUpdate(); - return; - } - for (int iter(0); iter < changes.count(); iter++) { - switch (changes[iter].first.changeType()) { - case TsTaskChangeInfo::EChangeDelete : - removeRows(changes[iter].first.oldOffset(), 1); - break; - case TsTaskChangeInfo::EChangeInsert : - insertRows(changes[iter].first.newOffset(), 1, - new TsModelItem(changes[iter].second)); - break; - case TsTaskChangeInfo::EChangeMove : - moveRows(changes[iter].first.oldOffset(), changes[iter].first.newOffset()); - break; - case TsTaskChangeInfo::EChangeUpdate : - updateRows(changes[iter].first.oldOffset(), - new TsModelItem(changes[iter].second)); - break; - default: - break; - } - } -} - -/*! - reset model -*/ -void TsModel::fullUpdate() -{ - beginResetModel(); - qDeleteAll(mEntries); - mEntries.clear(); - getApplications(); - endResetModel(); - -} - -/*! - Read list of running applications -*/ -void TsModel::getApplications() -{ - //get all running applications and append to entries list - QList tasks(mApplicationService.changeList(true)); - foreach(TsTaskChange taskData, tasks) { - if (!taskData.second.isNull()) { - mEntries.append(new TsModelItem(taskData.second)); - } - } -} - -/*! - Returns an entry from model - \param index of entry in model - \retval pointer to an entry -*/ -TsModelItem *TsModel::entry(const QModelIndex &index) const -{ - return mEntries.at(index.row()); -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tsmodelitem.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tsmodelitem.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* 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: tsmodelitem.cpp -* -*/ - -#include "tsmodelitem.h" - -#include - -#include - -#include "tsdataroles.h" - -/*! - \class TsModelItem - \ingroup group_tsdevicedialogplugin - \brief Item presenting running apps in the grid. -*/ - -/*! - Standard C++ constructor - /param entry - Task Monitor data -*/ -TsModelItem::TsModelItem(QSharedPointer entry) - : mEntry(entry) -{ - //no implementation required -} - -/*! - Standard C++ destructor -*/ -TsModelItem::~TsModelItem() -{ -} - -/*! - Returns the data stored under the given role. - /param role - requested data role - /return data encapulated by QVariant -*/ -QVariant TsModelItem::data(int role) const -{ - switch (role) { - case Qt::DisplayRole: - return QVariant(mEntry->name()); - case Qt::DecorationRole: - return QVariant::fromValue(HbIcon(mEntry->screenshot())); - case TsDataRoles::Closable: - return QVariant(mEntry->isClosable()); - case TsDataRoles::Active: - return QVariant(mEntry->isActive()); - default: - return QVariant(QVariant::Invalid); - } -} - -/*! - Close running application repesented by entry -*/ -void TsModelItem::close() -{ - mEntry->close(); -} - -/*! - Open or move to foreground application repesented by entry -*/ -void TsModelItem::open() -{ - mEntry->open(); -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tsnoitemslabel.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tsnoitemslabel.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* 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: -* -*/ -#include "tsnoitemslabel.h" - -#include - -/*! - \class TsTasksGridItem - \ingroup group_tsdevicedialogplugin - \brief Item that should be presented in grid. -*/ - -TsNoItemsLabel::TsNoItemsLabel(QGraphicsItem *parent) : HbLabel(parent) -{ - HbFrameDrawer *drawer = new HbFrameDrawer(QLatin1String("qtg_fr_multimedia_trans"), HbFrameDrawer::NinePieces); - setBackgroundItem(new HbFrameItem(drawer)); -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tstasksgrid.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tstasksgrid.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* 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: -* -*/ - -#include "tstasksgrid.h" - -void TsTasksGrid::polish(HbStyleParameters ¶ms) -{ - HbGridView::polish(params); - - // center second item when dialog is shown - if (model()) { - scrollTo(model()->index(1, 0), PositionAtCenter); - } -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/src/tstasksgriditem.cpp --- a/tsdevicedialog/tsdevicedialogplugin/src/tstasksgriditem.cpp Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* 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: -* -*/ -#include "tstasksgriditem.h" - -#include -#include -#include -#include -#include -#include - -#include "tsdataroles.h" - -/*! - \class TsTasksGridItem - \ingroup group_tsdevicedialogplugin - \brief Item that should be presented in grid. -*/ - -TsTasksGridItem::TsTasksGridItem() - : - HbAbstractViewItem(), - mScreenshotLabel(0), - mApplicationNameLabel(0), - mDeleteButton(0), - mActiveLabelFrame(0), - mActiveLabel(0) -{ - // Register the custom docml and css to provide our own style to the list items - bool widgetmlLoaded = - HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.widgetml"); - Q_ASSERT(widgetmlLoaded); - bool cssLoaded = - HbStyleLoader::registerFilePath(":/resource/tstasksgriditem.css"); - Q_ASSERT(cssLoaded); -} - -TsTasksGridItem::TsTasksGridItem(const TsTasksGridItem &item) : HbAbstractViewItem(item) -{ - mScreenshotLabel = new HbIconItem(this); - mApplicationNameLabel = new HbTextItem(this); - mDeleteButton = new HbPushButton(this); - HbFrameItem *screenshotFrame = new HbFrameItem(this); - screenshotFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - screenshotFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); - - HbFrameItem *applicationLabelFrame = new HbFrameItem(this); - applicationLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - applicationLabelFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); - - mActiveLabel = new HbTextItem(hbTrId("txt_ts_label_active"), this); - mActiveLabelFrame = new HbFrameItem(this); - mActiveLabelFrame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - mActiveLabelFrame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); - - mDeleteButton->setIcon(HbIcon("qtg_mono_exit")); - - HbStyle::setItemName(mScreenshotLabel, "screenshot"); - HbStyle::setItemName(mApplicationNameLabel, "appname"); - HbStyle::setItemName(mDeleteButton, "closebadge"); - mDeleteButton->setObjectName("closebadge"); - HbStyle::setItemName(screenshotFrame, "screenshotFrame"); - HbStyle::setItemName(applicationLabelFrame, "applicationLabelFrame"); - HbStyle::setItemName(mActiveLabel, "activeLabel"); - HbStyle::setItemName(mActiveLabelFrame, "activeLabelFrame"); - connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(handleDeleteClicked())); -} - -HbAbstractViewItem *TsTasksGridItem::createItem() -{ - TsTasksGridItem *newItem = new TsTasksGridItem(*this); - connect(newItem, SIGNAL(deleteClicked(QModelIndex)), itemView(), SIGNAL(deleteButtonClicked(QModelIndex))); - return newItem; -} - -void TsTasksGridItem::handleDeleteClicked() -{ - emit deleteClicked(modelIndex()); -} - -void TsTasksGridItem::updateChildItems() -{ - mScreenshotLabel->setIcon(modelIndex().data(Qt::DecorationRole).value()); - mApplicationNameLabel->setText(modelIndex().data(Qt::DisplayRole).toString()); - - QVariant closableData(modelIndex().data(TsDataRoles::Closable)); - const bool isClosable(closableData.isValid() && closableData.toBool()); - if (isClosable) { - mDeleteButton->show(); - } else { - mDeleteButton->hide(); - } - - QVariant activeData(modelIndex().data(TsDataRoles::Active)); - const bool isActive(activeData.isValid() && activeData.toBool()); - if (isActive) { - mActiveLabel->show(); - mActiveLabelFrame->show(); - } else { - mActiveLabel->hide(); - mActiveLabelFrame->hide(); - } -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.pro --- a/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.pro Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -# -# 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: tsdevicedialogplugin.pro -# - -TEMPLATE = lib -CONFIG += hb plugin mobility -MOBILITY = publishsubscribe - -include (../common.pri) - -HEADERS += inc/tsdevicedialogcontainer.h \ - inc/tsdevicedialogplugin.h \ - inc/tsmodel.h \ - inc/tsmodelitem.h \ - inc/tstasksgrid.h \ - inc/tstasksgriditem.h \ - inc/tsdocumentloader.h \ - inc/tsdataroles.h \ - inc/tsnoitemslabel.h \ - -SOURCES += src/tsdevicedialogcontainer.cpp \ - src/tsdevicedialogplugin.cpp \ - src/tsmodel.cpp \ - src/tsmodelitem.cpp \ - src/tstasksgrid.cpp \ - src/tstasksgriditem.cpp \ - src/tsdocumentloader.cpp \ - src/tsnoitemslabel.cpp \ - -INCLUDEPATH += . \ - ./inc \ - ../../inc \ - -LIBS += -ltstaskmonitorclient - -TRANSLATIONS = taskswitcher.ts - -RESOURCES += tsdevicedialogplugin.qrc - -DOCML += resource/layout.docml - -symbian { - TARGET.CAPABILITY = CAP_ECOM_PLUGIN - TARGET.UID3 = 0x2002677F - pluginstub.sources = tsdevicedialogplugin.dll - pluginstub.path = /resource/plugins/devicedialogs - DEPLOYMENT += pluginstub - - BLD_INF_RULES.prj_exports += \ - "$${LITERAL_HASH}include " \ - "conf/tsdevicedialog.confml APP_LAYER_CONFML(tsdevicedialog.confml)" \ - "conf/tsdevicedialog_2002677F.crml APP_LAYER_CRML(tsdevicedialog_2002677F.crml)" -} - -win32 { - include ($$[QMAKE_MKSPECS]/features/hb_install.prf) - DESTDIR = $$HB_PLUGINS_DIR/devicedialogs -} diff -r d1dadafc5584 -r 26079c1bb561 tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.qrc --- a/tsdevicedialog/tsdevicedialogplugin/tsdevicedialogplugin.qrc Mon Sep 27 11:31:59 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - resource/layout.docml.bin - resource/tstasksgriditem.widgetml - resource/tstasksgriditem.css - resource/hbdialog.css - -