phoneapp/phoneuiutils/src/cphoneclearblacklist.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Blacklist clearing.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cphoneclearblacklist.h"
       
    21 #include "phoneconstants.h"
       
    22 #include "phonelogger.h"
       
    23 #include "phoneui.pan"
       
    24 #include "rphoneanimclearblacklist.h"
       
    25 #include <data_caging_path_literals.hrh>
       
    26 
       
    27 // CONSTANTS
       
    28 #ifdef __WINS__
       
    29 _LIT( KPhoneAnimDllFileName, "phoneanimdll.dll" );
       
    30 #else
       
    31 _LIT( KPhoneAnimDllFileName, "z:phoneanimdll.dll" );
       
    32 #endif // __WINS__
       
    33 
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ===============================
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // CPhoneClearBlacklist::CreateL
       
    39 // ---------------------------------------------------------
       
    40 //
       
    41 EXPORT_C CPhoneClearBlacklist* CPhoneClearBlacklist::CreateL( RWsSession& aWsSession, 
       
    42      const RWindowBase& aDevice )
       
    43     {
       
    44     __LOGMETHODSTARTEND( EPhoneUIUtils, "CPhoneClearBlacklist::CreateL( ) ");
       
    45     CPhoneClearBlacklist* instance = static_cast<CPhoneClearBlacklist*>(
       
    46         CCoeEnv::Static( KUidClearBlackListSingleton ) );
       
    47     if ( !instance )
       
    48         {
       
    49         instance = new (ELeave) CPhoneClearBlacklist();
       
    50         CleanupStack::PushL( instance );
       
    51         instance->ConstructL( aWsSession, aDevice );
       
    52         CleanupStack::Pop( instance );
       
    53         }
       
    54     return instance;
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------
       
    58 // CPhoneClearBlacklist::Instance
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 EXPORT_C CPhoneClearBlacklist* CPhoneClearBlacklist::Instance()
       
    62     {
       
    63     CPhoneClearBlacklist* instance = static_cast<CPhoneClearBlacklist*>(
       
    64         CCoeEnv::Static( KUidClearBlackListSingleton ) );
       
    65     __ASSERT_DEBUG( instance, Panic( EPhoneCtrlSingletonNotInitialized ) );
       
    66     return instance;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 //  CPhoneClearBlacklist::CPhoneClearBlacklist
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 CPhoneClearBlacklist::CPhoneClearBlacklist() : CCoeStatic( KUidClearBlackListSingleton )
       
    74     {
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 //  CPhoneClearBlacklist::~CPhoneClearBlacklist
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C CPhoneClearBlacklist::~CPhoneClearBlacklist()
       
    82     {
       
    83     if ( iAnim )
       
    84         {
       
    85         iAnim->Close();
       
    86         delete iAnim;
       
    87         }
       
    88 
       
    89     if ( iAnimDll )
       
    90         {
       
    91         iAnimDll->Close();
       
    92         delete iAnimDll;
       
    93         }   
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 //  CPhoneClearBlacklist::ConstructL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void CPhoneClearBlacklist::ConstructL( RWsSession& aWsSession, 
       
   101      const RWindowBase& aDevice )
       
   102     {
       
   103     // Construct RAnim connection
       
   104     iAnimDll = new (ELeave) RAnimDll( aWsSession );
       
   105 
       
   106     TParse* fp = new (ELeave) TParse();
       
   107 #ifdef __WINS__
       
   108     fp->Set( KPhoneAnimDllFileName, NULL, NULL ); 
       
   109 #else
       
   110     fp->Set( KPhoneAnimDllFileName, &KDC_SHARED_LIB_DIR, NULL );     
       
   111 #endif //__WINS__
       
   112     TFileName fileName( fp->FullName() );
       
   113     delete fp;
       
   114 
       
   115     User::LeaveIfError( iAnimDll->Load( fileName ) );
       
   116 
       
   117     iAnim = new (ELeave) RPhoneAnimClearBlacklist( *iAnimDll );
       
   118     iAnim->ConstructL( aDevice );
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 //  CPhoneClearBlacklist::ClearBlackList
       
   123 //
       
   124 //  Clears blacklist.
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 EXPORT_C void CPhoneClearBlacklist::ClearBlackListNow()
       
   128     {
       
   129     __LOGMETHODSTARTEND( EPhoneUIUtils, "CPhoneClearBlacklist::ClearBlackListNow( ) ");
       
   130     iAnim->ClearBlackListNow();
       
   131     }
       
   132 
       
   133 // -----------------------------------------------------------------------------
       
   134 //  CPhoneClearBlacklist::ClearBlackListOnNextKey
       
   135 //
       
   136 //  Clears blacklist.
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 EXPORT_C void CPhoneClearBlacklist::ClearBlackListOnNextKey()
       
   140     {
       
   141     __LOGMETHODSTARTEND( EPhoneUIUtils, "CPhoneClearBlacklist::ClearBlackListOnNextKey( ) ");
       
   142     iAnim->ClearBlackListOnNextKey();
       
   143     }
       
   144 
       
   145 //  End of File