|
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: A class for folding view that can be expanded to its subview |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CVPBKFOLDINGCONTACTVIEW_H |
|
20 #define CVPBKFOLDINGCONTACTVIEW_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <MVPbkContactViewBase.h> |
|
24 #include <MVPbkExpandable.h> |
|
25 |
|
26 #include "VPbkContactView.hrh" |
|
27 #include <CVPbkAsyncOperation.h> |
|
28 |
|
29 class CVPbkFoldingViewContact; |
|
30 class MVPbkContactStore; |
|
31 class MVPbkContactObserver; |
|
32 class CVPbkContactViewDefinition; |
|
33 class CVPbkContactManager; |
|
34 |
|
35 /** |
|
36 * A class for folding view that can be expanded to its subview |
|
37 * |
|
38 * From the client point of view the folding view is a view contact |
|
39 * that can be expanded to another view. The folding view must |
|
40 * have one subview definition that is used to create the |
|
41 * expanded view |
|
42 */ |
|
43 NONSHARABLE_CLASS(CVPbkFoldingContactView) : |
|
44 public CBase, |
|
45 public MVPbkContactViewBase, |
|
46 public MVPbkExpandable |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Returns new CVPbkFoldingContactView instance |
|
52 * |
|
53 * @param aObserver Observer of this class |
|
54 * @param aViewDefinition view definition |
|
55 * @param aContactManager contact manager |
|
56 * @param aSortOrder sort order |
|
57 * @return instance of CVPbkFoldingContactView |
|
58 */ |
|
59 static CVPbkFoldingContactView* NewLC( |
|
60 MVPbkContactViewObserver& aObserver, |
|
61 const CVPbkContactViewDefinition& aViewDefinition, |
|
62 const CVPbkContactManager& aContactManager, |
|
63 const MVPbkFieldTypeList& aSortOrder); |
|
64 ~CVPbkFoldingContactView(); |
|
65 |
|
66 /** |
|
67 * Returns the name of the view that is visible to client |
|
68 * |
|
69 * @return the name of the view that is visible to client |
|
70 */ |
|
71 const TDesC& Name() const; |
|
72 |
|
73 public: // from base class MVPbkContactViewBase |
|
74 TVPbkContactViewType Type() const; |
|
75 void ChangeSortOrderL(const MVPbkFieldTypeList& aSortOrder); |
|
76 const MVPbkFieldTypeList& SortOrder() const; |
|
77 void RefreshL(); |
|
78 TInt ContactCountL() const; |
|
79 const MVPbkViewContact& ContactAtL(TInt aIndex) const; |
|
80 MVPbkContactLink* CreateLinkLC(TInt aIndex) const; |
|
81 TInt IndexOfLinkL(const MVPbkContactLink& aContactLink) const; |
|
82 void AddObserverL(MVPbkContactViewObserver& aObserver); |
|
83 void RemoveObserver(MVPbkContactViewObserver& aObserver); |
|
84 TBool MatchContactStore(const TDesC& aContactStoreUri) const; |
|
85 TBool MatchContactStoreDomain(const TDesC& aContactStoreDomain) const; |
|
86 MVPbkContactBookmark* CreateBookmarkLC(TInt aIndex) const; |
|
87 TInt IndexOfBookmarkL( |
|
88 const MVPbkContactBookmark& aContactBookmark) const; |
|
89 MVPbkContactViewFiltering* ViewFiltering(); |
|
90 |
|
91 public: // from base class MVPbkExpandable |
|
92 MVPbkContactViewBase* ExpandLC( |
|
93 MVPbkContactViewObserver& aObserver, |
|
94 const MVPbkFieldTypeList& aSortOrder) const; |
|
95 |
|
96 private: // Implementation |
|
97 CVPbkFoldingContactView( |
|
98 const CVPbkContactManager& aContactManager); |
|
99 void ConstructL( |
|
100 const CVPbkContactViewDefinition& aViewDefinition, |
|
101 const MVPbkFieldTypeList& aSortOrder); |
|
102 void DoAddObserverL(MVPbkContactViewObserver& aObserver); |
|
103 void AddObserverError(MVPbkContactViewObserver& aObserver, TInt aError); |
|
104 void SendAsyncUnavailableAndReadyEventL(); |
|
105 void DoSignalObserversViewReady(MVPbkContactViewObserver& aObserver); |
|
106 void DoSignalObserversViewUnavailable(MVPbkContactViewObserver& aObserver); |
|
107 void DoSignalObserversViewError(MVPbkContactViewObserver& aObserver, |
|
108 TInt aError); |
|
109 |
|
110 private: // Data |
|
111 /// Ref: the contact manager |
|
112 const CVPbkContactManager& iContactManager; |
|
113 /// Own: the view definition of this view. |
|
114 CVPbkContactViewDefinition* iViewDefinition; |
|
115 /// Own: The one and only view contact |
|
116 CVPbkFoldingViewContact* iFoldingContact; |
|
117 /// Own: the sort order. |
|
118 MVPbkFieldTypeList* iSortOrder; |
|
119 /// Ref: observers of the view |
|
120 RPointerArray<MVPbkContactViewObserver> iObservers; |
|
121 /// Own: an async operation for compliting async functions |
|
122 /// in VPbk interface |
|
123 VPbkEngUtils::CVPbkAsyncOperation iAsyncOperation; |
|
124 }; |
|
125 |
|
126 #endif // CVPBKFOLDINGCONTACTVIEW_H |
|
127 //End of file |
|
128 |
|
129 |