|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <LandmarksLmCategoriesModel.h>
Public Member Functions | |
| ~CLandmarksLmCategoriesModel () | |
| void | SelectCategoriesL (CArrayFixFlat< TInt > &aSelectedIndexes) |
| CDesCArray * | FormattedCategoryNamesL () |
| CArrayFixFlat< TInt > * | SelectedCategoriesL () |
Static Public Member Functions | |
| static CLandmarksLmCategoriesModel * | NewL (CLandmarksApplicationEngine &aEngine, RArray< TPosLmItemId > &aMarkedCategories) |
Private Member Functions | |
| CLandmarksLmCategoriesModel (RArray< TPosLmItemId > &aMarkedCategories) | |
| void | ConstructL (CLandmarksApplicationEngine &aEngine) |
Private Attributes | |
| CArrayPtr< CPosLandmarkCategory > * | iCategories |
| contains all existing categories | |
| RArray< TPosLmItemId > & | iMarkedCategoryIds |
| CDesCArrayFlat * | iListItems |
Definition at line 34 of file LandmarksLmCategoriesModel.h.
|
|
Destructor. Definition at line 74 of file LandmarksLmCategoriesModel.cpp. References iCategories. 00075 { 00076 if (iCategories) 00077 { 00078 iCategories->ResetAndDestroy(); 00079 delete iCategories; 00080 } 00081 }
|
|
|
C++ constructor.
Definition at line 40 of file LandmarksLmCategoriesModel.cpp. 00042 : iMarkedCategoryIds(aMarkedCategories) 00043 { 00044 }
|
|
||||||||||||
|
Two-phased constructor.
Definition at line 61 of file LandmarksLmCategoriesModel.cpp. References CLandmarksLmCategoriesModel(). 00064 { 00065 CLandmarksLmCategoriesModel* self = new (ELeave) 00066 CLandmarksLmCategoriesModel(aMarkedCategories); 00067 CleanupStack::PushL(self); 00068 self->ConstructL(aEngine); 00069 CleanupStack::Pop(self); 00070 return self; 00071 }
|
|
|
Stores ids of selected categories.
Definition at line 89 of file LandmarksLmCategoriesModel.cpp. References iMarkedCategoryIds, and LandmarksUtils::Panic(). 00091 { 00092 // clear current list of selected categories 00093 iMarkedCategoryIds.Reset(); 00094 00095 for (TInt i = 0; i < aSelectedIndexes.Count(); i++) 00096 { 00097 TInt categoryIndex = aSelectedIndexes[i]; 00098 00099 // Fetch the id of the selected item. 00100 __ASSERT_ALWAYS((categoryIndex >= 0) && (categoryIndex < iCategories->Count()), 00101 LandmarksUtils::Panic(KErrGeneral)); 00102 TPosLmItemId selectedCategoryId = (*iCategories)[categoryIndex]->CategoryId(); 00103 00104 User::LeaveIfError(iMarkedCategoryIds.Append(selectedCategoryId)); 00105 } 00106 }
|
|
|
Returns a descriptor array of formatted list items.
Definition at line 140 of file LandmarksLmCategoriesModel.cpp. References iCategories, and iListItems. 00141 { 00142 // Granularity is set to be 8. 00143 CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat(KGranularity); 00144 CleanupStack::PushL(listItems); 00145 00146 for (TInt i = 0; i < iCategories->Count(); i++) 00147 { 00148 // Create buffer that will contain the name and mark status. 3 extra 00149 // chars for tab and icon index. 00150 const TInt KExtraChars = 3; 00151 TPtrC categoryName; 00152 User::LeaveIfError((*iCategories)[i]->GetCategoryName(categoryName)); 00153 HBufC* formattedCategoryName = HBufC::NewLC(categoryName.Length() + KExtraChars); 00154 00155 // format string with category 00156 formattedCategoryName->Des().Format(KItemFormat, &categoryName); 00157 00158 listItems->AppendL(*formattedCategoryName); 00159 CleanupStack::PopAndDestroy(formattedCategoryName); 00160 } 00161 00162 CleanupStack::Pop(listItems); 00163 00164 iListItems = listItems; 00165 return iListItems; 00166 }
|
|
|
Returns array of indices of selected categories.
Definition at line 114 of file LandmarksLmCategoriesModel.cpp. References iMarkedCategoryIds. 00115 { 00116 CArrayFixFlat<TInt>* selectedItems = new (ELeave) CArrayFixFlat<TInt>(KGranularity); 00117 CleanupStack::PushL(selectedItems); 00118 00119 for (TInt i = 0; i < iCategories->Count(); i++) 00120 { 00121 TPosLmItemId categoryId = (*iCategories)[i]->CategoryId(); 00122 00123 TInt index = iMarkedCategoryIds.Find(categoryId); 00124 if (KErrNotFound != index) 00125 { 00126 selectedItems->AppendL(i); 00127 } 00128 } 00129 00130 CleanupStack::Pop(selectedItems); 00131 return selectedItems; 00132 }
|
|
|
By default Symbian 2nd phase constructor is private.
Definition at line 51 of file LandmarksLmCategoriesModel.cpp. References CLandmarksApplicationEngine::CategoriesL(), and iCategories. 00052 { 00053 iCategories = aEngine.CategoriesL(); 00054 }
|
|
|
contains Ids for those categories that are selected for the edited landmark. Definition at line 100 of file LandmarksLmCategoriesModel.h. |
|
|
An array of formatted category names suitable for a two-column listbox. Definition at line 104 of file LandmarksLmCategoriesModel.h. |
|
© Nokia 2006 |