phonebookui/Phonebook2/USIMExtension/inc/CPsu2ViewManager.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 USIM UI Extension view manager.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPSU2VIEWMANAGER_H
       
    20 #define CPSU2VIEWMANAGER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "Pbk2USimUI.hrh"
       
    25 #include <MVPbkContactStoreObserver.h>
       
    26 #include <MVPbkContactViewObserver.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CVPbkContactManager;
       
    30 class MVPbkContactViewBase;
       
    31 class TVPbkContactStoreUriPtr;
       
    32 class MVPbkContactStoreList;
       
    33 class MVPbkSimPhone;
       
    34 class CPsu2SecUi;
       
    35 class CVPbkSortOrder;
       
    36 class MVPbkContactStore;
       
    37 class MVPbkContactStoreObserver;
       
    38 class MVPbkContactViewObserver;
       
    39 class MPsu2ViewLaunchCallback;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44  * Phonebook 2 USIM UI Extension view manager.
       
    45  */
       
    46 class CPsu2ViewManager : public CBase,
       
    47                          private MVPbkContactStoreObserver,
       
    48                          private MVPbkContactViewObserver
       
    49     {
       
    50     public: // Constructors and destructor
       
    51 
       
    52         /**
       
    53          * Creates a new instance of this class.
       
    54          *
       
    55          * @return  A new instance of this class.
       
    56          */
       
    57         static CPsu2ViewManager* NewL();
       
    58 
       
    59         /**
       
    60          * Destructor.
       
    61          */
       
    62         virtual ~CPsu2ViewManager();
       
    63 
       
    64     public: // Interface
       
    65 
       
    66         /**
       
    67          * Returns the current engine side SIM view.
       
    68          *
       
    69          * @return  Current engine side SIM view.
       
    70          */
       
    71         inline MVPbkContactViewBase& CurrentSimView();
       
    72 
       
    73         /**
       
    74          * Returns the PIN 2 handler.
       
    75          *
       
    76          * @return  PIN 2 handler.
       
    77          */
       
    78         inline CPsu2SecUi& SecUi() const;
       
    79 
       
    80         /**
       
    81          * Resets current store and view configuration and loads
       
    82          * opens the store identified by given URI.
       
    83          * Opens the contact view identified by given view id.
       
    84          *
       
    85          * @param aURI                  URI of contact store to open.
       
    86          * @param aViewId               Id of the view to open.         
       
    87          * @param aViewLaunchCallback   Reference to receive contact
       
    88          *                               view reference.
       
    89          */
       
    90         void ResetAndInitiateStoreAndViewL(
       
    91                 const TVPbkContactStoreUriPtr& aURI,
       
    92                 TPsu2ViewId aViewId,
       
    93                 MPsu2ViewLaunchCallback& aViewLaunchCallback);
       
    94                 
       
    95         /**
       
    96          * Remove view's launch callback
       
    97          */                
       
    98         void RemoveViewLaunchCallBack(); 
       
    99 
       
   100         /**
       
   101          * Registers store and view.
       
   102          */
       
   103         void RegisterStoreAndView();
       
   104 
       
   105         /**
       
   106          * Deregisters store and view.
       
   107          */
       
   108         void DeregisterStoreAndView();
       
   109 
       
   110         /**
       
   111          * Returns current contact store.
       
   112          */
       
   113          MVPbkContactStore& ContactStore();
       
   114 
       
   115         /**
       
   116          * Returns ETrue if store is available. EFalse if not.
       
   117          * This function also shows unavailable note if store is not available
       
   118          */
       
   119         TBool StoreAvailableL();
       
   120 
       
   121     private: // From MVPbkContactStoreObserver
       
   122         void StoreReady(
       
   123                 MVPbkContactStore& aContactStore );
       
   124         void StoreUnavailable(
       
   125                 MVPbkContactStore& aContactStore,
       
   126                 TInt aReason );
       
   127         void HandleStoreEventL(
       
   128                 MVPbkContactStore& aContactStore, 
       
   129                 TVPbkContactStoreEvent aStoreEvent );
       
   130 
       
   131     private: // From MVPbkContactViewObserver
       
   132         void ContactViewReady(
       
   133                 MVPbkContactViewBase& aView );
       
   134         void ContactViewUnavailable(
       
   135                 MVPbkContactViewBase& aView );
       
   136         void ContactAddedToView(
       
   137                 MVPbkContactViewBase& aView,
       
   138                 TInt aIndex,
       
   139                 const MVPbkContactLink& aContactLink );
       
   140         void ContactRemovedFromView(
       
   141                 MVPbkContactViewBase& aView,
       
   142                 TInt aIndex,
       
   143                 const MVPbkContactLink& aContactLink );
       
   144         void ContactViewError(
       
   145                 MVPbkContactViewBase& aView,
       
   146                 TInt aError,
       
   147                 TBool aErrorNotified );
       
   148 
       
   149 
       
   150     private: // Implementation
       
   151         CPsu2ViewManager();
       
   152         void ConstructL();
       
   153         MVPbkContactViewBase* CreateViewL(
       
   154                 TInt aViewDefResourceId );
       
   155         MVPbkContactViewBase* OpenViewL(
       
   156                 TPsu2ViewId aViewId );
       
   157         void DoOpenContactViewL();
       
   158 
       
   159     private: // Data
       
   160         /// Ref: Contact manager
       
   161         CVPbkContactManager* iContactManager;
       
   162         /// Own: Currently active view
       
   163         MVPbkContactViewBase* iCurrentSimView;
       
   164         /// Ref: Contact store list
       
   165         MVPbkContactStoreList* iContactStores;
       
   166         /// Own: Sim phone
       
   167         MVPbkSimPhone* iPhone;
       
   168         /// Own: PIN 2 handler
       
   169         CPsu2SecUi* iSecUi;
       
   170         /// Own: FDN sort order
       
   171         CVPbkSortOrder* iFdnSortOrder;
       
   172         /// Own: contact store
       
   173         MVPbkContactStore* iContactStore;
       
   174         /// Own: view id
       
   175         TPsu2ViewId iViewId;
       
   176         /// Ref: View LaunchCallback
       
   177         MPsu2ViewLaunchCallback* iViewLaunchCallback;
       
   178         /// Own: Store available indicator
       
   179         TBool iStoreAvailable;
       
   180         /// Own: Reference count
       
   181         TInt iRefCount;
       
   182     };
       
   183 
       
   184 // INLINE FUNCTIONS
       
   185 
       
   186 // --------------------------------------------------------------------------
       
   187 // CPsu2ViewManager::CurrentSimView
       
   188 // --------------------------------------------------------------------------
       
   189 //
       
   190 inline MVPbkContactViewBase& CPsu2ViewManager::CurrentSimView()
       
   191     {
       
   192     return *iCurrentSimView;
       
   193     }
       
   194 
       
   195 // --------------------------------------------------------------------------
       
   196 // CPsu2ViewManager::SecUi
       
   197 // --------------------------------------------------------------------------
       
   198 //
       
   199 inline CPsu2SecUi& CPsu2ViewManager::SecUi() const
       
   200     {
       
   201     return *iSecUi;
       
   202     }
       
   203 
       
   204 #endif // CPSU2VIEWMANAGER_H
       
   205 
       
   206 // End of File