43 _LIT( KJadFileExtension, ".jad" ); |
43 _LIT( KJadFileExtension, ".jad" ); |
44 const TInt KDelayWhenAppListInvalid = 500000; |
44 const TInt KDelayWhenAppListInvalid = 500000; |
45 |
45 |
46 const TUint KFileOpenFlags = EFileShareReadersOrWriters; |
46 const TUint KFileOpenFlags = EFileShareReadersOrWriters; |
47 |
47 |
48 const TInt KWidgetBundleIdLength = KMaxFileName + 1; |
48 //const TInt KWidgetBundleIdLength = KMaxFileName + 1; |
49 |
49 |
50 // ======== CALLBACK FUNCTION ======== |
50 // ======== CALLBACK FUNCTION ======== |
51 |
51 |
52 static TInt InstallationCompleteCallback( TAny* aData ) |
52 static TInt InstallationCompleteCallback( TAny* aData ) |
53 { |
53 { |
136 // --------------------------------------------------------------------------- |
141 // --------------------------------------------------------------------------- |
137 // |
142 // |
138 void CNcdInstallationService::ConstructL() |
143 void CNcdInstallationService::ConstructL() |
139 { |
144 { |
140 DLTRACEIN(("")); |
145 DLTRACEIN(("")); |
|
146 |
|
147 iResults = 0; |
|
148 iArguments = 0; |
|
149 |
141 iDocHandler = CDocumentHandler::NewL(); |
150 iDocHandler = CDocumentHandler::NewL(); |
142 iDocHandler->SetExitObserver( this ); |
151 iDocHandler->SetExitObserver( this ); |
143 |
152 |
144 User::LeaveIfError( iFs.Connect() ); |
153 User::LeaveIfError( iFs.Connect() ); |
145 User::LeaveIfError( iFs.ShareProtected() ); |
154 User::LeaveIfError( iFs.ShareProtected() ); |
222 // --------------------------------------------------------------------------- |
231 // --------------------------------------------------------------------------- |
223 // |
232 // |
224 void CNcdInstallationService::SilentInstallL( RFile& aFile, |
233 void CNcdInstallationService::SilentInstallL( RFile& aFile, |
225 const TDesC& aMimeType, |
234 const TDesC& aMimeType, |
226 const TNcdItemPurpose& aPurpose, |
235 const TNcdItemPurpose& aPurpose, |
227 const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) |
236 const Usif::COpaqueNamedParams* aInstallOptionsPckg ) |
228 { |
237 { |
229 DLTRACEIN(("")); |
238 DLTRACEIN(("")); |
230 |
239 |
231 if ( iSilentInstallActiveObserver == NULL ) |
240 if ( iSilentInstallActiveObserver == NULL ) |
232 { |
241 { |
233 DLINFO(("Create active observer for silent install")); |
242 DLINFO(("Create active observer for silent install")); |
234 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
243 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
235 } |
244 } |
236 |
245 |
237 InstallL( aFile, aMimeType, aPurpose, &aInstallOptionsPckg ); |
246 InstallL( aFile, aMimeType, aPurpose, aInstallOptionsPckg ); |
238 |
247 |
239 DLTRACEOUT(("")); |
248 DLTRACEOUT(("")); |
240 } |
249 } |
241 |
250 |
242 |
251 |
245 // --------------------------------------------------------------------------- |
254 // --------------------------------------------------------------------------- |
246 // |
255 // |
247 void CNcdInstallationService::SilentInstallJavaL( RFile& aFile, |
256 void CNcdInstallationService::SilentInstallJavaL( RFile& aFile, |
248 const TDesC& aMimeType, |
257 const TDesC& aMimeType, |
249 const TDesC8& aDescriptorData, |
258 const TDesC8& aDescriptorData, |
250 const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) |
259 const Usif::COpaqueNamedParams* aInstallOptionsPckg ) |
251 { |
260 { |
252 DLTRACEIN(("")); |
261 DLTRACEIN(("")); |
253 |
262 |
254 if ( iSilentInstallActiveObserver == NULL ) |
263 if ( iSilentInstallActiveObserver == NULL ) |
255 { |
264 { |
256 DLINFO(("Create active observer for silent install")); |
265 DLINFO(("Create active observer for silent install")); |
257 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
266 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
258 } |
267 } |
259 |
268 |
260 InstallJavaL( aFile, aMimeType, aDescriptorData, &aInstallOptionsPckg ); |
269 InstallJavaL( aFile, aMimeType, aDescriptorData, aInstallOptionsPckg ); |
261 |
270 |
262 DLTRACEOUT(("")); |
271 DLTRACEOUT(("")); |
263 } |
272 } |
264 |
273 |
265 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
266 // Installs widget silently. |
275 // Installs widget silently. |
267 // --------------------------------------------------------------------------- |
276 // --------------------------------------------------------------------------- |
268 // |
277 // |
269 void CNcdInstallationService::SilentInstallWidgetL( RFile& aFile, |
278 void CNcdInstallationService::SilentInstallWidgetL( RFile& aFile, |
270 const SwiUI::TInstallOptionsPckg& aInstallOptionsPckg ) |
279 const Usif::COpaqueNamedParams* aInstallOptionsPckg ) |
271 { |
280 { |
272 DLTRACEIN(("")); |
281 DLTRACEIN(("")); |
273 |
282 |
274 if ( iSilentInstallActiveObserver == NULL ) |
283 if ( iSilentInstallActiveObserver == NULL ) |
275 { |
284 { |
276 DLINFO(("Create active observer for silent install")); |
285 DLINFO(("Create active observer for silent install")); |
277 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
286 iSilentInstallActiveObserver = CNcdSilentInstallActiveObserver::NewL( *this ); |
278 } |
287 } |
279 |
288 |
280 InstallWidgetL( aFile, &aInstallOptionsPckg ); |
289 InstallWidgetL( aFile, aInstallOptionsPckg ); |
281 |
290 |
282 DLTRACEOUT(("")); |
291 DLTRACEOUT(("")); |
283 } |
292 } |
284 // --------------------------------------------------------------------------- |
293 // --------------------------------------------------------------------------- |
285 // Cancell silent install. |
294 // Cancell silent install. |
1278 // --------------------------------------------------------------------------- |
1287 // --------------------------------------------------------------------------- |
1279 // |
1288 // |
1280 void CNcdInstallationService::InstallL( RFile& aFile, |
1289 void CNcdInstallationService::InstallL( RFile& aFile, |
1281 const TDesC& aMimeType, |
1290 const TDesC& aMimeType, |
1282 const TNcdItemPurpose& aPurpose, |
1291 const TNcdItemPurpose& aPurpose, |
1283 const SwiUI::TInstallOptionsPckg* aSilentInstallOptionsPckg ) |
1292 const Usif::COpaqueNamedParams* aSilentInstallOptions ) |
1284 { |
1293 { |
1285 DLTRACEIN(( _L("iBusy=%d, MIME: %S"),iBusy, &aMimeType )); |
1294 DLTRACEIN(( _L("iBusy=%d, MIME: %S"),iBusy, &aMimeType )); |
1286 DASSERT( iObserver ); |
1295 DASSERT( iObserver ); |
1287 DASSERT( iDocHandler ); |
1296 DASSERT( iDocHandler ); |
1288 |
1297 |
1324 DLTRACE(("Java")); |
1333 DLTRACE(("Java")); |
1325 InstallJavaL( |
1334 InstallJavaL( |
1326 aFile, |
1335 aFile, |
1327 *iRecognizedMime, |
1336 *iRecognizedMime, |
1328 KNullDesC8, |
1337 KNullDesC8, |
1329 aSilentInstallOptionsPckg ); |
1338 aSilentInstallOptions ); |
1330 return; |
1339 return; |
1331 } |
1340 } |
1332 else if ( MatchWidget( aFile, aMimeType ) ) |
1341 else if ( MatchWidget( aFile, aMimeType ) ) |
1333 { |
1342 { |
1334 DLTRACE(("Widget")); |
1343 DLTRACE(("Widget")); |
1335 InstallWidgetL( |
1344 InstallWidgetL( |
1336 aFile, |
1345 aFile, |
1337 aSilentInstallOptionsPckg ); |
1346 aSilentInstallOptions ); |
1338 return; |
1347 return; |
1339 } |
1348 } |
1340 |
1349 |
1341 // Handle SIS(X) and DRM content which has a suitable purpose |
1350 // Handle SIS(X) and DRM content which has a suitable purpose |
1342 if ( aMimeType.MatchF( KMimeTypeMatchSymbianInstall ) != KErrNotFound |
1351 if ( aMimeType.MatchF( KMimeTypeMatchSymbianInstall ) != KErrNotFound |
1374 |
1383 |
1375 TDataType dataType; |
1384 TDataType dataType; |
1376 // Start application installation. |
1385 // Start application installation. |
1377 DLINFO(( "Calling doc handler Open" )); |
1386 DLINFO(( "Calling doc handler Open" )); |
1378 |
1387 |
1379 if ( !aSilentInstallOptionsPckg ) |
1388 if ( !aSilentInstallOptions ) |
1380 { |
1389 { |
1381 DLINFO(("Normal install")); |
1390 DLINFO(("Normal install")); |
1382 InitializeInstallerL(); |
1391 InitializeInstallerL(); |
1383 iCancelCode = SwiUI::ERequestInstallHandle; |
1392 //iCancelCode = SwiUI::ERequestInstallHandle; |
1384 |
1393 |
1385 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 ); |
1386 iInstallStatusObserver->StartToObserve(); |
1407 iInstallStatusObserver->StartToObserve(); |
1387 } |
1408 } |
1388 else |
1409 else |
1389 { |
1410 { |
1390 DLINFO(("Silent install")); |
1411 DLINFO(("Silent install")); |
1391 // 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 |
1392 // 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 |
1393 // function of this class object. |
1414 // function of this class object. |
1394 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1415 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1395 *aSilentInstallOptionsPckg ); |
1416 aSilentInstallOptions ); |
1396 } |
1417 } |
1397 |
1418 |
1398 iBusy = ETrue; |
1419 iBusy = ETrue; |
1399 |
1420 |
1400 } |
1421 } |
1461 // --------------------------------------------------------------------------- |
1482 // --------------------------------------------------------------------------- |
1462 // |
1483 // |
1463 void CNcdInstallationService::InstallJavaL( RFile& aFile, |
1484 void CNcdInstallationService::InstallJavaL( RFile& aFile, |
1464 const TDesC& /*aMimeType*/, |
1485 const TDesC& /*aMimeType*/, |
1465 const TDesC8& aDescriptorData, |
1486 const TDesC8& aDescriptorData, |
1466 const SwiUI::TInstallOptionsPckg* aSilentInstallOptionsPckg ) |
1487 const Usif::COpaqueNamedParams* aSilentInstallOptions ) |
1467 { |
1488 { |
1468 DLTRACEIN((_L("iBusy=%d, descriptor=%d"),iBusy, aDescriptorData.Length() )); |
1489 DLTRACEIN((_L("iBusy=%d, descriptor=%d"),iBusy, aDescriptorData.Length() )); |
1469 DASSERT( iObserver ); |
1490 DASSERT( iObserver ); |
1470 |
1491 |
1471 // Check if some installation is already in progress. |
1492 // Check if some installation is already in progress. |
1496 |
1517 |
1497 |
1518 |
1498 iInstallType = EJavaInstall; |
1519 iInstallType = EJavaInstall; |
1499 TDataType dataType; |
1520 TDataType dataType; |
1500 |
1521 |
1501 if ( aSilentInstallOptionsPckg == NULL ) |
1522 if ( aSilentInstallOptions == NULL ) |
1502 { |
1523 { |
1503 DLINFO(("Normal install")); |
1524 DLINFO(("Normal install")); |
1504 InitializeInstallerL(); |
1525 InitializeInstallerL(); |
1505 if( iJadFileName ) |
1526 if( iJadFileName ) |
1506 { |
1527 { |
1507 DLTRACE(("Installing JAD+JAR")); |
1528 DLTRACE(("Installing JAD+JAR")); |
1508 // JAD+JAR install |
1529 // JAD+JAR install |
1509 iCancelCode = SwiUI::ERequestInstall; |
1530 //iCancelCode = SwiUI::ERequestInstall; |
1510 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 ); |
1511 } |
1544 } |
1512 else |
1545 else |
1513 { |
1546 { |
1514 DLTRACE(("Installing JAR")); |
1547 DLTRACE(("Installing JAR")); |
1515 // JAR install |
1548 // JAR install |
1516 iCancelCode = SwiUI::ERequestInstallHandle; |
1549 //iCancelCode = SwiUI::ERequestInstallHandle; |
1517 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 ); |
1518 } |
1564 } |
1519 |
1565 |
1520 iInstallStatusObserver->StartToObserve(); |
1566 iInstallStatusObserver->StartToObserve(); |
1521 } |
1567 } |
1522 else |
1568 else |
1528 // JAD+JAR install |
1574 // JAD+JAR install |
1529 // 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 |
1530 // 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 |
1531 // function of this class object. |
1577 // function of this class object. |
1532 iSilentInstallActiveObserver->StartToObserveL( *iJadFileName, |
1578 iSilentInstallActiveObserver->StartToObserveL( *iJadFileName, |
1533 *aSilentInstallOptionsPckg ); |
1579 aSilentInstallOptions ); |
1534 } |
1580 } |
1535 else |
1581 else |
1536 { |
1582 { |
1537 DLINFO(("Silent jar")); |
1583 DLINFO(("Silent jar")); |
1538 // JAR install |
1584 // JAR install |
1539 // 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 |
1540 // 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 |
1541 // function of this class object. |
1587 // function of this class object. |
1542 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1588 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1543 *aSilentInstallOptionsPckg ); |
1589 aSilentInstallOptions ); |
1544 } |
1590 } |
1545 } |
1591 } |
1546 |
1592 |
1547 iBusy = ETrue; |
1593 iBusy = ETrue; |
1548 |
1594 |
1554 // Installs Widgets files in normal or in silent way. |
1600 // Installs Widgets files in normal or in silent way. |
1555 // --------------------------------------------------------------------------- |
1601 // --------------------------------------------------------------------------- |
1556 // |
1602 // |
1557 void CNcdInstallationService::InstallWidgetL( |
1603 void CNcdInstallationService::InstallWidgetL( |
1558 RFile& aFile, |
1604 RFile& aFile, |
1559 const SwiUI::TInstallOptionsPckg* aSilentInstallOptionsPckg ) |
1605 const Usif::COpaqueNamedParams* aSilentInstallOptions ) |
1560 { |
1606 { |
1561 DLTRACEIN(("")); |
1607 DLTRACEIN(("")); |
1562 |
1608 |
1563 iInstallType = EWidgetInstall; |
1609 iInstallType = EWidgetInstall; |
1564 |
1610 |
1568 |
1614 |
1569 TDataType dataType; |
1615 TDataType dataType; |
1570 // Start application installation. |
1616 // Start application installation. |
1571 DLINFO(( "Calling doc handler Open" )); |
1617 DLINFO(( "Calling doc handler Open" )); |
1572 |
1618 |
1573 if ( !aSilentInstallOptionsPckg ) |
1619 if ( !aSilentInstallOptions ) |
1574 { |
1620 { |
1575 DLINFO(("Normal install")); |
1621 DLINFO(("Normal install")); |
1576 InitializeInstallerL(); |
1622 InitializeInstallerL(); |
1577 iCancelCode = SwiUI::ERequestInstallHandle; |
1623 //iCancelCode = SwiUI::ERequestInstallHandle; |
1578 |
1624 if ( !iArguments ) |
1579 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 ); |
1580 iInstallStatusObserver->StartToObserve(); |
1637 iInstallStatusObserver->StartToObserve(); |
1581 } |
1638 } |
1582 else |
1639 else |
1583 { |
1640 { |
1584 DLINFO(("Silent install")); |
1641 DLINFO(("Silent install")); |
1585 // 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 |
1586 // 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 |
1587 // function of this class object. |
1644 // function of this class object. |
1588 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1645 iSilentInstallActiveObserver->StartToObserveL( aFile, |
1589 *aSilentInstallOptionsPckg ); |
1646 aSilentInstallOptions ); |
1590 } |
1647 } |
1591 |
1648 |
1592 iBusy = ETrue; |
1649 iBusy = ETrue; |
1593 |
1650 |
1594 } |
1651 } |
1601 { |
1658 { |
1602 DLTRACEIN(("")); |
1659 DLTRACEIN(("")); |
1603 DeletePtr( iInstallStatusObserver ); |
1660 DeletePtr( iInstallStatusObserver ); |
1604 iInstallStatusObserver = CNcdActiveOperationObserver::NewL( *this ); |
1661 iInstallStatusObserver = CNcdActiveOperationObserver::NewL( *this ); |
1605 |
1662 |
|
1663 User::LeaveIfError( iInstaller.Connect() ); |
|
1664 /* |
1606 if ( !iInstaller.Handle() ) |
1665 if ( !iInstaller.Handle() ) |
1607 { |
1666 { |
1608 User::LeaveIfError( iInstaller.Connect() ); |
1667 User::LeaveIfError( iInstaller.Connect() ); |
1609 } |
1668 } |
|
1669 */ |
1610 } |
1670 } |
1611 |
1671 |
1612 |
1672 |
1613 // --------------------------------------------------------------------------- |
1673 // --------------------------------------------------------------------------- |
1614 // Cancels installation |
1674 // Cancels installation |
1615 // --------------------------------------------------------------------------- |
1675 // --------------------------------------------------------------------------- |
1616 // |
1676 // |
1617 void CNcdInstallationService::CancelInstall() |
1677 void CNcdInstallationService::CancelInstall() |
1618 { |
1678 { |
1619 DLTRACEIN(("")); |
1679 DLTRACEIN(("")); |
1620 if ( iInstallStatusObserver && |
1680 //if ( iInstallStatusObserver && |
1621 iInstaller.Handle() ) |
1681 // iInstaller.Handle() ) |
|
1682 if ( iInstallStatusObserver ) |
1622 { |
1683 { |
1623 DLTRACE(("Cancelling installation")); |
1684 DLTRACE(("Cancelling installation")); |
1624 iInstaller.CancelAsyncRequest( iCancelCode ); |
1685 iInstaller.CancelOperation(); |
|
1686 //iInstaller.CancelAsyncRequest( iCancelCode ); |
1625 } |
1687 } |
1626 |
1688 |
1627 DeletePtr( iInstallStatusObserver ); |
1689 DeletePtr( iInstallStatusObserver ); |
1628 iInstaller.Close(); |
1690 iInstaller.Close(); |
1629 } |
1691 } |