172 // --------------------------------------------------------------------------- |
141 // --------------------------------------------------------------------------- |
173 // |
142 // |
174 void CNcdInstallationService::ConstructL() |
143 void CNcdInstallationService::ConstructL() |
175 { |
144 { |
176 DLTRACEIN(("")); |
145 DLTRACEIN(("")); |
|
146 |
|
147 iResults = 0; |
|
148 iArguments = 0; |
|
149 |
177 iDocHandler = CDocumentHandler::NewL(); |
150 iDocHandler = CDocumentHandler::NewL(); |
178 iDocHandler->SetExitObserver( this ); |
151 iDocHandler->SetExitObserver( this ); |
179 |
152 |
180 User::LeaveIfError( iFs.Connect() ); |
153 User::LeaveIfError( iFs.Connect() ); |
181 User::LeaveIfError( iFs.ShareProtected() ); |
154 User::LeaveIfError( iFs.ShareProtected() ); |
182 User::LeaveIfError( iRegistrySession.Connect() ); |
155 User::LeaveIfError( iRegistrySession.Connect() ); |
183 User::LeaveIfError( iAknsSrv.Connect() ); |
156 User::LeaveIfError( iAknsSrv.Connect() ); |
|
157 User::LeaveIfError( iScrSession.Connect()); |
184 |
158 |
185 iInstallationCompleteCallback = new(ELeave) CAsyncCallBack( |
159 iInstallationCompleteCallback = new(ELeave) CAsyncCallBack( |
186 TCallBack( InstallationCompleteCallback, this ), |
160 TCallBack( InstallationCompleteCallback, this ), |
187 CActive::EPriorityStandard ); |
161 CActive::EPriorityStandard ); |
188 |
162 |
257 // --------------------------------------------------------------------------- |
231 // --------------------------------------------------------------------------- |
258 // |
232 // |
259 void CNcdInstallationService::SilentInstallL( RFile& aFile, |
233 void CNcdInstallationService::SilentInstallL( RFile& aFile, |
260 const TDesC& aMimeType, |
234 const TDesC& aMimeType, |
261 const TNcdItemPurpose& aPurpose, |
235 const TNcdItemPurpose& aPurpose, |
262 const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) |
236 const Usif::COpaqueNamedParams* aInstallOptionsPckg ) |
263 { |
237 { |
264 DLTRACEIN(("")); |
238 DLTRACEIN(("")); |
265 |
239 |
266 if ( iSilentInstallActiveObserver == NULL ) |
240 if ( iSilentInstallActiveObserver == NULL ) |
267 { |
241 { |
268 DLINFO(("Create active observer for silent install")); |
242 DLINFO(("Create active observer for silent install")); |
269 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
243 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
270 } |
244 } |
271 |
245 |
272 InstallL( aFile, aMimeType, aPurpose, &aInstallOptionsPckg ); |
246 InstallL( aFile, aMimeType, aPurpose, aInstallOptionsPckg ); |
273 |
247 |
274 DLTRACEOUT(("")); |
248 DLTRACEOUT(("")); |
275 } |
249 } |
276 |
250 |
277 |
251 |
280 // --------------------------------------------------------------------------- |
254 // --------------------------------------------------------------------------- |
281 // |
255 // |
282 void CNcdInstallationService::SilentInstallJavaL( RFile& aFile, |
256 void CNcdInstallationService::SilentInstallJavaL( RFile& aFile, |
283 const TDesC& aMimeType, |
257 const TDesC& aMimeType, |
284 const TDesC8& aDescriptorData, |
258 const TDesC8& aDescriptorData, |
285 const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) |
259 const Usif::COpaqueNamedParams* aInstallOptionsPckg ) |
286 { |
260 { |
287 DLTRACEIN(("")); |
261 DLTRACEIN(("")); |
288 |
262 |
289 if ( iSilentInstallActiveObserver == NULL ) |
263 if ( iSilentInstallActiveObserver == NULL ) |
290 { |
264 { |
291 DLINFO(("Create active observer for silent install")); |
265 DLINFO(("Create active observer for silent install")); |
292 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
266 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
293 } |
267 } |
294 |
268 |
295 InstallJavaL( aFile, aMimeType, aDescriptorData, &aInstallOptionsPckg ); |
269 InstallJavaL( aFile, aMimeType, aDescriptorData, aInstallOptionsPckg ); |
296 |
270 |
297 DLTRACEOUT(("")); |
271 DLTRACEOUT(("")); |
298 } |
272 } |
299 |
273 |
300 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
301 // Installs widget silently. |
275 // Installs widget silently. |
302 // --------------------------------------------------------------------------- |
276 // --------------------------------------------------------------------------- |
303 // |
277 // |
304 void CNcdInstallationService::SilentInstallWidgetL( RFile& aFile, |
278 void CNcdInstallationService::SilentInstallWidgetL( RFile& aFile, |
305 const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) |
279 const Usif::COpaqueNamedParams* aInstallOptionsPckg ) |
306 { |
280 { |
307 DLTRACEIN(("")); |
281 DLTRACEIN(("")); |
308 |
282 |
309 if ( iSilentInstallActiveObserver == NULL ) |
283 if ( iSilentInstallActiveObserver == NULL ) |
310 { |
284 { |
311 DLINFO(("Create active observer for silent install")); |
285 DLINFO(("Create active observer for silent install")); |
312 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
286 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
313 } |
287 } |
314 |
288 |
315 InstallWidgetL( aFile, &aInstallOptionsPckg ); |
289 InstallWidgetL( aFile, aInstallOptionsPckg ); |
316 |
290 |
317 DLTRACEOUT(("")); |
291 DLTRACEOUT(("")); |
318 } |
292 } |
319 // --------------------------------------------------------------------------- |
293 // --------------------------------------------------------------------------- |
320 // Cancell silent install. |
294 // Cancell silent install. |
508 // --------------------------------------------------------------------------- |
477 // --------------------------------------------------------------------------- |
509 // Open java suite entry |
478 // Open java suite entry |
510 // |
479 // |
511 // --------------------------------------------------------------------------- |
480 // --------------------------------------------------------------------------- |
512 // |
481 // |
513 #ifdef USE_OLD_JAVA_API |
|
514 |
482 |
515 TBool CNcdInstallationService::JavaAppExistsL( |
483 TBool CNcdInstallationService::JavaAppExistsL( |
516 const TUid& aUid ) |
484 const TUid& aUid ) |
517 { |
485 { |
518 DLTRACEIN(("")); |
486 DLTRACEIN(("")); |
519 |
487 |
520 MJavaRegistry* javaRegistry = MJavaRegistry::CreateL(); |
488 TBool retVal = EFalse; |
521 CleanupReleasePushL( *javaRegistry ); |
489 Usif::TComponentId compId = 0; |
522 |
490 |
523 TRAPD( err, |
491 // Get component id |
524 { |
492 TRAPD( ret, compId = iScrSession.GetComponentIdForAppL( aUid ) ); |
525 // Leaves with KErrNotFound if not found |
493 if ( ret == KErrNotFound ) |
526 MJavaRegistryMIDletEntry* midletEntry = javaRegistry->MIDletEntryL( |
494 { |
527 aUid ); |
495 return EFalse; |
528 midletEntry->Release(); |
496 } |
529 }); |
497 else if (ret != KErrNone ) |
530 |
498 { |
531 LeaveIfNotErrorL( err, KErrNotFound ); |
499 User::Leave( ret ); |
532 |
500 } |
533 CleanupStack::PopAndDestroy( javaRegistry ); |
501 |
534 return err == KErrNone; |
502 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC(); |
535 } |
503 TRAPD(err, iScrSession.GetComponentL(compId, *entry)); |
536 |
504 |
537 #else |
505 if ( err == KErrNotFound ) |
538 |
506 { |
539 TBool CNcdInstallationService::JavaAppExistsL( |
507 retVal = EFalse; |
540 const TUid& aUid ) |
508 } |
541 { |
509 else if (err != KErrNone ) |
542 DLTRACEIN(("")); |
510 { |
543 |
511 User::Leave( err ); |
544 CJavaRegistry* javaRegistry = CJavaRegistry::NewLC(); |
512 } |
545 |
513 else |
546 TBool exists = javaRegistry->RegistryEntryExistsL( aUid ); |
514 { |
547 |
515 // type == Java ? |
548 CleanupStack::PopAndDestroy( javaRegistry ); |
516 if ( entry->SoftwareType().Compare( Usif::KSoftwareTypeJava ) == 0 ) |
549 return exists; |
517 { |
550 } |
518 retVal = ETrue; |
551 |
519 } |
552 #endif |
520 else |
|
521 { |
|
522 retVal = EFalse; |
|
523 } |
|
524 } |
|
525 CleanupStack::PopAndDestroy(entry); |
|
526 return retVal; |
|
527 |
|
528 } |
553 |
529 |
554 // Check via widget registry API |
530 // Check via widget registry API |
555 TNcdApplicationStatus CNcdInstallationService::IsWidgetInstalledL(const TDesC& aIdentifier, const TCatalogsVersion& aVersion) |
531 TNcdApplicationStatus CNcdInstallationService::IsWidgetInstalledL(const TDesC& aIdentifier, const TCatalogsVersion& aVersion) |
556 { |
532 { |
557 DLTRACEIN(("")); |
533 DLTRACEIN(("")); |
1409 |
1383 |
1410 TDataType dataType; |
1384 TDataType dataType; |
1411 // Start application installation. |
1385 // Start application installation. |
1412 DLINFO(( "Calling doc handler Open" )); |
1386 DLINFO(( "Calling doc handler Open" )); |
1413 |
1387 |
1414 if ( !aSilentInstallOptionsPckg ) |
1388 if ( !aSilentInstallOptions ) |
1415 { |
1389 { |
1416 DLINFO(("Normal install")); |
1390 DLINFO(("Normal install")); |
1417 InitializeInstallerL(); |
1391 InitializeInstallerL(); |
1418 iCancelCode = SwiUI::ERequestInstallHandle; |
1392 //iCancelCode = SwiUI::ERequestInstallHandle; |
1419 |
1393 |
1420 iInstaller.Install( iInstallStatusObserver->iStatus, aFile ); |
1394 if ( !iArguments ) |
|
1395 { |
|
1396 iArguments = Usif::COpaqueNamedParams::NewL(); |
|
1397 } |
|
1398 if ( !iResults ) |
|
1399 { |
|
1400 iResults = Usif::COpaqueNamedParams::NewL(); |
|
1401 } |
|
1402 |
|
1403 iArguments->AddIntL( Usif::KSifInParam_InstallSilently, EFalse ); |
|
1404 |
|
1405 iInstaller.Install( aFile, *iArguments, *iResults, iInstallStatusObserver->iStatus ); |
|
1406 //iInstaller.Install( iInstallStatusObserver->iStatus, aFile ); |
1421 iInstallStatusObserver->StartToObserve(); |
1407 iInstallStatusObserver->StartToObserve(); |
1422 } |
1408 } |
1423 else |
1409 else |
1424 { |
1410 { |
1425 DLINFO(("Silent install")); |
1411 DLINFO(("Silent install")); |
1426 // Set the observer active because it will be informed about the completion |
1412 // Set the observer active because it will be informed about the completion |
1427 // of the silent install and it will forward the information for the callback |
1413 // of the silent install and it will forward the information for the callback |
1428 // function of this class object. |
1414 // function of this class object. |
1429 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1415 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1430 *aSilentInstallOptionsPckg ); |
1416 aSilentInstallOptions ); |
1431 } |
1417 } |
1432 |
1418 |
1433 iBusy = ETrue; |
1419 iBusy = ETrue; |
1434 |
1420 |
1435 } |
1421 } |
1540 |
1517 |
1541 |
1518 |
1542 iInstallType = EJavaInstall; |
1519 iInstallType = EJavaInstall; |
1543 TDataType dataType; |
1520 TDataType dataType; |
1544 |
1521 |
1545 if ( aSilentInstallOptionsPckg == NULL ) |
1522 if ( aSilentInstallOptions == NULL ) |
1546 { |
1523 { |
1547 DLINFO(("Normal install")); |
1524 DLINFO(("Normal install")); |
1548 InitializeInstallerL(); |
1525 InitializeInstallerL(); |
1549 if( iJadFileName ) |
1526 if( iJadFileName ) |
1550 { |
1527 { |
1551 DLTRACE(("Installing JAD+JAR")); |
1528 DLTRACE(("Installing JAD+JAR")); |
1552 // JAD+JAR install |
1529 // JAD+JAR install |
1553 iCancelCode = SwiUI::ERequestInstall; |
1530 //iCancelCode = SwiUI::ERequestInstall; |
1554 iInstaller.Install( iInstallStatusObserver->iStatus, *iJadFileName ); |
1531 if ( !iArguments ) |
|
1532 { |
|
1533 iArguments = Usif::COpaqueNamedParams::NewL(); |
|
1534 } |
|
1535 if ( !iResults ) |
|
1536 { |
|
1537 iResults = Usif::COpaqueNamedParams::NewL(); |
|
1538 } |
|
1539 |
|
1540 iArguments->AddIntL( Usif::KSifInParam_InstallSilently, EFalse ); |
|
1541 |
|
1542 iInstaller.Install( *iJadFileName, *iArguments, *iResults, iInstallStatusObserver->iStatus ); |
|
1543 //iInstaller.Install( iInstallStatusObserver->iStatus, *iJadFileName ); |
1555 } |
1544 } |
1556 else |
1545 else |
1557 { |
1546 { |
1558 DLTRACE(("Installing JAR")); |
1547 DLTRACE(("Installing JAR")); |
1559 // JAR install |
1548 // JAR install |
1560 iCancelCode = SwiUI::ERequestInstallHandle; |
1549 //iCancelCode = SwiUI::ERequestInstallHandle; |
1561 iInstaller.Install( iInstallStatusObserver->iStatus, aFile ); |
1550 if ( !iArguments ) |
|
1551 { |
|
1552 iArguments = Usif::COpaqueNamedParams::NewL(); |
|
1553 } |
|
1554 if ( !iResults ) |
|
1555 { |
|
1556 iResults = Usif::COpaqueNamedParams::NewL(); |
|
1557 } |
|
1558 |
|
1559 iArguments->AddIntL( Usif::KSifInParam_InstallSilently, EFalse ); |
|
1560 |
|
1561 iInstaller.Install( aFile, *iArguments, *iResults, iInstallStatusObserver->iStatus ); |
|
1562 |
|
1563 //iInstaller.Install( iInstallStatusObserver->iStatus, aFile ); |
1562 } |
1564 } |
1563 |
1565 |
1564 iInstallStatusObserver->StartToObserve(); |
1566 iInstallStatusObserver->StartToObserve(); |
1565 } |
1567 } |
1566 else |
1568 else |
1572 // JAD+JAR install |
1574 // JAD+JAR install |
1573 // Set the observer active because it will be informed about the completion |
1575 // Set the observer active because it will be informed about the completion |
1574 // of the silent install and it will forward the information for the callback |
1576 // of the silent install and it will forward the information for the callback |
1575 // function of this class object. |
1577 // function of this class object. |
1576 iSilentInstallActiveObserver->StartToObserveL( *iJadFileName, |
1578 iSilentInstallActiveObserver->StartToObserveL( *iJadFileName, |
1577 *aSilentInstallOptionsPckg ); |
1579 aSilentInstallOptions ); |
1578 } |
1580 } |
1579 else |
1581 else |
1580 { |
1582 { |
1581 DLINFO(("Silent jar")); |
1583 DLINFO(("Silent jar")); |
1582 // JAR install |
1584 // JAR install |
1583 // Set the observer active because it will be informed about the completion |
1585 // Set the observer active because it will be informed about the completion |
1584 // of the silent install and it will forward the information for the callback |
1586 // of the silent install and it will forward the information for the callback |
1585 // function of this class object. |
1587 // function of this class object. |
1586 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1588 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1587 *aSilentInstallOptionsPckg ); |
1589 aSilentInstallOptions ); |
1588 } |
1590 } |
1589 } |
1591 } |
1590 |
1592 |
1591 iBusy = ETrue; |
1593 iBusy = ETrue; |
1592 |
1594 |
1612 |
1614 |
1613 TDataType dataType; |
1615 TDataType dataType; |
1614 // Start application installation. |
1616 // Start application installation. |
1615 DLINFO(( "Calling doc handler Open" )); |
1617 DLINFO(( "Calling doc handler Open" )); |
1616 |
1618 |
1617 if ( !aSilentInstallOptionsPckg ) |
1619 if ( !aSilentInstallOptions ) |
1618 { |
1620 { |
1619 DLINFO(("Normal install")); |
1621 DLINFO(("Normal install")); |
1620 InitializeInstallerL(); |
1622 InitializeInstallerL(); |
1621 iCancelCode = SwiUI::ERequestInstallHandle; |
1623 //iCancelCode = SwiUI::ERequestInstallHandle; |
1622 |
1624 if ( !iArguments ) |
1623 iInstaller.Install( iInstallStatusObserver->iStatus, aFile ); |
1625 { |
|
1626 iArguments = Usif::COpaqueNamedParams::NewL(); |
|
1627 } |
|
1628 if ( !iResults ) |
|
1629 { |
|
1630 iResults = Usif::COpaqueNamedParams::NewL(); |
|
1631 } |
|
1632 |
|
1633 iArguments->AddIntL( Usif::KSifInParam_InstallSilently, EFalse ); |
|
1634 iInstaller.Install(aFile, *iArguments, *iResults, iInstallStatusObserver->iStatus ); |
|
1635 |
|
1636 //iInstaller.Install( iInstallStatusObserver->iStatus, aFile ); |
1624 iInstallStatusObserver->StartToObserve(); |
1637 iInstallStatusObserver->StartToObserve(); |
1625 } |
1638 } |
1626 else |
1639 else |
1627 { |
1640 { |
1628 DLINFO(("Silent install")); |
1641 DLINFO(("Silent install")); |
1629 // Set the observer active because it will be informed about the completion |
1642 // Set the observer active because it will be informed about the completion |
1630 // of the silent install and it will forward the information for the callback |
1643 // of the silent install and it will forward the information for the callback |
1631 // function of this class object. |
1644 // function of this class object. |
1632 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1645 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1633 *aSilentInstallOptionsPckg ); |
1646 aSilentInstallOptions ); |
1634 } |
1647 } |
1635 |
1648 |
1636 iBusy = ETrue; |
1649 iBusy = ETrue; |
1637 |
1650 |
1638 } |
1651 } |
1645 { |
1658 { |
1646 DLTRACEIN(("")); |
1659 DLTRACEIN(("")); |
1647 DeletePtr( iInstallStatusObserver ); |
1660 DeletePtr( iInstallStatusObserver ); |
1648 iInstallStatusObserver = CNcdActiveOperationObserver::NewL( *this ); |
1661 iInstallStatusObserver = CNcdActiveOperationObserver::NewL( *this ); |
1649 |
1662 |
|
1663 User::LeaveIfError( iInstaller.Connect() ); |
|
1664 /* |
1650 if ( !iInstaller.Handle() ) |
1665 if ( !iInstaller.Handle() ) |
1651 { |
1666 { |
1652 User::LeaveIfError( iInstaller.Connect() ); |
1667 User::LeaveIfError( iInstaller.Connect() ); |
1653 } |
1668 } |
|
1669 */ |
1654 } |
1670 } |
1655 |
1671 |
1656 |
1672 |
1657 // --------------------------------------------------------------------------- |
1673 // --------------------------------------------------------------------------- |
1658 // Cancels installation |
1674 // Cancels installation |
1659 // --------------------------------------------------------------------------- |
1675 // --------------------------------------------------------------------------- |
1660 // |
1676 // |
1661 void CNcdInstallationService::CancelInstall() |
1677 void CNcdInstallationService::CancelInstall() |
1662 { |
1678 { |
1663 DLTRACEIN(("")); |
1679 DLTRACEIN(("")); |
1664 if ( iInstallStatusObserver && |
1680 //if ( iInstallStatusObserver && |
1665 iInstaller.Handle() ) |
1681 // iInstaller.Handle() ) |
|
1682 if ( iInstallStatusObserver ) |
1666 { |
1683 { |
1667 DLTRACE(("Cancelling installation")); |
1684 DLTRACE(("Cancelling installation")); |
1668 iInstaller.CancelAsyncRequest( iCancelCode ); |
1685 iInstaller.CancelOperation(); |
|
1686 //iInstaller.CancelAsyncRequest( iCancelCode ); |
1669 } |
1687 } |
1670 |
1688 |
1671 DeletePtr( iInstallStatusObserver ); |
1689 DeletePtr( iInstallStatusObserver ); |
1672 iInstaller.Close(); |
1690 iInstaller.Close(); |
1673 } |
1691 } |
1891 } |
1910 } |
1892 } |
1911 } |
1893 while( appErr == KErrNone && retryCount >= 0 ); |
1912 while( appErr == KErrNone && retryCount >= 0 ); |
1894 |
1913 |
1895 iApaLs.Close(); |
1914 iApaLs.Close(); |
1896 CleanupStack::PopAndDestroy( &midletUids ); |
1915 CleanupStack::PopAndDestroy( &midletUids );*/ |
1897 |
1916 |
1898 DLTRACEOUT(("ROM apps: %d", iRomUids.Count() )); |
1917 DLTRACEOUT(("ROM apps: %d", iRomUids.Count() )); |
1899 } |
1918 } |
1900 |
1919 |
1901 |
1920 |
1902 // --------------------------------------------------------------------------- |
1921 // --------------------------------------------------------------------------- |
1903 // Gets a list of installed midlet UIDs |
1922 // Gets a list of installed midlet UIDs |
1904 // --------------------------------------------------------------------------- |
1923 // --------------------------------------------------------------------------- |
1905 // |
1924 // |
1906 #ifdef USE_OLD_JAVA_API |
|
1907 |
1925 |
1908 void CNcdInstallationService::MidletUidsL( RArray<TUid>& aUids ) |
1926 void CNcdInstallationService::MidletUidsL( RArray<TUid>& aUids ) |
1909 { |
1927 { |
1910 DLTRACEIN(("")); |
1928 |
1911 MJavaRegistry* javaRegistry = MJavaRegistry::CreateL(); |
1929 // Get ids of all java components in scr |
1912 CleanupReleasePushL( *javaRegistry ); |
1930 RArray<Usif::TComponentId> javaComponentIdList; |
1913 javaRegistry->InstalledMIDletUidsL( aUids ); |
1931 CleanupClosePushL( javaComponentIdList ); |
1914 CleanupStack::PopAndDestroy( javaRegistry ); |
1932 |
1915 } |
1933 Usif::CComponentFilter *pJavaSwTypeFilter = Usif::CComponentFilter::NewLC(); |
1916 |
1934 pJavaSwTypeFilter->SetSoftwareTypeL( Usif::KSoftwareTypeJava ); |
1917 #else |
1935 iScrSession.GetComponentIdsL( javaComponentIdList, pJavaSwTypeFilter ); |
1918 |
1936 CleanupStack::PopAndDestroy( pJavaSwTypeFilter ); |
1919 void CNcdInstallationService::MidletUidsL( RArray<TUid>& aUids ) |
1937 |
1920 { |
1938 |
1921 DLTRACEIN(("")); |
1939 // Get components |
1922 CJavaRegistry* javaRegistry = CJavaRegistry::NewLC(); |
1940 TInt aUidIndex = 0; |
1923 javaRegistry->GetRegistryEntryUidsL( aUids ); |
1941 for ( TInt i = 0; i < javaComponentIdList.Count(); ++i ) |
1924 CleanupStack::PopAndDestroy( javaRegistry ); |
1942 { |
1925 } |
1943 RArray<TUid> midletUids; |
1926 |
1944 CleanupClosePushL( midletUids ); |
1927 #endif |
1945 iScrSession.GetAppUidsForComponentL( javaComponentIdList[i], midletUids ); |
1928 |
1946 for ( TInt j = 0; j < midletUids.Count(); ++j ) |
|
1947 { |
|
1948 aUids[aUidIndex] = aUids[j]; |
|
1949 aUidIndex++; |
|
1950 } |
|
1951 CleanupStack::PopAndDestroy(); // midletUids |
|
1952 } |
|
1953 |
|
1954 CleanupStack::PopAndDestroy(); // javaComponentIdList |
|
1955 |
|
1956 } |
1929 |
1957 |
1930 // --------------------------------------------------------------------------- |
1958 // --------------------------------------------------------------------------- |
1931 // Checks if the application is in ROM |
1959 // Checks if the application is in ROM |
1932 // --------------------------------------------------------------------------- |
1960 // --------------------------------------------------------------------------- |
1933 // |
1961 // |
1934 TBool CNcdInstallationService::IsRomApplication( const TUid& aUid ) const |
1962 TBool CNcdInstallationService::IsRomApplication( const TUid& aUid ) const |
1935 { |
1963 { |
1936 DLTRACEIN(("UID: %x", aUid.iUid )); |
1964 DLTRACEIN(("UID: %x", aUid.iUid )); |
1937 return iRomUids.Find( aUid ) != KErrNotFound; |
1965 return iRomUids.Find( aUid ) != KErrNotFound; |
1938 } |
1966 } |
1939 |
|
1940 |
|
1941 // --------------------------------------------------------------------------- |
|
1942 // Returns the UID of the latest installed midlet, NULL UID if none have |
|
1943 // been installed since the last device restart |
|
1944 // --------------------------------------------------------------------------- |
|
1945 // |
|
1946 #ifdef USE_OLD_JAVA_API |
|
1947 |
|
1948 TUid CNcdInstallationService::LatestMidletUidL( |
|
1949 MJavaRegistry& aJavaRegistry ) const |
|
1950 { |
|
1951 DLTRACEIN(("")); |
|
1952 TInt suiteUid = 0; |
|
1953 |
|
1954 // Get UID for the latest installed Midlet suite |
|
1955 // KPSUidJavaLatestInstallation = 0x10282567 |
|
1956 // Ignoring error in case the key or read policy change so that client |
|
1957 // doesn't behave strangely |
|
1958 RProperty::Get( KUidSystemCategory, |
|
1959 KPSUidJavaLatestInstallation, suiteUid ); |
|
1960 |
|
1961 DLTRACE(("JMI UID: %x", suiteUid )); |
|
1962 |
|
1963 if ( !suiteUid ) |
|
1964 { |
|
1965 return KNullUid; |
|
1966 } |
|
1967 |
|
1968 // Get entry for the installed suite |
|
1969 MJavaRegistrySuiteEntry* suite = aJavaRegistry.SuiteEntryL( |
|
1970 TUid::Uid( suiteUid ) ); |
|
1971 CleanupReleasePushL( *suite ); |
|
1972 RArray<TUid> suiteUids; |
|
1973 CleanupClosePushL( suiteUids ); |
|
1974 |
|
1975 TUid midletUid = KNullUid; |
|
1976 suite->MIDletUidsL( suiteUids ); |
|
1977 |
|
1978 // Take first midlet UID from the suite |
|
1979 if ( suiteUids.Count() ) |
|
1980 { |
|
1981 midletUid = suiteUids[0]; |
|
1982 } |
|
1983 DLTRACE(("Midlets in suite: %d", suite->NumberOfMIDletsL() )); |
|
1984 CleanupStack::PopAndDestroy( &suiteUids ); |
|
1985 DLTRACE(("InstalledAppsEntryUid: %x", midletUid.iUid )); |
|
1986 |
|
1987 CleanupStack::PopAndDestroy( suite ); |
|
1988 return midletUid; |
|
1989 } |
|
1990 |
|
1991 #else |
|
1992 |
|
1993 TUid CNcdInstallationService::LatestMidletUidL( |
|
1994 CJavaRegistry& aJavaRegistry ) const |
|
1995 { |
|
1996 DLTRACEIN(("")); |
|
1997 TInt suiteUid = 0; |
|
1998 |
|
1999 // Get UID for the latest installed Midlet suite |
|
2000 // KPSUidJavaLatestInstallation = 0x10282567 |
|
2001 // Ignoring error in case the key or read policy change so that client |
|
2002 // doesn't behave strangely |
|
2003 RProperty::Get( KUidSystemCategory, |
|
2004 KPSUidJavaLatestInstallation, suiteUid ); |
|
2005 |
|
2006 DLTRACE(("JMI UID: %x", suiteUid )); |
|
2007 |
|
2008 if ( !suiteUid ) |
|
2009 { |
|
2010 return KNullUid; |
|
2011 } |
|
2012 |
|
2013 // Get entry for the installed suite |
|
2014 CJavaRegistryEntry* suite = aJavaRegistry.RegistryEntryL( |
|
2015 TUid::Uid( suiteUid ) ); |
|
2016 |
|
2017 if ( !suite ) |
|
2018 { |
|
2019 return KNullUid; |
|
2020 } |
|
2021 |
|
2022 CleanupStack::PushL( suite ); |
|
2023 |
|
2024 DASSERT( suite->Type() < EGeneralApplication && |
|
2025 suite->Type() >= EGeneralPackage ); |
|
2026 |
|
2027 CJavaRegistryPackageEntry* entry = |
|
2028 static_cast<CJavaRegistryPackageEntry*>( suite ); |
|
2029 |
|
2030 TUid midletUid = KNullUid; |
|
2031 TInt count = entry->NumberOfEmbeddedEntries(); |
|
2032 TBool appFound = EFalse; |
|
2033 TInt index = 0; |
|
2034 |
|
2035 // Find the first application from the suite |
|
2036 while ( index < count && !appFound ) |
|
2037 { |
|
2038 CJavaRegistryEntry* app = entry->EmbeddedEntryByNumberL( index ); |
|
2039 if ( app->Type() >= EGeneralApplication ) |
|
2040 { |
|
2041 midletUid = app->Uid(); |
|
2042 appFound = ETrue; |
|
2043 DLTRACE(( "Found app: %x", midletUid.iUid )); |
|
2044 } |
|
2045 delete app; |
|
2046 ++index; |
|
2047 } |
|
2048 |
|
2049 CleanupStack::PopAndDestroy( suite ); |
|
2050 return midletUid; |
|
2051 } |
|
2052 |
|
2053 |
|
2054 #endif |
|
2055 |
1967 |
2056 // --------------------------------------------------------------------------- |
1968 // --------------------------------------------------------------------------- |
2057 // Returns true if the MIME type matches a Java application or descriptor |
1969 // Returns true if the MIME type matches a Java application or descriptor |
2058 // --------------------------------------------------------------------------- |
1970 // --------------------------------------------------------------------------- |
2059 // |
1971 // |
2063 aMime.MatchF( KMimeTypeMatch2JavaApplication ) != KErrNotFound || |
1975 aMime.MatchF( KMimeTypeMatch2JavaApplication ) != KErrNotFound || |
2064 aMime.MatchF( KMimeTypeMatchJad ) != KErrNotFound ); |
1976 aMime.MatchF( KMimeTypeMatchJad ) != KErrNotFound ); |
2065 } |
1977 } |
2066 |
1978 |
2067 |
1979 |
2068 #ifdef USE_OLD_JAVA_API |
1980 |
2069 |
1981 |
2070 TUid CNcdInstallationService::InstalledMidletUidL() |
1982 TUid CNcdInstallationService::InstalledMidletUidL() |
2071 { |
1983 { |
2072 DLTRACEIN(("")); |
1984 |
2073 RArray<TUid> MIDletUids; |
1985 //Usif::COpaqueNamedParams* iResults = 0; // to be removed |
2074 CleanupClosePushL( MIDletUids ); |
1986 |
2075 |
1987 RArray<TUid> appUids; |
2076 MJavaRegistry* javaRegistry = MJavaRegistry::CreateL(); |
1988 TUid midletUid = KNullUid; |
2077 CleanupReleasePushL( *javaRegistry ); |
1989 TInt compId = 0; |
2078 javaRegistry->InstalledMIDletUidsL( MIDletUids ); |
1990 |
2079 TUid MIDletUid = KNullUid; |
1991 // Get component id |
2080 // Search for new uids in Java registry. |
1992 TRAPD ( err, iResults->IntByNameL( Usif::KSifOutParam_ComponentId )); |
2081 for ( TInt i = 0 ; i < MIDletUids.Count() ; i++ ) |
1993 if ( err == KErrNotFound ) |
2082 { |
1994 { |
2083 if ( iMIDletUids.Find( MIDletUids[i] ) == KErrNotFound ) |
1995 return midletUid; |
2084 { |
1996 } |
2085 // A new uid found, this is the installed midlet's uid |
1997 |
2086 MIDletUid = MIDletUids[i]; |
1998 // Get components |
2087 break; |
1999 CleanupClosePushL( appUids ); |
2088 } |
2000 iScrSession.GetAppUidsForComponentL( compId, appUids ); |
2089 } |
2001 |
2090 |
2002 // return first midlet uid, if exists |
2091 // We didn't get any new UID so we have to check Java installer's |
2003 if ( appUids.Count() != 0 ) |
2092 // P&S key for the installed suite UID and the get the midlet UID |
2004 { |
2093 // from that. This happens when a midlet with predefined UID, |
2005 midletUid = appUids[0]; |
2094 // eg. WidSets, is reinstalled. Midlet UIDs are predefined with |
2006 } |
2095 // the attribute Nokia-MIDlet-UID-<n> in a JAD or JAR manifest |
2007 CleanupStack::PopAndDestroy(); // appUids |
2096 if ( MIDletUid == KNullUid ) |
|
2097 { |
|
2098 MIDletUid = LatestMidletUidL( *javaRegistry ); |
|
2099 } |
|
2100 |
|
2101 CleanupStack::PopAndDestroy( javaRegistry ); |
|
2102 CleanupStack::PopAndDestroy( &MIDletUids ); |
|
2103 |
|
2104 iMIDletUids.Reset(); |
|
2105 return MIDletUid; |
|
2106 } |
|
2107 |
|
2108 #else // USE_OLD_JAVA_API |
|
2109 |
|
2110 TUid CNcdInstallationService::InstalledMidletUidL() |
|
2111 { |
|
2112 DLTRACEIN(("")); |
|
2113 CJavaRegistry* registry = CJavaRegistry::NewLC(); |
|
2114 TUid midletUid = LatestMidletUidL( *registry ); |
|
2115 CleanupStack::PopAndDestroy( registry ); |
|
2116 return midletUid; |
2008 return midletUid; |
2117 } |
|
2118 |
|
2119 #endif // USE_OLD_JAVA_API |
|
2120 |
|
2121 |
|
2122 // --------------------------------------------------------------------------- |
|
2123 // Populates the list of installed widgets |
|
2124 // --------------------------------------------------------------------------- |
|
2125 // |
|
2126 void CNcdInstallationService::PopulateInstalledWidgetUidsL() |
|
2127 { |
|
2128 DLTRACEIN(("")); |
|
2129 |
|
2130 if ( !iWidgetRegistry.Handle() ) |
|
2131 { |
|
2132 User::LeaveIfError( iWidgetRegistry.Connect() ); |
|
2133 } |
|
2134 |
|
2135 iInstalledWidgets.ResetAndDestroy(); |
|
2136 User::LeaveIfError( iWidgetRegistry.InstalledWidgetsL( iInstalledWidgets ) ); |
|
2137 } |
2009 } |
2138 |
2010 |
2139 // --------------------------------------------------------------------------- |
2011 // --------------------------------------------------------------------------- |
2140 // Populates the list of installed widgets |
2012 // Populates the list of installed widgets |
2141 // --------------------------------------------------------------------------- |
2013 // --------------------------------------------------------------------------- |
2143 void CNcdInstallationService::PopulateInstalledWidgetsL |
2015 void CNcdInstallationService::PopulateInstalledWidgetsL |
2144 (RExtendedWidgetInfoArray& aWidgets) |
2016 (RExtendedWidgetInfoArray& aWidgets) |
2145 { |
2017 { |
2146 DLTRACEIN(("")); |
2018 DLTRACEIN(("")); |
2147 |
2019 |
2148 // Get the list of installed widget uids |
2020 // Get ids of all widget components in scr |
2149 PopulateInstalledWidgetUidsL(); |
2021 RArray<Usif::TComponentId> widgetComponentIdList; |
2150 |
2022 Usif::CComponentFilter *pWidgetSwTypeFilter = Usif::CComponentFilter::NewLC(); |
2151 const TInt count = iInstalledWidgets.Count(); |
2023 pWidgetSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeWidget); |
2152 |
2024 |
2153 // Create array with UID & Version infos |
2025 iScrSession.GetComponentIdsL(widgetComponentIdList, pWidgetSwTypeFilter); |
|
2026 |
|
2027 CleanupStack::PopAndDestroy(pWidgetSwTypeFilter); |
|
2028 CleanupClosePushL(widgetComponentIdList); |
|
2029 |
|
2030 const TInt count = widgetComponentIdList.Count(); |
|
2031 |
|
2032 // Create array with id & version infos |
2154 for ( TInt i = 0; i < count; ++i ) |
2033 for ( TInt i = 0; i < count; ++i ) |
2155 { |
2034 { |
2156 CExtendedWidgetInfo* tempInfo = new ( ELeave ) CExtendedWidgetInfo(); |
2035 CExtendedWidgetInfo* tempInfo = new ( ELeave ) CExtendedWidgetInfo(); |
2157 CleanupStack::PushL( tempInfo ); |
2036 CleanupStack::PushL( tempInfo ); |
2158 |
2037 |
2159 CWidgetInfo* widgetInfo = iInstalledWidgets[i]; |
2038 // Get widget |
2160 |
2039 Usif::TComponentId compId = widgetComponentIdList[i]; |
2161 CWidgetPropertyValue* version = iWidgetRegistry.GetWidgetPropertyValueL |
2040 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC(); |
2162 (widgetInfo->iUid, EBundleVersion ); |
2041 iScrSession.GetComponentL(compId, *entry); |
2163 CleanupStack::PushL( version ); |
2042 |
2164 |
2043 // Fill id & version |
2165 // Fill info |
2044 tempInfo->iUid.iUid= compId; |
2166 tempInfo->iUid = widgetInfo->iUid; |
2045 *(tempInfo->iVersion) = entry->Version(); |
2167 if (!version->iValue.s) |
|
2168 *(tempInfo->iVersion) = KDefVersion; |
|
2169 else |
|
2170 *(tempInfo->iVersion) = *(version->iValue.s); |
|
2171 |
2046 |
2172 // Append to arrayt |
2047 // Append to arrayt |
2173 aWidgets.AppendL( tempInfo ); |
2048 aWidgets.AppendL( tempInfo ); |
2174 |
2049 |
2175 CleanupStack::PopAndDestroy( version ); |
2050 CleanupStack::PopAndDestroy(entry); |
2176 CleanupStack::Pop( tempInfo ); |
2051 CleanupStack::Pop( tempInfo ); |
2177 } |
2052 } |
|
2053 |
|
2054 |
|
2055 CleanupStack::PopAndDestroy(); // widgetComponentIdList |
2178 |
2056 |
2179 DLTRACEOUT(("")); |
2057 DLTRACEOUT(("")); |
2180 |
2058 |
2181 } |
2059 } |
2182 |
2060 |
2183 // --------------------------------------------------------------------------- |
2061 // --------------------------------------------------------------------------- |
2184 // Gets the name of widget that was installed last |
2062 // Gets the name of widget that was installed last |
2185 // --------------------------------------------------------------------------- |
2063 // --------------------------------------------------------------------------- |
2186 // |
2064 // |
|
2065 |
2187 HBufC* CNcdInstallationService::InstalledWidgetNameLC() |
2066 HBufC* CNcdInstallationService::InstalledWidgetNameLC() |
2188 { |
2067 { |
2189 DLTRACEIN(("")); |
2068 DLTRACEIN(("")); |
2190 |
2069 |
2191 TUid widgetUid = InstalledWidgetUidL(); |
2070 // Not currently suported |
2192 |
2071 return NULL; |
2193 if ( widgetUid == KNullUid ) |
|
2194 { |
|
2195 DLERROR(("No widget uid")); |
|
2196 // No new UID was found, so we assume user canceled the installation. |
|
2197 // Installer does not give any error code in that case. |
|
2198 return NULL; |
|
2199 } |
|
2200 |
|
2201 HBufC* bundleId = HBufC::NewLC( KWidgetBundleIdLength ); |
|
2202 TPtr des( bundleId->Des() ); |
|
2203 iWidgetRegistry.GetWidgetBundleId( widgetUid, des ); |
|
2204 |
|
2205 DLTRACEOUT(( _L("Widget bundle id: %S"), bundleId )); |
|
2206 return bundleId; |
|
2207 } |
2072 } |
2208 |
2073 |
2209 |
2074 |
2210 // --------------------------------------------------------------------------- |
2075 // --------------------------------------------------------------------------- |
2211 // Gets the UID of the widget that was just installed |
2076 // Gets the UID of the widget that was just installed |
2311 iObserver->InstallationCompleteL( KNullDesC, uid, iInstallError ); |
2176 iObserver->InstallationCompleteL( KNullDesC, uid, iInstallError ); |
2312 } |
2177 } |
2313 |
2178 |
2314 |
2179 |
2315 // --------------------------------------------------------------------------- |
2180 // --------------------------------------------------------------------------- |
2316 // |
|
2317 // --------------------------------------------------------------------------- |
|
2318 // |
|
2319 TBool CNcdInstallationService::WidgetExistsL( const TUid& aUid ) |
|
2320 { |
|
2321 DLTRACEIN(("")); |
|
2322 |
|
2323 if ( !iWidgetRegistry.Handle() ) |
|
2324 { |
|
2325 User::LeaveIfError( iWidgetRegistry.Connect() ); |
|
2326 } |
|
2327 |
|
2328 if ( iWidgetRegistry.IsWidget( aUid ) ) |
|
2329 { |
|
2330 TBuf<KWidgetBundleIdLength> id; |
|
2331 iWidgetRegistry.GetWidgetBundleId( aUid, id ); |
|
2332 return iWidgetRegistry.WidgetExistsL( id ); |
|
2333 } |
|
2334 return EFalse; |
|
2335 } |
|
2336 |
|
2337 // --------------------------------------------------------------------------- |
|
2338 //Calling widget registry API to check if a widget with given uid is installed |
2181 //Calling widget registry API to check if a widget with given uid is installed |
2339 //already |
2182 //already |
2340 // --------------------------------------------------------------------------- |
2183 // --------------------------------------------------------------------------- |
2341 // |
2184 // |
|
2185 TBool CNcdInstallationService::WidgetExistsL( const TUid& aUid ) |
|
2186 { |
|
2187 DLTRACEIN(("")); |
|
2188 |
|
2189 TBool retVal = EFalse; |
|
2190 |
|
2191 // Get entry |
|
2192 Usif::TComponentId compId = aUid.iUid; |
|
2193 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC(); |
|
2194 TRAPD(err, iScrSession.GetComponentL(compId, *entry)); |
|
2195 |
|
2196 if ( err == KErrNotFound || !retVal ) |
|
2197 { |
|
2198 retVal = EFalse; |
|
2199 } |
|
2200 else if (err != KErrNone ) |
|
2201 { |
|
2202 User::Leave( err ); |
|
2203 } |
|
2204 else |
|
2205 { |
|
2206 // widget ?? |
|
2207 if ( entry->SoftwareType().Compare( Usif::KSoftwareTypeWidget ) == 0 ) |
|
2208 { |
|
2209 retVal = ETrue; |
|
2210 } |
|
2211 else |
|
2212 { |
|
2213 retVal = EFalse; |
|
2214 } |
|
2215 } |
|
2216 CleanupStack::PopAndDestroy(entry); |
|
2217 return retVal; |
|
2218 } |
|
2219 |
|
2220 // --------------------------------------------------------------------------- |
|
2221 //Calling widget registry API to check if a widget with given uid is installed |
|
2222 //already. Returns the version of the installed widget. |
|
2223 // --------------------------------------------------------------------------- |
|
2224 // |
2342 TBool CNcdInstallationService::WidgetExistsL( |
2225 TBool CNcdInstallationService::WidgetExistsL( |
2343 const TUid& aUid, TCatalogsVersion& aVersion ) |
2226 const TUid& aUid, TCatalogsVersion& aVersion ) |
2344 { |
2227 { |
2345 DLTRACEIN(("")); |
2228 DLTRACEIN(("")); |
2346 |
2229 |
2347 if ( !iWidgetRegistry.Handle() ) |
2230 TBool retVal = EFalse; |
2348 { |
2231 |
2349 User::LeaveIfError( iWidgetRegistry.Connect() ); |
2232 // Get entry |
2350 } |
2233 Usif::TComponentId compId = aUid.iUid; |
2351 |
2234 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC(); |
2352 if ( iWidgetRegistry.IsWidget( aUid ) ) |
2235 TRAPD(err, retVal= iScrSession.GetComponentL(compId, *entry)); |
2353 { |
2236 |
2354 TBuf<KWidgetBundleIdLength> id; |
2237 if ( err == KErrNotFound || !retVal ) |
2355 iWidgetRegistry.GetWidgetBundleId( aUid, id ); |
2238 { |
2356 if (iWidgetRegistry.WidgetExistsL( id )) |
2239 retVal = EFalse; |
2357 { |
2240 } |
|
2241 else if (err != KErrNone ) |
|
2242 { |
|
2243 User::Leave( err ); |
|
2244 } |
|
2245 else |
|
2246 { |
|
2247 // widget ?? |
|
2248 if ( entry->SoftwareType().Compare( Usif::KSoftwareTypeWidget ) == 0 ) |
|
2249 { |
|
2250 retVal = ETrue; |
|
2251 |
2358 // Get version |
2252 // Get version |
2359 CWidgetPropertyValue* version = |
2253 TPtrC entryVersion = entry->Version(); |
2360 iWidgetRegistry.GetWidgetPropertyValueL(aUid, EBundleVersion ); |
2254 TCatalogsVersion::ConvertL( aVersion, entryVersion ); |
2361 CleanupStack::PushL( version ); |
|
2362 TCatalogsVersion::ConvertL( aVersion, *(version->iValue.s) ); |
|
2363 CleanupStack::PopAndDestroy( version ); |
|
2364 return (ETrue); |
|
2365 } |
2255 } |
2366 else |
2256 else |
2367 { |
2257 { |
2368 return (EFalse); |
2258 retVal = EFalse; |
2369 } |
2259 } |
2370 } |
2260 } |
2371 else |
2261 CleanupStack::PopAndDestroy(entry); |
2372 return(EFalse); |
2262 return retVal; |
2373 |
2263 |
2374 } |
2264 } |
2375 |
2265 |
2376 // --------------------------------------------------------------------------- |
2266 // --------------------------------------------------------------------------- |
2377 // Calling widget registry API to check if a widget with given identifier is |
2267 // Calling widget registry API to check if a widget with given identifier is |
2378 // installed already |
2268 // installed already |
2381 TBool CNcdInstallationService::WidgetExistsL |
2271 TBool CNcdInstallationService::WidgetExistsL |
2382 ( const TDesC& aIdentifier, TCatalogsVersion& aVersion ) |
2272 ( const TDesC& aIdentifier, TCatalogsVersion& aVersion ) |
2383 { |
2273 { |
2384 DLTRACEIN(("")); |
2274 DLTRACEIN(("")); |
2385 |
2275 |
2386 if ( !iWidgetRegistry.Handle() ) |
2276 TBool retVal = EFalse; |
2387 { |
2277 Usif::TComponentId compId = 0; |
2388 User::LeaveIfError( iWidgetRegistry.Connect() ); |
2278 |
2389 } |
2279 // Get widget component id by identifier |
2390 |
2280 TRAPD( err, compId = |
2391 RPointerArray<CWidgetInfo> widgetInfoArr; |
2281 iScrSession.GetComponentIdL( aIdentifier, Usif::KSoftwareTypeWidget )); |
2392 |
2282 |
2393 CleanupResetAndDestroyPushL( widgetInfoArr ); |
2283 if ( err == KErrNotFound ) |
2394 TInt err = iWidgetRegistry.InstalledWidgetsL(widgetInfoArr); |
2284 { |
2395 |
2285 retVal = EFalse; |
2396 for( TInt i( widgetInfoArr.Count() - 1 ); i >= 0; --i ) |
2286 } |
2397 { |
2287 else if (err != KErrNone ) |
2398 CWidgetInfo* widgetInfo( widgetInfoArr[i] ); |
2288 { |
2399 CWidgetPropertyValue* bundleId = |
2289 User::Leave( err ); |
2400 iWidgetRegistry.GetWidgetPropertyValueL |
2290 } |
2401 (widgetInfo->iUid, EBundleIdentifier ); |
2291 else |
2402 CleanupStack::PushL( bundleId ); |
2292 { |
2403 |
2293 // Widget found |
2404 if( aIdentifier.Compare( *(bundleId->iValue.s) )== 0 ) |
2294 retVal = ETrue; |
2405 { |
2295 |
2406 CWidgetPropertyValue* version = |
2296 // Get entry |
2407 iWidgetRegistry.GetWidgetPropertyValueL |
2297 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC(); |
2408 (widgetInfo->iUid, EBundleVersion ); |
2298 retVal = iScrSession.GetComponentL(compId, *entry); |
2409 CleanupStack::PushL( version ); |
2299 |
2410 TCatalogsVersion::ConvertL( aVersion, *(version->iValue.s) ); |
2300 // Get version |
2411 |
2301 if ( retVal ) |
2412 CleanupStack::PopAndDestroy( version ); |
2302 { |
2413 CleanupStack::PopAndDestroy( bundleId ); |
2303 TPtrC entryVersion = entry->Version(); |
2414 CleanupStack::PopAndDestroy( &widgetInfoArr ); |
2304 TCatalogsVersion::ConvertL( aVersion, entryVersion ); |
2415 |
2305 } |
2416 return ETrue; |
2306 |
2417 } |
2307 CleanupStack::PopAndDestroy(entry); |
2418 CleanupStack::PopAndDestroy( bundleId ); |
2308 } |
2419 } |
2309 |
2420 CleanupStack::PopAndDestroy( &widgetInfoArr ); |
2310 return retVal; |
2421 return EFalse; |
2311 } |
2422 } |
2312 |
2423 |
2313 |
2424 // --------------------------------------------------------------------------- |
2314 // --------------------------------------------------------------------------- |
2425 // Calling widget registry API to return the Uid of the widget |
2315 // Calling widget registry API to return the Uid of the widget |
2426 // with given identifier. |
2316 // with given identifier. |
2427 // --------------------------------------------------------------------------- |
2317 // --------------------------------------------------------------------------- |