|
1 /* |
|
2 * Copyright (c) 2002-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: Own number listbox model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPSU2OWNNUMBERLISTBOXMODEL_H |
|
21 #define CPSU2OWNNUMBERLISTBOXMODEL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <MVPbkContactObserver.h> |
|
26 #include <MVPbkContactViewObserver.h> |
|
27 #include <badesca.h> // Array |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MVPbkContactViewBase; |
|
31 class MPbk2ContactNameFormatter; |
|
32 class MVPbkViewContact; |
|
33 class CCoeControl; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * Own number listbox model. |
|
39 * |
|
40 * @lib Pbk2USimUI.dll |
|
41 */ |
|
42 class CPsu2OwnNumberListBoxModel : |
|
43 public CActive, |
|
44 public MDesCArray, |
|
45 private MVPbkContactObserver, |
|
46 private MVPbkContactViewObserver |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 /** |
|
50 * @param aView the view from the extension framework |
|
51 * @param aContainer Window is owned here |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 static CPsu2OwnNumberListBoxModel* NewL( MVPbkContactViewBase& aView, |
|
55 CCoeControl& aObserver ); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CPsu2OwnNumberListBoxModel(); |
|
61 |
|
62 private: // From CActive |
|
63 void RunL(); |
|
64 void DoCancel(); |
|
65 TInt RunError( |
|
66 TInt aError); |
|
67 |
|
68 private: // from MDesCArray |
|
69 TInt MdcaCount() const; |
|
70 TPtrC16 MdcaPoint(TInt aIndex) const; |
|
71 |
|
72 private: // from MVPbkContactObserver |
|
73 void ContactOperationCompleted(TContactOpResult aResult); |
|
74 void ContactOperationFailed( |
|
75 TContactOp aOpCode, TInt aErrorCode, TBool aErrorNotified); |
|
76 |
|
77 private: // From MVPbkContactViewObserver |
|
78 void ContactViewReady( |
|
79 MVPbkContactViewBase& aView ); |
|
80 void ContactViewUnavailable( |
|
81 MVPbkContactViewBase& aView ); |
|
82 void ContactAddedToView( |
|
83 MVPbkContactViewBase& aView, |
|
84 TInt aIndex, |
|
85 const MVPbkContactLink& aContactLink ); |
|
86 void ContactRemovedFromView( |
|
87 MVPbkContactViewBase& aView, |
|
88 TInt aIndex, |
|
89 const MVPbkContactLink& aContactLink ); |
|
90 void ContactViewError( |
|
91 MVPbkContactViewBase& aView, |
|
92 TInt aError, |
|
93 TBool aErrorNotified ); |
|
94 |
|
95 private: // New functions |
|
96 |
|
97 /** |
|
98 * Formats given contact information to listbox string and |
|
99 * puts it in array. |
|
100 * @param aContact Own number contact |
|
101 */ |
|
102 void AddToArrayL( MVPbkStoreContact* aContact ); |
|
103 |
|
104 /** |
|
105 * Starts async contact reading |
|
106 */ |
|
107 void ReadContactsL(); |
|
108 |
|
109 /** |
|
110 * Refresh contacts. Async operation |
|
111 */ |
|
112 void RefreshL(); |
|
113 |
|
114 private: // implementation |
|
115 CPsu2OwnNumberListBoxModel( MVPbkContactViewBase& aView, |
|
116 CCoeControl& aObserver ); |
|
117 void ConstructL(); |
|
118 void IssueRequest(); |
|
119 |
|
120 private: // Data |
|
121 /// Ref: View which contains the own number 'contacts' |
|
122 MVPbkContactViewBase& iView; |
|
123 /// Own: Stores formatted strings for listbox |
|
124 CDesCArraySeg* iArray; |
|
125 /// Own: Currently loading contact index |
|
126 TInt iCurrentContact; |
|
127 /// Ref: This is called after 'contacts' are loaded |
|
128 CCoeControl& iObserver; |
|
129 }; |
|
130 |
|
131 #endif // CPSU2OWNNUMBERLISTBOXMODEL_H |
|
132 |
|
133 // End of File |