taskswitcher/contextengine/tsfswserver/engine/src/tsfsalwaysshownapplist.cpp
changeset 4 4d54b72983ae
child 30 b8fae6b8a148
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
       
     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:  File containing application list classes
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 //INCLUDES:
       
    20 #include <apaid.h>
       
    21 #include "tsfsalwaysshownapplist.h"
       
    22 
       
    23 //CONSTANTS:
       
    24 /* Array for all application uid that need to be always displayed (if they are running).
       
    25    Also, there will be no Close option for such apps. */
       
    26 const TUint32 KTsFsUidArray[] =
       
    27     {
       
    28     0x102750F0 // Idle App Uid
       
    29     ,0x0EFC346A //Search App Uid
       
    30 /* never show menu app */    //,0x101F4CD2 // Menu App Uid
       
    31     };
       
    32 
       
    33 // ================= MEMBER FUNCTIONS =======================
       
    34 
       
    35 // --------------------------------------------------------------------------
       
    36 // CTsFsAlwaysShownAppList::NewL
       
    37 // --------------------------------------------------------------------------
       
    38 //
       
    39 CTsFsAlwaysShownAppList* CTsFsAlwaysShownAppList::NewL()
       
    40     {
       
    41     CTsFsAlwaysShownAppList* self =
       
    42         new (ELeave) CTsFsAlwaysShownAppList;
       
    43     CleanupStack::PushL (self );
       
    44     self->ConstructL ( );
       
    45     CleanupStack::Pop ( self );
       
    46     return self;
       
    47     }
       
    48 
       
    49 // --------------------------------------------------------------------------
       
    50 // CTsFsAlwaysShownAppList::CTsFsAlwaysShownAppList
       
    51 // --------------------------------------------------------------------------
       
    52 //
       
    53 CTsFsAlwaysShownAppList::CTsFsAlwaysShownAppList()
       
    54     {
       
    55     }
       
    56 
       
    57 // --------------------------------------------------------------------------
       
    58 // CTsFsAlwaysShownAppList::~CTsFsAlwaysShownAppList
       
    59 // --------------------------------------------------------------------------
       
    60 //
       
    61 CTsFsAlwaysShownAppList::~CTsFsAlwaysShownAppList( )
       
    62     {
       
    63     iAppList.Close();
       
    64     iAppArcSession.Close();
       
    65     }
       
    66 
       
    67 // --------------------------------------------------------------------------
       
    68 // CTsFsAlwaysShownAppList::ConstructL
       
    69 // --------------------------------------------------------------------------
       
    70 //
       
    71 void CTsFsAlwaysShownAppList::ConstructL( )
       
    72     {
       
    73     User::LeaveIfError( iAppArcSession.Connect() );
       
    74     }
       
    75 
       
    76 // --------------------------------------------------------------------------
       
    77 // CTsFsAlwaysShownAppList::InitializeAlwaysShownListL
       
    78 // Applications that are always shown in fast swap are stored
       
    79 // in different their own list whether they exist
       
    80 // in the phone rom or not
       
    81 // --------------------------------------------------------------------------
       
    82 //
       
    83 void CTsFsAlwaysShownAppList::InitializeAlwaysShownListL( )
       
    84     {
       
    85     iAppList.Reset();
       
    86     // order of always shown applications
       
    87     TApaAppInfo applicationInfo;
       
    88     for (TInt index = 0,
       
    89             sizeOfArray = ( sizeof(KTsFsUidArray) / sizeof( TUint32 ) );
       
    90             index < sizeOfArray; index++ )
       
    91         {
       
    92         // if exists in phone rom
       
    93         if ( iAppArcSession.GetAppInfo( applicationInfo,
       
    94                 TUid::Uid( KTsFsUidArray[index] ) )!= KErrNotFound )
       
    95             {
       
    96             iAppList.AppendL( TUid::Uid( KTsFsUidArray[index] ) );
       
    97             }
       
    98         }
       
    99     }
       
   100 
       
   101 // --------------------------------------------------------------------------
       
   102 // CTsFsAlwaysShownAppList::IsAlwaysShownApp
       
   103 // If application uid exists in the always shown application list
       
   104 // --------------------------------------------------------------------------
       
   105 //
       
   106 TBool CTsFsAlwaysShownAppList::IsAlwaysShownApp( TUid aAppUid )
       
   107     {
       
   108     for ( TInt index = 0, count = iAppList.Count ( ); index < count; index++ )
       
   109         {
       
   110         if ( iAppList[index] == aAppUid )
       
   111             {
       
   112             return ETrue;
       
   113             }
       
   114         }
       
   115     return EFalse;
       
   116     }
       
   117 
       
   118 
       
   119 // end of file