phonebookengines_old/contactsmodel/cntsrv/inc/CCntPermanentData.h
changeset 40 b46a585f6909
equal deleted inserted replaced
37:fd64c38c277d 40:b46a585f6909
       
     1 /**
       
     2 * Copyright (c) 2005-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 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23  @released
       
    24 */
       
    25 
       
    26 
       
    27 #ifndef CCNTPERMANENTDATA_H_
       
    28 #define CCNTPERMANENTDATA_H_
       
    29 
       
    30 #include <cntviewbase.h>
       
    31 
       
    32 
       
    33 class CCntDbManagerController;
       
    34 class CCntDbManager;
       
    35 class CContactDefaultViewDefinition;
       
    36 
       
    37 
       
    38 /**
       
    39 This class manages permanent data created during Server start-up.
       
    40 */
       
    41 class CCntPermanentData : public CActive, public MContactViewObserver
       
    42 	{
       
    43 private:
       
    44 	enum TState
       
    45 		{
       
    46 		EStateInitial = 0,
       
    47 		EStateOpeningDb,
       
    48 		EStateOpeningView,
       
    49 		EStateFinished
       
    50 		};
       
    51 	
       
    52 public:
       
    53 	~CCntPermanentData();
       
    54 	
       
    55 	void RunL();
       
    56 	void DoCancel();
       
    57 	TInt RunError(TInt aError);
       
    58 	void CompleteSelf(TInt aReason);
       
    59 	
       
    60 	static CCntPermanentData* NewL(CCntDbManagerController& aController);
       
    61 	
       
    62 	void StartDataCreationL();
       
    63 	TBool IsOnlyClientOfDbManager(CCntDbManager* manager) const;
       
    64 	void ReleaseDbManagerL(CCntDbManager* manager);
       
    65 	
       
    66 	void HandleContactViewEvent(const CContactViewBase &aView, const TContactViewEvent &aEvent);
       
    67 
       
    68 private:
       
    69 	CCntPermanentData(CCntDbManagerController& aController);
       
    70 	void ConstructL();
       
    71 	void Close();
       
    72 	
       
    73 	TBool OpenNextViewL();
       
    74 	CContactViewBase* OpenViewFromDefinitionL(const CContactDefaultViewDefinition& aViewDef);
       
    75 	
       
    76 private:
       
    77 	TState iState;
       
    78 	CCntDbManagerController& iController;
       
    79 	CCntDbManager * iManager;
       
    80 	RPointerArray<CContactDefaultViewDefinition> iViewDefs;
       
    81 	RPointerArray<CContactViewBase> iViews; // This does not own the CContactViewBase, RPointerArray is
       
    82 	                                        // only used since RArray<CContactViewBase&> does not compile.
       
    83 	};
       
    84 
       
    85 
       
    86 #endif // CCNTPERMANENTDATA_H_