phonebookui/Phonebook/Engine/src/CPbkConstants.cpp
changeset 0 e686773b3f54
child 21 9da50d567e3c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *        Implementation file for CPbkConstants class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    <CPbkConstants.h>
       
    22 #include    <f32file.h>
       
    23 #include    <barsc.h>
       
    24 #include    <barsread.h>
       
    25 #include    <PbkEng.rsg>
       
    26 #include    "CPbkLocalVariationManager.h"
       
    27 
       
    28 
       
    29 /// Unnamed namespace for local definitions
       
    30 namespace {
       
    31 
       
    32 // LOCAL CONSTANTS AND MACROS
       
    33 #ifdef _DEBUG
       
    34 enum TPanicCode
       
    35     {
       
    36     EPanicPreCond_UnnamedTitle = 1
       
    37     };
       
    38 
       
    39 static void Panic(TPanicCode aReason)
       
    40     {
       
    41     _LIT(KPanicText, "CPbkConstants");
       
    42     User::Panic(KPanicText, aReason);
       
    43     }
       
    44 #endif // _DEBUG
       
    45 
       
    46 } // namespace
       
    47 
       
    48 // ==================== MEMBER FUNCTIONS ====================
       
    49 
       
    50 inline CPbkConstants::CPbkConstants()
       
    51     {
       
    52     // CBase::operator new(TLeave) resets member data
       
    53     }
       
    54 
       
    55 inline void CPbkConstants::ConstructL(RResourceFile& aResourceFile)
       
    56     {
       
    57     TResourceReader reader;
       
    58     reader.SetBuffer(aResourceFile.AllocReadLC(R_QTN_PHOB_UNNAMED));
       
    59     iUnnamedTitle = reader.ReadHBufCL();
       
    60     iLocalVariationManager = CPbkLocalVariationManager::NewL();
       
    61     CleanupStack::PopAndDestroy();  // reader
       
    62     }
       
    63 
       
    64 EXPORT_C CPbkConstants* CPbkConstants::NewL(RResourceFile& aResourceFile)
       
    65     {
       
    66     CPbkConstants* self = new(ELeave) CPbkConstants;
       
    67     CleanupStack::PushL(self);
       
    68     self->ConstructL(aResourceFile);
       
    69     CleanupStack::Pop(self);
       
    70     return self;
       
    71     }
       
    72 
       
    73 CPbkConstants::~CPbkConstants()
       
    74     {
       
    75     delete iUnnamedTitle;
       
    76     delete iLocalVariationManager;
       
    77     }
       
    78 
       
    79 EXPORT_C const TDesC& CPbkConstants::UnnamedTitle() const
       
    80     {
       
    81     __ASSERT_DEBUG(iUnnamedTitle, Panic(EPanicPreCond_UnnamedTitle));
       
    82     return *iUnnamedTitle;
       
    83     }
       
    84 
       
    85 EXPORT_C TInt CPbkConstants::GroupLabelLength()
       
    86     {
       
    87     return 35;
       
    88     }
       
    89 
       
    90 EXPORT_C TInt CPbkConstants::FormEditorLength()
       
    91     {
       
    92     return 35;
       
    93     }
       
    94 
       
    95 EXPORT_C TInt CPbkConstants::CompressionInactivityTimerLength()
       
    96     {
       
    97     return 10;
       
    98     }
       
    99 
       
   100 EXPORT_C TInt CPbkConstants::RingingTonePreviewDelay()
       
   101     {   
       
   102     return 1000*1000; // 1 second
       
   103     }
       
   104 
       
   105 EXPORT_C TInt CPbkConstants::ThumbnailPopupDelay()
       
   106     {
       
   107     return 200*1000; // wait time 200 milliseconds.
       
   108     }
       
   109 
       
   110 EXPORT_C TInt CPbkConstants::FieldEditorLength()
       
   111     {
       
   112     return 8;
       
   113     }
       
   114 
       
   115 EXPORT_C TInt CPbkConstants::SearchFieldLength()
       
   116     {
       
   117     return 40;
       
   118     }
       
   119 
       
   120 EXPORT_C TBool CPbkConstants::LocallyVariatedFeatureEnabled
       
   121         (TPbkLocalVariantFlags aFeature)
       
   122     {
       
   123     return iLocalVariationManager->LocallyVariatedFeatureEnabled(aFeature);
       
   124     }
       
   125 
       
   126 
       
   127 //  End of File