|
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 contact info data swapper utility class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32base.h> |
|
21 #include <bamdesca.h> |
|
22 |
|
23 // FORWARD DECLARATIONS |
|
24 class CEikTextListBox; |
|
25 class CPbk2PresentationContactFieldCollection; |
|
26 class CPbk2ThumbnailLoader; |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * Phonebook 2 contact info data swapper utility class. |
|
32 * Responsible for holding data for a short period of time so that |
|
33 * contact info can change the contact to show safely and rollback |
|
34 * if an error occurs. |
|
35 */ |
|
36 NONSHARABLE_CLASS(CPbk2ContactInfoDataSwapper) : public CBase |
|
37 { |
|
38 public: // Construction and destruction |
|
39 |
|
40 /** |
|
41 * Constructor. |
|
42 */ |
|
43 CPbk2ContactInfoDataSwapper(); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 ~CPbk2ContactInfoDataSwapper(); |
|
49 |
|
50 public: // Interface |
|
51 |
|
52 /** |
|
53 * Saves data into this object which restores list box's state |
|
54 * (model, top and current item index) in this objects destructor. |
|
55 */ |
|
56 void StoreListBoxState(CEikTextListBox& aListBox); |
|
57 |
|
58 /** |
|
59 * Resets any data set with StoreListBoxState(). |
|
60 */ |
|
61 void ResetListBoxState(); |
|
62 |
|
63 /** |
|
64 * Swaps objects. |
|
65 * |
|
66 * @param aObj1 First object to swap. |
|
67 * @param aObj2 Second object to swap. |
|
68 */ |
|
69 template<class Type> |
|
70 inline void Swap( Type& aObj1, Type& aObj2 ) |
|
71 { |
|
72 Type tmp = aObj1; |
|
73 aObj1 = aObj2; |
|
74 aObj2 = tmp; |
|
75 } |
|
76 |
|
77 public: // Data |
|
78 /// Ref: Field collection |
|
79 const CPbk2PresentationContactFieldCollection* iFieldCollection; |
|
80 /// Own: List box model |
|
81 MDesCArray* iListBoxModel; |
|
82 /// Ref: List box |
|
83 CEikTextListBox* iListBox; |
|
84 /// Ref: List box's item array |
|
85 MDesCArray* iItemTextArray; |
|
86 /// Own: Top item index to restore |
|
87 TInt iTopItemIndex; |
|
88 /// Own: Current item index to restore |
|
89 TInt iCurrentItemIndex; |
|
90 /// Own: Title pane text |
|
91 HBufC* iTitlePaneText; |
|
92 /// Own: Thumbnail loader |
|
93 CPbk2ThumbnailLoader* iThumbnailLoader; |
|
94 }; |
|
95 |
|
96 // End of File |