phonebookui/Phonebook2/UIControls/src/Pbk2FetchDlgPageFactory.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Provides methods for Fetch dialog page interfaces
       
    15                   for Phonebook.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "Pbk2FetchDlgPageFactory.h"
       
    21 
       
    22 // Phonebook 2
       
    23 #include "CPbk2FetchDlgPages.h"
       
    24 #include "Pbk2UIControls.hrh"
       
    25 #include "CPbk2FetchDlgPage.h"
       
    26 #include "CPbk2FetchDlgGroupPage.h"
       
    27 #include "MPbk2FetchDlg.h"
       
    28 #include "CPbk2NamesListControl.h"
       
    29 #include <MPbk2ApplicationServices.h>
       
    30 #include <MPbk2AppUi.h>
       
    31 
       
    32 // --------------------------------------------------------------------------
       
    33 // Pbk2FetchDlgPageFactory::CreateCustomControlL
       
    34 // --------------------------------------------------------------------------
       
    35 //
       
    36 CCoeControl* Pbk2FetchDlgPageFactory::CreateCustomControlL
       
    37         ( TInt aControlType,  const CCoeControl* aParent,
       
    38           MPbk2FetchDlg& aFetchDlg )
       
    39     {
       
    40     CPbk2NamesListControl* namesListControl = NULL;
       
    41 
       
    42     if ( aControlType == EPbk2CtNamesContactViewList )
       
    43         {
       
    44         namesListControl = new ( ELeave ) CPbk2NamesListControl
       
    45             ( aParent,
       
    46               Phonebook2::Pbk2AppUi()->ApplicationServices().
       
    47                 ContactManager(),
       
    48               aFetchDlg.FetchDlgViewL( ECtrlFetchNamesList ),
       
    49               Phonebook2::Pbk2AppUi()->ApplicationServices().
       
    50                 NameFormatter(),
       
    51               Phonebook2::Pbk2AppUi()->ApplicationServices().
       
    52                 StoreProperties() );
       
    53         }
       
    54     else if ( aControlType == EPbk2CtGroupsContactViewList )
       
    55         {
       
    56         namesListControl = new ( ELeave ) CPbk2NamesListControl
       
    57             ( aParent,
       
    58               Phonebook2::Pbk2AppUi()->ApplicationServices().
       
    59                 ContactManager(),
       
    60               aFetchDlg.FetchDlgViewL( ECtrlFetchGroupsList ),
       
    61               Phonebook2::Pbk2AppUi()->ApplicationServices().
       
    62                 NameFormatter(),
       
    63               Phonebook2::Pbk2AppUi()->ApplicationServices().
       
    64                 StoreProperties() );
       
    65         }
       
    66 
       
    67     return namesListControl;
       
    68     }
       
    69 
       
    70 // --------------------------------------------------------------------------
       
    71 // Pbk2FetchDlgPageFactory::CreatePagesL
       
    72 // --------------------------------------------------------------------------
       
    73 //
       
    74 MPbk2FetchDlgPages* Pbk2FetchDlgPageFactory::CreatePagesL
       
    75         ( MPbk2FetchDlg& aFetchDlg, CVPbkContactManager& aContactManager )
       
    76     {
       
    77     CPbk2FetchDlgPages* pages = new ( ELeave ) CPbk2FetchDlgPages;
       
    78     CleanupStack::PushL( pages );
       
    79 
       
    80     if ( aFetchDlg.FetchDlgControl( ECtrlFetchNamesList ) )
       
    81         {
       
    82         CPbk2FetchDlgPage* page = CPbk2FetchDlgPage::NewL
       
    83             ( aFetchDlg, ECtrlFetchNamesList );
       
    84 
       
    85         CleanupStack::PushL( page );
       
    86         pages->AddL( page );
       
    87         CleanupStack::Pop( page );
       
    88         }
       
    89 
       
    90     if ( aFetchDlg.FetchDlgControl( ECtrlFetchGroupsList ) )
       
    91         {
       
    92         CPbk2FetchDlgGroupPage* page = CPbk2FetchDlgGroupPage::NewL
       
    93             ( aFetchDlg,  ECtrlFetchGroupsList, aContactManager );
       
    94 
       
    95         CleanupStack::PushL( page );
       
    96         pages->AddL( page );
       
    97         CleanupStack::Pop( page );
       
    98         }
       
    99 
       
   100     CleanupStack::Pop( pages );
       
   101     return pages;
       
   102     }
       
   103 
       
   104 // End of File