phonebookui/Phonebook/PbkExt/src/CPbkMultiContactEditorExtension.cpp
changeset 0 e686773b3f54
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 *       Composite contact editor extension.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CPbkMultiContactEditorExtension.h"
       
    22 #include "ForEachUtil.h"
       
    23 
       
    24 const TInt KExtensionGranularity = 1;
       
    25 
       
    26 // ==================== MEMBER FUNCTIONS ====================
       
    27 CPbkMultiContactEditorExtension::CPbkMultiContactEditorExtension() :
       
    28     iContactEditors(KExtensionGranularity)
       
    29     {
       
    30     }
       
    31 
       
    32 CPbkMultiContactEditorExtension::~CPbkMultiContactEditorExtension()
       
    33     {
       
    34     // This really cannot leave since this is a template
       
    35     // method and actually Release method is called
       
    36     ForEachL(iContactEditors,
       
    37              &Release);
       
    38     iContactEditors.Reset();
       
    39     }
       
    40 
       
    41 CPbkMultiContactEditorExtension* CPbkMultiContactEditorExtension::NewL()
       
    42     {
       
    43     CPbkMultiContactEditorExtension* self = 
       
    44         new (ELeave) CPbkMultiContactEditorExtension;
       
    45     return self;
       
    46     }
       
    47 
       
    48 void CPbkMultiContactEditorExtension::AppendL
       
    49         (MPbkContactEditorExtension* aContactEditor)
       
    50     {
       
    51     iContactEditors.AppendL(aContactEditor);
       
    52     }
       
    53 
       
    54 void CPbkMultiContactEditorExtension::DynInitMenuPaneL
       
    55         (TInt aResourceId, CEikMenuPane* aMenuPane)
       
    56     {
       
    57     ForEachL(iContactEditors,
       
    58              VoidMemberFunction(&MPbkContactEditorExtension::DynInitMenuPaneL),
       
    59              aResourceId,
       
    60              aMenuPane);
       
    61     }
       
    62 
       
    63 TBool CPbkMultiContactEditorExtension::ProcessCommandL(TInt aCommandId)
       
    64     {
       
    65     return TryEachL(iContactEditors,
       
    66                     MemberFunction(&MPbkContactEditorExtension::ProcessCommandL),
       
    67                     aCommandId);
       
    68     }
       
    69         
       
    70 void CPbkMultiContactEditorExtension::PreOkToExitL(TInt aButtonId)
       
    71     {
       
    72     ForEachL(iContactEditors,
       
    73                     VoidMemberFunction(&MPbkContactEditorExtension::PreOkToExitL),
       
    74                     aButtonId);
       
    75     }
       
    76 
       
    77 void CPbkMultiContactEditorExtension::PostOkToExitL(TInt aButtonId)
       
    78     {
       
    79     ForEachL(iContactEditors,
       
    80              VoidMemberFunction(&MPbkContactEditorExtension::PostOkToExitL),
       
    81              aButtonId);
       
    82     }
       
    83 
       
    84 void CPbkMultiContactEditorExtension::DoRelease()
       
    85     {
       
    86     delete this;
       
    87     }