uifw/inc/akncompaif.inl
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Compa-mode interface (client) implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <../ecom/ecom.h>
       
    21 #include <aknappui.h>
       
    22 #include <centralrepository.h>
       
    23 #include <AvkonInternalCRKeys.h>
       
    24 
       
    25 #include "akncompaif.h"
       
    26 
       
    27 // akncompaflags.h is not included. These are from there.
       
    28 const TInt KAknCompaFeatureEnaCompaMode = 1; // Enable compa-mode in device
       
    29 const TInt KAknCompaSettingEnaApps = 1;
       
    30 
       
    31 // --------------------------------------------------------------------------
       
    32 //
       
    33 // --------------------------------------------------------------------------
       
    34 inline CAknCompaIf::~CAknCompaIf()
       
    35     {
       
    36     REComSession::DestroyedImplementation(iEcomDtorId);
       
    37     }
       
    38 
       
    39 // --------------------------------------------------------------------------
       
    40 // Create instance of compa-mode interface
       
    41 // --------------------------------------------------------------------------
       
    42 inline CAknCompaIf* CAknCompaIf::NewL()
       
    43     {
       
    44     const TUid KImplUid = {0x20010126}; // AKNCOMPAIF_ECOM_IMPL_UID
       
    45     return reinterpret_cast<CAknCompaIf*>(
       
    46         REComSession::CreateImplementationL(KImplUid,
       
    47             _FOFF(CAknCompaIf, iEcomDtorId)));
       
    48     }
       
    49 
       
    50 // --------------------------------------------------------------------------
       
    51 // Check if compa-mode may be needed. If this function returns false,
       
    52 // compa-mode is definetely not needed. Either application is touch
       
    53 // compatible or compa mode feature is not enabled. If it returns true,
       
    54 // compa-mode plugin should be instantiated to perform further checks.
       
    55 // --------------------------------------------------------------------------
       
    56 inline TBool CAknCompaIf::IsNeeded(TInt aAppUiFlags,
       
    57     CRepository* aRepository)
       
    58     {
       
    59     TBool isNeeded = EFalse;
       
    60     if ((aAppUiFlags & CAknAppUiBase::EAknTouchCompatible) == 0 &&
       
    61         aRepository)
       
    62         {
       
    63         // Compa-mode maybe needed if compa-mode feature is enabled in device
       
    64         TInt compaFeatures = 0;
       
    65         aRepository->Get(KAknCompaModeFeatures, compaFeatures);
       
    66         if (compaFeatures & KAknCompaFeatureEnaCompaMode)
       
    67             {
       
    68             TInt compaSettings = 0;
       
    69             aRepository->Get(KAknCompaModeSettings, compaSettings);
       
    70             // Compa-mode may be needed if compa-mode is enabled from settings
       
    71             // or the application is a global UI server.
       
    72             isNeeded = compaSettings & KAknCompaSettingEnaApps ||
       
    73                 aAppUiFlags & CEikAppUi::ENoScreenFurniture;
       
    74             }
       
    75         }
       
    76     return isNeeded;
       
    77     }