1964 |
1978 |
1965 TPckg<TUint32> uidDes(uid); |
1979 TPckg<TUint32> uidDes(uid); |
1966 aMessage.WriteL(1, uidDes); |
1980 aMessage.WriteL(1, uidDes); |
1967 } |
1981 } |
1968 |
1982 |
1969 TBool CScrRequestImpl::GetIntSoftwareTypeDataForComponentLC(TComponentId aComponentId, const TDesC& aColumnName, TInt& aValue) const |
1983 TBool CScrRequestImpl::GetSifPluginUidIInternalL(TInt aSoftwareTypeId, TInt& aValue) const |
1970 { |
1984 { |
1971 _LIT(KSelectComponents, "SELECT SoftwareTypeId FROM Components WHERE ComponentId=?;"); |
1985 TBool found = EFalse; |
1972 TBool found = EFalse; |
1986 |
1973 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectComponents); |
1987 _LIT(KSelectSifPluginUid, "SELECT SifPluginUid FROM SoftwareTypes WHERE SoftwareTypeId=?;"); |
1974 stmt->BindIntL(1, aComponentId); |
1988 CStatement* stmt = iDbHandle->PrepareStatementLC(KSelectSifPluginUid); |
1975 if(!stmt->ProcessNextRowL()) |
1989 stmt->BindIntL(1, aSoftwareTypeId); |
1976 { |
1990 |
1977 DEBUG_PRINTF2(_L("Component Id (%d) doesn't exist in the SCR database!"), aComponentId); |
1991 if(stmt->ProcessNextRowL()) |
1978 User::LeaveIfError(KErrNotFound); |
1992 { |
1979 } |
1993 aValue = stmt->IntColumnL(0); |
1980 TInt swTypeId = stmt->IntColumnL(0); |
1994 found = ETrue; |
|
1995 } |
1981 CleanupStack::PopAndDestroy(stmt); |
1996 CleanupStack::PopAndDestroy(stmt); |
1982 |
|
1983 _LIT(KSelectSoftwareTypes, "SELECT %S FROM SoftwareTypes WHERE SoftwareTypeId=?;"); |
|
1984 HBufC *statementStr = FormatStatementLC(KSelectSoftwareTypes(), aColumnName.Length(), &aColumnName); |
|
1985 CStatement *stmtSwType = iDbHandle->PrepareStatementLC(*statementStr); |
|
1986 stmtSwType->BindIntL(1, swTypeId); |
|
1987 |
|
1988 if(stmtSwType->ProcessNextRowL()) |
|
1989 { |
|
1990 aValue = stmtSwType->IntColumnL(0); |
|
1991 found = ETrue; |
|
1992 } |
|
1993 CleanupStack::PopAndDestroy(2, statementStr); // statementStr, stmtSwType |
|
1994 return found; |
1997 return found; |
1995 } |
1998 } |
1996 |
1999 |
1997 TBool CScrRequestImpl::GetInstallerSidForComponentL(TComponentId aComponentId, TSecureId& aSid) const |
2000 TBool CScrRequestImpl::GetSidsForSoftwareTypeIdL(TInt aSoftwareTypeId, RArray<TSecureId>& aSids) const |
1998 { |
2001 { |
1999 _LIT(KInstallerSecureId, "InstallerSecureId"); |
2002 TBool found = EFalse; |
2000 TInt secureIdInt (0); |
2003 |
2001 TBool found = GetIntSoftwareTypeDataForComponentLC(aComponentId, KInstallerSecureId, secureIdInt); |
2004 _LIT(KSelectSecureIds, "SELECT SecureId FROM CustomAccessList WHERE SoftwareTypeId=?;"); |
2002 aSid.iId = secureIdInt; |
2005 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectSecureIds); |
2003 return found; |
2006 stmt->BindIntL(1, aSoftwareTypeId); |
2004 } |
2007 |
2005 |
2008 aSids.Reset(); |
2006 TBool CScrRequestImpl::GetExecutionEnvSidForComponentL(TComponentId aComponentId, TSecureId& aSid) const |
2009 while(stmt->ProcessNextRowL()) |
2007 { |
2010 { |
2008 _LIT(KExecutionLayerSecureId, "ExecutionLayerSecureId"); |
2011 aSids.AppendL(stmt->IntColumnL(0)); |
2009 TInt secureIdInt(0); |
2012 found = ETrue; |
2010 TBool found = GetIntSoftwareTypeDataForComponentLC(aComponentId, KExecutionLayerSecureId, secureIdInt); |
2013 } |
2011 aSid.iId = secureIdInt; |
2014 |
2012 return found; |
2015 CleanupStack::PopAndDestroy(stmt); |
2013 } |
2016 return found; |
|
2017 } |
|
2018 |
|
2019 TBool CScrRequestImpl::GetInstallerOrExecutionEnvSidsForComponentL(TComponentId aComponentId, RArray<TSecureId>& aSids) const |
|
2020 { |
|
2021 // Get the software type id for the component |
|
2022 TInt swTypeId = GetSoftwareTypeForComponentL(aComponentId); |
|
2023 // Retrieve the Sids for the type id |
|
2024 return GetSidsForSoftwareTypeIdL(swTypeId, aSids); |
|
2025 } |
2014 |
2026 |
2015 TBool CScrRequestImpl::IsInstallerOrExecutionEnvSidL(TSecureId& aSid) const |
2027 TBool CScrRequestImpl::IsInstallerOrExecutionEnvSidL(TSecureId& aSid) const |
2016 { |
2028 { |
2017 _LIT(KSelectStatement, "SELECT InstallerSecureId FROM SoftwareTypes WHERE InstallerSecureId=? OR ExecutionLayerSecureId=?;"); |
2029 _LIT(KSelectStatement, "SELECT SecureId FROM CustomAccessList WHERE SecureId=? AND AccessMode=?;"); |
2018 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectStatement); |
2030 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectStatement); |
2019 stmt->BindIntL(1, aSid); |
2031 stmt->BindIntL(1, aSid); |
2020 stmt->BindIntL(2, aSid); |
2032 stmt->BindIntL(2, (TInt)ETransactionalSid); |
2021 TBool res = ETrue; |
2033 TBool res = ETrue; |
2022 if(!stmt->ProcessNextRowL()) |
2034 if(!stmt->ProcessNextRowL()) |
2023 { |
2035 { |
2024 DEBUG_PRINTF2(_L("%d is not an installer SID"), TUint32(aSid)); |
2036 DEBUG_PRINTF2(_L("%d is not an installer or execution environment SID"), TUint32(aSid)); |
2025 res = EFalse; |
2037 res = EFalse; |
2026 } |
2038 } |
2027 CleanupStack::PopAndDestroy(stmt); |
2039 CleanupStack::PopAndDestroy(stmt); |
2028 return res; |
2040 return res; |
2029 } |
2041 } |
2030 |
2042 |
2031 void CScrRequestImpl::GetPluginUidWithComponentIdL(const RMessage2& aMessage) const |
2043 void CScrRequestImpl::GetPluginUidWithComponentIdL(const RMessage2& aMessage) const |
2032 { |
2044 { |
2033 TComponentId componentId = GetComponentIdFromMsgL(aMessage); |
2045 TComponentId componentId = GetComponentIdFromMsgL(aMessage); |
2034 DEBUG_PRINTF2(_L8("Returning the plugin of component(%d)."), componentId); |
2046 DEBUG_PRINTF2(_L8("Returning the plugin of component(%d)."), componentId); |
2035 _LIT(KSifPluginUid, "SifPluginUid"); |
2047 |
|
2048 // Get the software type id for the component |
|
2049 TInt swTypeId = GetSoftwareTypeForComponentL(componentId); |
|
2050 |
2036 TInt uid (0); |
2051 TInt uid (0); |
2037 TBool found = GetIntSoftwareTypeDataForComponentLC(componentId, KSifPluginUid, uid); |
2052 TBool found = GetSifPluginUidIInternalL(swTypeId, uid); |
2038 __ASSERT_ALWAYS(found, User::Leave(KErrNotFound)); |
2053 __ASSERT_ALWAYS(found, User::Leave(KErrNotFound)); |
2039 |
2054 |
2040 TPckg<TUint32> uidDes(uid); |
2055 TPckg<TUint32> uidDes(uid); |
2041 aMessage.WriteL(1, uidDes); |
2056 aMessage.WriteL(1, uidDes); |
2042 } |
2057 } |
2043 |
2058 |
2044 // This function returns whether the SID looked up has been found in the software types table. |
2059 // This function returns whether the SID looked up has been found in the software types table. |
2045 TBool CScrRequestImpl::GetSidsForSoftwareTypeL(const HBufC* aSoftwareTypeName, TSecureId& aInstallerSid, TSecureId& aExecutableEnvSid) const |
2060 TBool CScrRequestImpl::GetSidsForSoftwareTypeL(const HBufC* aSoftwareTypeName, RArray<TSecureId>& aSids) const |
2046 { |
2061 { |
2047 DEBUG_PRINTF2(_L("Returning SIDs for software type(%S)."), aSoftwareTypeName); |
2062 DEBUG_PRINTF2(_L("Returning SIDs for software type(%S)."), aSoftwareTypeName); |
2048 TBool found = EFalse; |
2063 |
2049 TUint32 swTypeId = HashCaseSensitiveL(*aSoftwareTypeName); |
2064 TUint32 swTypeId = HashCaseSensitiveL(*aSoftwareTypeName); |
2050 |
2065 return GetSidsForSoftwareTypeIdL(swTypeId, aSids); |
2051 _LIT(KSelectStatement, "SELECT ExecutionLayerSecureId, InstallerSecureId FROM SoftwareTypes WHERE SoftwareTypeId =?;"); |
2066 } |
2052 CStatement* stmt = iDbHandle->PrepareStatementLC(KSelectStatement); |
2067 |
2053 stmt->BindIntL(1, swTypeId); |
2068 TBool CScrRequestImpl::CheckIfAppUidExistsL(const TUid aAppUid) const |
2054 |
2069 { |
2055 if(stmt->ProcessNextRowL()) |
2070 DEBUG_PRINTF(_L8("Check if the given application UID exists.")); |
2056 { |
2071 TUid retrievedAppUid; |
2057 aExecutableEnvSid = stmt->IntColumnL(0); |
2072 _LIT(KSelectColumn, "AppUid"); |
2058 aInstallerSid = stmt->IntColumnL(1); |
2073 _LIT(KTable, "AppRegistrationInfo"); |
2059 found = ETrue; |
2074 _LIT(KConditionColumn, "AppUid"); |
2060 } |
2075 if(GetIntforConditionL(KSelectColumn, KTable, KConditionColumn, aAppUid.iUid, (TInt&)retrievedAppUid.iUid)) |
2061 |
2076 { |
2062 CleanupStack::PopAndDestroy(stmt); |
2077 return ETrue; |
2063 return found; |
2078 } |
2064 } |
2079 return EFalse ; |
2065 |
2080 } |
|
2081 |
|
2082 void CScrRequestImpl::SetLocaleForRegInfoForApplicationSubsessionContextL(const RMessage2& aMessage, CRegInfoForApplicationSubsessionContext *aSubsessionContext) |
|
2083 { |
|
2084 TLanguage appLocale= (TLanguage)aMessage.Int1(); |
|
2085 TUid appUid; |
|
2086 appUid.iUid=aMessage.Int0(); |
|
2087 if(!GetNearestAppLanguageL(appLocale,appUid, aSubsessionContext->iAppLanguageForCurrentLocale)) |
|
2088 { |
|
2089 if (KUnspecifiedLocale!=appLocale) |
|
2090 { |
|
2091 DEBUG_PRINTF2(_L8("Given Locale %d is not supported by application"),appLocale); |
|
2092 User::Leave(KErrNotFound); |
|
2093 } |
|
2094 } |
|
2095 } |
|
2096 |
|
2097 void CScrRequestImpl::GetServiceUidSizeL(const RMessage2& aMessage,TUid aAppUid, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
2098 { |
|
2099 TUid uid; |
|
2100 _LIT(KSelectServiceUidWithAppUid, "SELECT Uid FROM ServiceInfo WHERE AppUid =?;"); |
|
2101 CStatement* stmt = iDbHandle->PrepareStatementLC(KSelectServiceUidWithAppUid); |
|
2102 stmt->BindIntL(1, aAppUid.iUid); |
|
2103 aSubsessionContext->iServiceUidList.Close(); |
|
2104 while(stmt->ProcessNextRowL()) |
|
2105 { |
|
2106 uid.iUid = stmt->IntColumnL(0); |
|
2107 aSubsessionContext->iServiceUidList.Append(uid); |
|
2108 } |
|
2109 if(aSubsessionContext->iServiceUidList.Count() == 0) |
|
2110 { |
|
2111 DEBUG_PRINTF2(_L8("No service ids correspond to the given AppUid,%d"),aAppUid); |
|
2112 } |
|
2113 CleanupStack::PopAndDestroy(stmt); |
|
2114 WriteArraySizeL(aMessage, 1, aSubsessionContext->iServiceUidList); |
|
2115 } |
|
2116 |
|
2117 void CScrRequestImpl::GetServiceUidDataL(const RMessage2& aMessage, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
2118 { |
|
2119 WriteArrayDataL(aMessage, 0, aSubsessionContext->iServiceUidList); |
|
2120 aSubsessionContext->iServiceUidList.Close(); |
|
2121 } |
|
2122 |
|
2123 void CScrRequestImpl::GetApplicationLanguageL(const RMessage2& aMessage, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
2124 { |
|
2125 DEBUG_PRINTF(_L8("Returning the Application Language .")); |
|
2126 TPckg<TLanguage> applicationLanguage (aSubsessionContext->iAppLanguageForCurrentLocale); |
|
2127 aMessage.WriteL(0, applicationLanguage); |
|
2128 } |
|
2129 |
|
2130 void CScrRequestImpl::GetDefaultScreenNumberL(const RMessage2& aMessage,TUid aAppUid) const |
|
2131 { |
|
2132 DEBUG_PRINTF(_L8("Returning the default screen number.")); |
|
2133 |
|
2134 TInt screenNumber=0; |
|
2135 _LIT(KSelectColumn, "DefaultScreenNumber"); |
|
2136 _LIT(KTable, "AppRegistrationInfo"); |
|
2137 _LIT(KConditionColumn, "AppUid"); |
|
2138 |
|
2139 GetIntforConditionL(KSelectColumn(),KTable(),KConditionColumn(),aAppUid.iUid, screenNumber); |
|
2140 { |
|
2141 TPckg<TInt> screenNumberDes(screenNumber); |
|
2142 aMessage.WriteL(0, screenNumberDes); |
|
2143 } |
|
2144 } |
|
2145 |
|
2146 void CScrRequestImpl::GetNumberOfOwnDefinedIconsL(const RMessage2& aMessage,TUid aAppUid , CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
2147 { |
|
2148 DEBUG_PRINTF(_L8("Returning the no of own defined Icons count ")); |
|
2149 TInt numberOfIcons; |
|
2150 _LIT(KSelectNoOfIcones, "SELECT NumberOfIcons FROM CaptionAndIconInfo WHERE CaptionAndIconId IN (SELECT CaptionAndIconId FROM LocalizableAppInfo WHERE AppUid= ? AND Locale = ?);"); |
|
2151 CStatement* stmt = iDbHandle->PrepareStatementLC(KSelectNoOfIcones); |
|
2152 stmt->BindIntL(1, aAppUid.iUid); |
|
2153 stmt->BindIntL(2, aSubsessionContext->iAppLanguageForCurrentLocale); |
|
2154 if(stmt->ProcessNextRowL()) |
|
2155 { |
|
2156 numberOfIcons = stmt->IntColumnL(0); |
|
2157 TPckg<TInt> numberOfIconsDes(numberOfIcons); |
|
2158 aMessage.WriteL(0, numberOfIconsDes); |
|
2159 } |
|
2160 CleanupStack::PopAndDestroy(stmt); |
|
2161 } |
|
2162 |
|
2163 void CScrRequestImpl::GetAppForDataTypeAndServiceL(const RMessage2& aMessage) const |
|
2164 { |
|
2165 DEBUG_PRINTF(_L8("Returns the App Uid for a given Service Uid that handles the specified datatype with the highest priority.")); |
|
2166 HBufC *dataType = ReadDescLC(aMessage,0); |
|
2167 TUid inputServiceUid = TUid::Uid(aMessage.Int1()); |
|
2168 |
|
2169 _LIT(KSelectAppUidsForGivenUidAndDataType, "SELECT AppUid FROM (ServiceInfo JOIN DataType ON ServiceInfo.ServiceId = DataType.ServiceId) WHERE Uid=? AND Type=? ORDER BY Priority DESC;"); |
|
2170 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppUidsForGivenUidAndDataType); |
|
2171 stmt->BindIntL(1, inputServiceUid.iUid); |
|
2172 stmt->BindStrL(2, *dataType); |
|
2173 |
|
2174 if(stmt->ProcessNextRowL()) |
|
2175 { |
|
2176 TPckg<TInt> appUidDes(stmt->IntColumnL(0)); |
|
2177 aMessage.WriteL(2, appUidDes); |
|
2178 CleanupStack::PopAndDestroy(2, dataType); //stmt, dataType |
|
2179 } |
|
2180 else |
|
2181 { |
|
2182 DEBUG_PRINTF(_L("No AppUid for given datatype and Service Uid")); |
|
2183 CleanupStack::PopAndDestroy(2, dataType); //stmt, dataType |
|
2184 User::Leave(KErrNotFound); |
|
2185 } |
|
2186 } |
|
2187 |
|
2188 void CScrRequestImpl::GetAppForDataTypeL(const RMessage2& aMessage) const |
|
2189 { |
|
2190 DEBUG_PRINTF(_L8("Returning the app UID.")); |
|
2191 |
|
2192 TUid appUid = TUid::Null(); |
|
2193 HBufC *type = ReadDescLC(aMessage, 0); |
|
2194 TInt serviceId = GetServiceIdForDataTypeL(*type); |
|
2195 |
|
2196 if(serviceId == KErrNotFound) |
|
2197 { |
|
2198 DEBUG_PRINTF(_L("No Service Id for the given datatype")); |
|
2199 User::Leave(KErrNotFound); |
|
2200 } |
|
2201 |
|
2202 CleanupStack::PopAndDestroy(type); |
|
2203 if(!GetAppUidForServiceIdL(serviceId, appUid)) |
|
2204 { |
|
2205 DEBUG_PRINTF(_L("No AppUid for given datatype")); |
|
2206 } |
|
2207 TPckg<TUid> appUidDes(appUid); |
|
2208 aMessage.WriteL(1, appUidDes); |
|
2209 } |
|
2210 |
|
2211 TInt CScrRequestImpl::GetServiceIdForDataTypeL(const TDesC& aType) const |
|
2212 { |
|
2213 TInt serviceId = 0; |
|
2214 _LIT(KSelectAppForDataTypeAndService, "SELECT ServiceId FROM DataType WHERE Type=? ORDER BY Priority DESC;"); |
|
2215 CStatement* stmt = iDbHandle->PrepareStatementLC(KSelectAppForDataTypeAndService); |
|
2216 stmt->BindStrL(1, aType); |
|
2217 |
|
2218 if(!stmt->ProcessNextRowL()) |
|
2219 { |
|
2220 DEBUG_PRINTF(_L("No Service for given datatype")); |
|
2221 } |
|
2222 else |
|
2223 { |
|
2224 serviceId = stmt->IntColumnL(0); |
|
2225 } |
|
2226 CleanupStack::PopAndDestroy(stmt); |
|
2227 return serviceId; |
|
2228 } |
|
2229 |
|
2230 TBool CScrRequestImpl::GetAppUidForServiceIdL(const TInt ServiceId, TUid& aAppUid) const |
|
2231 { |
|
2232 _LIT(KSelectColumn, "AppUid"); |
|
2233 _LIT(KTable, "ServiceInfo"); |
|
2234 _LIT(KConditionColumn, "ServiceId"); |
|
2235 if(GetIntforConditionL(KSelectColumn(),KTable(),KConditionColumn(),ServiceId, (TInt&)aAppUid.iUid)) |
|
2236 { |
|
2237 return ETrue; |
|
2238 } |
|
2239 else |
|
2240 { |
|
2241 DEBUG_PRINTF(_L("No AppUid for given datatype")); |
|
2242 return EFalse; |
|
2243 } |
|
2244 } |
|
2245 |
|
2246 TBool CScrRequestImpl::GetNearestAppLanguageL(TLanguage aRequiredLocale,TUid appUid, TLanguage& aFinalAppLocale) const |
|
2247 { |
|
2248 TLanguagePath equivalentLanguages; |
|
2249 TInt index = 0; |
|
2250 RArray<TInt> appLocales; |
|
2251 TBool isLocalizedInfoPresent = EFalse; |
|
2252 aFinalAppLocale = KUnspecifiedLocale; |
|
2253 |
|
2254 //If required language is not specified, take the current user language. |
|
2255 if (aRequiredLocale == KUnspecifiedLocale) |
|
2256 { |
|
2257 aRequiredLocale = User::Language(); |
|
2258 } |
|
2259 |
|
2260 |
|
2261 //Get the app language list. |
|
2262 GetLocalesForAppIdL(appLocales,appUid); |
|
2263 |
|
2264 //Check if current language is supported by application |
|
2265 if ( KErrNotFound!=appLocales.Find((TInt)aRequiredLocale)) |
|
2266 { |
|
2267 aFinalAppLocale = aRequiredLocale; |
|
2268 isLocalizedInfoPresent = ETrue; |
|
2269 appLocales.Close(); |
|
2270 return isLocalizedInfoPresent; |
|
2271 } |
|
2272 //Get the nearest languages corresponding to the required language. |
|
2273 BaflUtils::GetEquivalentLanguageList(aRequiredLocale, equivalentLanguages); |
|
2274 |
|
2275 |
|
2276 //Identify the app language corresponding to the nearest required language. |
|
2277 if(0 != appLocales.Count()) |
|
2278 { |
|
2279 while(1) |
|
2280 { |
|
2281 if(equivalentLanguages[index] != ELangNone && appLocales.FindInOrder((TInt)equivalentLanguages[index]) != KErrNotFound) |
|
2282 { |
|
2283 aFinalAppLocale = equivalentLanguages[index]; |
|
2284 isLocalizedInfoPresent = ETrue; |
|
2285 break; |
|
2286 } |
|
2287 |
|
2288 if(equivalentLanguages[index] == ELangNone) |
|
2289 { |
|
2290 break; |
|
2291 } |
|
2292 |
|
2293 index++; |
|
2294 |
|
2295 } |
|
2296 // If a matching language is not found in the list of equivalent languages, |
|
2297 // we check if a default locale (KNonLocalized) is present. |
|
2298 if(!isLocalizedInfoPresent && appLocales[0] == (TInt)KNonLocalized) |
|
2299 { |
|
2300 isLocalizedInfoPresent = ETrue; |
|
2301 aFinalAppLocale = KNonLocalized; |
|
2302 } |
|
2303 } |
|
2304 appLocales.Close(); |
|
2305 return isLocalizedInfoPresent; |
|
2306 } |
|
2307 |
|
2308 TBool CScrRequestImpl::GetIntforConditionL(const TDesC& aSelectColumn,const TDesC& aTableInfo,const TDesC& aConditionColumn,TInt aConditionValue,TInt& aRetrievedValue) const |
|
2309 { |
|
2310 TBool isIntValFound = 0; |
|
2311 _LIT(KSelectDependencies, "SELECT %S FROM %S WHERE %S=?;"); |
|
2312 TInt formattedLen = aSelectColumn.Length() + aTableInfo.Length()+ aConditionColumn.Length(); |
|
2313 HBufC *stmtStr = FormatStatementLC(KSelectDependencies(), formattedLen, &aSelectColumn, &aTableInfo,&aConditionColumn); |
|
2314 |
|
2315 CStatement* stmt = iDbHandle->PrepareStatementLC(*stmtStr); |
|
2316 stmt->BindIntL(1, aConditionValue); |
|
2317 if(!stmt->ProcessNextRowL()) |
|
2318 { |
|
2319 DEBUG_PRINTF3(_L("%S with value %d not found!"), &aSelectColumn, aConditionValue); |
|
2320 } |
|
2321 else |
|
2322 { |
|
2323 aRetrievedValue = stmt->IntColumnL(0); |
|
2324 isIntValFound = 1; |
|
2325 } |
|
2326 CleanupStack::PopAndDestroy(2,stmtStr); |
|
2327 |
|
2328 return isIntValFound; |
|
2329 } |
|
2330 |
2066 void IntersectSortedArraysL(RArray<TComponentId>& aLhs, RArray<TComponentId> aRhs) |
2331 void IntersectSortedArraysL(RArray<TComponentId>& aLhs, RArray<TComponentId> aRhs) |
2067 { |
2332 { |
2068 RArray<TComponentId> tmp; |
2333 RArray<TComponentId> tmp; |
2069 CleanupClosePushL(tmp); |
2334 CleanupClosePushL(tmp); |
2070 TInt idxLhs(0); |
2335 TInt idxLhs(0); |
3228 { |
3537 { |
3229 DEBUG_PRINTF(_L8("Getting the Data of matching supported languages")); |
3538 DEBUG_PRINTF(_L8("Getting the Data of matching supported languages")); |
3230 WriteArrayDataL(aMessage, 0, iMatchingSupportedLanguageList); |
3539 WriteArrayDataL(aMessage, 0, iMatchingSupportedLanguageList); |
3231 iMatchingSupportedLanguageList.Close(); |
3540 iMatchingSupportedLanguageList.Close(); |
3232 } |
3541 } |
|
3542 |
|
3543 TBool CScrRequestImpl::DoesAppWithScreenModeExistL(TUid aAppUid, TInt aScreenMode, TLanguage aLocale) const |
|
3544 { |
|
3545 _LIT(KSelectAppUidFromLocalizableAppInfo,"SELECT COUNT(*)FROM (LocalizableAppInfo JOIN ViewData ON LocalizableAppInfo.LocalAppInfoId = ViewData.LocalAppInfoId) WHERE AppUid = ? AND ScreenMode = ? AND Locale = ?;"); |
|
3546 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppUidFromLocalizableAppInfo); |
|
3547 stmt->BindIntL(1, aAppUid.iUid); |
|
3548 stmt->BindIntL(2, aScreenMode); |
|
3549 stmt->BindIntL(3, aLocale); |
|
3550 stmt->ProcessNextRowL(); |
|
3551 TInt count = stmt->IntColumnL(0); |
|
3552 CleanupStack::PopAndDestroy(stmt); |
|
3553 if(count!=0) |
|
3554 return ETrue; |
|
3555 else |
|
3556 return EFalse; |
|
3557 } |
|
3558 |
|
3559 void CScrRequestImpl::GetAppUidsL(CAppInfoViewSubsessionContext* aSubsessionContext, TBool aScreenModePresent) const |
|
3560 { |
|
3561 CStatement* stmt; |
|
3562 _LIT(KAllAppIds,"SELECT AppUid from AppRegistrationInfo"); |
|
3563 stmt = iDbHandle->PrepareStatementLC(KAllAppIds); |
|
3564 aSubsessionContext->iApps.Close(); |
|
3565 while(stmt->ProcessNextRowL()) |
|
3566 { |
|
3567 TAppUidWithLocaleInfo appUidWithLocaleInfo; |
|
3568 appUidWithLocaleInfo.iAppUid = TUid::Uid(stmt->IntColumnL(0)); |
|
3569 appUidWithLocaleInfo.iLocale = KUnspecifiedLocale; |
|
3570 GetNearestAppLanguageL(aSubsessionContext->iLocale, appUidWithLocaleInfo.iAppUid, appUidWithLocaleInfo.iLocale); |
|
3571 if(aScreenModePresent) |
|
3572 { |
|
3573 if(DoesAppWithScreenModeExistL(appUidWithLocaleInfo.iAppUid, aSubsessionContext->iScreenMode, appUidWithLocaleInfo.iLocale)) |
|
3574 { |
|
3575 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3576 } |
|
3577 } |
|
3578 |
|
3579 else |
|
3580 { |
|
3581 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3582 } |
|
3583 } |
|
3584 CleanupStack::PopAndDestroy(stmt); |
|
3585 } |
|
3586 |
|
3587 void CScrRequestImpl::GetEmbeddableAppUidsL(CAppInfoViewSubsessionContext* aSubsessionContext, TBool aScreenModePresent) const |
|
3588 { |
|
3589 CStatement *stmt1; |
|
3590 _LIT (KGetAppIdWithEmbeddability, "SELECT DISTINCT AppUid from AppRegistrationInfo where Embeddable IN(1,2)"); |
|
3591 stmt1 = iDbHandle->PrepareStatementLC(KGetAppIdWithEmbeddability); |
|
3592 aSubsessionContext->iApps.Close(); |
|
3593 while(stmt1->ProcessNextRowL()) |
|
3594 { |
|
3595 TAppUidWithLocaleInfo appUidWithLocaleInfo; |
|
3596 appUidWithLocaleInfo.iAppUid = TUid::Uid(stmt1->IntColumnL(0)); |
|
3597 appUidWithLocaleInfo.iLocale = KUnspecifiedLocale; |
|
3598 GetNearestAppLanguageL(aSubsessionContext->iLocale, appUidWithLocaleInfo.iAppUid, appUidWithLocaleInfo.iLocale); |
|
3599 if(aScreenModePresent) |
|
3600 { |
|
3601 if(DoesAppWithScreenModeExistL(appUidWithLocaleInfo.iAppUid, aSubsessionContext->iScreenMode, appUidWithLocaleInfo.iLocale)) |
|
3602 { |
|
3603 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3604 } |
|
3605 } |
|
3606 else |
|
3607 { |
|
3608 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3609 } |
|
3610 } |
|
3611 CleanupStack::PopAndDestroy(stmt1); |
|
3612 } |
|
3613 |
|
3614 |
|
3615 void CScrRequestImpl::GetServerAppUidsL(CAppInfoViewSubsessionContext* aSubsessionContext, TUid aServiceUid, TBool aScreenModePresent) const |
|
3616 { |
|
3617 CStatement *stmt1; |
|
3618 _LIT(KSelectAppUidForServiceId,"SELECT DISTINCT AppUid from ServiceInfo where Uid = ?"); |
|
3619 stmt1 = iDbHandle->PrepareStatementLC(KSelectAppUidForServiceId); |
|
3620 stmt1->BindIntL(1, aServiceUid.iUid); |
|
3621 aSubsessionContext->iApps.Close(); |
|
3622 while(stmt1->ProcessNextRowL()) |
|
3623 { |
|
3624 TAppUidWithLocaleInfo appUidWithLocaleInfo; |
|
3625 appUidWithLocaleInfo.iAppUid = TUid::Uid(stmt1->IntColumnL(0)); |
|
3626 appUidWithLocaleInfo.iLocale = KUnspecifiedLocale; |
|
3627 GetNearestAppLanguageL(aSubsessionContext->iLocale, appUidWithLocaleInfo.iAppUid, appUidWithLocaleInfo.iLocale); |
|
3628 if(aScreenModePresent) |
|
3629 { |
|
3630 if(DoesAppWithScreenModeExistL(appUidWithLocaleInfo.iAppUid, aSubsessionContext->iScreenMode, appUidWithLocaleInfo.iLocale)) |
|
3631 { |
|
3632 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3633 } |
|
3634 } |
|
3635 else |
|
3636 { |
|
3637 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3638 } |
|
3639 } |
|
3640 CleanupStack::PopAndDestroy(stmt1); |
|
3641 } |
|
3642 |
|
3643 void CScrRequestImpl::GetAppUidsWithEmbeddabilityFilterL(CAppInfoViewSubsessionContext* aSubsessionContext, TEmbeddableFilter& aFilter, TBool aScreenModePresent) const |
|
3644 { |
|
3645 CStatement *stmt1; |
|
3646 TApplicationCharacteristics::TAppEmbeddability embeddability; |
|
3647 _LIT(KSelectAppUidForServiceId,"SELECT DISTINCT AppUid,Embeddable from AppRegistrationInfo"); |
|
3648 stmt1 = iDbHandle->PrepareStatementLC(KSelectAppUidForServiceId); |
|
3649 aSubsessionContext->iApps.Close(); |
|
3650 while(stmt1->ProcessNextRowL()) |
|
3651 { |
|
3652 embeddability = (TApplicationCharacteristics::TAppEmbeddability)stmt1->IntColumnL(1); |
|
3653 if(aFilter.MatchesEmbeddability(embeddability)) |
|
3654 { |
|
3655 TAppUidWithLocaleInfo appUidWithLocaleInfo; |
|
3656 appUidWithLocaleInfo.iAppUid = TUid::Uid(stmt1->IntColumnL(0)); |
|
3657 appUidWithLocaleInfo.iLocale = KUnspecifiedLocale; |
|
3658 GetNearestAppLanguageL(aSubsessionContext->iLocale, appUidWithLocaleInfo.iAppUid, appUidWithLocaleInfo.iLocale); |
|
3659 if(aScreenModePresent) |
|
3660 { |
|
3661 if(DoesAppWithScreenModeExistL(appUidWithLocaleInfo.iAppUid, aSubsessionContext->iScreenMode, appUidWithLocaleInfo.iLocale)) |
|
3662 { |
|
3663 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3664 } |
|
3665 } |
|
3666 else |
|
3667 { |
|
3668 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3669 } |
|
3670 } |
|
3671 else |
|
3672 continue; |
|
3673 } |
|
3674 CleanupStack::PopAndDestroy(stmt1); |
|
3675 } |
|
3676 |
|
3677 void CScrRequestImpl::GetAppUidsWithCapabilityMaskAndValueL(CAppInfoViewSubsessionContext* aSubsessionContext,TUint aCapabilityAttrFilterMask, TUint aCapabilityAttrFilterValue, TBool aScreenModePresent) const |
|
3678 { |
|
3679 CStatement *stmt1; |
|
3680 TUint attributes; |
|
3681 _LIT(KSelectAppUidForServiceId,"SELECT DISTINCT AppUid,Attributes from AppRegistrationInfo"); |
|
3682 stmt1 = iDbHandle->PrepareStatementLC(KSelectAppUidForServiceId); |
|
3683 aSubsessionContext->iApps.Close(); |
|
3684 while(stmt1->ProcessNextRowL()) |
|
3685 { |
|
3686 attributes = stmt1->IntColumnL(1); |
|
3687 if(((attributes & aCapabilityAttrFilterMask) == (aCapabilityAttrFilterValue & aCapabilityAttrFilterMask))) |
|
3688 { |
|
3689 TAppUidWithLocaleInfo appUidWithLocaleInfo; |
|
3690 appUidWithLocaleInfo.iAppUid = TUid::Uid(stmt1->IntColumnL(0)); |
|
3691 appUidWithLocaleInfo.iLocale = KUnspecifiedLocale; |
|
3692 GetNearestAppLanguageL(aSubsessionContext->iLocale, appUidWithLocaleInfo.iAppUid, appUidWithLocaleInfo.iLocale); |
|
3693 if(aScreenModePresent) |
|
3694 { |
|
3695 if(DoesAppWithScreenModeExistL(appUidWithLocaleInfo.iAppUid, aSubsessionContext->iScreenMode, appUidWithLocaleInfo.iLocale)) |
|
3696 { |
|
3697 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3698 } |
|
3699 } |
|
3700 else |
|
3701 { |
|
3702 aSubsessionContext->iApps.AppendL(appUidWithLocaleInfo); |
|
3703 } |
|
3704 } |
|
3705 else |
|
3706 continue; |
|
3707 } |
|
3708 CleanupStack::PopAndDestroy(stmt1); |
|
3709 } |
|
3710 |
|
3711 void CScrRequestImpl::GetLocalesForAppIdL(RArray<TInt>& aLocales, TUid aAppUid) const |
|
3712 { |
|
3713 _LIT(KAllLocales," SELECT Locale from LocalizableAppInfo where AppUid = ? ORDER BY Locale"); |
|
3714 CStatement* stmt = iDbHandle->PrepareStatementLC(KAllLocales); |
|
3715 stmt->BindIntL(1, aAppUid.iUid); |
|
3716 aLocales.Close(); |
|
3717 while(stmt->ProcessNextRowL()) |
|
3718 { |
|
3719 aLocales.Append(stmt->IntColumnL(0)); |
|
3720 } |
|
3721 CleanupStack::PopAndDestroy(1,stmt); |
|
3722 } |
|
3723 |
|
3724 CStatement* CScrRequestImpl::CreateStatementForAppInfoL(const TDesC& aStatement, TLanguage aLocale, TInt aValuesNum,...) const |
|
3725 { |
|
3726 VA_LIST argList; |
|
3727 VA_START(argList, aValuesNum); |
|
3728 |
|
3729 CStatement *stmt = iDbHandle->PrepareStatementLC(aStatement); |
|
3730 BindStatementValuesL(*stmt, aLocale,aValuesNum, argList); |
|
3731 CleanupStack::Pop(stmt); |
|
3732 return stmt; |
|
3733 } |
|
3734 |
|
3735 CAppInfoFilter* CScrRequestImpl::ReadAppInfoFilterL(const RMessage2& aMessage) const |
|
3736 { |
|
3737 CAppInfoFilter *filter = ReadObjectFromMessageLC<CAppInfoFilter>(aMessage, 0); |
|
3738 CleanupStack::Pop(filter); |
|
3739 return filter; |
|
3740 } |
|
3741 |
|
3742 void CScrRequestImpl::OpenAppInfoViewL(CAppInfoFilter& aFilter, CAppInfoViewSubsessionContext* aSubsessionContext) |
|
3743 { |
|
3744 |
|
3745 switch(aFilter.iSetFlag) |
|
3746 { |
|
3747 |
|
3748 case CAppInfoFilter::EAllApps: |
|
3749 { |
|
3750 GetAppUidsL(aSubsessionContext); |
|
3751 break; |
|
3752 } |
|
3753 case CAppInfoFilter::EAllAppsWithScreenMode: |
|
3754 { |
|
3755 aSubsessionContext->iScreenMode = aFilter.iScreenMode; |
|
3756 GetAppUidsL(aSubsessionContext, ETrue); |
|
3757 break; |
|
3758 } |
|
3759 |
|
3760 case CAppInfoFilter::EGetEmbeddableApps: |
|
3761 { |
|
3762 GetEmbeddableAppUidsL(aSubsessionContext); |
|
3763 break; |
|
3764 } |
|
3765 |
|
3766 case CAppInfoFilter::EGetEmbeddableAppsWithSreenMode: |
|
3767 { |
|
3768 aSubsessionContext->iScreenMode = aFilter.iScreenMode; |
|
3769 GetEmbeddableAppUidsL(aSubsessionContext, ETrue); |
|
3770 break; |
|
3771 } |
|
3772 |
|
3773 case CAppInfoFilter::EGetFilteredAppsWithEmbeddabilityFilter: |
|
3774 { |
|
3775 GetAppUidsWithEmbeddabilityFilterL(aSubsessionContext, aFilter.iEmbeddabilityFilter); |
|
3776 break; |
|
3777 } |
|
3778 |
|
3779 case CAppInfoFilter::EGetFilteredAppsWithEmbeddabilityFilterWithScreenMode: |
|
3780 { |
|
3781 aSubsessionContext->iScreenMode = aFilter.iScreenMode; |
|
3782 GetAppUidsWithEmbeddabilityFilterL(aSubsessionContext, aFilter.iEmbeddabilityFilter, ETrue); |
|
3783 break; |
|
3784 } |
|
3785 |
|
3786 case CAppInfoFilter::EGetFilteredAppsWithCapabilityMaskAndValue: |
|
3787 { |
|
3788 GetAppUidsWithCapabilityMaskAndValueL(aSubsessionContext,aFilter.iCapabilityAttributeMask,aFilter.iCapabilityAttributeValue); |
|
3789 break; |
|
3790 } |
|
3791 |
|
3792 case CAppInfoFilter::EGetFilteredAppsWithCapabilityMaskAndValueWithScreenMode: |
|
3793 { |
|
3794 aSubsessionContext->iScreenMode = aFilter.iScreenMode; |
|
3795 GetAppUidsWithCapabilityMaskAndValueL(aSubsessionContext,aFilter.iCapabilityAttributeMask,aFilter.iCapabilityAttributeValue, ETrue); |
|
3796 break; |
|
3797 } |
|
3798 case CAppInfoFilter::EGetServerApps: |
|
3799 { |
|
3800 GetServerAppUidsL(aSubsessionContext, aFilter.iServiceUid); |
|
3801 break; |
|
3802 } |
|
3803 |
|
3804 case CAppInfoFilter::EGetServerAppsWithScreenMode: |
|
3805 { |
|
3806 aSubsessionContext->iScreenMode = aFilter.iScreenMode; |
|
3807 GetServerAppUidsL(aSubsessionContext, aFilter.iServiceUid, ETrue); |
|
3808 break; |
|
3809 } |
|
3810 |
|
3811 default: |
|
3812 User::Leave(KErrArgument); |
|
3813 } |
|
3814 |
|
3815 } |
|
3816 |
|
3817 void CScrRequestImpl::NextAppInfoSizeL(const RMessage2& aMessage, TAppRegInfo*& aAppInfo, CAppInfoViewSubsessionContext* aSubsessionContext) |
|
3818 { |
|
3819 if(aSubsessionContext->iAppInfoIndex < aSubsessionContext->iApps.Count()) |
|
3820 { |
|
3821 TInt count1 = User::CountAllocCells(); |
|
3822 aAppInfo = new(ELeave) TAppRegInfo; |
|
3823 TInt count2 = User::CountAllocCells(); |
|
3824 aAppInfo->iUid = (aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex]).iAppUid; |
|
3825 |
|
3826 _LIT(KSelectAppFilename, "SELECT AppFile FROM AppRegistrationInfo WHERE AppUid=?;"); |
|
3827 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppFilename); |
|
3828 stmt->BindIntL(1, aAppInfo->iUid.iUid); |
|
3829 stmt->ProcessNextRowL(); |
|
3830 aAppInfo->iFullName = stmt->StrColumnL(0); |
|
3831 CleanupStack::PopAndDestroy(stmt); |
|
3832 |
|
3833 if((aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex]).iLocale != KUnspecifiedLocale) |
|
3834 { |
|
3835 GetCaptionAndShortCaptionInfoForLocaleL(aAppInfo->iUid, aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex].iLocale, aAppInfo->iShortCaption, aAppInfo->iCaption); |
|
3836 } |
|
3837 aSubsessionContext->iAppInfoIndex++; |
|
3838 } |
|
3839 else |
|
3840 { |
|
3841 DEBUG_PRINTF(_L8("Reached the end of the view.")); |
|
3842 } |
|
3843 |
|
3844 WriteObjectSizeL(aMessage, 1, aAppInfo); |
|
3845 } |
|
3846 |
|
3847 void CScrRequestImpl::NextAppInfoDataL(const RMessage2& aMessage, TAppRegInfo*& aAppInfo) |
|
3848 { |
|
3849 DEBUG_PRINTF(_L8("Returning the AppInfo data.")); |
|
3850 WriteObjectDataL(aMessage, 0, aAppInfo); |
|
3851 DeleteObjectZ(aAppInfo); // Delete the object to prevent it to be resent. |
|
3852 aAppInfo = NULL; |
|
3853 } |
|
3854 |
|
3855 void CScrRequestImpl::AddApplicationEntryL(const RMessage2& aMessage) |
|
3856 { |
|
3857 DEBUG_PRINTF(_L8("Adding the application details into SCR")); |
|
3858 TComponentId componentId = GetComponentIdFromMsgL(aMessage); |
|
3859 CApplicationRegistrationData *regInfo = ReadObjectFromMessageLC<CApplicationRegistrationData>(aMessage, 1); |
|
3860 |
|
3861 TSecureId clientSid = aMessage.SecureId(); |
|
3862 TUint32 swTypeId = 0; |
|
3863 if (componentId == 0 && clientSid == KSisRegistryServerSid) |
|
3864 { |
|
3865 swTypeId = HashCaseSensitiveL(Usif::KSoftwareTypeNative); |
|
3866 } |
|
3867 else |
|
3868 { |
|
3869 // Applicaiton is always associated with a component. We use the SoftwareTypeId of the |
|
3870 // component as the ApplicationTypeId. |
|
3871 swTypeId = GetSoftwareTypeForComponentL(componentId); |
|
3872 } |
|
3873 |
|
3874 |
|
3875 _LIT(KInsertAppRegistrationInfo,"INSERT INTO AppRegistrationInfo(AppUid, ComponentId, AppFile, TypeId, Attributes, Hidden, Embeddable, NewFile, Launch, GroupName, DefaultScreenNumber) VALUES(?,?,?,?,?,?,?,?,?,?,?);"); |
|
3876 TInt numberOfValues = 11; |
|
3877 ExecuteStatementL(KInsertAppRegistrationInfo(), numberOfValues, EValueInteger, regInfo->AppUid(), EValueInteger, componentId, EValueString, &(regInfo->AppFile()), EValueInteger, swTypeId, EValueInteger, regInfo->Attributes(), EValueInteger, regInfo->Hidden(), EValueInteger, regInfo->Embeddability(), EValueInteger, regInfo->NewFile(), EValueInteger, regInfo->Launch(), EValueString, &(regInfo->GroupName()), EValueInteger, regInfo->DefaultScreenNumber()); |
|
3878 |
|
3879 RPointerArray<HBufC> ownedFileArray = regInfo->OwnedFileArray(); |
|
3880 for(TInt i=0;i<ownedFileArray.Count();++i) |
|
3881 { |
|
3882 AddFileOwnershipInfoL(regInfo->AppUid(),*(ownedFileArray[i])); |
|
3883 } |
|
3884 |
|
3885 RPointerArray<CServiceInfo> serviceArray = regInfo->ServiceArray(); |
|
3886 for(TInt i=0;i<serviceArray.Count();++i) |
|
3887 { |
|
3888 AddServiceInfoL(regInfo->AppUid(),serviceArray[i]); |
|
3889 } |
|
3890 |
|
3891 RPointerArray<CLocalizableAppInfo> localizableAppInfo = regInfo->LocalizableAppInfoList(); |
|
3892 for(TInt i=0;i<localizableAppInfo.Count();++i) |
|
3893 { |
|
3894 AddLocalizableAppInfoL(regInfo->AppUid(), localizableAppInfo[i]); |
|
3895 } |
|
3896 |
|
3897 RPointerArray<CPropertyEntry> appPropertiesList = regInfo->AppProperties(); |
|
3898 for(TInt i=0;i<appPropertiesList.Count();++i) |
|
3899 { |
|
3900 AddPropertyL(regInfo->AppUid(), appPropertiesList[i]); |
|
3901 } |
|
3902 |
|
3903 RPointerArray<COpaqueData> opaqueDataList = regInfo->AppOpaqueData(); |
|
3904 for (TInt i = 0; i < opaqueDataList.Count(); ++i) |
|
3905 { |
|
3906 AddOpaqueDataL(regInfo->AppUid(), opaqueDataList[i]); |
|
3907 } |
|
3908 |
|
3909 CleanupStack::PopAndDestroy(regInfo); |
|
3910 DEBUG_PRINTF(_L8("Adding the application details into SCR done ")); |
|
3911 } |
|
3912 |
|
3913 void CScrRequestImpl::AddFileOwnershipInfoL(TUid aAppUid, const TDesC& aFileName) |
|
3914 { |
|
3915 if(aAppUid == KNullUid || !aFileName.CompareF(KNullDesC())) |
|
3916 { |
|
3917 DEBUG_PRINTF(_L8("Mandatory values not provided.")); |
|
3918 User::Leave(KErrArgument); |
|
3919 } |
|
3920 |
|
3921 _LIT(KInsertFileOwnershipInfo,"INSERT INTO FileOwnershipInfo(AppUid, FileName) VALUES(?,?);"); |
|
3922 TInt numberOfValues = 2; |
|
3923 ExecuteStatementL(KInsertFileOwnershipInfo(), numberOfValues, EValueInteger, aAppUid, EValueString, &aFileName); |
|
3924 } |
|
3925 |
|
3926 void CScrRequestImpl::AddLocalizableAppInfoL(TUid aAppUid, Usif::CLocalizableAppInfo* aLocalizableAppInfoEntry) |
|
3927 { |
|
3928 TInt captionAndIconInfoId = 0; |
|
3929 if(NULL != aLocalizableAppInfoEntry->iCaptionAndIconInfo) |
|
3930 { |
|
3931 captionAndIconInfoId = AddCaptionAndIconInfoL(aLocalizableAppInfoEntry->iCaptionAndIconInfo); |
|
3932 } |
|
3933 _LIT(KInsertLocalizableAppInfo,"INSERT INTO LocalizableAppInfo(AppUid, ShortCaption, GroupName, Locale, CaptionAndIconId) VALUES(?,?,?,?,?);"); |
|
3934 TInt numberOfValues = 5; |
|
3935 ExecuteStatementL(KInsertLocalizableAppInfo(), numberOfValues, EValueInteger, aAppUid, EValueString, &(aLocalizableAppInfoEntry->ShortCaption()), EValueString, &(aLocalizableAppInfoEntry->GroupName()), EValueInteger, aLocalizableAppInfoEntry->ApplicationLanguage(), EValueInteger, captionAndIconInfoId); |
|
3936 TInt localAppInfoId = iDbHandle->LastInsertedIdL(); |
|
3937 RPointerArray<CAppViewData> viewDataList = aLocalizableAppInfoEntry->ViewDataList(); |
|
3938 for (TInt i=0;i<viewDataList.Count();i++) |
|
3939 { |
|
3940 AddViewDataL(localAppInfoId, viewDataList[i]); |
|
3941 } |
|
3942 } |
|
3943 |
|
3944 void CScrRequestImpl::AddViewDataL(TInt aLocalAppInfoId, Usif::CAppViewData* aViewDataEntry) |
|
3945 { |
|
3946 if(aLocalAppInfoId == 0 || aViewDataEntry->Uid() == KNullUid ) |
|
3947 { |
|
3948 DEBUG_PRINTF(_L8("Mandatory values not provided.")); |
|
3949 User::Leave(KErrArgument); |
|
3950 } |
|
3951 |
|
3952 TInt captionAndIconInfoId = 0; |
|
3953 if(NULL != aViewDataEntry->iCaptionAndIconInfo) |
|
3954 { |
|
3955 captionAndIconInfoId = AddCaptionAndIconInfoL(aViewDataEntry->iCaptionAndIconInfo); |
|
3956 } |
|
3957 |
|
3958 _LIT(KInsertViewData,"INSERT INTO ViewData(LocalAppInfoId, Uid, ScreenMode, CaptionAndIconId) VALUES(?,?,?,?);"); |
|
3959 TInt numberOfValues = 4; |
|
3960 ExecuteStatementL(KInsertViewData(), numberOfValues, EValueInteger, aLocalAppInfoId, EValueInteger, aViewDataEntry->Uid(), EValueInteger, aViewDataEntry->ScreenMode(), EValueInteger, captionAndIconInfoId); |
|
3961 } |
|
3962 |
|
3963 TInt CScrRequestImpl::AddCaptionAndIconInfoL(Usif::CCaptionAndIconInfo* aCaptionAndIconEntry) |
|
3964 { |
|
3965 _LIT(KCaptionAndIconInfo,"INSERT INTO CaptionAndIconInfo(Caption, NumberOfIcons, IconFile) VALUES(?,?,?);"); |
|
3966 TInt numberOfValues = 3; |
|
3967 ExecuteStatementL(KCaptionAndIconInfo(), numberOfValues, EValueString, &(aCaptionAndIconEntry->Caption()), EValueInteger, aCaptionAndIconEntry->NumOfAppIcons(), EValueString, &(aCaptionAndIconEntry->IconFileName())); |
|
3968 return iDbHandle->LastInsertedIdL(); |
|
3969 } |
|
3970 |
|
3971 void CScrRequestImpl::AddServiceInfoL(TUid aAppUid, Usif::CServiceInfo* aAppServiceInfoEntry) |
|
3972 { |
|
3973 if(aAppUid == KNullUid) |
|
3974 { |
|
3975 DEBUG_PRINTF(_L8("Values for app uid is absent")); |
|
3976 User::Leave(KErrArgument); |
|
3977 } |
|
3978 _LIT(KInsertServiceInfo,"INSERT INTO ServiceInfo(AppUid, Uid) VALUES(?,?);"); |
|
3979 TInt numberOfValues = 2; |
|
3980 |
|
3981 ExecuteStatementL(KInsertServiceInfo(), numberOfValues, EValueInteger, aAppUid, EValueInteger, aAppServiceInfoEntry->Uid()); |
|
3982 TInt serviceId = iDbHandle->LastInsertedIdL(); |
|
3983 |
|
3984 RPointerArray<Usif::COpaqueData> opaqueData = aAppServiceInfoEntry->OpaqueData(); |
|
3985 for(TInt i=0;i<opaqueData.Count();i++) |
|
3986 { |
|
3987 AddOpaqueDataL(aAppUid, opaqueData[i], aAppServiceInfoEntry->Uid()); |
|
3988 } |
|
3989 |
|
3990 RPointerArray<Usif::CDataType> dataTypes = aAppServiceInfoEntry->DataTypes(); |
|
3991 for (TInt i=0;i<dataTypes.Count();i++) |
|
3992 { |
|
3993 AddServiceDataTypeL(serviceId, dataTypes[i]); |
|
3994 } |
|
3995 } |
|
3996 |
|
3997 void CScrRequestImpl::AddServiceDataTypeL(TInt aServiceUid, Usif::CDataType* aDataTypeEntry) |
|
3998 { |
|
3999 if(!((aDataTypeEntry->Type()).CompareF(KNullDesC()))) |
|
4000 { |
|
4001 DEBUG_PRINTF(_L8("Values for service uid or type is absent")); |
|
4002 User::Leave(KErrArgument); |
|
4003 } |
|
4004 _LIT(KInsertServiceDataTypeInfo,"INSERT INTO DataType(ServiceId, Priority, Type) VALUES(?,?,?);"); |
|
4005 TInt numberOfValues = 3; |
|
4006 ExecuteStatementL(KInsertServiceDataTypeInfo(), numberOfValues, EValueInteger, aServiceUid, EValueInteger, aDataTypeEntry->Priority() , EValueString, &(aDataTypeEntry->Type())); |
|
4007 } |
|
4008 |
|
4009 void CScrRequestImpl::AddPropertyL(TUid aAppUid, Usif::CPropertyEntry* aAppPropertiesEntry) |
|
4010 { |
|
4011 if(aAppUid == KNullUid || !((aAppPropertiesEntry->PropertyName().CompareF(KNullDesC())))) |
|
4012 { |
|
4013 DEBUG_PRINTF(_L8("Property name is absent and hence cannot be entered into the DB.")); |
|
4014 User::Leave(KErrArgument); |
|
4015 } |
|
4016 _LIT(KInsertAppProperties, "INSERT INTO AppProperties(AppUid, %S;"); |
|
4017 _LIT(KPropertyIntValue," Name, IntValue) VALUES(?,?,?)"); |
|
4018 _LIT(KPropertyStrValue," Locale, Name, StrValue) VALUES(?,?,?,?)"); |
|
4019 _LIT(KPropertyBinaryValue," Name, StrValue, IsStr8Bit) VALUES(?,?,?,1)"); |
|
4020 |
|
4021 HBufC *statementStr(0); |
|
4022 CStatement *stmt ; |
|
4023 |
|
4024 switch(aAppPropertiesEntry->PropertyType()) |
|
4025 { |
|
4026 case CPropertyEntry::EIntProperty: |
|
4027 { |
|
4028 statementStr = FormatStatementLC(KInsertAppProperties, KPropertyIntValue().Length(), &KPropertyIntValue()); |
|
4029 stmt = iDbHandle->PrepareStatementLC(*statementStr); |
|
4030 CIntPropertyEntry *intProp = static_cast<CIntPropertyEntry *>(aAppPropertiesEntry); |
|
4031 stmt->BindIntL(1, aAppUid.iUid); |
|
4032 stmt->BindStrL(2, intProp->PropertyName()); |
|
4033 stmt->BindInt64L(3, intProp->Int64Value()); |
|
4034 stmt->ExecuteStatementL(); |
|
4035 CleanupStack::PopAndDestroy(2,statementStr); |
|
4036 } |
|
4037 break; |
|
4038 case CPropertyEntry::ELocalizedProperty: |
|
4039 { |
|
4040 statementStr = FormatStatementLC(KInsertAppProperties, KPropertyStrValue().Length(), &KPropertyStrValue()); |
|
4041 stmt = iDbHandle->PrepareStatementLC(*statementStr); |
|
4042 CLocalizablePropertyEntry *localizedProp = static_cast<CLocalizablePropertyEntry *>(aAppPropertiesEntry); |
|
4043 stmt->BindIntL(1, aAppUid.iUid); |
|
4044 stmt->BindIntL(2, localizedProp->LocaleL()); |
|
4045 stmt->BindStrL(3, localizedProp->PropertyName()); |
|
4046 stmt->BindStrL(4, localizedProp->StrValue()); |
|
4047 stmt->ExecuteStatementL(); |
|
4048 CleanupStack::PopAndDestroy(2,statementStr); |
|
4049 } |
|
4050 break; |
|
4051 case CPropertyEntry::EBinaryProperty: |
|
4052 { |
|
4053 statementStr = FormatStatementLC(KInsertAppProperties, KPropertyBinaryValue().Length(), &KPropertyBinaryValue()); |
|
4054 stmt = iDbHandle->PrepareStatementLC(*statementStr); |
|
4055 CBinaryPropertyEntry *binaryProp = static_cast<CBinaryPropertyEntry *>(aAppPropertiesEntry); |
|
4056 stmt->BindIntL(1, aAppUid.iUid); |
|
4057 stmt->BindStrL(2, binaryProp->PropertyName()); |
|
4058 stmt->BindBinaryL(3, binaryProp->BinaryValue()); |
|
4059 stmt->ExecuteStatementL(); |
|
4060 CleanupStack::PopAndDestroy(2,statementStr); |
|
4061 } |
|
4062 break; |
|
4063 |
|
4064 default: |
|
4065 DEBUG_PRINTF(_L8("The property type couldn't be recognized.")); |
|
4066 User::Leave(KErrAbort); |
|
4067 } |
|
4068 } |
|
4069 |
|
4070 |
|
4071 void CScrRequestImpl::AddOpaqueDataL(TUid aAppUid, Usif::COpaqueData* aOpaqueDataEntry, TUid aServiceUid) |
|
4072 { |
|
4073 /* AppUid cannot be NULL since this function is invoked from AddApplicationEntryL */ |
|
4074 __ASSERT_DEBUG(aAppUid != TUid::Null(), User::Leave(KErrArgument)); |
|
4075 |
|
4076 _LIT(KOpaqueDataEntry, "INSERT INTO AppProperties(AppUid, Name, Locale, ServiceUid, StrValue, IsStr8Bit) VALUES(?,?,?,?,?,1)"); |
|
4077 |
|
4078 CStatement *stmt = iDbHandle->PrepareStatementLC(KOpaqueDataEntry); |
|
4079 |
|
4080 stmt->BindIntL(1, aAppUid.iUid); |
|
4081 stmt->BindStrL(2, _L("OpaqueData")); |
|
4082 stmt->BindIntL(3, (TInt)aOpaqueDataEntry->iLanguage); |
|
4083 stmt->BindIntL(4, aServiceUid.iUid); |
|
4084 stmt->BindBinaryL(5, *(aOpaqueDataEntry->iOpaqueData)); |
|
4085 stmt->ExecuteStatementL(); |
|
4086 CleanupStack::PopAndDestroy(stmt); |
|
4087 } |
|
4088 |
|
4089 void CScrRequestImpl::DeleteApplicationEntryInternalL(const TInt aAppUid) |
|
4090 { |
|
4091 TInt numberOfValues = 1; |
|
4092 |
|
4093 DeleteFromTableL(KFileOwnershipInfoTable,KAppIdColumnName,aAppUid); |
|
4094 |
|
4095 _LIT(KDeleteDataType, "DELETE FROM DataType WHERE ServiceId IN \ |
|
4096 (SELECT ServiceId FROM ServiceInfo WHERE AppUid=?);"); |
|
4097 ExecuteStatementL(KDeleteDataType, numberOfValues, EValueInteger, aAppUid); |
|
4098 DEBUG_PRINTF2(_L8("Service datatype details associated with application(%d) have been deleted."), aAppUid); |
|
4099 |
|
4100 DeleteFromTableL(KServiceInfoTable,KAppIdColumnName,aAppUid); |
|
4101 |
|
4102 RArray<TInt> viewId; |
|
4103 CleanupClosePushL(viewId); |
|
4104 DEBUG_PRINTF2(_L8("Deleting the LocalizableAppInfo details associated with application (%d)"), aAppUid); |
|
4105 _LIT(KSelectViewId, "SELECT ViewId FROM ViewData WHERE LocalAppInfoId IN(SELECT LocalAppInfoId FROM LocalizableAppInfo WHERE AppUid = ?);"); |
|
4106 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectViewId); |
|
4107 stmt->BindIntL(1, aAppUid); |
|
4108 viewId.Close(); |
|
4109 while(stmt->ProcessNextRowL()) |
|
4110 { |
|
4111 viewId.AppendL(stmt->IntColumnL(0)); |
|
4112 } |
|
4113 |
|
4114 _LIT(KViewId,"ViewId"); |
|
4115 _LIT(KDeleteCaptionAndIconInfoAssociatedToViewData, "DELETE FROM CaptionAndIconInfo WHERE CaptionAndIconId = (SELECT CaptionAndIconId FROM ViewData WHERE ViewId=?);"); |
|
4116 |
|
4117 for(TInt i=0; i< viewId.Count();i++) |
|
4118 { |
|
4119 ExecuteStatementL(KDeleteCaptionAndIconInfoAssociatedToViewData, numberOfValues, EValueInteger, viewId[i]); |
|
4120 DeleteFromTableL(KViewDataTable,KViewId,viewId[i]); |
|
4121 } |
|
4122 CleanupStack::PopAndDestroy(2, &viewId); |
|
4123 |
|
4124 _LIT(KDeleteCaptionAndIconInfo, "DELETE FROM CaptionAndIconInfo WHERE CaptionAndIconId IN \ |
|
4125 (SELECT CaptionAndIconId FROM LocalizableAppInfo WHERE AppUid=?);"); |
|
4126 ExecuteStatementL(KDeleteCaptionAndIconInfo, numberOfValues, EValueInteger, aAppUid); |
|
4127 |
|
4128 DeleteFromTableL(KLocalizableAppInfoTable,KAppIdColumnName,aAppUid); |
|
4129 |
|
4130 DeleteFromTableL(KAppPropertiesTable,KAppIdColumnName,aAppUid); |
|
4131 DeleteFromTableL(KAppRegistrationInfoTable,KAppIdColumnName,aAppUid); |
|
4132 |
|
4133 } |
|
4134 |
|
4135 void CScrRequestImpl::DeleteApplicationEntryL(const RMessage2& aMessage) |
|
4136 { |
|
4137 TInt applicationUid = aMessage.Int0(); |
|
4138 DeleteApplicationEntryInternalL(applicationUid); |
|
4139 } |
|
4140 |
|
4141 void CScrRequestImpl::DeleteAllAppsWithinPackageL(const RMessage2& aMessage) |
|
4142 { |
|
4143 TComponentId componentId = GetComponentIdFromMsgL(aMessage); |
|
4144 TSecureId clientSid = aMessage.SecureId(); |
|
4145 if(componentId == 0 && clientSid != KSisRegistryServerSid) |
|
4146 { |
|
4147 DEBUG_PRINTF(_L8("ComponentId 0 corresponds to In-Rom Applications that cannot be deleted.")); |
|
4148 User::Leave(KErrNotSupported); |
|
4149 } |
|
4150 |
|
4151 DeleteAllAppsWithinPackageInternalL(componentId); |
|
4152 } |
|
4153 |
|
4154 void CScrRequestImpl::DeleteAllAppsWithinPackageInternalL(const TComponentId aComponentId) |
|
4155 { |
|
4156 DEBUG_PRINTF2(_L8("Deleting all the applications associated with component (%d) from SCR."), aComponentId); |
|
4157 |
|
4158 // Fetching all the applications associated with the component |
|
4159 _LIT(KSelectAssociatedAppIds, "SELECT AppUid FROM AppRegistrationInfo WHERE ComponentId=?;"); |
|
4160 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAssociatedAppIds); |
|
4161 stmt->BindIntL(1, aComponentId); |
|
4162 |
|
4163 while(stmt->ProcessNextRowL()) |
|
4164 { |
|
4165 TInt appId = stmt->IntColumnL(0); |
|
4166 DeleteApplicationEntryInternalL(appId); |
|
4167 } |
|
4168 |
|
4169 // Release allocated memories |
|
4170 CleanupStack::PopAndDestroy(1, stmt); // stmt |
|
4171 } |
|
4172 |
|
4173 void CScrRequestImpl::DeleteFromTableL(const TDesC& aTableName, const TDesC& aAttribute, const TInt aValue) |
|
4174 { |
|
4175 _LIT(KDeleteFromTable,"DELETE FROM %S WHERE %S=?;"); |
|
4176 TInt formattedLen = aTableName.Length() + aAttribute.Length(); |
|
4177 HBufC *statementStr = FormatStatementLC(KDeleteFromTable(), formattedLen, &aTableName, &aAttribute ); |
|
4178 TInt numberOfValues = 1; |
|
4179 ExecuteStatementL(*statementStr, numberOfValues, EValueInteger, aValue); |
|
4180 DEBUG_PRINTF4(_L8("%S info where %S = %d has been deleted."), &aTableName, &aAttribute, aValue); |
|
4181 CleanupStack::PopAndDestroy(statementStr); |
|
4182 } |
|
4183 |
|
4184 CCaptionAndIconInfo* CScrRequestImpl::GetCaptionAndIconInfoL(TInt aCaptionAndIconId) const |
|
4185 { |
|
4186 _LIT(KGetLocalizedCaptionAndIconInfo, "Select Caption,NumberOfIcons,Iconfile from CaptionAndIconInfo where CaptionAndIconId = ?"); |
|
4187 CStatement *stmt = iDbHandle->PrepareStatementLC(KGetLocalizedCaptionAndIconInfo); |
|
4188 stmt->BindIntL(1, aCaptionAndIconId); |
|
4189 if(stmt->ProcessNextRowL()) |
|
4190 { |
|
4191 TPtrC caption(stmt->StrColumnL(0)); |
|
4192 TInt noOfAppIcons(stmt->IntColumnL(1)); |
|
4193 TPtrC iconFilename(stmt->StrColumnL(2)); |
|
4194 CCaptionAndIconInfo* captionandIconInfo = CCaptionAndIconInfo::NewL(caption, iconFilename, noOfAppIcons); |
|
4195 DEBUG_PRINTF2(_L("The Caption for this App is %S "), captionandIconInfo->iCaption); |
|
4196 DEBUG_PRINTF2(_L("The Number of AppIcons for this App is %d "), captionandIconInfo->iNumOfAppIcons); |
|
4197 DEBUG_PRINTF2(_L("The Icon File Name this App is %S "), captionandIconInfo->iIconFileName); |
|
4198 CleanupStack::PopAndDestroy(stmt); |
|
4199 return captionandIconInfo; |
|
4200 } |
|
4201 else |
|
4202 { |
|
4203 CleanupStack::PopAndDestroy(stmt); |
|
4204 return NULL; |
|
4205 } |
|
4206 } |
|
4207 |
|
4208 void CScrRequestImpl::GetViewsL(RPointerArray<Usif::CAppViewData>& aViewInfoArray, TUid aAppUid, TLanguage aLanguage) const |
|
4209 { |
|
4210 _LIT(KSelectViewDetailsWithAppUid, "SELECT Uid, ScreenMode, CaptionAndIconId FROM ViewData WHERE LocalAppInfoId IN(SELECT LocalAppInfoId FROM LocalizableAppInfo WHERE AppUid = ? AND Locale = ?);"); |
|
4211 CStatement *stmt1 = iDbHandle->PrepareStatementLC(KSelectViewDetailsWithAppUid); |
|
4212 stmt1->BindIntL(1, aAppUid.iUid); |
|
4213 stmt1->BindIntL(2, aLanguage); |
|
4214 aViewInfoArray.ResetAndDestroy(); |
|
4215 while(stmt1->ProcessNextRowL()) |
|
4216 { |
|
4217 TUid uid; |
|
4218 uid.iUid = stmt1->IntColumnL(0); |
|
4219 TInt screenMode(stmt1->IntColumnL(1)); |
|
4220 TInt captionAndIconId(stmt1->IntColumnL(2)); |
|
4221 DEBUG_PRINTF2(_L("The view Uid for this App is 0x%x "),uid.iUid); |
|
4222 DEBUG_PRINTF2(_L("The view Screen Mode for this App is %d "), screenMode); |
|
4223 CCaptionAndIconInfo *captionAndIconInfo = GetCaptionAndIconInfoL(captionAndIconId); |
|
4224 CAppViewData *viewdataInfo = CAppViewData::NewLC(uid, screenMode, captionAndIconInfo); |
|
4225 aViewInfoArray.AppendL(viewdataInfo); |
|
4226 CleanupStack::Pop(viewdataInfo); // viewdataInfo |
|
4227 } |
|
4228 CleanupStack::PopAndDestroy(1, stmt1); // stmt1 |
|
4229 } |
|
4230 |
|
4231 void CScrRequestImpl::GetViewSizeL(const RMessage2& aMessage, TUid aAppUid, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
4232 { |
|
4233 GetViewsL(aSubsessionContext->iViewInfoArray,aAppUid,aSubsessionContext->iAppLanguageForCurrentLocale); |
|
4234 if(aSubsessionContext->iViewInfoArray.Count() == 0) |
|
4235 { |
|
4236 DEBUG_PRINTF2(_L8("No view details associated with the given AppUid,%d"),aAppUid); |
|
4237 } |
|
4238 DEBUG_PRINTF2(_L8("Returning the view details' entry size of application(0x%x) for the current locale."), aAppUid); |
|
4239 WriteArraySizeL(aMessage, 1, aSubsessionContext->iViewInfoArray); |
|
4240 } |
|
4241 |
|
4242 void CScrRequestImpl::GetViewDataL(const RMessage2& aMessage, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
4243 { |
|
4244 DEBUG_PRINTF(_L8("Returning the localized information entry data.")); |
|
4245 WriteArrayDataL(aMessage, 0, aSubsessionContext->iViewInfoArray); |
|
4246 aSubsessionContext->iViewInfoArray.ResetAndDestroy(); |
|
4247 } |
|
4248 |
|
4249 void CScrRequestImpl::OpenApplicationRegistrationViewL(const RMessage2& aMessage, CAppRegistrySubsessionContext* aSubsessionContext) |
|
4250 { |
|
4251 TLanguage requiredLanguage = TLanguage(aMessage.Int0()); |
|
4252 if(requiredLanguage == KUnspecifiedLocale) |
|
4253 { |
|
4254 requiredLanguage = User::Language(); |
|
4255 } |
|
4256 aSubsessionContext->iLanguage = requiredLanguage; |
|
4257 |
|
4258 CStatement* stmt; |
|
4259 _LIT(KAllAppIds," SELECT AppUid from AppRegistrationInfo"); |
|
4260 stmt = iDbHandle->PrepareStatementLC(KAllAppIds); |
|
4261 aSubsessionContext->iAppUids.Close(); |
|
4262 while(stmt->ProcessNextRowL()) |
|
4263 { |
|
4264 aSubsessionContext->iAppUids.AppendL(TUid::Uid(stmt->IntColumnL(0))); |
|
4265 } |
|
4266 CleanupStack::PopAndDestroy(stmt); |
|
4267 } |
|
4268 |
|
4269 void CScrRequestImpl::OpenApplicationRegistrationForAppUidsViewL(const RMessage2& aMessage, CAppRegistrySubsessionContext* aSubsessionContext) |
|
4270 { |
|
4271 TLanguage requiredLanguage = TLanguage(aMessage.Int0()); |
|
4272 if(requiredLanguage == KUnspecifiedLocale) |
|
4273 { |
|
4274 requiredLanguage = User::Language(); |
|
4275 } |
|
4276 aSubsessionContext->iLanguage = requiredLanguage; |
|
4277 |
|
4278 //Read languages need to pass |
|
4279 TInt bufSize=0; |
|
4280 bufSize = aMessage.GetDesMaxLength(1); |
|
4281 HBufC8* bufToHoldAppUids = HBufC8::NewLC(bufSize); |
|
4282 TPtr8 bufPtrDscToHoldAppUids = bufToHoldAppUids->Des(); |
|
4283 aMessage.ReadL(1, bufPtrDscToHoldAppUids); |
|
4284 RDesReadStream inStream(bufPtrDscToHoldAppUids); |
|
4285 CleanupClosePushL(inStream); |
|
4286 TInt size = inStream.ReadInt32L(); |
|
4287 |
|
4288 aSubsessionContext->iAppUids.Close(); |
|
4289 for (TInt i =0; i<size ;i++) |
|
4290 { |
|
4291 TUid appUid = TUid::Uid(inStream.ReadInt32L()); |
|
4292 if(CheckIfAppUidExistsL(appUid)) //Append only if AppUid is present in DB. |
|
4293 { |
|
4294 aSubsessionContext->iAppUids.AppendL(appUid); |
|
4295 } |
|
4296 } |
|
4297 |
|
4298 CleanupStack::PopAndDestroy(2,bufToHoldAppUids); //bufToHoldAppUids, inStream |
|
4299 } |
|
4300 |
|
4301 TBool CScrRequestImpl::GetApplicationRegistrationInfoL(CApplicationRegistrationData& aApplicationRegistration,TUid aAppUid) const |
|
4302 { |
|
4303 _LIT(KSelectAppRegInfo, "SELECT AppUid, ComponentId, AppFile, TypeId, Attributes, Hidden, Embeddable, NewFile, Launch, GroupName, DefaultScreenNumber FROM AppRegistrationInfo WHERE AppUid = ?"); |
|
4304 |
|
4305 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppRegInfo); |
|
4306 stmt->BindIntL(1, aAppUid.iUid); |
|
4307 if(stmt->ProcessNextRowL()) |
|
4308 { |
|
4309 aApplicationRegistration.iAppUid = TUid::Uid(stmt->IntColumnL(0)); |
|
4310 HBufC* appFile = stmt->StrColumnL(2).AllocLC(); |
|
4311 DeleteObjectZ(aApplicationRegistration.iAppFile); |
|
4312 aApplicationRegistration.iAppFile = appFile; |
|
4313 aApplicationRegistration.iTypeId = stmt->IntColumnL(3); |
|
4314 aApplicationRegistration.iCharacteristics.iAttributes = stmt->IntColumnL(4); |
|
4315 aApplicationRegistration.iCharacteristics.iAppIsHidden = stmt->IntColumnL(5); |
|
4316 aApplicationRegistration.iCharacteristics.iEmbeddability = (TApplicationCharacteristics::TAppEmbeddability)stmt->IntColumnL(6); |
|
4317 aApplicationRegistration.iCharacteristics.iSupportsNewFile = stmt->IntColumnL(7); |
|
4318 aApplicationRegistration.iCharacteristics.iLaunchInBackground = stmt->IntColumnL(8); |
|
4319 aApplicationRegistration.iCharacteristics.iGroupName = stmt->StrColumnL(9); |
|
4320 aApplicationRegistration.iDefaultScreenNumber = stmt->IntColumnL(10); |
|
4321 |
|
4322 DEBUG_PRINTF2(_L("The Uid for this App is 0x%x "),aApplicationRegistration.iAppUid); |
|
4323 DEBUG_PRINTF2(_L("The App File for this App is %S "), aApplicationRegistration.iAppFile); |
|
4324 DEBUG_PRINTF2(_L("The Attribute for this App is %d "), aApplicationRegistration.iCharacteristics.iAttributes); |
|
4325 DEBUG_PRINTF2(_L("The Hidden for this App is %d "), (aApplicationRegistration.iCharacteristics.iAppIsHidden)); |
|
4326 DEBUG_PRINTF2(_L("The Embeddability for this App is %d "), aApplicationRegistration.iCharacteristics.iEmbeddability); |
|
4327 DEBUG_PRINTF2(_L("The New File for this App is %d "), aApplicationRegistration.iCharacteristics.iSupportsNewFile); |
|
4328 DEBUG_PRINTF2(_L("The Launch for this App is %d "), aApplicationRegistration.iCharacteristics.iLaunchInBackground); |
|
4329 DEBUG_PRINTF2(_L("The Group Name for this App is %S "), &(aApplicationRegistration.iCharacteristics.iGroupName)); |
|
4330 DEBUG_PRINTF2(_L("The Default screen number for this App is %d "), aApplicationRegistration.iDefaultScreenNumber); |
|
4331 |
|
4332 CleanupStack::Pop(1); |
|
4333 } |
|
4334 else |
|
4335 { |
|
4336 DEBUG_PRINTF2(_L8("AppUid %d Not Found in th SCR"),aAppUid); |
|
4337 CleanupStack::PopAndDestroy(stmt); |
|
4338 return EFalse; |
|
4339 } |
|
4340 CleanupStack::PopAndDestroy(stmt); |
|
4341 return ETrue; |
|
4342 } |
|
4343 |
|
4344 void CScrRequestImpl::GetFileOwnershipInfoL(CApplicationRegistrationData& aApplicationRegistration,TUid aAppUid) const |
|
4345 { |
|
4346 _LIT(KGetFileOwnershipInfo, "SELECT FileName FROM FileOwnershipInfo WHERE AppUid = ?"); |
|
4347 CStatement *stmt = iDbHandle->PrepareStatementLC(KGetFileOwnershipInfo); |
|
4348 stmt->BindIntL(1, aAppUid.iUid); |
|
4349 aApplicationRegistration.iOwnedFileArray.ResetAndDestroy(); |
|
4350 while(stmt->ProcessNextRowL()) |
|
4351 { |
|
4352 HBufC *fileName = stmt->StrColumnL(0).AllocLC(); |
|
4353 aApplicationRegistration.iOwnedFileArray.AppendL(fileName); |
|
4354 DEBUG_PRINTF2(_L("The File Name for owned Files for this App is %S "), fileName); |
|
4355 CleanupStack::Pop(); |
|
4356 } |
|
4357 CleanupStack::PopAndDestroy(stmt); |
|
4358 } |
|
4359 |
|
4360 |
|
4361 void CScrRequestImpl::GetDataTypesL(RPointerArray<Usif::CDataType>& aDataTypes,TInt aServiceId)const |
|
4362 { |
|
4363 _LIT(KGetDataType, "SELECT Priority, Type FROM DataType where ServiceId = ?"); |
|
4364 CStatement *stmt = iDbHandle->PrepareStatementLC(KGetDataType); |
|
4365 stmt->BindIntL(1, aServiceId); |
|
4366 aDataTypes.ResetAndDestroy(); |
|
4367 while(stmt->ProcessNextRowL()) |
|
4368 { |
|
4369 Usif::CDataType* dataType = CDataType::NewLC(); |
|
4370 dataType->iPriority = stmt->IntColumnL(0); |
|
4371 DeleteObjectZ(dataType->iType); |
|
4372 dataType->iType = stmt->StrColumnL(1).AllocLC(); |
|
4373 DEBUG_PRINTF2(_L("The Service Info Priority for this App is %d "), dataType->iPriority); |
|
4374 DEBUG_PRINTF2(_L("The Service Type for this App is %S "), dataType->iType); |
|
4375 aDataTypes.AppendL(dataType); |
|
4376 CleanupStack::Pop(2,dataType); //for iType and dataType |
|
4377 } |
|
4378 CleanupStack::PopAndDestroy(stmt); |
|
4379 } |
|
4380 |
|
4381 void CScrRequestImpl::GetServiceInfoL(CApplicationRegistrationData& aApplicationRegistration, TUid aAppUid, TLanguage aLanguage) const |
|
4382 { |
|
4383 Usif::CServiceInfo* serviceInfo = NULL; |
|
4384 TInt serviceId = 0; |
|
4385 _LIT(KGetServiceInfo, "SELECT ServiceId, Uid FROM ServiceInfo where AppUid = ?"); |
|
4386 CStatement *stmt = iDbHandle->PrepareStatementLC(KGetServiceInfo); |
|
4387 stmt->BindIntL(1, aAppUid.iUid); |
|
4388 aApplicationRegistration.iServiceArray.ResetAndDestroy(); |
|
4389 while(stmt->ProcessNextRowL()) |
|
4390 { |
|
4391 serviceInfo = Usif::CServiceInfo::NewLC(); |
|
4392 serviceId = stmt->IntColumnL(0); |
|
4393 serviceInfo->iUid = TUid::Uid(stmt->IntColumnL(1)); |
|
4394 |
|
4395 DEBUG_PRINTF2(_L("The Service Uid for this App is 0x%x "), serviceInfo->iUid); |
|
4396 if(serviceInfo->iUid.iUid) |
|
4397 { |
|
4398 TLanguage storedLanguage = aLanguage; |
|
4399 GetNearestAppLanguageL(aLanguage, aAppUid, storedLanguage); |
|
4400 GetOpaqueDataArrayL(aAppUid, serviceInfo->iUid, serviceInfo->iOpaqueDataArray, storedLanguage); |
|
4401 } |
|
4402 |
|
4403 //populate the data types for a service Id |
|
4404 GetDataTypesL(serviceInfo->iDataTypes,serviceId); |
|
4405 |
|
4406 aApplicationRegistration.iServiceArray.AppendL(serviceInfo); |
|
4407 CleanupStack::Pop(serviceInfo); // serviceInfo |
|
4408 } |
|
4409 CleanupStack::PopAndDestroy(stmt); |
|
4410 } |
|
4411 |
|
4412 void CScrRequestImpl::GetLocalizableAppInfoL(CApplicationRegistrationData& aApplicationRegistration,TUid aAppUid, TLanguage aLanguage) |
|
4413 { |
|
4414 TLanguage storedLanguage; |
|
4415 if(GetNearestAppLanguageL(aLanguage, aAppUid, storedLanguage)) |
|
4416 { |
|
4417 Usif::CLocalizableAppInfo* localizedAppInfo = NULL; |
|
4418 _LIT(KGetServiceInfo, "Select ShortCaption,GroupName,Locale,CaptionAndIconId from LocalizableAppInfo where AppUid = ? and Locale = ?"); |
|
4419 CStatement *stmt = iDbHandle->PrepareStatementLC(KGetServiceInfo); |
|
4420 stmt->BindIntL(1, aAppUid.iUid); |
|
4421 stmt->BindIntL(2, (TInt)storedLanguage); |
|
4422 if(stmt->ProcessNextRowL()) |
|
4423 { |
|
4424 localizedAppInfo = Usif::CLocalizableAppInfo::NewLC(); |
|
4425 DeleteObjectZ(localizedAppInfo->iShortCaption); |
|
4426 localizedAppInfo->iShortCaption = stmt->StrColumnL(0).AllocLC(); |
|
4427 DeleteObjectZ(localizedAppInfo->iGroupName); |
|
4428 localizedAppInfo->iGroupName = stmt->StrColumnL(1).AllocLC(); |
|
4429 localizedAppInfo->iApplicationLanguage = (TLanguage)stmt->IntColumnL(2); |
|
4430 |
|
4431 DEBUG_PRINTF2(_L("The Short Caption for this App is %S "), localizedAppInfo->iShortCaption); |
|
4432 DEBUG_PRINTF2(_L("The Group name this App is %S "), localizedAppInfo->iGroupName); |
|
4433 DEBUG_PRINTF2(_L("The application language this App is %d "), localizedAppInfo->iApplicationLanguage); |
|
4434 |
|
4435 //populate localized caption and icon info |
|
4436 TInt captionAndIconID = stmt->IntColumnL(3); |
|
4437 localizedAppInfo->iCaptionAndIconInfo = GetCaptionAndIconInfoL(captionAndIconID); |
|
4438 //populate view data |
|
4439 GetViewsL(localizedAppInfo->iViewDataList, aAppUid, storedLanguage); |
|
4440 |
|
4441 aApplicationRegistration.iLocalizableAppInfoList.AppendL(localizedAppInfo); |
|
4442 CleanupStack::Pop(3,localizedAppInfo); //poping iGroupName, iShortCaption and localizedAppInfo |
|
4443 } |
|
4444 CleanupStack::PopAndDestroy(stmt); |
|
4445 } |
|
4446 else |
|
4447 { |
|
4448 DEBUG_PRINTF(_L8("No Nearest locale found for AppUid %d in the SCR")); |
|
4449 } |
|
4450 } |
|
4451 |
|
4452 void CScrRequestImpl::GetAppRegOpaqueDataL(CApplicationRegistrationData& aApplicationRegistration, TUid aAppUid, TLanguage aLanguage) const |
|
4453 { |
|
4454 TLanguage storedLanguage = aLanguage; |
|
4455 GetNearestAppLanguageL(aLanguage, aAppUid, storedLanguage); |
|
4456 GetOpaqueDataArrayL(aAppUid, TUid::Null(), aApplicationRegistration.iOpaqueDataArray, storedLanguage); |
|
4457 } |
|
4458 |
|
4459 void CScrRequestImpl::NextApplicationRegistrationInfoSizeL(const RMessage2& aMessage, CApplicationRegistrationData*& aApplicationRegistration, CAppRegistrySubsessionContext* aSubsessionContext) |
|
4460 { |
|
4461 DeleteObjectZ(aApplicationRegistration); |
|
4462 aApplicationRegistration = CApplicationRegistrationData::NewL(); |
|
4463 if((aSubsessionContext->iAppRegIndex < aSubsessionContext->iAppUids.Count())) |
|
4464 { |
|
4465 TUid appUid = aSubsessionContext->iAppUids[aSubsessionContext->iAppRegIndex]; |
|
4466 |
|
4467 //Populate the Application Registration Info |
|
4468 if(GetApplicationRegistrationInfoL(*aApplicationRegistration,appUid)) |
|
4469 { |
|
4470 //Populate File ownership info |
|
4471 GetFileOwnershipInfoL(*aApplicationRegistration,appUid); |
|
4472 |
|
4473 //Populate service info |
|
4474 GetServiceInfoL(*aApplicationRegistration, appUid, aSubsessionContext->iLanguage); |
|
4475 |
|
4476 //Populate localizable appinfo including caption and icon info |
|
4477 //and view data and its caption and icon info. |
|
4478 GetLocalizableAppInfoL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
|
4479 |
|
4480 GetAppRegOpaqueDataL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
|
4481 |
|
4482 GetAppPropertiesInfoL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
|
4483 } |
|
4484 else |
|
4485 { |
|
4486 DeleteObjectZ(aApplicationRegistration); |
|
4487 } |
|
4488 |
|
4489 //Incrementing the index |
|
4490 aSubsessionContext->iAppRegIndex++; |
|
4491 WriteObjectSizeL(aMessage, 1, aApplicationRegistration); |
|
4492 } |
|
4493 else |
|
4494 { |
|
4495 DEBUG_PRINTF(_L8("Reached the end of the view.")); |
|
4496 WriteIntValueL(aMessage, 1, 0); |
|
4497 DeleteObjectZ(aApplicationRegistration); |
|
4498 } |
|
4499 } |
|
4500 |
|
4501 void CScrRequestImpl::NextApplicationRegistrationInfoDataL(const RMessage2& aMessage, CApplicationRegistrationData*& aApplicationRegistration) |
|
4502 { |
|
4503 DEBUG_PRINTF(_L8("Returning the Application Registration data.")); |
|
4504 WriteObjectDataL(aMessage, 0, aApplicationRegistration); |
|
4505 DeleteObjectZ(aApplicationRegistration); // Delete the object to prevent it to be resent. |
|
4506 } |
|
4507 |
|
4508 void CScrRequestImpl::GetAppOwnedFilesSizeL(const RMessage2& aMessage, TUid aAppUid, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
4509 { |
|
4510 DEBUG_PRINTF2(_L8("Returning the Application Owned files size for application 0X%x."), aAppUid); |
|
4511 _LIT(KSelectFileOwnershipInfoWithAppUid, "SELECT FileName FROM FileOwnershipInfo WHERE AppUid = ? ;"); |
|
4512 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectFileOwnershipInfoWithAppUid); |
|
4513 stmt->BindIntL(1, aAppUid.iUid); |
|
4514 aSubsessionContext->iAppOwnedFiles.ResetAndDestroy(); |
|
4515 while(stmt->ProcessNextRowL()) |
|
4516 { |
|
4517 HBufC* fileName=stmt->StrColumnL(0).AllocLC(); |
|
4518 aSubsessionContext->iAppOwnedFiles.AppendL(fileName); |
|
4519 CleanupStack::Pop(1, fileName); |
|
4520 } |
|
4521 CleanupStack::PopAndDestroy(1, stmt); |
|
4522 if(0 == aSubsessionContext->iAppOwnedFiles.Count() ) |
|
4523 { |
|
4524 DEBUG_PRINTF2(_L8("Application with AppUid :0X%x does not own any file "),aAppUid); |
|
4525 } |
|
4526 WriteArraySizeL(aMessage, 1, aSubsessionContext->iAppOwnedFiles); |
|
4527 } |
|
4528 |
|
4529 void CScrRequestImpl::GetAppOwnedFilesDataL(const RMessage2& aMessage, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
4530 { |
|
4531 DEBUG_PRINTF(_L8("Returning the Application Owned files .")); |
|
4532 WriteArrayDataL(aMessage, 0, aSubsessionContext->iAppOwnedFiles); |
|
4533 aSubsessionContext->iAppOwnedFiles.ResetAndDestroy(); |
|
4534 } |
|
4535 |
|
4536 void CScrRequestImpl::GetAppCharacteristicsL(const RMessage2& aMessage, TUid aAppUid) const |
|
4537 { |
|
4538 DEBUG_PRINTF2(_L8("Returning the characteristics of application 0X%x."), aAppUid); |
|
4539 _LIT(KSelectApplicationCapability, "SELECT Attributes, Hidden, Embeddable, NewFile, Launch, GroupName FROM AppRegistrationInfo WHERE AppUid = ? ;"); |
|
4540 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectApplicationCapability); |
|
4541 stmt->BindIntL(1, aAppUid.iUid); |
|
4542 TApplicationCharacteristics appCharacteristics; |
|
4543 if(stmt->ProcessNextRowL()) |
|
4544 { |
|
4545 appCharacteristics.iAttributes = stmt->IntColumnL(0); |
|
4546 appCharacteristics.iAppIsHidden = stmt->IntColumnL(1); |
|
4547 appCharacteristics.iEmbeddability = (TApplicationCharacteristics::TAppEmbeddability)stmt->IntColumnL(2); |
|
4548 appCharacteristics.iSupportsNewFile = stmt->IntColumnL(3); |
|
4549 appCharacteristics.iLaunchInBackground = stmt->IntColumnL(4); |
|
4550 appCharacteristics.iGroupName = stmt->StrColumnL(5); |
|
4551 TPckgC<TApplicationCharacteristics> infoPk(appCharacteristics); |
|
4552 aMessage.WriteL(0, infoPk); |
|
4553 } |
|
4554 else |
|
4555 { |
|
4556 DEBUG_PRINTF2(_L8("No Data found for Application capability with AppUid :0X%x "),aAppUid); |
|
4557 } |
|
4558 CleanupStack::PopAndDestroy(1, stmt); |
|
4559 } |
|
4560 |
|
4561 void CScrRequestImpl::GetAppIconForFileNameL(const RMessage2& aMessage, TUid aAppUid, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
4562 { |
|
4563 DEBUG_PRINTF2(_L8("Returning the Icon File Name for application 0X%x."), aAppUid); |
|
4564 _LIT(KSelectIconFileNameForApplication, "SELECT IconFile FROM CaptionAndIconInfo WHERE CaptionAndIconId IN (SELECT CaptionAndIconId FROM LocalizableAppInfo WHERE AppUid = ? AND Locale = ?);"); |
|
4565 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectIconFileNameForApplication); |
|
4566 stmt->BindIntL(1, aAppUid.iUid); |
|
4567 stmt->BindIntL(2, aSubsessionContext->iAppLanguageForCurrentLocale); |
|
4568 if(stmt->ProcessNextRowL()) |
|
4569 { |
|
4570 TFileName fileName = stmt->StrColumnL(0); |
|
4571 TPckgC<TFileName> pckg(fileName); |
|
4572 aMessage.WriteL(0, pckg); |
|
4573 } |
|
4574 else |
|
4575 { |
|
4576 DEBUG_PRINTF2(_L8("No Icon file found for Application with AppUid :0X%x "),aAppUid); |
|
4577 } |
|
4578 CleanupStack::PopAndDestroy(1, stmt); |
|
4579 } |
|
4580 |
|
4581 void CScrRequestImpl::GetAppViewIconFileNameL(const RMessage2& aMessage, TUid aAppUid, CRegInfoForApplicationSubsessionContext *aSubsessionContext) const |
|
4582 { |
|
4583 TUid viewUid; |
|
4584 viewUid.iUid= aMessage.Int0(); |
|
4585 DEBUG_PRINTF2(_L8("Returning the view Icon File Name size for application 0X%x."), aAppUid); |
|
4586 _LIT(KSelectIconFileNameFromViewForApplication, "SELECT IconFile FROM CaptionAndIconInfo WHERE CaptionAndIconId IN (SELECT CaptionAndIconId FROM ViewData WHERE Uid = ? AND LocalAppInfoId IN ( SELECT LocalAppInfoId FROM LocalizableAppInfo WHERE AppUid = ? AND Locale = ?));"); |
|
4587 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectIconFileNameFromViewForApplication); |
|
4588 stmt->BindIntL(1, viewUid.iUid); |
|
4589 stmt->BindIntL(2, aAppUid.iUid); |
|
4590 stmt->BindIntL(3, aSubsessionContext->iAppLanguageForCurrentLocale); |
|
4591 if(stmt->ProcessNextRowL()) |
|
4592 { |
|
4593 TFileName fileName = stmt->StrColumnL(0); |
|
4594 TPckgC<TFileName> pckg(fileName); |
|
4595 aMessage.WriteL(1, pckg); |
|
4596 } |
|
4597 else |
|
4598 { |
|
4599 DEBUG_PRINTF3(_L8("No view Icon file found for Application with AppUid :0X%x and View ID :0X%x "),aAppUid,viewUid); |
|
4600 } |
|
4601 CleanupStack::PopAndDestroy(1, stmt); |
|
4602 } |
|
4603 |
|
4604 void CScrRequestImpl::GetAppServiceInfoSizeL(const RMessage2& aMessage, CApplicationRegInfoSubsessionContext *aSubsessionContext ) const |
|
4605 { |
|
4606 CAppServiceInfoFilter *filter = ReadObjectFromMessageLC<CAppServiceInfoFilter>(aMessage, 0); |
|
4607 TLanguage locale = (TLanguage)aMessage.Int1(); |
|
4608 |
|
4609 switch(filter->iSetFlag) |
|
4610 { |
|
4611 case CAppServiceInfoFilter::EGetServiceInfoForApp: |
|
4612 { |
|
4613 GetAppServicesL(filter->iAppUid, aSubsessionContext->iServiceInfoArray, locale); |
|
4614 break; |
|
4615 } |
|
4616 case CAppServiceInfoFilter::EGetServiceImplementationForServiceUid: |
|
4617 { |
|
4618 GetServiceImplementationsL(filter->iServiceUid, aSubsessionContext->iServiceInfoArray, locale); |
|
4619 break; |
|
4620 } |
|
4621 case CAppServiceInfoFilter::EGetServiceImplementationForServiceUidAndDatatType: |
|
4622 { |
|
4623 GetServiceImplementationsL(filter->iServiceUid, *(filter->iDataType), aSubsessionContext->iServiceInfoArray, locale); |
|
4624 break; |
|
4625 } |
|
4626 case CAppServiceInfoFilter::EGetOpaqueDataForAppWithServiceUid: |
|
4627 { |
|
4628 GetAppServiceOpaqueDataL(filter->iAppUid, filter->iServiceUid, aSubsessionContext->iServiceInfoArray, locale); |
|
4629 break; |
|
4630 } |
|
4631 default: |
|
4632 { |
|
4633 DEBUG_PRINTF(_L8("No match found for the query requested.")); |
|
4634 User::Leave(KErrArgument); |
|
4635 } |
|
4636 } |
|
4637 if(aSubsessionContext->iServiceInfoArray.Count()== 0) |
|
4638 { |
|
4639 DEBUG_PRINTF(_L8("No service info associated with the given parameters found")); |
|
4640 User::Leave(KErrNotFound); |
|
4641 } |
|
4642 WriteArraySizeL(aMessage, 2, aSubsessionContext->iServiceInfoArray); |
|
4643 CleanupStack::PopAndDestroy(filter); |
|
4644 } |
|
4645 |
|
4646 void CScrRequestImpl::GetAppServiceInfoDataL(const RMessage2& aMessage, CApplicationRegInfoSubsessionContext *aSubsessionContext) const |
|
4647 { |
|
4648 DEBUG_PRINTF(_L8("Returning the service information details.")); |
|
4649 WriteArrayDataL(aMessage, 0, aSubsessionContext->iServiceInfoArray); |
|
4650 aSubsessionContext->iServiceInfoArray.ResetAndDestroy(); |
|
4651 } |
|
4652 |
|
4653 void CScrRequestImpl::GetAppServicesL(TUid aAppUid, RPointerArray< |
|
4654 CServiceInfo>& aServiceInfoArray, TLanguage aLocale) const |
|
4655 { |
|
4656 DEBUG_PRINTF2(_L8("Returning the size of the service info details entry of application (%d)."), aAppUid.iUid); |
|
4657 _LIT(KSelectMatchingServiceInfo, "SELECT ServiceId, Uid FROM ServiceInfo WHERE AppUid=?;"); |
|
4658 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectMatchingServiceInfo); |
|
4659 stmt->BindIntL(1, aAppUid.iUid); |
|
4660 aServiceInfoArray.ResetAndDestroy(); |
|
4661 while (stmt->ProcessNextRowL()) |
|
4662 { |
|
4663 /* AppProperties is being used for OpaqueData of both AppRegInfo |
|
4664 * and ServiceInfo. So add to ServiceInfoArray only if serviceId is not 0 |
|
4665 */ |
|
4666 if (stmt->IntColumnL(1)) |
|
4667 { |
|
4668 CServiceInfo* serviceInfo = CServiceInfo::NewLC(); |
|
4669 serviceInfo->iUid = TUid::Uid(stmt->IntColumnL(1)); |
|
4670 |
|
4671 TLanguage finalLocale = KUnspecifiedLocale; |
|
4672 GetNearestAppLanguageL(aLocale, aAppUid, finalLocale); |
|
4673 GetOpaqueDataArrayL(aAppUid, serviceInfo->iUid, serviceInfo->iOpaqueDataArray, finalLocale); |
|
4674 GetDataTypesL(serviceInfo->iDataTypes, stmt->IntColumnL(0)); |
|
4675 aServiceInfoArray.AppendL(serviceInfo); |
|
4676 CleanupStack::Pop(serviceInfo); |
|
4677 } |
|
4678 } |
|
4679 // Release allocated memories |
|
4680 CleanupStack::PopAndDestroy(1, stmt); // stmt |
|
4681 } |
|
4682 |
|
4683 void CScrRequestImpl::GetServiceImplementationsL(TUid aServiceUid, |
|
4684 RPointerArray<CServiceInfo>& aServiceInfoArray, TLanguage aLocale) const |
|
4685 { |
|
4686 if (aServiceUid.iUid) |
|
4687 { |
|
4688 DEBUG_PRINTF2(_L8("Returning the size of the service info details entry associated with service Uid (%d)."), aServiceUid.iUid); |
|
4689 _LIT(KSelectMatchingServiceInfo, "SELECT ServiceId, Uid, AppUid FROM ServiceInfo WHERE Uid=?;"); |
|
4690 CStatement *stmt = iDbHandle->PrepareStatementLC( |
|
4691 KSelectMatchingServiceInfo); |
|
4692 stmt->BindIntL(1, aServiceUid.iUid); |
|
4693 aServiceInfoArray.ResetAndDestroy(); |
|
4694 while (stmt->ProcessNextRowL()) |
|
4695 { |
|
4696 CServiceInfo* serviceInfo = CServiceInfo::NewLC(); |
|
4697 |
|
4698 serviceInfo->iUid = TUid::Uid(stmt->IntColumnL(1)); |
|
4699 TUid appUid = TUid::Uid(stmt->IntColumnL(2)); |
|
4700 TLanguage finalLocale = KUnspecifiedLocale; |
|
4701 GetNearestAppLanguageL(aLocale, appUid, finalLocale); |
|
4702 GetOpaqueDataArrayL(appUid, serviceInfo->iUid, serviceInfo->iOpaqueDataArray, finalLocale); |
|
4703 GetDataTypesL(serviceInfo->iDataTypes, stmt->IntColumnL(0)); |
|
4704 |
|
4705 aServiceInfoArray.AppendL(serviceInfo); |
|
4706 CleanupStack::Pop(serviceInfo); |
|
4707 } |
|
4708 // Release allocated memories |
|
4709 CleanupStack::PopAndDestroy(1, stmt); // stmt |
|
4710 } |
|
4711 } |
|
4712 |
|
4713 void CScrRequestImpl::GetServiceImplementationsL(TUid aServiceUid, |
|
4714 TDesC& aDataType, RPointerArray<CServiceInfo>& aServiceInfoArray, TLanguage aLocale) const |
|
4715 { |
|
4716 if (aServiceUid.iUid) |
|
4717 { |
|
4718 DEBUG_PRINTF3(_L8("Returning the size of the service info details entry associated with service Uid (%d) and datatype (%S)."), aServiceUid.iUid, &aDataType); |
|
4719 _LIT(KSelectMatchingServiceInfo, "SELECT Uid, Priority, Type, AppUid FROM (ServiceInfo JOIN DataType ON ServiceInfo.ServiceId = DataType.ServiceId) WHERE Uid=? AND Type=?;"); |
|
4720 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectMatchingServiceInfo); |
|
4721 stmt->BindIntL(1, aServiceUid.iUid); |
|
4722 stmt->BindStrL(2, aDataType); |
|
4723 aServiceInfoArray.ResetAndDestroy(); |
|
4724 while (stmt->ProcessNextRowL()) |
|
4725 { |
|
4726 CServiceInfo* serviceInfo = CServiceInfo::NewLC(); |
|
4727 |
|
4728 serviceInfo->iUid = TUid::Uid(stmt->IntColumnL(0)); |
|
4729 |
|
4730 TUid appUid = TUid::Uid(stmt->IntColumnL(3)); |
|
4731 TLanguage finalLocale = KUnspecifiedLocale; |
|
4732 GetNearestAppLanguageL(aLocale, appUid, finalLocale); |
|
4733 GetOpaqueDataArrayL(appUid, serviceInfo->iUid, serviceInfo->iOpaqueDataArray, finalLocale); |
|
4734 TInt priority(stmt->IntColumnL(1)); |
|
4735 TPtrC datatype(stmt->StrColumnL(2)); |
|
4736 CDataType* dataType = CDataType::NewL(priority,datatype); |
|
4737 CleanupStack::PushL(dataType); |
|
4738 serviceInfo->iDataTypes.AppendL(dataType); |
|
4739 CleanupStack::Pop(dataType); |
|
4740 aServiceInfoArray.AppendL(serviceInfo); |
|
4741 CleanupStack::Pop(serviceInfo); |
|
4742 } |
|
4743 // Release allocated memories |
|
4744 CleanupStack::PopAndDestroy(1, stmt); // stmt |
|
4745 } |
|
4746 } |
|
4747 |
|
4748 |
|
4749 void CScrRequestImpl::GetAppServiceOpaqueDataL(TUid aAppUid, |
|
4750 TUid aServiceUid, RPointerArray<CServiceInfo>& aServiceInfoArray, TLanguage aLocale) const |
|
4751 { |
|
4752 if (aServiceUid.iUid) |
|
4753 { |
|
4754 DEBUG_PRINTF3(_L8("Returning the size of the service info details entry associated with app Uid (%d) and service Uid (%d)."), aAppUid.iUid, aServiceUid.iUid); |
|
4755 _LIT(KSelectMatchingServiceInfo, "SELECT ServiceId, Uid FROM ServiceInfo WHERE AppUid=? AND Uid=? ;"); |
|
4756 CStatement *stmt = iDbHandle->PrepareStatementLC( |
|
4757 KSelectMatchingServiceInfo); |
|
4758 stmt->BindIntL(1, aAppUid.iUid); |
|
4759 stmt->BindIntL(2, aServiceUid.iUid); |
|
4760 aServiceInfoArray.ResetAndDestroy(); |
|
4761 while (stmt->ProcessNextRowL()) |
|
4762 { |
|
4763 CServiceInfo* serviceInfo = CServiceInfo::NewLC(); |
|
4764 |
|
4765 serviceInfo->iUid = TUid::Uid(stmt->IntColumnL(1)); |
|
4766 TLanguage finalLocale = KUnspecifiedLocale; |
|
4767 GetNearestAppLanguageL(aLocale, aAppUid, finalLocale); |
|
4768 GetOpaqueDataArrayL(aAppUid, serviceInfo->iUid, serviceInfo->iOpaqueDataArray, finalLocale); |
|
4769 GetDataTypesL(serviceInfo->iDataTypes, stmt->IntColumnL(0)); |
|
4770 |
|
4771 aServiceInfoArray.AppendL(serviceInfo); |
|
4772 CleanupStack::Pop(serviceInfo); |
|
4773 } |
|
4774 // Release allocated memories |
|
4775 CleanupStack::PopAndDestroy(1, stmt); // stmt |
|
4776 } |
|
4777 } |
|
4778 |
|
4779 void CScrRequestImpl::GetOpaqueDataArrayL(TUid aAppUid, TUid aServiceUid, RPointerArray<COpaqueData>& aOpaqueDataArray, TLanguage aLanguage) const |
|
4780 { |
|
4781 _LIT(KOpaqueData, "SELECT StrValue FROM AppProperties where Name = ? AND ServiceUid = ? AND AppUid = ? AND Locale = ?"); |
|
4782 CStatement *stmt = iDbHandle->PrepareStatementLC(KOpaqueData); |
|
4783 |
|
4784 stmt->BindStrL(1, _L("OpaqueData")); |
|
4785 stmt->BindIntL(2, aServiceUid.iUid); |
|
4786 stmt->BindIntL(3, aAppUid.iUid); |
|
4787 stmt->BindIntL(4, (TInt)aLanguage); |
|
4788 |
|
4789 aOpaqueDataArray.ResetAndDestroy(); |
|
4790 while (stmt->ProcessNextRowL()) |
|
4791 { |
|
4792 Usif::COpaqueData* opaqueData = Usif::COpaqueData::NewLC(); |
|
4793 opaqueData->iLanguage = aLanguage; |
|
4794 DeleteObjectZ(opaqueData->iOpaqueData); |
|
4795 opaqueData->iOpaqueData = stmt->BinaryColumnL(0).AllocL(); |
|
4796 DEBUG_PRINTF2(_L("Locale for opaque entry for this App is %d "), opaqueData->iLanguage); |
|
4797 aOpaqueDataArray.AppendL(opaqueData); |
|
4798 CleanupStack::Pop(opaqueData); |
|
4799 } |
|
4800 CleanupStack::PopAndDestroy(stmt); |
|
4801 } |
|
4802 |
|
4803 TBool CScrRequestImpl::GetComponentIdForAppInternalL(TUid aAppUid, TComponentId& aComponentId) const |
|
4804 { |
|
4805 return GetIntforConditionL(KComponentIdColumnName, KAppRegistrationInfoTable, KAppIdColumnName, aAppUid.iUid, aComponentId); |
|
4806 } |
|
4807 |
|
4808 void CScrRequestImpl::GetComponentIdForAppL(const RMessage2& aMessage) const |
|
4809 { |
|
4810 DEBUG_PRINTF(_L8("Returning the componentId that the given appUid is associated with.")); |
|
4811 TUid appUid; |
|
4812 TPckg<TUid> appUidPckg(appUid); |
|
4813 aMessage.ReadL(0,appUidPckg); |
|
4814 TComponentId compId; |
|
4815 |
|
4816 if(GetComponentIdForAppInternalL(appUid, compId)) |
|
4817 { |
|
4818 TPckg<TComponentId> compIdPckg(compId); |
|
4819 aMessage.WriteL(1, compIdPckg); |
|
4820 } |
|
4821 else |
|
4822 { |
|
4823 DEBUG_PRINTF(_L8("The given app doesnot exist")); |
|
4824 User::Leave(KErrNotFound); |
|
4825 } |
|
4826 } |
|
4827 |
|
4828 void CScrRequestImpl::GetAppUidsForComponentSizeL(const RMessage2& aMessage) const |
|
4829 { |
|
4830 DEBUG_PRINTF(_L8("Returning the size of the list of AppUids associated with the component.")); |
|
4831 TComponentId compId = aMessage.Int0(); |
|
4832 |
|
4833 _LIT(KSelectAppUids, "SELECT AppUid FROM AppRegistrationInfo WHERE ComponentId=?;"); |
|
4834 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppUids); |
|
4835 stmt->BindIntL(1, compId); |
|
4836 iComponentAppUids.Close(); |
|
4837 while(stmt->ProcessNextRowL()) |
|
4838 { |
|
4839 TInt appUid(stmt->IntColumnL(0)); |
|
4840 iComponentAppUids.AppendL(TUid::Uid(appUid)); |
|
4841 } |
|
4842 // Release allocated memories |
|
4843 CleanupStack::PopAndDestroy(1, stmt); // stmt |
|
4844 |
|
4845 if(iComponentAppUids.Count()== 0) |
|
4846 { |
|
4847 DEBUG_PRINTF(_L8("No apps associated with the given componentId found")); |
|
4848 User::Leave(KErrNotFound); |
|
4849 } |
|
4850 |
|
4851 WriteArraySizeL(aMessage, 1, iComponentAppUids); |
|
4852 } |
|
4853 |
|
4854 void CScrRequestImpl::GetAppUidsForComponentDataL(const RMessage2& aMessage) const |
|
4855 { |
|
4856 DEBUG_PRINTF(_L8("Returning the list of appUids associated with the component.")); |
|
4857 WriteArrayDataL(aMessage, 0, iComponentAppUids); |
|
4858 iComponentAppUids.Reset(); |
|
4859 } |
|
4860 |
|
4861 void CScrRequestImpl::GetApplicationInfoL(const RMessage2& aMessage) |
|
4862 { |
|
4863 TUid appUid = TUid::Uid(aMessage.Int0()); |
|
4864 TLanguage locale = (TLanguage)aMessage.Int1(); |
|
4865 if(locale == KUnspecifiedLocale) |
|
4866 { |
|
4867 locale = User::Language(); |
|
4868 } |
|
4869 TAppRegInfo appRegInfo; |
|
4870 TPckg<TAppRegInfo> appRegInfoPckg(appRegInfo); |
|
4871 aMessage.ReadL(2, appRegInfoPckg); |
|
4872 |
|
4873 _LIT(KNull,""); |
|
4874 DEBUG_PRINTF2(_L8("Returning the basic information contained in TAppRegInfo for application 0x%x."), appUid.iUid); |
|
4875 _LIT(KSelectAppInfo, "SELECT AppFile FROM AppRegistrationInfo WHERE AppUid = ?;"); |
|
4876 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppInfo); |
|
4877 stmt->BindIntL(1, appUid.iUid); |
|
4878 if(stmt->ProcessNextRowL()) |
|
4879 { |
|
4880 appRegInfo.iUid = appUid; |
|
4881 appRegInfo.iFullName.Copy(stmt->StrColumnL(0)); |
|
4882 TLanguage finallocale = KUnspecifiedLocale; |
|
4883 if(GetNearestAppLanguageL(locale,appRegInfo.iUid, finallocale)) |
|
4884 { |
|
4885 GetCaptionAndShortCaptionInfoForLocaleL(appRegInfo.iUid, finallocale, appRegInfo.iShortCaption, appRegInfo.iCaption); |
|
4886 } |
|
4887 else |
|
4888 { |
|
4889 appRegInfo.iCaption.Copy(KNull); |
|
4890 appRegInfo.iShortCaption.Copy(KNull); |
|
4891 } |
|
4892 aMessage.WriteL(2, appRegInfoPckg); |
|
4893 } |
|
4894 else |
|
4895 { |
|
4896 appRegInfo.iUid = TUid::Null(); |
|
4897 DEBUG_PRINTF2(_L8("Application 0x%x not found."), appUid.iUid); |
|
4898 } |
|
4899 CleanupStack::PopAndDestroy(stmt); |
|
4900 } |
|
4901 |
|
4902 void CScrRequestImpl::GetCaptionAndShortCaptionInfoForLocaleL(TUid aAppUid, TLanguage aLocale, TAppCaption& aShortCaption, TAppCaption& aCaption) |
|
4903 { |
|
4904 _LIT(KGetShortCaptionAndCaptionAndIconId,"SELECT CaptionAndIconId, ShortCaption FROM LocalizableAppInfo WHERE AppUid = ? AND Locale = ?;"); |
|
4905 CStatement *stmt1 = iDbHandle->PrepareStatementLC(KGetShortCaptionAndCaptionAndIconId); |
|
4906 stmt1->BindIntL(1, aAppUid.iUid); |
|
4907 stmt1->BindIntL(2, aLocale); |
|
4908 stmt1->ProcessNextRowL(); |
|
4909 aShortCaption.Copy(stmt1->StrColumnL(1)); |
|
4910 TInt captionAndIconId = stmt1->IntColumnL(0); |
|
4911 if(captionAndIconId) |
|
4912 { |
|
4913 _LIT(KGetCaption,"SELECT Caption FROM CaptionAndIconInfo WHERE CaptionAndIconId = ?;"); |
|
4914 CStatement *stmt2 = iDbHandle->PrepareStatementLC(KGetCaption); |
|
4915 stmt2->BindIntL(1, captionAndIconId); |
|
4916 stmt2->ProcessNextRowL(); |
|
4917 aCaption.Copy(stmt2->StrColumnL(0)); |
|
4918 CleanupStack::PopAndDestroy(stmt2); |
|
4919 } |
|
4920 CleanupStack::PopAndDestroy(stmt1); |
|
4921 } |
|
4922 |
|
4923 void CScrRequestImpl::GetAppPropertiesInfoL(CApplicationRegistrationData& aApplicationRegistration,TUid aAppUid, TLanguage aLanguage) |
|
4924 { |
|
4925 TLanguage appSupportedLanguage; |
|
4926 if(GetNearestAppLanguageL(aLanguage, aAppUid, appSupportedLanguage)) |
|
4927 { |
|
4928 _LIT(KGetAppPropertiesInfo, "SELECT Name, IntValue, StrValue, Locale, IsStr8Bit FROM AppProperties WHERE (AppUid =?) AND (Locale= ? OR Locale= ?)"); |
|
4929 CStatement *stmt = iDbHandle->PrepareStatementLC(KGetAppPropertiesInfo); |
|
4930 stmt->BindIntL(1, aAppUid.iUid); |
|
4931 stmt->BindIntL(2, Usif::KNonLocalized); |
|
4932 stmt->BindIntL(3, (TInt)appSupportedLanguage); |
|
4933 while(stmt->ProcessNextRowL()) |
|
4934 { |
|
4935 TPtrC name(stmt->StrColumnL(0)); |
|
4936 CPropertyEntry *entry = GetPropertyEntryL(*stmt, name, 1); // aStartingIndex=1 |
|
4937 DEBUG_PRINTF2(_L("Value read for Property %S "), &name); |
|
4938 CleanupStack::PushL(entry); |
|
4939 aApplicationRegistration.iAppPropertiesArray.AppendL(entry); |
|
4940 CleanupStack::Pop(entry); // because array is now owner |
|
4941 } |
|
4942 CleanupStack::PopAndDestroy(stmt); |
|
4943 } |
|
4944 else |
|
4945 { |
|
4946 DEBUG_PRINTF2(_L8("No Nearest locale found for AppUid %d in the SCR"), aAppUid); |
|
4947 } |
|
4948 } |
|
4949 |
|
4950 void CScrRequestImpl::GetApplicationLaunchersSizeL(const RMessage2& aMessage) const |
|
4951 { |
|
4952 DEBUG_PRINTF(_L8("Returning the size of the list of application launchers")); |
|
4953 |
|
4954 _LIT(KSelectLauncher, "SELECT SoftwareTypeId, LauncherExecutable FROM SoftwareTypes;"); |
|
4955 CStatement* stmt = iDbHandle->PrepareStatementLC(KSelectLauncher); |
|
4956 |
|
4957 while(stmt->ProcessNextRowL()) |
|
4958 { |
|
4959 CLauncherExecutable* launcher = CLauncherExecutable::NewLC(); |
|
4960 launcher->iTypeId = stmt->IntColumnL(0); |
|
4961 DeleteObjectZ(launcher->iLauncher); |
|
4962 launcher->iLauncher = stmt->StrColumnL(1).AllocL(); |
|
4963 iLaunchers.AppendL(launcher); |
|
4964 CleanupStack::Pop(launcher); |
|
4965 } |
|
4966 CleanupStack::PopAndDestroy(stmt); |
|
4967 |
|
4968 WriteArraySizeL(aMessage, 1, iLaunchers); |
|
4969 } |
|
4970 |
|
4971 void CScrRequestImpl::GetApplicationLaunchersDataL(const RMessage2& aMessage) const |
|
4972 { |
|
4973 DEBUG_PRINTF(_L8("Returning the list of application launchers")); |
|
4974 WriteArrayDataL(aMessage, 0, iLaunchers); |
|
4975 iLaunchers.ResetAndDestroy(); |
|
4976 } |
|
4977 |
|
4978 |
|
4979 void CScrRequestImpl::GenerateNonNativeAppUidL(const RMessage2& aMessage) |
|
4980 { |
|
4981 //Get access to the repository instance. |
|
4982 CScrRepository* scrRepository = CScrRepository::GetRepositoryInstanceL(); |
|
4983 |
|
4984 //Number of ranges defined in the cenrep file |
|
4985 TInt rangeCount = scrRepository->AppUidRangeCountL(); |
|
4986 |
|
4987 TUid rangeBegin = TUid::Null(); |
|
4988 TUid rangeEnd = TUid::Null(); |
|
4989 TUid generatedUid = TUid::Null(); // Used to store final result. |
|
4990 |
|
4991 for(TInt counter = 1; counter <= rangeCount; counter++) |
|
4992 { |
|
4993 // Retrieve the range. |
|
4994 TRAPD(err, scrRepository->GetAppUidRangeL(counter, rangeBegin, rangeEnd)); |
|
4995 |
|
4996 if(KErrNotFound == err) |
|
4997 continue;// Incorrect range, try the next one. |
|
4998 if(rangeBegin.iUid >= rangeEnd.iUid) |
|
4999 continue; // Incorrect range, try the next one. |
|
5000 |
|
5001 _LIT(KSelectAppUids, "SELECT AppUid FROM AppRegistrationInfo WHERE AppUid >= ? AND AppUid <= ? ORDER BY AppUid;"); |
|
5002 |
|
5003 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppUids); |
|
5004 stmt->BindIntL(1, rangeBegin.iUid); |
|
5005 stmt->BindIntL(2, rangeEnd.iUid); |
|
5006 |
|
5007 TInt prevUid = rangeBegin.iUid-1; |
|
5008 while(stmt->ProcessNextRowL()) |
|
5009 { |
|
5010 TInt currUid(stmt->IntColumnL(0)); |
|
5011 if(currUid > prevUid+1) |
|
5012 break; |
|
5013 prevUid = currUid; |
|
5014 } |
|
5015 |
|
5016 if(prevUid != rangeEnd.iUid) //If the range is not full |
|
5017 { |
|
5018 generatedUid = TUid::Uid(prevUid+1); |
|
5019 CleanupStack::PopAndDestroy(1, stmt); |
|
5020 break; |
|
5021 } |
|
5022 |
|
5023 // Release allocated memories |
|
5024 CleanupStack::PopAndDestroy(1, stmt); |
|
5025 } |
|
5026 |
|
5027 TPckg<TUid> generatedUidPckg(generatedUid); |
|
5028 aMessage.WriteL(0, generatedUidPckg); |
|
5029 } |