phonebookui/Phonebook/View/inc/CPbkGroupPopup.h
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 *     UI control for Phonebook's "Add to group".
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CPbkGroupPopup_H__
       
    21 #define __CPbkGroupPopup_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>        // CBase
       
    25 #include <cntdef.h>         // TContactItemId
       
    26 #include <cntviewbase.h>    // MContactViewObserver
       
    27 #include <eikcmobs.h>       // MEikCommandObserver
       
    28 
       
    29 //  FORWARD DECLARATIONS
       
    30 class CEikColumnListBox;
       
    31 class CPbkInputAbsorber;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36  * @internal Only Phonebook internal use supported!
       
    37  *
       
    38  * Popup dialog which displays groups.
       
    39  */
       
    40 NONSHARABLE_CLASS(CPbkGroupPopup) : 
       
    41         public CBase, 
       
    42         private MContactViewObserver,
       
    43         private MEikCommandObserver
       
    44     {
       
    45     public:  // interface
       
    46         /**
       
    47          * Parameters object for NewL.
       
    48          */
       
    49         struct TParams
       
    50             {
       
    51             /// Ref, input: a contact view containing the groups to display
       
    52             CContactViewBase* iGroupView;
       
    53             /// Own, input: Initial (before iGroupView is ready) popup softkeys
       
    54 			/// resource id
       
    55             TInt iInitialSoftkeyResId;
       
    56             /// Own, input: Popup softkeys resource id
       
    57             TInt iSoftkeyResId;
       
    58             /// Ref, input: Popup prompt text
       
    59             const TDesC* iPrompt;
       
    60             /// Ref, input: empty text for the listbox
       
    61             const TDesC* iEmptyText;
       
    62             /// Own, input: listbox flags
       
    63             TInt iListBoxFlags;
       
    64             /// Own, output: Selected group's id
       
    65             TContactItemId iSelectedGroupId;
       
    66 
       
    67             /**
       
    68              * Constructor. Initializes mandatory fields with parameters and 
       
    69              * other fields to default values.
       
    70 			 * @param aGroupView the view
       
    71 			 * @param aInitialSoftkeyResId initial popup softkeys resource id
       
    72 			 * @param aSoftKeyResId popup softkeys resource id
       
    73              */
       
    74             TParams
       
    75                 (CContactViewBase& aGroupView, 
       
    76                 TInt aInitialSoftkeyResId,
       
    77                 TInt aSoftKeyResId);
       
    78             };
       
    79 
       
    80         /**
       
    81          * Creates a new instance of this class.
       
    82          *
       
    83          * @param aParams @see TParams.
       
    84          */
       
    85         static CPbkGroupPopup* NewL(TParams& aParams);
       
    86 
       
    87         /**
       
    88          * Destructor. Also makes ExecuteLD return like the dialog was
       
    89 		 * cancelled.
       
    90          */
       
    91         ~CPbkGroupPopup();
       
    92 
       
    93         /**
       
    94          * Executes and deletes (also if a leave occurs) this dialog.
       
    95          *
       
    96          * @postcond    (result==0 && iParams.iSelectedGroupId==KNullContactId) ||
       
    97          *              (result!=0 && iParams.iSelectedGroupId!=KNullContactId)
       
    98          */
       
    99         TInt ExecuteLD();
       
   100 
       
   101         /**
       
   102          * Resets *aSelfPtr to NULL when this object is destroyed.
       
   103          *
       
   104          * @precond !aSelfPtr || *aSelfPtr==this
       
   105          */
       
   106         void ResetWhenDestroyed(CPbkGroupPopup** aSelfPtr);
       
   107 
       
   108     private:  // from MContactViewObserver
       
   109 	    void HandleContactViewEvent
       
   110             (const CContactViewBase& aView,
       
   111             const TContactViewEvent& aEvent);
       
   112 
       
   113     private:  // from MEikCommandObserver
       
   114     	void ProcessCommandL(TInt aCommandId);
       
   115 
       
   116     private:  // Implementation
       
   117         CPbkGroupPopup(TParams& aParams);
       
   118         void ConstructL();
       
   119         void WaitForViewEventL();
       
   120         void RunPopupL();
       
   121         void Close();
       
   122         void DoHandleContactViewEventL(const TContactViewEvent& aEvent);
       
   123 
       
   124     private:  // data
       
   125         /// Ref: parameters
       
   126         TParams& iParams;
       
   127         /// Own: return value from ExecuteLD
       
   128         TInt iResult;
       
   129         /// Own: event absorbing control
       
   130         CPbkInputAbsorber* iInputAbsorber;
       
   131         /// Own: listbox
       
   132         CEikColumnListBox* iListBox;
       
   133         /// Type of iPopupList
       
   134         class CPopupList;
       
   135         /// Own: popuplist that contains iListBox
       
   136         CPopupList* iPopupList;
       
   137         /// Ref: destructor sets referred TBool to ETrue
       
   138         TBool* iDestroyedPtr;
       
   139         /// Ref: referred pointer is set to NULL in destructor
       
   140         CPbkGroupPopup** iSelfPtr;
       
   141     };
       
   142 
       
   143 #endif // __CPbkGroupPopup_H__
       
   144 
       
   145 // End of File