contentstorage/srvsrc/casrvengutils.cpp
changeset 60 f62f87b200ec
child 66 32469d7d46ff
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     1 /*
       
     2  * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  *  Description : The API supports item information that is not supported by
       
    15  *                the content arsenal server itself
       
    16  *
       
    17  */
       
    18 #include <AknIconUtils.h>
       
    19 #include <avkon.mbg>
       
    20 #include <e32property.h>
       
    21 #include <AknTaskList.h>
       
    22 #include <mmf/common/mmfcontrollerpluginresolver.h>
       
    23 #include "casrvengutils.h"
       
    24 #include "cautils.h"
       
    25 #include "cadef.h"
       
    26 #include "castorage.h"
       
    27 #include "cainnerentry.h"
       
    28 
       
    29 // ================= LOCAL FUNCTIONS ========================
       
    30 
       
    31 
       
    32 // ================= MEMBER FUNCTIONS =======================
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // CMenuSrvEngUtils::~CMenuSrvEngUtils
       
    36 // ---------------------------------------------------------
       
    37 //
       
    38 CCaSrvEngUtils::~CCaSrvEngUtils()
       
    39     {
       
    40     iApaLsSession.Close();
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CCaSrvEngUtils::NewL
       
    45 // ---------------------------------------------------------
       
    46 //
       
    47 CCaSrvEngUtils* CCaSrvEngUtils::NewL()
       
    48     {
       
    49     CCaSrvEngUtils* utils = new ( ELeave ) CCaSrvEngUtils();
       
    50     CleanupStack::PushL( utils );
       
    51     utils->ConstructL();
       
    52     CleanupStack::Pop( utils );
       
    53     return utils;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------
       
    57 // GetAppUid
       
    58 // ---------------------------------------------------------
       
    59 //
       
    60 TInt CCaSrvEngUtils::GetAppUid( const CCaInnerEntry& aEntry, TUid& aAppUid )
       
    61     {
       
    62     TInt err( 0 );
       
    63     TInt32 attrVal = aEntry.GetUid();
       
    64     if( attrVal )
       
    65         {
       
    66         aAppUid = TUid::Uid( attrVal );
       
    67         }
       
    68     else
       
    69         {
       
    70         err = KErrNotFound;
       
    71         }
       
    72     return err;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // GetApaAppInfo
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 EXPORT_C TInt CCaSrvEngUtils::GetApaAppInfo( TUid aUid, TApaAppInfo& aInfo ) const
       
    80     {
       
    81     return iApaLsSession.GetAppInfo( aInfo, aUid );
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CMenuSrvEngUtils::CMenuSrvEngUtils
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 CCaSrvEngUtils::CCaSrvEngUtils()
       
    89     {
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // CMenuSrvEngUtils::ConstructL
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 void CCaSrvEngUtils::ConstructL()
       
    97     {
       
    98     User::LeaveIfError( iApaLsSession.Connect() );
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------
       
   102 // CMenuSrvEngUtils::GetAppInfo
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 EXPORT_C TInt CCaSrvEngUtils::GetAppInfo( const CCaInnerEntry& aEntry,
       
   106         TApaAppInfo& aAppInfo ) const
       
   107     {
       
   108     TUid appUid;
       
   109     TInt err = GetAppUid( aEntry, appUid );
       
   110     if( !err )
       
   111         {
       
   112         err = iApaLsSession.GetAppInfo( aAppInfo, appUid );
       
   113         }
       
   114     return err;
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------
       
   118 // CMenuSrvEngUtils::IsNative
       
   119 // ---------------------------------------------------------
       
   120 //
       
   121 TBool CCaSrvEngUtils::IsNative( const CCaInnerEntry& aEntry )
       
   122     {
       
   123     TBool native( EFalse );
       
   124     if( aEntry.GetEntryTypeName().CompareF( KCaTypeApp ) == KErrNone )
       
   125         {
       
   126         TUid uid;
       
   127         if( GetAppUid( aEntry, uid ) == KErrNone )
       
   128             {
       
   129             IsNative( uid, native );
       
   130             }
       
   131         }
       
   132     return native;
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------
       
   136 // CMenuSrvEngUtils::IsNativeL
       
   137 // ---------------------------------------------------------
       
   138 //
       
   139 
       
   140 void CCaSrvEngUtils::IsNative( TUid aAppUid, TBool& aIsNative )
       
   141     {
       
   142     TApaAppInfo appInfo;
       
   143     aIsNative = EFalse;
       
   144     TInt error = iApaLsSession.GetAppInfo( appInfo, aAppUid );
       
   145     if( error == KErrNone )
       
   146         {
       
   147         error = iApaLsSession.IsProgram( appInfo.iFullName, aIsNative );
       
   148         if( error != KErrNone )
       
   149             {
       
   150             aIsNative = EFalse;
       
   151             }
       
   152         }
       
   153     }