--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpactiondatacache.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpactiondatacache.h Tue May 11 16:30:05 2010 +0300
@@ -67,6 +67,15 @@
void AppendL( const CLiwGenericParamList* aParamList);
/**
+ * Appends empty item to the cache to indicate that the entry
+ * doesn't exist in a storage and it makes not sense to call GetList
+ * operation on a storage
+ *
+ * @param aIdsMap a map containing entry identifiers
+ */
+ void AppendEmptyL( const CLiwMap* aIdsMap );
+
+ /**
* Checks if it is possible to cache the item.
* Only items that are specified, which means that id or
* all parameters ( publisher, content_type, content_id ) are provided
@@ -115,6 +124,23 @@
TBool MatchL(const CLiwMap* aCachedMap, const CLiwMap* aInputMap);
/**
+ * Checks if types of two items match
+ *
+ * @param aCachedMap a map from the cache containing item identifiers
+ * @param aInputMap an input map containing item identifiers
+ * @return ETrue if types match , EFalse if not
+ */
+ TBool TypesMatchL(const CLiwMap* aCachedMap, const CLiwMap* aInputMap);
+
+ /**
+ * Extracts RBuf from a variant
+ *
+ * @param aVariant a variant
+ * @param aBuf a result descriptor
+ */
+ void ExtractRBufL(const TLiwVariant& aVariant, RBuf& aBuf);
+
+ /**
* Checks if two strings contained in both maps match
*
* @param aLeft first map
--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpglobals.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpglobals.h Tue May 11 16:30:05 2010 +0300
@@ -45,6 +45,7 @@
const TInt KThreadNameLimit = 64;
const TUint KDisablePersist = 0x1000;
const TUint KDisableNotification = 0x2000;
+const TUint KExtendedNotifications = 0x4000;
_LIT( KService, "CP Service" );
--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h Tue May 11 16:30:05 2010 +0300
@@ -41,13 +41,13 @@
* Two-phased constructor.
*/
static CCPNotificationHandler* NewL( RPointerArray<CLiwDefaultList>&
- aNotifications );
+ aNotifications, TLiwVariant& aDataMapCache );
/**
* Two-phased constructor.
*/
static CCPNotificationHandler* NewLC( RPointerArray<CLiwDefaultList>&
- aNotifications );
+ aNotifications, TLiwVariant& aDataMapCache );
/**
* Destructor.
@@ -97,12 +97,12 @@
/**
* C++ default constructor.
*/
- CCPNotificationHandler();
+ CCPNotificationHandler(TLiwVariant& aDataMapCache);
/**
* By default Symbian 2nd phase constructor is private.
*/
- void ConstructL( RPointerArray<CLiwDefaultList>& aNotifications );
+ void ConstructL(RPointerArray<CLiwDefaultList>& aNotifications);
/**
* Invoked in order to send notification
@@ -202,6 +202,18 @@
* Filters
*/
RHashMap< TInt32, CCPLiwMap*> iFilters;
+
+
+ /*
+ * Own.
+ * Filters
+ */
+ RHashMap< TInt32, TBool> iExtendedFlags;
+
+ /*
+ * Not Own.
+ */
+ TLiwVariant& iDataMapCache;
};
#endif // C_CPNOTIFICATIONHANDLER_H
--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserver.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserver.h Tue May 11 16:30:05 2010 +0300
@@ -112,6 +112,13 @@
*/
RPointerArray<CLiwDefaultList>& GetNotifications( );
+ /**
+ * Get DataMap Cache
+ *
+ * @return DataMap cache reference
+ */
+ TLiwVariant& GetDataMapCache();
+
private:
// From CActive
@@ -222,6 +229,12 @@
* activation during startup
*/
RPointerArray<CLiwDefaultList> iNotifications;
+
+ /*
+ * Own.
+ */
+ TLiwVariant iDataMapCache;
+
};
#endif // C_CCPSERVER_H
--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverdatamanager.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserverdatamanager.h Tue May 11 16:30:05 2010 +0300
@@ -53,12 +53,14 @@
/**
* Two-phased constructor.
*/
- static CCPDataManager* NewL( TBool aTBool = EFalse );
+ static CCPDataManager* NewL(TLiwVariant& aDataMapCache, TBool aTBool =
+ EFalse);
/**
* Two-phased constructor.
*/
- static CCPDataManager* NewLC( TBool aTBool = EFalse );
+ static CCPDataManager* NewLC(TLiwVariant& aDataMapCache, TBool aTBool =
+ EFalse);
/**
* Add a new data to database
@@ -136,7 +138,7 @@
* Open database
* @return
*/
- void OpenDatabaseL();
+ void OpenDatabaseL(TLiwVariant& aDataMapCache);
private:
// methods
@@ -149,7 +151,7 @@
/**
* Standard 2nd phase constructor.
*/
- void ConstructL( TBool aTBool );
+ void ConstructL( TLiwVariant& aDataMapCache, TBool aTBool );
/**
* Fetches action bound to provided trigger.
@@ -180,12 +182,12 @@
* Fills aOutParamList with parameters for action.
*
* @param aOutParamList parsed list of items
- * @param aParamList list of items from data base
+ * @param aActionMap action map from the database
* @param aActionTrigger action trigger
*/
void FillActionParamListL(
CLiwGenericParamList & aOutParamList,
- const TLiwGenericParam* aParam,
+ const CLiwDefaultMap* aActionMap,
const CLiwDefaultList* aActionTriggers);
/**
@@ -208,7 +210,8 @@
/**
* Builds change info list based on query result to database
* @param aMap - map containing parameters needed to build change info list
- * @param aParam - param from getlist result
+ * @param aParam - param from getlist result
+ * @param aActionMap - action map from a database
* @param aChangeInfoList - output list containing change info list sent
* as notification
*/
@@ -216,7 +219,9 @@
const CCPLiwMap* aMap,
const CLiwDefaultList* aActionTriggers,
const TLiwGenericParam* aParam,
+ const CLiwDefaultMap* aActionMap,
CLiwDefaultList* aChangeInfoList );
+
/**
* Builds change info list when query to database returned nothing
* @param aMap - map containing parameters needed to build change info list
@@ -282,7 +287,6 @@
* Own.
*/
CCPActionDataCache* iActionDataCache;
-
#ifdef CONTENT_PUBLISHER_DEBUG
CCPDebug* iDebug;
--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserversession.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserversession.h Tue May 11 16:30:05 2010 +0300
@@ -74,10 +74,10 @@
/**
* Selects correct function from message
- * @param aMessage message from client (containing requested operation
- * and any data)
+ * @param aMessage message from client (containing requested operation and any data)
+ * @param aCompleteRequest flag for marking need of completing request
*/
- void DispatchMessageL(const RMessage2& aMessage, TBool& aPanicedClient);
+ void DispatchMessageL(const RMessage2& aMessage, TBool& aCompleteRequest);
private:
// New methods
@@ -269,7 +269,7 @@
* Manager to prepare and execute action
*/
CCPActionHandlerThread* iActionHandlerThread;
-
+
#ifdef CONTENT_PUBLISHER_DEBUG
CCPDebug* iDebug;
#endif
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpactiondatacache.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpactiondatacache.cpp Tue May 11 16:30:05 2010 +0300
@@ -20,6 +20,7 @@
#include <liwcommon.h>
#include <liwvariant.h>
#include <s32mem.h>
+#include <escapeutils.h>
#include "cpactiondatacache.h"
#include "cpglobals.h"
@@ -28,7 +29,7 @@
_LIT8(KCachedMap, "cached_map");
-static const int KMaxCacheItems = 6;
+static const int KMaxCacheItems = 18;
// ======== MEMBER FUNCTIONS ========
@@ -113,6 +114,7 @@
{
const CLiwMap* inputMap = param->Value().AsMap();
CLiwDefaultMap* map = CLiwDefaultMap::NewLC();
+ CopyVariantL(KType, inputMap, map);
CopyVariantL(KId, inputMap, map);
CopyVariantL(KPublisherId, inputMap, map);
CopyVariantL(KContentType, inputMap, map);
@@ -132,6 +134,22 @@
//
// ---------------------------------------------------------------------------
//
+void CCPActionDataCache::AppendEmptyL( const CLiwMap* aIdsMap )
+ {
+ CLiwDefaultMap* map = CLiwDefaultMap::NewLC();
+ CopyVariantL(KType, aIdsMap, map);
+ CopyVariantL(KId, aIdsMap, map);
+ CopyVariantL(KPublisherId, aIdsMap, map);
+ CopyVariantL(KContentType, aIdsMap, map);
+ CopyVariantL(KContentId, aIdsMap, map);
+ iInternalList->AppendL(TLiwVariant(map));
+ CleanupStack::PopAndDestroy(map);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
TBool CCPActionDataCache::IsCacheableL(const CLiwMap* aMap)
{
TBool result(EFalse);
@@ -203,21 +221,23 @@
TLiwVariant l, r;
l.PushL();
r.PushL();
- if (aCachedMap->FindL(KId, l) && aInputMap->FindL(KId, r) && l.AsTInt32()
- == r.AsTInt32())
+ if (TypesMatchL(aCachedMap,aInputMap))
{
- idMatch = ETrue;
- }
- if (!idMatch)
- {
- if (MatchL(aCachedMap, aInputMap, KPublisherId) && MatchL(aCachedMap,
- aInputMap, KContentType) && MatchL(aCachedMap, aInputMap,
- KContentId))
+ if (aCachedMap->FindL(KId, l) && aInputMap->FindL(KId, r) && l.AsTInt32()
+ == r.AsTInt32())
{
idMatch = ETrue;
}
+ if (!idMatch)
+ {
+ if (MatchL(aCachedMap, aInputMap, KPublisherId) && MatchL(aCachedMap,
+ aInputMap, KContentType) && MatchL(aCachedMap, aInputMap,
+ KContentId))
+ {
+ idMatch = ETrue;
+ }
+ }
}
-
CleanupStack::PopAndDestroy(&r);
CleanupStack::PopAndDestroy(&l);
return idMatch;
@@ -227,6 +247,61 @@
//
// ---------------------------------------------------------------------------
//
+TBool CCPActionDataCache::TypesMatchL(const CLiwMap* aCachedMap,
+ const CLiwMap* aInputMap)
+ {
+ TBool typesMatch(EFalse);
+ TLiwVariant cacheVariant;
+ TLiwVariant inputVariant;
+ cacheVariant.PushL();
+ inputVariant.PushL();
+ if (aCachedMap->FindL(KType, cacheVariant) && aInputMap->FindL(KType,
+ inputVariant))
+ {
+ RBuf typeCache;
+ RBuf typeInput;
+ CleanupClosePushL(typeCache);
+ CleanupClosePushL(typeInput);
+ ExtractRBufL(cacheVariant, typeCache);
+ ExtractRBufL(inputVariant, typeInput);
+ if (typeCache.Compare(typeInput)==0)
+ {
+ typesMatch = ETrue;
+ }
+ CleanupStack::PopAndDestroy( &typeInput );
+ CleanupStack::PopAndDestroy( &typeCache );
+ }
+ CleanupStack::PopAndDestroy(&inputVariant);
+ CleanupStack::PopAndDestroy(&cacheVariant);
+ return typesMatch;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CCPActionDataCache::ExtractRBufL(const TLiwVariant& aVariant, RBuf& aBuf)
+ {
+ TPtrC type( KNullDesC );
+ if( !aVariant.Get( type ) )
+ {
+ TPtrC8 type8( KNullDesC8 );
+ if( !aVariant.Get( type8 ) )
+ {
+ User::Leave( KErrBadName );
+ }
+ aBuf.Assign( EscapeUtils::ConvertToUnicodeFromUtf8L( type8 ) );
+ }
+ else
+ {
+ aBuf.CreateL( type );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
TBool CCPActionDataCache::MatchL(const CLiwMap* aLeft, const CLiwMap* aRight,
const TDesC8& aKey)
{
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpnotificationhandler.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpnotificationhandler.cpp Tue May 11 16:30:05 2010 +0300
@@ -26,6 +26,7 @@
#include "cpglobals.h"
#include "cpserverdef.h"
+static const int KMaxKeyLength = 256;
using namespace LIW;
// ======== MEMBER FUNCTIONS ========
@@ -33,7 +34,8 @@
//
// ---------------------------------------------------------------------------
//
-CCPNotificationHandler::CCPNotificationHandler()
+CCPNotificationHandler::CCPNotificationHandler( TLiwVariant& aDataMapCache ):
+ iDataMapCache(aDataMapCache)
{
}
@@ -57,11 +59,11 @@
//
// ---------------------------------------------------------------------------
//
-CCPNotificationHandler* CCPNotificationHandler::NewL(
- RPointerArray<CLiwDefaultList>& aNotifications )
+CCPNotificationHandler* CCPNotificationHandler::NewL(RPointerArray<
+ CLiwDefaultList>& aNotifications, TLiwVariant& aDataMapCache)
{
- CCPNotificationHandler* self = CCPNotificationHandler::NewLC(
- aNotifications );
+ CCPNotificationHandler* self = CCPNotificationHandler::NewLC(
+ aNotifications, aDataMapCache);
CleanupStack::Pop( self );
return self;
}
@@ -70,10 +72,11 @@
//
// ---------------------------------------------------------------------------
//
-CCPNotificationHandler* CCPNotificationHandler::NewLC(
- RPointerArray<CLiwDefaultList>& aNotifications )
+CCPNotificationHandler* CCPNotificationHandler::NewLC(RPointerArray<
+ CLiwDefaultList>& aNotifications, TLiwVariant& aDataMapCache)
{
- CCPNotificationHandler* self = new( ELeave ) CCPNotificationHandler;
+ CCPNotificationHandler* self = new (ELeave) CCPNotificationHandler(
+ aDataMapCache);
CleanupStack::PushL( self );
self->ConstructL( aNotifications );
return self;
@@ -99,6 +102,7 @@
transaction = iter.NextKey( );
}
iFilters.Close();
+ iExtendedFlags.Close();
Reset( );
for ( TInt i(0); i< iNotifications.Count( ); i++ )
{
@@ -131,6 +135,9 @@
CCPLiwMap* filterMap = CCPLiwMap::NewL( datastrm );
CleanupStack::PushL( filterMap );
iFilters.InsertL( transactionId, filterMap );
+ TUint options = static_cast<TUint> (aMessage.Int2()); // 2 == KOptionsPosition
+ iExtendedFlags.InsertL(transactionId, options
+ & KExtendedNotifications);
CleanupStack::Pop( filterMap );
CleanupStack::PopAndDestroy( &datastrm );
CleanupStack::PopAndDestroy( buffer );
@@ -160,6 +167,9 @@
CCPLiwMap* filterMap = CCPLiwMap::NewL( datastrm );
CleanupStack::PushL( filterMap );
iFilters.InsertL( transactionId, filterMap );
+ TUint options = static_cast<TUint> (aMessage.Int2()); // 2 == KOptionsPosition
+ iExtendedFlags.InsertL(transactionId, options
+ & KExtendedNotifications);
CleanupStack::Pop( filterMap );
CleanupStack::PopAndDestroy( &datastrm );
CleanupStack::PopAndDestroy( buffer );
@@ -177,6 +187,7 @@
filter->Reset();
filter->Close();
iFilters.Remove( transactionId );
+ iExtendedFlags.Remove( transactionId );
}
// -----------------------------------------------------------------------------
@@ -297,7 +308,6 @@
const CCPLiwMap*const* filter = iter.NextValue( );
while( filter )
{
-
CLiwDefaultList* listOfMatchingMaps = CLiwDefaultList::NewLC( );
TInt count = aListOfMaps->Count( );
//for every item in the input list
@@ -308,9 +318,33 @@
aListOfMaps->AtL( j, variant );
if ( variant.TypeId() == EVariantTypeMap )
{
- if ( IsProperForFilterL( *variant.AsMap(), **filter ) )
+ const CLiwMap* map = variant.AsMap();
+ if ( IsProperForFilterL( *map, **filter ) )
{
- listOfMatchingMaps->AppendL( variant );
+ if (iExtendedFlags.FindL(*iter.CurrentKey())
+ && (iDataMapCache.TypeId() == EVariantTypeDesC8))
+ {
+ //extended notifications - append data map
+ CLiwDefaultMap* extendedMap = CLiwDefaultMap::NewLC();
+ TInt count = map->Count();
+ for(TInt i=0; i<count;i++)
+ {
+ TLiwVariant temporary;
+ temporary.PushL();
+ TBuf8<KMaxKeyLength> key;
+ map->AtL(i,key);
+ map->FindL(key, temporary);
+ extendedMap->InsertL(key,temporary);
+ CleanupStack::PopAndDestroy(&temporary);
+ }
+ extendedMap->InsertL(KDataMap,iDataMapCache);
+ listOfMatchingMaps->AppendL( TLiwVariant(extendedMap) );
+ CleanupStack::PopAndDestroy(extendedMap);
+ }
+ else
+ {
+ listOfMatchingMaps->AppendL( variant );
+ }
}
}
CleanupStack::PopAndDestroy( &variant );
@@ -325,7 +359,6 @@
CleanupStack::PopAndDestroy( listOfMatchingMaps );
filter = iter.NextValue( );
}
-
if( iChangeInfoList->Count( ) )
{
TPckgBuf<TInt> sizeDes( iChangeInfoList->Size( ) );
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserver.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserver.cpp Tue May 11 16:30:05 2010 +0300
@@ -93,7 +93,7 @@
iBURListener = CCPServerBURListener::NewL(this);
iCountSession = 0;
iBURLock = iBURListener->CheckBUR();
- iDataManager = CCPDataManager::NewL(iBURLock);
+ iDataManager = CCPDataManager::NewL(iDataMapCache, iBURLock);
iActionHandlerThread = CCPActionHandlerThread::NewL();
if (!iBURLock)
{
@@ -123,6 +123,7 @@
CCPServer::~CCPServer()
{
CP_DEBUG( _L8("CCPServer::~CCPServer()" ) );
+ iDataMapCache.Reset();
for ( TInt i(0); i< iNotifications.Count( ); i++ )
{
iNotifications[i]->Close( );
@@ -171,7 +172,7 @@
}
else
{
- iDataManager->OpenDatabaseL( );
+ iDataManager->OpenDatabaseL(iDataMapCache);
iBURLock = EFalse;
}
}
@@ -194,6 +195,15 @@
return iNotifications;
}
+// -----------------------------------------------------------------------------
+// CCPServer::GetDataMapCache
+// -----------------------------------------------------------------------------
+//
+TLiwVariant& CCPServer::GetDataMapCache()
+ {
+ return iDataMapCache;
+ }
+
// -----------------------------------------------------------------------------
// CCPServer::NewSessionL
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp Tue May 11 16:30:05 2010 +0300
@@ -47,9 +47,9 @@
//
// ---------------------------------------------------------------------------
//
-CCPDataManager* CCPDataManager::NewL( TBool aBool )
+CCPDataManager* CCPDataManager::NewL(TLiwVariant& aDataMapCache, TBool aBool)
{
- CCPDataManager* self = CCPDataManager::NewLC( aBool );
+ CCPDataManager* self = CCPDataManager::NewLC( aDataMapCache, aBool );
CleanupStack::Pop( self );
return self;
}
@@ -58,11 +58,11 @@
//
// ---------------------------------------------------------------------------
//
-CCPDataManager* CCPDataManager::NewLC( TBool aBool )
+CCPDataManager* CCPDataManager::NewLC(TLiwVariant& aDataMapCache, TBool aBool)
{
- CCPDataManager* self = new( ELeave ) CCPDataManager;
+ CCPDataManager* self = new( ELeave ) CCPDataManager();
CleanupStack::PushL( self );
- self->ConstructL( aBool );
+ self->ConstructL( aDataMapCache, aBool );
return self;
}
@@ -70,7 +70,7 @@
// C++ constructor.
// ---------------------------------------------------------------------------
//
-CCPDataManager::CCPDataManager()
+CCPDataManager::CCPDataManager()
{
}
@@ -79,12 +79,12 @@
// Standard 2nd phase constructor.
// ---------------------------------------------------------------------------
//
-void CCPDataManager::ConstructL( TBool aBool )
+void CCPDataManager::ConstructL(TLiwVariant& aDataMapCache, TBool aBool)
{
CP_DEBUG( _L8("CCPDataManager::ConstructL()") );
if ( !aBool )
{
- iStorage = StorageFactory::NewDatabaseL( );
+ iStorage = StorageFactory::NewDatabaseL( aDataMapCache );
}
iActionDataCache = CCPActionDataCache::NewL();
}
@@ -183,9 +183,16 @@
else
{
TRAP( result, iStorage->GetListL( &aMap, *paramList ) );
- if ( aEnableCache && cacheable && result == KErrNone )
+ if ( aEnableCache && cacheable )
{
- iActionDataCache->AppendL(paramList);
+ if ( result == KErrNone )
+ {
+ iActionDataCache->AppendL(paramList);
+ }
+ else if ( result == KErrNotFound )
+ {
+ iActionDataCache->AppendEmptyL(&aMap);
+ }
}
}
@@ -202,11 +209,24 @@
//iteration through paramList items
while ( param && pos != KErrNotFound )
{
- BuildChangeInfoL( &aMap, actionTriggers, param,
- aNotificationList );
- FillActionParamListL( aOutParamList, param, actionTriggers );
- param = paramList->FindNext( pos, KListMap );
+ RBuf8 actionBinaries;
+ actionBinaries.CleanupClosePushL();
+ ExtractActionL( param, actionBinaries );
+ RDesReadStream str(actionBinaries);
+ CleanupClosePushL( str );
+ CLiwDefaultMap* actionMap = CLiwDefaultMap::NewLC( str );
+ BuildChangeInfoL( &aMap, actionTriggers, param, actionMap,
+ aNotificationList );
+ FillActionParamListL( aOutParamList, actionMap, actionTriggers );
+ param = paramList->FindNext( pos, KListMap );
+ CleanupStack::PopAndDestroy( actionMap );
+ CleanupStack::PopAndDestroy( &str );
+ CleanupStack::PopAndDestroy( &actionBinaries );
}
+ if (aNotificationList->Count() == 0)
+ {
+ User::Leave(KErrNotFound);
+ }
}
else
{
@@ -225,20 +245,11 @@
//
void CCPDataManager::FillActionParamListL(
CLiwGenericParamList& aOutParamList,
- const TLiwGenericParam* aParam,
+ const CLiwDefaultMap* aActionMap,
const CLiwDefaultList* aActionTriggers)
{
CP_DEBUG( _L8("CCPDataManager::FillActionParamListL()") );
__ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) );
-
- RBuf8 actionBinaries;
- actionBinaries.CleanupClosePushL();
- ExtractActionL( aParam, actionBinaries );
-
- RDesReadStream str(actionBinaries);
- CleanupClosePushL( str );
- CLiwDefaultMap* actionMap = CLiwDefaultMap::NewLC( str );
-
TLiwVariant trigger;
trigger.PushL();
TInt count = aActionTriggers->Count();
@@ -246,13 +257,9 @@
{
trigger.Reset();
aActionTriggers->AtL( i,trigger );
- ExtractTriggerL( aOutParamList, actionMap, trigger.AsData());
+ ExtractTriggerL( aOutParamList, aActionMap, trigger.AsData());
}
CleanupStack::PopAndDestroy(&trigger);
-
- CleanupStack::PopAndDestroy( actionMap );
- CleanupStack::PopAndDestroy( &str );
- CleanupStack::PopAndDestroy( &actionBinaries );
}
// ---------------------------------------------------------------------------
@@ -282,14 +289,9 @@
if ( aMap->FindL( aTrigger, variant ) )
{
targetMap->InsertL( KActionMap, variant );
+ TLiwGenericParam result( KListMap, TLiwVariant( targetMap ));
+ aOutParamList.AppendL( result );
}
- else
- {
- User::Leave( KErrNotFound );
- }
-
- TLiwGenericParam result( KListMap, TLiwVariant( targetMap ));
- aOutParamList.AppendL( result );
CleanupStack::PopAndDestroy( &variant );
CleanupStack::PopAndDestroy( targetMap );
}
@@ -374,12 +376,12 @@
//
// ---------------------------------------------------------------------------
//
-void CCPDataManager::OpenDatabaseL()
+void CCPDataManager::OpenDatabaseL(TLiwVariant& aDataMapCache)
{
CP_DEBUG( _L8("CCPDataManager::OpenDatabaseL()") );
if ( !iStorage )
{
- iStorage = StorageFactory::NewDatabaseL( );
+ iStorage = StorageFactory::NewDatabaseL( aDataMapCache );
// Restore storage observers
if ( iNotificationsArray.Count() > 0 )
@@ -490,6 +492,7 @@
void CCPDataManager::BuildChangeInfoL( const CCPLiwMap* aMap,
const CLiwDefaultList* aActionTriggers,
const TLiwGenericParam* aParam,
+ const CLiwDefaultMap* aActionMap,
CLiwDefaultList* aChangeInfoList )
{
TLiwVariant resultVar = aParam->Value();
@@ -498,32 +501,34 @@
{
for ( TInt i = 0; i<aActionTriggers->Count(); i++ )
{
- CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC();
-
- CopyVariantL(KId, resultVar.AsMap(), changeInfoMap );
- CopyVariantL(KPublisherId, resultVar.AsMap(), changeInfoMap );
- CopyVariantL(KContentType, resultVar.AsMap(), changeInfoMap );
- CopyVariantL(KContentId, resultVar.AsMap(), changeInfoMap );
- CopyVariantL(KFlag, resultVar.AsMap(), changeInfoMap );
- CopyVariantL(KType, aMap, changeInfoMap );
-
+ TLiwVariant dummyVariant;
+ dummyVariant.PushL();
TLiwVariant trigger;
trigger.PushL();
aActionTriggers->AtL(i,trigger);
- changeInfoMap->InsertL(KActionTrigger, trigger);
- CopyActionTrigger16L(trigger,changeInfoMap);
+ if (aActionMap->FindL( trigger.AsData(), dummyVariant ))
+ {
+ CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC();
+ CopyVariantL(KId, resultVar.AsMap(), changeInfoMap);
+ CopyVariantL(KPublisherId, resultVar.AsMap(), changeInfoMap);
+ CopyVariantL(KContentType, resultVar.AsMap(), changeInfoMap);
+ CopyVariantL(KContentId, resultVar.AsMap(), changeInfoMap);
+ CopyVariantL(KFlag, resultVar.AsMap(), changeInfoMap);
+ CopyVariantL(KType, aMap, changeInfoMap);
+ changeInfoMap->InsertL(KActionTrigger, trigger);
+ CopyActionTrigger16L(trigger, changeInfoMap);
+ changeInfoMap->InsertL(KOperation, TLiwVariant(
+ KOperationExecute));
+ aChangeInfoList->AppendL(TLiwVariant(changeInfoMap));
+ CleanupStack::PopAndDestroy(changeInfoMap);
+ }
CleanupStack::PopAndDestroy(&trigger);
-
- changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationExecute ) );
-
- aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) );
- CleanupStack::PopAndDestroy( changeInfoMap );
+ CleanupStack::PopAndDestroy(&dummyVariant);
}
}
CleanupStack::PopAndDestroy( &resultVar );
}
-
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserversession.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserversession.cpp Tue May 11 16:30:05 2010 +0300
@@ -42,9 +42,9 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CCPServerSession* CCPServerSession::NewL( TPointersForSession& aPasser )
+CCPServerSession* CCPServerSession::NewL(TPointersForSession& aPasser)
{
- CCPServerSession* self = CCPServerSession::NewLC( aPasser );
+ CCPServerSession* self = CCPServerSession::NewLC(aPasser);
CleanupStack::Pop( self ) ;
return self;
}
@@ -54,9 +54,9 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CCPServerSession* CCPServerSession::NewLC( TPointersForSession& aPasser )
+CCPServerSession* CCPServerSession::NewLC(TPointersForSession& aPasser)
{
- CCPServerSession* self = new ( ELeave ) CCPServerSession();
+ CCPServerSession* self = new (ELeave) CCPServerSession();
CleanupStack::PushL( self );
self->ConstructL( aPasser ) ;
return self;
@@ -129,12 +129,18 @@
else
{
TInt err(KErrNone);
- TBool panicedClient(EFalse);
- TRAP( err , DispatchMessageL( aMessage, panicedClient ) );
+ TBool completeRequest( ETrue );
+ //complete request by default
+ //not applicable when client panicked or
+ //in case of ECpServerExecuteMultipleActions
+ TRAP( err , DispatchMessageL( aMessage, completeRequest ) );
if ( (!(aMessage.Function( ) == ECpServerRegisterObserver )
- || err == KErrInUse) && !panicedClient )
+ || err == KErrInUse) && completeRequest )
{
- aMessage.Complete( err );
+ if( !aMessage.IsNull() )
+ {
+ aMessage.Complete( err );
+ }
}
}
}
@@ -144,7 +150,8 @@
// Handle client requests.
// -----------------------------------------------------------------------------
//
-void CCPServerSession::DispatchMessageL( const RMessage2& aMessage, TBool& aPanicedClient )
+void CCPServerSession::DispatchMessageL( const RMessage2& aMessage,
+ TBool& aCompleteRequest )
{
CP_DEBUG( _L8("CCPServerSession::DispatchMessageL()" ) );
switch ( aMessage.Function( ) )
@@ -184,10 +191,11 @@
break;
case ECpServerExecuteMultipleActions:
ExecuteMultipleActionsL( aMessage );
+ aCompleteRequest = EFalse;
break;
default:
iServer->PanicClient( aMessage, ECPServerBadRequest );
- aPanicedClient = ETrue;
+ aCompleteRequest = EFalse;
break;
}
}
@@ -325,13 +333,14 @@
CLiwGenericParamList* genericList = UnpackForMultiExecuteLC(aMessage);
TUint options = static_cast<TUint> (aMessage.Int2()); // 2 == KOptionsPosition
-
+ //complete message in order to unblock HS
+ aMessage.Complete( KErrNone );
+
const TLiwGenericParam* param = NULL;
TInt pos(0);
param = genericList->FindFirst(pos, KFilters);
const CLiwList* maps = param->Value().AsList();
CLiwDefaultList* cpMaps = CheckValidityLC(maps);
-
//execute actions
for (TInt i = 0; i < cpMaps->Count(); i++)
{
@@ -387,7 +396,7 @@
if ( !iNotificationHandler )
{
iNotificationHandler = CCPNotificationHandler::NewL(
- iServer->GetNotifications());
+ iServer->GetNotifications(), iServer->GetDataMapCache());
iDataManager->AddObserverL( iNotificationHandler );
}
iNotificationHandler->SaveMessageL( aMessage );
--- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/bwins/cpstorageu.def Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/bwins/cpstorageu.def Tue May 11 16:30:05 2010 +0300
@@ -1,3 +1,3 @@
EXPORTS
- ?NewDatabaseL@StorageFactory@@SAPAVCCpStorage@@XZ @ 1 NONAME ; class CCpStorage * StorageFactory::NewDatabaseL(void)
+ ?NewDatabaseL@StorageFactory@@SAPAVCCpStorage@@AAVTLiwVariant@@@Z @ 1 NONAME ; class CCpStorage * StorageFactory::NewDatabaseL(class TLiwVariant &)
--- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/eabi/cpstorageu.def Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/eabi/cpstorageu.def Tue May 11 16:30:05 2010 +0300
@@ -1,3 +1,3 @@
EXPORTS
- _ZN14StorageFactory12NewDatabaseLEv @ 1 NONAME
+ _ZN14StorageFactory12NewDatabaseLER11TLiwVariant @ 1 NONAME
--- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstorageengine.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstorageengine.h Tue May 11 16:30:05 2010 +0300
@@ -29,7 +29,7 @@
#endif
class MCPChangeNotifier;
class CRepository;
-
+class TLiwVariant;
// CLASS DECLARATION
/**
* SQLite based databse for Content Publisher
@@ -44,12 +44,12 @@
/**
* Two-phased constructor.
*/
- static CCpStorageEngine* NewL();
+ static CCpStorageEngine* NewL(TLiwVariant& aDataMapCache);
/**
* Two-phased constructor.
*/
- static CCpStorageEngine* NewLC();
+ static CCpStorageEngine* NewLC(TLiwVariant& aDataMapCache);
/**
* Destructor.
@@ -95,7 +95,7 @@
/**
* C++ default constructor.
*/
- CCpStorageEngine();
+ CCpStorageEngine(TLiwVariant& aDataMapCache);
/**
* Creates database tables.
@@ -136,7 +136,11 @@
* Own.
*/
CRepository* iRepository;
-
+
+ /**
+ * Not own.
+ */
+ TLiwVariant& iDataMapCache;
#ifdef CONTENT_PUBLISHER_DEBUG
CCPDebug* iDebug;
#endif
--- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstoragefactory.h Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/inc/cpstoragefactory.h Tue May 11 16:30:05 2010 +0300
@@ -23,6 +23,7 @@
// FORWARD DECLARATIONS
class CCpStorage;
+class TLiwVariant;
// CLASS DECLARATION
/**
@@ -34,7 +35,7 @@
class StorageFactory
{
public:
- IMPORT_C static CCpStorage* NewDatabaseL();
+ IMPORT_C static CCpStorage* NewDatabaseL(TLiwVariant& aDataMapCache);
};
#endif //C_CPSTORAGE_FACTORY_H
--- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstorageengine.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstorageengine.cpp Tue May 11 16:30:05 2010 +0300
@@ -29,7 +29,8 @@
//
// ---------------------------------------------------------------------------
//
-CCpStorageEngine::CCpStorageEngine()
+CCpStorageEngine::CCpStorageEngine(TLiwVariant& aDataMapCache) :
+ iDataMapCache(aDataMapCache)
{
}
@@ -72,9 +73,9 @@
//
// ---------------------------------------------------------------------------
//
-CCpStorageEngine* CCpStorageEngine::NewL()
+CCpStorageEngine* CCpStorageEngine::NewL(TLiwVariant& aDataMapCache)
{
- CCpStorageEngine* self = CCpStorageEngine::NewLC( );
+ CCpStorageEngine* self = CCpStorageEngine::NewLC(aDataMapCache);
CleanupStack::Pop( self );
return self;
}
@@ -84,9 +85,9 @@
//
// ---------------------------------------------------------------------------
//
-CCpStorageEngine* CCpStorageEngine::NewLC()
+CCpStorageEngine* CCpStorageEngine::NewLC(TLiwVariant& aDataMapCache)
{
- CCpStorageEngine* self = new (ELeave) CCpStorageEngine();
+ CCpStorageEngine* self = new (ELeave) CCpStorageEngine(aDataMapCache);
CleanupStack::PushL( self );
self->ConstructL( );
return self;
@@ -136,7 +137,10 @@
{
CP_DEBUG( _L8("CCpStorageEngine::GetListL()") );
const CCPLiwMap* map = static_cast<const CCPLiwMap*>(aMap);
+
RArray<TInt32> itemsToDelete;
+ CleanupClosePushL( itemsToDelete );
+
TUint numberOfItems = map->GetListL( iSqlDb, &aList, itemsToDelete );
//delete outdated items
CContentMap* removeItemMap = CContentMap::NewLC( );
@@ -148,7 +152,7 @@
removeItemMap->Remove( KId );
}
CleanupStack::PopAndDestroy( removeItemMap );
- itemsToDelete.Reset( );
+ CleanupStack::PopAndDestroy( &itemsToDelete );
if ( numberOfItems == 0 )
{
@@ -170,6 +174,8 @@
{
CLiwDefaultList* listOfMaps = CLiwDefaultList::NewLC( );
id = map->AddL( iSqlDb, listOfMaps );
+ iDataMapCache.Reset();
+ map->FindL(KDataMap, iDataMapCache);
iCallback->HandleChangeL( listOfMaps );
CleanupStack::PopAndDestroy( listOfMaps ) ;
}
--- a/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstoragefactory.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingserver/cpsqlitestorage/src/cpstoragefactory.cpp Tue May 11 16:30:05 2010 +0300
@@ -19,7 +19,7 @@
#include "cpstoragefactory.h"
#include "cpstorageengine.h"
-EXPORT_C CCpStorage* StorageFactory::NewDatabaseL()
+EXPORT_C CCpStorage* StorageFactory::NewDatabaseL(TLiwVariant& aDataMapCache)
{
- return CCpStorageEngine::NewL();
+ return CCpStorageEngine::NewL(aDataMapCache);
}
--- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/ccontentmap.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/ccontentmap.cpp Tue May 11 16:30:05 2010 +0300
@@ -170,6 +170,7 @@
content_id ) );
CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC( );
targetMap->InsertL( KId, TLiwVariant( id ) );
+ targetMap->InsertL( KType, TLiwVariant( KCpData ) );
targetMap->InsertL( KPublisherId, TLiwVariant( publisher ) );
targetMap->InsertL( KContentType, TLiwVariant(content_type ) );
targetMap->InsertL( KContentId, TLiwVariant( content_id ) );
--- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpublisherregistrymap.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpublisherregistrymap.cpp Tue May 11 16:30:05 2010 +0300
@@ -180,6 +180,7 @@
if (!(filter & EFlag) || ( (flag_db & flag_map)==flag_map))
{
CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC();
+ targetMap->InsertL( KType, TLiwVariant( KPublisher ) );
targetMap->InsertL( KId , TLiwVariant( id ) );
targetMap->InsertL( KPublisherId , TLiwVariant( publisher ) );
targetMap->InsertL( KContentType , TLiwVariant( content_type ) );
--- a/homescreenpluginsrv/hspsmanager/group/hspsthemeserver.mmp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/group/hspsthemeserver.mmp Tue May 11 16:30:05 2010 +0300
@@ -84,6 +84,7 @@
LIBRARY ecom.lib // definition engine
LIBRARY MemMan.lib
LIBRARY ws32.lib // RWsSession
+LIBRARY SysLangUtil.lib
#ifdef _hsps_DEBUG_
LIBRARY flogger.lib
--- a/homescreenpluginsrv/hspsmanager/inc/hspsinstallationhandler.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsinstallationhandler.h Tue May 11 16:30:05 2010 +0300
@@ -650,7 +650,22 @@
HBufC8& aValue8,
const TDesC8& aTag,
HBufC*& aResultString );
-
+
+
+ /**
+ * Find resource files
+ * @since S60 5.0
+ * @param aPath Path to files
+ * @param aRecursive Is recursive search
+ * @param aDriveArray Drives to search
+ * @param aDeviceLanguages Required languages
+ */
+
+ void ChspsInstallationHandler::FindResourceFilesL( const TDesC& aPath,
+ const TBool aRecursive,
+ RArray<TInt>& aDriveArray,
+ CArrayFixFlat<TInt>* aDeviceLanguages );
+
public:
ChspsResult* iResult;
--- a/homescreenpluginsrv/hspsmanager/inc/hspsrominstaller.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsrominstaller.h Tue May 11 16:30:05 2010 +0300
@@ -163,10 +163,10 @@
* @since S60 5.0
*/
void FindInstallationFilesL(
- RPointerArray<HBufC>& aFolders );
+ RPointerArray<HBufC>& aFileArray );
void DoFindInstallationFilesL(
- RPointerArray<HBufC>& aFolders,
+ RPointerArray<HBufC>& aFileArray,
const TDesC& aPath );
/**
--- a/homescreenpluginsrv/hspsmanager/inc/hspsserverutil.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsserverutil.h Tue May 11 16:30:05 2010 +0300
@@ -570,16 +570,26 @@
* @param aFs is a reference to open file server session handle
* @param aDriveArray An array of drives in search order
* @param aPath Relative path to be found
- * @param aFolders Search results or empty
- * @param aRecursive True if files should be found from any sudirectories
+ * @param aFileArray Search results or empty
+ * @param aDeviceLanguages An array of languages the HW supports
+ * @param aRecursive True if files should be found from any sudirectories
*/
- static void FindFilesRecursivelyL(
+ static void FindResourcesL(
RFs& aFs,
const RArray<TInt>& aDriveArray,
const TDesC& aPath,
- RPointerArray<HBufC>& aFolders,
+ RPointerArray<HBufC>& aFileArray,
+ CArrayFixFlat<TInt>* aDeviceLanguages,
TBool aRecursive = EFalse );
+ /**
+ * Returns an array of languages which can be used in the UI.
+ * @since S60 5.2
+ * @param aLanguages Array of language ids
+ */
+ static void GetInstalledLanguagesL(
+ CArrayFixFlat<TInt>*& aLanguages );
+
private:
/**
* Internal method. Do not call directly!
--- a/homescreenpluginsrv/hspsmanager/inc/hspsthemeserver.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsthemeserver.h Tue May 11 16:30:05 2010 +0300
@@ -669,7 +669,14 @@
*/
void ShutdownInitiating();
#endif // _hsps_SERVER_SHUTDOWN_ENABLED_
-
+
+ /**
+ * Foreces checking of related file resouces within each server session.
+ * Should be called when the application configuration has been modified.
+ * @since S60 5.2
+ * @param aAppUid UID of the application configuration
+ */
+ void SetResourceFileCopyRequired( const TInt aAppUid );
public: // from MhspsDefinitioRepositoryObserver
--- a/homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp Tue May 11 16:30:05 2010 +0300
@@ -62,7 +62,32 @@
const TInt KMaxMediaTypeLength = 100;
-// ============================ MEMBER FUNCTIONS ===============================
+// ========================= LOCAL FUNCTIONS ==================================
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroy()
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroy( TAny* aObj )
+ {
+ if( aObj )
+ {
+ static_cast<T*>( aObj )->ResetAndDestroy();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroyPushL
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroyPushL(T& aArray)
+ {
+ CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
+ }
+
+// ========================= MEMBER FUNCTIONS ==================================
// -----------------------------------------------------------------------------
// Callback function for removing repository lock if error occurs while repository is locked
@@ -1401,7 +1426,7 @@
TUid::Uid( iThemeUid ),
pluginIds );
isUsed = ( pluginIds.Count() > 0 );
- CleanupStack::PopAndDestroy();
+ CleanupStack::PopAndDestroy(); // pluginIds
CleanupStack::PopAndDestroy( odt );
@@ -2190,7 +2215,27 @@
// See enumarations from e32lang.h
if( !error && languageIndex >= ELangTest )
- {
+ {
+
+ // Process only supported languages
+ CArrayFixFlat<TInt>* languageCodes = NULL;
+ hspsServerUtil::GetInstalledLanguagesL( languageCodes );
+ CleanupStack::PushL( languageCodes );
+ TBool isSupported = EFalse;
+ for( TInt i=0; i<languageCodes->Count(); i++ )
+ {
+ if( languageCodes->At( i ) == languageIndex )
+ {
+ isSupported = ETrue;
+ break;
+ }
+ }
+ CleanupStack::PopAndDestroy( languageCodes );
+ if( !isSupported )
+ {
+ continue;
+ }
+
// If we found the first language specification
if ( !iDefaultSpecificationSet )
{
@@ -2199,7 +2244,7 @@
iDefaultSpecification = (TLanguage)languageIndex;
iDefaultSpecificationSet = ETrue;
}
-
+
// Setup a path to the subdirectory
localePath.Copy( aPath );
localePath.Append( entry.iName );
@@ -2215,19 +2260,6 @@
}
CleanupStack::PopAndDestroy( fileList );
fileList = NULL;
- }
-
- // If no DTD files were found
- if ( iDefaultSpecification != ELangTest || !iDefaultSpecificationSet )
- {
-#ifdef HSPS_LOG_ACTIVE
- if( iLogBus )
- {
- iLogBus->LogText( _L8( "ChspsInstallationHandler::AddHspsLocalesV2L(): - mandatory test locale is missing!" ) );
- }
-#endif
- // Halt installation, test language was not found
- User::Leave( KErrNotFound );
}
}
@@ -2280,145 +2312,27 @@
//
void ChspsInstallationHandler::AddInterfaceResourcesV2L(
const TDesC& aPath )
- {
+ {
+ // Retrieve supported localizations.
+
+ CArrayFixFlat<TInt>* systemEpocLanguageCodes = NULL;
+ hspsServerUtil::GetInstalledLanguagesL(
+ systemEpocLanguageCodes );
+ CleanupStack::PushL( systemEpocLanguageCodes );
+
+ // Find all entries under the Xuikon folders that
+ // match our eclipsing rules and localisations supported by phone.
+
RArray<TInt> driveArray;
- CleanupClosePushL( driveArray );
-
- // Set search order for eclipsing, only the ROM and UDA drives should be scanned
+ CleanupClosePushL( driveArray );
+ driveArray.Append( EDriveE );
driveArray.Append( EDriveC );
- driveArray.Append( EDriveZ );
-
- // Find all unique locale entries under the Xuikon folders in either drive
- RPointerArray<HBufC> locales;
- CleanupClosePushL( locales );
- hspsServerUtil::FindFilesRecursivelyL(
- iFsSession,
- driveArray,
- aPath,
- locales,
- EFalse );
-
- // Find all file entries under the Xuikon folders in either drive
- RPointerArray<HBufC> folders;
- CleanupClosePushL( folders );
- hspsServerUtil::FindFilesRecursivelyL(
- iFsSession,
- driveArray,
- aPath,
- folders,
- ETrue );
-
- // Loop language folders
- for(TInt localeIndex=0; localeIndex < locales.Count(); localeIndex++ )
- {
- TParsePtrC localeParser( locales[ localeIndex ]->Des() );
- TPath localePath = localeParser.Path();
-
- TPath tempPath = locales[ localeIndex ]->Des();
- if( tempPath.Right( KPathDelim().Length() ).Compare( KPathDelim() ) == 0 )
- {
- tempPath.Delete( tempPath.Length() - KPathDelim().Length(), KPathDelim().Length() );
- }
- TParsePtrC tempParser( tempPath );
- TFileName localeName = tempParser.Name();
- TInt languageIndex = 0;
- TLex lex( localeName );
- if( lex.Val( languageIndex ) != KErrNone )
- {
- continue;
- }
- if( languageIndex < ELangTest )
- {
- User::Leave( KErrIllegalInstallation );
- }
-
- // If we found the first language specification
- if ( !iDefaultSpecificationSet )
- {
- // Assume this is the default language shown when device language is not supported
- iDefaultSpecification = (TLanguage)languageIndex;
- iDefaultSpecificationSet = ETrue;
- }
-
- // Loop file resources which should be found from either drive
- ChspsResource* resource = NULL;
- for( TInt resourceIndex=0; resourceIndex < iTempLocalizedResourceList->Count(); resourceIndex++ )
- {
- resource = iTempLocalizedResourceList->At( resourceIndex );
- TFileName file;
-
- for( TInt folderIndex=0; folderIndex < folders.Count(); folderIndex++ )
- {
- TParsePtrC folderParser( folders[ folderIndex ]->Des() );
- TPath folderPath = folderParser.Path();
- TFileName name = folderParser.Name();
-
- if( localePath.CompareF( folderPath ) == 0 )
- {
- TFileName fixedName = hspsServerUtil::GetFixedOdtName( folderParser.NameAndExt() );
- if( fixedName.CompareF( resource->FileName() ) == 0 )
- {
- file = folders[ folderIndex ]->Des();
- break;
- }
- }
- }
-
- if( file.Length() )
- {
- TBool duplicate = EFalse;
- for( TInt i=0; i< iResourceList->Count(); i++ )
- {
- ChspsResource* r = iResourceList->At(i);
- if( r->Language() == languageIndex
- && r->FileName().CompareF( file ) == 0 )
- {
- duplicate = ETrue;
- break;
- }
- }
- if( !duplicate )
- {
-
- TPtrC8 mimeType;
- TPtrC8 tag;
- HBufC8* tagBuf8 = NULL;
- if ( resource->Tags().Length() )
- {
- tagBuf8 = HBufC8::NewLC( resource->Tags().Length() );
- tagBuf8->Des().Copy( resource->Tags() );
- tag.Set( tagBuf8->Des() );
- }
-
- // Add localized files into the resource array
- AddResourceL(
- *iResourceList,
- file,
- (TLanguage)languageIndex,
- EResourceOther,
- mimeType,
- tag );
-
- if ( tagBuf8 )
- {
- CleanupStack::PopAndDestroy( tagBuf8 );
- }
-
- }
- }
- }
-
- }
-
- folders.ResetAndDestroy();
- locales.ResetAndDestroy();
- CleanupStack::PopAndDestroy( 3, &driveArray ); // driveArray, locales, folders,
-
- if ( iDefaultSpecification != ELangTest || !iDefaultSpecificationSet )
- {
- // Halt installation, test language was not found
- User::Leave( KErrNotFound );
- }
+ driveArray.Append( EDriveZ );
+
+ FindResourceFilesL( aPath, ETrue, driveArray, systemEpocLanguageCodes );
+
+ CleanupStack::PopAndDestroy(); // driveArray
+ CleanupStack::PopAndDestroy( systemEpocLanguageCodes );
}
// -----------------------------------------------------------------------------
@@ -2450,7 +2364,27 @@
// See enumarations from e32lang.h
if( !error && languageIndex >= ELangTest )
- {
+ {
+
+ // Process only supported languages
+ CArrayFixFlat<TInt>* languageCodes = NULL;
+ hspsServerUtil::GetInstalledLanguagesL( languageCodes );
+ CleanupStack::PushL( languageCodes );
+ TBool isSupported = EFalse;
+ for( TInt i=0; i<languageCodes->Count(); i++ )
+ {
+ if( languageCodes->At( i ) == languageIndex )
+ {
+ isSupported = ETrue;
+ break;
+ }
+ }
+ CleanupStack::PopAndDestroy( languageCodes );
+ if( !isSupported )
+ {
+ continue;
+ }
+
// If we found the first language specification
if ( !iDefaultSpecificationSet )
{
@@ -2458,8 +2392,8 @@
// there is no locale for the active UI language
iDefaultSpecification = (TLanguage)languageIndex;
iDefaultSpecificationSet = ETrue;
- }
-
+ }
+
// Setup a path to the subdirectory
localePath.Copy( aPath );
localePath.Append( entry.iName );
@@ -2475,13 +2409,6 @@
}
CleanupStack::PopAndDestroy( fileList );
fileList = NULL;
- }
-
- // If no DTD files were found
- if ( iDefaultSpecification != ELangTest || !iDefaultSpecificationSet )
- {
- // Halt installation, test language was not found
- User::Leave( KErrNotFound );
}
}
@@ -2531,45 +2458,14 @@
CleanupStack::PopAndDestroy( dtdPath );
}
- // Store locale specific resources if the "localization" element has been declared in XML definition
- ChspsResource* resource = NULL;
- for( TInt resourceIndex=0; resourceIndex < iTempLocalizedResourceList->Count(); resourceIndex++ )
- {
- resource = iTempLocalizedResourceList->At( resourceIndex );
-
- HBufC* resourcePath = HBufC::NewLC( aPath.Length() + resource->FileName().Length() );
- resourcePath->Des().Copy( aPath );
- resourcePath->Des().Append( resource->FileName() );
-
- TDataType dataType( resource->MimeType() );
+ // Find localized files from the provided directory
+ RArray<TInt> driveArray;
+ CleanupClosePushL( driveArray );
+ driveArray.Append( EDriveC );
- TPtrC8 tagsPtr;
- HBufC8* tagBuf8 = NULL;
- if ( resource->Tags().Length() )
- {
- tagBuf8 = HBufC8::NewLC( resource->Tags().Length() );
- tagBuf8->Des().Copy( resource->Tags() );
- tagsPtr.Set( tagBuf8->Des() );
- }
-
- // Add localized files into the resource array
- AddResourceL(
- *iResourceList,
- *resourcePath,
- aLanguage,
- EResourceOther,
- dataType.Des8(),
- tagsPtr
- );
-
- if ( tagBuf8 )
- {
- CleanupStack::PopAndDestroy( tagBuf8 );
- }
-
- CleanupStack::PopAndDestroy( resourcePath );
- }
+ FindResourceFilesL( aPath, EFalse, driveArray, NULL );
+ CleanupStack::PopAndDestroy(); // driveArray
}
// -----------------------------------------------------------------------------
@@ -2677,4 +2573,125 @@
CleanupStack::Pop( aResultString );
}
+// -----------------------------------------------------------------------------
+// ChspsInstallationHandler::FindResourceFilesL
+// -----------------------------------------------------------------------------
+//
+void ChspsInstallationHandler::FindResourceFilesL( const TDesC& aPath,
+ const TBool aRecursive,
+ RArray<TInt>& aDriveArray,
+ CArrayFixFlat<TInt>* aDeviceLanguages )
+ {
+ RPointerArray<HBufC> filesArray;
+ CleanupResetAndDestroyPushL( filesArray );
+
+ hspsServerUtil::FindResourcesL(
+ iFsSession,
+ aDriveArray,
+ aPath,
+ filesArray,
+ aDeviceLanguages,
+ aRecursive );
+
+ // Filter search results and select only relevant files
+ TInt error = KErrNone;
+ for( TInt i = 0; i < filesArray.Count(); i++ )
+ {
+ const TFileName fileName = filesArray[ i ]->Des();
+
+ // Check that file is listed in manifest resource.
+
+ error = KErrNotFound;
+
+ TParsePtrC fileNameParser( fileName );
+ const TFileName fixedName =
+ hspsServerUtil::GetFixedOdtName( fileNameParser.NameAndExt() );
+
+ ChspsResource* temporaryResource = NULL;
+
+ for( TInt j = 0;
+ j < iTempLocalizedResourceList->Count();
+ j++ )
+ {
+ temporaryResource = iTempLocalizedResourceList->At( j );
+ if( fixedName.CompareF( temporaryResource->FileName() ) == 0 )
+ {
+ error = KErrNone;
+ break;
+ }
+ }
+
+ // Extract localisation code from path.
+
+ TInt localizationCode = 0;
+
+ if( error == KErrNone )
+ {
+ TPath path = fileNameParser.Path();
+ if( path.Right( KPathDelim().Length() ).Compare( KPathDelim() ) == 0 )
+ {
+ path.Delete( path.Length() - KPathDelim().Length(), KPathDelim().Length() );
+ }
+
+ TParsePtrC localizationParser( path );
+ TLex lex( localizationParser.Name() );
+ error = lex.Val( localizationCode );
+
+ if( error == KErrNone && localizationCode < ELangTest )
+ {
+ error = KErrCorrupt;
+ }
+ }
+
+ // Check for duplicates.
+
+ if( error == KErrNone )
+ {
+ for( TInt k = 0; k < iResourceList->Count(); k++ )
+ {
+ ChspsResource* resource = iResourceList->At( k );
+
+ if( resource->Language() == localizationCode &&
+ resource->FileName().CompareF( fileName ) == 0 )
+ {
+ error = KErrAlreadyExists;
+ break;
+ }
+ }
+ }
+
+ // Add to actual resource list.
+ if( error == KErrNone )
+ {
+ TPtrC8 tag;
+ HBufC8* tagBuf8 = NULL;
+
+ if ( temporaryResource->Tags().Length() )
+ {
+ tagBuf8 = HBufC8::NewLC( temporaryResource->Tags().Length() );
+ tagBuf8->Des().Copy( temporaryResource->Tags() );
+ tag.Set( tagBuf8->Des() );
+ }
+
+ TDataType dataType( temporaryResource->MimeType() );
+
+ // Add localized files into the resource array
+ AddResourceL(
+ *iResourceList,
+ fileName,
+ (TLanguage)localizationCode,
+ EResourceOther,
+ dataType.Des8(),
+ tag );
+
+ if ( tagBuf8 )
+ {
+ CleanupStack::PopAndDestroy( tagBuf8 );
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // filesArray
+ }
+
// end of file
--- a/homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp Tue May 11 16:30:05 2010 +0300
@@ -568,28 +568,15 @@
}
#endif
}
+ else
+ {
+ iThemeServer.SetResourceFileCopyRequired( appODT->RootUid() );
+ }
}
-
+
// Unlock after the changes have been done
iDefinitionRepository.Unlock();
- CleanupStack::Pop(&iDefinitionRepository);
-
- if ( !err )
- {
- // Inform clients that the ODT has been modified
- ThspsRepositoryInfo info(
- ThspsRepositoryEvent(EhspsODTModified),
- appODT->RootUid(),
- appODT->ThemeUid(),
- aMessage.SecureId().iId,
- appODT->ProviderUid(),
- 0,
- 0,
- pluginUid,usedPluginId,ETrue,
- pluginODT->ThemeFullName(),
- (TLanguage)(appODT->OdtLanguage() ) );
- iDefinitionRepository.RegisterNotification( info );
- }
+ CleanupStack::Pop(&iDefinitionRepository);
}
}
@@ -1200,23 +1187,6 @@
// Unlock after the changes have been done
iDefinitionRepository.Unlock();
CleanupStack::Pop(&iDefinitionRepository);
-
- if ( !err )
- {
- // Inform clients that the ODT has been modified
- ThspsRepositoryInfo info(
- ThspsRepositoryEvent(EhspsODTRemoved),
- appODT->RootUid(),
- appODT->ThemeUid(),
- aMessage.SecureId().iId,
- appODT->ProviderUid(),
- 0,0,
- pluginUid,pluginId,ETrue,
- pluginName,
- (TLanguage)(appODT->OdtLanguage())
- );
- iDefinitionRepository.RegisterNotification( info );
- }
}
}
@@ -1600,6 +1570,7 @@
#endif
// Stores the new application configuration into the repository
err = iDefinitionRepository.SetOdtL( *appODT );
+
// Unlock after the changes have been done
iDefinitionRepository.Unlock();
if ( err )
@@ -1610,26 +1581,11 @@
iLogBus->LogText( _L( "ChspsMaintenanceHandler::ServiceReplacePluginL(): - Updating failed" ) );
}
#endif
- }
+ }
else
{
- // Inform clients that the ODT has been modified
- ThspsRepositoryInfo info(
- ThspsRepositoryEvent(EhspsPluginReplaced),
- appODT->RootUid(),
- appODT->ThemeUid(),
- aMessage.SecureId().iId,
- 0,
- 0,
- 0,
- confUid,
- pluginId,
- ETrue,
- KNullDesC(),
- (TLanguage)(appODT->OdtLanguage())
- );
- iDefinitionRepository.RegisterNotification( info );
- }
+ iThemeServer.SetResourceFileCopyRequired( appODT->RootUid() );
+ }
}
else
{
@@ -3641,15 +3597,13 @@
odt->SetFlags( header->Flags() );
odt->SetMultiInstance( header->MultiInstance() );
User::LeaveIfError( iDefinitionRepository.GetOdtL( *odt ) );
-
RArray<TInt> pluginIds;
-
+ CleanupClosePushL( pluginIds );
hspsServerUtil::GetPluginIdsByUidL( *odt,
TUid::Uid( aOdt.ThemeUid() ),
pluginIds );
-
if ( pluginIds.Count() > 0 )
{
@@ -3660,8 +3614,6 @@
pluginIds );
User::LeaveIfError( iDefinitionRepository.SetOdtL( *odt ) );
-
-
TBool status = EFalse;
for(TInt i = 0; i < pluginIds.Count(); i++ )
@@ -3686,13 +3638,9 @@
aNotificationParams.Append(info);
}
}
-
-
-
- pluginIds.Close();
-
- CleanupStack::PopAndDestroy( odt );
-
+
+ CleanupStack::PopAndDestroy(); // pluginIds.
+ CleanupStack::PopAndDestroy( odt );
}
}
--- a/homescreenpluginsrv/hspsmanager/src/hspsrominstaller.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/src/hspsrominstaller.cpp Tue May 11 16:30:05 2010 +0300
@@ -27,14 +27,39 @@
#include "hspsclientrequesthandler.h"
#include "hspsserverutil.h"
+_LIT(KPrivateInstallC, "C:\\private\\200159c0\\install\\");
+_LIT(KPrivateInstallE, "E:\\private\\200159c0\\install\\");
_LIT(KPrivateInstallZ, "Z:\\private\\200159c0\\install\\");
-_LIT(KPrivateInstallC, "C:\\private\\200159c0\\install\\");
-_LIT(KMaskAllFiles, "*");
+
_LIT(KBackslash, "\\");
_LIT(KHsps, "hsps");
_LIT(KTestLanguage, "00");
_LIT(KManifest, "manifest.dat");
+// ========================= LOCAL FUNCTIONS ==================================
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroy()
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroy( TAny* aObj )
+ {
+ if( aObj )
+ {
+ static_cast<T*>( aObj )->ResetAndDestroy();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroyPushL
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroyPushL(T& aArray)
+ {
+ CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
+ }
// ========================= MEMBER FUNCTIONS ==================================
@@ -110,16 +135,16 @@
//
void ChspsRomInstaller::InstallL()
{
- RPointerArray<HBufC> pluginFolders;
- CleanupClosePushL( pluginFolders );
+ RPointerArray<HBufC> fileArray;
+ CleanupResetAndDestroyPushL( fileArray );
// Find UDA and ROM widgets to be installed
- FindInstallationFilesL( pluginFolders );
+ FindInstallationFilesL( fileArray );
// Install the manifest files
- for( TInt index=0; index < pluginFolders.Count(); index++ )
+ for( TInt index=0; index < fileArray.Count(); index++ )
{
- TPtrC namePtr( pluginFolders[index]->Des() );
+ TPtrC namePtr( fileArray[index]->Des() );
// Synchronous method
ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed;
@@ -130,14 +155,13 @@
}
}
- if ( pluginFolders.Count() == 0 )
+ if ( fileArray.Count() == 0 )
{
// Mandatory plugins were missing
User::Leave( KErrCorrupt );
}
-
- pluginFolders.ResetAndDestroy();
- CleanupStack::PopAndDestroy( 1, &pluginFolders );
+
+ CleanupStack::PopAndDestroy(); // fileArray
}
@@ -146,12 +170,13 @@
// -----------------------------------------------------------------------------
//
void ChspsRomInstaller::FindInstallationFilesL(
- RPointerArray<HBufC>& aFolders )
+ RPointerArray<HBufC>& aFileArray )
{
- __ASSERT_DEBUG( aFolders.Count() == 0, User::Leave( KErrArgument ) );
-
- DoFindInstallationFilesL( aFolders, KPrivateInstallC );
- DoFindInstallationFilesL( aFolders, KPrivateInstallZ );
+ __ASSERT_DEBUG( aFileArray.Count() == 0, User::Leave( KErrArgument ) );
+
+ DoFindInstallationFilesL( aFileArray, KPrivateInstallE );
+ DoFindInstallationFilesL( aFileArray, KPrivateInstallC );
+ DoFindInstallationFilesL( aFileArray, KPrivateInstallZ );
}
// -----------------------------------------------------------------------------
@@ -159,35 +184,24 @@
// -----------------------------------------------------------------------------
//
void ChspsRomInstaller::DoFindInstallationFilesL(
- RPointerArray<HBufC>& aFolders,
+ RPointerArray<HBufC>& aFileArray,
const TDesC& aPath )
{
TFindFile fileFinder( iFsSession );
fileFinder.SetFindMask(
KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted );
- CDir* dirList( NULL );
- fileFinder.FindWildByDir( KMaskAllFiles, aPath, dirList );
+ CDir* dirList( NULL );
+ fileFinder.FindWildByPath( aPath, NULL, dirList );
if ( dirList )
{
CleanupStack::PushL( dirList );
- const TInt count = dirList->Count();
- const TInt KMaxEntryLength = KMaxFileName - 50;
+ const TInt count = dirList->Count();
for( TInt i = 0; i < count; i++ )
{
const TEntry& dirEntry = (*dirList)[i];
if ( dirEntry.IsDir() )
- {
- // Populate path for the manifest file
- const TEntry& folderEntry = (*dirList)[i];
-
- // Check for length of the directory name
- if( dirEntry.iName.Length() > KMaxEntryLength )
- {
- // Skip plugins which have too long name
- continue;
- }
-
+ {
TFileName manifest( aPath );
manifest.Append( dirEntry.iName );
manifest.Append( KBackslash );
@@ -195,19 +209,14 @@
manifest.Append( KBackslash );
manifest.Append( KTestLanguage );
manifest.Append( KBackslash );
- manifest.Append( KManifest );
-
- if( !BaflUtils::FileExists( iFsSession, manifest ) )
- {
- continue;
- }
-
+ manifest.Append( KManifest );
+
// Check for duplicates
TBool isShadowed = EFalse;
TParsePtrC manifestPtr( manifest );
- for( TInt i=0; i < aFolders.Count(); i++ )
+ for( TInt i=0; i < aFileArray.Count(); i++ )
{
- TParsePtrC ptr( aFolders[i]->Des() );
+ TParsePtrC ptr( aFileArray[i]->Des() );
if( ptr.Path() == manifestPtr.Path() )
{
isShadowed = ETrue;
@@ -216,18 +225,11 @@
}
if( !isShadowed )
- {
- // Append the drive information (C or Z)
- TFileName driveIncluded;
- hspsServerUtil::FindFile(
- iFsSession,
- manifest,
- KNullDesC,
- driveIncluded );
- if( driveIncluded.Length() )
+ {
+ if( BaflUtils::FileExists( iFsSession, manifest ) )
{
- HBufC* nameBuf = driveIncluded.AllocLC();
- aFolders.AppendL( nameBuf );
+ HBufC* nameBuf = manifest.AllocLC();
+ aFileArray.AppendL( nameBuf );
CleanupStack::Pop( nameBuf );
}
}
--- a/homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp Tue May 11 16:30:05 2010 +0300
@@ -29,6 +29,7 @@
#include "hspsmanifest.h"
#include "bautils.h"
#include "sysutil.h"
+#include <syslangutil.h>
_LIT(KHspsFolder, "\\200159c0\\themes\\" );
@@ -1944,21 +1945,23 @@
}
// -----------------------------------------------------------------------------
-// hspsServerUtil::FindFilesRecursivelyL
+// hspsServerUtil::FindResourcesL
// -----------------------------------------------------------------------------
-void hspsServerUtil::FindFilesRecursivelyL(
+void hspsServerUtil::FindResourcesL(
RFs& aFs,
const RArray<TInt>& aDriveArray,
const TDesC& aPath,
- RPointerArray<HBufC>& aFolders,
+ RPointerArray<HBufC>& aFileArray,
+ CArrayFixFlat<TInt>* aDeviceLanguages,
TBool aRecursive )
{
- TParsePtrC parser( aPath );
-
+ // Scan internal drives only
TFindFile fileFinder( aFs );
fileFinder.SetFindMask( KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted );
+
+ TParsePtrC parser( aPath );
- _LIT(KMaskFile, "*");
+ // Loop the provided disk drives
for( TInt driveIndex=0; driveIndex < aDriveArray.Count(); driveIndex++ )
{
TChar driveChar;
@@ -1970,38 +1973,64 @@
TPath path;
path.Copy( driveBuf );
path.Append( parser.Path() );
-
- CDir* dirList( NULL );
- fileFinder.FindWildByDir( KMaskFile, path, dirList );
+
+ // Find files from the drive and path
+ CDir* dirList( NULL );
+ fileFinder.FindWildByPath( path, NULL, dirList );
if ( dirList )
- {
- CleanupStack::PushL( dirList );
+ {
+ CleanupStack::PushL( dirList );
- const TInt count = dirList->Count();
- for( TInt entryIndex = 0; entryIndex < count; entryIndex++ )
- {
- const TEntry& entry = (*dirList)[ entryIndex ];
+ const TInt count = dirList->Count();
+ for( TInt entryIndex = 0; entryIndex < count; entryIndex++ )
+ {
+ const TEntry& entry = (*dirList)[ entryIndex ];
- TFileName file( path );
- file.Append( entry.iName );
- if( entry.IsDir() )
- {
+ TFileName file( path );
+ file.Append( entry.iName );
+
+ if( entry.IsDir() )
+ {
+ if( aDeviceLanguages )
+ {
+ TInt dirLanguage = 0;
+ TLex lex( entry.iName );
+ TBool skipDir = ETrue;
+ if( lex.Val( dirLanguage ) == KErrNone && dirLanguage >= ELangTest )
+ {
+ for( TInt i=0; i < aDeviceLanguages->Count(); i++ )
+ {
+ TInt supportedLanguage = aDeviceLanguages->At( i );
+ if( supportedLanguage == dirLanguage )
+ {
+ skipDir = EFalse;
+ break;
+ }
+ }
+ }
+ if( skipDir )
+ {
+ continue;
+ }
+ }
+
file.Append( KDoubleBackSlash );
}
- if( !BaflUtils::FileExists( aFs, file ) )
- {
- continue;
- }
if( entry.IsDir() && aRecursive )
- {
- FindFilesRecursivelyL( aFs, aDriveArray, file, aFolders );
+ {
+ // Find files from the directory and drive
+ RArray<TInt> driveArray;
+ CleanupClosePushL( driveArray );
+ driveArray.Append( aDriveArray[driveIndex] );
+ FindResourcesL( aFs, driveArray, file, aFileArray, NULL );
+ CleanupStack::PopAndDestroy( &driveArray );
}
else
- {
+ {
HBufC* nameBuf = file.AllocLC();
- aFolders.AppendL( nameBuf );
- CleanupStack::Pop( nameBuf );
+ aFileArray.AppendL( nameBuf );
+ CleanupStack::Pop( nameBuf );
}
}
@@ -2012,6 +2041,32 @@
} // driveIndex
}
+void hspsServerUtil::GetInstalledLanguagesL(
+ CArrayFixFlat<TInt>*& aLanguages )
+ {
+ User::LeaveIfError( SysLangUtil::GetInstalledLanguages( aLanguages ) );
+ CleanupStack::PushL( aLanguages );
+
+ const TInt testLang = (TInt)ELangTest;
+
+ TBool isIncluded = EFalse;
+ for( TInt i = 0; i < aLanguages->Count(); i++ )
+ {
+ if( aLanguages->At( i ) == testLang )
+ {
+ isIncluded = ETrue;
+ break;
+ }
+ }
+
+ if( !isIncluded )
+ {
+ aLanguages->InsertL( 0, testLang );
+ }
+
+ CleanupStack::Pop( aLanguages );
+ }
+
// -----------------------------------------------------------------------------
// hspsServerUtil::hspsServerUtil
--- a/homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp Tue May 11 16:30:05 2010 +0300
@@ -307,13 +307,14 @@
// Setup a runtime array of headers (=header cache)
iHeaderListCache = new ( ELeave ) CArrayPtrSeg< ChspsODT >( KHeaderListGranularity );
+
+ // Setup a Plug-in Repository listener
+ iCentralRepository = CRepository::NewL( KhspsThemeStatusRepositoryUid );
- iDefinitionRepository = ChspsDefinitionRepository::NewL();
+ iDefinitionRepository = ChspsDefinitionRepository::NewL( *iCentralRepository );
#ifdef HSPS_LOG_ACTIVE
iDefinitionRepository->SetLogBus( iLogBus );
-#endif
- // Setup a Plug-in Repository listener
- iCentralRepository = CRepository::NewL( KhspsThemeStatusRepositoryUid );
+#endif
// Get active device language
iDeviceLanguage = GetDeviceLanguage();
@@ -607,13 +608,7 @@
aRepositoryInfo.iEventType & EhspsODTModified ||
aRepositoryInfo.iEventType & EhspsPluginReplaced )
{
- for( TInt i = 0; i < iSessions.Count(); i++ )
- {
- if( iSessions[i]->AppUid() == aRepositoryInfo.iAppUid )
- {
- iSessions[i]->SetResourceFileCopyRequired( ETrue );
- }
- }
+ SetResourceFileCopyRequired( aRepositoryInfo.iAppUid );
}
// If header cache should be updated from files in the Plug-in Repository
@@ -3610,5 +3605,22 @@
return iFamily;
}
+
+// -----------------------------------------------------------------------------
+// ChspsThemeServer::SetResourceFileCopyRequired()
+// -----------------------------------------------------------------------------
+//
+void ChspsThemeServer::SetResourceFileCopyRequired( const TInt aAppUid )
+ {
+ // Handle all related sessions
+ for( TInt i = 0; i < iSessions.Count(); i++ )
+ {
+ if( iSessions[i]->AppUid() == aAppUid )
+ {
+ iSessions[i]->SetResourceFileCopyRequired( ETrue );
+ }
+ }
+ }
+
// end of file
--- a/homescreenpluginsrv/hspspluginregistry/bwins/hspsdefrepu.def Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspspluginregistry/bwins/hspsdefrepu.def Tue May 11 16:30:05 2010 +0300
@@ -17,10 +17,10 @@
?MakeResourcePathL@ChspsDefinitionRepository@@QAEXABVChspsODT@@AAVChspsResource@@@Z @ 16 NONAME ; void ChspsDefinitionRepository::MakeResourcePathL(class ChspsODT const &, class ChspsResource &)
?GetOdtL@ChspsDefinitionRepository@@QAEHAAVChspsODT@@@Z @ 17 NONAME ; int ChspsDefinitionRepository::GetOdtL(class ChspsODT &)
?Lock@ChspsDefinitionRepository@@QAEXXZ @ 18 NONAME ; void ChspsDefinitionRepository::Lock(void)
- ?NewL@ChspsDefinitionRepository@@SAPAV1@XZ @ 19 NONAME ; class ChspsDefinitionRepository * ChspsDefinitionRepository::NewL(void)
- ?GetThemePathListL@ChspsDefinitionRepository@@QAEXAAVCDesC16ArraySeg@@ABVChspsODT@@@Z @ 20 NONAME ; void ChspsDefinitionRepository::GetThemePathListL(class CDesC16ArraySeg &, class ChspsODT const &)
- ?GetOdtL@ChspsDefinitionRepository@@QAEXABVTDes16@@AAVChspsODT@@@Z @ 21 NONAME ; void ChspsDefinitionRepository::GetOdtL(class TDes16 const &, class ChspsODT &)
- ?SetResourceListL@ChspsDefinitionRepository@@QAEHAAVChspsODT@@ABV?$CArrayPtrSeg@VChspsResource@@@@@Z @ 22 NONAME ; int ChspsDefinitionRepository::SetResourceListL(class ChspsODT &, class CArrayPtrSeg<class ChspsResource> const &)
+ ?GetThemePathListL@ChspsDefinitionRepository@@QAEXAAVCDesC16ArraySeg@@ABVChspsODT@@@Z @ 19 NONAME ; void ChspsDefinitionRepository::GetThemePathListL(class CDesC16ArraySeg &, class ChspsODT const &)
+ ?GetOdtL@ChspsDefinitionRepository@@QAEXABVTDes16@@AAVChspsODT@@@Z @ 20 NONAME ; void ChspsDefinitionRepository::GetOdtL(class TDes16 const &, class ChspsODT &)
+ ?SetResourceListL@ChspsDefinitionRepository@@QAEHAAVChspsODT@@ABV?$CArrayPtrSeg@VChspsResource@@@@@Z @ 21 NONAME ; int ChspsDefinitionRepository::SetResourceListL(class ChspsODT &, class CArrayPtrSeg<class ChspsResource> const &)
+ ?NewL@ChspsDefinitionRepository@@SAPAV1@AAVCRepository@@@Z @ 22 NONAME ; class ChspsDefinitionRepository * ChspsDefinitionRepository::NewL(class CRepository &)
?RegisterObserverL@ChspsDefinitionRepository@@QAEXABVMhspsDefinitionRepositoryObserver@@@Z @ 23 NONAME ; void ChspsDefinitionRepository::RegisterObserverL(class MhspsDefinitionRepositoryObserver const &)
?GetOdtHeaderL@ChspsDefinitionRepository@@QAEHAAVTDes16@@W4TLanguage@@AAVChspsODT@@@Z @ 24 NONAME ; int ChspsDefinitionRepository::GetOdtHeaderL(class TDes16 &, enum TLanguage, class ChspsODT &)
?BackupConfigurationL@ChspsDefinitionRepository@@QAEXABVChspsODT@@@Z @ 25 NONAME ; void ChspsDefinitionRepository::BackupConfigurationL(class ChspsODT const &)
--- a/homescreenpluginsrv/hspspluginregistry/eabi/hspsdefrepu.def Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspspluginregistry/eabi/hspsdefrepu.def Tue May 11 16:30:05 2010 +0300
@@ -17,13 +17,13 @@
_ZN25ChspsDefinitionRepository21GetThemeListAsStreamLER12CArrayPtrSegI6HBufC8ERK8ChspsODT @ 16 NONAME
_ZN25ChspsDefinitionRepository26RestoreBackupConfigurationERK8ChspsODT @ 17 NONAME
_ZN25ChspsDefinitionRepository4LockEv @ 18 NONAME
- _ZN25ChspsDefinitionRepository4NewLEv @ 19 NONAME
+ _ZN25ChspsDefinitionRepository4NewLER11CRepository @ 19 NONAME
_ZN25ChspsDefinitionRepository6UnlockEv @ 20 NONAME
_ZN25ChspsDefinitionRepository7GetOdtLER8ChspsODT @ 21 NONAME
_ZN25ChspsDefinitionRepository7GetOdtLERK6TDes16R8ChspsODT @ 22 NONAME
_ZN25ChspsDefinitionRepository7SetOdtLERK8ChspsODT @ 23 NONAME
_ZN25ChspsDefinitionRepository9SetLogBusEPv @ 24 NONAME
_ZNK25ChspsDefinitionRepository6LockedEv @ 25 NONAME
- _ZTI25ChspsDefinitionRepository @ 26 NONAME ; #<TI>#
- _ZTV25ChspsDefinitionRepository @ 27 NONAME ; #<VT>#
+ _ZTI25ChspsDefinitionRepository @ 26 NONAME
+ _ZTV25ChspsDefinitionRepository @ 27 NONAME
--- a/homescreenpluginsrv/hspspluginregistry/group/hspsdefinitionrepository.mmp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspspluginregistry/group/hspsdefinitionrepository.mmp Tue May 11 16:30:05 2010 +0300
@@ -44,6 +44,7 @@
LIBRARY hspsresource.lib
LIBRARY sysutil.lib
LIBRARY fbscli.lib
+LIBRARY centralrepository.lib
--- a/homescreenpluginsrv/hspspluginregistry/src/hspsdefinitionrepository.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/hspspluginregistry/src/hspsdefinitionrepository.cpp Tue May 11 16:30:05 2010 +0300
@@ -21,6 +21,7 @@
#include <s32mem.h>
#include <sysutil.h>
#include <bautils.h>
+#include <centralrepository.h>
#include "hsps_builds_cfg.hrh"
@@ -54,6 +55,10 @@
const TInt KTIntMahspsumbers( 11 );
+_LIT_SECURITY_POLICY_C1( KPSReadPolicy, ECapabilityReadDeviceData );
+_LIT_SECURITY_POLICY_C1( KPSWritePolicy, ECapabilityWriteDeviceData );
+
+
// ============================= LOCAL FUNCTIONS ===============================
// ============================ MEMBER FUNCTIONS ===============================
@@ -64,8 +69,10 @@
// might leave.
// -----------------------------------------------------------------------------
//
-ChspsDefinitionRepository::ChspsDefinitionRepository() :
- iCacheLastODT( NULL )
+ChspsDefinitionRepository::ChspsDefinitionRepository(
+ CRepository& aCentralRepository ) :
+ iCacheLastODT( NULL ),
+ iCentralRepository( aCentralRepository )
{
}
@@ -75,10 +82,14 @@
// -----------------------------------------------------------------------------
//
void ChspsDefinitionRepository::ConstructL()
- {
+ {
+ // Setup RProperty keys for the client applications
+ SetupPropertiesL( KPropertyAI3Key );
+ SetupPropertiesL( KPropertyMTKey );
+
User::LeaveIfError( iFs.Connect() );
//Create private path if it doesn't exist already
- TInt err=iFs.CreatePrivatePath(EDriveC);
+ TInt err = iFs.CreatePrivatePath(EDriveC);
if (err!=KErrNone && err!=KErrAlreadyExists)
{
User::Leave(err);
@@ -103,9 +114,11 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-EXPORT_C ChspsDefinitionRepository* ChspsDefinitionRepository::NewL()
+EXPORT_C ChspsDefinitionRepository* ChspsDefinitionRepository::NewL(
+ CRepository& aCentralRepository )
{
- ChspsDefinitionRepository* self = new( ELeave ) ChspsDefinitionRepository;
+ ChspsDefinitionRepository* self =
+ new( ELeave ) ChspsDefinitionRepository( aCentralRepository );
CleanupStack::PushL( self );
self->ConstructL();
@@ -117,6 +130,7 @@
// Destructor
ChspsDefinitionRepository::~ChspsDefinitionRepository()
{
+ iProperty.Close();
iFs.Close();
iRepositoryInfoQueue.Reset();
iRepositoryInfoQueue.Close();
@@ -131,6 +145,31 @@
}
// -----------------------------------------------------------------------------
+// ChspsDefinitionRepository::SetupPropertiesL
+// -----------------------------------------------------------------------------
+//
+void ChspsDefinitionRepository::SetupPropertiesL( const TUint aKey )
+ {
+ TInt err = RProperty::Define(
+ KPropertyHspsCat,
+ aKey,
+ RProperty::EInt,
+ KPSReadPolicy,
+ KPSWritePolicy );
+ if( err != KErrAlreadyExists && err != KErrNone )
+ {
+ User::LeaveIfError( err );
+ }
+ // Init
+ User::LeaveIfError(
+ RProperty::Set(
+ KPropertyHspsCat,
+ aKey,
+ KPropertyKeyDefault )
+ );
+ }
+
+// -----------------------------------------------------------------------------
// ChspsDefinitionRepository::SetLocaleL
// Saves the dtd-file into the repository.
// (other items were commented in a header).
@@ -208,7 +247,40 @@
{
delete iCacheLastODT;
iCacheLastODT = NULL;
- iCacheLastODT = aODT.CloneL();
+ iCacheLastODT = aODT.CloneL();
+
+ // Check whether we updated active application configuration
+ TInt configurationUid = -1;
+ User::LeaveIfError(
+ iCentralRepository.Get( iCacheLastODT->RootUid(), configurationUid )
+ );
+ if( configurationUid == aODT.ThemeUid() )
+ {
+
+ const TUint key = iCacheLastODT->RootUid();
+
+ // Get current value
+ TInt version( 0 );
+ User::LeaveIfError(
+ RProperty::Get(
+ KPropertyHspsCat,
+ key,
+ version )
+ );
+
+ // Increment the version, each client session should update the ODT copies
+ version++;
+ if( version < 1 )
+ {
+ version = 1;
+ }
+ User::LeaveIfError(
+ RProperty::Set(
+ KPropertyHspsCat,
+ key,
+ version )
+ );
+ }
}
return ret;
--- a/homescreenpluginsrv/inc/hspsdefinitionrepository.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreenpluginsrv/inc/hspsdefinitionrepository.h Tue May 11 16:30:05 2010 +0300
@@ -26,13 +26,29 @@
#include <badesca.h>
#include <s32mem.h>
#include <fbs.h>
+#include <e32property.h>
#include "hspsresource.h"
+class CRepository;
#ifdef HSPS_LOG_ACTIVE
class ChspsLogBus;
#endif
+
+/**
+* Publish & Subscribe functionality for controlling the ODT copies.
+*
+* IPC clients, such as such as sapi_homescreenplugin, should update any ChspsODT based
+* runtime copies when the active application configuration is updated.
+* Updated versions are indicated by an increment in the associated RProperty key.
+**/
+const TUid KPropertyHspsCat = {0x200159C0};
+const TUint KPropertyAI3Key = {0x102750F0}; // Homescreen
+const TUint KPropertyMTKey = {0x20000FB1}; // EUNIT MT
+const TInt KPropertyKeyDefault = 1;
+
+
/**
* ThspsRepositoryEvent.
* Events used in ThspsRepositoryInfo.
@@ -170,7 +186,8 @@
*
* @since S60 5.0
*/
- IMPORT_C static ChspsDefinitionRepository* NewL();
+ IMPORT_C static ChspsDefinitionRepository* NewL(
+ CRepository& aCentralRepository );
/**
* Destructor.
@@ -435,13 +452,15 @@
/**
* C++ default constructor.
*/
- ChspsDefinitionRepository();
+ ChspsDefinitionRepository( CRepository& aCentralRepository );
/**
* By default Symbian 2nd phase constructor is private.
*/
void ConstructL();
+ void SetupPropertiesL( const TUint aKey );
+
void SelectFilesFromPathL( CDesCArraySeg& aFileList, const TDesC& aPath, TEntryKey aSortFlag, const TDesC& aFileExtension );
void GetPathL( const ChspsODT& aODT, ThspsResourceType aResourceType );
@@ -495,6 +514,12 @@
// Cached copy of last retrieved ODT.
ChspsODT* iCacheLastODT;
+
+ // For indicating ODT updates
+ RProperty iProperty;
+
+ // Reference to central repository
+ CRepository& iCentralRepository;
};
#endif // C_hspsDEFINITIONREPOSITORY_H
--- a/homescreensrv_plat/hs_widget_publisher_api/inc/hswidgetpublisherimpl.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/hs_widget_publisher_api/inc/hswidgetpublisherimpl.h Tue May 11 16:30:05 2010 +0300
@@ -33,7 +33,6 @@
namespace Hs {
class HsWidget;
-class HsWidgetItem;
typedef std::map<std::string, std::wstring> WidgetContentIdMapType;
@@ -169,7 +168,7 @@
/**
*/
void InsertWidgetDataIdentifiersL( HsWidget& aWidget,
- CLiwDefaultMap* aDataMap, const TDesC& aContentType );
+ CLiwDefaultMap* aDataMap );
/**
*/
@@ -178,7 +177,7 @@
/**
*/
- void InsertWidgetItemL( HsWidgetItem& aWidgetItem,
+ void InsertWidgetItemsL( HsWidget& aWidget,
CLiwDefaultMap* aDataMap );
/**
@@ -191,7 +190,7 @@
/**
*/
- void InsertItemTriggerL( HsWidgetItem& aWidgetItem,
+ void InsertItemsTriggersL( HsWidget& aWidget,
CLiwDefaultMap* aTriggerMap );
/**
--- a/homescreensrv_plat/hs_widget_publisher_api/src/hswidgetpublisherimpl.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/hs_widget_publisher_api/src/hswidgetpublisherimpl.cpp Tue May 11 16:30:05 2010 +0300
@@ -198,7 +198,7 @@
{
// remove widget data when widget removed from screen
CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
- InsertWidgetDataIdentifiersL( aWidget, cpdatamap, KAll );
+ InsertWidgetDataIdentifiersL( aWidget, cpdatamap );
// removal may fail if the client has already removed the data
TRAP_IGNORE( RemoveFromCpsL( cpdatamap, KCpData ) );
mWidgetContentIds.erase( aWidget.getIdentifier() );
@@ -411,54 +411,45 @@
// ---------------------------------------------------------------------------
//
void HsWidgetPublisherImpl::PublishWidgetDataL( HsWidget& aWidget )
- {
- CLiwGenericParamList* inParam = &(mServiceHandler->InParamListL());
- CLiwGenericParamList* outParam = &(mServiceHandler->OutParamListL());
- TLiwGenericParam type(KType, TLiwVariant(KCpData));
-
- int count = aWidget.itemsCount();
- for( int i = 0; i < count; i++ )
- {
- inParam->AppendL(type);
- CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
-
- HsWidgetItem* const widgetItem = aWidget.getWidgetItem( i );
-
- // insert widget data identifiers
- HBufC* itemName = StdStringToUnicodeLC( widgetItem->getItemName());
- InsertWidgetDataIdentifiersL( aWidget, cpdatamap, *itemName );
- CleanupStack::PopAndDestroy( itemName );
-
- // insert widget item
- CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC();
- InsertWidgetItemL( *widgetItem, datamap );
- cpdatamap->InsertL( KDataMap, TLiwVariant( datamap ) );
-
- // insert widget access control list
- InsertWidgetACLL( cpdatamap );
-
- // insert item triggers
- CLiwDefaultMap* triggermap = CLiwDefaultMap::NewLC();
- InsertItemTriggerL( *widgetItem, triggermap );
- cpdatamap->InsertL( KActionMap, TLiwVariant( triggermap ) );
- CleanupStack::PopAndDestroy( triggermap );
+ {
+ CLiwGenericParamList* inParam = &(mServiceHandler->InParamListL());
+ CLiwGenericParamList* outParam = &(mServiceHandler->OutParamListL());
+
+ TLiwGenericParam type(KType, TLiwVariant(KCpData));
+ inParam->AppendL(type);
+
+ CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
+ InsertWidgetDataIdentifiersL( aWidget, cpdatamap );
+
+ CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC();
+ InsertWidgetItemsL( aWidget, datamap );
+ cpdatamap->InsertL( KDataMap, TLiwVariant( datamap ) );
+ InsertWidgetACLL( cpdatamap );
+
+ int count = aWidget.itemsCount();
+ if( count > 0 )
+ {
+ CLiwDefaultMap* triggermap = CLiwDefaultMap::NewLC();
+ InsertItemsTriggersL( aWidget, triggermap );
+ cpdatamap->InsertL( KActionMap, TLiwVariant( triggermap ) );
+ CleanupStack::PopAndDestroy( triggermap );
+ }
// add to CPS
- TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ));
- inParam->AppendL( item );
- mServiceInterface->ExecuteCmdL( KAdd,
- *inParam, *outParam);
- TInt ret= ObtainErrorCode( *outParam );
-
- CleanupStack::PopAndDestroy( datamap );
- CleanupStack::PopAndDestroy( cpdatamap );
-
- item.Reset();
- outParam->Reset();
- inParam->Reset();
- User::LeaveIfError( ret );
- }
- type.Reset();
+ TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ));
+ inParam->AppendL( item );
+ mServiceInterface->ExecuteCmdL( KAdd,
+ *inParam, *outParam);
+ TInt ret= ObtainErrorCode( *outParam );
+
+ CleanupStack::PopAndDestroy( datamap );
+ CleanupStack::PopAndDestroy( cpdatamap );
+
+ item.Reset();
+ type.Reset();
+ outParam->Reset();
+ inParam->Reset();
+ User::LeaveIfError( ret );
}
// ---------------------------------------------------------------------------
@@ -572,7 +563,7 @@
CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
TRAPD( err,
- InsertWidgetDataIdentifiersL( aWidget, cpdatamap, KAll );
+ InsertWidgetDataIdentifiersL( aWidget, cpdatamap );
RemoveFromCpsL( cpdatamap, KCpData ) );
if ( err != KErrNotFound )
{
@@ -783,7 +774,7 @@
// ---------------------------------------------------------------------------
//
void HsWidgetPublisherImpl::InsertWidgetDataIdentifiersL( HsWidget& aWidget,
- CLiwDefaultMap* aDataMap, const TDesC& aContentType )
+ CLiwDefaultMap* aDataMap )
{
WidgetContentIdMapType::const_iterator contentIdIter =
mWidgetContentIds.find( aWidget.getIdentifier() );
@@ -797,7 +788,7 @@
HBufC* publisherName = StdStringToUnicodeLC( GetPublisherNameL( aWidget ) );
aDataMap->InsertL( KPublisherId, TLiwVariant( *publisherName ) );
- aDataMap->InsertL( KContentType, TLiwVariant( aContentType ) );
+ aDataMap->InsertL( KContentType, TLiwVariant( KAll ) );
aDataMap->InsertL( KContentId, TLiwVariant( contentId ) );
CleanupStack::PopAndDestroy( publisherName );
@@ -845,25 +836,31 @@
//
// ---------------------------------------------------------------------------
//
-void HsWidgetPublisherImpl::InsertWidgetItemL ( HsWidgetItem& aWidgetItem,
+void HsWidgetPublisherImpl::InsertWidgetItemsL ( HsWidget& aWidget,
CLiwDefaultMap* aDataMap )
{
- TPtrC8 itemName = ((TUint8*)aWidgetItem.getItemName().c_str());
- if( aWidgetItem.isStringValue() )
- {
- TPtrC8 itemValue = ((TUint8*)aWidgetItem.getItemValue().c_str());
- HBufC* value = HBufC::NewLC( KUnicodeSize * itemValue.Length() );
- TPtr dest( value->Des() );
- CnvUtfConverter::ConvertToUnicodeFromUtf8( dest, itemValue );
-
- aDataMap->InsertL( itemName, TLiwVariant(*value ));
- CleanupStack::PopAndDestroy(value);
- }
- else
- {
- int itemValue = aWidgetItem.getItemValueInt();
- aDataMap->InsertL( itemName, TLiwVariant( TInt32( itemValue ) ));
- }
+ int count = aWidget.itemsCount();
+ for (int index = 0; index < count; index++)
+ {
+ HsWidgetItem* const item = aWidget.getWidgetItem( index );
+
+ TPtrC8 itemName = ((TUint8*)item->getItemName().c_str());
+ if( item->isStringValue() )
+ {
+ TPtrC8 itemValue = ((TUint8*)item->getItemValue().c_str());
+ HBufC* value = HBufC::NewLC( KUnicodeSize * itemValue.Length() );
+ TPtr dest( value->Des() );
+ CnvUtfConverter::ConvertToUnicodeFromUtf8( dest, itemValue );
+
+ aDataMap->InsertL( itemName, TLiwVariant(*value ));
+ CleanupStack::PopAndDestroy(value);
+ }
+ else
+ {
+ int itemValue = item->getItemValueInt();
+ aDataMap->InsertL( itemName, TLiwVariant( TInt32( itemValue ) ));
+ }
+ }
}
// ---------------------------------------------------------------------------
@@ -941,9 +938,10 @@
//
// ---------------------------------------------------------------------------
//
-void HsWidgetPublisherImpl::InsertItemTriggerL( HsWidgetItem& aWidgetItem,
+void HsWidgetPublisherImpl::InsertItemsTriggersL( HsWidget& aWidget,
CLiwDefaultMap* aTriggerMap )
{
+ int count = aWidget.itemsCount();
CLiwDefaultMap* activateAction = CLiwDefaultMap::NewLC();
activateAction->InsertL( KPluginId, TLiwVariant( KCASpaAppLauncherPlugin ) );
@@ -954,10 +952,13 @@
activate->InsertL( KApaCommand, TLiwVariant( KApaCommandBackground ) );
activateAction->InsertL( KData, TLiwVariant( activate ) );
-
- TPtrC8 itemName = ((TUint8*)aWidgetItem.getItemName().c_str());
- aTriggerMap->InsertL( itemName, TLiwVariant( activateAction ));
-
+
+ for (int index = 0; index < count; index++)
+ {
+ HsWidgetItem* const item = aWidget.getWidgetItem( index );
+ TPtrC8 itemName = ((TUint8*)item->getItemName().c_str());
+ aTriggerMap->InsertL( itemName, TLiwVariant( activateAction ));
+ }
CleanupStack::PopAndDestroy( activate );
CleanupStack::PopAndDestroy( activateAction );
}
--- a/homescreensrv_plat/idlefw_api/group/bld.inf Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/idlefw_api/group/bld.inf Tue May 11 16:30:05 2010 +0300
@@ -28,5 +28,7 @@
../inc/aifwstatehandler.h MW_LAYER_PLATFORM_EXPORT_PATH(aifwstatehandler.h)
../inc/aiuicontroller.h MW_LAYER_PLATFORM_EXPORT_PATH(aiuicontroller.h)
../inc/aiuiidleintegration.h MW_LAYER_PLATFORM_EXPORT_PATH(aiuiidleintegration.h)
-../inc/debug.h MW_LAYER_PLATFORM_EXPORT_PATH(debug.h) // needed?
+../inc/debug.h MW_LAYER_PLATFORM_EXPORT_PATH(debug.h)
../inc/aifwdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(aifwdefs.h)
+../inc/aifwpublisherinfo.h MW_LAYER_PLATFORM_EXPORT_PATH(aifwpublisherinfo.h)
+../inc/aifwpublisherinfo.inl MW_LAYER_PLATFORM_EXPORT_PATH(aifwpublisherinfo.inl)
--- a/homescreensrv_plat/idlefw_api/inc/aifwdefs.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/idlefw_api/inc/aifwdefs.h Tue May 11 16:30:05 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: Internal array type definition
+* Description: AiFw definitions
*
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/idlefw_api/inc/aifwpublisherinfo.h Tue May 11 16:30:05 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2005-2006 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: AiFw internal publisher info
+*
+*/
+
+
+#ifndef _AIFWPUBLISHERINFO_H
+#define _AIFWPUBLISHERINFO_H
+
+// System includes
+#include <e32std.h>
+
+// User includes
+#include <hspublisherinfo.h>
+#include <aifwdefs.h>
+
+// Type definitions
+
+// Class declaration
+/**
+ * Callback
+ *
+ * @since S60 5.2
+ */
+class TAiFwCallback
+ {
+public:
+ // constructors
+
+ /**
+ * C++ default contrutor
+ */
+ inline TAiFwCallback();
+
+ /**
+ * C++ contrutor
+ */
+ inline TAiFwCallback( void (*aFunction)( TAny* aPtr, TInt aResult ), TAny* aPtr );
+
+public:
+ // new functions
+
+ /**
+ * Assigment operator
+ *
+ * @since S60 5.2
+ * @param aCb Callback to assign.
+ */
+ inline TAiFwCallback& operator= ( const TAiFwCallback& aCb );
+
+ /**
+ * Callback
+ *
+ * @since S60 5.2
+ * @param aResult Result which is pased to callback
+ */
+ inline void Callback( TInt aResult ) const;
+
+private:
+ // data
+
+ /** Callback function */
+ void ( *iFunction )( TAny* aPtr, TInt aResult );
+ /** A pointer to pass in callback function */
+ TAny* iPtr;
+ };
+
+class TAiFwPublisherInfo
+ {
+public:
+ // constructors
+
+ /**
+ * C++ default contrutor
+ */
+ inline TAiFwPublisherInfo();
+
+ /**
+ * C++ contrutor
+ */
+ inline TAiFwPublisherInfo( const THsPublisherInfo& aInfo,
+ const TAiFwCallback& aCb, TInt aReason );
+
+public:
+ // new functions
+
+ /**
+ * Assigment operator
+ *
+ * @since S60 5.2
+ * @param aInfo Info to assign.
+ */
+ inline TAiFwPublisherInfo& operator= ( const TAiFwPublisherInfo& aInfo );
+
+ /**
+ * Equals operator
+ *
+ * @since S60 5.2
+ * @param aInfo Info to use in comparision
+ * @return Publisher info
+ */
+ inline TBool operator==( const THsPublisherInfo& aInfo ) const;
+
+ /**
+ * Gets publisher info
+ *
+ * @since S60 5.2
+ * @return Publisher info
+ */
+ inline const THsPublisherInfo& Info() const;
+
+ /**
+ * Gets reason
+ *
+ * @since S60 5.2
+ * @return Reason
+ */
+ inline TInt Reason() const;
+
+ /**
+ * Calls callback functions
+ *
+ * @since S60 5.2
+ * @param aResult Result which is passed to callback function
+ */
+ inline void Callback( TInt aResult ) const;
+
+private:
+ // data
+
+ /** Publisher info */
+ THsPublisherInfo iInfo;
+ /** Callback */
+ TAiFwCallback iCb;
+ /** Reason */
+ TInt iReason;
+ };
+
+#include <aifwpublisherinfo.inl>
+
+#endif // _AIFWPUBLISHERINFO_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/idlefw_api/inc/aifwpublisherinfo.inl Tue May 11 16:30:05 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2005-2006 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: AiFw internal publisher info
+*
+*/
+
+
+#ifndef _AIFWPUBLISHERINFO_INL
+#define _AIFWPUBLISHERINFO_INL
+
+// ---------------------------------------------------------------------------
+// TAiFwCallback::TAiFwCallback
+//
+// ---------------------------------------------------------------------------
+//
+inline TAiFwCallback::TAiFwCallback()
+ : iFunction( NULL ), iPtr( NULL )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwCallback::TAiFwCallback
+//
+// ---------------------------------------------------------------------------
+//
+inline TAiFwCallback::TAiFwCallback(
+ void (*aFunction)( TAny* aPtr, TInt aResult ), TAny* aPtr )
+ : iFunction( aFunction ), iPtr( aPtr )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwCallback::operator=
+//
+// ---------------------------------------------------------------------------
+//
+inline TAiFwCallback& TAiFwCallback::operator=( const TAiFwCallback& aCb )
+ {
+ iPtr = aCb.iPtr;
+ iFunction = aCb.iFunction;
+
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwCallback::Callback
+//
+// ---------------------------------------------------------------------------
+//
+inline void TAiFwCallback::Callback( TInt aResult ) const
+ {
+ if ( iFunction )
+ {
+ (*iFunction)( iPtr, aResult );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwPublisherInfo::TAiFwPublisherInfo
+//
+// ---------------------------------------------------------------------------
+//
+inline TAiFwPublisherInfo::TAiFwPublisherInfo()
+ : iInfo( THsPublisherInfo() ), iCb( TAiFwCallback() ), iReason( 0 )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwPublisherInfo::TAiFwPublisherInfo
+//
+// ---------------------------------------------------------------------------
+//
+inline TAiFwPublisherInfo::TAiFwPublisherInfo( const THsPublisherInfo& aInfo,
+ const TAiFwCallback& aCb, TInt aReason )
+ : iInfo( aInfo ), iCb( aCb ), iReason( aReason )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwPublisherInfo::operator=
+//
+// ---------------------------------------------------------------------------
+//
+inline TAiFwPublisherInfo& TAiFwPublisherInfo::operator=(
+ const TAiFwPublisherInfo& aInfo )
+ {
+ iInfo = aInfo.iInfo;
+ iCb = aInfo.iCb;
+ iReason = aInfo.iReason;
+
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwPublisherInfo::operator==
+//
+// ---------------------------------------------------------------------------
+//
+inline TBool TAiFwPublisherInfo::operator==(
+ const THsPublisherInfo& aInfo ) const
+ {
+ return iInfo == aInfo;
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwPublisherInfo::Info
+//
+// ---------------------------------------------------------------------------
+//
+inline const THsPublisherInfo& TAiFwPublisherInfo::Info() const
+ {
+ return iInfo;
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwPublisherInfo::Reason
+//
+// ---------------------------------------------------------------------------
+//
+inline TInt TAiFwPublisherInfo::Reason() const
+ {
+ return iReason;
+ }
+
+// ---------------------------------------------------------------------------
+// TAiFwPublisherInfo::Callback
+//
+// ---------------------------------------------------------------------------
+//
+inline void TAiFwPublisherInfo::Callback( TInt aResult ) const
+ {
+ iCb.Callback( aResult );
+ }
+
+#endif // _AIFWPUBLISHERINFO_INL
+
+// End of file
--- a/homescreensrv_plat/idlefw_api/inc/aifwstatehandler.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/idlefw_api/inc/aifwstatehandler.h Tue May 11 16:30:05 2010 +0300
@@ -25,7 +25,7 @@
#include <aifwdefs.h>
// Forward declarations
-class THsPublisherInfo;
+class TAiFwPublisherInfo;
/**
* Active Idle Framework internal state handling interface.
@@ -43,22 +43,17 @@
* Instructs to load plugin
*
* @since S60 5.2
- * @param aPublisherInfo plugin to load
- * @param aReason startup reason
- * @return Error code, KErrNone if loaded succesfully.
+ * @param aPublisherInfo plugin to load
*/
- virtual TInt LoadPlugin( const THsPublisherInfo& aPublisherInfo,
- TAiFwLoadReason aReason ) = 0;
+ virtual void LoadPlugin( const TAiFwPublisherInfo& aPublisher ) = 0;
/**
* Instructs to destroy plugin
*
* @since S60 5.2
* @param aPublisherInfo plugin to destroy
- * @param aReason shutdown reason
*/
- virtual void DestroyPlugin( const THsPublisherInfo& aPublisherInfo,
- TAiFwDestroyReason aReason ) = 0;
+ virtual void DestroyPlugin( const TAiFwPublisherInfo& aPublisher ) = 0;
/**
* Instructs to change all plugins' state
@@ -67,7 +62,6 @@
* @param aState State to change
*/
virtual void ChangePluginState( TAiFwState aState ) = 0;
-
};
#endif // M_AIFWSTATEHANDLER_H
--- a/homescreensrv_plat/sapi_contentpublishing/inc/cpclient.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_contentpublishing/inc/cpclient.h Tue May 11 16:30:05 2010 +0300
@@ -96,10 +96,14 @@
* Send command to server to Register observer for notifications
*
* @since S6CCPActiveNotifierNotifier v 5.CCPActiveNotifierNotifier
- * @param aObserver
+ * @param aObserver callback pointer
+ * @param aInParamList input parameter list
+ * @param aCmdOptions options for the command
*/
void RegisterObserverL( MLiwNotifyCallback* aObserver,
- const CLiwGenericParamList& aInParamList, TInt32 aTransactionId );
+ const CLiwGenericParamList& aInParamList,
+ TInt32 aTransactionId,
+ TUint aCmdOptions );
/**
* Unregister observer if Transaction Id provided or all observers if not
--- a/homescreensrv_plat/sapi_contentpublishing/inc/cpclientactivenotifier.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_contentpublishing/inc/cpclientactivenotifier.h Tue May 11 16:30:05 2010 +0300
@@ -50,11 +50,14 @@
* Register observer
*
* @param aObserver Pointer for callback
+ * @param aTransactionId Integer transaction id
* @param aMap Map containing parameters
- * @param aTransactionId Integer transaction id
+ * @param aCmdOptions options for the command
*/
- void RegisterL( MLiwNotifyCallback* aObserver, TInt32 aTransactionId,
- CCPLiwMap* aMap );
+ void RegisterL( MLiwNotifyCallback* aObserver,
+ TInt32 aTransactionId,
+ CCPLiwMap* aMap,
+ TUint aCmdOptions );
/**
* Unregister observer
@@ -120,8 +123,7 @@
/*
* Register observer
*/
- void RegisterAgainL( );
-
+ void RegisterAgainL( );
private:
--- a/homescreensrv_plat/sapi_contentpublishing/src/cdatasourceinterface.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_contentpublishing/src/cdatasourceinterface.cpp Tue May 11 16:30:05 2010 +0300
@@ -158,7 +158,10 @@
User::Leave( KErrPathNotFound );
}
transactionId = aCallback->GetTransactionID();
- iCPClient->RegisterObserverL( aCallback, aInParamList, transactionId );
+ iCPClient->RegisterObserverL( aCallback,
+ aInParamList,
+ transactionId,
+ aCmdOptions );
}
else
{
--- a/homescreensrv_plat/sapi_contentpublishing/src/cpclient.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_contentpublishing/src/cpclient.cpp Tue May 11 16:30:05 2010 +0300
@@ -144,7 +144,9 @@
// -----------------------------------------------------------------------------
//
void CCPClient::RegisterObserverL( MLiwNotifyCallback* aObserver,
- const CLiwGenericParamList& aInParamList, TInt32 aTransactionId )
+ const CLiwGenericParamList& aInParamList,
+ TInt32 aTransactionId,
+ TUint aCmdOptions )
{
CP_DEBUG( _L8("CCPClient::RegisterObserverL()") );
CP_EXTENDED_DEBUG( "RegisterObserver()" , aInParamList );
@@ -156,7 +158,8 @@
{
iActiveNotifier = CCPActiveNotifier::NewL( iServerClient );
}
- iActiveNotifier->RegisterL( aObserver, aTransactionId, inMapForServer );
+ iActiveNotifier->RegisterL( aObserver, aTransactionId, inMapForServer,
+ aCmdOptions );
CleanupStack::PopAndDestroy( inMapForServer );
}
--- a/homescreensrv_plat/sapi_contentpublishing/src/cpclientactivenotifier.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_contentpublishing/src/cpclientactivenotifier.cpp Tue May 11 16:30:05 2010 +0300
@@ -60,7 +60,9 @@
// ----------------------------------------------------------------------------
//
void CCPActiveNotifier::RegisterL( MLiwNotifyCallback* aObserver,
- TInt32 aTransactionId, CCPLiwMap* aMap )
+ TInt32 aTransactionId,
+ CCPLiwMap* aMap,
+ TUint aCmdOptions )
{
CP_DEBUG( _L8("CCPActiveNotifier::RegisterL()" ) );
TIpcArgs args;
@@ -77,7 +79,7 @@
CleanupStack::Pop( iObserverBuf );
args.Set( KDescriptorPosition, &*iObserverBuf );
args.Set( KTransactionPosition, aTransactionId );
-
+ args.Set( KOptionsPosition, static_cast<TInt>( aCmdOptions ));
if ( !IsActive( ) )
{
iSizeDes = new (ELeave) TPckgBuf<TInt>( );
--- a/homescreensrv_plat/sapi_homescreenplugin/hspsservice/inc/hspsconfigurationservice.h Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_homescreenplugin/hspsservice/inc/hspsconfigurationservice.h Tue May 11 16:30:05 2010 +0300
@@ -28,6 +28,7 @@
#include <hspsodt.h>
#include <hspsdomlist.h>
#include <hspsdomdocument.h>
+#include <e32property.h>
// FORWARD DECLARATIONS
class ChspsDomNode;
@@ -191,9 +192,12 @@
ChspsLogBus* iLogBus;
#endif
/**
- * ETrue if iHspsODT is invalid.
+ * Currently loaded version of the CHspsODT instance
*/
- TBool iInvalidODT;
+ TInt iODTVersion;
+
+ // For validation of the iHspsODT member
+ RProperty iProperty;
};
--- a/homescreensrv_plat/sapi_homescreenplugin/hspsservice/src/hspsconfigurationservice.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_homescreenplugin/hspsservice/src/hspsconfigurationservice.cpp Tue May 11 16:30:05 2010 +0300
@@ -62,6 +62,7 @@
//
CHspsConfigurationService::~CHspsConfigurationService()
{
+ iProperty.Close();
iPluginIds.Close();
if(iHspsRequestClient)
{
@@ -85,7 +86,7 @@
// ---------------------------------------------------------------------------
//
CHspsConfigurationService::CHspsConfigurationService() :
- iInvalidODT ( ETrue )
+ iODTVersion( 0 )
{
}
@@ -113,11 +114,49 @@
User::Leave( KErrNotFound );
}
- // If current ODT is invalidated, then update it.
- if( iInvalidODT )
- {
- GetODTL( iHspsODT->RootUid() );
- }
+ if( iODTVersion < 1 )
+ {
+ GetODTL( iHspsODT->RootUid() );
+ }
+
+ // Get app uid/key
+ TInt key = 0;
+ GetAppUidL( key );
+ if( key < 1 )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ if( iODTVersion < 1 )
+ {
+ User::LeaveIfError(
+ iProperty.Attach(
+ KPropertyHspsCat,
+ key )
+ );
+ User::LeaveIfError(
+ iProperty.Get(
+ KPropertyHspsCat,
+ key,
+ iODTVersion )
+ );
+ }
+ else
+ {
+ // Check whether the ODT needs to be updated
+ TInt latestVersion( -1 );
+ User::LeaveIfError(
+ iProperty.Get(
+ KPropertyHspsCat,
+ key,
+ latestVersion )
+ );
+ if( latestVersion != iODTVersion )
+ {
+ GetODTL( iHspsODT->RootUid() );
+ iODTVersion = latestVersion;
+ }
+ }
return iHspsODT->DomDocument();
}
@@ -152,7 +191,7 @@
else
{
// ODT is now valid.
- iInvalidODT = EFalse;
+
/*
// Start observing ODT changes
if ( EhspsServiceRequestSheduled != iHspsRequestClient->hspsGetODTUpdate() )
@@ -211,7 +250,7 @@
// -----------------------------------------------------------------------------
EXPORT_C void CHspsConfigurationService::InvalidateODT()
{
- iInvalidODT = ETrue;
+ iODTVersion = 0;
}
// -----------------------------------------------------------------------------
--- a/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/src/mt_hspsconfigurationif.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/src/mt_hspsconfigurationif.cpp Tue May 11 16:30:05 2010 +0300
@@ -3527,19 +3527,19 @@
"FUNCTIONALITY",
SetupL, SetActiveAppConf_4_L, Teardown )
- EUNIT_TEST(
- "RequestNotify(1)",
- "IConfiguration",
- "RequestNotify",
- "FUNCTIONALITY",
- SetupL, RequestNotify_1_L, Teardown )
+// EUNIT_TEST(
+// "RequestNotify(1)",
+// "IConfiguration",
+// "RequestNotify",
+// "FUNCTIONALITY",
+// SetupL, RequestNotify_1_L, Teardown )
- EUNIT_TEST(
- "RequestNotify(2)",
- "IConfiguration",
- "RequestNotify",
- "FUNCTIONALITY",
- SetupL, RequestNotify_2_L, Teardown )
+// EUNIT_TEST(
+// "RequestNotify(2)",
+// "IConfiguration",
+// "RequestNotify",
+// "FUNCTIONALITY",
+// SetupL, RequestNotify_2_L, Teardown )
EUNIT_TEST(
"RequestNotify(3)",
@@ -3555,12 +3555,12 @@
"FUNCTIONALITY",
SetupL, RequestNotify_4_L, Teardown )
- EUNIT_TEST(
- "RequestNotify(5)",
- "IConfiguration",
- "RequestNotify",
- "FUNCTIONALITY",
- SetupL, RequestNotify_5_L, Teardown )
+// EUNIT_TEST(
+// "RequestNotify(5)",
+// "IConfiguration",
+// "RequestNotify",
+// "FUNCTIONALITY",
+// SetupL, RequestNotify_5_L, Teardown )
EUNIT_TEST(
"RequestNotify(6)",
--- a/idlefw/inc/framework/aicpsexecuteparam.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/inc/framework/aicpsexecuteparam.h Tue May 11 16:30:05 2010 +0300
@@ -26,6 +26,7 @@
// Forward declarations
class CLiwGenericParamList;
+class CLiwDefaultMap;
// Constants
/**
--- a/idlefw/inc/framework/aipluginfactory.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/inc/framework/aipluginfactory.h Tue May 11 16:30:05 2010 +0300
@@ -30,6 +30,7 @@
class CAiUiControllerManager;
class CAiStateManager;
class CAiCpsCommandBuffer;
+class TAiFwPublisherInfo;
class CHsContentPublisher;
class THsPublisherInfo;
@@ -42,7 +43,7 @@
* @lib aifw
* @since S60 5.2
*/
-NONSHARABLE_CLASS( CAiPluginFactory ) : public CBase
+NONSHARABLE_CLASS( CAiPluginFactory ) : public CTimer
{
public:
// Constructors and destructor
@@ -51,7 +52,12 @@
* Two-phased constructor.
*/
static CAiPluginFactory* NewL( CAiUiControllerManager& aManager );
-
+
+ /**
+ * 2nd phase constructor
+ */
+ void ConstructL();
+
/**
* Destructor
*/
@@ -59,26 +65,30 @@
public:
// new functions
-
+
/**
- * Create plugin
+ * Lists KInterfaceUidHsContentPlugin ECom implementations
+ *
+ * @since S60 5.2
+ */
+ void ListImplementationsL();
+
+ /**
+ * Schedules plugin loading
*
* @since S60 5.2
- * @param aPublisherInfo plugin to create. Factory keeps plugin's ownership.
- * @return KErrNone if plugin is created succesfully, otherwise system wide error code.
- */
- TInt CreatePlugin(
- const THsPublisherInfo& aPublisherInfo );
-
+ * @param aInfo Plugin to load
+ */
+ void LoadPlugin( const TAiFwPublisherInfo& aInfo );
+
/**
- * Destroy plugin
+ * Schedules plugin destroyal
*
* @since S60 5.2
- * @param aPublisherInfo plugin to destroy.
- */
- void DestroyPlugin(
- const THsPublisherInfo& aPublisherInfo );
-
+ * @param aInfo Plugin to destroy
+ */
+ void DestroyPlugin( const TAiFwPublisherInfo& aInfo );
+
/**
* Destroy plugin
*
@@ -86,8 +96,22 @@
* @param aUid Implementation UID of a plugin to destroy.
*/
void DestroyPlugin(
- const TUid& aUid );
-
+ const TUid& aUid );
+
+ /**
+ * Destroys all plugins during system shutdown
+ *
+ * @since S60 5.2
+ */
+ void DestroyAllPlugins();
+
+ /**
+ * Flushes cps command buffer
+ *
+ * @since S60 5.2
+ */
+ void FlushCommandBuffer();
+
/**
* Finds plugin by publisher info.
*
@@ -117,20 +141,36 @@
CHsContentPublisher* PluginByName( const TDesC& aName ) const;
/**
- * Sets cps command buffer
+ * Sets state manager
+ *
+ * @since S60 5.2
+ * @param aStateManager State Manager
+ */
+ void SetStateManager( CAiStateManager* aStateManager );
+
+ /**
+ * Gets all plugins from factory
*
* @since S60 5.2
- * @param aCommanddBuffer Command buffer
+ * @return Array of plugins
*/
- void SetCommandBuffer( CAiCpsCommandBuffer* aCommanddBuffer );
+ RPointerArray< CHsContentPublisher >& Publishers() const;
+
+private:
+ // from CTimer
+
+ /**
+ * @see CTimer
+ */
+ void RunL();
+
+ /**
+ * @see CTimer
+ */
+ void DoCancel();
private:
// private constructors
-
- /**
- * Leaving constructor
- */
- void ConstructL();
/**
* C++ default constructor
@@ -139,35 +179,52 @@
private:
// new functions
-
- void CreatePluginL(
- const THsPublisherInfo& aPublisherInfo );
-
- void SubscribeContentObserversL(
+
+ TInt DoCreatePlugin(
+ const TAiFwPublisherInfo& aPublisherInfo );
+
+ void DoDestroyPlugin(
+ const TAiFwPublisherInfo& aPublisherInfo );
+
+ void DoCreatePluginL(
+ const TAiFwPublisherInfo& aPublisherInfo );
+
+ void SubscribePluginL(
CHsContentPublisher& aContentPublisher,
const THsPublisherInfo& aPublisherInfo );
void ConfigurePluginL(
CHsContentPublisher& aContentPublisher,
const THsPublisherInfo& aPublisherInfo );
+
+ void HandleQueueChanged();
+
+ static TInt ProcessQueue( TAny* aAny );
- RPointerArray< CHsContentPublisher >& Publishers() const;
-
private:
// data
/** UI Controller Manager, Not owned */
CAiUiControllerManager& iUiControllerManager;
- /** Cps command buffer, Not owned */
+ /** State Manager, Not owned */
+ CAiStateManager* iStateManager;
+ /** Cps command buffer, Owned */
CAiCpsCommandBuffer* iCommandBuffer;
+ /** Queue starter, Owned */
+ CPeriodic* iStarter;
/** Array of loaded data plugins, Owned */
mutable RPointerArray< CHsContentPublisher > iPublishers;
/** Ecom implementation info, Owned */
RImplInfoPtrArray iEComPlugins;
+ /** Load queue, Owned */
+ RArray< TAiFwPublisherInfo > iLoadQueue;
+ /** Destroy queue, Owned */
+ RArray< TAiFwPublisherInfo > iDestroyQueue;
+ /** Flag to determine wheter flush is allowed */
+ TBool iAllowFlush;
private:
// friend classes
- friend class CAiStateManager;
#ifdef _AIFW_UNIT_TEST
friend class UT_AiPluginFactory;
--- a/idlefw/inc/framework/aistatemanager.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/inc/framework/aistatemanager.h Tue May 11 16:30:05 2010 +0300
@@ -29,7 +29,7 @@
// Forward declarations
class CAiPluginFactory;
-class CAiCpsCommandBuffer;
+class TAiFwPublisherInfo;
class CHsContentPublisher;
class THsPublisherInfo;
@@ -38,7 +38,7 @@
*
* @ingroup group_aifw
* @lib aifw.lib
- * @since S60 5.0
+ * @since S60 5.2
*/
NONSHARABLE_CLASS( CAiStateManager ) : public CBase,
public MAiStateObserver
@@ -102,14 +102,12 @@
/**
* @see MAiStateObserver
*/
- TInt NotifyLoadPlugin( const THsPublisherInfo& aInfo,
- TAiFwLoadReason aReason );
+ void NotifyLoadPlugin( const TAiFwPublisherInfo& aInfo );
/**
* @see MAiStateObserver
*/
- void NotifyDestroyPlugin( const THsPublisherInfo& aInfo,
- TAiFwDestroyReason aReason );
+ void NotifyDestroyPlugin( const TAiFwPublisherInfo& aInfo );
/**
* @see MAiStateObserver
@@ -122,6 +120,27 @@
*/
void NotifyReleasePlugins( const RArray<TUid>& aUidList );
+public:
+ // new functions
+
+ /**
+ * Runs plugin startup sequence
+ *
+ * @since S60 5.2
+ * @param aPlugin Plugin to start
+ * @param aReason Start reason
+ */
+ void StartPlugin( CHsContentPublisher& aPlugin, TInt aReason );
+
+ /**
+ * Runs plugin shutdown sequence
+ *
+ * @since S60 5.2
+ * @param aPlugin Plugin to stop
+ * @param aReason Stop reason
+ */
+ void StopPlugin( CHsContentPublisher& aPlugin, TInt aReason );
+
private:
// new functions
@@ -162,48 +181,12 @@
* @since S60 5.2
*/
void ProcessOnlineStateChange();
-
- /**
- * Runs plugin startup sequence
- *
- * @since S60 5.2
- * @param aPlugin Plugin to start
- * @param aReason Start reason
- */
- void StartPlugin( CHsContentPublisher& aPlugin,
- CHsContentPublisher::TStartReason aReason );
-
- /**
- * Runs plugin shutdown sequence
- *
- * @since S60 5.2
- * @param aPlugin Plugin to stop
- * @param aReason Stop reason
- */
- void StopPlugin( CHsContentPublisher& aPlugin,
- CHsContentPublisher::TStopReason aReason );
-
- /**
- * Destroys all plugins from plugin factory
- *
- * @since S60 5.2
- */
- void DestroyPlugins();
-
- /**
- * Flushes cps command buffer
- *
- * @since S60 5.2
- */
- void FlushCommandBuffer();
-
+
private:
// data
/** Plugin Factory, Not owned */
CAiPluginFactory& iFactory;
- /** CPS Command buffer, Owned */
- CAiCpsCommandBuffer* iCommandBuffer;
/** Current state */
TState iCurrentState;
/** Flags */
@@ -212,7 +195,7 @@
TBool iHalt;
/** List of plugins which should be reloaded */
RArray<THsPublisherInfo> iReloadPlugins;
-
+
private:
// friend classes
--- a/idlefw/inc/framework/aistateobserver.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/inc/framework/aistateobserver.h Tue May 11 16:30:05 2010 +0300
@@ -25,7 +25,7 @@
#include <aifwdefs.h>
// Forward declarations
-class THsPublisherInfo;
+class TAiFwPublisherInfo;
/**
* State Observer
@@ -50,21 +50,16 @@
*
* @since S60 5.2
* @param aInfo Publisher Info, which describes the plugin to be loaded.
- * @param aReason Startup reason, which will be forwarded to the plugin.
- * @return Error code, KErrNone if succesfully loaded.
*/
- virtual TInt NotifyLoadPlugin( const THsPublisherInfo& aInfo,
- TAiFwLoadReason aReason ) = 0;
+ virtual void NotifyLoadPlugin( const TAiFwPublisherInfo& aInfo ) = 0;
/**
* Content publisher destroy request.
*
* @since S60 5.2
* @param aInfo Publisher Info, which describes the plugin to be destroyed.
- * @param aReason Shutdown reason, which will be forwarded to the plugin.
*/
- virtual void NotifyDestroyPlugin( const THsPublisherInfo& aInfo,
- TAiFwDestroyReason aReason ) = 0;
+ virtual void NotifyDestroyPlugin( const TAiFwPublisherInfo& aInfo ) = 0;
/**
* Notifies to reload previously released plugins
--- a/idlefw/inc/framework/aistateprovider.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/inc/framework/aistateprovider.h Tue May 11 16:30:05 2010 +0300
@@ -32,7 +32,7 @@
// Forward declarations
class MAiPSPropertyObserver;
class MAiStateObserver;
-class THsPublisherInfo;
+class TAiFwPublisherInfo;
// Class declaration
@@ -150,14 +150,12 @@
/**
* @see MAiFwStateHandler
*/
- TInt LoadPlugin( const THsPublisherInfo& aPublisherInfo,
- TAiFwLoadReason aReason );
+ void LoadPlugin( const TAiFwPublisherInfo& aInfo );
/**
* @see MAiFwStateHandler
*/
- void DestroyPlugin( const THsPublisherInfo& aPublisherInfo,
- TAiFwDestroyReason aReason );
+ void DestroyPlugin( const TAiFwPublisherInfo& aInfo );
/**
* @see MAiFwStateHandler
--- a/idlefw/inc/framework/caicpscommandbuffer.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/inc/framework/caicpscommandbuffer.h Tue May 11 16:30:05 2010 +0300
@@ -160,6 +160,11 @@
* Owned.
*/
RPointerArray<CAiCpsExecuteParam> iPlugins;
+
+private:
+#ifdef _AIFW_UNIT_TEST
+ friend class UT_AiCpsCommandBuffer;
+#endif
};
#endif // C_CAICPSCOMMANDBUFFER_H
--- a/idlefw/plugins/devicestatus/inc/aidevicestatuspluginengine.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/inc/aidevicestatuspluginengine.h Tue May 11 16:30:05 2010 +0300
@@ -61,7 +61,12 @@
public:
// new functions
-
+
+ /**
+ * Refreshes all active publishers.
+ */
+ void RefreshActivePublishersL( TBool aClean );
+
/**
* Resumes all publishers.
*/
--- a/idlefw/plugins/devicestatus/inc/aidevicestatuspublisher.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/inc/aidevicestatuspublisher.h Tue May 11 16:30:05 2010 +0300
@@ -89,6 +89,15 @@
virtual TBool RefreshL( TInt /*aContentId*/, TBool /*aClean*/ ) { return EFalse; }
/**
+ * Refresh publisher if not suspended.
+ *
+ * This has the same effect as the publisher would get content update from system.
+ * Publisher publishes content if it is available.
+ * @param aClean ETrue if current content needs to be cleaned.
+ */
+ virtual void RefreshIfActiveL( TBool /*aClean*/ ) {};
+
+ /**
* Suspends specific content.
*
* Publisher suspends content publishing specified by aContentId.
--- a/idlefw/plugins/devicestatus/inc/aioperatorlogopublisher.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/inc/aioperatorlogopublisher.h Tue May 11 16:30:05 2010 +0300
@@ -69,6 +69,7 @@
MAiPublisherBroadcaster& aBroadcaster );
void RefreshL( TBool aClean );
TBool RefreshL( TInt aContentId, TBool aClean );
+ void RefreshIfActiveL( TBool aClean );
TBool SuspendL( TInt aContentId, TBool aClean );
TBool RefreshContentWithPriorityL( TInt aContentId, TInt aPriority );
--- a/idlefw/plugins/devicestatus/inc/aioperatornamepublisher.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/inc/aioperatornamepublisher.h Tue May 11 16:30:05 2010 +0300
@@ -64,8 +64,10 @@
CHsContentPublisher& aExtension,
MAiPublishPrioritizer& aPrioritizer,
MAiPublisherBroadcaster& aBroadcaster );
+
void RefreshL( TBool aClean );
- TBool RefreshL( TInt aContentId, TBool aClean );
+ TBool RefreshL( TInt aContentId, TBool aClean );
+ void RefreshIfActiveL( TBool aClean );
TBool SuspendL( TInt aContentId, TBool aClean );
TBool RefreshContentWithPriorityL( TInt aContentId, TInt aPriority );
--- a/idlefw/plugins/devicestatus/src/aidevicestatusplugin.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/src/aidevicestatusplugin.cpp Tue May 11 16:30:05 2010 +0300
@@ -53,7 +53,8 @@
// ----------------------------------------------------------------------------
//
CAiDeviceStatusPlugin::CAiDeviceStatusPlugin()
- : iResourceOffset( KErrNotFound )
+ : iResourceOffset( KErrNotFound ),
+ iRequirePublish( EFalse )
{
}
@@ -164,6 +165,8 @@
//
void CAiDeviceStatusPlugin::FreeResources()
{
+ iRequirePublish = EFalse;
+
if( iResourceOffset >= 0 )
{
CCoeEnv* coe = CCoeEnv::Static();
@@ -202,7 +205,8 @@
// ----------------------------------------------------------------------------
//
void CAiDeviceStatusPlugin::Stop( TStopReason /*aReason*/ )
- {
+ {
+ iRequirePublish = EFalse;
}
// ----------------------------------------------------------------------------
@@ -216,10 +220,14 @@
{
if ( iRequirePublish )
{
- TRAP_IGNORE( DoResumeL() );
-
+ TRAP_IGNORE( DoResumeL() );
iRequirePublish = EFalse;
- }
+ }
+ else
+ {
+ TRAP_IGNORE(
+ iEngine->RefreshActivePublishersL( EFalse ) );
+ }
}
}
--- a/idlefw/plugins/devicestatus/src/aidevicestatuspluginengine.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/src/aidevicestatuspluginengine.cpp Tue May 11 16:30:05 2010 +0300
@@ -167,6 +167,25 @@
}
// ----------------------------------------------------------------------------
+// CAiDeviceStatusPluginEngine::RefreshActivePublishersL
+//
+// ----------------------------------------------------------------------------
+//
+void CAiDeviceStatusPluginEngine::RefreshActivePublishersL( TBool aClean )
+ {
+ iContentObserver->StartTransaction( KImplUidDevStaPlugin );
+
+ const TInt count( iPublishers.Count() );
+
+ for ( TInt i( 0 ); i < count; i++ )
+ {
+ iPublishers[i]->RefreshIfActiveL( aClean );
+ }
+
+ iContentObserver->Commit( KImplUidDevStaPlugin );
+ }
+
+// ----------------------------------------------------------------------------
// CAiDeviceStatusPluginEngine::RefreshPublishersL
//
// ----------------------------------------------------------------------------
--- a/idlefw/plugins/devicestatus/src/aioperatorlogopublisher.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/src/aioperatorlogopublisher.cpp Tue May 11 16:30:05 2010 +0300
@@ -171,6 +171,13 @@
iBroadcaster = &aBroadcaster;
}
+void CAiOperatorLogoPublisher::RefreshIfActiveL( TBool aClean )
+ {
+ if ( !iSuspended )
+ {
+ UpdateOperatorLogoL( aClean );
+ }
+ }
void CAiOperatorLogoPublisher::RefreshL( TBool aClean )
{
--- a/idlefw/plugins/devicestatus/src/aioperatornamepublisher.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/devicestatus/src/aioperatornamepublisher.cpp Tue May 11 16:30:05 2010 +0300
@@ -164,6 +164,13 @@
iBroadcaster = &aBroadcaster;
}
+void CAiOperatorNamePublisher::RefreshIfActiveL( TBool aClean )
+ {
+ if ( !iSuspended )
+ {
+ RefreshL( aClean );
+ }
+ }
void CAiOperatorNamePublisher::RefreshL( TBool aClean )
{
@@ -617,7 +624,7 @@
if( !iPeriodic->IsActive() )
{
iPeriodic->Start( KCleanOperationDelay,
- 0,
+ KCleanOperationDelay,
TCallBack( CleanAndShowPLMNOperationCallback, this ) );
}
}
@@ -630,13 +637,18 @@
if( self )
{
- TRAP_IGNORE
- (
- //clean
- self->DoCleanOperationL();
- //show PLMN name
- self->ShowNetworkIdentityNameL( ETrue );
- );
+ self->iPeriodic->Cancel();
+ // check if got suspended while timer was active
+ if ( !self->iSuspended )
+ {
+ TRAP_IGNORE
+ (
+ //clean
+ self->DoCleanOperationL();
+ //show PLMN name
+ self->ShowNetworkIdentityNameL( ETrue );
+ );
+ }
}
return KErrNone;
@@ -648,7 +660,6 @@
iPrioritizer->TryToCleanL( *iBroadcaster,
EAiDeviceStatusContentNetworkIdentity,
EAiServiceProviderName );
- iPeriodic->Cancel();
}
@@ -674,7 +685,7 @@
if ( aContentId == EAiDeviceStatusContentNetworkIdentity )
{
iSuspended = ETrue;
-
+ iPeriodic->Cancel();
return ETrue;
}
--- a/idlefw/plugins/mcsplugin/publisher/src/mcsplugin.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/mcsplugin/publisher/src/mcsplugin.cpp Tue May 11 16:30:05 2010 +0300
@@ -89,7 +89,7 @@
//
CMCSPlugin::~CMCSPlugin()
{
- Release( iContent );
+ Release( iContent );
delete iEngine;
iObservers.Close();
@@ -157,7 +157,12 @@
return;
}
- CMenuItem* item = iEngine->FetchMenuItemL( aData );
+ CMenuItem* item = iEngine->FetchMenuItemL( aData );
+ if ( !item )
+ {
+ User::Leave( KErrNotFound );
+ }
+
CleanupStack::PushL( item );
// One widget item has iDataCount number of elements
--- a/idlefw/plugins/mcsplugin/publisher/src/mcsplugindata.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/mcsplugin/publisher/src/mcsplugindata.cpp Tue May 11 16:30:05 2010 +0300
@@ -75,6 +75,7 @@
// ---------------------------------------------------------------------------
//
CMCSData::CMCSData()
+ :iDirty( ETrue )
{
}
@@ -229,43 +230,67 @@
RPointerArray<CItemMap> settings;
CleanupResetAndDestroyPushL( settings );
- iPluginSettings->GetSettingsL( iInstanceUid, settings );
- TInt count = settings.Count();
+ User::LeaveIfError( iPluginSettings->GetSettingsL( iInstanceUid, settings ) );
+ if ( settings.Count() <= 0 )
+ {
+ User::Leave( KErrNotFound );
+ }
+
TBool wasEmpty = !iData.Count();
- for ( TInt i = 0; i < count; i++ )
+ for ( TInt i = 0; i < settings.Count(); i++ )
{
CItemMap* itemMap = settings[ i ];
+
+ // get properties
RPointerArray<HSPluginSettingsIf::CPropertyMap>& properties
= itemMap->Properties();
+
CMCSData* data = GetMenuDataL( properties );
-
+ CleanupStack::PushL( data );
if ( wasEmpty )
{
// list of shortcut slot was empty
- // we append the shortcut data slots one-by-one to the list
+ // we append the shortcut data slots one-by-one to the list
data->SetDirty( ETrue );
iData.AppendL( data );
+ CleanupStack::Pop( data );
}
else
{
// check for updates in existing shortcut data slot
// if menuitem id has changed, replace the item and
// set as dirty
- TInt id = -1;
- id = iData[ i ]->MenuItem().Id();
+ TInt id( iData[ i ]->MenuItem().Id() );
- if ( data->MenuItem().Id() != id )
+ // id of all bookmarks is zero so name has to be check
+ // in case of bookmark has changed
+ if ( id >= 0 && ( data->MenuItem().Id() != id ||
+ ( id == 0 && data->Name().CompareF(
+ iData[ i ]->Name() ) != 0 ) ) )
{
data->SetDirty( ETrue );
CMCSData* oldData = iData[i];
iData.Remove( i );
delete oldData;
+
iData.InsertL( data, i );
+ CleanupStack::Pop( data );
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy( data );
}
}
}
-
+
+ // Leave if there isn't any data filled into array as there isn't
+ // anything shortcut to publish on homescreen.
+ if ( iData.Count() <= 0 )
+ {
+ User::Leave( KErrNotFound );
+ }
+
// Cleanup.
CleanupStack::PopAndDestroy(); // settings
}
@@ -308,12 +333,18 @@
// Gets the menu item from engine using the setting properties as filter
// ---------------------------------------------------------------------------
//
-CMCSData* CMCSPluginData::GetMenuDataL( RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
+CMCSData* CMCSPluginData::GetMenuDataL(
+ RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
{
+ if ( aProperties.Count() <= 0 )
+ {
+ User::Leave( KErrArgument );
+ }
+
TPtrC8 type;
- TPtrC8 uid;
- TPtrC8 view;
- TPtrC8 param;
+ TPtrC8 uid;
+ TPtrC8 view;
+ TPtrC8 param;
// first we need to check the item type
for ( TInt i = 0; i < aProperties.Count(); i++ )
@@ -495,8 +526,11 @@
if ( aIndex >= 0 && aIndex < settingItems.Count() )
{
CItemMap* itemMap = settingItems[ aIndex ];
- RPointerArray<HSPluginSettingsIf::CPropertyMap> properties;
- properties = itemMap->Properties();
+
+ // get properties
+ RPointerArray<HSPluginSettingsIf::CPropertyMap>& properties
+ = itemMap->Properties();
+
for ( TInt i = 0; i < properties.Count(); i++ )
{
if ( properties[ i ]->Name() == KProperNameType )
--- a/idlefw/plugins/mcsplugin/publisher/src/mcspluginengine.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/mcsplugin/publisher/src/mcspluginengine.cpp Tue May 11 16:30:05 2010 +0300
@@ -213,9 +213,12 @@
StopObserving();
delete iPluginData;
-
+
+ // Notifier close has to be before iMenu close
+ iNotifier.Close();
iMenu.Close();
delete iWatcher;
+ delete iNotifyWatcher;
CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
@@ -320,20 +323,21 @@
//
CMenuItem* CMCSPluginEngine::FetchMenuItemL( CMCSData& aData )
{
+ CMenuItem* item = NULL;
if( aData.MenuItem().Type() == KMenuTypeUrl )
{
- return CreateBkmItemL( aData );
+ item = CreateBkmItemL( aData );
}
else if( aData.MenuItem().Type() == KMenuTypeMailbox )
{
- return CreateMailboxItemL( aData);
+ item = CreateMailboxItemL( aData);
}
else
- {
- CMenuItem* item = NULL;
- TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() ) );
- return item;
+ {
+ item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() );
}
+
+ return item;
}
// ---------------------------------------------------------------------------
--- a/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp Tue May 11 16:30:05 2010 +0300
@@ -202,13 +202,15 @@
RPointerArray<CItemMap> settingItems;
CleanupResetAndDestroyPushL( settingItems );
- iPluginSettings->GetSettingsL( *iPluginId, settingItems );
+ User::LeaveIfError(
+ iPluginSettings->GetSettingsL( *iPluginId, settingItems ) );
for ( TInt i = 0; i < settingItems.Count(); i++ )
{
CItemMap* itemMap = settingItems[i];
- RPointerArray<HSPluginSettingsIf::CPropertyMap> properties;
- properties = itemMap->Properties();
+ // get properties
+ RPointerArray<HSPluginSettingsIf::CPropertyMap>& properties
+ = itemMap->Properties();
TSettingItem item = ItemL( properties );
iSettings.AppendL( item );
}
@@ -312,15 +314,17 @@
RPointerArray<CItemMap> settingItems;
CleanupResetAndDestroyPushL( settingItems );
- iPluginSettings->GetSettingsL( *iPluginId, settingItems );
+ User::LeaveIfError( iPluginSettings->GetSettingsL( *iPluginId, settingItems ) );
if ( aIndex >= 0 && aIndex < settingItems.Count() )
{
TBool exists( EFalse );
CItemMap* itemMap = settingItems[ aIndex ];
- RPointerArray<HSPluginSettingsIf::CPropertyMap> properties;
- properties = itemMap->Properties();
+ // get properties
+ RPointerArray<HSPluginSettingsIf::CPropertyMap>& properties
+ = itemMap->Properties();
+
const TInt KGranularity = 6;
CDesC8Array* propertiesList = new ( ELeave ) CDesC8ArrayFlat( KGranularity );
CleanupStack::PushL( propertiesList );
--- a/idlefw/plugins/sapidataplugin/inc/sapidataobserver.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/sapidataplugin/inc/sapidataobserver.h Tue May 11 16:30:05 2010 +0300
@@ -99,10 +99,16 @@
/**
* Registers to CPS for add, delete , update and execute notifications
- * @aFilter - filter for input parameter list
+ *
+ * @param aFilter filter for input parameter list
+ * @param aRegistry Publisher or content registry
+ * @param aOptions Options for the registration
+ *
* @return void.
*/
- void RegisterL( CLiwDefaultMap* aFilter, const TDesC& aRegistry );
+ void RegisterL( CLiwDefaultMap* aFilter,
+ const TDesC& aRegistry,
+ TUint aOptions = 0 );
/**
* Cancel all the registered notifications.
@@ -115,7 +121,9 @@
/** Interface Reference, not owned */
MLiwInterface* iInterface;
/** Reference of the sapi data, not owned */
- CSapiData* iData;
+ CSapiData* iData;
+ /** Transaction Id */
+ TInt32 iTransactionId;
};
#endif // SAPIDATAOBSERVER_H
--- a/idlefw/plugins/sapidataplugin/inc/sapidataplugin.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/sapidataplugin/inc/sapidataplugin.h Tue May 11 16:30:05 2010 +0300
@@ -59,9 +59,10 @@
*/
enum TPluginStates
{
- ENone,
+ EStopped,
+ EStarted,
EResume,
- ESuspend
+ ESuspend
};
public:
@@ -165,6 +166,12 @@
*/
TBool HasMenuItem( const TDesC16& aMenuItem );
+private:
+ // new functions
+
+ void StartL( TStartReason aReason );
+ void StopL( TStopReason aReason );
+
public:
// new functions
@@ -290,6 +297,8 @@
TPluginNetworkStatus iNetworkStatus;
/** Plugin state */
TPluginStates iPluginState;
+ /** Flag to indicate whether observer is registered */
+ TBool iPubObsRegistered;
};
#endif // SAPIDATAPLUGIN_H
--- a/idlefw/plugins/sapidataplugin/inc/sapidatapluginconst.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/sapidataplugin/inc/sapidatapluginconst.h Tue May 11 16:30:05 2010 +0300
@@ -102,6 +102,8 @@
const TUint KLeftParenthesis = '(';
+// Option for registering in CPS
+const TUint KExtendedNotifications = 0x4000;
// Sapi Data Plugin Constants
const TUint KPluginNameSeprator = '/';
--- a/idlefw/plugins/sapidataplugin/src/sapidata.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/sapidataplugin/src/sapidata.cpp Tue May 11 16:30:05 2010 +0300
@@ -581,6 +581,7 @@
//Create filter criteria for requested entries in form of LIW map:
filter = CreateFilterLC( aObjectId );
}
+
//append type to inparam list
TLiwGenericParam cptype( KType, TLiwVariant( KCpData ) );
inParamList->AppendL( cptype );
@@ -588,18 +589,18 @@
}
filter->InsertL( KActionTrigger, TLiwVariant( triggerName->Des() ) );
- //append filter to input param
+ //append filter to input param
TLiwGenericParam item( KFilter, TLiwVariant( filter ) );
inParamList->AppendL( item );
- iInterface->ExecuteCmdL( KExecuteAction, *inParamList, *outParamList );
-
+ iInterface->ExecuteCmdL( KExecuteAction, *inParamList, *outParamList );
+
CleanupStack::PopAndDestroy( filter );
CleanupStack::PopAndDestroy( triggerName );
item.Reset();
inParamList->Reset();
outParamList->Reset();
-
+
}
// ---------------------------------------------------------------------------
@@ -627,7 +628,8 @@
{
CLiwDefaultMap* conRegFilter = CreateFilterLC();
conRegFilter->InsertL( KOperation, TLiwVariant( KAddUpdateDelete ) );
- iContentObserver->RegisterL( conRegFilter, KCpData() );
+ iContentObserver->RegisterL( conRegFilter, KCpData(),
+ KExtendedNotifications );
CleanupStack::PopAndDestroy( conRegFilter );
}
}
--- a/idlefw/plugins/sapidataplugin/src/sapidataobserver.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/sapidataplugin/src/sapidataobserver.cpp Tue May 11 16:30:05 2010 +0300
@@ -23,6 +23,11 @@
#include "sapidata.h"
#include "sapidataobserver.h"
#include "sapidatapluginconst.h"
+
+// Constants
+_LIT8( KErrorCode, "ErrorCode" );
+_LIT8( KTransactionId, "TransactionID" );
+
// ---------------------------------------------------------------------------
// Constructor
// ---------------------------------------------------------------------------
@@ -47,25 +52,52 @@
// Register for notifications
// ---------------------------------------------------------------------------
//
-void CSapiDataObserver::RegisterL( CLiwDefaultMap* aFilter, const TDesC& aRegistry )
+void CSapiDataObserver::RegisterL( CLiwDefaultMap* aFilter,
+ const TDesC& aRegistry,
+ TUint aOptions )
{
CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
CleanupStack::PushL( inParamList );
+
CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
CleanupStack::PushL( outParamList );
// Fill in input list for RequestNotification command
- inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant(aRegistry)));
- inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant(aFilter)));
+ inParamList->AppendL(
+ TLiwGenericParam( KType, TLiwVariant( aRegistry ) ) );
+
+ inParamList->AppendL(
+ TLiwGenericParam( KFilter ,TLiwVariant( aFilter ) ) );
- TRAP_IGNORE( iInterface->ExecuteCmdL(KRequestNotification,
+ TRAP_IGNORE( iInterface->ExecuteCmdL(
+ KRequestNotification,
*inParamList,
*outParamList,
- 0,
+ aOptions,
this ) );
+
+ TInt pos( 0 );
+
+ const TLiwGenericParam* outParam(
+ outParamList->FindFirst( pos, KErrorCode ) );
- CleanupStack::PopAndDestroy( outParamList );
- CleanupStack::PopAndDestroy( inParamList );
+ if ( outParam )
+ {
+ TInt retval( outParam->Value().AsTInt32() );
+
+ if( retval == KErrNone )
+ {
+ pos = 0;
+ outParam = outParamList->FindFirst( pos, KTransactionId );
+
+ if ( outParam )
+ {
+ iTransactionId = outParam->Value().AsTInt32();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 2, inParamList );
}
// ---------------------------------------------------------------------------
@@ -74,22 +106,29 @@
//
void CSapiDataObserver::ReleaseL()
{
- if( iInterface )
+ if( !iInterface )
{
- CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
- CleanupStack::PushL( inParamList );
- CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
- CleanupStack::PushL( outParamList );
-
- TRAP_IGNORE( iInterface->ExecuteCmdL( KRequestNotification,
- *inParamList,
- *outParamList,
- KLiwOptCancel,
- this ));
-
- CleanupStack::PopAndDestroy( outParamList );
- CleanupStack::PopAndDestroy( inParamList );
+ return;
}
+
+ CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
+ CleanupStack::PushL( inParamList );
+
+ CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
+ CleanupStack::PushL( outParamList );
+
+ inParamList->AppendL( TLiwGenericParam( KTransactionId,
+ TLiwVariant( iTransactionId ) ) );
+
+ TRAP_IGNORE( iInterface->ExecuteCmdL(
+ KRequestNotification,
+ *inParamList,
+ *outParamList,
+ KLiwOptCancel,
+ this ));
+
+
+ CleanupStack::PopAndDestroy( 2, inParamList );
}
// ---------------------------------------------------------------------------
--- a/idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp Tue May 11 16:30:05 2010 +0300
@@ -79,7 +79,7 @@
// ---------------------------------------------------------------------------
//
CSapiDataPlugin::CSapiDataPlugin()
- : iNetworkStatus( EUnknown ), iPluginState( ENone )
+ : iNetworkStatus( EUnknown ), iPluginState( EStopped )
{
}
@@ -121,7 +121,6 @@
iRfs.Close();
}
-
// ---------------------------------------------------------------------------
// Publishes widget's texts and images
// ---------------------------------------------------------------------------
@@ -325,7 +324,6 @@
return id;
}
-
// ---------------------------------------------------------------------------
// Gets type of a content
// ---------------------------------------------------------------------------
@@ -419,23 +417,46 @@
//
void CSapiDataPlugin::Start( TStartReason aReason )
{
- if( aReason == ESystemStartup )
- {
- TRAP_IGNORE( PublishL() );
- TRAP_IGNORE( iData->SetStartupReasonL( KSystemStartup ));
- }
- else if( aReason == EPageStartup )
+ iPluginState = EStarted;
+
+ TRAP_IGNORE( StartL( aReason ) );
+ }
+
+// ----------------------------------------------------------------------------
+// CSapiDataPlugin::StartL
+//
+// ----------------------------------------------------------------------------
+//
+void CSapiDataPlugin::StartL( TStartReason aReason )
+ {
+ // Activate the publisher
+ iData->ChangePublisherStatusL( KActive );
+
+ if ( aReason == ESystemStartup )
{
- TRAP_IGNORE( iData->SetStartupReasonL( KPageStartup ));
+ PublishL();
+ iData->SetStartupReasonL( KSystemStartup );
}
- else if( aReason == EPluginStartup )
+ else if ( aReason == EPageStartup )
{
- TRAP_IGNORE( PublishL() );
- TRAP_IGNORE( iData->SetStartupReasonL( KPluginStartup));
+ iData->SetStartupReasonL( KPageStartup );
+ }
+ else if ( aReason == EPluginStartup )
+ {
+ PublishL();
+ iData->SetStartupReasonL( KPluginStartup );
}
- // Listen for publisher registration to resend the events
- TRAP_IGNORE( iData->RegisterPublisherObserverL() );
+ if ( !iPubObsRegistered )
+ {
+ // Listen for publisher registration to resend the events
+ iData->RegisterPublisherObserverL() ;
+
+ // Execute the active trigger
+ iData->TriggerActiveL();
+
+ iPubObsRegistered = ETrue;
+ }
}
// ----------------------------------------------------------------------------
@@ -445,23 +466,35 @@
//
void CSapiDataPlugin::Stop( TStopReason aReason )
{
- if( aReason == ESystemShutdown )
- {
- TRAP_IGNORE( iData->ChangePublisherStatusL( KSystemShutdown ));
- }
- else if( aReason == EPageShutdown )
+ TRAP_IGNORE( StopL( aReason ) );
+
+ iPluginState = EStopped;
+ }
+
+// ----------------------------------------------------------------------------
+// CSapiDataPlugin::StopL
+//
+// ----------------------------------------------------------------------------
+//
+void CSapiDataPlugin::StopL( TStopReason aReason )
+ {
+ if ( aReason == ESystemShutdown )
{
- TRAP_IGNORE( iData->ChangePublisherStatusL( KPageShutdown ));
+ iData->ChangePublisherStatusL( KSystemShutdown );
}
- else if( aReason == EPluginShutdown )
+ else if ( aReason == EPageShutdown )
{
- TRAP_IGNORE( iData->ChangePublisherStatusL( KPluginShutdown ));
+ iData->ChangePublisherStatusL( KPageShutdown );
+ }
+ else if ( aReason == EPluginShutdown )
+ {
+ iData->ChangePublisherStatusL( KPluginShutdown );
}
if ( iData )
{
- TRAP_IGNORE( iData->ChangePublisherStatusL( KDeActive ));
- }
+ iData->ChangePublisherStatusL( KDeActive );
+ }
}
// ----------------------------------------------------------------------------
@@ -471,7 +504,7 @@
//
void CSapiDataPlugin::Resume( TResumeReason aReason )
{
- if ( aReason == EForeground )
+ if ( aReason == EForeground && iPluginState != EStopped )
{
iPluginState = EResume;
TRAP_IGNORE( iData->ChangePublisherStatusL( KResume ));
@@ -485,7 +518,7 @@
//
void CSapiDataPlugin::Suspend( TSuspendReason aReason )
{
- if ( aReason == EBackground )
+ if ( aReason == EBackground && iPluginState != EStopped )
{
iPluginState = ESuspend;
TRAP_IGNORE( iData->ChangePublisherStatusL( KSuspend ));
@@ -499,7 +532,7 @@
//
void CSapiDataPlugin::SetOnline()
{
- if ( iNetworkStatus != EOnline )
+ if ( iNetworkStatus != EOnline && iPluginState != EStopped )
{
iNetworkStatus = EOnline;
TRAP_IGNORE( iData->ChangePublisherStatusL( KOnLine ));
@@ -513,7 +546,7 @@
//
void CSapiDataPlugin::SetOffline()
{
- if ( iNetworkStatus != EOffline )
+ if ( iNetworkStatus != EOffline && iPluginState != EStopped )
{
iNetworkStatus = EOffline;
TRAP_IGNORE( iData->ChangePublisherStatusL( KOffLine ));
@@ -617,17 +650,9 @@
// Configurations
iData->ConfigureL( configurationItemsArr );
-
- iPluginState = ESuspend;
// Listen the publisher content update
- iData->RegisterContentObserverL();
-
- // Activate the publisher
- iData->ChangePublisherStatusL( KActive );
- // Execute the active trigger
- iData->TriggerActiveL();
-
+ iData->RegisterContentObserverL();
}
contentItemsArr.Reset();
@@ -644,7 +669,7 @@
//
void CSapiDataPlugin::SetProperty( TProperty aProperty, TAny* aAny )
{
- if (aProperty == ECpsCmdBuffer )
+ if ( aProperty == ECpsCmdBuffer )
{
iData->SetCommandBuffer( aAny );
}
--- a/idlefw/plugins/wrtdataplugin/inc/wrtdataobserver.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/wrtdataplugin/inc/wrtdataobserver.h Tue May 11 16:30:05 2010 +0300
@@ -122,7 +122,9 @@
// Reference of the wrt data, not owned */
CWrtData* iData;
/** Call back error code */
- TInt iError;
+ TInt iError;
+ /** Transaction id */
+ TInt32 iTransactionId;
};
#endif // WRTDATAOBSERVER_H
--- a/idlefw/plugins/wrtdataplugin/inc/wrtdataplugin.h Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/wrtdataplugin/inc/wrtdataplugin.h Tue May 11 16:30:05 2010 +0300
@@ -341,6 +341,8 @@
RFs iRfs;
/** Timer for initial data republishing, owned */
CPeriodic* iTimer;
+ /** Flag to indicate if this plugin is stopped */
+ TBool iStopped;
};
#endif // WRTDATAPLUGIN_H
--- a/idlefw/plugins/wrtdataplugin/src/wrtdataobserver.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/wrtdataplugin/src/wrtdataobserver.cpp Tue May 11 16:30:05 2010 +0300
@@ -26,6 +26,9 @@
#include "wrtdataobserver.h"
#include "wrtdatapluginconst.h"
+_LIT8( KErrorCode, "ErrorCode" );
+_LIT8( KTransactionId, "TransactionID" );
+
// ---------------------------------------------------------------------------
// Factory method construction
// ---------------------------------------------------------------------------
@@ -167,12 +170,16 @@
{
CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
CleanupStack::PushL( inParamList );
+
CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
CleanupStack::PushL( outParamList );
// Fill in input list for RequestNotification command
- inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant(KCpData_PubData)));
- inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant(aFilter)));
+ inParamList->AppendL(
+ TLiwGenericParam( KType, TLiwVariant( KCpData_PubData ) ) );
+
+ inParamList->AppendL(
+ TLiwGenericParam( KFilter, TLiwVariant( aFilter ) ) );
iError = KErrNone;
TRAP( iError, iInterface->ExecuteCmdL(
@@ -181,9 +188,29 @@
*outParamList,
0,
this ) );
+
+ TInt pos( 0 );
- CleanupStack::PopAndDestroy( outParamList );
- CleanupStack::PopAndDestroy( inParamList );
+ const TLiwGenericParam* outParam(
+ outParamList->FindFirst( pos, KErrorCode ) );
+
+ if ( outParam )
+ {
+ TInt retval( outParam->Value().AsTInt32() );
+
+ if( retval == KErrNone )
+ {
+ pos = 0;
+ outParam = outParamList->FindFirst( pos, KTransactionId );
+
+ if ( outParam )
+ {
+ iTransactionId = outParam->Value().AsTInt32();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 2, inParamList );
}
// ---------------------------------------------------------------------------
@@ -193,24 +220,28 @@
//
void CWrtDataObserver::ReleaseL()
{
- if( iInterface )
+ if( !iInterface )
{
- CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
- CleanupStack::PushL( inParamList );
- CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
- CleanupStack::PushL( outParamList );
-
- TInt err(KErrNone);
- TRAP(err, iInterface->ExecuteCmdL(
- KRequestNotification,
- *inParamList,
- *outParamList,
- KLiwOptCancel,
- this ));
-
- CleanupStack::PopAndDestroy( outParamList );
- CleanupStack::PopAndDestroy( inParamList );
+ return;
}
+
+ CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
+ CleanupStack::PushL( inParamList );
+
+ CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
+ CleanupStack::PushL( outParamList );
+
+ inParamList->AppendL( TLiwGenericParam( KTransactionId,
+ TLiwVariant( iTransactionId ) ) );
+
+ TRAP_IGNORE( iInterface->ExecuteCmdL(
+ KRequestNotification,
+ *inParamList,
+ *outParamList,
+ KLiwOptCancel,
+ this ) );
+
+ CleanupStack::PopAndDestroy( 2, inParamList );
}
// End of file
--- a/idlefw/plugins/wrtdataplugin/src/wrtdataplugin.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/plugins/wrtdataplugin/src/wrtdataplugin.cpp Tue May 11 16:30:05 2010 +0300
@@ -138,6 +138,8 @@
//
void CWrtDataPlugin::Start( TStartReason aReason )
{
+ iStopped = EFalse;
+
if( aReason == ESystemStartup ||
aReason == EPluginStartup )
{
@@ -158,6 +160,8 @@
{
TRAP_IGNORE(iData->NotifyPublisherL( KDeActive ));
}
+
+ iStopped = ETrue;
}
// ----------------------------------------------------------------------------
@@ -167,7 +171,7 @@
//
void CWrtDataPlugin::Resume( TResumeReason aReason )
{
- if ( aReason == EForeground )
+ if ( aReason == EForeground && !iStopped )
{
iPluginState = EResume;
@@ -182,7 +186,7 @@
//
void CWrtDataPlugin::Suspend( TSuspendReason aReason )
{
- if ( aReason == EBackground )
+ if ( aReason == EBackground && !iStopped )
{
iPluginState = ESuspend;
@@ -197,8 +201,11 @@
//
void CWrtDataPlugin::SetOnline()
{
- iNetworkStatus = EOnline;
- TRAP_IGNORE( iData->NotifyPublisherL( KOnLine ));
+ if ( !iStopped )
+ {
+ iNetworkStatus = EOnline;
+ TRAP_IGNORE( iData->NotifyPublisherL( KOnLine ));
+ }
}
// ----------------------------------------------------------------------------
@@ -208,8 +215,11 @@
//
void CWrtDataPlugin::SetOffline()
{
- iNetworkStatus = EOffline;
- TRAP_IGNORE( iData->NotifyPublisherL( KOffLine ));
+ if ( !iStopped )
+ {
+ iNetworkStatus = EOffline;
+ TRAP_IGNORE( iData->NotifyPublisherL( KOffLine ));
+ }
}
// ----------------------------------------------------------------------------
@@ -365,7 +375,7 @@
//
TBool CWrtDataPlugin::IsActive() const
{
- return iPluginState == EResume;
+ return iPluginState == EResume && !iStopped;
}
// ----------------------------------------------------------------------------
@@ -810,7 +820,7 @@
iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
}
- if ( !iTimer->IsActive() )
+ if ( iTimer && !iTimer->IsActive() )
{
TTimeIntervalMicroSeconds32 delay( KTryAgainDelay );
iTimer->Start( delay, delay, TCallBack( Timeout, this ) );
--- a/idlefw/src/framework/aifw.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/src/framework/aifw.cpp Tue May 11 16:30:05 2010 +0300
@@ -224,6 +224,9 @@
// Create WS pluign manager
iWsPluginManager = CAiWsPluginManager::NewL( env );
+ // Finalise factory construction
+ iFactory->ConstructL();
+
// Start state provider
iStateProvider->StartL( env );
@@ -335,6 +338,9 @@
iWsPluginManager = NULL;
iStateProvider->Stop();
+
+ delete iFactory;
+ iFactory = NULL;
}
}
--- a/idlefw/src/framework/aipluginfactory.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/src/framework/aipluginfactory.cpp Tue May 11 16:30:05 2010 +0300
@@ -21,12 +21,14 @@
// User includes
#include <aisystemuids.hrh>
+#include <aifwpublisherinfo.h>
#include <hscontentpublisher.h>
#include <hspublisherinfo.h>
#include <aicontentobserver.h>
#include <aiuicontroller.h>
#include "caicpscommandbuffer.h"
#include "aiuicontrollermanager.h"
+#include "aistatemanager.h"
#include "aipluginfactory.h"
#include "debug.h"
@@ -37,9 +39,13 @@
const TUid KProfilePluginUid =
{ AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PROFILEPLUGIN };
+const TUid KSapiPluginImplUid = { 0x20019594 };
+const TUid KWrtPluginImplUid = { 0x200286DD };
+
_LIT( KDeviceStatusPluginName, "DeviceStatus" );
_LIT( KProfilePluginName, "Profile" );
+const TInt KQueueStartInterval( 500000 );
// ======== LOCAL FUNCTIONS ========
// ----------------------------------------------------------------------------
@@ -61,6 +67,17 @@
}
// ----------------------------------------------------------------------------
+// IsSapiOrWrt()
+//
+// ----------------------------------------------------------------------------
+//
+TBool IsSapiOrWrt( const THsPublisherInfo& aInfo )
+ {
+ return ( aInfo.Uid() == KSapiPluginImplUid ||
+ aInfo.Uid() == KWrtPluginImplUid );
+ }
+
+// ----------------------------------------------------------------------------
// CleanupResetAndDestroy()
//
// ----------------------------------------------------------------------------
@@ -91,7 +108,8 @@
// ----------------------------------------------------------------------------
//
CAiPluginFactory::CAiPluginFactory( CAiUiControllerManager& aManager )
- : iUiControllerManager( aManager )
+ : CTimer( CActive::EPriorityUserInput - 1 ),
+ iUiControllerManager( aManager ), iAllowFlush( ETrue )
{
}
@@ -102,6 +120,15 @@
//
CAiPluginFactory::~CAiPluginFactory()
{
+ Cancel();
+
+ delete iStarter;
+
+ delete iCommandBuffer;
+
+ iLoadQueue.Reset();
+ iDestroyQueue.Reset();
+
// All publishers should be already deleted from CAiFw::HandleUiShutdown
iPublishers.ResetAndDestroy();
@@ -117,13 +144,7 @@
//
CAiPluginFactory* CAiPluginFactory::NewL( CAiUiControllerManager& aManager )
{
- CAiPluginFactory* self =
- new ( ELeave ) CAiPluginFactory( aManager );
-
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
+ return new ( ELeave ) CAiPluginFactory( aManager );
}
// ----------------------------------------------------------------------------
@@ -132,28 +153,172 @@
// ----------------------------------------------------------------------------
//
void CAiPluginFactory::ConstructL()
- {
+ {
+ ListImplementationsL();
+
+ iCommandBuffer = CAiCpsCommandBuffer::NewL();
+
+ // Ensure interface is available
+ iCommandBuffer->GetCPSInterfaceL();
+
+ CActiveScheduler::Add( this );
+
+ CTimer::ConstructL();
+
+ iStarter = CPeriodic::NewL( CActive::EPriorityIdle );
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::ListImplementationsL()
+//
+// ----------------------------------------------------------------------------
+//
+void CAiPluginFactory::ListImplementationsL()
+ {
+ iEComPlugins.ResetAndDestroy();
+
REComSession::ListImplementationsL(
- KInterfaceUidHsContentPlugin, iEComPlugins );
+ KInterfaceUidHsContentPlugin, iEComPlugins );
}
-
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::LoadPlugin()
+//
// ----------------------------------------------------------------------------
-// CAiPluginFactory::CreatePluginL()
+//
+void CAiPluginFactory::LoadPlugin( const TAiFwPublisherInfo& aInfo )
+ {
+ const THsPublisherInfo& info( aInfo.Info() );
+
+ for ( TInt i = 0; i < iDestroyQueue.Count(); i++ )
+ {
+ if ( iDestroyQueue[i] == info )
+ {
+ iDestroyQueue.Remove( i );
+ break;
+ }
+ }
+
+ if ( IsSapiOrWrt( info ) || IsRecyclable( info ) || !PluginByInfo( info ) )
+ {
+ TBool append( ETrue );
+
+ for ( TInt i = 0; i < iLoadQueue.Count(); i++ )
+ {
+ if ( iLoadQueue[i] == info )
+ {
+ append = EFalse;
+ break;
+ }
+ }
+
+ // Plugin is not in load queue and is not currently loaded
+ if( append )
+ {
+ iLoadQueue.Append( aInfo );
+
+ HandleQueueChanged();
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::DestroyPlugin()
//
// ----------------------------------------------------------------------------
//
-TInt CAiPluginFactory::CreatePlugin(
- const THsPublisherInfo& aPublisherInfo )
+void CAiPluginFactory::DestroyPlugin( const TAiFwPublisherInfo& aInfo )
{
- __PRINTS( "*** CAiPluginFactory::CreatePlugin: Start ***" );
+ const THsPublisherInfo& info( aInfo.Info() );
+
+ for ( TInt i = 0; i < iLoadQueue.Count(); i++ )
+ {
+ if ( iLoadQueue[i] == info )
+ {
+ iLoadQueue[i].Callback( KErrCancel );
+
+ iLoadQueue.Remove( i );
+ break;
+ }
+ }
+
+ if ( PluginByInfo( info ) )
+ {
+ TBool append( ETrue );
+
+ for ( TInt i = 0; i < iDestroyQueue.Count(); i++ )
+ {
+ if ( iDestroyQueue[i] == info )
+ {
+ append = EFalse;
+ break;
+ }
+ }
+
+ // Plugin is not in destroy queue and is currently loaded
+ if ( append )
+ {
+ iDestroyQueue.Append( aInfo );
+
+ HandleQueueChanged();
+ }
+ }
+ }
- if ( IsRecyclable( aPublisherInfo ) )
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::HandleQueueChanged()
+//
+// ----------------------------------------------------------------------------
+//
+void CAiPluginFactory::HandleQueueChanged()
+ {
+ __PRINTS( "CAiPluginFactory::HandleQueueChanged" );
+
+ if ( iLoadQueue.Count() == 0 && iDestroyQueue.Count() == 0 )
+ {
+ __PRINTS( "CAiPluginFactory::HandleQueueChanged - done, queues empty" );
+
+ return;
+ }
+
+ Cancel();
+ iStarter->Cancel();
+
+ __PRINTS( "CAiPluginFactory::HandleQueueChanged, iStarter->Start()" );
+
+ if ( iLoadQueue.Count() == 1 && iDestroyQueue.Count() == 0 &&
+ iLoadQueue[0].Reason() == EAiFwPluginStartup )
{
- CHsContentPublisher* plugin( PluginByUid( aPublisherInfo.Uid() ) );
+ ProcessQueue( this );
+ }
+ else
+ {
+ iStarter->Start( KQueueStartInterval, 0,
+ TCallBack( ProcessQueue, this ) );
+ }
+
+ __PRINTS( "CAiPluginFactory::HandleQueueChanged - done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::DoCreatePlugin()
+//
+// ----------------------------------------------------------------------------
+//
+TInt CAiPluginFactory::DoCreatePlugin(
+ const TAiFwPublisherInfo& aPublisherInfo )
+ {
+ __PRINTS( "*** CAiPluginFactory::DoCreatePlugin: Start ***" );
+
+ const THsPublisherInfo& info( aPublisherInfo.Info() );
+
+ if ( IsRecyclable( info ) )
+ {
+ CHsContentPublisher* plugin( PluginByUid( info.Uid() ) );
if ( plugin )
{
- if ( aPublisherInfo.Namespace() == KNullDesC8 )
+ if ( info.Namespace() == KNullDesC8 )
{
// No namespace available
__PRINTS( "*** CAiPluginFactory::CreatePlugin: Done -\
@@ -162,10 +327,10 @@
}
// Plugin already exists, update its namespace
- THsPublisherInfo& info(
+ THsPublisherInfo& pubinfo(
const_cast< THsPublisherInfo& >( plugin->PublisherInfo() ) );
- info.iNamespace.Copy( aPublisherInfo.Namespace() );
+ pubinfo.iNamespace.Copy( info.Namespace() );
__PRINTS( "*** CAiPluginFactory::CreatePlugin: Done -\
Plugin recycled ***" );
@@ -180,14 +345,14 @@
{
CImplementationInformation* information( iEComPlugins[i] );
- if( information->ImplementationUid().iUid == aPublisherInfo.Uid().iUid )
+ if( information->ImplementationUid() == info.Uid() )
{
implFound = ETrue;
break;
}
}
- if( aPublisherInfo.Namespace() == KNullDesC8 || !implFound )
+ if( info.Namespace() == KNullDesC8 || !implFound )
{
// No namespace available or no ecom implementation available
__PRINTS( "*** CAiPluginFactory::CreatePlugin: Done -\
@@ -196,19 +361,19 @@
return KErrNotSupported;
}
- CHsContentPublisher* plugin( PluginByInfo( aPublisherInfo ) );
+ CHsContentPublisher* plugin( PluginByInfo( info ) );
if( plugin )
{
__PRINTS( "*** CAiPluginFactory::CreatePlugin: Done -\
- Failed to Load Plug-in: KErrAlreadyExists ***" );
+ No need to Load Plug-in: KErrAlreadyExists ***" );
return KErrAlreadyExists;
}
TInt err( KErrNone );
- TRAP( err, CreatePluginL( aPublisherInfo ) );
+ TRAP( err, DoCreatePluginL( aPublisherInfo ) );
__PRINTS( "*** CAiPluginFactory::CreatePlugin: Done - Load Plug-in ***" );
@@ -216,23 +381,37 @@
}
// ----------------------------------------------------------------------------
-// CAiPluginFactory::DestroyPlugin()
+// CAiPluginFactory::DoDestroyPlugin()
//
// ----------------------------------------------------------------------------
//
-void CAiPluginFactory::DestroyPlugin( const THsPublisherInfo& aPublisherInfo )
+void CAiPluginFactory::DoDestroyPlugin(
+ const TAiFwPublisherInfo& aPublisherInfo )
{
- __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Start ***" );
+ __PRINTS( "*** CAiPluginFactory::DoDestroyPlugin: Start ***" );
- if ( IsRecyclable( aPublisherInfo ) )
+ const THsPublisherInfo& info( aPublisherInfo.Info() );
+
+ if ( IsRecyclable( info ) )
{
// Don't destroy recyclable plugin
__PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done - Keeping recyclable Plug-in ***" );
return;
}
-
- CHsContentPublisher* plugin( PluginByInfo( aPublisherInfo ) );
+
+ if ( IsSapiOrWrt( info ) )
+ {
+ if ( aPublisherInfo.Reason() == EAiFwPageShutdown )
+ {
+ // Don't destroy sapi or wrt plugin when page is changed
+ __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done - Keeping SAPI/WRT plugin ***" );
+
+ return;
+ }
+ }
+
+ CHsContentPublisher* plugin( PluginByInfo( info ) );
if ( plugin )
{
@@ -256,51 +435,81 @@
CHsContentPublisher* plugin( PluginByUid( aUid ) );
- while ( plugin )
- {
+ if ( plugin )
+ {
iPublishers.Remove( iPublishers.Find( plugin ) );
__PRINT( __DBG_FORMAT(
- "CAiPluginFactory::DestroyPlugin: name: %S" ), &plugin->PublisherInfo().Name() );
+ "CAiPluginFactory::DestroyPlugin: name: %S" ),
+ &plugin->PublisherInfo().Name() );
delete plugin;
- plugin = NULL;
+ plugin = NULL;
}
__PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done ***" );
}
// ----------------------------------------------------------------------------
-// CAiPluginFactory::CreatePluginL()
+// CAiPluginFactory::DestroyAllPlugins()
//
// ----------------------------------------------------------------------------
//
-void CAiPluginFactory::CreatePluginL(
- const THsPublisherInfo& aPublisherInfo )
+void CAiPluginFactory::DestroyAllPlugins()
{
+ Cancel();
+ iStarter->Cancel();
+
+ iLoadQueue.Reset();
+ iDestroyQueue.Reset();
+
+ for ( TInt i = 0; i < iPublishers.Count(); i++ )
+ {
+ CHsContentPublisher* plugin( iPublishers[i] );
+
+ // Do shutdown state transition
+ iStateManager->StopPlugin( *plugin, EAiFwSystemShutdown );
+ }
+
+ FlushCommandBuffer();
+
+ // Finally get rid of all plugins
+ iPublishers.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::DoCreatePluginL()
+//
+// ----------------------------------------------------------------------------
+//
+void CAiPluginFactory::DoCreatePluginL(
+ const TAiFwPublisherInfo& aPublisherInfo )
+ {
+ const THsPublisherInfo& info( aPublisherInfo.Info() );
+
__PRINT( __DBG_FORMAT( "\t[I]\t Loading plug-in uid=%x name=%S"),
- aPublisherInfo.Uid(), &(aPublisherInfo.Name() ) );
+ info.Uid(), &(info.Name() ) );
iPublishers.ReserveL( iPublishers.Count() + 1 );
CHsContentPublisher* plugin( NULL );
__TIME( "CAiPluginFactory::CreatePluginL Create plug-in:",
- plugin = CHsContentPublisher::NewL( aPublisherInfo ) );
+ plugin = CHsContentPublisher::NewL( info ) );
CleanupStack::PushL( plugin );
- // Ensure interface is available
- iCommandBuffer->GetCPSInterfaceL();
-
- plugin->SetProperty( CHsContentPublisher::ECpsCmdBuffer,
- static_cast< MAiCpsCommandBuffer* >( iCommandBuffer ) );
+ if ( IsSapiOrWrt( info ) )
+ {
+ plugin->SetProperty( CHsContentPublisher::ECpsCmdBuffer,
+ static_cast< MAiCpsCommandBuffer* >( iCommandBuffer ) );
+ }
__TIME( "FW: Subscribe content observers",
- SubscribeContentObserversL( *plugin, aPublisherInfo ) );
+ SubscribePluginL( *plugin, info ) );
__TIME( "FW: Configure Plugin",
- ConfigurePluginL( *plugin, aPublisherInfo ) );
+ ConfigurePluginL( *plugin, info ) );
// Take plugin's ownership
iPublishers.Append( plugin );
@@ -308,11 +517,11 @@
}
// ----------------------------------------------------------------------------
-// CAiPluginFactory::SubscribeContentObserversL()
+// CAiPluginFactory::SubscribePluginL()
//
// ----------------------------------------------------------------------------
//
-void CAiPluginFactory::SubscribeContentObserversL(
+void CAiPluginFactory::SubscribePluginL(
CHsContentPublisher& aContentPublisher,
const THsPublisherInfo& aPublisherInfo )
{
@@ -432,13 +641,136 @@
}
// ----------------------------------------------------------------------------
-// CAiPluginFactory::SetCommandBuffer()
+// CAiPluginFactory::SetStateManager()
+//
+// ----------------------------------------------------------------------------
+//
+void CAiPluginFactory::SetStateManager( CAiStateManager* aStateManager )
+ {
+ iStateManager = aStateManager;
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::FlushCommandBuffer()
+//
+// ----------------------------------------------------------------------------
+//
+void CAiPluginFactory::FlushCommandBuffer()
+ {
+ __PRINTS( "CAiPluginFactory::FlushCommandBuffer" );
+
+ if ( iCommandBuffer && iAllowFlush && !IsActive() )
+ {
+ iCommandBuffer->Flush();
+ }
+
+ __PRINTS( "CAiPluginFactory::FlushCommandBuffer - done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::ProcessQueue()
+//
+// ----------------------------------------------------------------------------
+//
+/* static */ TInt CAiPluginFactory::ProcessQueue( TAny* aAny )
+ {
+ CAiPluginFactory* self = static_cast< CAiPluginFactory* >( aAny );
+
+ self->iStarter->Cancel();
+
+ if ( !self->IsActive() )
+ {
+ self->After( 0 );
+ }
+
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::RunL()
//
// ----------------------------------------------------------------------------
//
-void CAiPluginFactory::SetCommandBuffer( CAiCpsCommandBuffer* aCommandBuffer )
+void CAiPluginFactory::RunL()
{
- iCommandBuffer = aCommandBuffer;
+ __PRINTS( "CAiPluginFactory::RunL" );
+
+ if ( iStarter->IsActive() )
+ {
+ __PRINTS( "CAiPluginFactory::RunL - done, iStarter->IsActive()" );
+
+ return;
+ }
+
+ iAllowFlush = EFalse;
+
+ if ( iDestroyQueue.Count() > 0 )
+ {
+ TAiFwPublisherInfo info( iDestroyQueue[ 0 ] );
+ iDestroyQueue.Remove( 0 );
+
+ // Resolve plugin
+ CHsContentPublisher* plugin( PluginByInfo( info.Info() ) );
+
+ if ( plugin )
+ {
+ // Do shutdown state transition
+ iStateManager->StopPlugin( *plugin, info.Reason() );
+
+ // Destroy plugin
+ DoDestroyPlugin( info );
+ }
+ }
+ else if ( iLoadQueue.Count() > 0 )
+ {
+ TAiFwPublisherInfo info( iLoadQueue[ 0 ] );
+ iLoadQueue.Remove( 0 );
+
+ // Create plugin
+ TInt retval( DoCreatePlugin( info ) );
+
+ if ( retval == KErrNone || retval == KErrAlreadyExists )
+ {
+ CHsContentPublisher* plugin( PluginByInfo( info.Info() ) );
+
+ if( plugin )
+ {
+ // Do startup state transition
+ iStateManager->StartPlugin( *plugin, info.Reason() );
+ }
+ else
+ {
+ retval = KErrNotFound;
+ }
+ }
+
+ info.Callback( retval );
+ }
+
+ iAllowFlush = ETrue;
+
+ After( 0 );
+
+ if ( iLoadQueue.Count() == 0 && iDestroyQueue.Count() == 0 )
+ {
+ __PRINTS( "CAiPluginFactory::RunL - queues now empty" );
+
+ Cancel();
+
+ FlushCommandBuffer();
+ }
+
+ __PRINTS( "CAiPluginFactory::RunL - done" );
+ }
+
+// ----------------------------------------------------------------------------
+// CAiPluginFactory::DoCancel()
+//
+// ----------------------------------------------------------------------------
+//
+void CAiPluginFactory::DoCancel()
+ {
+ __PRINTS( "CAiPluginFactory::DoCancel" );
}
// End of file
--- a/idlefw/src/framework/aistatemanager.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/src/framework/aistatemanager.cpp Tue May 11 16:30:05 2010 +0300
@@ -19,10 +19,7 @@
// User includes
#include <hscontentpublisher.h>
-#include <aifwdefs.h>
-#include <AknWaitDialog.h>
-#include <bautils.h>
-#include <ConeResLoader.h>
+#include <aifwpublisherinfo.h>
#include <debug.h>
#include "caicpscommandbuffer.h"
@@ -36,7 +33,7 @@
//
// ----------------------------------------------------------------------------
//
-static CHsContentPublisher::TStartReason StartReason( TAiFwLoadReason aReason )
+static CHsContentPublisher::TStartReason StartReason( TInt aReason )
{
CHsContentPublisher::TStartReason reason;
@@ -61,7 +58,7 @@
//
// ----------------------------------------------------------------------------
//
-static CHsContentPublisher::TStopReason StopReason( TAiFwDestroyReason aReason )
+static CHsContentPublisher::TStopReason StopReason( TInt aReason )
{
CHsContentPublisher::TStopReason reason;
@@ -113,9 +110,8 @@
// ----------------------------------------------------------------------------
//
CAiStateManager::~CAiStateManager()
- {
- delete iCommandBuffer;
- iReloadPlugins.Close();
+ {
+ iReloadPlugins.Reset();
}
// ----------------------------------------------------------------------------
@@ -134,10 +130,8 @@
// ----------------------------------------------------------------------------
//
void CAiStateManager::ConstructL()
- {
- iCommandBuffer = CAiCpsCommandBuffer::NewL();
-
- iFactory.SetCommandBuffer( iCommandBuffer );
+ {
+ iFactory.SetStateManager( this );
}
// ----------------------------------------------------------------------------
@@ -152,15 +146,15 @@
__PRINTS( "CAiStateManager::NotifyStateChange, aState: EAiFwUiShutdown" );
iFlags.Set( EShutdown );
-
- DestroyPlugins();
+
+ iFactory.DestroyAllPlugins();
return;
}
else if ( aState == EAiFwUiStartup )
{
__PRINTS( "CAiStateManager::NotifyStateChange, aState: EAiFwUiStartup" );
-
+
iFlags.Clear( EShutdown );
return;
@@ -228,6 +222,7 @@
// State change evaluation and state change trial is done always here
__PRINTS( "CAiStateManager::NotifyStateChange, Run state change" );
+
ProcessStateChange( EvaluateNextState() );
}
@@ -236,32 +231,17 @@
//
// ----------------------------------------------------------------------------
//
-TInt CAiStateManager::NotifyLoadPlugin( const THsPublisherInfo& aPublisherInfo,
- TAiFwLoadReason aReason )
+void CAiStateManager::NotifyLoadPlugin( const TAiFwPublisherInfo& aInfo )
{
__PRINT( __DBG_FORMAT(
"CAiStateManager::NotifyLoadPlugin: name: %S, reason: %d " ),
- &aPublisherInfo.Name(), (TInt) aReason );
+ &aInfo.Info().Name(), aInfo.Reason() );
__TIME_MARK( time );
-
- // Create plugin
- TInt retval( iFactory.CreatePlugin( aPublisherInfo ) );
+
+ iFactory.LoadPlugin( aInfo );
- if ( retval == KErrNone )
- {
- CHsContentPublisher* plugin( iFactory.PluginByInfo( aPublisherInfo ) );
-
- if( plugin )
- {
- // Do startup state transition
- StartPlugin( *plugin, StartReason( aReason ) );
- }
- }
-
- __TIME_ENDMARK( "CAiStateManager::NotifyLoadPlugin, construction", time );
-
- return retval;
+ __TIME_ENDMARK( "CAiStateManager::NotifyLoadPlugin - done", time );
}
// ----------------------------------------------------------------------------
@@ -269,46 +249,17 @@
//
// ----------------------------------------------------------------------------
//
-void CAiStateManager::NotifyDestroyPlugin(
- const THsPublisherInfo& aPublisherInfo, TAiFwDestroyReason aReason )
+void CAiStateManager::NotifyDestroyPlugin( const TAiFwPublisherInfo& aInfo )
{
__PRINT( __DBG_FORMAT(
"CAiStateManager::NotifyDestroyPlugin: name: %S, reason: %d " ),
- &aPublisherInfo.Name(), (TInt)aReason );
+ &aInfo.Info().Name(), aInfo.Reason() );
__TIME_MARK( time );
- // Resolve plugin
- CHsContentPublisher* plugin( iFactory.PluginByInfo( aPublisherInfo ) );
-
- if ( plugin )
- {
- // Do shutdown state transition
- StopPlugin( *plugin, StopReason( aReason ) );
-
- // Destroy plugin
- iFactory.DestroyPlugin( aPublisherInfo );
- }
-
- __TIME_ENDMARK( "CAiStateManager::DestroyPlugin, done", time );
- }
-
-// ----------------------------------------------------------------------------
-// CAiStateManager::NotifyReloadPlugins()
-//
-// ----------------------------------------------------------------------------
-//
-void CAiStateManager::NotifyReloadPlugins()
- {
- __PRINTS( "CAiStateManager::NotifyReloadPlugins" );
-
- for ( TInt i = 0; i < iReloadPlugins.Count(); i++ )
- {
- // Reload plugin
- NotifyLoadPlugin( iReloadPlugins[ i ], EAiFwSystemStartup );
- }
-
- __PRINTS( "CAiStateManager::NotifyReloadPlugins, done" );
+ iFactory.DestroyPlugin( aInfo );
+
+ __TIME_ENDMARK( "CAiStateManager::DestroyPlugin - done", time );
}
// ----------------------------------------------------------------------------
@@ -380,14 +331,14 @@
}
}
- FlushCommandBuffer();
+ iFactory.FlushCommandBuffer();
}
else
{
__PRINTS( "CAiStateManager::ProcessStateChange, no state change" );
}
- __TIME_ENDMARK( "CAiStateManager::ProcessStateChange, done", time );
+ __TIME_ENDMARK( "CAiStateManager::ProcessStateChange - done", time );
}
// ----------------------------------------------------------------------------
@@ -415,9 +366,9 @@
}
}
- FlushCommandBuffer();
+ iFactory.FlushCommandBuffer();
- __TIME_ENDMARK( "CAiStateManager::ProcessGeneralThemeChange, done", time );
+ __TIME_ENDMARK( "CAiStateManager::ProcessGeneralThemeChange - done", time );
}
// ----------------------------------------------------------------------------
@@ -452,9 +403,9 @@
}
}
- FlushCommandBuffer();
+ iFactory.FlushCommandBuffer();
- __TIME_ENDMARK( "CAiStateManager::ProcessBackupRestore, done", time );
+ __TIME_ENDMARK( "CAiStateManager::ProcessBackupRestore - done", time );
}
// ----------------------------------------------------------------------------
@@ -482,7 +433,9 @@
}
}
- FlushCommandBuffer();
+ iFactory.FlushCommandBuffer();
+
+ __PRINTS( "CAiStateManager::ProcessOnlineStateChange - done" );
}
// ----------------------------------------------------------------------------
@@ -490,15 +443,14 @@
//
// ----------------------------------------------------------------------------
//
-void CAiStateManager::StartPlugin( CHsContentPublisher& aPlugin,
- CHsContentPublisher::TStartReason aReason )
+void CAiStateManager::StartPlugin( CHsContentPublisher& aPlugin, TInt aReason )
{
const THsPublisherInfo& info( aPlugin.PublisherInfo() );
__PRINT( __DBG_FORMAT(
"CAiStateManager::StartPlugin: name: %S, reason: %d" ), &info.Name(), (TInt)aReason );
- aPlugin.Start( aReason );
+ aPlugin.Start( StartReason( aReason ) );
if ( iCurrentState == EAlive )
{
@@ -525,9 +477,7 @@
aPlugin.SetOffline() );
}
-
- FlushCommandBuffer();
-
+
__PRINTS( "CAiStateManager::StartPlugin - done" );
}
@@ -536,8 +486,7 @@
//
// ----------------------------------------------------------------------------
//
-void CAiStateManager::StopPlugin( CHsContentPublisher& aPlugin,
- CHsContentPublisher::TStopReason aReason )
+void CAiStateManager::StopPlugin( CHsContentPublisher& aPlugin, TInt aReason )
{
const THsPublisherInfo& info( aPlugin.PublisherInfo() );
@@ -551,61 +500,38 @@
aPlugin.Suspend( CHsContentPublisher::EBackground ) );
}
- aPlugin.Stop( aReason );
-
- FlushCommandBuffer();
-
+ aPlugin.Stop( StopReason( aReason ) );
+
__PRINTS( "CAiStateManager::StopPlugin - done" );
}
// ----------------------------------------------------------------------------
-// CAiStateManager::DestroyPlugins()
+// CAiStateManager::NotifyReloadPlugins()
//
// ----------------------------------------------------------------------------
//
-void CAiStateManager::DestroyPlugins()
+void CAiStateManager::NotifyReloadPlugins()
{
- __PRINTS( "CAiStateManager::DestroyPlugins, start" );
- __TIME_MARK( time );
-
- RPointerArray< CHsContentPublisher >& plugins( iFactory.Publishers() );
-
- for ( TInt i = 0; i < plugins.Count(); i++ )
- {
- CHsContentPublisher* plugin( plugins[i] );
+ __PRINTS( "CAiStateManager::NotifyReloadPlugins" );
- // Do shutdown state transition
- StopPlugin( *plugin, CHsContentPublisher::ESystemShutdown );
- }
+ // Factory needs to update its ecom plugins list
+ TRAP_IGNORE( iFactory.ListImplementationsL() );
- FlushCommandBuffer();
+ for ( TInt i = 0; i < iReloadPlugins.Count(); i++ )
+ {
+ TAiFwPublisherInfo info( iReloadPlugins[i],
+ TAiFwCallback(), EAiFwSystemStartup );
+
+ // Reload plugin
+ NotifyLoadPlugin( info );
+ }
- // Finally get rid of all plugins
- plugins.ResetAndDestroy();
+ iReloadPlugins.Reset();
- __TIME_ENDMARK( "CAiStateManager::DestroyPlugins, done", time );
+ __PRINTS( "CAiStateManager::NotifyReloadPlugins - done" );
}
// ----------------------------------------------------------------------------
-// CAiStateManager::FlushCommandBuffer();()
-//
-// ----------------------------------------------------------------------------
-//
-void CAiStateManager::FlushCommandBuffer()
- {
- __PRINTS( "CAiStateManager::FlushCommandBuffer, start" );
-
- if ( iCommandBuffer )
- {
- __TIME( "CAiStateManager::FlushCommandBuffer, flush",
-
- iCommandBuffer->Flush() );
- }
-
- __PRINTS( "CAiStateManager::FlushCommandBuffer - done" );
- }
-
-// ----------------------------------------------------------------------------
// CAiStateManager::NotifyReleasePlugins()
//
// ----------------------------------------------------------------------------
@@ -616,18 +542,36 @@
iReloadPlugins.Reset();
+ TBool flush( EFalse );
+
for ( TInt i = 0; i < aUidList.Count(); i++ )
{
- CHsContentPublisher* plugin = iFactory.PluginByUid( aUidList[ i ] );
- if ( plugin )
+ const TUid& uid( aUidList[ i ] );
+
+ CHsContentPublisher* plugin( iFactory.PluginByUid( uid ) );
+
+ while ( plugin )
{
StopPlugin( *plugin, CHsContentPublisher::ESystemShutdown );
- THsPublisherInfo info = plugin->PublisherInfo();
+
+ const THsPublisherInfo& info( plugin->PublisherInfo() );
iReloadPlugins.Append( info );
- iFactory.DestroyPlugin( aUidList[ i ] );
+
+ iFactory.DestroyPlugin( uid );
+
+ flush = ETrue;
+
+ // Get next plugin with same uid
+ plugin = iFactory.PluginByUid( uid );
}
- }
- __PRINTS( "CAiStateManager::NotifyReleasePlugins: return void" );
+ }
+
+ if ( flush )
+ {
+ iFactory.FlushCommandBuffer();
+ }
+
+ __PRINTS( "CAiStateManager::NotifyReleasePlugins - done" );
}
-
+
// End of file
--- a/idlefw/src/framework/aistateprovider.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/idlefw/src/framework/aistateprovider.cpp Tue May 11 16:30:05 2010 +0300
@@ -251,8 +251,10 @@
void CAiStateProvider::NotifyEcomRegistryChanged()
{
__PRINTS( "CAiStateProvider::NotifyEcomRegistryChanged" );
+
iObserver.NotifyReloadPlugins();
- __PRINTS( "CAiStateProvider::NotifyEcomRegistryChanged - return void" );
+
+ __PRINTS( "CAiStateProvider::NotifyEcomRegistryChanged - done" );
}
// ----------------------------------------------------------------------------
@@ -260,10 +262,9 @@
//
// ----------------------------------------------------------------------------
//
-TInt CAiStateProvider::LoadPlugin( const THsPublisherInfo& aPublisherInfo,
- TAiFwLoadReason aReason )
+void CAiStateProvider::LoadPlugin( const TAiFwPublisherInfo& aInfo )
{
- return iObserver.NotifyLoadPlugin( aPublisherInfo, aReason );
+ iObserver.NotifyLoadPlugin( aInfo );
}
// ----------------------------------------------------------------------------
@@ -271,10 +272,9 @@
//
// ----------------------------------------------------------------------------
//
-void CAiStateProvider::DestroyPlugin( const THsPublisherInfo& aPublisherInfo,
- TAiFwDestroyReason aReason )
+void CAiStateProvider::DestroyPlugin( const TAiFwPublisherInfo& aInfo )
{
- iObserver.NotifyDestroyPlugin( aPublisherInfo, aReason );
+ iObserver.NotifyDestroyPlugin( aInfo );
}
// ----------------------------------------------------------------------------
@@ -328,12 +328,15 @@
{
CAiStateProvider* self = static_cast< CAiStateProvider* >( aAny );
- RArray<TUid> uidList;
- if ( KErrNone == Swi::GetAllUids( uidList ) )
+ RArray< TUid > list;
+
+ if ( Swi::GetAllUids( list ) == KErrNone )
{
- self->iObserver.NotifyReleasePlugins( uidList );
+ self->iObserver.NotifyReleasePlugins( list );
}
+ list.Reset();
+
return KErrNone;
}
--- a/menucontentsrv/handlersrc/menuuninstalloperation.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/menucontentsrv/handlersrc/menuuninstalloperation.cpp Tue May 11 16:30:05 2010 +0300
@@ -33,7 +33,33 @@
const TUid KMidletType = { 0x10210E26 };
-// ================= MEMBER FUNCTIONS =======================
+
+// ========================= LOCAL FUNCTIONS ===============
+
+// ---------------------------------------------------------
+// CleanupResetAndDestroy()
+// ---------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroy( TAny* aObj )
+ {
+ if( aObj )
+ {
+ static_cast<T*>( aObj )->ResetAndDestroy();
+ }
+ }
+
+// ---------------------------------------------------------
+// CleanupResetAndDestroyPushL
+// ---------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroyPushL(T& aArray)
+ {
+ CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
+ }
+
+// ========================= MEMBER FUNCTIONS ==============
// ---------------------------------------------------------
// CMenuUninstallOperation::~CMenuUninstallOperation
@@ -217,7 +243,7 @@
iSisRegSession.InstalledUidsL( packageIds );
RPointerArray< HBufC > packageFiles;
- CleanupClosePushL( packageFiles );
+ CleanupResetAndDestroyPushL( packageFiles );
for( TInt i = 0; i < packageIds.Count() && !found; ++i )
{
@@ -239,7 +265,6 @@
found = ETrue;
}
}
- packageFiles.ResetAndDestroy();
CleanupStack::PopAndDestroy( &packageEntry );
}
}
--- a/menucontentsrv/srvsrc/menusrvobjectfilter.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/menucontentsrv/srvsrc/menusrvobjectfilter.cpp Tue May 11 16:30:05 2010 +0300
@@ -55,9 +55,20 @@
if ( haveAttr )
{
__ASSERT_DEBUG( needAttr, User::Invariant() ); // Checked above.
- if ( needVal != haveVal )
+ //we want co compare uid case onsensitive
+ if( !name.Compare( KMenuAttrUid() ) )
{
- return EFalse;
+ if ( needVal.CompareF( haveVal ) )
+ {
+ return EFalse;
+ }
+ }
+ else
+ {
+ if ( needVal.Compare( haveVal ) )
+ {
+ return EFalse;
+ }
}
}
}
--- a/xcfw/src/xcfwengine.cpp Tue Apr 27 16:57:49 2010 +0300
+++ b/xcfw/src/xcfwengine.cpp Tue May 11 16:30:05 2010 +0300
@@ -879,9 +879,11 @@
if ( obj )
{
CleanupStack::PushL( obj );
-
+
factory->InitializeObjectL( *this );
-
+
+ CleanupStack::Pop( obj );
+
if ( !iCurrentTreeNode )
{
//Adding root.
@@ -892,8 +894,6 @@
//add under certain parent.
iCurrentTreeNode = iTree->AddNodeL( obj, iCurrentTreeNode );
}
-
- CleanupStack::Pop( obj );
}
else
{