diff -r 36d367c62acb -r 76f25fb7a6a1 servicewidget/servicewidgetdatapublisher/src/cservicewidgetcontentpublisher.cpp --- a/servicewidget/servicewidgetdatapublisher/src/cservicewidgetcontentpublisher.cpp Tue May 11 16:01:07 2010 +0300 +++ b/servicewidget/servicewidgetdatapublisher/src/cservicewidgetcontentpublisher.cpp Tue May 25 12:27:36 2010 +0300 @@ -30,6 +30,9 @@ #include #include +#include +#include + #define KSW_LIST_GRANULARITY 8 // --------------------------------------------------------------------------- @@ -329,9 +332,23 @@ // CServiceWidgetContentPublisher::UnregisterAllWidgetsL // --------------------------------------------------------------------------- // -void CServiceWidgetContentPublisher::UnregisterAllWidgetsL() +void CServiceWidgetContentPublisher::UnregisterAllWidgetsL(RArray* aServiceArray) { TRACE_SWP(TXT("CServiceWidgetContentPublisher::UnregisterAllWidgetsL() start") ); + CDesC16ArrayFlat* servicesExisting = new (ELeave) CDesC16ArrayFlat( KSW_LIST_GRANULARITY ); + CleanupStack::PushL( servicesExisting ); + if(aServiceArray && aServiceArray->Count() > 0) + { + CSPSettings* settings = CSPSettings::NewLC(); + for(TInt i=0; iCount();i++) + { + CSPEntry* entry = CSPEntry::NewLC(); + settings->FindEntryL( (*aServiceArray)[i], *entry ) ; + servicesExisting->AppendL(entry->GetServiceName()); + CleanupStack::PopAndDestroy(entry); + } + CleanupStack::PopAndDestroy(settings); + } CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); @@ -351,9 +368,8 @@ if(outparam) { - TInt pos(0); - const TLiwGenericParam* param = NULL; - param = outparam->FindFirst(pos,KResults); + TInt pos(0); + outparam->FindFirst(pos,KResults); if(pos != KErrNotFound) { HBufC* uidStr = KThemeUid().AllocLC(); @@ -377,7 +393,24 @@ { //If publisher id has KThemeUid, then this services is //registered by this component - serviceNames->AppendL(variant.AsDes()); + TBool serviceExisting = EFalse; + if(servicesExisting && servicesExisting->Count() > 0) + { + for(TInt i=0; iCount(); i++) + { + TPtrC serviceName; + serviceName.Set(variant.AsDes().Left(variant.AsDes().Length()-KThemeUid().Length())); + if(serviceName.Compare((*servicesExisting)[i]) == 0) + { + serviceExisting = ETrue; + break; + } + } + } + if(!serviceExisting) + { + serviceNames->AppendL(variant.AsDes()); + } } } } @@ -396,7 +429,8 @@ } CleanupStack::PopAndDestroy(serviceNames); - CleanupStack::PopAndDestroy(cpdatamap); + CleanupStack::PopAndDestroy(cpdatamap); + CleanupStack::PopAndDestroy(servicesExisting); outparam->Reset(); inparam->Reset();