# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276253917 -10800 # Node ID 156f692b168748b424e867f6387f7cd10bdc5910 # Parent 397d00875918855b39ad2fd04afbedd3128c0e97 Revision: 201021 Kit: 2010123 diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/bwins/hsactivitydbclientu.def --- a/activityfw/activitydatabase/bwins/hsactivitydbclientu.def Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/bwins/hsactivitydbclientu.def Fri Jun 11 13:58:37 2010 +0300 @@ -25,4 +25,7 @@ ?activityRequested@HsActivityDbClient@@IAEXABVQString@@@Z @ 24 NONAME ; void HsActivityDbClient::activityRequested(class QString const &) ?updateActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 25 NONAME ; int HsActivityDbClient::updateActivity(class QHash const &) ?removeActivity@HsActivityDbClient@@UAEHABV?$QHash@VQString@@VQVariant@@@@@Z @ 26 NONAME ; int HsActivityDbClient::removeActivity(class QHash const &) + ?dataChanged@HsActivityDbClient@@IAEXXZ @ 27 NONAME ; void HsActivityDbClient::dataChanged(void) + ?notifyDataChange@HsActivityDbClient@@QAEHXZ @ 28 NONAME ; int HsActivityDbClient::notifyDataChange(void) + ?asyncRequestCompleated@HsActivityDbClient@@UAEXHH@Z @ 29 NONAME ; void HsActivityDbClient::asyncRequestCompleated(int, int) diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/eabi/hsactivitydbclientu.def --- a/activityfw/activitydatabase/eabi/hsactivitydbclientu.def Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/eabi/hsactivitydbclientu.def Fri Jun 11 13:58:37 2010 +0300 @@ -35,4 +35,8 @@ _ZThn8_N18HsActivityDbClient14updateActivityERK5QHashI7QString8QVariantE @ 34 NONAME _ZThn8_N18HsActivityDbClient21applicationActivitiesER5QListI5QHashI7QString8QVariantEERKS4_ @ 35 NONAME _ZThn8_N18HsActivityDbClient27removeApplicationActivitiesERK5QHashI7QString8QVariantE @ 36 NONAME + _ZN18HsActivityDbClient11dataChangedEv @ 37 NONAME + _ZN18HsActivityDbClient16notifyDataChangeEv @ 38 NONAME + _ZN18HsActivityDbClient22asyncRequestCompleatedEii @ 39 NONAME + _ZThn12_N18HsActivityDbClient22asyncRequestCompleatedEii @ 40 NONAME diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp --- a/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/group/hsactivitydbserver.mmp Fri Jun 11 13:58:37 2010 +0300 @@ -18,10 +18,12 @@ TARGETTYPE exe UID 0 0x200267B4 -SYSTEMINCLUDE /epoc32/include +MW_LAYER_SYSTEMINCLUDE +APP_LAYER_SYSTEMINCLUDE USERINCLUDE ../inc USERINCLUDE ../../inc +USERINCLUDE ../../../../inc SOURCEPATH ../src SOURCE main.cpp @@ -33,7 +35,6 @@ SOURCE activitystoragesynctask.cpp SOURCE activitystorageasynctask.cpp SOURCE activityobservertask.cpp -SOURCE activitygraphicfilescaling.cpp SOURCE activitythumbnailtask.cpp LIBRARY euser.lib @@ -44,6 +45,7 @@ LIBRARY fbscli.lib LIBRARY bitmaptransforms.lib LIBRARY imageconversion.lib +LIBRARY tsutils.lib CAPABILITY ALL -TCB EPOCHEAPSIZE 0x100000 0x600000 // 1MB - 6MB diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h Thu May 27 13:11:12 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 : - * - */ -#ifndef ACTIVITYGRAPHICFILESSCALING_H -#define ACTIVITYGRAPHICFILESSCALING_H - -#ifndef __E32SVR_H__ -#define __E32SVR_H__ -#endif - - -#ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT -#define SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT -#endif - -#include - -class CImageDecoder; -class CFbsBitmap; - -class MImageReadyCallBack -{ -public: - virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ) = 0; -}; - -class CGraphicsSalingHandler : public CActive -{ -public: - -enum TCurrentOperation{ - ENone = 0, - EConvertBitmapFromFile = 1, - EScale = 2 - }; - -enum TKindOfScaling -{ - EIgnoreAspectRatio = 0, - EKeepAspectRatio = 1, - EKeepAspectRatioByExpanding = 2, -}; - - ~CGraphicsSalingHandler(); - - static CGraphicsSalingHandler* NewL(MImageReadyCallBack &aNotify, - RFs &aFs, - const TDesC &aFileName, - const TDesC8& aMimeType, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio); - static CGraphicsSalingHandler* NewLC(MImageReadyCallBack &aNotify, - RFs &aFs, - const TDesC &aFileName, - const TDesC8& aMimeType, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio); - -protected: - void DoCancel(); - void RunL(); - TInt RunError(TInt); - -private: - void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType); - CGraphicsSalingHandler(MImageReadyCallBack &aNotify, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling = CGraphicsSalingHandler::EIgnoreAspectRatio); - TSize Scaling(); - -private: - MImageReadyCallBack &mNotify; - CImageDecoder *mImageDecoder; - CFbsBitmap *mBitmapFromFile; - CFbsBitmap *mBitmapOutput; - CBitmapScaler *mBitmapScaler; - TSize mNewSize; - TBool mKindOfScaling; - - TCurrentOperation mCurrentOperation; -}; - -#endif // ACTIVITYGRAPHICFILESSCALING_H diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activityobservertask.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activityobservertask.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activityobservertask.h Fri Jun 11 13:58:37 2010 +0300 @@ -74,6 +74,11 @@ * Write response data to requested message */ void WriteResponseL(); + + /** + * Returns ETrue if task is related with session argument + */ + TBool IsSessionTask(const CSession2* session); private: MActivityTaskStorage& mGlobalStorage; diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activityserver.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activityserver.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activityserver.h Fri Jun 11 13:58:37 2010 +0300 @@ -63,6 +63,7 @@ * @see MActivityTaskStorage::StorageData() */ const RPointerArray& StorageData() const; + private: @@ -81,7 +82,12 @@ * @see CServer2::NewSessionL(const TVersion&, const RMessage2&) */ CSession2* NewSessionL(const TVersion& version, const RMessage2& message) const; - + + /** + * Removes not valid task + */ + void RemoveNotValidTasks(const CSession2* session); + private: RFs mFsSession; CActivityStorage* mStorage; diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activitysession.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitysession.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitysession.h Fri Jun 11 13:58:37 2010 +0300 @@ -71,6 +71,11 @@ * @see MActivityTaskStorage::StorageData() */ const RPointerArray& StorageData() const; + + /** + * Removes not valid task + */ + void RemoveNotValidTasks(const CSession2* session); private: /** diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activitystorageasynctask.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitystorageasynctask.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitystorageasynctask.h Fri Jun 11 13:58:37 2010 +0300 @@ -95,6 +95,11 @@ * @param msg - destination message */ void WriteResponseL(const RMessage2& msg); + + /** + * Returns ETrue if task is related with session argument + */ + TBool IsSessionTask(const CSession2* session); private: RBuf8 mData; diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activitytask.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitytask.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitytask.h Fri Jun 11 13:58:37 2010 +0300 @@ -30,6 +30,11 @@ * @param msg - broadcast message */ virtual void BroadcastReceivedL(const RMessage2& msg) =0; + + /** + * Returns ETrue if task is related with session argument + */ + virtual TBool IsSessionTask(const CSession2* session) =0; }; #endif //ACTIVITYTASK_H diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activitytaskstorage.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitytaskstorage.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitytaskstorage.h Fri Jun 11 13:58:37 2010 +0300 @@ -37,6 +37,11 @@ * List of registered tasks */ virtual const RPointerArray& StorageData() const =0; + + /** + * Removes not valid task + */ + virtual void RemoveNotValidTasks(const CSession2* session) =0; }; #endif //ACTIVITYTASKSTORAGE_H diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h --- a/activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/inc/activitythumbnailtask.h Fri Jun 11 13:58:37 2010 +0300 @@ -27,7 +27,7 @@ #include "activitytask.h" #include "activitytaskstorage.h" -#include "activitygraphicfilescaling.h" +#include "tsgraphicfilescalinghandler.h" class CFbsBitmap; @@ -67,6 +67,11 @@ const TDesC8& Data()const; void BroadcastReceivedL(const RMessage2& ); + + /** + * Returns ETrue if task is related with session argument + */ + TBool IsSessionTask(const CSession2* session); private: MActivityTaskStorage& mStorage; diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitybroadcasttask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -27,5 +27,7 @@ for (TInt iter(tasks.Count() - 1); iter >= 0 ; --iter ) { (tasks[iter])->BroadcastReceivedL(msg); } - msg.Complete(KErrNone); + if(EFalse == msg.IsNull()) { + msg.Complete(KErrNone); + } } diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/activitygraphicfilescaling.cpp Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +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 "activitygraphicfilescaling.h" -#include - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -CGraphicsSalingHandler::CGraphicsSalingHandler(MImageReadyCallBack &aNotify, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling - /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/) : - CActive(EPriorityNormal), - mNotify(aNotify), - mNewSize(aNewSize), - mKindOfScaling(aKindOfScaling), - mCurrentOperation(ENone) -{ -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -CGraphicsSalingHandler::~CGraphicsSalingHandler() -{ - Cancel(); - delete mBitmapFromFile; - delete mBitmapOutput; - delete mImageDecoder; - delete mBitmapScaler; -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -CGraphicsSalingHandler* CGraphicsSalingHandler::NewL(MImageReadyCallBack &aNotify, - RFs &aFs, - const TDesC &aFileName, - const TDesC8& aMimeType, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling - /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/) -{ - CGraphicsSalingHandler *self = CGraphicsSalingHandler::NewLC(aNotify, - aFs, - aFileName, - aMimeType, - aNewSize, - aKindOfScaling); - CleanupStack::Pop(); - return self; -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -CGraphicsSalingHandler* CGraphicsSalingHandler::NewLC(MImageReadyCallBack &aNotify, - RFs &aFs, - const TDesC &aFileName, - const TDesC8& aMimeType, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling - /* = CGraphicsSalingHandler::EIgnoreAspectRatio*/) -{ - CGraphicsSalingHandler *self = new (ELeave) CGraphicsSalingHandler(aNotify, - aNewSize, - aKindOfScaling); - - - - CleanupStack::PushL(self); - self->ConstructL(aFs, aFileName, aMimeType); - return self; -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -void CGraphicsSalingHandler::ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType) -{ - if (aFileName.Length() == 0 - || aFs.IsValidName(aFileName) == EFalse) { - User::Leave(KErrPathNotFound); - } - - if (aMimeType.Length() == 0) { - User::Leave(KErrBadName); - } - - if(0>=mNewSize.iWidth || 0>=mNewSize.iHeight) { - User::Leave(KErrCorrupt); - } - - CActiveScheduler::Add(this); - - mBitmapScaler = CBitmapScaler::NewL(); - mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality); - - // convert *.png to bitmap - mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType); - mBitmapFromFile = new(ELeave)CFbsBitmap(); - const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0)); - User::LeaveIfError(mBitmapFromFile->Create(frameInfo.iOverallSizeInPixels, - frameInfo.iFrameDisplayMode)); - - mImageDecoder->Convert(&iStatus, *mBitmapFromFile, 0); - mCurrentOperation = EConvertBitmapFromFile; - SetActive(); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -void CGraphicsSalingHandler::DoCancel() -{ - switch (mCurrentOperation) { - case EConvertBitmapFromFile: - mImageDecoder->Cancel(); - break; - case EScale: - mBitmapScaler->Cancel(); - break; - } - mNotify.ImageReadyCallBack(KErrCancel, 0); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -void CGraphicsSalingHandler::RunL() -{ - if(iStatus.Int()){ - mNotify.ImageReadyCallBack(iStatus.Int(), 0); - return; - } - - switch (mCurrentOperation) { - case EConvertBitmapFromFile: { - delete mImageDecoder; - mImageDecoder = 0; - - mBitmapOutput = new (ELeave)CFbsBitmap(); - User::LeaveIfError(mBitmapOutput->Create(Scaling(), mBitmapFromFile->DisplayMode())); - mBitmapScaler->Scale(&iStatus, *mBitmapFromFile, *mBitmapOutput, EFalse); - mCurrentOperation = EScale; - SetActive(); - break; - } - case EScale: { - mCurrentOperation = ENone; - - delete mBitmapScaler; - mBitmapScaler = 0; - - delete mBitmapFromFile; - mBitmapFromFile = 0; - - if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatioByExpanding) { - User::LeaveIfError(mBitmapOutput->Resize(mNewSize)); - } - - mNotify.ImageReadyCallBack(iStatus.Int(), mBitmapOutput); - break; - } - } -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -TSize CGraphicsSalingHandler::Scaling() -{ - TSize originalSize = mBitmapFromFile->SizeInPixels(); - float widthFactor = mNewSize.iWidth / (float)originalSize.iWidth; - float heightFactor = mNewSize.iHeight / (float)originalSize.iHeight; - - TSize retSize(mNewSize); - - if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatio) { - retSize = (widthFactor < heightFactor) ? - TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight) : - TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight); - } else if (mKindOfScaling == CGraphicsSalingHandler::EKeepAspectRatioByExpanding) { - retSize = (widthFactor < heightFactor) ? - TSize(heightFactor * originalSize.iWidth, mNewSize.iHeight) : - TSize(mNewSize.iWidth, widthFactor * originalSize.iHeight); - } - return retSize; -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// -TInt CGraphicsSalingHandler::RunError(TInt aError) -{ - mNotify.ImageReadyCallBack(aError, 0); - return KErrNone; -} diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activityobservertask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -125,3 +125,12 @@ mMsg.WriteL(KResponseDataSizeOffset, TPckgBuf(mData.Length()));//write data size mMsg.WriteL(KResponseIdOffset, TPckgBuf(this));//task identyfier } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool CActivityObserverTask::IsSessionTask(const CSession2* session) +{ + return mMsg.Session() == session ? ETrue : EFalse; +} diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/src/activityserver.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/activityserver.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activityserver.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -114,3 +114,17 @@ { return mObservers; } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CActivityServer::RemoveNotValidTasks(const CSession2* session) +{ + for (TInt i=mObservers.Count()-1; i>=0; --i) { + if( mObservers[i]->IsSessionTask(session) ) { + delete mObservers[i]; + mObservers.Remove(i); + } + } +} diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitysession.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -48,7 +48,7 @@ // CActivitySession::~CActivitySession() { - mRunningTasks.ResetAndDestroy(); + RemoveNotValidTasks(this); } // ----------------------------------------------------------------------------- @@ -150,3 +150,13 @@ { return mRunningTasks; } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CActivitySession::RemoveNotValidTasks(const CSession2* session) +{ + mRunningTasks.ResetAndDestroy(); + mTasksStorage.RemoveNotValidTasks(this); +} diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitystorageasynctask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -128,3 +128,12 @@ TPckgBuf(this));//task identyfier } } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool CActivityStorageAsyncTask::IsSessionTask(const CSession2* /*session*/) +{ + return EFalse; +} diff -r 397d00875918 -r 156f692b1687 activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp --- a/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activitydatabase/hsactivitydbserver/src/activitythumbnailtask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -76,12 +76,12 @@ mime.CreateL(mMsg.GetDesLengthL(3)); mMsg.ReadL(3, mime); - mService = CGraphicsSalingHandler::NewL(*this, - session, - path, - mime, - TSize(width(), height()), - CGraphicsSalingHandler::EKeepAspectRatio); + mService = CTsGraphicFileScalingHandler::NewL(*this, + session, + path, + mime, + TSize(width(), height()), + CTsGraphicFileScalingHandler::EKeepAspectRatio); CleanupStack::PopAndDestroy(&mime); CleanupStack::PopAndDestroy(&path); @@ -124,3 +124,11 @@ { } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool CActivityThumbnailTask::IsSessionTask(const CSession2* session) +{ + return mMsg.Session() == session ? ETrue : EFalse; +} diff -r 397d00875918 -r 156f692b1687 activityfw/activityserviceplugin/activityserviceplugin.pro --- a/activityfw/activityserviceplugin/activityserviceplugin.pro Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activityserviceplugin/activityserviceplugin.pro Fri Jun 11 13:58:37 2010 +0300 @@ -21,8 +21,6 @@ include(activityserviceplugin.pri) INCLUDEPATH += ./inc \ - #../cautils/inc \ - #../extinc \ HEADERS += ./inc/activityserviceplugin.h \ ./inc/activitydatastorage.h \ @@ -45,7 +43,7 @@ SOURCES += ./s60/src/applicationlauncher_p.cpp - HEADERS += ./s60/src/applicationlauncher_p.h + HEADERS += ./s60/inc/applicationlauncher_p.h LIBS += -lapparc \ -lapgrfx \ @@ -76,4 +74,8 @@ xml.path = $$RESOURCE_FILES_DIR/activity DEPLOYMENT += xml + + #temporary workaround + BLD_INF_RULES.prj_exports += "data/activityserviceplugin.xml z:/resource/activity/activityserviceplugin.xml" + } diff -r 397d00875918 -r 156f692b1687 activityfw/activityserviceplugin/src/activityclient.cpp --- a/activityfw/activityserviceplugin/src/activityclient.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/activityserviceplugin/src/activityclient.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -20,9 +20,7 @@ ActivityClient::ActivityClient(QObject *parent) : QObject(parent) { - qDebug("[JCH] activity client creation started"); d_ptr = new ActivityClientPrivate(this); - qDebug("[JCH] activity client creation stopped"); } ActivityClient::~ActivityClient() diff -r 397d00875918 -r 156f692b1687 activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/activityfw/orbitintegration/hbactivityplugin/hbactivityplugininterface.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,51 @@ +/* +* 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 HBACTIVITYPLUGININTERFACE_H +#define HBACTIVITYPLUGININTERFACE_H + +#include +#include +#include +#include +#include +#include + +class HbActivityPluginInterface : public QObject +{ + Q_OBJECT + +public: + HbActivityPluginInterface(QObject *parent = 0) : QObject(parent) {} + +public: + virtual bool addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) = 0; + virtual bool removeActivity(const QString &activityId) = 0; + virtual bool updateActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) = 0; + virtual QList activities() = 0; + virtual QVariant activityData(const QString &activityId) = 0; + virtual bool waitActivity() = 0; + virtual QVariantHash parseCommandLine(const QStringList &commandLineParams) = 0; + +signals: + void activityRequested(const QString &activityId); + +}; + +Q_DECLARE_INTERFACE(HbActivityPluginInterface, "HbActivityPluginInterface/1.0") + +#endif // HBACTIVITYPLUGININTERFACE_H diff -r 397d00875918 -r 156f692b1687 activityfw/rom/activitymanager_core.iby --- a/activityfw/rom/activitymanager_core.iby Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/rom/activitymanager_core.iby Fri Jun 11 13:58:37 2010 +0300 @@ -23,6 +23,7 @@ file=ABI_DIR\BUILD_DIR\hsactivitydbserver.exe PROGRAMS_DIR\hsactivitydbserver.exe file=ABI_DIR\BUILD_DIR\hsactivitydbclient.dll SHARED_LIB_DIR\hsactivitydbclient.dll +file=ABI_DIR\BUILD_DIR\tsutils.dll SHARED_LIB_DIR\tsutils.dll file=ABI_DIR\BUILD_DIR\hbactivityplugin.dll SHARED_LIB_DIR\hbactivityplugin.dll data=\epoc32\data\z\resource\qt\plugins\hbactivityplugin.qtplugin resource\qt\plugins\hbactivityplugin.qtplugin diff -r 397d00875918 -r 156f692b1687 activityfw/sis/activitymanager.pkg --- a/activityfw/sis/activitymanager.pkg Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/sis/activitymanager.pkg Fri Jun 11 13:58:37 2010 +0300 @@ -32,6 +32,7 @@ "/epoc32/release/armv5/urel/hsactivitydbserver.exe" - "!:\sys\bin\hsactivitydbserver.exe" "/epoc32/release/armv5/urel/hsactivitydbclient.dll" - "!:\sys\bin\hsactivitydbclient.dll" +"/epoc32/release/armv5/urel/tsutils.dll" - "!:\sys\bin\tsutils.dll" "/epoc32/release/armv5/urel/hbactivityplugin.dll" - "!:\sys\bin\hbactivityplugin.dll" "/epoc32/data/z/resource/qt/plugins/hbactivityplugin.qtplugin"-"!:\resource\qt\plugins\hbactivityplugin.qtplugin" diff -r 397d00875918 -r 156f692b1687 activityfw/sis/stubs/activitymanager_stub.pkg --- a/activityfw/sis/stubs/activitymanager_stub.pkg Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/sis/stubs/activitymanager_stub.pkg Fri Jun 11 13:58:37 2010 +0300 @@ -38,6 +38,7 @@ "" - "Z:\sys\bin\hsactivitydbserver.exe" "" - "Z:\sys\bin\hsactivitydbclient.dll" +"" - "Z:\sys\bin\tsutils.dll" "" - "Z:\sys\bin\hbactivityplugin.dll" "" - "Z:\resource\qt\plugins\hbactivityplugin.qtplugin" \ No newline at end of file diff -r 397d00875918 -r 156f692b1687 activityfw/sis/stubs/activitymanager_stub.sis Binary file activityfw/sis/stubs/activitymanager_stub.sis has changed diff -r 397d00875918 -r 156f692b1687 activityfw/tsutils/bwins/tsutilsu.def --- a/activityfw/tsutils/bwins/tsutilsu.def Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/tsutils/bwins/tsutilsu.def Fri Jun 11 13:58:37 2010 +0300 @@ -1,5 +1,7 @@ EXPORTS ?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 1 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling) ?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@AAVRFs@@ABVTDesC16@@ABVTDesC8@@ABVTSize@@W4TKindOfScaling@1@@Z @ 2 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class RFs &, class TDesC16 const &, class TDesC8 const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling) - ??1CTsGraphicFileScalingHandler@@UAE@XZ @ 3 NONAME ; CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler(void) + ?NewLC@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@ABVCFbsBitmap@@ABVTSize@@W4TKindOfScaling@1@@Z @ 3 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewLC(class MImageReadyCallBack &, class CFbsBitmap const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling) + ?NewL@CTsGraphicFileScalingHandler@@SAPAV1@AAVMImageReadyCallBack@@ABVCFbsBitmap@@ABVTSize@@W4TKindOfScaling@1@@Z @ 4 NONAME ; class CTsGraphicFileScalingHandler * CTsGraphicFileScalingHandler::NewL(class MImageReadyCallBack &, class CFbsBitmap const &, class TSize const &, enum CTsGraphicFileScalingHandler::TKindOfScaling) + ??1CTsGraphicFileScalingHandler@@UAE@XZ @ 5 NONAME ; CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler(void) diff -r 397d00875918 -r 156f692b1687 activityfw/tsutils/eabi/tsutilsu.def --- a/activityfw/tsutils/eabi/tsutilsu.def Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/tsutils/eabi/tsutilsu.def Fri Jun 11 13:58:37 2010 +0300 @@ -1,9 +1,11 @@ EXPORTS _ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 1 NONAME - _ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 2 NONAME - _ZN28CTsGraphicFileScalingHandlerD0Ev @ 3 NONAME - _ZN28CTsGraphicFileScalingHandlerD1Ev @ 4 NONAME - _ZN28CTsGraphicFileScalingHandlerD2Ev @ 5 NONAME - _ZTI28CTsGraphicFileScalingHandler @ 6 NONAME - _ZTV28CTsGraphicFileScalingHandler @ 7 NONAME + _ZN28CTsGraphicFileScalingHandler4NewLER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 2 NONAME + _ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackR3RFsRK7TDesC16RK6TDesC8RK5TSizeNS_14TKindOfScalingE @ 3 NONAME + _ZN28CTsGraphicFileScalingHandler5NewLCER19MImageReadyCallBackRK10CFbsBitmapRK5TSizeNS_14TKindOfScalingE @ 4 NONAME + _ZN28CTsGraphicFileScalingHandlerD0Ev @ 5 NONAME + _ZN28CTsGraphicFileScalingHandlerD1Ev @ 6 NONAME + _ZN28CTsGraphicFileScalingHandlerD2Ev @ 7 NONAME + _ZTI28CTsGraphicFileScalingHandler @ 8 NONAME + _ZTV28CTsGraphicFileScalingHandler @ 9 NONAME diff -r 397d00875918 -r 156f692b1687 activityfw/tsutils/group/bld.inf --- a/activityfw/tsutils/group/bld.inf Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/tsutils/group/bld.inf Fri Jun 11 13:58:37 2010 +0300 @@ -18,7 +18,7 @@ DEFAULT PRJ_EXPORTS -../inc/tsgraphicfilescalinghandler.h +../inc/tsgraphicfilescalinghandler.h |../../../inc/tsgraphicfilescalinghandler.h PRJ_MMPFILES tsutils.mmp diff -r 397d00875918 -r 156f692b1687 activityfw/tsutils/inc/tsgraphicfilescalinghandler.h --- a/activityfw/tsutils/inc/tsgraphicfilescalinghandler.h Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/tsutils/inc/tsgraphicfilescalinghandler.h Fri Jun 11 13:58:37 2010 +0300 @@ -31,31 +31,70 @@ class CImageDecoder; class CFbsBitmap; +/** + * Interface to observer contain + * ImageReadyCallBack function return error code and scaled/resized bitmap. + */ class MImageReadyCallBack { public: - virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ) = 0; + virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap) = 0; }; +/** + * Class to scaling graphic file/s. + */ class CTsGraphicFileScalingHandler : public CActive { public: + /** + * Kind of graphic file scaling. + * EIgnoreAspectRatio - the file is scaled to size, aspect ratio isn't preserving. + * EKeepAspectRatio - the file is scaled to a rectangle as large as possible inside size + * preserving the aspect ratio. + * EKeepAspectRatioByExpanding - the file is scaled to a rectangle as small as possible outside size + * preserving the aspect ratio. + */ + enum TKindOfScaling + { + EIgnoreAspectRatio = 0, + EKeepAspectRatio = 1, + EKeepAspectRatioByExpanding = 2, + }; -enum TCurrentOperation{ +private: + /** + * Active object current operation. + */ + enum TCurrentOperation{ ENone = 0, EConvertBitmapFromFile = 1, EScale = 2 }; -enum TKindOfScaling -{ - EIgnoreAspectRatio = 0, - EKeepAspectRatio = 1, - EKeepAspectRatioByExpanding = 2, -}; - +public: + /** + * Destructor. + */ IMPORT_C ~CTsGraphicFileScalingHandler(); + /** + * All constructors initialise active object asynchronous operation + * by calling ConstructL function. + * 1st group - decoding and scaling. + * 2nd group - scaling. + */ + + /** + * 1st group. + * Exported from dll constructors for activation graphic file scaling. + * aNotify - reference to observer implementation. + * aFs - reference to file server session. + * aFileName - path to graphic file. + * aMimeType - mime type of graphic file. + * aNewSize - new size of output graphic file. + * aKindOfScaling - kind of graphic file scaling described above. + */ IMPORT_C static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify, RFs &aFs, const TDesC &aFileName, @@ -69,27 +108,103 @@ const TSize &aNewSize, TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio); + /** + * 2nd group. + * Exported from dll constructors for activation graphic file scaling. + * aNotify - reference to observer implementation. + * aImputFbsBitmap - reference to pattern CFbsBitmap. + * aNewSize - new size of output graphic file. + * aKindOfScaling - kind of graphic file scaling described above. + */ + IMPORT_C static CTsGraphicFileScalingHandler* NewL(MImageReadyCallBack &aNotify, + const CFbsBitmap &aImputFbsBitmap, + const TSize &aNewSize, + TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio); + IMPORT_C static CTsGraphicFileScalingHandler* NewLC(MImageReadyCallBack &aNotify, + const CFbsBitmap &aImputFbsBitmap, + const TSize &aNewSize, + TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio); + protected: + /** + * Cancels the wait for completion of an outstanding request. + */ void DoCancel(); + /** + * Handles an active object’s request completion event. + */ void RunL(); + /** + * Handles a leave occurring in the request completion event handler RunL(). + */ TInt RunError(TInt); private: + /** + * Functions construct active objest instance and made asynchronous operation/s. + * Parameters - the same meaning as in appropriate NewL/NewLC functions. + */ void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType); + void ConstructL(const CFbsBitmap &aImputFbsBitmap); + /** + * Private constructor. + * Parameters - the same meaning as in appropriate NewL/NewLC functions. + */ CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify, const TSize &aNewSize, TKindOfScaling aKindOfScaling = CTsGraphicFileScalingHandler::EIgnoreAspectRatio); - TSize Scaling(); + /** + * Action to made before decoding graphic file operation. + * Parameters - the same meaning as in appropriate NewL/NewLC functions. + */ + void DecodingOperationL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType); + /** + * Action to made before scaling graphic file operation. + */ + void ScalingOperationL(); + /** + * Algorithm to determine output bitmap (returned in ImageReadyCallBack) size + * after scaling operation. + */ + TSize NewSizeToScalingOperation(); + /** + * Fix for TDisplayMode == EColor16MAP not supported by scaling operation! + * ! ! ! ADD OTHER NOT SUPPORTED DISPLAY MODES ! ! ! + */ + void FixForDisplayModeNotSupportedByScalingOperation(); private: + /** + * Reference to observer implementation - return error code and output bitmap. + */ MImageReadyCallBack &mNotify; + /** + * Pointer to decoder used by decoding graphic file algorithm. + */ CImageDecoder *mImageDecoder; - CFbsBitmap *mBitmapFromFile; - CFbsBitmap *mBitmapOutput; + /** + * Pointer to input bitmap - before decoding/scaling operation/s. + */ + CFbsBitmap *mInputBitmap; + /** + * Pointer to output bitmap - returned in mNotify object. + */ + CFbsBitmap *mOutputBitmap; + /** + * Pointer to CBitmapScaler calss used by scaling graphic file algorithm. + */ CBitmapScaler *mBitmapScaler; + /** + * New size of output graphic file. + */ TSize mNewSize; + /** + * Kind of graphic file scaling described above. + */ TBool mKindOfScaling; - + /** + * Active object current operation. + */ TCurrentOperation mCurrentOperation; }; diff -r 397d00875918 -r 156f692b1687 activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp --- a/activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp Thu May 27 13:11:12 2010 +0300 +++ b/activityfw/tsutils/src/tsgraphicfilescalinghandler.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -21,15 +21,16 @@ // ----------------------------------------------------------------------------- // CTsGraphicFileScalingHandler::CTsGraphicFileScalingHandler(MImageReadyCallBack &aNotify, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling - /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) : + const TSize &aNewSize, + TKindOfScaling aKindOfScaling + /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) : CActive(EPriorityNormal), mNotify(aNotify), mNewSize(aNewSize), mKindOfScaling(aKindOfScaling), mCurrentOperation(ENone) { + CActiveScheduler::Add(this); } // ----------------------------------------------------------------------------- @@ -38,8 +39,8 @@ EXPORT_C CTsGraphicFileScalingHandler::~CTsGraphicFileScalingHandler() { Cancel(); - delete mBitmapFromFile; - delete mBitmapOutput; + delete mInputBitmap; + delete mOutputBitmap; delete mImageDecoder; delete mBitmapScaler; } @@ -48,19 +49,19 @@ // ----------------------------------------------------------------------------- // EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(MImageReadyCallBack &aNotify, - RFs &aFs, - const TDesC &aFileName, - const TDesC8& aMimeType, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling - /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) + RFs &aFs, + const TDesC &aFileName, + const TDesC8& aMimeType, + const TSize &aNewSize, + TKindOfScaling aKindOfScaling + /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) { CTsGraphicFileScalingHandler *self = CTsGraphicFileScalingHandler::NewLC(aNotify, - aFs, - aFileName, - aMimeType, - aNewSize, - aKindOfScaling); + aFs, + aFileName, + aMimeType, + aNewSize, + aKindOfScaling); CleanupStack::Pop(); return self; } @@ -69,16 +70,16 @@ // ----------------------------------------------------------------------------- // EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(MImageReadyCallBack &aNotify, - RFs &aFs, - const TDesC &aFileName, - const TDesC8& aMimeType, - const TSize &aNewSize, - TKindOfScaling aKindOfScaling - /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) + RFs &aFs, + const TDesC &aFileName, + const TDesC8& aMimeType, + const TSize &aNewSize, + TKindOfScaling aKindOfScaling + /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) { CTsGraphicFileScalingHandler *self = new (ELeave) CTsGraphicFileScalingHandler(aNotify, - aNewSize, - aKindOfScaling); + aNewSize, + aKindOfScaling); CleanupStack::PushL(self); self->ConstructL(aFs, aFileName, aMimeType); @@ -99,24 +100,63 @@ User::Leave(KErrBadName); } - if(0>=mNewSize.iWidth || 0>=mNewSize.iHeight) { + if (0>=mNewSize.iWidth || 0>=mNewSize.iHeight) { User::Leave(KErrCorrupt); } - CActiveScheduler::Add(this); + mInputBitmap = new(ELeave)CFbsBitmap(); + DecodingOperationL(aFs, aFileName, aMimeType); + SetActive(); +} - mBitmapScaler = CBitmapScaler::NewL(); - mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality); +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewL(MImageReadyCallBack &aNotify, + const CFbsBitmap &aImputFbsBitmap, + const TSize &aNewSize, + TKindOfScaling aKindOfScaling + /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) +{ + CTsGraphicFileScalingHandler *self = CTsGraphicFileScalingHandler::NewLC(aNotify, + aImputFbsBitmap, + aNewSize, + aKindOfScaling); + CleanupStack::Pop(); + return self; +} - // convert *.png to bitmap - mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType); - mBitmapFromFile = new(ELeave)CFbsBitmap(); - const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0)); - User::LeaveIfError(mBitmapFromFile->Create(frameInfo.iOverallSizeInPixels, - frameInfo.iFrameDisplayMode)); +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +EXPORT_C CTsGraphicFileScalingHandler* CTsGraphicFileScalingHandler::NewLC(MImageReadyCallBack &aNotify, + const CFbsBitmap &aImputFbsBitmap, + const TSize &aNewSize, + TKindOfScaling aKindOfScaling + /* = CTsGraphicFileScalingHandler::EIgnoreAspectRatio*/) +{ + CTsGraphicFileScalingHandler *self = new (ELeave) CTsGraphicFileScalingHandler(aNotify, + aNewSize, + aKindOfScaling); - mImageDecoder->Convert(&iStatus, *mBitmapFromFile, 0); - mCurrentOperation = EConvertBitmapFromFile; + CleanupStack::PushL(self); + self->ConstructL(aImputFbsBitmap); + return self; +} + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void CTsGraphicFileScalingHandler::ConstructL(const CFbsBitmap &aImputFbsBitmap) +{ + if (0>=mNewSize.iWidth || 0>=mNewSize.iHeight) { + User::Leave(KErrCorrupt); + } + + mInputBitmap = new(ELeave)CFbsBitmap(); + User::LeaveIfError(mInputBitmap->Duplicate(aImputFbsBitmap.Handle())); + + ScalingOperationL(); SetActive(); } @@ -147,11 +187,8 @@ case EConvertBitmapFromFile: { delete mImageDecoder; mImageDecoder = 0; - - mBitmapOutput = new (ELeave)CFbsBitmap(); - User::LeaveIfError(mBitmapOutput->Create(Scaling(), mBitmapFromFile->DisplayMode())); - mBitmapScaler->Scale(&iStatus, *mBitmapFromFile, *mBitmapOutput, EFalse); - mCurrentOperation = EScale; + + ScalingOperationL(); SetActive(); break; } @@ -161,14 +198,14 @@ delete mBitmapScaler; mBitmapScaler = 0; - delete mBitmapFromFile; - mBitmapFromFile = 0; + delete mInputBitmap; + mInputBitmap = 0; if (mKindOfScaling == CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding) { - User::LeaveIfError(mBitmapOutput->Resize(mNewSize)); + User::LeaveIfError(mOutputBitmap->Resize(mNewSize)); } - mNotify.ImageReadyCallBack(iStatus.Int(), mBitmapOutput); + mNotify.ImageReadyCallBack(iStatus.Int(), mOutputBitmap); break; } } @@ -177,9 +214,51 @@ // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // -TSize CTsGraphicFileScalingHandler::Scaling() +void CTsGraphicFileScalingHandler::DecodingOperationL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType) +{ + // convert *.png to bitmap + mImageDecoder = CImageDecoder::FileNewL(aFs, aFileName, aMimeType); + const TFrameInfo frameInfo(mImageDecoder->FrameInfo(0)); + mInputBitmap->Reset(); + User::LeaveIfError(mInputBitmap->Create(frameInfo.iOverallSizeInPixels, + frameInfo.iFrameDisplayMode)); + + mImageDecoder->Convert(&iStatus, *mInputBitmap, 0); + mCurrentOperation = EConvertBitmapFromFile; +} + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void CTsGraphicFileScalingHandler::ScalingOperationL() { - TSize originalSize = mBitmapFromFile->SizeInPixels(); + mBitmapScaler = CBitmapScaler::NewL(); + mBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality); + + FixForDisplayModeNotSupportedByScalingOperation(); + + mOutputBitmap = new (ELeave)CFbsBitmap(); + User::LeaveIfError(mOutputBitmap->Create(NewSizeToScalingOperation(), mInputBitmap->DisplayMode())); + mBitmapScaler->Scale(&iStatus, *mInputBitmap, *mOutputBitmap, EFalse); + mCurrentOperation = EScale; +} + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void CTsGraphicFileScalingHandler::FixForDisplayModeNotSupportedByScalingOperation() +{ + if (EColor16MAP == mInputBitmap->DisplayMode()) { + mInputBitmap->SetDisplayMode(EColor16MA); + } +} + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +TSize CTsGraphicFileScalingHandler::NewSizeToScalingOperation() +{ + TSize originalSize = mInputBitmap->SizeInPixels(); float widthFactor = mNewSize.iWidth / (float)originalSize.iWidth; float heightFactor = mNewSize.iHeight / (float)originalSize.iHeight; diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/inc/caclient_defines.h --- a/contentstorage/caclient/inc/caclient_defines.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/inc/caclient_defines.h Fri Jun 11 13:58:37 2010 +0300 @@ -15,9 +15,14 @@ * */ +#ifndef CACLIENT_DEFINES_H +#define CACLIENT_DEFINES_H + const char APPLICATION_UID_ATTRIBUTE_NAME[] = "application:uid"; const char APPLICATION_ENTRY_TYPE_NAME[] = "application"; const char WIDGET_ENTRY_TYPE_NAME[] = "widget"; const char URL_ENTRY_TYPE_NAME[] = "url"; const char PACKAGE_ENTRY_TYPE_NAME[] = "package"; const char TEMPLATED_APPLICATION_ENTRY_TYPE_NAME[] = "templatedApplication"; + +#endif //CACLIENT_DEFINES_H diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/inc/cahandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/inc/cahandler.h Fri Jun 11 13:58:37 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: + * + */ +#ifndef CAHANDLER_H +#define CAHANDLER_H + +#include +#include +#include + +class QString; +class CaEntry; + +class CaHandler // move this header to caclient/inc +{ +public: + virtual ~CaHandler() {} + virtual int execute(const CaEntry &entry, + const QString &commandName) = 0; +}; + +Q_DECLARE_INTERFACE(CaHandler, "com.nokia.homescreen.ICommandHandler") + +#endif //CAHANDLER_H diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/inc/cahandlerloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/inc/cahandlerloader.h Fri Jun 11 13:58:37 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: + * + */ + +#ifndef CAHANDLERLOADER_H +#define CAHANDLERLOADER_H + +class QString; +class CaHandler; + +class CaHandlerLoader +{ +public: + virtual ~CaHandlerLoader(); + virtual CaHandler *loadHandler(const QString &entryTypeName, + const QString &commandName) = 0; +}; + +#endif // CAHANDLERLOADER_H diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/inc/cahandlerproxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/inc/cahandlerproxy.h Fri Jun 11 13:58:37 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 CAHANDLERPROXY_H +#define CAHANDLERPROXY_H + +#include +#include +#include + +#include + +#include "cahandlerloader.h" + +class CaEntry; + +class CaHandlerProxy +{ +public: + + ~CaHandlerProxy(); + + explicit CaHandlerProxy(const QSharedPointer &loader); + + ErrorCode execute(const CaEntry &entry, const QString &commandName); + +private: + CaHandler *getHandler(const CaEntry &entry, + const QString &commandName); + + typedef QMap > ImplementationMap; + typedef ImplementationMap::iterator ImplementationMapIterator; + + QSharedPointer mLoader; + ImplementationMap mImplementationMap; +}; + +#endif // CAHANDLERPROXY_H diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/inc/caitemmodel_p.h --- a/contentstorage/caclient/inc/caitemmodel_p.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/inc/caitemmodel_p.h Fri Jun 11 13:58:37 2010 +0300 @@ -84,6 +84,7 @@ void connectSlots(); void disconnectSlots(); void reconnectSlots(); + void emitEmpty(int previousCount); private slots: diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/inc/caqtsfhandlerloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/inc/caqtsfhandlerloader.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,38 @@ +/* + * 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 CA_QT_SF_HANDLER_LOADER_H +#define CA_QT_SF_HANDLER_LOADER_H + +#include +#include +#include + +#include "cahandlerloader.h" + +class CaQtSfHandlerLoader: + public CaHandlerLoader +{ +public: + CaQtSfHandlerLoader(); + CaHandler *loadHandler(const QString &entryTypeName, + const QString &commandName); +protected: + void registerPlugins() const; +}; + +#endif diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/inc/caservice_p.h --- a/contentstorage/caclient/inc/caservice_p.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/inc/caservice_p.h Fri Jun 11 13:58:37 2010 +0300 @@ -27,6 +27,7 @@ class CaService; class CaNotifier; class CaClientNotifierProxy; +class CaHandlerProxy; class CaServicePrivate { @@ -69,6 +70,9 @@ CaService *const m_q; + // Command handler. + QSharedPointer mCommandHandler; + CaClientProxy *mProxy; CaClientNotifierProxy *mNotifierProxy; diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/inc/cabitmapadapter.h --- a/contentstorage/caclient/s60/inc/cabitmapadapter.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/s60/inc/cabitmapadapter.h Fri Jun 11 13:58:37 2010 +0300 @@ -43,13 +43,6 @@ static CFbsBitmap *copyBitmapLC(CFbsBitmap *input); /** - * Convert bitmap - * @param input bitmap. - * @return qPixmap. - */ - static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *aBitmap); - - /** * Convert from bitmap and mask to qpixmap * @param input bitmap. * @param pixmap to prepare. diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/inc/caclientproxy.h --- a/contentstorage/caclient/s60/inc/caclientproxy.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/s60/inc/caclientproxy.h Fri Jun 11 13:58:37 2010 +0300 @@ -130,16 +130,6 @@ QList &sourceIdList); /** - * Method for executing command - * - * @param entry entry on wchich command will be executed - * @param command command to execute - * @return error code - */ - ErrorCode executeCommand(const CaEntry &entry, - const QString &command); - - /** * Method for touching entry. * * @param aEntry entry to touch @@ -235,9 +225,6 @@ // Own. RCaClientSession mSession; - // Command handler. - QSharedPointer mCommandHandler; - // Mutex to serialize access to mSessions. QMutex mMutex; }; diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/inc/cahandler.h --- a/contentstorage/caclient/s60/inc/cahandler.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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 CA_HANDLER_H -#define CA_HANDLER_H - -#include -#include -#include - -class CCaInnerEntry; -class QString; - -class CaHandler -{ -public: - virtual ~CaHandler() {} - virtual int execute(CCaInnerEntry &innerEntry, - const QString &commandName) = 0; -}; - -Q_DECLARE_INTERFACE(CaHandler, "com.nokia.homescreen.ICommandHandler") - -#endif diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/inc/cahandlerloader.h --- a/contentstorage/caclient/s60/inc/cahandlerloader.h Thu May 27 13:11:12 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 CA_HANDLER_LOADER_H -#define CA_HANDLER_LOADER_H - -#include - -class QString; -class CaHandler; - -class CaHandlerLoader -{ -public: - virtual ~CaHandlerLoader(); - virtual CaHandler *loadHandler(const QString &entryTypeName, - const QString &commandName) = 0; -}; - -#endif diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/inc/cahandlerproxy.h --- a/contentstorage/caclient/s60/inc/cahandlerproxy.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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 CA_HANDLER_PROXY_H -#define CA_HANDLER_PROXY_H - -#include -#include -#include -#include -#include - -#include "cahandlerloader.h" - -class CaEntry; - -class CaHandlerProxy -{ -public: - - ~CaHandlerProxy(); - - explicit CaHandlerProxy(CaHandlerLoader *loader); - - TInt execute(const CaEntry &entry, const QString &commandName); - -private: - CaHandler *getHandler(const CaEntry &entry, - const QString &commandName); - - typedef QMap > ImplementationMap; - typedef ImplementationMap::iterator ImplementationMapIterator; - - QSharedPointer mLoader; - ImplementationMap mImplementationMap; -}; - -#endif diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/inc/caqtsfhandlerloader.h --- a/contentstorage/caclient/s60/inc/caqtsfhandlerloader.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +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 CA_QT_SF_HANDLER_LOADER_H -#define CA_QT_SF_HANDLER_LOADER_H - -#include -#include -#include - -#include "cahandlerloader.h" - -class CaQtSfHandlerLoader: - public CaHandlerLoader -{ -public: - CaQtSfHandlerLoader(); - CaHandler *loadHandler(const QString &entryTypeName, - const QString &commandName); -protected: - void registerPlugins() const; -}; - -#endif diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/src/cabitmapadapter.cpp --- a/contentstorage/caclient/s60/src/cabitmapadapter.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/s60/src/cabitmapadapter.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -31,60 +31,6 @@ #include "cadef.h" #include "cabitmapadapter.h" -static QImage::Format TDisplayMode2Format(TDisplayMode mode) -{ - QImage::Format format; - switch (mode) { - case EGray2: - format = QImage::Format_MonoLSB; - break; - case EColor256: - case EGray256: - format = QImage::Format_Indexed8; - break; - case EColor4K: - format = QImage::Format_RGB444; - break; - case EColor64K: - format = QImage::Format_RGB16; - break; - case EColor16M: - format = QImage::Format_RGB888; - break; - case EColor16MU: - format = QImage::Format_RGB32; - break; - case EColor16MA: - format = QImage::Format_ARGB32; - break; - case EColor16MAP: - format = QImage::Format_ARGB32_Premultiplied; - break; - default: - format = QImage::Format_Invalid; - break; - } - return format; -} - -QPixmap CaBitmapAdapter::fromSymbianCFbsBitmap(CFbsBitmap *aBitmap) -{ - aBitmap->BeginDataAccess(); - uchar *data = (uchar *)aBitmap->DataAddress(); - TSize size = aBitmap->SizeInPixels(); - TDisplayMode displayMode = aBitmap->DisplayMode(); - - // QImage format must match to bitmap format - QImage image(data, size.iWidth, size.iHeight, TDisplayMode2Format( - displayMode)); - aBitmap->EndDataAccess(); - - // No data copying happens because - // image format matches native OpenVG format. - // So QPixmap actually points to CFbsBitmap data. - return QPixmap::fromImage(image); -} - // ----------------------------------------------------------------------------- // copying compressed bitmap //---------------------------------------------------------------------------- @@ -108,17 +54,19 @@ CFbsBitmap* fbsMask, QPixmap& pixmap) { if (fbsBitmap->Header().iCompression == ENoBitmapCompression) { - pixmap = CaBitmapAdapter::fromSymbianCFbsBitmap(fbsBitmap); - QPixmap mask = CaBitmapAdapter::fromSymbianCFbsBitmap(fbsMask); + pixmap = pixmap.fromSymbianCFbsBitmap(fbsBitmap); + QPixmap mask; + mask = mask.fromSymbianCFbsBitmap(fbsMask); pixmap.setAlphaChannel(mask); } else { // we need special handling for icons in 9.2 (NGA) // let's hope that in future it will be in QT code CFbsBitmap *temp(NULL); temp = CaBitmapAdapter::copyBitmapLC(fbsBitmap); - pixmap = CaBitmapAdapter::fromSymbianCFbsBitmap(temp); + pixmap = pixmap.fromSymbianCFbsBitmap(temp); CleanupStack::PopAndDestroy(); temp = CaBitmapAdapter::copyBitmapLC(fbsMask); - QPixmap mask = CaBitmapAdapter::fromSymbianCFbsBitmap(temp); + QPixmap mask; + mask = mask.fromSymbianCFbsBitmap(temp); CleanupStack::PopAndDestroy(); pixmap.setAlphaChannel(mask); } diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/src/caclientproxy.cpp --- a/contentstorage/caclient/s60/src/caclientproxy.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/s60/src/caclientproxy.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -38,8 +38,7 @@ //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- -CaClientProxy::CaClientProxy(): - mCommandHandler(new CaHandlerProxy(new CaQtSfHandlerLoader())) +CaClientProxy::CaClientProxy() { } @@ -169,20 +168,6 @@ //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- -ErrorCode CaClientProxy::executeCommand(const CaEntry &entry, - const QString &command) -{ - TInt error = mCommandHandler->execute(entry, command); - - USE_QDEBUG_IF(error) << "CaClientProxy::executeCommand - Error (" - << error << ")"; - - return CaObjectAdapter::convertErrorCode(error); -} - -//---------------------------------------------------------------------------- -// -//---------------------------------------------------------------------------- ErrorCode CaClientProxy::touch(const CaEntry &aEntry) { TRAPD(error, touchL(aEntry)); diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/src/cahandlerloader.cpp --- a/contentstorage/caclient/s60/src/cahandlerloader.cpp Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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 "cahandlerloader.h" - -/*! - \class CaHandlerLoader - \ingroup - \brief Interface for class of objects providing command handlers. - - \sa CaHandlerLoader -*/ - -/*! - Destructor. -*/ -CaHandlerLoader::~CaHandlerLoader() -{ -} - - diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/src/cahandlerproxy.cpp --- a/contentstorage/caclient/s60/src/cahandlerproxy.cpp Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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 "cahandler.h" -#include "cahandlerproxy.h" -#include "cahandlerloader.h" -#include "cainnerentry.h" -#include "caobjectadapter.h" - -/*! - \class CaHandlerProxy - \ingroup - \brief Forwards execute request to an implemenation provided by specific handler loader. - - \sa CaHandlerLoader -*/ - -/*! - Destructor. -*/ -CaHandlerProxy::~CaHandlerProxy() -{ -} - - -/*! - Constructs handler proxy. - \param loader Provides handler implementations. It has to be pointer to a valid object. -*/ -CaHandlerProxy::CaHandlerProxy(CaHandlerLoader *loader): - mLoader(loader) -{ - Q_ASSERT(!mLoader.isNull()); -} - -/*! - Forwards execute request to an appropriate handler if found otherwise ignores the request. - \param entry Subject for the requested command. - \param commandName Name of the command to be executed. - \return KErrNone (i.e. 0) on succes, error code otherwise. - \sa e32err.h for KErrNone definition. -*/ -TInt CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName) -{ - CaHandler *const handler = getHandler(entry, commandName); - - TInt result = KErrNotFound; - - if (handler != NULL) { - QScopedPointer innerEntry(NULL); - TRAP(result, - innerEntry.reset(CCaInnerEntry::NewL()); - CaObjectAdapter::convertL(entry, *innerEntry); - ) - if (result == KErrNone) { - result = handler->execute(*innerEntry, commandName); - } - } - return result; -} - -/*! - Looks for handler implementation in local cache or if not found, request it from - handler loader. - \param entry The entry being a subject for the requested command. - \param commandName Name of the command to be executed. - \return Pointer to a handler instance if available, NULL otherwise. -*/ -CaHandler *CaHandlerProxy::getHandler(const CaEntry &entry, - const QString &commandName) -{ - CaHandler *implementation(0); - - const QString entryTypeName(entry.entryTypeName()); - - const ImplementationMapIterator it( - mImplementationMap.find(entryTypeName)); - - if (it != mImplementationMap.end()) { - implementation = it->data(); - } else { - implementation = mLoader->loadHandler(entryTypeName, commandName); - mImplementationMap[entryTypeName] = QSharedPointer(implementation); - } - - return implementation; -} diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/src/camenuiconutility.cpp --- a/contentstorage/caclient/s60/src/camenuiconutility.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/s60/src/camenuiconutility.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -240,7 +240,7 @@ if (entry.entryTypeName() == XQConversions::s60DescToQString( KCaTypeWidget)) { icon.addBadge(Qt::AlignBottom | Qt::AlignLeft, - HbIcon("qtg_small_hs_widget")); + HbIcon("qtg_small_homescreen")); } return icon; } diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/s60/src/caqtsfhandlerloader.cpp --- a/contentstorage/caclient/s60/src/caqtsfhandlerloader.cpp Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +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 -#include -#include -#include -#include -#include -#include - -#include "cahandler.h" -#include "caqtsfhandlerloader.h" -#include "caclient_defines.h" - -QTM_USE_NAMESPACE - -/*! - \class CaQtSfHandlerLoader - \ingroup - \brief Loads handlers implementation - - The purpose of the class is to find Qt SF plugins implementing command handlers. - Temporarily because of issues with Qt SF this is replaced by immediate object - creation. - \sa CaHandlerLoader -*/ - -/*! - Constructor. -*/ -CaQtSfHandlerLoader::CaQtSfHandlerLoader() -{ - registerPlugins(); -} - -/*! - Load plugins for command handling. -*/ -void CaQtSfHandlerLoader::registerPlugins() const -{ - const QString pluginPath("hsresources/plugins/commandhandler"); - const QFileInfoList drives = QDir::drives(); - - foreach(QFileInfo drive, drives) { - const QString driveLetter = drive.absolutePath(); - const QString pluginAbsolutePath = driveLetter + pluginPath; - const QDir pluginDir(pluginAbsolutePath); - if(QDir(pluginDir).exists()) { - const QFileInfoList fileInfos = - pluginDir.entryInfoList(QStringList("*.xml")); - - QApplication::addLibraryPath(pluginAbsolutePath); - - QServiceManager serviceManager; - foreach(QFileInfo fileInfo, fileInfos) { - serviceManager.addService(fileInfo.absoluteFilePath()); - } - } - } -} - -/*! - Loads handler implementations appropriate for the requested entry type name and command. - - The caller takes ownership of the returned pointer. - - \param entryTypeName Entry type name. - \param commandName Name of the command to be handled. - \return A pointer to handler serving the entry type and command if found, NULL otherwise. -*/ -CaHandler *CaQtSfHandlerLoader::loadHandler(const QString &entryTypeName, - const QString &commandName) -{ - Q_UNUSED(commandName); - - QString typeName(entryTypeName); - if (entryTypeName == WIDGET_ENTRY_TYPE_NAME - || entryTypeName == PACKAGE_ENTRY_TYPE_NAME) { - typeName = QString(APPLICATION_ENTRY_TYPE_NAME); - } - - QServiceManager serviceManager; - QServiceFilter serviceFilter("com.nokia.homescreen.ICommandHandler"); - serviceFilter.setCustomAttribute("entryTypeName", typeName); - QList serviceInterfaceDescriptorList = - serviceManager.findInterfaces(serviceFilter); - CaHandler *interfaceHandler = NULL; - if (!serviceInterfaceDescriptorList.isEmpty()) { - QServiceInterfaceDescriptor serviceInterfaceDescriptor = - serviceInterfaceDescriptorList[0]; - QObject *handler = - serviceManager.loadInterface(serviceInterfaceDescriptor); - interfaceHandler = qobject_cast(handler); - } - return interfaceHandler; -} - - diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/src/cahandlerloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/src/cahandlerloader.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,36 @@ +/* + * 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 "cahandlerloader.h" + +/*! + \class CaHandlerLoader + \ingroup + \brief Interface for class of objects providing command handlers. + + \sa CaHandlerLoader +*/ + +/*! + Destructor. +*/ +CaHandlerLoader::~CaHandlerLoader() +{ +} + + diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/src/cahandlerproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/src/cahandlerproxy.cpp Fri Jun 11 13:58:37 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: + * + */ + +#include + +#include "cahandler.h" +#include "cahandlerproxy.h" +#include "cahandlerloader.h" +#include "caobjectadapter.h" + +/*! + \class CaHandlerProxy + \ingroup + \brief Forwards execute request to an implemenation provided by specific handler loader. + + \sa CaHandlerLoader +*/ + +/*! + Destructor. +*/ +CaHandlerProxy::~CaHandlerProxy() +{ +} + + +/*! + Constructs handler proxy. + \param loader Provides handler implementations. It has to be pointer to a valid object. +*/ +CaHandlerProxy::CaHandlerProxy(const QSharedPointer &loader): + mLoader(loader) +{ + Q_ASSERT(!mLoader.isNull()); +} + +/*! + Forwards execute request to an appropriate handler if found otherwise ignores the request. + \param entry Subject for the requested command. + \param commandName Name of the command to be executed. + \return KErrNone (i.e. 0) on succes, error code otherwise. + \sa e32err.h for KErrNone definition. +*/ +ErrorCode CaHandlerProxy::execute(const CaEntry &entry, const QString &commandName) +{ + CaHandler *const handler = getHandler(entry, commandName); + ErrorCode result = NotFoundErrorCode; + + if (handler) { + result = CaObjectAdapter::convertErrorCode( + handler->execute(entry, commandName)); + } + return result; +} + +/*! + Looks for handler implementation in local cache or if not found, request it from + handler loader. + \param entry The entry being a subject for the requested command. + \param commandName Name of the command to be executed. + \return Pointer to a handler instance if available, NULL otherwise. +*/ +CaHandler *CaHandlerProxy::getHandler(const CaEntry &entry, + const QString &commandName) +{ + CaHandler *implementation(0); + + const QString entryTypeName(entry.entryTypeName()); + + const ImplementationMapIterator it( + mImplementationMap.find(entryTypeName)); + + if (it != mImplementationMap.end()) { + implementation = it->data(); + } else { + implementation = mLoader->loadHandler(entryTypeName, commandName); + mImplementationMap[entryTypeName] = QSharedPointer(implementation); + } + + return implementation; +} diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/src/caitemmodel.cpp --- a/contentstorage/caclient/src/caitemmodel.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/src/caitemmodel.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -955,6 +955,7 @@ void CaItemModelPrivate::updateModelItem(int id, ChangeType changeType) { CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelItem"); + int previousCount = rowCount(); switch (changeType) { case AddChangeType: addItem(id); @@ -966,6 +967,7 @@ updateItemData(id); break; } + emitEmpty(previousCount); CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelItem"); } @@ -976,6 +978,8 @@ void CaItemModelPrivate::updateModelContent(int id) { Q_UNUSED(id); + int previousCount = rowCount(); + CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::updateModelContent"); QList ids = mService->getEntryIds(mQuery); @@ -984,5 +988,20 @@ } else { removeItems(ids); } + emitEmpty(previousCount); CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::updateModelContent"); } + +/*! + Emits empty signal if model state was changed + \param id of parent + */ +void CaItemModelPrivate::emitEmpty(int previousCount) +{ + if ( previousCount && !rowCount()) { + emit m_q->empty(true); + } + if ( !previousCount && rowCount()) { + emit m_q->empty(false); + } +} diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/src/caqtsfhandlerloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/caclient/src/caqtsfhandlerloader.cpp Fri Jun 11 13:58:37 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 +#include +#include +#include +#include +#include +#include +#include + +#include "cahandler.h" +#include "caqtsfhandlerloader.h" +#include "caclient_defines.h" + +QTM_USE_NAMESPACE + +/*! + \class CaQtSfHandlerLoader + \ingroup + \brief Loads handlers implementation + + The purpose of the class is to find Qt SF plugins implementing command handlers. + Temporarily because of issues with Qt SF this is replaced by immediate object + creation. + \sa CaHandlerLoader +*/ + +/*! + Constructor. +*/ +CaQtSfHandlerLoader::CaQtSfHandlerLoader() +{ + registerPlugins(); +} + +/*! + Load plugins for command handling. +*/ +void CaQtSfHandlerLoader::registerPlugins() const +{ + const QString pluginPath("hsresources/plugins/commandhandler"); + const QFileInfoList drives = QDir::drives(); + + foreach(QFileInfo drive, drives) { + const QString driveLetter = drive.absolutePath(); + const QString pluginAbsolutePath = driveLetter + pluginPath; + const QDir pluginDir(pluginAbsolutePath); + if(QDir(pluginDir).exists()) { + const QFileInfoList fileInfos = + pluginDir.entryInfoList(QStringList("*.xml")); + + QApplication::addLibraryPath(pluginAbsolutePath); + + QServiceManager serviceManager; + foreach(QFileInfo fileInfo, fileInfos) { + serviceManager.addService(fileInfo.absoluteFilePath()); + } + } + } +} + +/*! + Loads handler implementations appropriate for the requested entry type name and command. + + The caller takes ownership of the returned pointer. + + \param entryTypeName Entry type name. + \param commandName Name of the command to be handled. + \return A pointer to handler serving the entry type and command if found, NULL otherwise. +*/ +CaHandler *CaQtSfHandlerLoader::loadHandler(const QString &entryTypeName, + const QString &commandName) +{ + Q_UNUSED(commandName); + + QString typeName(entryTypeName); + if (entryTypeName == WIDGET_ENTRY_TYPE_NAME + || entryTypeName == PACKAGE_ENTRY_TYPE_NAME) { + typeName = QString(APPLICATION_ENTRY_TYPE_NAME); + } + + QServiceManager serviceManager; + QServiceFilter serviceFilter("com.nokia.homescreen.ICommandHandler"); + serviceFilter.setCustomAttribute("entryTypeName", typeName); + QList serviceInterfaceDescriptorList = + serviceManager.findInterfaces(serviceFilter); + CaHandler *interfaceHandler = NULL; + if (!serviceInterfaceDescriptorList.isEmpty()) { + QServiceInterfaceDescriptor serviceInterfaceDescriptor = + serviceInterfaceDescriptorList[0]; + QObject *handler = + serviceManager.loadInterface(serviceInterfaceDescriptor); + interfaceHandler = qobject_cast(handler); + } + return interfaceHandler; +} + + diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/src/caservice.cpp --- a/contentstorage/caclient/src/caservice.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/src/caservice.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -30,6 +30,8 @@ #include "caclientproxy.h" #include "caclientnotifierproxy.h" +#include "cahandlerproxy.h" +#include "caqtsfhandlerloader.h" #include "caobjectadapter.h" #include "caclienttest_global.h" @@ -89,7 +91,6 @@ CaService::CaService(QObject *parent) : QObject(parent), m_d(new CaServicePrivate(this)) { - } /*! @@ -944,7 +945,10 @@ \param servicePublic pointer to public service */ CaServicePrivate::CaServicePrivate(CaService *servicePublic) : - m_q(servicePublic), mProxy(new CaClientProxy), + m_q(servicePublic), + mCommandHandler(new CaHandlerProxy(QSharedPointer + (new CaQtSfHandlerLoader()))), + mProxy(new CaClientProxy()), mNotifierProxy(NULL) { const ErrorCode connectionResult = mProxy->connect(); @@ -1338,7 +1342,7 @@ touch(entry); } - mErrorCode = mProxy->executeCommand(entry, command); + mErrorCode = mCommandHandler->execute(entry, command); qDebug() << "CaServicePrivate::executeCommand mErrorCode on return:" << mErrorCode; diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/stub/inc/caobjectadapter.h --- a/contentstorage/caclient/stub/inc/caobjectadapter.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/stub/inc/caobjectadapter.h Fri Jun 11 13:58:37 2010 +0300 @@ -21,6 +21,8 @@ // INCLUDES #include +#include + class QSize; class CaEntry; class CaIconDescription; @@ -59,6 +61,12 @@ */ static void setId(CaIconDescription &iconDescription, int id); + + /** + * Converts symbian error code to error code (used in QT code). + */ + static ErrorCode convertErrorCode( + int internalErrorCode); }; diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/stub/src/camenuiconutility.cpp --- a/contentstorage/caclient/stub/src/camenuiconutility.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/stub/src/camenuiconutility.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -53,6 +53,10 @@ if (icon.isNull() || !(icon.size().isValid())) { icon = HbIcon(QDir(".").absoluteFilePath("resource/application.png")); } + if (entry.entryTypeName() == "widget") { + icon.addBadge(Qt::AlignBottom | Qt::AlignLeft, + HbIcon("qtg_small_homescreen")); + } return icon; } diff -r 397d00875918 -r 156f692b1687 contentstorage/caclient/stub/src/caobjectadapter.cpp --- a/contentstorage/caclient/stub/src/caobjectadapter.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/caclient/stub/src/caobjectadapter.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -60,3 +60,20 @@ iconDescription.setId(id); } +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +ErrorCode CaObjectAdapter::convertErrorCode(int internalErrorCode) +{ + ErrorCode error(NoErrorCode); + switch (internalErrorCode) { + case 0: + error = NoErrorCode; + break; + default: + error = UnknownErrorCode; + break; + } + return error; +} + diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/app/app.pro --- a/contentstorage/cahandler/app/app.pro Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/app/app.pro Fri Jun 11 13:58:37 2010 +0300 @@ -37,7 +37,6 @@ LIBS += \ -leuser \ -lecom \ - -lswinstcli \ -lcautils \ -lapgrfx \ -lws32 \ @@ -48,7 +47,8 @@ -lefsrv \ -lsif \ -lscrclient \ - -lxqutils + -lxqutils \ + -lcaclient exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager):LIBS += -lxqsettingsmanager } diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/app/inc/caapphandler.h --- a/contentstorage/cahandler/app/inc/caapphandler.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/app/inc/caapphandler.h Fri Jun 11 13:58:37 2010 +0300 @@ -15,96 +15,73 @@ * */ -#ifndef C_CAAPPHANDLER_H -#define C_CAAPPHANDLER_H +#ifndef CAAPPHANDLER_H +#define CAAPPHANDLER_H -#include +#include -// forward declarations +#include "cahandler.h" + class CEikonEnv; -class CCaInnerEntry; class CCaUsifUninstallOperation; +class CaEntry; /** * Command handler for application entries. * * @lib caclient.lib */ -NONSHARABLE_CLASS( CCaAppHandler ): public CBase - { +class CaAppHandler: public QObject, public CaHandler +{ + Q_OBJECT + Q_INTERFACES(CaHandler) public: - /** - * Allocates memory for and initializes CCaAppHandler object - */ - static CCaAppHandler* NewL(); + + explicit CaAppHandler(QObject *parent = 0); /** * Destructor. */ - virtual ~CCaAppHandler(); - -protected: - - CCaAppHandler(); - - void ConstructL(); + virtual ~CaAppHandler(); public: - /** - * Handle command. - * @param aItem Item of supported type. - * @param aCommand Command. - * @param aParams. Command parameters. - * @param aStatus Observer request status. When the operation completes, - * this status will be completed with the resulting error code. - * @return Asynchronous operation. Owned by the caller. - */ - void HandleCommandL( CCaInnerEntry& aEntry, const TDesC8& aCommand ); + int execute(const CaEntry &entry, const QString &command); private: + /** * Launches application * @param aUid UID of the application to launch * @param aParam command parameters * @param aViewId id of the view the application is to start in */ - void LaunchApplicationL( const TUid aUid, const TDesC8 &aParam, - TInt aViewId ); + void launchApplicationL(const TUid aUid, TInt aViewId); /** * Closes application * @param aEntry the entry represeting application to close */ - void CloseApplicationL( CCaInnerEntry& aEntry ); + int closeApplication(const EntryFlags &flags, TInt windowGroupId); /** * Uninstall application * @param aEntry the entry represeting application to uninstall */ - void HandleRemoveL( CCaInnerEntry &aEntry ); - - /** - * Gets component id - * @param aEntry the entry - * @param aSoftwareType indicates software type - * @return component id - */ - TInt GetComponentIdL( const CCaInnerEntry &aEntry, - const TDesC& aSoftwareType ); + int handleRemove(const EntryFlags &flags, + const QString &typeName, + const QString &componentId); /** * Start uninstall operation via usif * @param aComponentId component id */ - void StartUsifUninstallL( TInt aComponentId ); + void startUsifUninstallL(TInt aComponentId); private: - // data + CEikonEnv *iEikEnv; + CCaUsifUninstallOperation *iUsifUninstallOperation; +}; - CEikonEnv* iEikEnv; - CCaUsifUninstallOperation* iUsifUninstallOperation; - }; - -#endif // C_CAAPPHANDLER_H +#endif // CAAPPHANDLER_H diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/app/inc/cas60apphandleradapter.h --- a/contentstorage/cahandler/app/inc/cas60apphandleradapter.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +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 CA_S60_APP_HANDLER_ADAPTER_H -#define CA_S60_APP_HANDLER_ADAPTER_H - -#include -#include - -#include "cahandler.h" - -class CCaInnerEntry; - -class CaS60AppHandlerAdapter: public QObject, public CaHandler -{ - Q_OBJECT - Q_INTERFACES(CaHandler) - -public: - int execute(CCaInnerEntry &innerEntry, const QString &commandName); - -}; - -#endif // CA_S60_APP_HANDLER_ADAPTER_H diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/app/src/caapphandler.cpp --- a/contentstorage/cahandler/app/src/caapphandler.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/app/src/caapphandler.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -15,6 +15,8 @@ * */ +#include +#include #include #include #include @@ -27,102 +29,86 @@ #include #include +#include +#include + #include "caapphandler.h" #include "cainnerentry.h" #include "causifuninstalloperation.h" #include "catasklist.h" - #include "cautils.h" +#include "caclient_defines.h" #include "cadef.h" -// ======== MEMBER FUNCTIONS ======== using namespace Usif; -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCaAppHandler::~CCaAppHandler() -{ - delete iUsifUninstallOperation; -} - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -CCaAppHandler *CCaAppHandler::NewL() -{ - CCaAppHandler *handler = new(ELeave) CCaAppHandler(); - CleanupStack::PushL( handler ); - handler->ConstructL(); - CleanupStack::Pop( handler ); - return handler; -} +static const char caTypeApp[] = "application"; +static const char caTypePackage[] = "package"; +static const char caTypeWidget[] = "widget"; +static const char caAttrView[] = "view"; +static const char caCmdClose[] = "close"; +static const char caAttrWindowGroupId[] = "window_group_id"; +static const char caAttrComponentId[] = "component_id"; +static const char caCmdRemove[] = "remove"; // --------------------------------------------------------- -// CCaAppHandler::CCaAppHandler +// // --------------------------------------------------------- // -CCaAppHandler::CCaAppHandler() +CaAppHandler::CaAppHandler(QObject *parent): + iEikEnv(CEikonEnv::Static()), + iUsifUninstallOperation(NULL) { - iEikEnv = CEikonEnv::Static(); - iUsifUninstallOperation = NULL; + Q_UNUSED(parent); } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CCaAppHandler::ConstructL() +CaAppHandler::~CaAppHandler() +{ + delete iUsifUninstallOperation; +} + +int CaAppHandler::execute(const CaEntry &entry, const QString &command) { + int result(KErrGeneral); + if (command == caCmdOpen && entry.entryTypeName() == caTypeApp) { + QString viewIdValue = entry.attribute(caAttrView); + bool viewIdIsCorrect(true); + int viewId(-1); + if (!viewIdValue.isNull()) { + viewId = viewIdValue.toInt(&viewIdIsCorrect, 0); + } + if (viewIdIsCorrect) { + QString uidValue = + entry.attribute(APPLICATION_UID_ATTRIBUTE_NAME); + int uid = uidValue.toInt(); + TRAP(result, launchApplicationL(TUid::Uid(uid), viewId)); + } + } else if (command == caCmdClose && entry.entryTypeName() == caTypeApp ) { + QString windowGroupId = entry.attribute(caAttrWindowGroupId); + if (!windowGroupId.isNull()) { + result = closeApplication(entry.flags(), windowGroupId.toInt()); + } + } else if (command == caCmdRemove) { + QString componentId(entry.attribute(caAttrComponentId)); + result = handleRemove(entry.flags(), + entry.entryTypeName(), + componentId); + } else { + result = KErrNotSupported; + } + + return result; } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CCaAppHandler::HandleCommandL( - CCaInnerEntry &aEntry, const TDesC8 &aCommand ) -{ - - if( aCommand == KCaCmdOpen() - && aEntry.GetEntryTypeName() == KCaTypeApp() ) - { - TInt viewId(-1); - TPtrC viewIdValue; - if( aEntry.FindAttribute( KCaAttrView(), viewIdValue ) ) - { - if( MenuUtils::GetTUint( viewIdValue, (TUint &) viewId ) - != KErrNone ) - { - User::Leave( KErrCorrupt ); - } - } - LaunchApplicationL( - TUid::Uid( aEntry.GetUid() ), KNullDesC8(), viewId ); - } - else if ( aCommand == KCaCmdClose() - && aEntry.GetEntryTypeName() == KCaTypeApp() ) - { - CloseApplicationL( aEntry ); - } - else if ( aCommand == KCaCmdRemove() ) - { - HandleRemoveL(aEntry); - } - else - { - User::Leave( KErrNotSupported ); - } -} - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CCaAppHandler::LaunchApplicationL( - const TUid aUid, const TDesC8 &aParam, TInt aViewId ) +void CaAppHandler::launchApplicationL(const TUid aUid, TInt aViewId) { if( aViewId > 0 && iEikEnv ) { @@ -172,7 +158,7 @@ cmdLine->SetCommandL( EApaCommandRun ); } - cmdLine->SetTailEndL( aParam ); + cmdLine->SetTailEndL( KNullDesC8 ); User::LeaveIfError( appArcSession.StartApp( *cmdLine ) ); @@ -188,113 +174,70 @@ // // --------------------------------------------------------------------------- // -void CCaAppHandler::CloseApplicationL( CCaInnerEntry &aEntry ) +int CaAppHandler::closeApplication(const EntryFlags &flags, int windowGroupId) { - RWsSession wsSession; - User::LeaveIfError( wsSession.Connect() ); - CleanupClosePushL( wsSession ); - - if( ( aEntry.GetFlags() & ERunning ) - && !( aEntry.GetFlags() & ESystem ) ) - { - RBuf value; - CleanupClosePushL( value ); - value.CreateL( KCaMaxAttrValueLen ); - if( aEntry.FindAttribute( KCaAttrWindowGroupId, value ) ) - { - TInt wgId( KErrNotFound ); - TLex16 parser( value ); - if( KErrNone == parser.Val( wgId ) && wgId > 0 ) - { - TWsEvent event; - event.SetTimeNow(); - event.SetType( KAknShutOrHideApp ); - wsSession.SendEventToWindowGroup( wgId, event ); - } - } - CleanupStack::PopAndDestroy( &value ); + int result(KErrNone); + if (flags.testFlag(RunningEntryFlag) + && !( flags.testFlag(SystemEntryFlag)) + && windowGroupId > 0) { + RWsSession wsSession; + result = wsSession.Connect(); + if (result==KErrNone) { + TWsEvent event; + event.SetTimeNow(); + event.SetType( KAknShutOrHideApp ); + wsSession.SendEventToWindowGroup( windowGroupId, event ); + } + wsSession.Close(); } - - CleanupStack::PopAndDestroy( &wsSession ); + return result; } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CCaAppHandler::HandleRemoveL( CCaInnerEntry &aEntry ) - { - if( !( aEntry.GetFlags() & ERemovable ) ) - { - User::Leave( KErrAccessDenied ); - } - - const TPtrC entryTypeName(aEntry.GetEntryTypeName()); - - if( entryTypeName == KCaTypeApp() || - entryTypeName == KCaTypePackage() || - entryTypeName == KCaTypeWidget() ) - { - TPtrC componentId; - TBool result = aEntry.FindAttribute( KCaAttrComponentId, componentId ); - if( result ) - { - TInt32 id ; - TLex idDesc; - idDesc.Assign( componentId ); - User::LeaveIfError( idDesc.Val( id ) ); - StartUsifUninstallL( id ); - } - else - { - User::Leave( KErrNotFound ); +int CaAppHandler::handleRemove(const EntryFlags &flags, + const QString &typeName, + const QString &componentId) +{ + int result(KErrNone); + if (flags.testFlag(RemovableEntryFlag)) { + if (typeName == caTypeApp + || typeName == caTypePackage + || typeName == caTypeWidget) { + if(componentId.isNull()) { + result = KErrNotFound; + } else { + bool convertStatus(false); + int id = componentId.toInt(&convertStatus); + if (convertStatus) { + TRAP(result, startUsifUninstallL(id)); + } else { + result = KErrGeneral; + } } } - else - { - User::Leave( KErrNotSupported ); + else { + result = KErrNotSupported; } + } else { + result = KErrAccessDenied; } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CCaAppHandler::GetComponentIdL( const CCaInnerEntry &aEntry, - const TDesC& aSoftwareType ) -{ - TInt id(KErrNotFound); - RSoftwareComponentRegistry scr; - CleanupClosePushL(scr); - User::LeaveIfError(scr.Connect()); - CComponentFilter* compFilter = CComponentFilter::NewLC(); - compFilter->AddPropertyL(_L("Uid"), aEntry.GetUid()); - compFilter->SetSoftwareTypeL(aSoftwareType); - RArray componentIdList; - CleanupClosePushL(componentIdList); - scr.GetComponentIdsL(componentIdList, compFilter); - if (componentIdList.Count() > 0) - { - id = componentIdList[0]; - } - CleanupStack::PopAndDestroy(&componentIdList); - CleanupStack::PopAndDestroy(compFilter); - CleanupStack::PopAndDestroy(&scr); - return id; + return result; } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CCaAppHandler::StartUsifUninstallL( TInt aComponentId ) +void CaAppHandler::startUsifUninstallL(TInt aComponentId) { - if ( iUsifUninstallOperation && iUsifUninstallOperation->IsActive() ) - { + if (iUsifUninstallOperation && iUsifUninstallOperation->IsActive()) { User::Leave( KErrInUse ); - } + } delete iUsifUninstallOperation; iUsifUninstallOperation = NULL; - iUsifUninstallOperation = CCaUsifUninstallOperation::NewL( aComponentId ); + iUsifUninstallOperation = CCaUsifUninstallOperation::NewL(aComponentId); } diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/app/src/caapphandlerplugin.cpp --- a/contentstorage/cahandler/app/src/caapphandlerplugin.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/app/src/caapphandlerplugin.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -23,7 +23,6 @@ #include "cahandlerloader.h" #include "caapphandler.h" #include "caapphandlerplugin.h" -#include "cas60apphandleradapter.h" /*! \class CaAppHandlerPlugin @@ -35,7 +34,7 @@ \param descriptor Service descriptor. \param context Ignored. \param session Ignored. - \return An instance of the CaS60HandlerAdapter when descriptor interface name + \return An instance of the CaS60HandlerAdapter when descriptor interface name is "com.nokia.homescreen.ICommandHandler", NULL otherwise. */ QObject *CaAppHandlerPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor, @@ -47,7 +46,7 @@ if (descriptor.interfaceName() == "com.nokia.homescreen.ICommandHandler") { - return new CaS60AppHandlerAdapter(); + return new CaAppHandler(); } else { return 0; } diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/app/src/cas60apphandleradapter.cpp --- a/contentstorage/cahandler/app/src/cas60apphandleradapter.cpp Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: ?Description - * - */ - -#include -#include -#include - -#include "cas60apphandleradapter.h" -#include "caapphandler.h" -#include "cainnerentry.h" - -int CaS60AppHandlerAdapter::execute(CCaInnerEntry &innerEntry, const QString &commandName) -{ - QScopedPointer commandNameDesc8(XQConversions::qStringToS60Desc8(commandName)); - TRAPD(result, - static QScopedPointer plugin(CCaAppHandler::NewL()); - plugin->HandleCommandL(innerEntry, commandNameDesc8->Des()); - ); - return result; -} diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/tapp/inc/catapphandler.h --- a/contentstorage/cahandler/tapp/inc/catapphandler.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/tapp/inc/catapphandler.h Fri Jun 11 13:58:37 2010 +0300 @@ -35,11 +35,11 @@ ~CaTappHandler(); Q_INVOKABLE - int execute(CCaInnerEntry& innerEntry, const QString& command); + int execute(const CaEntry &entry, const QString &command); private: - XQApplicationManager* mAiwMgr; + XQApplicationManager *mAiwMgr; }; -#endif +#endif // CATAPPHANDLER_H diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/tapp/src/catapphandler.cpp --- a/contentstorage/cahandler/tapp/src/catapphandler.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/tapp/src/catapphandler.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -23,10 +23,9 @@ #include "caentry.h" #include "catapphandler.h" -#include "cainnerentry.h" #include "caclient_defines.h" -_LIT(hsitemLaunchUri, "item:launchuri"); +static const QString hsitemLaunchUri("item:launchuri"); QTM_USE_NAMESPACE @@ -61,22 +60,27 @@ \param command Description of the command. \return Error code described in QSERVICEMANAGER.H */ -int CaTappHandler::execute(CCaInnerEntry& innerEntry, const QString& command) +int CaTappHandler::execute(const CaEntry& entry, const QString& command) { - int error = 0; // this returns Error enum from QSERVICEMANAGER.H + // this returns Error enum from QSERVICEMANAGER.H + int error = 0; if (command == caCmdOpen) { - TPtrC attribute; - innerEntry.FindAttribute(hsitemLaunchUri, attribute); - - // e.g. QUrl url ("application://101F7AE7?"); - QUrl url(QString::fromUtf16(attribute.Ptr(), attribute.Length())); - QScopedPointer request(mAiwMgr->create(url, false)); - if (!request.isNull()) { - bool res = request->send(); - if (!res) { - error = request->lastError(); + QString attribute = entry.attribute(hsitemLaunchUri); + if (!attribute.isNull()) { + // e.g. QUrl("appto://101F7AE7?"); + QScopedPointer request(mAiwMgr->create(QUrl(attribute), + false)); + if (!request.isNull()) { + bool res = request->send(); + if (!res) { + error = request->lastError(); + } } } + } else { + // TODO: error code cleanning and appropriate conversion (in other classes too). + static const int NotSupportedErrorCode = 100; + error = NotSupportedErrorCode; } return error; } diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/tapp/tapp.pro --- a/contentstorage/cahandler/tapp/tapp.pro Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/tapp/tapp.pro Fri Jun 11 13:58:37 2010 +0300 @@ -40,8 +40,8 @@ LIBS += -lxqservice \ -lxqutils \ - -lcautils -# -lhsutils + -lcautils \ + -lcaclient } diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/url/inc/cas60urlhandleradapter.h --- a/contentstorage/cahandler/url/inc/cas60urlhandleradapter.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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 CA_S60_URL_HANDLER_ADAPTER_H -#define CA_S60_URL_HANDLER_ADAPTER_H - -#include - -#include "cahandler.h" - -class CCaInnerEntry; - -class CaS60UrlHandlerAdapter: public QObject, public CaHandler -{ - Q_OBJECT - Q_INTERFACES(CaHandler) - -public: - int execute(CCaInnerEntry &innerEntry, const QString &commandName); - -}; - -#endif //CA_S60_URL_HANDLER_ADAPTER_H diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/url/inc/caurlhandler.h --- a/contentstorage/cahandler/url/inc/caurlhandler.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/url/inc/caurlhandler.h Fri Jun 11 13:58:37 2010 +0300 @@ -15,75 +15,26 @@ * */ -#ifndef __CCAURLHANDLER_H__ -#define __CCAURLHANDLER_H__ - -#include - -class CCaInnerEntry; +#ifndef CAURLHANDLER_H +#define CAURLHANDLER_H -// Constants -const TUid KUidBrowser = - { - 0x10008D39 - }; -_LIT( KBrowserPrefix, "4 " ); - -/** - * Command handler for url entries. - * - * @lib caclient.lib - */ -NONSHARABLE_CLASS( CCaUrlHandler ): public CBase - { - -public: - // construction +#include "cahandler.h" - /** - * Destructor. - */ - virtual ~CCaUrlHandler(); - - /** - * Two-phased constructor. Leaves on failure. - * @return The constructed object. - */ - static CCaUrlHandler* NewL(); +class QString; -protected: - // construction - - /** - * Constructor. - * @param aMenu Menu. - */ - CCaUrlHandler(); - - /** - * Second-phase constructor. - */ - void ConstructL(); +class CaUrlHandler: public QObject, public CaHandler +{ + Q_OBJECT + Q_INTERFACES(CaHandler) public: + explicit CaUrlHandler(QObject *parent = 0); - /** - * Handle command. - * @param aEntry The url entry to be processed. - * @param aCommand Command. - */ - void HandleCommandL( CCaInnerEntry& aEntry, const TDesC8& aCommand ); + virtual ~CaUrlHandler(); -private: - // internal + int execute(const CaEntry &entry, const QString &command); - /** - * Launches the url. - * @param aUrl The url to be launched. - */ - void LaunchUrlL( const TDesC& aUrl ); +}; - }; - -#endif // __CCAURLHANDLER_H__ +#endif // CAURLHANDLER_H diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/url/inc/caurlhandlerplugin.h --- a/contentstorage/cahandler/url/inc/caurlhandlerplugin.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/url/inc/caurlhandlerplugin.h Fri Jun 11 13:58:37 2010 +0300 @@ -11,12 +11,12 @@ * * Contributors: * - * Description: + * Description: Url handler plugin. * */ -#ifndef CA_URL_HANDLER_PLUGIN_H -#define CA_URL_HANDLER_PLUGIN_H +#ifndef CAURLHANDLERPLUGIN_H +#define CAURLHANDLERPLUGIN_H #include #include @@ -30,8 +30,8 @@ public: QObject *createInstance(const QServiceInterfaceDescriptor &descriptor, - QServiceContext *context, - QAbstractSecuritySession *session); + QServiceContext *context, + QAbstractSecuritySession *session); }; -#endif +#endif // CAURLHANDLERPLUGIN_H diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/url/src/cas60urlhandleradapter.cpp --- a/contentstorage/cahandler/url/src/cas60urlhandleradapter.cpp Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: ?Description - * - */ - -#include -#include -#include - -#include "cas60urlhandleradapter.h" -#include "caurlhandler.h" -#include "cainnerentry.h" - -int CaS60UrlHandlerAdapter::execute(CCaInnerEntry &innerEntry, const QString &commandName) -{ - QScopedPointer commandNameDesc8(XQConversions::qStringToS60Desc8(commandName)); - TRAPD(result, - static QScopedPointer plugin(CCaUrlHandler::NewL()); - plugin->HandleCommandL(innerEntry, commandNameDesc8->Des()); - ); - return result; -} diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/url/src/caurlhandler.cpp --- a/contentstorage/cahandler/url/src/caurlhandler.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/url/src/caurlhandler.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -15,130 +15,33 @@ * */ -#include -#include -#include -#include +#include +#include + +#include #include "caurlhandler.h" -#include "cadef.h" -#include "cainnerentry.h" -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CCaUrlHandler::~CCaUrlHandler -// -------------------------------------------------------------------------- -// -CCaUrlHandler::~CCaUrlHandler() - { - } +static const QString caAttrUrl("url"); -// -------------------------------------------------------------------------- -// CCaUrlHandler::NewL -// -------------------------------------------------------------------------- -// -CCaUrlHandler* CCaUrlHandler::NewL() - { - CCaUrlHandler* handler = new ( ELeave ) CCaUrlHandler(); - CleanupStack::PushL( handler ); - handler->ConstructL(); - CleanupStack::Pop( handler ); - return handler; - } - -// -------------------------------------------------------------------------- -// CCaUrlHandler::CCaUrlHandler -// -------------------------------------------------------------------------- -// -CCaUrlHandler::CCaUrlHandler() - { - } +CaUrlHandler::CaUrlHandler(QObject *parent) +{ + Q_UNUSED(parent); +} -// -------------------------------------------------------------------------- -// CCaUrlHandler::ConstructL -// -------------------------------------------------------------------------- -// -void CCaUrlHandler::ConstructL() - { - } - -// -------------------------------------------------------------------------- -// CCaUrlHandler::HandleCommandL -// -------------------------------------------------------------------------- -// -void CCaUrlHandler::HandleCommandL( CCaInnerEntry& aEntry, - const TDesC8& aCommand ) - { +CaUrlHandler::~CaUrlHandler() +{ +} - if( !aCommand.Compare( KCaCmdOpen() ) ) - { - const RCaEntryAttrArray& attributes = aEntry.GetAttributes(); - TInt attributesArrayCount = attributes.Count(); - for( int i = 0; i < attributesArrayCount; ++i ) - { - const CCaEntryAttribute * const attribute = attributes[i]; - if( attribute->Name().Compare( KCaAttrUrl ) == 0 ) - { - LaunchUrlL( attribute->Value() ); - break; - } - } - } - else - { - User::Leave( KErrNotSupported ); +int CaUrlHandler::execute(const CaEntry &entry, const QString &command) +{ + int err(KErrGeneral); + if (command == caCmdOpen) { + QString attribute = entry.attribute(caAttrUrl); + if (!attribute.isNull() && + QDesktopServices::openUrl(QUrl(attribute))) { + err = KErrNone; } } - -// -------------------------------------------------------------------------- -// CCaUrlHandler::LaunchUrlL -// -------------------------------------------------------------------------- -// - -void CCaUrlHandler::LaunchUrlL( const TDesC& aUrl ) - { - // Launches browser stand-alone. - // Browser is launched with a parameter 4 ("4 http://...."), which - // Start/Continue the browser specifying a URL. - // Other available parameters are described in the Browser API Specification - // Document. - TInt length = aUrl.Length() + KBrowserPrefix.iTypeLength; - - RWsSession wsSession; - User::LeaveIfError( wsSession.Connect() ); - CleanupClosePushL ( wsSession ); - - CAknTaskList* taskList = CAknTaskList::NewL( wsSession ); - TApaTask task = taskList->FindRootApp( KUidBrowser ); - delete taskList; - - if( task.Exists() ) - { - HBufC8* param8 = HBufC8::NewLC( length ); - TPtr8 ptr8 = param8->Des(); - ptr8.Append( KBrowserPrefix ); - ptr8.Append( aUrl ); - - // Sends message to existing Browser task. - task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used - CleanupStack::PopAndDestroy( param8 ); - } - else - { - HBufC* buf = HBufC::NewLC( length ); - TPtr ptr = buf->Des(); - ptr.Append( KBrowserPrefix ); - ptr.Append( aUrl ); - - RApaLsSession appArcSession; - User::LeaveIfError( appArcSession.Connect() ); - CleanupClosePushL ( appArcSession ); - TThreadId id; - appArcSession.StartDocument( *buf, KUidBrowser, id ); - CleanupStack::PopAndDestroy( &appArcSession ); - CleanupStack::PopAndDestroy( buf ); - } - - CleanupStack::PopAndDestroy( &wsSession ); - } + return err; +} diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/url/src/caurlhandlerplugin.cpp --- a/contentstorage/cahandler/url/src/caurlhandlerplugin.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/url/src/caurlhandlerplugin.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -15,14 +15,12 @@ * */ -#include #include #include #include + #include "cahandlerloader.h" - #include "caurlhandlerplugin.h" -#include "cas60urlhandleradapter.h" #include "caurlhandler.h" /*! @@ -35,7 +33,7 @@ \param descriptor Service descriptor. \param context Ignored. \param session Ignored. - \return An instance of the CaS60UrlHandlerAdapter when descriptor interface name + \return An instance of the CaS60UrlHandlerAdapter when descriptor interface name is "com.nokia.homescreen.ICommandHandler", NULL otherwise. */ QObject *CaUrlHandlerPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor, @@ -46,10 +44,11 @@ Q_UNUSED(session); if (descriptor.interfaceName() == - "com.nokia.homescreen.ICommandHandler") { - return new CaS60UrlHandlerAdapter(); + QLatin1String("com.nokia.homescreen.ICommandHandler")) { + return new CaUrlHandler(); } else { return 0; } } + Q_EXPORT_PLUGIN2(caurlhandlerplugin, CaUrlHandlerPlugin) diff -r 397d00875918 -r 156f692b1687 contentstorage/cahandler/url/url.pro --- a/contentstorage/cahandler/url/url.pro Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cahandler/url/url.pro Fri Jun 11 13:58:37 2010 +0300 @@ -37,7 +37,6 @@ LIBS += \ -leuser \ -lecom \ - -lswinstcli \ -lcautils \ -lapgrfx \ -lws32 \ @@ -46,7 +45,8 @@ -leikcore \ -lcone \ -lefsrv \ - -lxqutils + -lxqutils \ + -lcaclient exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager):LIBS += -lxqsettingsmanager } diff -r 397d00875918 -r 156f692b1687 contentstorage/casoftwareregistry/casoftwareregistry.pro --- a/contentstorage/casoftwareregistry/casoftwareregistry.pro Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casoftwareregistry/casoftwareregistry.pro Fri Jun 11 13:58:37 2010 +0300 @@ -40,7 +40,8 @@ -lbafl \ -lestor \ -lscrclient \ - -lxqutils + -lxqutils \ + -lPlatformEnv include(casoftwareregistry_s60.pri) } diff -r 397d00875918 -r 156f692b1687 contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp --- a/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casoftwareregistry/s60/src/casoftwareregistry_p.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -22,6 +22,7 @@ #include #include #include +#include #include "casoftwareregistry.h" #include "casoftwareregistry_p.h" @@ -39,6 +40,9 @@ typedef QScopedPointer > ScrScopedPointer; + +typedef QScopedPointer > RFSScopedPointer; /*! Constructor \param servicePublic Pointer to object of the public class. @@ -67,7 +71,8 @@ CaSoftwareRegistry::DetailMap result; if (componentId >= 1) { - ScrScopedPointer scr(new RSoftwareComponentRegistry); + RSoftwareComponentRegistry softwareComponentRegistry; + ScrScopedPointer scr(&softwareComponentRegistry); QT_TRAP_THROWING(User::LeaveIfError(scr->Connect())); QScopedPointer entry; @@ -99,13 +104,52 @@ XQConversions::s60DescToQString(entry.Vendor()); QString drives; + TChar drive; + const TInt driveListLen(entry.InstalledDrives().Length()); for (TInt i( 0 ); i < driveListLen; ++i) { if (entry.InstalledDrives()[i] != '\0') { + if (!drives.isEmpty()) { drives = drives.append(","); - } - drives = drives.append(QChar('A'+ i)).append(":"); + } + + if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultPhoneMemory, drive ) == KErrNone + && QChar('A'+ i) == QChar(drive)) + { + drives = drives.append(QChar('A'+ i)).append(":").append( + " txt_applib_dialog_1_device_memory"); + } + else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, drive ) == KErrNone + && QChar('A'+ i) == QChar(drive)) + { + drives = drives.append(QChar('A'+ i)).append(":").append( + " txt_applib_dialog_1_mass_storage"); + } + else if(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, drive ) == KErrNone + && QChar('A'+ i) == QChar(drive)) + { + RFs fs; + RFSScopedPointer fSPointer(&fs); + qt_symbian_throwIfError(fs.Connect()); + + TInt driveNumber; + TVolumeInfo tv; + DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, driveNumber ); + + qt_symbian_throwIfError(fs.Volume(tv, driveNumber)); + if(tv.iName.Length()) { + drives = drives.append(QChar('A'+ i)).append(": ").append( + XQConversions::s60DescToQString(tv.iName)); + } + else { + drives = drives.append(QChar('A'+ i)).append(":").append( + " txt_applib_dialog_1_memory_card"); + } + } + else { + drives = drives.append(QChar('A'+ i)).append(":"); + } } } diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/caappscanner/group/caappscanner.mmp --- a/contentstorage/casrv/caappscanner/group/caappscanner.mmp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/caappscanner/group/caappscanner.mmp Fri Jun 11 13:58:37 2010 +0300 @@ -58,5 +58,3 @@ LIBRARY sisregistryclient.lib LIBRARY platformenv.lib LIBRARY scrclient.lib -// temporary till cWRT will be in SCR -LIBRARY WidgetRegistryClient.lib diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/caappscanner/inc/casrvappscanner.h --- a/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/caappscanner/inc/casrvappscanner.h Fri Jun 11 13:58:37 2010 +0300 @@ -416,12 +416,10 @@ /** * Adds or updates component id attribute in entry based on SCR provided data - * @param appInfo application data carrying full path name of application file. * @param aEntry entry being updated with component id attribute. * @return ETrue when component id attribute of the entry has been added or changed. */ - TBool UpdateComponentIdL( TApaAppInfo& appInfo, - CCaInnerEntry& aEntry ) const; + TBool UpdateComponentIdL( CCaInnerEntry& aEntry ) const; /** * Schedule appscanner run. diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/caappscanner/src/casrvappscanner.cpp --- a/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/caappscanner/src/casrvappscanner.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -21,7 +21,6 @@ #include #include #include -#include #include "cadef.h" #include "casrvappscanner.h" @@ -924,7 +923,7 @@ } - if ( UpdateComponentIdL( *info, *aEntry ) ) + if ( UpdateComponentIdL( *aEntry ) ) { changed = ETrue; } @@ -944,24 +943,37 @@ KCaAttrAppSettingsPlugin, KCaAttrJavaAppSettingsPluginValue ); } - else if (appTypeUid == KCWRTApplicationTypeUid) + else if ( appTypeUid == KCWRTApplicationTypeUid ) { aEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT ); - aEntry->AddAttributeL( - KCaAttrAppWidgetUri, - KCaAttrAppWidgetUriCWRTValue ); - // web id should be taken from SCR when supported - RWidgetRegistryClientSession wrtSession; - CleanupClosePushL(wrtSession); - User::LeaveIfError( wrtSession.Connect()); - TFileName bundleId; - wrtSession.GetWidgetBundleId(info->iUid, bundleId); - aEntry->AddAttributeL( - KCaAttrAppWidgetParamWebAppId, - bundleId ); - CleanupStack::PopAndDestroy(&wrtSession); + TComponentId compId = + iSoftwareRegistry.GetComponentIdForAppL( info->iUid ); + CPropertyEntry* isMiniview = + iSoftwareRegistry.GetComponentPropertyL( compId, + KCaScrPropertyIsMiniviewSupported ); + CleanupStack::PushL( isMiniview ); + // check first if we support mini view + if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty && + static_cast(isMiniview)->IntValue()) + { + CPropertyEntry* appId = + iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId ); + CleanupStack::PushL( appId ); + if ( appId && + appId->PropertyType() == CPropertyEntry::ELocalizedProperty ) + { + aEntry->AddAttributeL( + KCaAttrAppWidgetUri, + KCaAttrAppWidgetUriCWRTValue ); + aEntry->AddAttributeL( + KCaAttrAppWidgetParamWebAppId, + static_cast(appId)->StrValue() ); + } + CleanupStack::PopAndDestroy( appId ); + } + CleanupStack::PopAndDestroy( isMiniview ); } } } @@ -1245,33 +1257,23 @@ // --------------------------------------------------------- // // ---------------------------------------------------------// -TBool CCaSrvAppScanner::UpdateComponentIdL( TApaAppInfo& appInfo, - CCaInnerEntry& aEntry ) const +TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const { TBool updated( EFalse ); - CComponentFilter* const fileNameFilter = CComponentFilter::NewLC(); - - fileNameFilter->SetFileL( appInfo.iFullName ); - - RArray componentIds; - CleanupClosePushL( componentIds ); - iSoftwareRegistry.GetComponentIdsL( componentIds, fileNameFilter ); + TUid uid; + TInt err(KErrNone); + TComponentId componentId( 0 ); + TRAP(err, componentId = + iSoftwareRegistry.GetComponentIdForAppL( + uid.Uid( aEntry.GetUid() ) ) ) - if ( componentIds.Count() == 0 ) - { - CComponentFilter* const uidFilter = CComponentFilter::NewLC(); - uidFilter->AddPropertyL(_L("Uid"), aEntry.GetUid()); - iSoftwareRegistry.GetComponentIdsL( componentIds, uidFilter ); - CleanupStack::PopAndDestroy( uidFilter ); - } - - if ( componentIds.Count() == 1 ) + if ( componentId > 0 && err == KErrNone ) { RBuf newComponentId; newComponentId.CleanupClosePushL(); newComponentId.CreateL( sizeof(TComponentId) + 1 ); - newComponentId.AppendNum( componentIds[0] ); + newComponentId.AppendNum( componentId ); RBuf oldComponentId; oldComponentId.CleanupClosePushL(); @@ -1293,9 +1295,5 @@ CleanupStack::PopAndDestroy( &oldComponentId ); CleanupStack::PopAndDestroy( &newComponentId ); } - - CleanupStack::PopAndDestroy( &componentIds ); - CleanupStack::PopAndDestroy( fileNameFilter ); - return updated; } diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h --- a/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/calocalizerscanner/inc/calocalizerscannerproxy.h Fri Jun 11 13:58:37 2010 +0300 @@ -91,6 +91,9 @@ */ const TDesC& GetEntryText( const RPointerArray& aEntries, TInt aId ); + + const TDesC& GetEntryDescription( + const RPointerArray& aEntries, TInt aId ); private: diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp --- a/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -28,8 +28,9 @@ #include "cadef.h" #include "cainnerquery.h" #include "cainnerentry.h" +#include "casqlcommands.h" -_LIT(KPathLoc,"z:/resource/qt/translations"); + // --------------------------------------------------------------------------- // CCaLocalizerScannerProxy::NewL @@ -135,9 +136,14 @@ { localizedName = GetLocalizedNameLC( locals[i] ); - if( localizedName->Compare( - GetEntryText( entries, locals[i]->GetRowId() ) ) ) - // translation different than text + if( locals[i]->GetAttributeName().Compare( KColumnEnText) == 0 + && !localizedName->Compare( + GetEntryText( entries, locals[i]->GetRowId() ) ) == 0 + || + locals[i]->GetAttributeName().Compare( KColumnEnDescription) == 0 + && !localizedName->Compare( + GetEntryDescription( entries, locals[i]->GetRowId() ) ) == 0 ) + // translations different than text { locals[i]->SetLocalizedStringL( *localizedName ); iStorageProxy->LocalizeEntryL( *( locals[i] ) ); @@ -160,7 +166,42 @@ { if( iRecentQmFile.Compare( aLocEntry->GetQmFilename() ) ) { - HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KPathLoc ); + + if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathC ) ) + { + if( !HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), KLocalizationFilepathZ ) ) + { + // this should not be called too often + TChar currentDriveLetter; + TDriveList driveList; + RFs fs; + User::LeaveIfError( fs.Connect() ); + User::LeaveIfError( fs.DriveList( driveList ) ); + + RBuf path; + path.Create( KLocalizationFilepath().Length() + 1 ); + CleanupClosePushL( path ); + + for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- ) + { + if ( driveList[driveNr] ) + { + User::LeaveIfError( fs.DriveToChar( driveNr, + currentDriveLetter ) ); + path.Append( currentDriveLetter ); + path.Append( KLocalizationFilepath ); + if( HbTextResolverSymbian::Init( aLocEntry->GetQmFilename(), path ) ) + { + break; + } + } + path.Zero(); + } + CleanupStack::PopAndDestroy( &path ); + fs.Close(); + } + } + // keeping last qm filename to avoid another initialization iRecentQmFile.Close(); iRecentQmFile.Create( aLocEntry->GetQmFilename().Length() ); @@ -186,3 +227,21 @@ } return KNullDesC(); } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +const TDesC& CCaLocalizerScannerProxy::GetEntryDescription( + const RPointerArray& aEntries, TInt aId ) + { + TInt entriesCount = aEntries.Count(); + for( TInt i=0; i < entriesCount; i++ ) + { + if( aEntries[i]->GetId() == aId ) + { + return aEntries[i]->GetDescription(); + } + } + return KNullDesC(); + } diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp --- a/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/group/cawidgetscanner.mmp Fri Jun 11 13:58:37 2010 +0300 @@ -61,4 +61,11 @@ LIBRARY xmlengineDOM.lib LIBRARY scrclient.lib + +// HB LIBRARIES +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +LIBRARY HbCore.lib + + + // End of file diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetdescription.h Fri Jun 11 13:58:37 2010 +0300 @@ -232,6 +232,24 @@ TPtrC GetServiceXml() const; /* + /* + * Localizes title and description, fill string id fields + */ + void LocalizeTextsL(); + + /* + * StringIdDescription time getter + * @return StringIdDescription + */ + TPtrC GetStringIdDescription() const; + + /* + * StringIdTitle time getter + * @return widget StringIdTitle + */ + TPtrC GetStringIdTitle() const; + + /* * Set manifest file path name. * @param aServiceXml Manifest file path name. */ @@ -242,8 +260,12 @@ * @return Manifest file path name. */ TPtrC GetManifestFilePathName() const; + + void SetStringIdDescriptionL( const TDesC& aStringIdDescription ); + + void SetStringidTitleL( const TDesC& aStringIdTitle ); + private: - /* * Library name getter * @return libraru name @@ -336,6 +358,14 @@ * Manifest file path name. */ RBuf iManifestFilePathName; + /* + * Strign id of title + */ + RBuf iStringIdTitle; + /* + * Strign id of description + */ + RBuf iStringIdDescription; }; typedef RPointerArray RWidgetArray; diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerdef.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,54 @@ +/* +* 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: Globals for Content Publisher server + * +*/ + + +#ifndef CA_WIDGETSCANNERDEF_H +#define CA_WIDGETSCANNERDEF_H + +// CONSTANTS +const TInt KChunkSize = 8192; +const TInt KDriveLetterLength = 2; +const TInt KModificationTimeLength = 17; +const TInt KNoId = -1; + +// LIT +_LIT( KDoubleSlash, "\\" ); +_LIT( KWidgetScannerUnderline, "_" ); +_LIT( KWidgetScannerCaEntry, "CA_ENTRY" ); +_LIT( KWidgetScannerEnText, "EN_TEXT" ); +_LIT( KWidgetScannerEnDescription, "EN_DESCRIPTION" ); + + +_LIT( KManifest, ".manifest"); +_LIT( KColen, ":" ); +_LIT( KImportDir, "\\private\\20022F35\\import\\widgetregistry\\" ); +_LIT( KTrue, "true" ); +_LIT8(KWidget, "widget" ); +_LIT8(KUri, "uri" ); +_LIT8(KLibrary, "library" ); +_LIT8(KTitle, "title" ); +_LIT8(KDescription, "description" ); +_LIT8(KHidden, "hidden" ); +_LIT8(KIconUri, "iconuri" ); +_LIT8(KWidgetProvider, "widgetprovider"); + +_LIT8(KWidgetManifest, "hswidgetmanifest"); +_LIT8(KIcon, "icon"); +_LIT8(KServiceXml, "servicexml"); + + +#endif // CA_WIDGETSCANNERDEF_H diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h --- a/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/inc/cawidgetstoragehandler.h Fri Jun 11 13:58:37 2010 +0300 @@ -112,6 +112,14 @@ * @param aWidget widget. */ void ClearVisibleFlagL( const CCaWidgetDescription* aWidget ); + + /** + * Set localizations for widget in db + * @param aWidget widget. + * @param aEntryId of widget. + */ + void SetLocalizationsL( const CCaWidgetDescription* aWidget, + TInt aEntryId ); private: diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -22,11 +22,9 @@ #include "cawidgetdescription.h" #include "cainnerentry.h" #include "widgetscannerutils.h" +#include "hbtextresolversymbian.h" -// CONST -const TInt KNoId = -1; -_LIT( KDoubleSlash, "\\" ); - +#include "cawidgetscannerdef.h" // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -143,6 +141,8 @@ iMmcId.Close(); iServiceXml.Close(); iManifestFilePathName.Close(); + iStringIdTitle.Close(); + iStringIdDescription.Close(); } // ---------------------------------------------------------------------------- @@ -311,6 +311,26 @@ // // ----------------------------------------------------------------------------- // +void CCaWidgetDescription::SetStringIdDescriptionL( const TDesC& aStringIdDescription ) + { + iStringIdDescription.Close(); + iStringIdDescription.CreateL( aStringIdDescription ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CCaWidgetDescription::SetStringidTitleL( const TDesC& aStringIdTitle ) + { + iStringIdTitle.Close(); + iStringIdTitle.CreateL( aStringIdTitle ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// TInt CCaWidgetDescription::GetEntryId( ) const { return iEntryId; @@ -329,6 +349,24 @@ // // ----------------------------------------------------------------------------- // +TPtrC CCaWidgetDescription::GetStringIdDescription() const + { + return iStringIdDescription; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// + +TPtrC CCaWidgetDescription::GetStringIdTitle() const + { + return iStringIdTitle; + } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// TPtrC CCaWidgetDescription::GetLibrary( ) const { return iLibrary; @@ -553,6 +591,74 @@ return iServiceXml; } +void CCaWidgetDescription::LocalizeTextsL() + { + + + if( iUri.Length() ) + { + RBuf uri; + uri.Create( iUri.Length() + 1 ); + CleanupClosePushL( uri ); + uri.Copy( iUri ); + uri.Append( KWidgetScannerUnderline ); + + + if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathC ) ) + { + if( !HbTextResolverSymbian::Init( uri, KLocalizationFilepathZ ) ) + { + // this should not be called too often + TChar currentDriveLetter; + TDriveList driveList; + RFs fs; + User::LeaveIfError( fs.Connect() ); + User::LeaveIfError( fs.DriveList( driveList ) ); + + RBuf path; + path.Create( KLocalizationFilepath().Length() + 1 ); + CleanupClosePushL( path ); + + for ( TInt driveNr=EDriveY; driveNr >= EDriveA; driveNr-- ) + { + if ( driveList[driveNr] ) + { + User::LeaveIfError( fs.DriveToChar( driveNr, + currentDriveLetter ) ); + path.Append( currentDriveLetter ); + path.Append( KLocalizationFilepath ); + if( HbTextResolverSymbian::Init( uri, path ) ) + { + break; + } + } + path.Zero(); + } + CleanupStack::PopAndDestroy( &path ); + fs.Close(); + } + } + + HBufC* tmp; + + if( iTitle.Length() ) + { + SetStringidTitleL( iTitle ); + tmp = HbTextResolverSymbian::LoadLC( iTitle ); + SetTitleL( *tmp ); + CleanupStack::PopAndDestroy( tmp ); + } + if( iDescription.Length() ) + { + SetStringIdDescriptionL( iDescription ); + tmp = HbTextResolverSymbian::LoadLC( iDescription ); + SetDescriptionL( *tmp ); + CleanupStack::PopAndDestroy( tmp ); + } + CleanupStack::PopAndDestroy( &uri ); + } + } + /* * Set manifest file path name * @param aManifestFilePt diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetscannerparser.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -28,30 +28,8 @@ #include "cawidgetscannerparser.h" #include "widgetscannerutils.h" -// CONSTANTS - -const TInt KChunkSize = 8192; -const TInt KDriveLetterLength = 2; -const TInt KModificationTimeLength = 17; +#include "cawidgetscannerdef.h" -_LIT( KManifest, ".manifest"); -_LIT( KColen, ":" ); -_LIT( KImportDir, "\\private\\20022F35\\import\\widgetregistry\\" ); -//_LIT( KImportDir, "import\\widgetregistry\\" ); -_LIT( KDoubleSlash, "\\" ); -_LIT( KTrue, "true" ); -_LIT8(KWidget, "widget" ); -_LIT8(KUri, "uri" ); -_LIT8(KLibrary, "library" ); -_LIT8(KTitle, "title" ); -_LIT8(KDescription, "description" ); -_LIT8(KHidden, "hidden" ); -_LIT8(KIconUri, "iconuri" ); -_LIT8(KWidgetProvider, "widgetprovider"); - -_LIT8(KWidgetManifest, "hswidgetmanifest"); -_LIT8(KIcon, "icon"); -_LIT8(KServiceXml, "servicexml"); // ============================ MEMBER FUNCTIONS =============================== @@ -182,7 +160,7 @@ RBuf fullFilePath; CleanupClosePushL( fullFilePath ); fullFilePath.CreateL( manifestDirectoryPath->Length() + - (*fileList)[i].iName.Length()); + (*fileList)[i].iName.Length() ); fullFilePath.Append( *manifestDirectoryPath ); fullFilePath.Append( (*fileList)[i].iName ); //if file is corrupted we go to the next one @@ -233,11 +211,12 @@ iWidgetDescriptor->SetManifestFilePathNameL( aFilePath ); SetMmcIdL( iWidgetDescriptor ); - + RXmlEngNodeList childElementList; CleanupClosePushL(childElementList); docElement.GetChildElements(childElementList); TXmlEngElement element; + while (childElementList.HasNext()) { element = childElementList.Next(); diff -r 397d00875918 -r 156f692b1687 contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp --- a/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetstoragehandler.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -25,9 +25,14 @@ #include "cainnerquery.h" #include "castorageproxy.h" #include "caarraycleanup.inl" +#include "calocalizationentry.h" + +#include "cawidgetscannerdef.h" + using namespace Usif; + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -112,6 +117,9 @@ CCaInnerEntry* entry = aWidget->GetEntryLC(); UpdateComponentIdL( aWidget->GetManifestFilePathName(), *entry ); iStorage->AddL( entry ); + + SetLocalizationsL( aWidget, entry->GetId() ); + if( entry->GetFlags() & ERemovable ) { AddWidgetToDownloadCollectionL( entry ); @@ -141,6 +149,9 @@ } entry->SetFlags( entry->GetFlags() & ~EMissing | EVisible ); iStorage->AddL( entry, EFalse, itemAppearanceChange ); + + SetLocalizationsL( aWidget, entry->GetId() ); + if( !aWidget->IsMissing() ) { AddWidgetToDownloadCollectionL( entry ); @@ -157,6 +168,7 @@ iUpdatedIndexes.Reset(); for( TInt i = 0; i < aWidgets.Count(); i++ ) { + aWidgets[i]->LocalizeTextsL(); TInt index = iWidgets.Find( aWidgets[i], CCaWidgetDescription::Compare ); if( index != KErrNotFound ) @@ -211,7 +223,10 @@ else { //item was uninstalled so we remove its mmc id - ClearVisibleFlagL( iWidgets[i] ); + if ( iWidgets[i]->IsVisible() ) + { + ClearVisibleFlagL( iWidgets[i] ); + } } } } @@ -269,6 +284,7 @@ RPointerArray entries; CleanupResetAndDestroyPushL( entries ); iStorage->GetEntriesL( query, entries ); + iWidgets.ResetAndDestroy(); for( TInt i = 0; i < entries.Count(); i++ ) { @@ -308,13 +324,10 @@ void CCaWidgetStorageHandler::ClearVisibleFlagL( const CCaWidgetDescription* aWidget ) { - if( aWidget->IsVisible() ) - { - CCaInnerEntry* entry = aWidget->GetEntryLC(); - entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed ); - iStorage->AddL( entry, EFalse, EItemDisappeared ); - CleanupStack::PopAndDestroy( entry ); - } + CCaInnerEntry* entry = aWidget->GetEntryLC(); + entry->SetFlags( entry->GetFlags() & ~EVisible & ~EMissing & ~EUsed ); + iStorage->AddL( entry, EFalse, EItemDisappeared ); + CleanupStack::PopAndDestroy( entry ); } // ---------------------------------------------------------------------------- @@ -337,6 +350,52 @@ } return massStorageNotInUse; } +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// + +void CCaWidgetStorageHandler::SetLocalizationsL( const CCaWidgetDescription* aWidget, + TInt aEntryId ) + { + RBuf filename; + filename.Create( aWidget->GetUri().Length() + 1 ); //1 for _ + CleanupClosePushL( filename ); + filename.Copy( aWidget->GetUri() ); + filename.Append( KWidgetScannerUnderline ); + + // prepare localizations + if ( aWidget->GetTitle().Length() > 0 && + aWidget->GetTitle().Compare( aWidget->GetStringIdTitle() ) ) + // lets do not add localization when key and value are identical + { + CCaLocalizationEntry* titleEntry = CCaLocalizationEntry::NewL(); + CleanupStack::PushL( titleEntry ); + titleEntry->SetTableNameL( KWidgetScannerCaEntry ); + titleEntry->SetAttributeNameL( KWidgetScannerEnText ); + titleEntry->SetStringIdL( aWidget->GetStringIdTitle() ); + titleEntry->SetQmFilenameL( filename ); + titleEntry->SetRowId( aEntryId ); + iStorage->AddLocalizationL( *titleEntry ); + CleanupStack::PopAndDestroy( titleEntry ); + } + if ( aWidget->GetDescription().Length() > 0 && + aWidget->GetDescription().Compare( + aWidget->GetStringIdDescription() ) ) + // lets do not add localization when key and value are identical + { + CCaLocalizationEntry* descEntry = CCaLocalizationEntry::NewL(); + CleanupStack::PushL( descEntry ); + descEntry->SetTableNameL( KWidgetScannerCaEntry ); + descEntry->SetAttributeNameL( KWidgetScannerEnDescription ); + descEntry->SetStringIdL( aWidget->GetStringIdDescription() ); + descEntry->SetQmFilenameL( filename ); + descEntry->SetRowId( aEntryId ); + iStorage->AddLocalizationL( *descEntry ); + CleanupStack::PopAndDestroy( descEntry ); + } + CleanupStack::PopAndDestroy( &filename ); + } // ---------------------------------------------------------------------------- // diff -r 397d00875918 -r 156f692b1687 contentstorage/castorage/inc/casqlcommands.h --- a/contentstorage/castorage/inc/casqlcommands.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/castorage/inc/casqlcommands.h Fri Jun 11 13:58:37 2010 +0300 @@ -70,8 +70,10 @@ _LIT( KSQLUpdateIcon, "UPDATE CA_ICON SET " ); _LIT( KSQLUpdateEntryUsedFlag, "UPDATE CA_ENTRY SET \ EN_FLAGS = EN_FLAGS | :EN_FLAGS WHERE ENTRY_ID = :LA_ENTRY_ID"); -_LIT( KSQLLocalizeEntry, "UPDATE CA_ENTRY SET \ +_LIT( KSQLLocalizeTextEntry, "UPDATE CA_ENTRY SET \ EN_TEXT = :LT_STRING WHERE ENTRY_ID = :LT_ROW_ID"); // WHERE ENTRY_ID must be changed if an attribute +_LIT( KSQLLocalizeDescriptionEntry, "UPDATE CA_ENTRY SET \ +EN_DESCRIPTION = :LT_STRING WHERE ENTRY_ID = :LT_ROW_ID"); // WHERE ENTRY_ID must be changed if an attribute _LIT( KSQLUpdatePositionInGroup, "UPDATE CA_GROUP_ENTRY SET \ GE_POSITION = :GE_POSITION WHERE \ diff -r 397d00875918 -r 156f692b1687 contentstorage/castorage/src/casqlitestorage.cpp --- a/contentstorage/castorage/src/casqlitestorage.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/castorage/src/casqlitestorage.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -214,8 +214,17 @@ void CCaSqLiteStorage::LocalizeEntryL( CCaLocalizationEntry& aLocalization ) { CCaSqlQuery* sqlLocalizeEntryQuery = CCaSqlQuery::NewLC( iSqlDb ); - CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlLocalizeEntryQuery, - KSQLLocalizeEntry); + if( aLocalization.GetAttributeName().Compare( KColumnEnText ) == 0 ) + { + CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery, + KSQLLocalizeTextEntry ); + } + else if ( aLocalization.GetAttributeName().Compare( + KColumnEnDescription ) == 0 ) + { + CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery, + KSQLLocalizeDescriptionEntry ); + } sqlLocalizeEntryQuery->PrepareL(); sqlLocalizeEntryQuery->BindValuesForLocalizeL( aLocalization ); sqlLocalizeEntryQuery->ExecuteL( ); diff -r 397d00875918 -r 156f692b1687 contentstorage/cautils/inc/calocalizationentry.h --- a/contentstorage/cautils/inc/calocalizationentry.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/cautils/inc/calocalizationentry.h Fri Jun 11 13:58:37 2010 +0300 @@ -100,7 +100,7 @@ IMPORT_C void SetRowId( TUint aRowId ); /** - + Sets localization id */ IMPORT_C void SetTextId( TUint aId ); @@ -197,7 +197,7 @@ RBuf iLocalName; /* - * Translated string. + * Qm filename. * Own. */ RBuf iQmFilename; diff -r 397d00875918 -r 156f692b1687 contentstorage/inc/cadef.h --- a/contentstorage/inc/cadef.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/inc/cadef.h Fri Jun 11 13:58:37 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: Definition of different constants - * Version : %version: 10.1.16 % << Don't touch! Updated by Synergy at check-out. + * Version : %version: ou1s60ui#10.1.19 % << Don't touch! Updated by Synergy at check-out. * */ @@ -94,11 +94,17 @@ _LIT( KCaAttrAppWidgetUriCWRTValue, "wrtwidgetuiplugin"); _LIT( KCaAttrAppWidgetParamWebAppId, "widgetparam:webAppId"); +_LIT( KCaScrPropertyAppId, "AppID"); +_LIT( KCaScrPropertyIsMiniviewSupported, "isMiniviewSupported"); _LIT( KCaAppGroupName, "appgroup_name" ); _LIT( KCollectionIconFileName, "qtg_large_applications_user"); +_LIT(KLocalizationFilepathZ, "z:/resource/qt/translations"); +_LIT(KLocalizationFilepathC, "c:/resource/qt/translations"); +_LIT(KLocalizationFilepath, ":/resource/qt/translations"); + const TInt KGranularityOne = 1; const TInt KUidChars = 10; const TInt KDefaultGranularity = 5; @@ -134,7 +140,7 @@ const TUid KCWRTApplicationTypeUid = { - 0x200267DC + 0x10282821 }; const TInt KCenRepBufferSize = 255; diff -r 397d00875918 -r 156f692b1687 contentstorage/srvinc/cainstallstrategy.h --- a/contentstorage/srvinc/cainstallstrategy.h Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/srvinc/cainstallstrategy.h Fri Jun 11 13:58:37 2010 +0300 @@ -156,9 +156,10 @@ private: /** - * Contains uid of application that was started to uninstall. + * Contains uninstallation status of application + * that was started to uninstall. */ - TInt iAppUid; + TInt iUninstallStatus; }; diff -r 397d00875918 -r 156f692b1687 contentstorage/srvsrc/cainstallstrategy.cpp --- a/contentstorage/srvsrc/cainstallstrategy.cpp Thu May 27 13:11:12 2010 +0300 +++ b/contentstorage/srvsrc/cainstallstrategy.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -18,6 +18,7 @@ #include #include #include "cainstallstrategy.h" +#include // --------------------------------------------------------------------------- // @@ -140,16 +141,16 @@ void CCaUsifUninstallStrategy::NotifyListenerL( RProperty& aProperty, MCaInstallListener& aListener ) { - TInt appUid; - User::LeaveIfError( aProperty.Get( KPSUidSWInstallerUiNotification, - KSWInstallerUninstallation, appUid ) ); - // if there is some value!=0 in iAppUid and appUid==0 that means - // application with uid==iAppUid was uninstalled, so we notify aListener - if( iAppUid && !appUid ) + TInt status; + // TODO: Temporary solution for incorrect USIF notifications + User::LeaveIfError( aProperty.Get( KUidSystemCategory, + Swi::KUidSoftwareInstallKey, status ) ); + //if( status == ( Swi::ESwisStatusSuccess | Swi::ESwisUninstall ) ) + if( iUninstallStatus == Swi::ESwisUninstall && !status ) { - aListener.HandleInstallNotifyL( iAppUid ); - } - iAppUid = appUid; + aListener.HandleInstallNotifyL( iUninstallStatus ); + } + iUninstallStatus = status; } // --------------------------------------------------------------------------- @@ -158,8 +159,7 @@ // CCaUsifUninstallStrategy::CCaUsifUninstallStrategy( RProperty& aProperty ) { - aProperty.Attach( - KPSUidSWInstallerUiNotification, KSWInstallerUninstallation ); + aProperty.Attach( KUidSystemCategory, Swi::KUidSoftwareInstallKey ); } // --------------------------------------------------------------------------- diff -r 397d00875918 -r 156f692b1687 homescreensrv_plat/contentstorage_api/cadefs.h --- a/homescreensrv_plat/contentstorage_api/cadefs.h Thu May 27 13:11:12 2010 +0300 +++ b/homescreensrv_plat/contentstorage_api/cadefs.h Fri Jun 11 13:58:37 2010 +0300 @@ -70,7 +70,7 @@ UnknownErrorCode }; -const QString caCmdOpen("open"); +static const QString caCmdOpen("open"); #ifndef QT_NO_DEBUG_OUTPUT # define USE_QDEBUG_IF(predicate) if (!predicate) {} else qDebug() diff -r 397d00875918 -r 156f692b1687 homescreensrv_plat/contentstorage_api/caitemmodel.h --- a/homescreensrv_plat/contentstorage_api/caitemmodel.h Thu May 27 13:11:12 2010 +0300 +++ b/homescreensrv_plat/contentstorage_api/caitemmodel.h Fri Jun 11 13:58:37 2010 +0300 @@ -81,6 +81,7 @@ void scrollTo(int row, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + void empty(bool value); protected: // data diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/backstepping/backstepping.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/backstepping/backstepping.pro Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,20 @@ +# +# 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 +symbian { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\"" + } diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/backstepping/bwins/tsbacksteppingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/backstepping/bwins/tsbacksteppingu.def Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + ?NewLC@CTsBackstepping@@SAPAV1@AAVRWsSession@@@Z @ 1 NONAME ; class CTsBackstepping * CTsBackstepping::NewLC(class RWsSession &) + ?NewL@CTsBackstepping@@SAPAV1@AAVRWsSession@@@Z @ 2 NONAME ; class CTsBackstepping * CTsBackstepping::NewL(class RWsSession &) + ??1CTsBackstepping@@UAE@XZ @ 3 NONAME ; CTsBackstepping::~CTsBackstepping(void) + diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/backstepping/eabi/tsbacksteppingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/backstepping/eabi/tsbacksteppingu.def Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,9 @@ +EXPORTS + _ZN15CTsBackstepping4NewLER10RWsSession @ 1 NONAME + _ZN15CTsBackstepping5NewLCER10RWsSession @ 2 NONAME + _ZN15CTsBacksteppingD0Ev @ 3 NONAME + _ZN15CTsBacksteppingD1Ev @ 4 NONAME + _ZN15CTsBacksteppingD2Ev @ 5 NONAME + _ZTI15CTsBackstepping @ 6 NONAME + _ZTV15CTsBackstepping @ 7 NONAME + diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/backstepping/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/backstepping/group/bld.inf Fri Jun 11 13:58:37 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: +* +*/ +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +tsbackstepping.mmp diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/backstepping/group/tsbackstepping.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/backstepping/group/tsbackstepping.mmp Fri Jun 11 13:58:37 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: +* +*/ + +TARGET tsbackstepping.dll +TARGETTYPE dll +UID 0x1000008d 0x200267AD +SECUREID 0x200267AD +CAPABILITY ALL -TCB + +EPOCHEAPSIZE 0x100000 0x600000 // 1MB - 6MB + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE tsbackstepping.cpp + +LIBRARY euser.lib +LIBRARY ws32.lib // for RWsSession +LIBRARY apgrfx.lib // for TApaTask / TApaTasksList + +DEBUGLIBRARY flogger.lib diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/backstepping/inc/tsbackstepping.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/backstepping/inc/tsbackstepping.h Fri Jun 11 13:58:37 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 __CBACKSTEPPING_H +#define __CBACKSTEPPING_H + +#include + + + +class CTsBackstepping : public CActive +{ +public: + IMPORT_C static CTsBackstepping* NewL(RWsSession &); + IMPORT_C static CTsBackstepping* NewLC(RWsSession &); + IMPORT_C virtual ~CTsBackstepping(); + +private: + CTsBackstepping(RWsSession&); + void ConstructL(); + void RunL(); + TInt RunError(TInt error); + void DoCancel(); + void Subscribe(); + void AnalyseWindowStackL(); + +private: + RWsSession &mWsSession; + RWindowGroup mWg; +}; + +#endif // __CBACKSTEPPING_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/backstepping/src/tsbackstepping.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/backstepping/src/tsbackstepping.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,213 @@ +/* +* 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 // key event +#include // for CApaWindowGroupName +#include +#include +#include +#include +#include +#include + +#include "tsbackstepping.h" + +const TUid KHSUid = {0x20022f35}; +const int KOrdinalPositionNoZOrder(-1); + + +/** + * CTsBackstepping::NewL + * two phase constructor + */ +EXPORT_C CTsBackstepping* CTsBackstepping::NewL(RWsSession &session) + { + RDebug::Print(_L("CTsBackstepping::NewL")); + CTsBackstepping* self = CTsBackstepping::NewLC(session); + CleanupStack::Pop(self); + return self; + } + +/** + * CTsBackstepping::NewLC + * two phase constructor + */ +EXPORT_C CTsBackstepping* CTsBackstepping::NewLC(RWsSession &session) +{ + CTsBackstepping* self = new (ELeave) CTsBackstepping(session); + CleanupStack::PushL(self); + self->ConstructL(); + return self; +} + +/** + * CTsBackstepping::CTsBackstepping + * constructor + */ +CTsBackstepping::CTsBackstepping(RWsSession &session) +:CActive(EPriorityStandard), +mWsSession(session) +{ + CActiveScheduler::Add(this); +} + + +/** + * CTsBackstepping::~CTsBackstepping + * deconstructor + */ +EXPORT_C CTsBackstepping::~CTsBackstepping() +{ + RDebug::Print(_L("CTsBackstepping::~CTsBackstepping")); + // Cancel AO + Cancel(); + // Close opened session + mWg.Close(); + +} + +/** + * CTsBackstepping::ConstructL + * two phase constructor + */ +void CTsBackstepping::ConstructL () +{ + RDebug::Print(_L("CTsBackstepping::ConstructL")); + // Initial window group + mWg = RWindowGroup (mWsSession); + User::LeaveIfError (mWg.Construct ((TUint32)&mWg, EFalse)); + mWg.SetOrdinalPosition (KOrdinalPositionNoZOrder); + mWg.EnableReceiptOfFocus (EFalse); + + // Hide window + CApaWindowGroupName* wn = CApaWindowGroupName::NewLC (mWsSession); + wn->SetHidden (ETrue); + wn->SetWindowGroupName (mWg); + CleanupStack::PopAndDestroy (wn); + + // Window group change event + User::LeaveIfError (mWg.EnableGroupListChangeEvents()); + + TRAP_IGNORE(AnalyseWindowStackL());//not critical operation + Subscribe(); +} + +/** + * CTsBackstepping::RunL + * called for handling events from window server + */ +void CTsBackstepping::RunL() +{ + User::LeaveIfError(iStatus.Int()); + TWsEvent wsEvent; + mWsSession.GetEvent (wsEvent); + if (EEventWindowGroupListChanged == wsEvent.Type()) { + RDebug::Print(_L("CTsBackstepping::RunL : EEventWindowGroupListChanged")); + AnalyseWindowStackL (); + } + Subscribe(); +} + +/** + * CTsBackstepping::DoCancel + * Handling RunL errors. + */ +TInt CTsBackstepping::RunError(TInt error) +{ + if (!IsActive() && KErrCancel != error) { + Subscribe(); + } + return KErrNone; +} + +/** + * CTsBackstepping::DoCancel + * Stopping active object + */ +void CTsBackstepping::DoCancel () +{ + if (IsActive()) { + mWsSession.EventReadyCancel(); + } +} + +/** + * CTsBackstepping::ActivateListeningL + * Starts listening to Window session events + */ +void CTsBackstepping::Subscribe() +{ + RDebug::Print(_L("CTsBackstepping::Subscribe")); + // and start listening + iStatus = KRequestPending; + mWsSession.EventReady( &iStatus ); + SetActive(); +} + +/** + * CTsBackstepping::AnalyseWindowStackL + * Analyzes window stack and move homescreen to proper position + */ +void CTsBackstepping::AnalyseWindowStackL () +{ + RDebug::Print(_L("CTsBackstepping::GetWindowCaption")); + + RArray windowGroups; + CleanupClosePushL(windowGroups); + + CApaWindowGroupName *windowGroupName = CApaWindowGroupName::NewLC(mWsSession ); + //update window group list + mWsSession.WindowGroupList( &windowGroups ); + + TInt count(windowGroups.Count()); + TInt pos(0); + TInt whereToJump(1); + for (TInt i=0; iConstructFromWgIdL(info.iId); + if (windowGroupName->AppUid() != TUid::Null()) { + // find the window group id and check that it has no parent + if ( info.iParentId <= 0 ) { + RDebug::Print( _L("CTsBackstepping::GetWindowCaption wgid:%d is standalone view"), info.iId); + //check if it is homescreen + if (windowGroupName->AppUid() == KHSUid) { + RDebug::Print(_L("CTsBackstepping::GetWindowCaption Homescreen position = %d ; list:%d/%d"), pos, i, count); + if (pos <= 1) {// HS is in foreground or second in line - do nothing + RDebug::Print(_L("CTsBackstepping::nothing to be done - it will stop checking here")); + } else {//we should move homescreen to be second (ommit embeded views) from top + RDebug::Print(_L("CTsBackstepping::moving homescreen to be second from top")); + RDebug::Print(_L("CTsBackstepping::whereToJump = %d"), whereToJump); + mWsSession.SetWindowGroupOrdinalPosition(info.iId, whereToJump); + } + // and break + break; + } + pos++; + } else { + // only embeded items for first standalone launch should be counted + if (!pos) { + ++whereToJump; + } + RDebug::Print(_L("CTsBackstepping::GetWindowCaption wgid:%d is embedded view"), info.iId); + } + } + } + CleanupStack::PopAndDestroy(windowGroupName); + CleanupStack::PopAndDestroy(&windowGroups); +} + +// end of file diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/client.pri --- a/tstaskmonitor/client/client.pri Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/client.pri Fri Jun 11 13:58:37 2010 +0300 @@ -25,24 +25,35 @@ symbian { INCLUDEPATH += $$PWD/s60/inc \ $$PWD/../inc \ - $$PWD/../utils/inc \ + $$PWD/../utils/inc \ + $$PWD/../../inc \ HEADERS += $$PWD/s60/inc/tstaskmonitorobserver.h \ $$PWD/s60/inc/tstaskmonitorclient.h \ $$PWD/s60/inc/tstaskmonitorclientimpl.h \ - $$PWD/s60/inc/tstaskmonitorsession.h \ + $$PWD/s60/inc/tssession.h \ $$PWD/../utils/inc/tsfswentry.h \ + $$PWD/../utils/inc/tsentrykey.h \ $$PWD/../utils/inc/tsutils.h \ $$PWD/s60/inc/tstaskmonitor_p.h \ $$PWD/s60/inc/tsapplicationtask.h \ + $$PWD/s60/inc/tsscreenshotclient.h \ + $$PWD/s60/inc/tsscreenshotclientimpl.h \ + $$PWD/inc/tsscreenshotregistry.h \ + $$PWD/s60/inc/tsscreenshotregistry_p.h \ SOURCES += $$PWD/s60/src/tstaskmonitorclient.cpp \ $$PWD/s60/src/tstaskmonitorclientimpl.cpp \ - $$PWD/s60/src/tstaskmonitorsession.cpp \ + $$PWD/s60/src/tssession.cpp \ $$PWD/../utils/src/tsfswentry.cpp \ + $$PWD/../utils/src/tsentrykey.cpp \ $$PWD/s60/src/tstaskmonitor_p.cpp \ $$PWD/s60/src/tstask.cpp \ $$PWD/s60/src/tsapplicationtask.cpp \ + $$PWD/s60/src/tsscreenshotclient.cpp \ + $$PWD/s60/src/tsscreenshotclientimpl.cpp \ + $$PWD/src/tsscreenshotregistry.cpp \ + $$PWD/s60/src/tsscreenshotregistry_p.cpp \ LIBS += -lxqutils \ -lestor \ @@ -53,9 +64,11 @@ HEADERS += $$PWD/stub/inc/tstaskmonitor_p.h \ $$PWD/stub/inc/tsfswentry.h \ + $$PWD/stub/inc/tsscreenshotregistry_p.h \ SOURCES += $$PWD/stub/src/tstaskmonitor_p.cpp \ $$PWD/stub/src/tstask.cpp \ $$PWD/stub/src/tsfswentry.cpp \ + $$PWD/stub/src/tsscreenshotregistry_p.cpp \ } diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/client.pro --- a/tstaskmonitor/client/client.pro Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/client.pro Fri Jun 11 13:58:37 2010 +0300 @@ -25,12 +25,15 @@ dll.sources = tstaskmonitorclient.dll dll.path = $$SHARED_LIB_DIR DEPLOYMENT += dll + LIBS += -ltsutils BLD_INF_RULES.prj_exports += "s60\inc\tstaskmonitorclient.h" \ "s60\inc\tstaskmonitorobserver.h" \ "inc\tstaskmonitor.h" \ "inc\tstask.h" \ "inc\tstaskmonitor_global.h" \ + "s60\inc\tsscreenshotclient.h" \ + "inc\tsscreenshotregistry.h" \ TARGET.UID3 = 0x200267AF TARGET.CAPABILITY = ALL -TCB diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/inc/tsscreenshotregistry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/inc/tsscreenshotregistry.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,40 @@ +/* +* 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 TSSCREENSHOTREGISTRY_H +#define TSSCREENSHOTREGISTRY_H + +#include + +#include "tstaskmonitor_global.h" + +class TsScreenshotRegistryPrivate; + +class TSTASKMONITOR_EXPORT TsScreenshotRegistry +{ + +public: + TsScreenshotRegistry(); + ~TsScreenshotRegistry(); + + bool registerScreenshot(const QPixmap &screenshot); + bool unregisterScreenshot(); + +private: + TsScreenshotRegistryPrivate *d_ptr; +}; + +#endif //TSSCREENSHOTREGISTRY_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/inc/tstask.h --- a/tstaskmonitor/client/inc/tstask.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/inc/tstask.h Fri Jun 11 13:58:37 2010 +0300 @@ -36,6 +36,7 @@ TSTASKMONITOR_EXPORT bool isClosable() const; TSTASKMONITOR_EXPORT QPixmap icon() const; + TSTASKMONITOR_EXPORT QPixmap screenshot() const; TSTASKMONITOR_EXPORT QString name() const; protected: diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/inc/tsscreenshotclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/inc/tsscreenshotclient.h Fri Jun 11 13:58:37 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: +* +*/ +#ifndef TSSCREENSHOTCLIENT_H +#define TSSCREENSHOTCLIENT_H + +#include + +#include "tstaskmonitorglobals.h" + +class CFbsBitmap; +class CTsScreenshotClientImpl; + +NONSHARABLE_CLASS( CTsScreenshotClient ) : public CBase +{ +public: + IMPORT_C static CTsScreenshotClient* NewL(); + IMPORT_C static CTsScreenshotClient* NewLC(); + IMPORT_C ~CTsScreenshotClient(); + +public: + IMPORT_C TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal); + IMPORT_C void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority = Normal); + IMPORT_C TInt UnregisterScreenshot(TInt wgId); + +private: + CTsScreenshotClient(); + void ConstructL(); + +private: + CTsScreenshotClientImpl* iImpl; +}; + +#endif // TSSCREENSHOTCLIENT_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/inc/tsscreenshotclientimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/inc/tsscreenshotclientimpl.h Fri Jun 11 13:58:37 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 TSSCREENSHOTCLIENTIMPL_H +#define TSSCREENSHOTCLIENTIMPL_H + +#include + +#include "tssession.h" + +class CFbsBitmap; + +NONSHARABLE_CLASS( CTsScreenshotClientImpl ) : public CBase +{ +public: + static CTsScreenshotClientImpl* NewL(); + static CTsScreenshotClientImpl* NewLC(); + ~CTsScreenshotClientImpl(); + +public: + TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority); + void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority); + TInt UnregisterScreenshot(TInt wgId); + +private: + CTsScreenshotClientImpl(); + void ConstructL(); + + RTsSession iSession; +}; + +#endif // TSSCREENSHOTCLIENTIMPL_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/inc/tsscreenshotregistry_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/inc/tsscreenshotregistry_p.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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 TSSCREENSHOTREGISTRY_P_H +#define TSSCREENSHOTREGISTRY_P_H + +#include + +class CTsScreenshotClient; + +class TsScreenshotRegistryPrivate +{ +public: + TsScreenshotRegistryPrivate(); + ~TsScreenshotRegistryPrivate(); + +public: + bool registerScreenshot(const QPixmap &screenshot); + bool unregisterScreenshot(); + +private: + int wgId(); + +private: + CTsScreenshotClient *mClient; + +}; + +#endif //TSSCREENSHOTREGISTRY_P_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/inc/tssession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/inc/tssession.h Fri Jun 11 13:58:37 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 TSSESSION_H +#define TSSESSION_H + +#include + +#include "tstaskmonitorglobals.h" +#include "tsfswentry.h" + +NONSHARABLE_CLASS( RTsSession ) : public RSessionBase +{ +public: + TInt Connect(); + +public: // task monitor API + void TaskListL(RTsFswArray& tasks); + void Subscribe(TRequestStatus& aStatus); + void CancelSubscribe(); + +public: // screenshots API + TInt RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority); + void RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority); + TInt UnregisterScreenshot(TInt wgId); + +private: + TInt StartServer(); +}; + +#endif // TSSESSION_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/inc/tstaskmonitorclient.h --- a/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclient.h Fri Jun 11 13:58:37 2010 +0300 @@ -27,9 +27,9 @@ NONSHARABLE_CLASS( CTsTaskMonitorClient ) : public CBase { public: - IMPORT_C static CTsTaskMonitorClient* NewL(); - IMPORT_C static CTsTaskMonitorClient* NewLC(); - IMPORT_C ~CTsTaskMonitorClient(); + static CTsTaskMonitorClient* NewL(); + static CTsTaskMonitorClient* NewLC(); + ~CTsTaskMonitorClient(); public: void TaskListL(RTsFswArray& tasks); diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h --- a/tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/s60/inc/tstaskmonitorclientimpl.h Fri Jun 11 13:58:37 2010 +0300 @@ -20,7 +20,7 @@ #include #include "tsfswentry.h" -#include "tstaskmonitorsession.h" +#include "tssession.h" class MTsTaskMonitorObserver; @@ -45,7 +45,7 @@ CTsTaskMonitorClientImpl(); void ConstructL(); - RTsTaskMonitorSession iSession; + RTsSession iSession; MTsTaskMonitorObserver* iObserver; // not owned }; diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/inc/tstaskmonitorsession.h --- a/tstaskmonitor/client/s60/inc/tstaskmonitorsession.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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 TSTASKMONITORSESSION_H -#define TSTASKMONITORSESSION_H - -#include - -#include "tsfswentry.h" - -NONSHARABLE_CLASS( RTsTaskMonitorSession ) : public RSessionBase -{ -public: - TInt Connect(); - - void TaskListL(RTsFswArray& tasks); - void Subscribe(TRequestStatus& aStatus); - void CancelSubscribe(); - -private: - TInt StartServer(); -}; - -#endif // TSTASKMONITORSESSION_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tsapplicationtask.cpp --- a/tstaskmonitor/client/s60/src/tsapplicationtask.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/s60/src/tsapplicationtask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -19,7 +19,7 @@ #include #include -#include +#include #include "tsfswentry.h" diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tsscreenshotclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/src/tsscreenshotclient.cpp Fri Jun 11 13:58:37 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: +* +*/ + +#include + +#include "tsscreenshotclient.h" +#include "tsscreenshotclientimpl.h" + +EXPORT_C CTsScreenshotClient *CTsScreenshotClient::NewL() +{ + CTsScreenshotClient* self = NewLC(); + CleanupStack::Pop(self); + return self; +} + +EXPORT_C CTsScreenshotClient *CTsScreenshotClient::NewLC() +{ + CTsScreenshotClient* self = new (ELeave) CTsScreenshotClient; + CleanupStack::PushL(self); + self->ConstructL(); + return self; +} + +void CTsScreenshotClient::ConstructL() +{ + iImpl = CTsScreenshotClientImpl::NewL(); +} + +CTsScreenshotClient::CTsScreenshotClient() +{ +} + +EXPORT_C CTsScreenshotClient::~CTsScreenshotClient() +{ + delete iImpl; +} + +EXPORT_C TInt CTsScreenshotClient::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority) +{ + return iImpl->RegisterScreenshot(screenshot, wgId, priority); +} + +EXPORT_C void CTsScreenshotClient::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority) +{ + iImpl->RegisterScreenshot(status, screenshot, wgId, priority); +} + +EXPORT_C TInt CTsScreenshotClient::UnregisterScreenshot(TInt wgId) +{ + return iImpl->UnregisterScreenshot(wgId); +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tsscreenshotclientimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/src/tsscreenshotclientimpl.cpp Fri Jun 11 13:58:37 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: +* +*/ + +#include + +#include "tsscreenshotclientimpl.h" + +CTsScreenshotClientImpl* CTsScreenshotClientImpl::NewL() +{ + CTsScreenshotClientImpl* self = NewLC(); + CleanupStack::Pop(self); + return self; +} + +CTsScreenshotClientImpl* CTsScreenshotClientImpl::NewLC() +{ + CTsScreenshotClientImpl* self = new (ELeave) CTsScreenshotClientImpl; + CleanupStack::PushL(self); + self->ConstructL(); + return self; +} + +CTsScreenshotClientImpl::CTsScreenshotClientImpl() +{ +} + +CTsScreenshotClientImpl::~CTsScreenshotClientImpl() +{ + iSession.Close(); +} + +void CTsScreenshotClientImpl::ConstructL() +{ + User::LeaveIfError(iSession.Connect()); +} + +TInt CTsScreenshotClientImpl::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority) +{ + return iSession.RegisterScreenshot(screenshot, wgId, priority); +} + +void CTsScreenshotClientImpl::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority) +{ + iSession.RegisterScreenshot(status, screenshot, wgId, priority); +} + +TInt CTsScreenshotClientImpl::UnregisterScreenshot(TInt wgId) +{ + return iSession.UnregisterScreenshot(wgId); +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tsscreenshotregistry_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/src/tsscreenshotregistry_p.cpp Fri Jun 11 13:58:37 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: +* +*/ +#include "tsscreenshotregistry_p.h" + +#include +#include +#include +#include +#include + +#include "tsscreenshotclient.h" + +TsScreenshotRegistryPrivate::TsScreenshotRegistryPrivate() : mClient(0) +{ + QT_TRAP_THROWING(mClient = CTsScreenshotClient::NewL()); +} + +TsScreenshotRegistryPrivate::~TsScreenshotRegistryPrivate() +{ + delete mClient; +} + +bool TsScreenshotRegistryPrivate::registerScreenshot(const QPixmap &screenshot) +{ + QScopedPointer bitmap(screenshot.toSymbianCFbsBitmap()); + if (bitmap.isNull()) + return false; + + return KErrNone == mClient->RegisterScreenshot(bitmap.data(), wgId()); +} + +bool TsScreenshotRegistryPrivate::unregisterScreenshot() +{ + return KErrNone == mClient->UnregisterScreenshot(wgId()); +} + +int TsScreenshotRegistryPrivate::wgId() +{ + return QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId(); +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tssession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/s60/src/tssession.cpp Fri Jun 11 13:58:37 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: +* +*/ +#include +#include + +#include "tssession.h" + +TInt RTsSession::Connect() +{ + TInt retry = 4; + TInt error(KErrNone); + do { + error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0)); + if (KErrNotFound != error && KErrServerTerminated != error) { + retry = 0; + } else { + error = StartServer(); + if (KErrNone != error && KErrAlreadyExists != error) { + retry = 0; + error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0)); + } + } + } while (--retry > 0); + return error; +} + +TInt RTsSession::StartServer() +{ + RProcess server; + if (TInt error = server.Create(KRunningAppServerName, KNullDesC, TUidType(KNullUid, KNullUid, KRunningAppServerUid))) { + return error; + } + + TRequestStatus status; + server.Rendezvous(status); + if (status != KRequestPending) { + server.Kill(0); + } else { + server.Resume(); + } + + User::WaitForRequest(status); + TInt error = (EExitPanic == server.ExitType()) ? KErrGeneral : status.Int(); + if (KErrCancel == error) { + error = KErrNone; + } + server.Close(); + + return error; +} + +void RTsSession::TaskListL(RTsFswArray& tasks) +{ + for (;;) { + TPckgBuf dataSize; + User::LeaveIfError(SendReceive(GetRunningAppInfo, TIpcArgs(&dataSize))); + HBufC8* data = HBufC8::NewLC(dataSize()); + TPtr8 dataPointer(data->Des()); + TInt err = SendReceive(FlushData, TIpcArgs(&dataPointer, dataSize())); + if (err == KErrNone) { + RDesReadStream dataStream(dataPointer); + CleanupClosePushL(dataStream); + CTsFswEntry::InternalizeArrayL(dataStream, tasks); + CleanupStack::PopAndDestroy(&dataStream); + } else if (err != KErrCorrupt) { + User::Leave(err); + } + CleanupStack::PopAndDestroy(data); + if (err == KErrNone) { + break; + } + // If result was KErrCorrupt then the size received from GetRunningAppInfo is + // not valid anymore so restart the whole procedure. + } +} + +void RTsSession::Subscribe(TRequestStatus& aStatus) +{ + SendReceive(SubscribeRunningAppChanges, aStatus); +} + +void RTsSession::CancelSubscribe() +{ + SendReceive(CancelSubscribeRunningAppChanges); +} + +TInt RTsSession::RegisterScreenshot(CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority) +{ + TPckgBuf screenshotPackage(screenshot->Handle()); + TPckgBuf wgIdPackage(wgId); + TPckgBuf priorityPackage(priority); + + TIpcArgs arguments; + arguments.Set(ScreenshotHandle, &screenshotPackage); + arguments.Set(WindowsGroup, &wgIdPackage); + arguments.Set(AdditionalParameters, &KNullDesC8); + arguments.Set(Priority, &priorityPackage); + + return SendReceive(RegisterScreenshotMessage, arguments); +} + +void RTsSession::RegisterScreenshot(TRequestStatus &status, CFbsBitmap *screenshot, TInt wgId, UpdatePriority priority) +{ + TPckgBuf screenshotPackage(screenshot->Handle()); + TPckgBuf wgIdPackage(wgId); + TPckgBuf priorityPackage(priority); + + TIpcArgs arguments; + arguments.Set(ScreenshotHandle, &screenshotPackage); + arguments.Set(WindowsGroup, &wgIdPackage); + arguments.Set(AdditionalParameters, &KNullDesC8); + arguments.Set(Priority, &priorityPackage); + + SendReceive(RegisterScreenshotMessage, arguments, status); +} + +TInt RTsSession::UnregisterScreenshot(TInt wgId) +{ + TPckgBuf wgIdPackage(wgId); + + TIpcArgs arguments; + arguments.Set(WindowsGroup, &wgIdPackage); + arguments.Set(AdditionalParameters, &KNullDesC8); + + return SendReceive(UnregisterScreenshotMessage, arguments); +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tstask.cpp --- a/tstaskmonitor/client/s60/src/tstask.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/s60/src/tstask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -16,7 +16,7 @@ */ #include "tstask.h" -#include +#include #include "tsfswentry.h" @@ -43,6 +43,11 @@ return pixmap; } +QPixmap TsTask::screenshot() const +{ + return QPixmap::fromSymbianCFbsBitmap(mEntry->Screenshot()); +} + QString TsTask::name() const { return XQConversions::s60DescToQString(mEntry->AppName()); diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp --- a/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/s60/src/tstaskmonitor_p.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -32,6 +32,7 @@ TsTaskMonitorPrivate::~TsTaskMonitorPrivate() { mClient->CancelSubscribe(); + delete mClient; } QList< QSharedPointer > TsTaskMonitorPrivate::taskList() diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp --- a/tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/s60/src/tstaskmonitorclient.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -20,14 +20,14 @@ #include "tstaskmonitorclient.h" #include "tstaskmonitorclientimpl.h" -EXPORT_C CTsTaskMonitorClient *CTsTaskMonitorClient::NewL() +CTsTaskMonitorClient *CTsTaskMonitorClient::NewL() { CTsTaskMonitorClient* self = NewLC(); CleanupStack::Pop(self); return self; } -EXPORT_C CTsTaskMonitorClient *CTsTaskMonitorClient::NewLC() +CTsTaskMonitorClient *CTsTaskMonitorClient::NewLC() { CTsTaskMonitorClient* self = new (ELeave) CTsTaskMonitorClient; CleanupStack::PushL(self); @@ -44,7 +44,7 @@ { } -EXPORT_C CTsTaskMonitorClient::~CTsTaskMonitorClient() +CTsTaskMonitorClient::~CTsTaskMonitorClient() { delete iImpl; } diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/s60/src/tstaskmonitorsession.cpp --- a/tstaskmonitor/client/s60/src/tstaskmonitorsession.cpp Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +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 "tstaskmonitorsession.h" -#include "tstaskmonitorglobals.h" - -void RTsTaskMonitorSession::TaskListL(RTsFswArray& tasks) -{ - for (;;) { - TPckgBuf dataSize; - User::LeaveIfError(SendReceive(GetRunningAppInfo, TIpcArgs(&dataSize))); - HBufC8* data = HBufC8::NewLC(dataSize()); - TPtr8 dataPointer(data->Des()); - TInt err = SendReceive(FlushData, TIpcArgs(&dataPointer, dataSize())); - if (err == KErrNone) { - RDesReadStream dataStream(dataPointer); - CleanupClosePushL(dataStream); - CTsFswEntry::InternalizeArrayL(dataStream, tasks); - CleanupStack::PopAndDestroy(&dataStream); - } else if (err != KErrCorrupt) { - User::Leave(err); - } - CleanupStack::PopAndDestroy(data); - if (err == KErrNone) { - break; - } - // If result was KErrCorrupt then the size received from GetRunningAppInfo is - // not valid anymore so restart the whole procedure. - } -} - -TInt RTsTaskMonitorSession::StartServer() -{ - RProcess server; - if (TInt error = server.Create(KRunningAppServerName, KNullDesC, TUidType(KNullUid, KNullUid, KRunningAppServerUid))) { - return error; - } - - TRequestStatus status; - server.Rendezvous(status); - if (status != KRequestPending) { - server.Kill(0); - } else { - server.Resume(); - } - - User::WaitForRequest(status); - TInt error = (EExitPanic == server.ExitType()) ? KErrGeneral : status.Int(); - if (KErrCancel == error) { - error = KErrNone; - } - server.Close(); - - return error; -} - -TInt RTsTaskMonitorSession::Connect() -{ - TInt retry = 4; - TInt error(KErrNone); - do { - error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0)); - if (KErrNotFound != error && KErrServerTerminated != error) { - retry = 0; - } else { - error = StartServer(); - if (KErrNone != error && KErrAlreadyExists != error) { - retry = 0; - error = CreateSession(KRunningAppServerName, TVersion(0, 0, 0)); - } - } - } while (--retry > 0); - return error; -} - -void RTsTaskMonitorSession::Subscribe(TRequestStatus& aStatus) -{ - SendReceive(SubscribeRunningAppChanges, aStatus); -} - -void RTsTaskMonitorSession::CancelSubscribe() -{ - SendReceive(CancelSubscribeRunningAppChanges); -} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/src/tsscreenshotregistry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/src/tsscreenshotregistry.cpp Fri Jun 11 13:58:37 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: +* +*/ +#include "tsscreenshotregistry.h" +#include "tsscreenshotregistry_p.h" + +TsScreenshotRegistry::TsScreenshotRegistry() : d_ptr(new TsScreenshotRegistryPrivate()) +{ +} + +TsScreenshotRegistry::~TsScreenshotRegistry() +{ + delete d_ptr; +} + +bool TsScreenshotRegistry::registerScreenshot(const QPixmap &screenshot) +{ + return d_ptr->registerScreenshot(screenshot); +} + +bool TsScreenshotRegistry::unregisterScreenshot() +{ + return d_ptr->unregisterScreenshot(); +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/stub/inc/tsscreenshotregistry_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/stub/inc/tsscreenshotregistry_p.h Fri Jun 11 13:58:37 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 TSSCREENSHOTREGISTRY_P_H +#define TSSCREENSHOTREGISTRY_P_H + +#include + +class TsScreenshotRegistryPrivate +{ +public: + bool registerScreenshot(const QPixmap &screenshot); + bool unregisterScreenshot(); +}; + +#endif //TSSCREENSHOTREGISTRY_P_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/stub/src/tsscreenshotregistry_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/client/stub/src/tsscreenshotregistry_p.cpp Fri Jun 11 13:58:37 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 "tsscreenshotregistry_p.h" + +bool TsScreenshotRegistryPrivate::registerScreenshot(const QPixmap &screenshot) +{ + Q_UNUSED(screenshot); + return true; +} + +bool TsScreenshotRegistryPrivate::unregisterScreenshot() +{ + return true; +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/client/stub/src/tstask.cpp --- a/tstaskmonitor/client/stub/src/tstask.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/client/stub/src/tstask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -37,6 +37,11 @@ return QPixmap(); } +QPixmap TsTask::screenshot() const +{ + return QPixmap(); +} + QString TsTask::name() const { return QString(); diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/inc/tstaskmonitorglobals.h --- a/tstaskmonitor/inc/tstaskmonitorglobals.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/inc/tstaskmonitorglobals.h Fri Jun 11 13:58:37 2010 +0300 @@ -30,6 +30,8 @@ UpdateScreenshot, FlushData, CancelSubscribeRunningAppChanges, + RegisterScreenshotMessage, + UnregisterScreenshotMessage, }; enum UpdatePriority { @@ -37,5 +39,13 @@ Normal, High }; + +enum ScreenshotMessageOffsets { + ScreenshotHandle = 0, + WindowsGroup, + AdditionalParameters, + Priority +}; + #endif //RUNNINGAPPGLOBALS_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/rom/tstaskmonitor_core.iby --- a/tstaskmonitor/rom/tstaskmonitor_core.iby Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/rom/tstaskmonitor_core.iby Fri Jun 11 13:58:37 2010 +0300 @@ -20,6 +20,11 @@ file=ABI_DIR\BUILD_DIR\tstaskmonitorclient.dll SHARED_LIB_DIR\tstaskmonitorclient.dll file=ABI_DIR\BUILD_DIR\hsrunningappmonitor.exe PROGRAMS_DIR\hsrunningappmonitor.exe +file=ABI_DIR\BUILD_DIR\tsbackstepping.dll SHARED_LIB_DIR\tsbackstepping.dll + + +ECOM_PLUGIN( tsscreenshotplugin.dll, tsscreenshotplugin.rsc ) + // stub sis data=ZSYSTEM/install/taskmonitor_stub.sis system/install/taskmonitor_stub.sis diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/screenshotplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/screenshotplugin/group/bld.inf Fri Jun 11 13:58:37 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: +* +*/ +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +tsscreenshotplugin.mmp diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/screenshotplugin/group/tsscreenshotplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/screenshotplugin/group/tsscreenshotplugin.mmp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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: +* +*/ +TARGET tsscreenshotplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200267AE +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +OPTION_REPLACE ARMCC --arm -O3 --cpu 6 + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE tsscreenshotmain.cpp +SOURCE tsscreenshotplugin.cpp + +RESOURCE tsscreenshotplugin.rss + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY wsgraphicdrawer.lib +LIBRARY fbscli.lib +LIBRARY estor.lib +LIBRARY gdi.lib +LIBRARY tstaskmonitorclient.lib +DEBUGLIBRARY flogger.lib diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/screenshotplugin/inc/tsscreenshotplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/screenshotplugin/inc/tsscreenshotplugin.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,87 @@ +/* +* 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: +* +*/ +#ifndef TSSCREENSHOTPLUGIN_H +#define TSSCREENSHOTPLUGIN_H + +#include +#include +#include + +class CTsScreenshotPlugin: public CWsGraphicDrawer, + public MWsEventHandler +{ +public: + /** + * Two phase constructor + */ + + static CTsScreenshotPlugin* NewL(); + + /** + * Destructor + */ + ~CTsScreenshotPlugin(); + +private: + /** + * From CWsGraphicDrawer. + * @see CWsGraphicDrawer::DoDraw(MWsGc&, const TRect&, const TDesC8&) const + */ + void DoDraw(MWsGc&, const TRect&, const TDesC8&) const; + + /** + * From CWsGraphicDrawer + * @see CWsGraphicDrawer::HandleMessage(const TDesC8&) + */ + void HandleMessage(const TDesC8&); + + void HandleMessageL(const TDesC8&); + + /** + * From CWsGraphicDrawer + * @see CWsGraphicDrawer::ConstructL(MWsGraphicDrawerEnvironment&, const TGraphicDrawerId& , MWsClient&, const TDesC8&) + */ + void ConstructL(MWsGraphicDrawerEnvironment& env, + const TGraphicDrawerId& id, + MWsClient& owner, + const TDesC8& data); + + /** + * From MWsEventHandler. + * + * @see MWsEventHandler::DoHandleEvent(const TWservCrEvent&) + */ + void DoHandleEvent(const TWservCrEvent& event); + + /** + * Function take screenshot od current display + * @param screenshot identyfier + */ + void TakeScreenshot(TInt); + + /** + * Function take screenshot od current display + * @param screenshot identyfier + */ + void TakeScreenshotL(TInt); + +private: + RPointerArray mCache; + TInt mWindowGroupId; +}; + +#endif //TSSCREENSHOTPLUGIN_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/screenshotplugin/screenshotplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/screenshotplugin/screenshotplugin.pro Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,20 @@ +# +# 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 + +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\"" + diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/screenshotplugin/src/tsscreenshotmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotmain.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,39 @@ +/* +* 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: +* +*/ +#include +#include "tsscreenshotplugin.h" + +const TInt KImpId( 0x200267AE ); + +// -------------------------------------------------------------------------- +// KImplementationTable +// -------------------------------------------------------------------------- +// +LOCAL_C const TImplementationProxy KImplementationTable[] = +{ + IMPLEMENTATION_PROXY_ENTRY(KImpId, CTsScreenshotPlugin::NewL) +}; + +// -------------------------------------------------------------------------- +// ImplementationGroupProxy +// -------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) +{ + aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy)); + return KImplementationTable; +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,176 @@ +/* +* 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: +* +*/ +#include "tsscreenshotplugin.h" +#include "tstaskmonitorglobals.h" +#include +#include + +const TInt KMsgSize(5); +const TInt KInvalidGroupId(~0); +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsScreenshotPlugin* CTsScreenshotPlugin::NewL() +{ + //no second step construction is required here + //window server will initialize plugin later + return new(ELeave)CTsScreenshotPlugin(); +} +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotPlugin::ConstructL(MWsGraphicDrawerEnvironment& env, + const TGraphicDrawerId& id, + MWsClient& owner, + const TDesC8& /*data*/ ) +{ + BaseConstructL(env, id, owner); + env.RegisterEventHandler(this, + this, + TWservCrEvent::EWindowGroupChanged | + TWservCrEvent::EDeviceOrientationChanged); + mWindowGroupId = KInvalidGroupId; +} +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsScreenshotPlugin::~CTsScreenshotPlugin() +{ + Env().UnregisterEventHandler(this); + mCache.ResetAndDestroy(); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotPlugin::DoDraw(MWsGc&, const TRect&, const TDesC8&) const +{ + //plugin is not a real drawer + //no implementation required +} +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotPlugin::HandleMessage(const TDesC8& msg) +{ + TRAP_IGNORE(HandleMessageL(msg)); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotPlugin::HandleMessageL(const TDesC8& msg) +{ + TInt parsedMsg[KMsgSize]; + RDesReadStream msgStream(msg); + for (TInt iter(0); iter < KMsgSize; ++iter) { + parsedMsg[iter] = msgStream.ReadInt32L(); + } + + if (RegisterScreenshotMessage == parsedMsg[0]) { //Screenshot registeration ACK + for(TInt iter(0); iter < mCache.Count(); ++iter) { + if (mCache[iter]->Handle() == parsedMsg[ScreenshotHandle + 1]) { + //bitmap is not needed no more + delete mCache[iter]; + mCache.Remove(iter); + break; + } + } + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotPlugin::DoHandleEvent(const TWservCrEvent& event) +{ + switch (event.Type()) { + case TWservCrEvent::EWindowGroupChanged: + if (KInvalidGroupId != mWindowGroupId) { + TakeScreenshot(mWindowGroupId); + } + mWindowGroupId = event.WindowGroupIdentifier(); + break; + case TWservCrEvent::EDeviceOrientationChanged: + TakeScreenshot(mWindowGroupId); + break; + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotPlugin::TakeScreenshot(TInt id) +{ + TRAP_IGNORE(TakeScreenshotL(id);) +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotPlugin::TakeScreenshotL(TInt id) +{ + if(0 >= Env().ScreenCount()) { + User::Leave(KErrCorrupt); + } + const TInt screenId(0); //use local variable in case of changing screen selection policy + const MWsScreenConfig* const screenConfig = + Env().Screen(screenId)->ObjectInterface(); + const MWsScreenDevice* const screenDevice = + static_cast(Env().Screen(screenId)->ResolveObjectInterface(MWsScreenDevice::EWsObjectInterfaceId)); + + User::LeaveIfNull(screenConfig); + User::LeaveIfNull(screenDevice); + + //prepare destination bitmap + CFbsBitmap *bitmap = new (ELeave) CFbsBitmap(); + CleanupStack::PushL(bitmap); + + + User::LeaveIfError(bitmap->Create(screenConfig->SizeInPixels(), + screenConfig->DisplayMode())); + + screenDevice->CopyScreenToBitmapL(bitmap, + screenConfig->SizeInPixels()); + + + //prepare and send message + TInt msg[KMsgSize] = {RegisterScreenshotMessage}; + + msg[WindowsGroup + 1] = id; + msg[ScreenshotHandle + 1] = bitmap->Handle(); + msg[Priority + 1] = Low; + msg[AdditionalParameters + 1] = 0; //unused + + const TPckgC buf(msg); + + User::LeaveIfError(SendMessage(buf)); + + mCache.AppendL(bitmap); + CleanupStack::Pop(bitmap); + +} + diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/screenshotplugin/src/tsscreenshotplugin.rss Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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: ECOM registration file +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x200267AE; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10281924; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x200267AE; + version_no = 1; + display_name = "tsscreenshotplugin"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/group/hsrunningappmonitor.mmp --- a/tstaskmonitor/server/group/hsrunningappmonitor.mmp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/group/hsrunningappmonitor.mmp Fri Jun 11 13:58:37 2010 +0300 @@ -18,15 +18,15 @@ TARGETTYPE exe UID 0 0x200267B0 -SYSTEMINCLUDE /epoc32/include - USERINCLUDE ../inc USERINCLUDE ../../inc +USERINCLUDE ../../../inc USERINCLUDE ../../utils/inc -SYSTEMINCLUDE /epoc32/include -SYSTEMINCLUDE /epoc32/include/mw -SYSTEMINCLUDE /epoc32/include/platform/mw -SYSTEMINCLUDE /epoc32/include/platform +USERINCLUDE ../../backstepping/inc + +MW_LAYER_SYSTEMINCLUDE +APP_LAYER_SYSTEMINCLUDE + SOURCEPATH ../src SOURCE main.cpp @@ -34,37 +34,31 @@ SOURCE hsrunningappsession.cpp SOURCE hsdataobservertask.cpp SOURCE hsdataprovidertask.cpp +SOURCE tsdatatask.cpp SOURCE tsrunningappstorage.cpp SOURCE tsfswdatalist.cpp SOURCE tsfswengine.cpp SOURCE tsfswmonitor.cpp +SOURCE tsscreenshotprovider.cpp SOURCEPATH ../../utils/src +SOURCE tsentrykey.cpp +SOURCE tsentrykeygenerator.cpp SOURCE tsfswentry.cpp -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY eikcore.lib -LIBRARY cone.lib -LIBRARY ws32.lib -LIBRARY efsrv.lib -LIBRARY fbscli.lib -LIBRARY avkon.lib -LIBRARY apgrfx.lib -LIBRARY flogger.lib +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY apparc.lib +LIBRARY ws32.lib +LIBRARY apgrfx.lib +LIBRARY fbscli.lib +LIBRARY bitgdi.lib +LIBRARY aknicon.lib +LIBRARY tsutils.lib +LIBRARY tsbackstepping.lib -LIBRARY apparc.lib -LIBRARY ws32.lib -LIBRARY apgrfx.lib -LIBRARY fbscli.lib -LIBRARY bitgdi.lib -LIBRARY aknicon.lib -LIBRARY aknskins.lib -LIBRARY egul.lib -LIBRARY featmgr.lib -LIBRARY bitmaptransforms.lib CAPABILITY ALL -TCB EPOCHEAPSIZE 0x100000 0x600000 // 1MB - 6MB diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/hsdataobserver.h --- a/tstaskmonitor/server/inc/hsdataobserver.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +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 DATAOBSERVER_H -#define DATAOBSERVER_H - -#include - -class MHsDataObserver { -public: - virtual void DataChanged() =0; -}; - -class CHsDataObserver: public CBase, - public MHsDataObserver -{ -public: - virtual void Cancel(const RMessage2& reason) =0; -}; - -class MHsDataObserverStorage -{ -public: - virtual void PushL(CHsDataObserver*) =0; - virtual void Pop(CHsDataObserver*) =0; - virtual void Cancel(const RMessage2& reason) =0; -}; - -#endif //DATAOBSERVER_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/hsdataobservertask.h --- a/tstaskmonitor/server/inc/hsdataobservertask.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/hsdataobservertask.h Fri Jun 11 13:58:37 2010 +0300 @@ -16,7 +16,7 @@ */ #ifndef DATAOBSERVERTASK_H #define DATAOBSERVERTASK_H -#include "hsdataobserver.h" +#include "tsdataobserver.h" #include class CHsDataObserverTask: public CHsDataObserver { diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/hsdataprovider.h --- a/tstaskmonitor/server/inc/hsdataprovider.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/hsdataprovider.h Fri Jun 11 13:58:37 2010 +0300 @@ -14,11 +14,10 @@ * Description: * */ -#ifndef DATAPROVIDR_H -#define DATAPROVIDR_H +#ifndef DATAPROVIDER_H +#define DATAPROVIDER_H #include - class MHsDataProvider { public: virtual const TDesC8& Data() const = 0; diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/hsdataprovidertask.h --- a/tstaskmonitor/server/inc/hsdataprovidertask.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/hsdataprovidertask.h Fri Jun 11 13:58:37 2010 +0300 @@ -14,8 +14,8 @@ * Description: * */ -#ifndef DATAPROVIDER_H -#define DATAPROVIDER_H +#ifndef DATAPROVIDERTASK_H +#define DATAPROVIDERTASK_H #include "hsdataprovider.h" diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/hsrunningappserver.h --- a/tstaskmonitor/server/inc/hsrunningappserver.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/hsrunningappserver.h Fri Jun 11 13:58:37 2010 +0300 @@ -20,8 +20,8 @@ // INCLUDES #include #include - -#include "hsdataobserver.h" +#include +#include "tsdataobserver.h" class CRunningAppStorage; /** @@ -69,7 +69,10 @@ CSession2* NewSessionL(const TVersion& version, const RMessage2& message) const; private: RPointerArray mObservers; + RWsSession mWsSession; CRunningAppStorage* mStorage; + CBase *mScreenshotProviderStarter; + CBase *mBacksteppingEngine; }; #endif // RUNNINGAPPSERVER_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/hsrunningappsession.h --- a/tstaskmonitor/server/inc/hsrunningappsession.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/hsrunningappsession.h Fri Jun 11 13:58:37 2010 +0300 @@ -20,8 +20,9 @@ // INCLUDES #include #include -#include "hsdataobserver.h" +#include "tsdataobserver.h" #include "hsdataprovider.h" +#include "tsdatastorage.h" /** * CActivitySession * @@ -43,7 +44,8 @@ * @param storage - data storage */ static CRunningAppSession* NewL(MHsDataObserverStorage& observerStorage, - const MHsDataProvider& dataProvider); + const MHsDataProvider& dataProvider, + MTsDataStorage& dataStorage); private: @@ -51,7 +53,8 @@ * Constructor for performing 1st stage construction */ CRunningAppSession(MHsDataObserverStorage& observerStorage, - const MHsDataProvider& dataProvider); + const MHsDataProvider& dataProvider, + MTsDataStorage& dataStorage); /** * EPOC default constructor for performing 2nd stage construction @@ -68,6 +71,7 @@ private: MHsDataObserverStorage& mObserverStorage; const MHsDataProvider& mDataProvider; + MTsDataStorage& mDataStorage; }; #endif // RUNNINGAPPSESSION_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsdatastorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/server/inc/tsdatastorage.h Fri Jun 11 13:58:37 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 DATASTORAGE_H +#define DATASTORAGE_H + +#include +class CFbsBitmap; +class MTsDataStorage { +public: + virtual void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority) =0; + virtual void RemoveL(TInt key, TInt param) =0; +}; + +#endif //DATASTORAGE_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsdatatask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/server/inc/tsdatatask.h Fri Jun 11 13:58:37 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 TSDATATASK_H +#define TSDATATASK_H +#include "tstaskmonitorglobals.h" +#include "tsdatastorage.h" +class TsDataTask +{ +public: + static void ExecuteL(MTsDataStorage& dataStorage, const RMessage2& msg); + +private: + static void RegisterScreenshotL(MTsDataStorage& dataStorage, + const RMessage2& msg); + + static void UnregisterScreenshotL(MTsDataStorage& dataStorage, + const RMessage2& msg); +}; + +#endif //TSDATATASK_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsfswdatalist.h --- a/tstaskmonitor/server/inc/tsfswdatalist.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/tsfswdatalist.h Fri Jun 11 13:58:37 2010 +0300 @@ -19,20 +19,12 @@ #ifndef TSFSWDATALIST_H #define TSFSWDATALIST_H -#define __E32SVR_H__ -#include -#include - #include -#include -#include #include #include #include "tsfswentry.h" -#include "tsfswobservers.h" +#include "tsdataobserver.h" -class CTsFswEngine; -class CTsFswIconCache; class CApaWindowGroupName; class CFbsBitmap; @@ -47,7 +39,7 @@ * * @param aParent */ - static CTsFswDataList* NewL( CTsFswEngine& aEngine ); + static CTsFswDataList* NewL(MHsDataObserver& observer); /* * Destructor @@ -58,7 +50,7 @@ /** * Constructor. */ - CTsFswDataList( CTsFswEngine& aEngine ); + CTsFswDataList(MHsDataObserver& observer); /** * Performs 2nd phase construction. @@ -79,117 +71,62 @@ * @return TBool ETrue if the content iData has been modified */ TBool CollectTasksL(); - - - /** - * Set flag iTaskListDirty; - */ - void SetDirty(); - - /** - * Set flag iAppDataRefreshNeeded - */ - void SetAppDataRefreshNeeded(); - - - /** - * Moves entry on given window app/widget id to - * the first position on conten data list - */ - void MoveEntryAtStart( TInt aAppId, TBool aWidget ); - - - /** - * Finds out the app uid for the given window group id. - * @param aWgId a valid window group id - * @param aUid requested uid - * @return error code - */ - TInt AppUidForWgId( TInt aWgId, TUid& aUid ); - - /** - * Finds out the app uid for the given window group id. - * @param aWgId a valid window group id - * @return application uid - */ - TUid AppUidForWgIdL( TInt aWgId ); /** * Checks if given uid is on hidden list * @param aUid uid to be checked - * @return ETrue if aUid is on hidden list + * @return ETrue if uid is on hidden list */ - TBool IsHiddenUid( TUid aUid ); + TBool IsHiddenUid( TUid uid ); + /** + * Set screenshot + */ + TBool SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId); + + /** + * Removes screenshot + */ + TBool RemoveScreenshotL(TInt wgId); + private: /** * Adds running apps to the list. - * @param aAppsList array to add to + * @param appsList array to add to */ - void CollectAppsL( RTsFswArray& aAppsList ); + void CollectAppsL( RTsFswArray& appsList ); /** * Called from CollectTasksL for each entry in the task list. - * @param aWgId window group id - * @param aAppUid application uid - * @param aWgName window group name or NULL - * @param aNewList list to add to - * @param aIsWidget true if the entry corresponds to a web widget - * @return TBool ETrue if it was really a new entry in the list + * @param key entry key + * @param appUid application uid + * @param wgName window group name or NULL + * @param newList list to add to */ - TBool AddEntryL( TInt aWgId, - const TUid& aAppUid, - CApaWindowGroupName* aWgName, - RTsFswArray& aNewList, - TBool aIsWidget ); + void AddEntryL( const TTsEntryKey& key, + const TUid& appUid, + CApaWindowGroupName* wgName, + RTsFswArray& newList ); /** * Checks if there is an entry for same app in the content list. * If yes then it takes some of the data for the entry that * will correspond to the same app in the refreshed content list. - * In case of widget, update window group field in content list. - * @param aEntry new entry in content list - * @param aAppUid application uid - * @param aChanged ref to change-flag, set to ETrue if it is sure - * that the new content list will be different from the previous one - * @param aNewList ref to new content list + * @param key new key in content list * @return ETrue if app was found */ - TBool ConsiderOldDataL( CTsFswEntry& aEntry, - const TUid& aAppUid, - TBool& aChanged, - RTsFswArray& aNewList ); - - /** - * Adds running widgets to the list. - * @param aWidgetsList array to add to - */ - void CollectWidgetsL( RTsFswArray& aWidgetsList ); - - /** - * Returns the parent's wg id or KErrNotFound. - * @param aWgId a valid window group id - * @return parent wg id or KErrNotFound if there is no parent - */ - TInt FindParentWgId( TInt aWgId ); - - /** - * Returns the most top parent's wg id or KErrNotFound. - * @param aWgId a valid window group id - * @return parent wg id or KErrNotFound if there is no parent - */ - TInt FindMostTopParentWgId( TInt aWgId ); + TBool ConsiderOldDataL( const TTsEntryKey& key ); /** * Finds out the application name. - * @param aWindowName window group name or NULL - * @param aAppUId application uid - * @param aWgId window group id + * @param windowName window group name or NULL + * @param appUId application uid + * @param wgId window group id * @return application name, ownership transferred to caller */ - HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName, - const TUid& aAppUid, - TInt aWgId ); + HBufC* FindAppNameLC(CApaWindowGroupName* windowName, + const TUid& appUid, + TInt wgId ); /** @@ -197,60 +134,67 @@ * Data is being changed with application type consideration that is based * on aConsiderWidgets param. * Function removes or add entries into data depend on given list. - * @param aListToFit list with actual data - * @param aConsiderWidgets application type + * @param listToFit list with actual data * @return ETrue if change occours on data list, EFalse otherwise */ - TBool FitDataToListL( RTsFswArray& aListToFit, TBool aConsiderWidgets ); + TBool FitDataToListL( RTsFswArray& listToFit); /** * Checks if there is an entry for same app in the given list. - * @param aEntry entry - * @param aNewList ref to list + * @param entry entry + * @param newList ref to list * @return ETrue if app was found */ - TBool CheckIfExists( const CTsFswEntry& aEntry, - const RTsFswArray& aNewList ) const; + TBool CheckIfExists( const CTsFswEntry& entry, + const RTsFswArray& newList ) const; /** * Retrieves the bitmap/mask for the icon of the given app. - * @param aAppUid application uid - * @param aBitmap bitmap ptr, ownership transferred to caller, or NULL - * @param aMask mask ptr, ownership transferred to caller, or NULL + * @param appUid application uid + * @param bitmapArg bitmap ptr, ownership transferred to caller, or NULL + * @param maskArg mask ptr, ownership transferred to caller, or NULL + */ + void GetAppIconL(const TUid& appUid, + CFbsBitmap*& bitmapArg, + CFbsBitmap*& maskArg); + + /** + * Finds entry in array + * @param list list to find + * @param key finding key + * @return position or KErrNotFound */ - void GetAppIconL( const TUid& aAppUid, - CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ); + TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const; + + /** + * Establish entry order accridung to aKeyList, all keys MUST be in iData + * @param keyList reference key list + * @return ETrue if changes occured + */ + TBool EstablishOrder(const RArray& keyList); + + /** + * Gets allowed uids, tries to filter non GUI application + */ + void GetAllowedUidsL(); private: - CTsFswEngine& iEngine; - - RTsFswArray iData; // current fsw content, i.e. the task list + MHsDataObserver &mObserver; + + RTsFswArray mData; // current fsw content, i.e. the task list // window server session - RWsSession iWsSession; + RWsSession mWsSession; // apparc session - RApaLsSession iAppArcSession; - - - - - // when true CollectTasksL will call GetAllApps etc. - // which is slow and need not be done normally, except - // during startup and perhaps when new applications are installed - TBool iAppDataRefreshNeeded; - - // Dirty flag, indicates that iData is not up-to-date because - // there were no subscribed clients during a previous possible - // change of the task list. - TBool iTaskListDirty; - - // if ETrue application order has been changed - TBool iOrderChanged; + RApaLsSession mAppArcSession; // list of hidden uids - RArray iHiddenUids; + RArray mHiddenUids; + + // list of allowed uids + RArray mAllowedUids; }; #endif //TSFSWDATALIST_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsfswengine.h --- a/tstaskmonitor/server/inc/tsfswengine.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/tsfswengine.h Fri Jun 11 13:58:37 2010 +0300 @@ -19,35 +19,12 @@ #ifndef TSFSWENGINE_H #define TSFSWENGINE_H -#define __E32SVR_H__ - -#include - #include -#include -#include -#include -#include -#include -#include -#include -#include #include "tsfswentry.h" -#include "tsfswobservers.h" -#include "hsdataprovider.h" -#include "hsdataobserver.h" - -class MTsFswEngineObserver; -class CTsFastSwapPreviewProvider; -class CApaWindowGroupName; -class CBitmapRotator; -class CTsRotationTask; -class CTSCpsNotifier; +#include "tsdataobserver.h" class CTsFswDataList; -// descriptor big enough to store hex repr of 32-bit integer plus 0x prefix -typedef TBuf<10> TAppUidHexString; /** * Engine for fast swap server. @@ -55,35 +32,21 @@ * received from the appui. */ NONSHARABLE_CLASS( CTsFswEngine ) : public CBase, - public MTsFswTaskListObserver + public MHsDataObserver { - enum TTsFswFgAppType - { - /** - * Means that even when the foreground app has another app embedded - * into it the uid of the container application will be returned. - */ - EUseStandaloneUid, - /** - * Means that if the foreground app has another app embedded - * into it then the returned uid will be the uid of the embedded - * app. - */ - EUseEmbeddedUid - }; public: /** * Creates a new instance. - * @param aObserver ref to observer + * @param observer ref to observer */ - static CTsFswEngine* NewL( MHsDataObserver& aObserver ); + static CTsFswEngine* NewL( MHsDataObserver& observer ); /** * @copydoc NewL */ - static CTsFswEngine* NewLC( MHsDataObserver& aObserver ); + static CTsFswEngine* NewLC( MHsDataObserver& observer ); /** * Destructor. @@ -92,19 +55,25 @@ /** * Returns a reference to the current content. - * Also performs sanity checks, e.g. associates application icons - * when no screenshot has been received. * @return ref to content array */ const RTsFswArray& FswDataL(); - + /** + * Set screenshot + */ + void SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId); + + /** + * Removes screenshot + */ + void RemoveScreenshotL(TInt wgId); private: // from MTsFswTaskListObserver - void UpdateTaskList(); + void DataChanged(); @@ -112,7 +81,7 @@ /** * Constructor. */ - CTsFswEngine( MHsDataObserver& aObserver ); + CTsFswEngine( MHsDataObserver& observer ); /** * Performs 2nd phase construction. @@ -125,53 +94,9 @@ */ TBool CollectTasksL(); - - /** - * Callback for the iUpdateStarter timer. - * Calls CollectTasksL and notifies the observer if the task list - * has really been modified. - */ - static TInt UpdateStarterCallback( TAny* aParam ); - - /** - * Returns the uid of the foreground app or KNullUid. - * Will never return hidden apps, only those which can - * also be seen in the array returned by FswDataL. - * - * In case of embedded apps the behaviour is controlled - * by aType: it will return either the uid of the embedded - * application or the container app. - * - * @param aType @see CTsFswClient::TTsFswFgAppType - */ - TUid ForegroundAppUidL( TInt aType ); - - /** - * Gets and publishes the foreground app uid to CFW. - */ - void PublishFgAppUidL(); - private: - // data - MHsDataObserver& iObserver; - - // window server session - RWsSession iWsSession; - - // apparc session - RApaLsSession iAppArcSession; - - // timer to defer content refresh - CPeriodic* iUpdateStarter; - - - // window group ids returned by last WindowGroupList call - RArray iWgIds; - - TUid iFgAppUid; - - - CTsFswDataList* iDataList;//own + MHsDataObserver& mObserver; + CTsFswDataList* mDataList; //own }; diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsfswmonitor.h --- a/tstaskmonitor/server/inc/tsfswmonitor.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/tsfswmonitor.h Fri Jun 11 13:58:37 2010 +0300 @@ -18,13 +18,11 @@ #ifndef TSFSWMONITOR_H #define TSFSWMONITOR_H -#define __E32SVR_H__ -#include #include #include -class MTsFswTaskListObserver; +class MHsDataObserver; class MTsFswResourceObserver; /** @@ -39,16 +37,16 @@ -static CTsFswMonitor* NewL(MTsFswTaskListObserver& aTaskListObserver); -static CTsFswMonitor* NewLC(MTsFswTaskListObserver& aTaskListObserver); +static CTsFswMonitor* NewL(MHsDataObserver& taskListObserver); +static CTsFswMonitor* NewLC(MHsDataObserver& taskListObserver); protected: - CTsFswMonitor(MTsFswTaskListObserver& aTaskListObserver); + CTsFswMonitor(MHsDataObserver& taskListObserver); void ConstructL(); // from CActive void RunL(); - TInt RunError( TInt aError ); + TInt RunError( TInt error ); void DoCancel(); @@ -56,14 +54,13 @@ void Subscribe(); void ConstractObserverL(); private: - MTsFswTaskListObserver* iTaskListObserver; // not own + MHsDataObserver* mTaskListObserver; // not own // window server session - RWsSession iWsSession; - /** - * Window group. - */ - RWindowGroup iWg; + RWsSession mWsSession; + + // Window group. + RWindowGroup mWg; }; #endif //TSFSWMONITOR_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsfswobservers.h --- a/tstaskmonitor/server/inc/tsfswobservers.h Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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: Observer interfaces to get notifications from appui and from engine - * -*/ - - -#ifndef TSFSWOBSERVERS_H -#define TSFSWOBSERVERS_H - -/** - * Interface to get notifications from appui when window groups - * have changed. - */ -class MTsFswTaskListObserver - { -public: - /** - * Function called by AppUi to notify about possible - * changes in task list - */ - virtual void UpdateTaskList() = 0; - }; -#endif diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsrunningappstorage.h --- a/tstaskmonitor/server/inc/tsrunningappstorage.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/inc/tsrunningappstorage.h Fri Jun 11 13:58:37 2010 +0300 @@ -21,8 +21,9 @@ #include #include -#include "hsdataobserver.h" +#include "tsdataobserver.h" #include "hsdataprovider.h" +#include "tsdatastorage.h" class CTsFswEngine; class CTsFswMonitor; @@ -32,8 +33,8 @@ */ class CRunningAppStorage : public CBase, public MHsDataProvider, - public MHsDataObserver - + public MHsDataObserver, + public MTsDataStorage { public: /** @@ -51,6 +52,10 @@ //MHsDataChangeProvider void DataChanged(); + + void UpdateL(TInt key,const CFbsBitmap& data, TInt param, TInt priority); + + void RemoveL(TInt key, TInt param); private: /** diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/inc/tsscreenshotprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/server/inc/tsscreenshotprovider.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,35 @@ +/* +* 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 TSSCREENSHOTPROVIDER_H +#define TSSCREENSHOTPROVIDER_H +#include "tsdatastorage.h" +#include + +class CTsScreenshotProvider: public CWsGraphic +{ +public: + static CTsScreenshotProvider* NewL(MTsDataStorage&); +private: + CTsScreenshotProvider(MTsDataStorage&); + void HandleMessage(const TDesC8&); + void HandleMessageL(const TDesC8&); + void OnReplace(); +private: + MTsDataStorage& mStorage; +}; + +#endif //TSSCREENSHOTTASK_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/hsrunningappserver.cpp --- a/tstaskmonitor/server/src/hsrunningappserver.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/src/hsrunningappserver.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -18,6 +18,8 @@ #include "hsrunningappserver.h" #include "hsrunningappsession.h" #include "tsrunningappstorage.h" +#include "tsscreenshotprovider.h" +#include "tsbackstepping.h" _LIT(KErrObserverExists, "Observer already exists"); // ----------------------------------------------------------------------------- @@ -37,6 +39,8 @@ // CRunningAppServer::~CRunningAppServer() { + delete mBacksteppingEngine; + delete mScreenshotProviderStarter; delete mStorage; mObservers.ResetAndDestroy(); } @@ -60,7 +64,10 @@ void CRunningAppServer::ConstructL() { StartL(KRunningAppServerName); + User::LeaveIfError(mWsSession.Connect()); mStorage = CRunningAppStorage::NewL(*this); + TRAP_IGNORE(mScreenshotProviderStarter = CTsScreenshotProvider::NewL(*mStorage); + mBacksteppingEngine = CTsBackstepping::NewL(mWsSession);) } // ----------------------------------------------------------------------------- @@ -70,6 +77,7 @@ CSession2* CRunningAppServer::NewSessionL(const TVersion &, const RMessage2&) const { return CRunningAppSession::NewL(*const_cast(this), + *const_cast(this)->mStorage, *const_cast(this)->mStorage); } diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/hsrunningappsession.cpp --- a/tstaskmonitor/server/src/hsrunningappsession.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/src/hsrunningappsession.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -19,16 +19,19 @@ #include "hsdataobservertask.h" #include "hsdataprovidertask.h" +#include "tsdatatask.h" // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // CRunningAppSession::CRunningAppSession(MHsDataObserverStorage& observerStorage, - const MHsDataProvider& dataProvider) + const MHsDataProvider& dataProvider, + MTsDataStorage& dataStorage) : mObserverStorage(observerStorage), - mDataProvider(dataProvider) + mDataProvider(dataProvider), + mDataStorage(dataStorage) { // No implementation required } @@ -46,9 +49,12 @@ // ----------------------------------------------------------------------------- // CRunningAppSession* CRunningAppSession::NewL(MHsDataObserverStorage& observerStorage, - const MHsDataProvider& dataProvider) + const MHsDataProvider& dataProvider, + MTsDataStorage& dataStorage) { - CRunningAppSession* self = new (ELeave) CRunningAppSession(observerStorage, dataProvider); + CRunningAppSession* self = new (ELeave) CRunningAppSession(observerStorage, + dataProvider, + dataStorage); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -82,6 +88,11 @@ case FlushData: HsDataProviderTask::ExecuteL(mDataProvider, message); break; + + case RegisterScreenshotMessage: + case UnregisterScreenshotMessage: + TsDataTask::ExecuteL(mDataStorage, message); + break; default: message.Complete(CServer2::EBadMessageNumber); diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/tsdatatask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/server/src/tsdatatask.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,63 @@ +/* +* 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 "tsdatatask.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void TsDataTask::ExecuteL(MTsDataStorage& dataStorage, const RMessage2& msg) +{ + switch(msg.Function()) { + case RegisterScreenshotMessage: + TsDataTask::RegisterScreenshotL(dataStorage, msg); break; + case UnregisterScreenshotMessage: + TsDataTask::UnregisterScreenshotL(dataStorage, msg); break; + } + + msg.Complete(KErrNone); +} + +void TsDataTask::RegisterScreenshotL(MTsDataStorage& dataStorage, + const RMessage2& msg) +{ + TPckgBuf wgId, fbsHdl, param, priority; + + msg.ReadL(WindowsGroup, wgId); + msg.ReadL(ScreenshotHandle, fbsHdl); + msg.ReadL(AdditionalParameters, param); + msg.Read(Priority, priority); + + //convert and provide data + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); + CleanupStack::PushL(bitmap); + User::LeaveIfError(bitmap->Duplicate(fbsHdl())); + dataStorage.UpdateL(wgId(), *bitmap, param(), priority()); + CleanupStack::PopAndDestroy(bitmap); +} + +void TsDataTask::UnregisterScreenshotL(MTsDataStorage& dataStorage, + const RMessage2& msg) +{ + TPckgBuf wgId, param; + + msg.ReadL(WindowsGroup, wgId); + msg.ReadL(AdditionalParameters, param); + + dataStorage.RemoveL(wgId(), param()); +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/tsfswdatalist.cpp --- a/tstaskmonitor/server/src/tsfswdatalist.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/src/tsfswdatalist.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -1,43 +1,41 @@ /* -* 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: File containing application list classes + * 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: File containing application list classes + * + */ //INCLUDES: -#define __E32SVR_H__ + #include "tsfswdatalist.h" #include "tsfswengine.h" +#include "tsentrykeygenerator.h" #include // for CleanupResetAndDestroyPushL -#include #include -#include -#include -#include #include #include // avkon -#include // fbsbitmap -#include +#include // fbsbitmap +#include +#include +#include + // size for the created app icons const TInt KAppIconWidth = 128; const TInt KAppIconHeight = 128; //uids to be hidden -const TUid KHsApplicationUid = {0x20022F35}; -const TUid KTelephoneUid = {0x100058B3}; +const TUid KHsApplicationUid = { 0x20022F35 }; // ================= MEMBER FUNCTIONS ======================= @@ -45,526 +43,427 @@ // CTsFswDataList::NewL // -------------------------------------------------------------------------- // -CTsFswDataList* CTsFswDataList::NewL(CTsFswEngine& aEngine) - { - CTsFswDataList* self = new (ELeave) CTsFswDataList(aEngine); - CleanupStack::PushL (self ); - self->ConstructL ( ); - CleanupStack::Pop ( self ); +CTsFswDataList* CTsFswDataList::NewL(MHsDataObserver &observer) +{ + CTsFswDataList* self = new (ELeave) CTsFswDataList(observer); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); return self; - } +} // -------------------------------------------------------------------------- // CTsFswDataList::CTsFswDataList // -------------------------------------------------------------------------- // -CTsFswDataList::CTsFswDataList(CTsFswEngine& aEngine) : - iEngine(aEngine) - { - } +CTsFswDataList::CTsFswDataList(MHsDataObserver& observer) : + mObserver(observer) +{ +} // -------------------------------------------------------------------------- // CTsFswDataList::~CTsFswDataList // -------------------------------------------------------------------------- // -CTsFswDataList::~CTsFswDataList( ) - { - iData.ResetAndDestroy(); - iAppArcSession.Close(); - iWsSession.Close(); - iHiddenUids.Close(); +CTsFswDataList::~CTsFswDataList() +{ + mData.ResetAndDestroy(); + mAppArcSession.Close(); + mWsSession.Close(); + mHiddenUids.Close(); + mAllowedUids.Close(); RFbsSession::Disconnect(); RAknIconSrvClient::Disconnect(); - } +} // -------------------------------------------------------------------------- // CTsFswDataList::ConstructL // -------------------------------------------------------------------------- // -void CTsFswDataList::ConstructL( ) - { - User::LeaveIfError( iWsSession.Connect() ); - User::LeaveIfError( iAppArcSession.Connect() ); - iHiddenUids.AppendL( KHsApplicationUid ); - iHiddenUids.AppendL( KTelephoneUid ); +void CTsFswDataList::ConstructL() +{ + User::LeaveIfError(mWsSession.Connect()); + User::LeaveIfError(mAppArcSession.Connect()); + mHiddenUids.AppendL(KHsApplicationUid); User::LeaveIfError(RFbsSession::Connect()); RAknIconSrvClient::Connect(); - } +} // -------------------------------------------------------------------------- // CTsFswDataList::FswDataL // -------------------------------------------------------------------------- // const RTsFswArray& CTsFswDataList::FswDataL() - { - // check the dirty flag and refresh if needed - if ( iTaskListDirty ) - { - CollectTasksL(); - // dirty flag is cleared in the above call - } - - return iData; - } +{ + return mData; +} // -------------------------------------------------------------------------- // CTsFswDataList::CollectTasksL // -------------------------------------------------------------------------- // TBool CTsFswDataList::CollectTasksL() - { - // clear dirty flag - iTaskListDirty = EFalse; +{ TBool changed = EFalse; - RTsFswArray newAppsList; - CleanupResetAndDestroyPushL(newAppsList); - CollectAppsL(newAppsList); - - changed |= FitDataToListL(newAppsList, EFalse); - - CleanupStack::PopAndDestroy( &newAppsList ); - + changed |= FitDataToListL(newAppsList); + CleanupStack::PopAndDestroy(&newAppsList); return changed; - } - - -// -------------------------------------------------------------------------- -// CTsFswDataList::SetDirty() -// -------------------------------------------------------------------------- -// -void CTsFswDataList::SetDirty() - { - iTaskListDirty = ETrue; - } - -// -------------------------------------------------------------------------- -// CTsFswDataList::SetAppDataRefreshNeeded() -// -------------------------------------------------------------------------- -// -void CTsFswDataList::SetAppDataRefreshNeeded() - { - iAppDataRefreshNeeded = ETrue; - } - -// -------------------------------------------------------------------------- -// CTsFswDataList::MoveEntryAtStart -// -------------------------------------------------------------------------- -// -void CTsFswDataList::MoveEntryAtStart(TInt aAppId, TBool /*aWidget*/) - { - TInt appId(0); - //check embeded case - - TInt wgId(0); - CApaWindowGroupName::FindByAppUid(TUid::Uid(aAppId), iWsSession, wgId); - TInt parentWgId = FindMostTopParentWgId( wgId ); - if( parentWgId != KErrNotFound ) - { - TUid appUid = TUid::Uid(0); - AppUidForWgId(parentWgId, appUid); - appId = appUid.iUid; - } - - - if( !appId ) - { - appId = aAppId; - } - - for ( TInt i = 0; i < iData.Count(); ++i ) - { - if( iData[i]->AppUid().iUid == appId ) - { - CTsFswEntry* entry = iData[i]; - iData.Remove(i); - iData.Insert(entry, 0); - iOrderChanged = ETrue; - break; - } - } - } +} // -------------------------------------------------------------------------- // CTsFswDataList:: // -------------------------------------------------------------------------- // -void CTsFswDataList::CollectAppsL(RTsFswArray& aAppsList) - { - - - // update app data if needed - // (usually on startup and when new apps might have been installed) - if ( iAppDataRefreshNeeded ) - { - - iAppArcSession.GetAllApps(); - iAppDataRefreshNeeded = EFalse; - } +void CTsFswDataList::CollectAppsL(RTsFswArray& appsList) +{ + // gets allowed uids - running apps without hidden uids, null uids, filtered uid + GetAllowedUidsL(); // get all window groups RArray allWgIds; - CleanupClosePushL( allWgIds ); - User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) ); + CleanupClosePushL(allWgIds); + User::LeaveIfError(mWsSession.WindowGroupList(0, &allWgIds)); TInt count = allWgIds.Count(); - for ( TInt i = 0; i < count; ++i ) - { - // ignore uninteresting entries (e.g. embedded apps) - if ( allWgIds[i].iParentId > 0 ) - { + for (TInt i = 0; i < count; ++i) { + TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(allWgIds[i].iId, allWgIds.Array()); + //skip this entry if it is already on list + if (FindEntry(appsList, key) >= 0) { continue; - } - + } + // get window group name - TInt wgId = allWgIds[i].iId; - CApaWindowGroupName* windowName = - CApaWindowGroupName::NewLC( iWsSession, wgId ); + TInt wgId = key.mParentId; + CApaWindowGroupName* windowName = CApaWindowGroupName::NewLC(mWsSession, wgId); TUid appUid = windowName->AppUid(); - - // ignore entries with null uid - if ( !appUid.iUid ) - { - CleanupStack::PopAndDestroy( windowName ); - continue; - } - // add item to task list if it is not hidden - if ( !windowName->Hidden() && !IsHiddenUid(appUid) ) - { - AddEntryL(wgId, appUid, windowName, aAppsList, EFalse); - } - CleanupStack::PopAndDestroy( windowName ); + // add item to task list if uid is allowed + if (mAllowedUids.Find(appUid) >= 0) { + AddEntryL(key, appUid, windowName, appsList); } - CleanupStack::PopAndDestroy( &allWgIds ); + CleanupStack::PopAndDestroy(windowName); } + CleanupStack::PopAndDestroy(&allWgIds); +} // -------------------------------------------------------------------------- // CTsFswDataList::AddEntryL // -------------------------------------------------------------------------- // -TBool CTsFswDataList::AddEntryL( TInt aWgId, const TUid& aAppUid, - CApaWindowGroupName* aWgName, RTsFswArray& aNewList, - TBool /*aIsWidget*/ ) - { - TBool changed = EFalse; - CTsFswEntry* entry = CTsFswEntry::NewLC(); - entry->SetWgId( aWgId ); - entry->SetAppUid( aAppUid ); +void CTsFswDataList::AddEntryL(const TTsEntryKey& key, const TUid& appUid, + CApaWindowGroupName* wgName, RTsFswArray& newList) +{ + CTsFswEntry* entry = CTsFswEntry::NewLC(key, &mObserver); // check if present in old list and if yes then take some of the old data - TBool found = ConsiderOldDataL( *entry, aAppUid, changed, aNewList ); + TBool found = ConsiderOldDataL(key); // if not present previously then find out app name // and check if screenshot is already available - if ( !found ) - { - // when adding a new entry to the list it is changed for sure - changed = ETrue; - HBufC* name = FindAppNameLC( aWgName, aAppUid, aWgId ); - if ( name ) - { - entry->SetAppNameL( *name ); - } - CleanupStack::PopAndDestroy( name ); + if (!found) { + entry->SetAppUid(appUid); + HBufC* name = FindAppNameLC(wgName, appUid, key.mParentId); + if (name) { + entry->SetAppNameL(*name); + } + CleanupStack::PopAndDestroy(name); - if ( aWgName ) - { - entry->SetCloseableApp( !aWgName->IsSystem() ); - } + if (wgName) { + entry->SetCloseableApp(!wgName->IsSystem()); + } CFbsBitmap* iconBitmap = NULL; CFbsBitmap* iconMask = NULL; - GetAppIconL(aAppUid, iconBitmap, iconMask); + GetAppIconL(appUid, iconBitmap, iconMask); //transfer ownership to entry - entry->SetAppIcon( iconBitmap, iconMask ); - } + entry->SetAppIcon(iconBitmap, iconMask); + } // add to new list, ownership is transferred - aNewList.AppendL( entry ); - CleanupStack::Pop( entry ); - return changed; - } + newList.AppendL(entry); + CleanupStack::Pop(entry); +} // -------------------------------------------------------------------------- // CTsFswDataList::ConsiderOldDataL // -------------------------------------------------------------------------- // -TBool CTsFswDataList::ConsiderOldDataL( CTsFswEntry& aEntry, - const TUid& aAppUid, - TBool& aChanged, - RTsFswArray& aNewList ) - { - for ( TInt entryIdx = 0, oldCount = iData.Count(); - entryIdx < oldCount; ++entryIdx ) - { - // Enough to check appuid, no need to bother with wgid as the - // screenshot handle is up-to-date or will be updated later anyway. - if ( iData[entryIdx]->AppUid() == aAppUid ) - { - iData[entryIdx]->SetWgId( aEntry.WgId()); - // if positions do not match then the list is different than before - if ( entryIdx != aNewList.Count() ) - { - aChanged = ETrue; - } - CTsFswEntry* oldEntry = iData[entryIdx]; - aEntry.SetAppNameL( oldEntry->AppName() ); - aEntry.SetCloseableApp( oldEntry->CloseableApp() ); +TBool CTsFswDataList::ConsiderOldDataL(const TTsEntryKey& key) +{ + for (TInt entryIdx = 0, oldCount = mData.Count(); entryIdx < oldCount; ++entryIdx) { + if (mData[entryIdx]->Key() == key) { return ETrue; - } } - return EFalse; } - - -// -------------------------------------------------------------------------- -// CTsFswDataList::FindParentWgId -// -------------------------------------------------------------------------- -// -TInt CTsFswDataList::FindParentWgId( TInt aWgId ) - { - TInt parent( KErrNotFound ); - RArray allWgIds; - // Ask for window group list from RWsSession - TInt error = iWsSession.WindowGroupList( 0, &allWgIds ); - if ( !error ) - { - TInt count( allWgIds.Count() ); - for ( TInt i( 0 ); i < count; i++ ) - { - RWsSession::TWindowGroupChainInfo info = allWgIds[i]; - if ( info.iId == aWgId && info.iParentId > 0) - { - parent = info.iParentId; - break; - } - } - } - allWgIds.Close(); - return parent; - } - -// -------------------------------------------------------------------------- -// CTsFswDataList::FindMostTopParentWgId -// -------------------------------------------------------------------------- -// -TInt CTsFswDataList::FindMostTopParentWgId( TInt aWgId ) - { - TInt parent( KErrNotFound ); - parent = FindParentWgId( aWgId ); - if( parent != KErrNotFound) - { - TInt topParent = FindMostTopParentWgId(parent); - if( topParent != KErrNotFound ) - { - parent = topParent; - } - } - return parent; - } + return EFalse; +} // -------------------------------------------------------------------------- // CTsFswDataList::FindAppNameLC // -------------------------------------------------------------------------- // -HBufC* CTsFswDataList::FindAppNameLC( CApaWindowGroupName* aWindowName, - const TUid& aAppUid, - TInt aWgId ) - { +HBufC* CTsFswDataList::FindAppNameLC(CApaWindowGroupName* windowName, const TUid& appUid, TInt wgId) +{ //Retrieve the app name TApaAppInfo info; - iAppArcSession.GetAppInfo( info, aAppUid ); + mAppArcSession.GetAppInfo(info, appUid); TPtrC caption = info.iShortCaption; HBufC* tempName = 0; - if ( !caption.Length() && aWindowName ) // if not set - use thread name instead - { - if ( aWindowName->Caption().Length() ) - { - tempName = aWindowName->Caption().AllocL(); + if (!caption.Length() && windowName) // if not set - use thread name instead + { + if (windowName->Caption().Length()) { + tempName = windowName->Caption().AllocL(); //put on cleanupstack after the if - } - else - { + } + else { TThreadId threadId; - TInt err = iWsSession.GetWindowGroupClientThreadId( - aWgId, threadId ); - if ( err == KErrNone ) - { + TInt err = mWsSession.GetWindowGroupClientThreadId(wgId, threadId); + if (err == KErrNone) { RThread thread; - CleanupClosePushL( thread ); - err = thread.Open ( threadId ); - if ( err==KErrNone ) - { + CleanupClosePushL(thread); + err = thread.Open(threadId); + if (err == KErrNone) { tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack // tempName put on cleanupstack after the if - } - CleanupStack::PopAndDestroy( &thread ); } + CleanupStack::PopAndDestroy(&thread); } } - else - { + } + else { tempName = caption.AllocL(); //put on cleanupstack after the if - } - CleanupStack::PushL( tempName ); + } + CleanupStack::PushL(tempName); return tempName; - } - +} // -------------------------------------------------------------------------- // CTsFswDataList::FitDataToListL // -------------------------------------------------------------------------- // -TBool CTsFswDataList::FitDataToListL(RTsFswArray& aListToFit, - TBool /*aConsiderWidgets*/) - { +TBool CTsFswDataList::FitDataToListL(RTsFswArray& listToFit) +{ TBool changed = EFalse; - TInt listCount = aListToFit.Count(); - TInt dataCount = iData.Count(); - + TInt listCount = listToFit.Count(); + TInt dataCount = mData.Count(); //remove items that dont't exists in newly collected list - for (TInt i = dataCount -1; i >= 0; --i) - { - if ( !CheckIfExists(*iData[i], aListToFit) ) - { - delete iData[i]; - iData.Remove(i); - changed = ETrue; - } - } - + for (TInt i = dataCount - 1; i >= 0; --i) { + if (!CheckIfExists(*mData[i], listToFit)) { + delete mData[i]; + mData.Remove(i); + changed = ETrue; + } + } + RArray allKeys; + //add new item at start - //for (TInt i = 0; i < aListToFit.Count(); ++i) - for (TInt i = aListToFit.Count()-1; i >= 0; --i) - { - if (!CheckIfExists(*aListToFit[i], iData)) - { - iData.Insert(aListToFit[i], 0); - aListToFit[i] = 0; + for (TInt i = listToFit.Count() - 1; i >= 0; --i) { + allKeys.Insert(listToFit[i]->Key(), 0); + if (!CheckIfExists(*listToFit[i], mData)) { + mData.Insert(listToFit[i], 0); + listToFit[i] = 0; changed = ETrue; - } } - changed = changed || iOrderChanged; - iOrderChanged = EFalse; + } + //establish order + TBool orderChanged = EstablishOrder(allKeys); + changed = changed || orderChanged; + allKeys.Close(); return changed; - } +} // -------------------------------------------------------------------------- // CTsFswDataList::CheckIfExists // -------------------------------------------------------------------------- // -TBool CTsFswDataList::CheckIfExists(const CTsFswEntry& aEntry, - const RTsFswArray& aList) const - { +TBool CTsFswDataList::CheckIfExists(const CTsFswEntry& entry, const RTsFswArray& list) const +{ TBool exists(EFalse); - TInt dataCount = aList.Count(); - for (TInt entryIdx = 0; entryIdx < dataCount; ++entryIdx) - { - if (aList[entryIdx]->AppUid() == aEntry.AppUid()) - { - exists = ETrue; - break; - } - } + TTsEntryKey key; + TInt pos = FindEntry(list, entry.Key()); + if (pos >= 0) { + exists = ETrue; + } return exists; - } +} // -------------------------------------------------------------------------- -// CTsFswDataList::AppUidForWgId +// CTsFswDataList::GetAppIconL // -------------------------------------------------------------------------- // -TInt CTsFswDataList::AppUidForWgId( TInt aWgId, TUid& aUid ) - { - TRAPD(err, aUid = AppUidForWgIdL( aWgId ) ); - return err; +void CTsFswDataList::GetAppIconL(const TUid& aAppUid, CFbsBitmap*& bitmapArg, CFbsBitmap*& maskArg) +{ + bitmapArg = maskArg = NULL; + + TSize size(KAppIconWidth, KAppIconHeight); + CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC(); + TInt err = mAppArcSession.GetAppIcon(aAppUid, size, *apaMaskedBitmap); + TInt iconsCount(0); + if (err == KErrNone) { + err = mAppArcSession.NumberOfOwnDefinedIcons(aAppUid, iconsCount); } -// -------------------------------------------------------------------------- -// CTsFswDataList::AppUidForWgIdL -// -------------------------------------------------------------------------- -// -TUid CTsFswDataList::AppUidForWgIdL( TInt aWgId ) - { - CApaWindowGroupName* windowName = - CApaWindowGroupName::NewLC( iWsSession, aWgId ); - TUid appUid = windowName->AppUid(); - CleanupStack::PopAndDestroy( windowName ); - return appUid; + if ((err == KErrNone) && (iconsCount > 0)) { + bitmapArg = static_cast (apaMaskedBitmap); + TInt maskHandle = apaMaskedBitmap->Mask()->Handle(); + maskArg = new (ELeave) CFbsBitmap; + maskArg->Duplicate(maskHandle); + CleanupStack::Pop(apaMaskedBitmap); } + else { + CleanupStack::PopAndDestroy(apaMaskedBitmap); + HBufC* fileNameFromApparc = NULL; + TInt err = mAppArcSession.GetAppIcon(aAppUid, fileNameFromApparc); + if (err == KErrNone) { + CleanupStack::PushL(fileNameFromApparc); + CFbsBitmap *bitamp(0); + CFbsBitmap *mask(0); + TInt bitmapIndex = 0; + TInt maskIndex = 1; + // it will change bitmap ids if it is mif (checking inside) + AknIconUtils::ValidateLogicalAppIconId(*fileNameFromApparc, bitmapIndex, maskIndex); + AknIconUtils::CreateIconLC(bitamp, mask, fileNameFromApparc->Des(), bitmapIndex, + maskIndex); + + if (AknIconUtils::IsMifFile(*fileNameFromApparc)) { + AknIconUtils::DisableCompression(bitamp); + AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight), + EAspectRatioPreservedAndUnusedSpaceRemoved); + // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order + CleanupStack::Pop(2); + bitmapArg = bitamp; + maskArg = mask; + } + else { + CleanupStack::PopAndDestroy(2); + } + CleanupStack::PopAndDestroy(fileNameFromApparc); + } + } +} // -------------------------------------------------------------------------- // CTsFswDataList::GetAppIconL // -------------------------------------------------------------------------- // -void CTsFswDataList::GetAppIconL( const TUid& aAppUid, - CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ) - { - aBitmap = aMask = NULL; +TBool CTsFswDataList::IsHiddenUid(TUid uid) +{ + TInt result = mHiddenUids.Find(uid); + return result >= 0 ? ETrue : EFalse; +} - TSize size( KAppIconWidth, KAppIconHeight ); - CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC(); - TInt err = iAppArcSession.GetAppIcon( aAppUid, size, *apaMaskedBitmap ); - TInt iconsCount(0); - if ( err == KErrNone ) - { - err = iAppArcSession.NumberOfOwnDefinedIcons(aAppUid, iconsCount); - } - - if ( (err == KErrNone) && (iconsCount>0) ) - { - aBitmap = static_cast(apaMaskedBitmap); - TInt maskHandle = apaMaskedBitmap->Mask()->Handle(); - aMask = new (ELeave) CFbsBitmap; - aMask->Duplicate( maskHandle ); - CleanupStack::Pop( apaMaskedBitmap ); - } - else - { - CleanupStack::PopAndDestroy( apaMaskedBitmap ); - HBufC* fileNameFromApparc = NULL; - TInt err = iAppArcSession.GetAppIcon(aAppUid,fileNameFromApparc); - if ( err == KErrNone ) - { - CleanupStack::PushL(fileNameFromApparc); - CFbsBitmap *bitamp(0); - CFbsBitmap *mask(0); - TInt bitmapIndex = 0; - TInt maskIndex = 1; - // it will change bitmap ids if it is mif (checking inside) - AknIconUtils::ValidateLogicalAppIconId( *fileNameFromApparc, bitmapIndex, maskIndex ); - AknIconUtils::CreateIconLC( bitamp, mask, fileNameFromApparc->Des(), bitmapIndex, maskIndex ); - - if (AknIconUtils::IsMifFile(*fileNameFromApparc)) \ - { - AknIconUtils::DisableCompression(bitamp); - AknIconUtils::SetSize(bitamp, TSize(KAppIconWidth, KAppIconHeight), EAspectRatioPreservedAndUnusedSpaceRemoved); - // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order - CleanupStack::Pop(2); - aBitmap = bitamp; - aMask = mask; - } - else - { - CleanupStack::PopAndDestroy(2); - } - CleanupStack::PopAndDestroy(fileNameFromApparc); - } +// -------------------------------------------------------------------------- +// CTsFswDataList::FindEntry +// -------------------------------------------------------------------------- +// +TInt CTsFswDataList::FindEntry(const RTsFswArray& list, const TTsEntryKey& key) const +{ + TInt pos(KErrNotFound); + TInt dataCount = list.Count(); + for (TInt entryIdx = 0; entryIdx < dataCount; ++entryIdx) { + if (list[entryIdx]->Key() == key) { + pos = entryIdx; + break; } } + return pos; +} // -------------------------------------------------------------------------- -// CTsFswDataList::GetAppIconL +// CTsFswDataList::SetScreenshotL +// -------------------------------------------------------------------------- +// +TBool CTsFswDataList::SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId) +{ + RArray allWgIds; + CleanupClosePushL(allWgIds); + User::LeaveIfError(mWsSession.WindowGroupList(0, &allWgIds)); + TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgId, allWgIds.Array()); + TInt pos = FindEntry(mData, key); + TBool updated(EFalse); + if (pos >= 0) { + updated = mData[pos]->SetScreenshotL(bitmap, priority); + } + else { + User::Leave(KErrNotFound); + } + CleanupStack::PopAndDestroy(&allWgIds); + return updated; +} + +// -------------------------------------------------------------------------- +// CTsFswDataList::RemoveScreenshotL // -------------------------------------------------------------------------- // -TBool CTsFswDataList::IsHiddenUid( TUid aUid ) - { - TInt result = iHiddenUids.Find( aUid ); - return result >= 0 ? ETrue : EFalse; +TBool CTsFswDataList::RemoveScreenshotL(TInt wgId) +{ + RArray allWgIds; + CleanupClosePushL(allWgIds); + User::LeaveIfError(mWsSession.WindowGroupList(0, &allWgIds)); + TTsEntryKey key = TsEntryKeyGeneraror::GenerateL(wgId, allWgIds.Array()); + TInt pos = FindEntry(mData, key); + TBool updated(EFalse); + if (pos >= 0) { + updated = mData[pos]->RemoveScreenshot(); + } + else { + User::Leave(KErrNotFound); } + CleanupStack::PopAndDestroy(&allWgIds); + return updated; +} + +// -------------------------------------------------------------------------- +// CTsFswDataList::EstablishOrder +// -------------------------------------------------------------------------- +// +TBool CTsFswDataList::EstablishOrder(const RArray& keyList) +{ + TBool changed(EFalse); + __ASSERT_ALWAYS(mData.Count() == keyList.Count(), User::Panic(_L("EstablishOrder 1"), KErrBadHandle) ); + for (TInt i = 0; i < keyList.Count(); i++) { + const TTsEntryKey& currentdataKey = mData[i]->Key(); + const TTsEntryKey& referenceKey = keyList[i]; + if (!(currentdataKey == referenceKey)) { + TInt foundPos = FindEntry(mData, referenceKey); + __ASSERT_ALWAYS(foundPos>=0, User::Panic(_L("EstablishOrder 2"), KErrBadHandle) ); + CTsFswEntry* entry = mData[foundPos]; + mData.Remove(foundPos); + mData.Insert(entry, i); + changed = ETrue; + } + } + return changed; +} + +// -------------------------------------------------------------------------- +// CTsFswDataList::GetAllowedUidsL +// -------------------------------------------------------------------------- +// +void CTsFswDataList::GetAllowedUidsL() +{ + mAllowedUids.Close(); + TApaAppInfo* appInfo = new (ELeave) TApaAppInfo(); + CleanupStack::PushL(appInfo); + TApaAppCapabilityBuf appCap; + + User::LeaveIfError(mAppArcSession.GetAllApps(0)); + // for every application get uid, hidden and missing attribute + // and add to aArray. + while (KErrNone == mAppArcSession.GetNextApp(*appInfo)) { + TUid uid = appInfo->iUid; + User::LeaveIfError(mAppArcSession.GetAppCapability(appCap, uid)); + // do not add hidden app and with null uid. + if (!appCap().iAppIsHidden && !IsHiddenUid(uid) && uid.iUid) { + mAllowedUids.AppendL(uid); + } + } + CleanupStack::PopAndDestroy(appInfo); +} // end of file diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/tsfswengine.cpp --- a/tstaskmonitor/server/src/tsfswengine.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/src/tsfswengine.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -17,205 +17,114 @@ #include "tsfswengine.h" - #include "tsfswdatalist.h" - - -#include -#include -#include -#include // for CleanupResetAndDestroyPushL -#include -#include -#include -#include - -// time to wait before refreshing content -const TInt KContentRefreshDelay = 50000; // 0.05 sec - - // -------------------------------------------------------------------------- // CTsFswEngine::NewL // -------------------------------------------------------------------------- // -CTsFswEngine* CTsFswEngine::NewL( MHsDataObserver& aObserver ) - { - CTsFswEngine* self = NewLC( aObserver ); - CleanupStack::Pop( self ); +CTsFswEngine* CTsFswEngine::NewL(MHsDataObserver& observer) +{ + CTsFswEngine* self = NewLC(observer); + CleanupStack::Pop(self); return self; - } +} // -------------------------------------------------------------------------- // CTsFswEngine::NewLC // -------------------------------------------------------------------------- // -CTsFswEngine* CTsFswEngine::NewLC( MHsDataObserver& aObserver ) - { - CTsFswEngine* self = new ( ELeave ) CTsFswEngine( aObserver ); - CleanupStack::PushL( self ); +CTsFswEngine* CTsFswEngine::NewLC(MHsDataObserver& observer) +{ + CTsFswEngine* self = new (ELeave) CTsFswEngine(observer); + CleanupStack::PushL(self); self->ConstructL(); return self; - } +} // -------------------------------------------------------------------------- // CTsFswEngine::CTsFswEngine // -------------------------------------------------------------------------- // -CTsFswEngine::CTsFswEngine( MHsDataObserver& aObserver ) - :iObserver( aObserver ) - { - } +CTsFswEngine::CTsFswEngine(MHsDataObserver& observer) : + mObserver(observer) +{ +} // -------------------------------------------------------------------------- // CTsFswEngine::ConstructL // -------------------------------------------------------------------------- // void CTsFswEngine::ConstructL() - { - User::LeaveIfError( iWsSession.Connect() ); - User::LeaveIfError( iAppArcSession.Connect() ); - - iDataList = CTsFswDataList::NewL(*this); - - // get an initial list of tasks - iDataList->SetAppDataRefreshNeeded(); +{ + mDataList = CTsFswDataList::NewL(mObserver); CollectTasksL(); - - iUpdateStarter = CPeriodic::NewL( CActive::EPriorityStandard ); - } +} // -------------------------------------------------------------------------- // CTsFswEngine::~CTsFswEngine // -------------------------------------------------------------------------- // CTsFswEngine::~CTsFswEngine() - { - - delete iUpdateStarter; - - iWgIds.Close(); - - iAppArcSession.Close(); - iWsSession.Close(); - - delete iDataList; - } +{ + delete mDataList; +} // -------------------------------------------------------------------------- // CTsFswEngine::FswDataL // -------------------------------------------------------------------------- // const RTsFswArray& CTsFswEngine::FswDataL() - { - return iDataList->FswDataL(); - } +{ + return mDataList->FswDataL(); +} // -------------------------------------------------------------------------- // CTsFswEngine::UpdateTaskList // Callback from appui // -------------------------------------------------------------------------- // -void CTsFswEngine::UpdateTaskList() - { - // There can be many calls in a row, use a timer to prevent degrading - // device performance. - iDataList->SetDirty(); - if ( !iUpdateStarter->IsActive() ) - { - iUpdateStarter->Start( KContentRefreshDelay, 0, - TCallBack( UpdateStarterCallback, this ) ); - } - // get the foreground app uid and publish it to CFW if different than before - TRAP_IGNORE( PublishFgAppUidL() ); +void CTsFswEngine::DataChanged() +{ + TBool changed = EFalse; + TRAPD( err, changed = CollectTasksL() ); + if (err == KErrNone && changed) { + mObserver.DataChanged(); } - -// -------------------------------------------------------------------------- -// CTsFswEngine::UpdateStarterCallback -// Callback for the timer -// -------------------------------------------------------------------------- -// -TInt CTsFswEngine::UpdateStarterCallback( TAny* aParam ) - { - CTsFswEngine* self = static_cast( aParam ); - self->iUpdateStarter->Cancel(); - // get list of tasks and notify observer if there is a change in the list - TBool changed = EFalse; - TRAPD( err, changed = self->CollectTasksL() ); - if ( err == KErrNone && changed ) - { - self->iObserver.DataChanged(); - } - return 0; - } +} // -------------------------------------------------------------------------- // CTsFswEngine::CollectTasksL // -------------------------------------------------------------------------- // TBool CTsFswEngine::CollectTasksL() - { - TBool changed = iDataList->CollectTasksL(); +{ + TBool changed = mDataList->CollectTasksL(); return changed; - } +} // -------------------------------------------------------------------------- -// CTsFswEngine::ForegroundAppUidL +// CTsFswEngine::SetScreenshotL // -------------------------------------------------------------------------- // -TUid CTsFswEngine::ForegroundAppUidL( TInt aType ) - { - // Do not use GetFocusWindowGroup or others. - // We want to see only "real" application uids in FgApp, - // i.e. stuff that would also be shown in the task swapper - // area of Taskswitcher. - - TUid result = KNullUid; - RArray allWgIds; - CleanupClosePushL( allWgIds ); - User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) ); - TInt count = allWgIds.Count(); - for ( TInt i = 0; i < count; ++i ) - { - // Depending on aType we may not need to bother with iParentId here. - // If aType == EUseEmbeddedUid => embedded apps are treated as others. - // If aType == EUseStandaloneUid => embedded apps must be ignored. - if ( allWgIds[i].iParentId > 0 - && aType == CTsFswEngine::EUseStandaloneUid ) - { - continue; - } - - CApaWindowGroupName* wgn = CApaWindowGroupName::NewLC( - iWsSession, allWgIds[i].iId ); - TUid newUid = wgn->AppUid(); - TBool hidden = wgn->Hidden(); - CleanupStack::PopAndDestroy( wgn ); - - if ( !hidden && newUid.iUid && !iDataList->IsHiddenUid(newUid) ) - { - result = newUid; - break; - } - } - CleanupStack::PopAndDestroy( &allWgIds ); - - return result; +void CTsFswEngine::SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId) +{ + TBool changed = mDataList->SetScreenshotL(bitmap, priority, wgId); + if (!changed) { + User::Leave(KErrAccessDenied); } +} // -------------------------------------------------------------------------- -// CTsFswEngine::PublishFgAppUidL +// CTsFswEngine::SetScreenshotL // -------------------------------------------------------------------------- // -void CTsFswEngine::PublishFgAppUidL() - { - TUid newUid = ForegroundAppUidL( CTsFswEngine::EUseEmbeddedUid ); - if ( iFgAppUid != newUid && newUid.iUid ) - { - iFgAppUid = newUid; - iDataList->MoveEntryAtStart(newUid.iUid, EFalse); - } +void CTsFswEngine::RemoveScreenshotL(TInt wgId) +{ + TBool changed = mDataList->RemoveScreenshotL(wgId); + if (changed) { + mObserver.DataChanged(); } - +} // end of file diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/tsfswmonitor.cpp --- a/tstaskmonitor/server/src/tsfswmonitor.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/src/tsfswmonitor.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -1,92 +1,89 @@ /* -* 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: ws monitor implementation + * 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: ws monitor implementation + * + */ #include "tsfswmonitor.h" -#include "tsfswobservers.h" +#include "tsdataobserver.h" // -------------------------------------------------------------------------- // CTsFswMonitor::~CTsFswMonitor // -------------------------------------------------------------------------- // CTsFswMonitor::~CTsFswMonitor() - { +{ Cancel(); - iWg.Close(); - iWsSession.Close(); - } + mWg.Close(); + mWsSession.Close(); +} // -------------------------------------------------------------------------- // CTsFswMonitor::CTsFswMonitor // -------------------------------------------------------------------------- // -CTsFswMonitor::CTsFswMonitor(MTsFswTaskListObserver& aTaskListObserver) : CActive( EPriorityStandard ), - iTaskListObserver(&aTaskListObserver) - { - } +CTsFswMonitor::CTsFswMonitor(MHsDataObserver& taskListObserver) : + CActive(EPriorityStandard), mTaskListObserver(&taskListObserver) +{ +} // -------------------------------------------------------------------------- // CTsFswMonitor::NewL // -------------------------------------------------------------------------- // -CTsFswMonitor* CTsFswMonitor::NewL(MTsFswTaskListObserver& aTaskListObserver) - { - CTsFswMonitor* self = NewLC(aTaskListObserver); - CleanupStack::Pop( self ); +CTsFswMonitor* CTsFswMonitor::NewL(MHsDataObserver& taskListObserver) +{ + CTsFswMonitor* self = NewLC(taskListObserver); + CleanupStack::Pop(self); return self; - } +} // -------------------------------------------------------------------------- // CTsFswMonitor::NewLC // -------------------------------------------------------------------------- // -CTsFswMonitor* CTsFswMonitor::NewLC(MTsFswTaskListObserver& aTaskListObserver) - { - CTsFswMonitor* self = new ( ELeave ) CTsFswMonitor(aTaskListObserver); - CleanupStack::PushL( self ); +CTsFswMonitor* CTsFswMonitor::NewLC(MHsDataObserver& taskListObserver) +{ + CTsFswMonitor* self = new (ELeave) CTsFswMonitor(taskListObserver); + CleanupStack::PushL(self); self->ConstructL(); return self; - } - +} + // -------------------------------------------------------------------------- // CTsFswMonitor::ConstructL // -------------------------------------------------------------------------- // void CTsFswMonitor::ConstructL() - { - CActiveScheduler::Add( this ); +{ + CActiveScheduler::Add(this); //Create window server observer ConstractObserverL(); Subscribe(); - } - +} // ----------------------------------------------------------------------------- // Subscribe // ----------------------------------------------------------------------------- // void CTsFswMonitor::Subscribe() - { - if( !IsActive() ) - { - iWsSession.EventReady( &iStatus ); +{ + if (!IsActive()) { + mWsSession.EventReady(&iStatus); SetActive(); - } } +} // ----------------------------------------------------------------------------- // ConstractObserverL @@ -94,35 +91,32 @@ // void CTsFswMonitor::ConstractObserverL() { - User::LeaveIfError( iWsSession.Connect() ); - iWg = RWindowGroup( iWsSession ); - User::LeaveIfError( iWg.Construct( - reinterpret_cast( &iWg ) ) ); - iWg.DisableFocusChangeEvents(); - iWg.DisableModifierChangedEvents(); - iWg.DisableOnEvents(); - iWg.DisableScreenChangeEvents(); + User::LeaveIfError(mWsSession.Connect()); + mWg = RWindowGroup(mWsSession); + User::LeaveIfError(mWg.Construct(reinterpret_cast (&mWg))); + mWg.DisableFocusChangeEvents(); + mWg.DisableModifierChangedEvents(); + mWg.DisableOnEvents(); + mWg.DisableScreenChangeEvents(); //enable notifications about group lists - User::LeaveIfError( iWg.EnableGroupListChangeEvents() ); + User::LeaveIfError(mWg.EnableGroupListChangeEvents()); } void CTsFswMonitor::RunL() { - User::LeaveIfError( iStatus.Int() ); + User::LeaveIfError(iStatus.Int()); TWsEvent event; - iWsSession.GetEvent( event ); + mWsSession.GetEvent(event); Subscribe();//new subscribtion has to be called after picking event - if( EEventWindowGroupListChanged == event.Type() /*|| EEventFocusGroupChanged == event.Type()*/ ) - { - if ( iTaskListObserver ) - { - iTaskListObserver->UpdateTaskList(); - } + if (EEventWindowGroupListChanged == event.Type() /*|| EEventFocusGroupChanged == event.Type()*/) { + if (mTaskListObserver) { + mTaskListObserver->DataChanged(); } + } } -TInt CTsFswMonitor::RunError( TInt /*aError*/ ) +TInt CTsFswMonitor::RunError(TInt /*aError*/) { Subscribe(); return KErrNone; @@ -130,10 +124,9 @@ void CTsFswMonitor::DoCancel() { - if( IsActive() ) - { - iWsSession.EventReadyCancel(); - } + if (IsActive()) { + mWsSession.EventReadyCancel(); + } } // end of file diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/tsrunningappstorage.cpp --- a/tstaskmonitor/server/src/tsrunningappstorage.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/server/src/tsrunningappstorage.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -19,7 +19,7 @@ #include "tsfswmonitor.h" #include "tsfswentry.h" #include -#include +#include // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -84,13 +84,12 @@ { mObserver.DataChanged(); } - - int a=8; - if( a==9) - { - CActiveScheduler::Stop(); - } } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// void CRunningAppStorage::DataChangedL() { RTsFswArray taskList = mEngine->FswDataL(); @@ -110,6 +109,24 @@ CleanupStack::PopAndDestroy(buf); - CleanupStack::PopAndDestroy(entry); - + CleanupStack::PopAndDestroy(entry); } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CRunningAppStorage::UpdateL(TInt key, const CFbsBitmap& data, TInt /*param*/, TInt priority) + { + UpdatePriority newpriority = static_cast(priority); + mEngine->SetScreenshotL(&data, newpriority, key); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CRunningAppStorage::RemoveL(TInt key, TInt /*param*/) + { + mEngine->RemoveScreenshotL(key); + } diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/src/tsscreenshotprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/server/src/tsscreenshotprovider.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,94 @@ +/* +* 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 "tsscreenshotprovider.h" +#include "tstaskmonitorglobals.h" +#include + +const TUid KPluginUID = {0x200267AE}; +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsScreenshotProvider* CTsScreenshotProvider::NewL(MTsDataStorage& storage) +{ + CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(storage); + CleanupStack::PushL(self); + self->BaseConstructL(KPluginUID, KNullDesC8); + CleanupStack::Pop(self); + return self; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CTsScreenshotProvider::CTsScreenshotProvider(MTsDataStorage& storage) +: +mStorage(storage) +{} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotProvider::HandleMessage(const TDesC8& msg) +{ + TRAP_IGNORE(HandleMessageL(msg)); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotProvider::HandleMessageL(const TDesC8& msg) +{ + const TInt KMsgSize(5); + TInt parsedMsg[KMsgSize]; + + RDesReadStream msgStream(msg); + for (TInt iter(0); iter < KMsgSize; ++iter) { + parsedMsg[iter] = msgStream.ReadInt32L(); + } + + if (RegisterScreenshotMessage == parsedMsg[0]) { + CFbsBitmap *bitmap = new CFbsBitmap; + TInt errNo(KErrNoMemory); + if (0 != bitmap) { + CleanupStack::PushL(bitmap); + errNo = bitmap->Duplicate(parsedMsg[ScreenshotHandle + 1]); + } + const TPckgC buf(parsedMsg);//ACK bitmap duplication + SendMessage(msg); + User::LeaveIfError(errNo); + + mStorage.UpdateL(parsedMsg[WindowsGroup +1 ], + *bitmap, + parsedMsg[AdditionalParameters + 1], + parsedMsg[Priority + 1]); + + CleanupStack::PopAndDestroy(bitmap); + } +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CTsScreenshotProvider::OnReplace() +{ + //no implementation required +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/server/tsrc/tsrc.pro --- a/tstaskmonitor/server/tsrc/tsrc.pro Thu May 27 13:11:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +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 -CONFIG += ordered - -SUBDIRS += testapp -SUBDIRS += t_tsrunningappstorage - diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/sis/stubs/taskmonitor_stub.pkg --- a/tstaskmonitor/sis/stubs/taskmonitor_stub.pkg Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/sis/stubs/taskmonitor_stub.pkg Fri Jun 11 13:58:37 2010 +0300 @@ -33,4 +33,7 @@ :"Nokia" "" - "Z:\sys\bin\tstaskmonitorclient.dll" -"" - "Z:\sys\bin\hsrunningappmonitor.exe" +"" - "Z:\sys\bin\hsrunningappmonitor.exe" +"" - "Z:\sys\bin\tsscreenshotplugin.dll" +"" - "Z:\resource\plugins\tsscreenshotplugin.rsc" +"" - "Z:\sys\bin\tsbackstepping.dll" \ No newline at end of file diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/sis/stubs/taskmonitor_stub.sis Binary file tstaskmonitor/sis/stubs/taskmonitor_stub.sis has changed diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/sis/taskmonitor.SIS Binary file tstaskmonitor/sis/taskmonitor.SIS has changed diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/sis/taskmonitor.pkg --- a/tstaskmonitor/sis/taskmonitor.pkg Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/sis/taskmonitor.pkg Fri Jun 11 13:58:37 2010 +0300 @@ -29,4 +29,6 @@ "/epoc32/release/armv5/urel/hsrunningappmonitor.exe" - "!:\sys\bin\hsrunningappmonitor.exe" "/epoc32/release/armv5/urel/tstaskmonitorclient.dll"-"!:\sys\bin\tstaskmonitorclient.dll" - +"/epoc32/release/armv5/urel/tsscreenshotplugin.dll"-"!:\sys\bin\tsscreenshotplugin.dll" +"/epoc32/data/z/resource/plugins/tsscreenshotplugin.rsc"-"!:\resource\plugins\tsscreenshotplugin.rsc" +"/epoc32/release/armv5/urel/tsbackstepping.dll"-"!:\sys\bin\tsbackstepping.dll" diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/tstaskmonitor.pro --- a/tstaskmonitor/tstaskmonitor.pro Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/tstaskmonitor.pro Fri Jun 11 13:58:37 2010 +0300 @@ -17,11 +17,14 @@ TEMPLATE = subdirs CONFIG += ordered - +SUBDIRS += client symbian { - SUBDIRS += server + SUBDIRS += backstepping \ + server \ + screenshotplugin + + BLD_INF_RULES.prj_exports += "inc\tstaskmonitorglobals.h" + } -SUBDIRS += client - symbian:include(rom.pri) \ No newline at end of file diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/utils/inc/tsdataobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/utils/inc/tsdataobserver.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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 DATAOBSERVER_H +#define DATAOBSERVER_H + +#include + +class MHsDataObserver { +public: + virtual void DataChanged() =0; +}; + +class CHsDataObserver: public CBase, + public MHsDataObserver +{ +public: + virtual void Cancel(const RMessage2& reason) =0; +}; + +class MHsDataObserverStorage +{ +public: + virtual void PushL(CHsDataObserver*) =0; + virtual void Pop(CHsDataObserver*) =0; + virtual void Cancel(const RMessage2& reason) =0; +}; + +#endif //DATAOBSERVER_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/utils/inc/tsentrykey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/utils/inc/tsentrykey.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,38 @@ +/* +* 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: Task list entry + * +*/ + + +#ifndef TSENTRYKEY_H +#define TSENTRYKEY_H + +#include +class RReadStream; +class RWriteStream; + +class TTsEntryKey +{ +public: + TTsEntryKey(TInt parentId =0); + TBool operator ==(const TTsEntryKey& key) const; + void ExternalizeL(RWriteStream& output); + void InternalizeL(RReadStream& input); + +public: + TInt mParentId; +}; + +#endif //TSENTRYKEY_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/utils/inc/tsentrykeygenerator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/utils/inc/tsentrykeygenerator.h Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,36 @@ +/* +* 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: Task list entry + * +*/ + + +#ifndef TSENTRYKEYGENERATOR_H +#define TSENTRYKEYGENERATOR_H + +#include +#include +#include + +#include "tsentrykey.h" + + +class TsEntryKeyGeneraror +{ +public: + static TTsEntryKey GenerateL(TInt windowGroupId, + const TArray& groupChain); +}; + +#endif //TSENTRYKEYGENERATOR_H diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/utils/inc/tsfswentry.h --- a/tstaskmonitor/utils/inc/tsfswentry.h Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/utils/inc/tsfswentry.h Fri Jun 11 13:58:37 2010 +0300 @@ -21,11 +21,16 @@ #include #include +#include + +#include "tsentrykey.h" +#include "tstaskmonitorglobals.h" class CTsFswEntry; class RReadStream; class RWriteStream; class CFbsBitmap; +class MHsDataObserver; typedef RPointerArray RTsFswArray; @@ -39,11 +44,16 @@ /** * An entry in the task list. */ -NONSHARABLE_CLASS( CTsFswEntry ) : public CBase +NONSHARABLE_CLASS( CTsFswEntry ) : public CBase, + private MImageReadyCallBack { public: static CTsFswEntry* NewL(); static CTsFswEntry* NewLC(); + + static CTsFswEntry* NewL(const TTsEntryKey& key, MHsDataObserver* observer =0); + static CTsFswEntry* NewLC(const TTsEntryKey& key, MHsDataObserver* observer =0); + ~CTsFswEntry(); /** @@ -80,15 +90,31 @@ /** * Application icon mask. - * @see AppIconBitmapHandle */ CFbsBitmap* AppIconMask() const; + + /** + * Application screenshot. + */ + CFbsBitmap* Screenshot() const; + + /** + * Priority. + */ + UpdatePriority Priority() const; + + /** + * Entry's key + */ + const TTsEntryKey& Key() const; - void SetWgId( TInt aWgId ); - void SetAppUid( const TUid& aUid ); - void SetAppNameL( const TDesC& aAppName ); - void SetCloseableApp( TBool aValue ); + void SetWgId( TInt wgId ); + void SetAppUid( const TUid& uid ); + void SetAppNameL( const TDesC& appName ); + void SetCloseableApp( TBool value ); + TBool SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority); + TBool RemoveScreenshot(); // takes ownership of bitmaps void SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask ); @@ -101,12 +127,23 @@ RTsFswArray& aArray ); private: - TInt iWgId; - TUid iAppUid; - HBufC* iAppName; - TBool iCloseableApp; - CFbsBitmap* iAppIconBitmap; - CFbsBitmap* iAppIconMask; + //constructors + CTsFswEntry(); + CTsFswEntry(const TTsEntryKey& aKey, MHsDataObserver* observer); + void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ); + +private: + TInt mWgId; + TUid mAppUid; + HBufC* mAppName; + TBool mCloseableApp; + CFbsBitmap* mAppIconBitmap; + CFbsBitmap* mAppIconMask; + CFbsBitmap* mScreenshot; + TTsEntryKey mKey; + UpdatePriority mPriority; + MHsDataObserver* mObserver; + CTsGraphicFileScalingHandler* mImgTool; }; #endif diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/utils/src/tsentrykey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/utils/src/tsentrykey.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -0,0 +1,56 @@ +/* +* 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: Task list entry + * +*/ + + +#include "tsentrykey.h" +#include + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TTsEntryKey::TTsEntryKey(TInt parentId) +: + mParentId(parentId) +{} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool TTsEntryKey::operator ==(const TTsEntryKey& key) const +{ + return (mParentId == key.mParentId); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void TTsEntryKey::ExternalizeL(RWriteStream& output) +{ + output.WriteInt32L(mParentId); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void TTsEntryKey::InternalizeL(RReadStream& input) +{ + mParentId = input.ReadInt32L(); +} diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/utils/src/tsentrykeygenerator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tstaskmonitor/utils/src/tsentrykeygenerator.cpp Fri Jun 11 13:58:37 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: Task list entry + * +*/ +#include "tsentrykeygenerator.h" + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TTsEntryKey TsEntryKeyGeneraror::GenerateL(TInt windowGroupId, + const TArray& groupChain) +{ + for (TInt iter(0); iter < groupChain.Count(); ++iter) { + if (groupChain[iter].iId == windowGroupId) { + return 0 >= groupChain[iter].iParentId ? + TTsEntryKey(windowGroupId) : + TsEntryKeyGeneraror::GenerateL(groupChain[iter].iParentId, groupChain); + } + } + User::Leave(KErrNotFound); + // for avoid compile error + return TTsEntryKey(); +} + diff -r 397d00875918 -r 156f692b1687 tstaskmonitor/utils/src/tsfswentry.cpp --- a/tstaskmonitor/utils/src/tsfswentry.cpp Thu May 27 13:11:12 2010 +0300 +++ b/tstaskmonitor/utils/src/tsfswentry.cpp Fri Jun 11 13:58:37 2010 +0300 @@ -1,22 +1,23 @@ /* -* 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: Task list entry + * 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: Task list entry + * + */ #define __E32SVR_H__ #include "tsfswentry.h" +#include "tsdataobserver.h" #include #include @@ -25,227 +26,370 @@ // -------------------------------------------------------------------------- // CTsFswEntry* CTsFswEntry::NewL() - { +{ CTsFswEntry* self = NewLC(); - CleanupStack::Pop( self ); + CleanupStack::Pop(self); return self; - } +} // -------------------------------------------------------------------------- // CTsFswEntry::NewLC // -------------------------------------------------------------------------- // CTsFswEntry* CTsFswEntry::NewLC() - { - CTsFswEntry* self = new ( ELeave ) CTsFswEntry; - CleanupStack::PushL( self ); +{ + CTsFswEntry* self = new (ELeave) CTsFswEntry; + CleanupStack::PushL(self); return self; - } +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::NewL +// -------------------------------------------------------------------------- +// +CTsFswEntry* CTsFswEntry::NewL(const TTsEntryKey& key, MHsDataObserver *observer) +{ + CTsFswEntry* self = NewLC(key, observer); + CleanupStack::Pop(self); + return self; +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::NewLC +// -------------------------------------------------------------------------- +// +CTsFswEntry* CTsFswEntry::NewLC(const TTsEntryKey& key, MHsDataObserver* observer) +{ + CTsFswEntry* self = new (ELeave) CTsFswEntry(key, observer); + CleanupStack::PushL(self); + return self; +} // -------------------------------------------------------------------------- // CTsFswEntry::~CTsFswEntry // -------------------------------------------------------------------------- // CTsFswEntry::~CTsFswEntry() - { - delete iAppName; - delete iAppIconBitmap; - delete iAppIconMask; - } +{ + delete mAppName; + delete mAppIconBitmap; + delete mAppIconMask; + delete mScreenshot; + delete mImgTool; +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::CTsFswEntry +// -------------------------------------------------------------------------- +// +CTsFswEntry::CTsFswEntry() : + mPriority(Low) +{ + mKey = TTsEntryKey(); +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::CTsFswEntry +// -------------------------------------------------------------------------- +// +CTsFswEntry::CTsFswEntry(const TTsEntryKey& key, MHsDataObserver *observer) : + mKey(key), mPriority(Low), mObserver(observer) +{ + mWgId = key.mParentId; +} // -------------------------------------------------------------------------- // CTsFswEntry::SetWgId // -------------------------------------------------------------------------- // -void CTsFswEntry::SetWgId( TInt aWgId ) - { - iWgId = aWgId; - } +void CTsFswEntry::SetWgId(TInt wgId) +{ + mWgId = wgId; + mKey = TTsEntryKey(mWgId); +} // -------------------------------------------------------------------------- // CTsFswEntry::SetAppUid // -------------------------------------------------------------------------- // -void CTsFswEntry::SetAppUid( const TUid& aUid ) - { - iAppUid = aUid; - } +void CTsFswEntry::SetAppUid(const TUid& uid) +{ + mAppUid = uid; +} // -------------------------------------------------------------------------- // CTsFswEntry::SetAppNameL // -------------------------------------------------------------------------- // -void CTsFswEntry::SetAppNameL( const TDesC& aAppName ) - { - delete iAppName; iAppName = 0; - iAppName = aAppName.AllocL(); - } +void CTsFswEntry::SetAppNameL(const TDesC& appName) +{ + delete mAppName; + mAppName = 0; + mAppName = appName.AllocL(); +} // -------------------------------------------------------------------------- // CTsFswEntry::SetSystemApp // -------------------------------------------------------------------------- // -void CTsFswEntry::SetCloseableApp( TBool aValue ) - { - iCloseableApp = aValue; - } +void CTsFswEntry::SetCloseableApp(TBool value) +{ + mCloseableApp = value; +} // -------------------------------------------------------------------------- // CTsFswEntry::SetAppIconHandles // -------------------------------------------------------------------------- // -void CTsFswEntry::SetAppIcon( CFbsBitmap* aBitmap, CFbsBitmap* aMask ) - { - iAppIconBitmap = aBitmap; - iAppIconMask = aMask; - } +void CTsFswEntry::SetAppIcon(CFbsBitmap* bitmap, CFbsBitmap* mask) +{ + mAppIconBitmap = bitmap; + mAppIconMask = mask; +} // -------------------------------------------------------------------------- // CTsFswEntry::WgId // -------------------------------------------------------------------------- // TInt CTsFswEntry::WgId() const - { - return iWgId; - } +{ + return mWgId; +} // -------------------------------------------------------------------------- // CTsFswEntry::AppUid // -------------------------------------------------------------------------- // TUid CTsFswEntry::AppUid() const - { - return iAppUid; - } +{ + return mAppUid; +} // -------------------------------------------------------------------------- // CTsFswEntry::AppName // -------------------------------------------------------------------------- // const TDesC& CTsFswEntry::AppName() const - { - return iAppName ? *iAppName : KNullDesC(); - } +{ + return mAppName ? *mAppName : KNullDesC(); +} // -------------------------------------------------------------------------- // CTsFswEntry::SystemApp // -------------------------------------------------------------------------- // TBool CTsFswEntry::CloseableApp() const - { - return iCloseableApp; - } +{ + return mCloseableApp; +} // -------------------------------------------------------------------------- // CTsFswEntry::AppIconBitmapHandle // -------------------------------------------------------------------------- // CFbsBitmap* CTsFswEntry::AppIconBitmap() const - { - return iAppIconBitmap; - } +{ + return mAppIconBitmap; +} // -------------------------------------------------------------------------- // CTsFswEntry::AppIconMaskHandle // -------------------------------------------------------------------------- // CFbsBitmap* CTsFswEntry::AppIconMask() const - { - return iAppIconMask; - } +{ + return mAppIconMask; +} // -------------------------------------------------------------------------- +// CTsFswEntry::Key +// -------------------------------------------------------------------------- +// +const TTsEntryKey& CTsFswEntry::Key() const +{ + return mKey; +} +// -------------------------------------------------------------------------- // CTsFswEntry::ExternalizeL // -------------------------------------------------------------------------- // -void CTsFswEntry::ExternalizeL( RWriteStream& aStream ) - { - aStream.WriteInt32L( iWgId ); - aStream.WriteInt32L( iAppUid.iUid ); - aStream << AppName(); - aStream.WriteInt32L( iCloseableApp ); - if ( iAppIconBitmap ) - { - aStream.WriteInt32L( iAppIconBitmap->Handle() ); - } - else - { - aStream.WriteInt32L( KErrNotFound ); - } - - if ( iAppIconMask ) - { - aStream.WriteInt32L( iAppIconMask->Handle() ); - } - else - { - aStream.WriteInt32L( KErrNotFound ); - } +void CTsFswEntry::ExternalizeL(RWriteStream& stream) +{ + stream.WriteInt32L(mWgId); + stream.WriteInt32L(mAppUid.iUid); + stream << AppName(); + stream.WriteInt32L(mCloseableApp); + if (mAppIconBitmap) { + stream.WriteInt32L(mAppIconBitmap->Handle()); + } + else { + stream.WriteInt32L(KErrNotFound); + } + + if (mAppIconMask) { + stream.WriteInt32L(mAppIconMask->Handle()); } + else { + stream.WriteInt32L(KErrNotFound); + } + + if (mScreenshot) { + stream.WriteInt32L(mScreenshot->Handle()); + } + else { + stream.WriteInt32L(KErrNotFound); + } + + mKey.ExternalizeL(stream); + TInt currentPriority = static_cast (mPriority); + stream.WriteInt32L(currentPriority); +} // -------------------------------------------------------------------------- // CTsFswEntry::InternalizeL // -------------------------------------------------------------------------- // -void CTsFswEntry::InternalizeL( RReadStream& aStream ) - { - iWgId = aStream.ReadInt32L(); - iAppUid = TUid::Uid( aStream.ReadInt32L() ); - delete iAppName; iAppName = NULL; - iAppName = HBufC::NewL( aStream, KMaxTInt ); - iCloseableApp = aStream.ReadInt32L(); - TInt appIconBitmapHandle = aStream.ReadInt32L(); - TInt appIconMaskHandle = aStream.ReadInt32L(); - if ( appIconBitmapHandle != KErrNotFound ) - { - iAppIconBitmap = new (ELeave) CFbsBitmap; - iAppIconBitmap->Duplicate( appIconBitmapHandle ); - } - if ( appIconMaskHandle != KErrNotFound ) - { - iAppIconMask = new (ELeave) CFbsBitmap; - iAppIconMask->Duplicate( appIconMaskHandle ); - } +void CTsFswEntry::InternalizeL(RReadStream& stream) +{ + mWgId = stream.ReadInt32L(); + mAppUid = TUid::Uid(stream.ReadInt32L()); + delete mAppName; + mAppName = NULL; + mAppName = HBufC::NewL(stream, KMaxTInt); + mCloseableApp = stream.ReadInt32L(); + TInt appIconBitmapHandle = stream.ReadInt32L(); + TInt appIconMaskHandle = stream.ReadInt32L(); + TInt screenshotHandle = stream.ReadInt32L(); + if (appIconBitmapHandle != KErrNotFound) { + mAppIconBitmap = new (ELeave) CFbsBitmap; + mAppIconBitmap->Duplicate(appIconBitmapHandle); } + if (appIconMaskHandle != KErrNotFound) { + mAppIconMask = new (ELeave) CFbsBitmap; + mAppIconMask->Duplicate(appIconMaskHandle); + } + if (screenshotHandle != KErrNotFound) { + mScreenshot = new (ELeave) CFbsBitmap; + mScreenshot->Duplicate(screenshotHandle); + } + mKey.InternalizeL(stream); + TInt currentPriority = stream.ReadInt32L(); + mPriority = static_cast (currentPriority); +} // -------------------------------------------------------------------------- // CTsFswEntry::ExternalizeArrayL // -------------------------------------------------------------------------- // -void CTsFswEntry::ExternalizeArrayL( RWriteStream& aStream, - const RTsFswArray& aArray ) - { +void CTsFswEntry::ExternalizeArrayL(RWriteStream& stream, const RTsFswArray& aArray) +{ TInt count = aArray.Count(); - aStream.WriteInt32L( count ); - for ( TInt i = 0; i < count; ++i ) - { - aArray[i]->ExternalizeL( aStream ); - } + stream.WriteInt32L(count); + for (TInt i = 0; i < count; ++i) { + aArray[i]->ExternalizeL(stream); } +} // -------------------------------------------------------------------------- // CTsFswEntry::InternalizeArrayL // -------------------------------------------------------------------------- // -void CTsFswEntry::InternalizeArrayL( RReadStream& aStream, - RTsFswArray& aArray ) - { +void CTsFswEntry::InternalizeArrayL(RReadStream& stream, RTsFswArray& aArray) +{ aArray.ResetAndDestroy(); - TInt count = aStream.ReadInt32L(); for ( TInt i = 0; i < count; ++i ) - { + TInt count = stream.ReadInt32L(); + for (TInt i = 0; i < count; ++i) { CTsFswEntry* entry = CTsFswEntry::NewLC(); - entry->InternalizeL( aStream ); - aArray.AppendL( entry ); - CleanupStack::Pop( entry ); - } + entry->InternalizeL(stream); + aArray.AppendL(entry); + CleanupStack::Pop(entry); } +} // -------------------------------------------------------------------------- // CTsFswEntry::Type // -------------------------------------------------------------------------- // TAppType CTsFswEntry::Type() const - { +{ return EApp; +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::SetScreenshot +// -------------------------------------------------------------------------- +// +TBool CTsFswEntry::SetScreenshotL(const CFbsBitmap* bitmapArg, UpdatePriority priority) +{ + TInt currentPriority = static_cast (mPriority); + TInt newPriority = static_cast (priority); + if (newPriority >= currentPriority) { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + User::LeaveIfError(bitmap->Duplicate(bitmapArg->Handle())); + CleanupStack::Pop(bitmap); + + mPriority = priority; + delete mScreenshot; + mScreenshot = bitmap; + + delete mImgTool; + mImgTool = 0; + + mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128), + CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding); + return ETrue; } + return EFalse; +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::RemoveScreenshot +// -------------------------------------------------------------------------- +// +TBool CTsFswEntry::RemoveScreenshot() +{ + if (mScreenshot) { + delete mScreenshot; + mScreenshot = NULL; + mPriority = Low; + return ETrue; + } + return EFalse; +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::Screenshot +// -------------------------------------------------------------------------- +// +CFbsBitmap* CTsFswEntry::Screenshot() const +{ + return mScreenshot; +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::Priority +// -------------------------------------------------------------------------- +// +UpdatePriority CTsFswEntry::Priority() const +{ + return mPriority; +} + +// -------------------------------------------------------------------------- +// CTsFswEntry::Priority +// -------------------------------------------------------------------------- +// +void CTsFswEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap) +{ + if (KErrNone == error && 0 != bitmap) { + mScreenshot->Reset(); + mScreenshot->Duplicate(bitmap->Handle()); + + if (mObserver) { + mObserver->DataChanged(); + } + } +} + // end of file