javamanager/javasettings/appmngrplugin/src/appmngr2midletappinfo.cpp
branchRCL_3
changeset 60 6c158198356e
parent 59 e5618cc85d74
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
    29 
    29 
    30 #include <appmngr2driveutils.h>         // TAppMngr2DriveUtils
    30 #include <appmngr2driveutils.h>         // TAppMngr2DriveUtils
    31 #include <appmngr2drmutils.h>           // TAppMngr2DRMUtils
    31 #include <appmngr2drmutils.h>           // TAppMngr2DRMUtils
    32 #include <appmngr2cleanuputils.h>       // CleanupResetAndDestroyPushL
    32 #include <appmngr2cleanuputils.h>       // CleanupResetAndDestroyPushL
    33 
    33 
    34 #include <javaapplicationsettings.rsg>           // Midlet resource IDs
    34 #include <apgcli.h>                     // RApaLsSession
       
    35 
       
    36 #include <javaapplicationsettings.rsg>  // Midlet resource IDs
    35 #include "appmngr2midletappinfo.h"      // CAppMngr2MidletAppInfo
    37 #include "appmngr2midletappinfo.h"      // CAppMngr2MidletAppInfo
    36 #include "appmngr2midletruntime.h"      // KAppMngr2MidletUid
    38 #include "appmngr2midletruntime.h"      // KAppMngr2MidletUid
    37 #include "javaapplicationsettings.hrh"           // Midlet command IDs
    39 #include "javaapplicationsettings.hrh"  // Midlet command IDs
    38 #include "appmngr2midletinfoiterator.h" // CAppMngr2MidletInfoIterator
    40 #include "appmngr2midletinfoiterator.h" // CAppMngr2MidletInfoIterator
    39 #include "appmngr2midletsettingsview.h" // CAppMngr2MidletSettingsView
    41 #include "appmngr2midletsettingsview.h" // CAppMngr2MidletSettingsView
    40 #include "appmngr2midletsettingshandler.h" // CAppMngr2MidletSettingsHandler
    42 #include "appmngr2midletsettingshandler.h" // CAppMngr2MidletSettingsHandler
    41 #include "appmngr2midletresourcehandler.h" // CAppMngr2MidletResourceHandler
    43 #include "appmngr2midletresourcehandler.h" // CAppMngr2MidletResourceHandler
    42 
    44 
   187 // ---------------------------------------------------------------------------
   189 // ---------------------------------------------------------------------------
   188 //
   190 //
   189 CGulIcon* CAppMngr2MidletAppInfo::SpecificIconL() const
   191 CGulIcon* CAppMngr2MidletAppInfo::SpecificIconL() const
   190 {
   192 {
   191     LOG(EJavaAppMngrPlugin, EInfo, "CAppMngr2MidletAppInfo::SpecificIconL");
   193     LOG(EJavaAppMngrPlugin, EInfo, "CAppMngr2MidletAppInfo::SpecificIconL");
   192     CGulIcon* icon = CGulIcon::NewL(iAppBitmap, iAppMask);
   194     CGulIcon* icon = NULL;
   193     icon->SetBitmapsOwnedExternally(ETrue);
   195     if (iAppBitmap && iAppMask)
       
   196     {
       
   197         icon = CGulIcon::NewL(iAppBitmap, iAppMask);
       
   198         icon->SetBitmapsOwnedExternally(ETrue);
       
   199     }
   194     return icon;
   200     return icon;
   195 }
   201 }
   196 
   202 
   197 // ---------------------------------------------------------------------------
   203 // ---------------------------------------------------------------------------
   198 // CAppMngr2MidletAppInfo::Name()
   204 // CAppMngr2MidletAppInfo::Name()
   241 // ---------------------------------------------------------------------------
   247 // ---------------------------------------------------------------------------
   242 //
   248 //
   243 void CAppMngr2MidletAppInfo::GetMenuItemsL(
   249 void CAppMngr2MidletAppInfo::GetMenuItemsL(
   244     RPointerArray<CEikMenuPaneItem::SData>& aMenuCmds)
   250     RPointerArray<CEikMenuPaneItem::SData>& aMenuCmds)
   245 {
   251 {
   246     LOG(EJavaAppMngrPlugin, EInfo, "CAppMngr2MidletAppInfo::GetMenuItemsL");
   252     LOG(EJavaAppMngrPlugin, EInfo, "+ CAppMngr2MidletAppInfo::GetMenuItemsL");
   247     TInt resourceOffset = iResourceHandler.AddResourceFileL();
   253     TInt resourceOffset = iResourceHandler.AddResourceFileL();
   248     CEikMenuPaneItem::SData* menuItemData = new(ELeave) CEikMenuPaneItem::SData;
   254     CEikMenuPaneItem::SData* menuItemData = new(ELeave) CEikMenuPaneItem::SData;
   249     CleanupStack::PushL(menuItemData);
   255     CleanupStack::PushL(menuItemData);
   250     ReadMenuItemDataFromResourceL(MIDLET_SUITE_SETTINGS_MENU_ITEM, *menuItemData);
   256     ReadMenuItemDataFromResourceL(MIDLET_SUITE_SETTINGS_MENU_ITEM, *menuItemData);
   251     aMenuCmds.AppendL(menuItemData);
   257     aMenuCmds.AppendL(menuItemData);
   466 // CAppMngr2MidletAppInfo::SecurityDomainCategory()
   472 // CAppMngr2MidletAppInfo::SecurityDomainCategory()
   467 // ---------------------------------------------------------------------------
   473 // ---------------------------------------------------------------------------
   468 //
   474 //
   469 const std::wstring CAppMngr2MidletAppInfo::SecurityDomainCategory() const
   475 const std::wstring CAppMngr2MidletAppInfo::SecurityDomainCategory() const
   470 {
   476 {
   471     LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletAppInfo::MidletSuiteSecurityDomainCategory ");
   477     LOG(EJavaAppMngrPlugin, EInfo, "CAppMngr2MidletAppInfo::MidletSuiteSecurityDomainCategory ");
   472     LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletAppInfo::MidletSuiteSecurityDomainCategory ");
       
   473     return iSecurityDomainCategory;
   478     return iSecurityDomainCategory;
   474 }
   479 }
   475 
   480 
   476 // ---------------------------------------------------------------------------
   481 // ---------------------------------------------------------------------------
   477 // CAppMngr2MidletAppInfo::SecurityDomainName()
   482 // CAppMngr2MidletAppInfo::SecurityDomainName()
   765     }
   770     }
   766 
   771 
   767     // MIDlet suite specific icons
   772     // MIDlet suite specific icons
   768     if (midletUids.Count() > 0)
   773     if (midletUids.Count() > 0)
   769     {
   774     {
   770         AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), midletUids[ 0 ],
   775         // Errors ignored so that the midlet is still displayed in the list with default icon.
   771                                    EAknsAppIconTypeList, iAppBitmap, iAppMask);
   776         TRAPD(err, GetAppIconL(midletUids[0]));
   772         CleanupStack::Pop(2); // iAppBitmap, iAppMask
   777         if (KErrNone != err)
   773     }
   778         {
       
   779             ELOG1(EJavaAppMngrPlugin, "GetAppIconL error %d", err);
       
   780         }
       
   781     }
       
   782     
   774     CleanupStack::PopAndDestroy(&midletUids);
   783     CleanupStack::PopAndDestroy(&midletUids);
   775 
   784 
   776     // security domain
   785     // security domain
   777     CAppMngr2MidletSettingsHandler* settingsHandler
   786     CAppMngr2MidletSettingsHandler* settingsHandler
   778     = CAppMngr2MidletSettingsHandler::NewL(*iLocalizedMIDletName, iEntry->Uid(), iResourceHandler);
   787     = CAppMngr2MidletSettingsHandler::NewL(*iLocalizedMIDletName, iEntry->Uid(), iResourceHandler);
   923 
   932 
   924     launcher->LaunchBrowserSyncEmbeddedL(urlParamPtr, this);
   933     launcher->LaunchBrowserSyncEmbeddedL(urlParamPtr, this);
   925 
   934 
   926     CleanupStack::PopAndDestroy(urlParam);
   935     CleanupStack::PopAndDestroy(urlParam);
   927     CleanupStack::PopAndDestroy(launcher);
   936     CleanupStack::PopAndDestroy(launcher);
   928     LOG(EJavaAppMngrPlugin, EInfo, "+ CAppMngr2MidletAppInfo::ShowInfoUrlL");
   937     LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::ShowInfoUrlL");
   929 }
   938 }
   930 
   939 
   931 // ---------------------------------------------------------------------------
   940 // ---------------------------------------------------------------------------
   932 // CAppMngr2MidletAppInfo::InfoIteratorL()
   941 // CAppMngr2MidletAppInfo::InfoIteratorL()
   933 // ---------------------------------------------------------------------------
   942 // ---------------------------------------------------------------------------
   983     }
   992     }
   984 
   993 
   985     iCertsRead = ETrue;
   994     iCertsRead = ETrue;
   986     LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::ReadCertificatesInfoL");
   995     LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::ReadCertificatesInfoL");
   987 }
   996 }
       
   997 
       
   998 void CAppMngr2MidletAppInfo::GetAppIconL(TUid aMidletUid)
       
   999 {
       
  1000     LOG(EJavaAppMngrPlugin, EInfo, "+ CAppMngr2MidletAppInfo::GetAppIconL");
       
  1001     
       
  1002     ASSERT(!iAppBitmap);
       
  1003     ASSERT(!iAppMask);
       
  1004     
       
  1005     RApaLsSession lsSession;
       
  1006     User::LeaveIfError(lsSession.Connect()); 
       
  1007     CleanupClosePushL(lsSession);
       
  1008     CApaMaskedBitmap* apaBmp = CApaMaskedBitmap::NewLC();
       
  1009     
       
  1010     TSize size = static_cast<CAppMngr2MidletRuntime&>(Runtime()).JavaRasterIconSize();
       
  1011     TInt err = lsSession.GetAppIcon(aMidletUid, size, *apaBmp);
       
  1012     if (err == KErrNone)
       
  1013     {
       
  1014         iAppBitmap = new (ELeave) CFbsBitmap(); 
       
  1015         iAppMask = new (ELeave) CFbsBitmap();
       
  1016         User::LeaveIfError(iAppBitmap->Duplicate(apaBmp->Handle()));
       
  1017         User::LeaveIfError(iAppMask->Duplicate(apaBmp->Mask()->Handle()));
       
  1018     }
       
  1019     CleanupStack::PopAndDestroy(apaBmp);
       
  1020     CleanupStack::PopAndDestroy(&lsSession);
       
  1021 
       
  1022     if (!iAppBitmap)
       
  1023     {
       
  1024         AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), aMidletUid,
       
  1025                                    EAknsAppIconTypeList, iAppBitmap, iAppMask);
       
  1026         CleanupStack::Pop(2); // iAppBitmap, iAppMask
       
  1027     }
       
  1028     
       
  1029     LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::GetAppIconL");
       
  1030 }