|         |      1 /* | 
|         |      2 * Copyright (c) 2002-2009 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 *     Sim Dialog plugin interface | 
|         |     16 * | 
|         |     17 */ | 
|         |     18  | 
|         |     19  | 
|         |     20 // INCLUDE FILES | 
|         |     21 #include "simdlgplugin.h" | 
|         |     22 #include "SMSU.H" | 
|         |     23 #include "simdlgplugininterface.h" | 
|         |     24  | 
|         |     25 // ============================== MEMBER FUNCTIONS ============================ | 
|         |     26  | 
|         |     27 // ---------------------------------------------------------------------------- | 
|         |     28 // CSimDlgPluginInterface::NewL | 
|         |     29 // Two Phase Construction | 
|         |     30 // ---------------------------------------------------------------------------- | 
|         |     31 CSimDlgPluginInterface* CSimDlgPluginInterface::NewL( | 
|         |     32         CSmsMtmUi&  aSmsMtmUi,  | 
|         |     33         CMsvSession& aSession) | 
|         |     34     { | 
|         |     35     CSimDlgPluginInterface* self = CSimDlgPluginInterface::NewLC(aSmsMtmUi,aSession); | 
|         |     36     CleanupStack::Pop( self ); | 
|         |     37  | 
|         |     38     return self; | 
|         |     39     } | 
|         |     40  | 
|         |     41 // ---------------------------------------------------------------------------- | 
|         |     42 // CSimDlgPluginInterface::NewLC | 
|         |     43 // Two Phase Construction | 
|         |     44 // ---------------------------------------------------------------------------- | 
|         |     45 CSimDlgPluginInterface* CSimDlgPluginInterface::NewLC( | 
|         |     46         CSmsMtmUi&  aSmsMtmUi,  | 
|         |     47         CMsvSession& aSession) | 
|         |     48     { | 
|         |     49     CSimDlgPluginInterface* self = new( ELeave ) CSimDlgPluginInterface(); | 
|         |     50     CleanupStack::PushL( self ); | 
|         |     51     self->ConstructL(aSmsMtmUi,aSession); | 
|         |     52  | 
|         |     53     return self; | 
|         |     54     } | 
|         |     55  | 
|         |     56 // ---------------------------------------------------------------------------- | 
|         |     57 // CSimDlgPluginInterface::CSimDlgPluginInterface | 
|         |     58 // Constructor | 
|         |     59 // ---------------------------------------------------------------------------- | 
|         |     60 CSimDlgPluginInterface::CSimDlgPluginInterface() | 
|         |     61     { | 
|         |     62     } | 
|         |     63  | 
|         |     64 // ---------------------------------------------------------------------------- | 
|         |     65 // CSimDlgPluginInterface::ConstructL | 
|         |     66 // 2nd phase constructor | 
|         |     67 // ---------------------------------------------------------------------------- | 
|         |     68 void CSimDlgPluginInterface::ConstructL( | 
|         |     69         CSmsMtmUi&  aSmsMtmUi,  | 
|         |     70         CMsvSession& aSession) | 
|         |     71     { | 
|         |     72     InstantiatePluginL(aSmsMtmUi,aSession); | 
|         |     73     } | 
|         |     74  | 
|         |     75 // ---------------------------------------------------------------------------- | 
|         |     76 // CSimDlgPluginInterface::~CSimDlgPluginInterface | 
|         |     77 // Constructor | 
|         |     78 // ---------------------------------------------------------------------------- | 
|         |     79 CSimDlgPluginInterface::~CSimDlgPluginInterface( ) | 
|         |     80     { | 
|         |     81     UnloadPlugIn(); | 
|         |     82     if(iSimDlgPlugin) | 
|         |     83         { | 
|         |     84         delete iSimDlgPlugin; | 
|         |     85         iSimDlgPlugin = NULL; | 
|         |     86         } | 
|         |     87     } | 
|         |     88  | 
|         |     89 // ---------------------------------------------------------------------------- | 
|         |     90 // CSimDlgPluginInterface::InstantiateAllPlugInsL | 
|         |     91 // Instantiates all plugins | 
|         |     92 // ---------------------------------------------------------------------------- | 
|         |     93 void CSimDlgPluginInterface::InstantiatePluginL( | 
|         |     94         CSmsMtmUi&  aSmsMtmUi,  | 
|         |     95         CMsvSession& aSession) | 
|         |     96     { | 
|         |     97     RImplInfoPtrArray infoArray; | 
|         |     98  | 
|         |     99     // Get list of all implementations | 
|         |    100     ListAllImplementationsL( infoArray ); | 
|         |    101  | 
|         |    102     //other sim dialogs available, instantiate other than default | 
|         |    103     for ( TInt iloop=0; iloop<infoArray.Count(); iloop++ ) | 
|         |    104         { | 
|         |    105         // Get imp info | 
|         |    106         CImplementationInformation& info( *infoArray[iloop] ); | 
|         |    107         // Get imp UID | 
|         |    108         TUid impUid ( info.ImplementationUid() ); | 
|         |    109  | 
|         |    110         if(infoArray.Count() > 1 &&  | 
|         |    111                 !(info.DisplayName().Compare(_L("_default_")))) | 
|         |    112             { | 
|         |    113             continue; | 
|         |    114             } | 
|         |    115         else | 
|         |    116             { | 
|         |    117             //instantiate plugin for impUid | 
|         |    118             iSimDlgPlugin = CSimDlgPlugin::NewL(impUid, aSmsMtmUi , aSession); | 
|         |    119             break; | 
|         |    120             } | 
|         |    121         } | 
|         |    122     infoArray.ResetAndDestroy(); | 
|         |    123     } | 
|         |    124  | 
|         |    125 // ----------------------------------------------------------------------------- | 
|         |    126 // CSimDlgPluginInterface::UnloadPlugIn | 
|         |    127 // Unloads plugin | 
|         |    128 // ----------------------------------------------------------------------------- | 
|         |    129 void CSimDlgPluginInterface::UnloadPlugIn() | 
|         |    130     { | 
|         |    131     REComSession::FinalClose();     | 
|         |    132     } | 
|         |    133  | 
|         |    134 // ---------------------------------------------------------------------------- | 
|         |    135 // CSimDlgPluginInterface::LaunchL | 
|         |    136 // Forwards the request to the plugin instance , | 
|         |    137 // Launch the sim dialog | 
|         |    138 // ---------------------------------------------------------------------------- | 
|         |    139 void CSimDlgPluginInterface::LaunchL() | 
|         |    140     { | 
|         |    141     if( iSimDlgPlugin) | 
|         |    142         { | 
|         |    143         //launch default sim dialog | 
|         |    144         iSimDlgPlugin->LaunchL(); | 
|         |    145         } | 
|         |    146     } | 
|         |    147  | 
|         |    148 //EOF |