|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <AddressBookView.h>
Public Member Functions | |
| void | ConstructL (const TRect &aRect) |
| CAddressBookView (CAddressBookEngine &aEngine) | |
| ~CAddressBookView () | |
| void | UpdateL (RPointerArray< CAddressBookContact > &aContactArray) |
| void | OpenItemL () |
| void | CloseItem () |
| void | ChangeCbaL (TInt aResourceId, TDrawNow aDrawNow) |
| void | ShowAbout (TBool aAboutVisible=ETrue) |
| CAddressBookContact * | CurrentContact () |
| void | AppendRowL (TPtrC8 aValue, const TDesC8 &aFieldName, CDesCArray &aArray) |
| void | HandleListBoxEventL (CEikListBox *, TListBoxEvent aEventType) |
Private Member Functions | |
| void | SizeChanged () |
| TInt | CountComponentControls () const |
| CCoeControl * | ComponentControl (TInt aIndex) const |
| void | Draw (const TRect &aRect) const |
| void | HandleControlEventL (CCoeControl *aControl, TCoeEvent aEventType) |
| virtual TKeyResponse | OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
Private Attributes | |
| CAddressBookEngine & | iEngine |
| TBool | iDetailedView |
| CEikColumnListBox * | iSearchList |
| CEikTextListBox * | iDetailList |
| CDesCArray * | iItemList |
| const CFont * | iFont |
Definition at line 66 of file AddressBookView.h.
|
|
C++ default constructor. Definition at line 41 of file AddressBookView.cpp. 00042 : 00043 iEngine(aEngine), 00044 iDetailedView(EFalse), 00045 iSearchList(NULL), 00046 iDetailList(NULL) 00047 { 00048 }
|
|
|
Destructor. Definition at line 55 of file AddressBookView.cpp. References iDetailList, iItemList, and iSearchList. 00056 { 00057 delete iSearchList; 00058 if (iItemList) 00059 iItemList->Reset(); 00060 00061 delete iItemList; 00062 delete iDetailList; 00063 }
|
|
|
By default Symbian 2nd phase constructor is private.
Definition at line 70 of file AddressBookView.cpp. References iDetailList, iFont, iItemList, and iSearchList. 00071 { 00072 CreateWindowL(); 00073 00074 iFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont); 00075 00076 iSearchList = new (ELeave) CAknSingleStyleListBox(); 00077 iSearchList->ConstructL(this); 00078 iSearchList->SetContainerWindowL(*this); 00079 iSearchList->CreateScrollBarFrameL(ETrue); 00080 iSearchList->ScrollBarFrame()->SetScrollBarVisibilityL( 00081 CEikScrollBarFrame::EOn, 00082 CEikScrollBarFrame::EAuto); 00083 00084 iItemList = new (ELeave) CDesCArrayFlat(3); 00085 iSearchList->Model()->SetItemTextArray(iItemList); 00086 iSearchList->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); 00087 00088 iDetailList = new (ELeave) CAknFormDoubleStyleListBox; 00089 iDetailList->ConstructL(this); 00090 iDetailList->SetContainerWindowL(*this); 00091 iDetailList->CreateScrollBarFrameL(ETrue); 00092 iDetailList->ScrollBarFrame()->SetScrollBarVisibilityL( 00093 CEikScrollBarFrame::EOn, 00094 CEikScrollBarFrame::EAuto); 00095 iDetailList->Model()->SetOwnershipType(ELbmOwnsItemArray); 00096 iDetailList->MakeVisible(EFalse); 00097 iSearchList->MakeVisible(ETrue); // show "no results" at startup 00098 iSearchList->SetListBoxObserver(this); 00099 SetRect(aRect); 00100 ActivateL(); 00101 MakeVisible(ETrue); 00102 }
|
|
|
Updates bufer containing the contact information when search was finished
Definition at line 126 of file AddressBookView.cpp. References iItemList, iSearchList, and CAddressBookContact::MobilePhoneL(). 00127 { 00128 iItemList->Reset(); 00129 iSearchList->MakeVisible(ETrue); 00130 TInt count = aContactArray.Count(); 00131 if(count > 0) 00132 { 00133 for( TInt i = 0; i < count; ++i ) 00134 { 00135 CAddressBookContact* item = aContactArray[i]; 00136 00137 HBufC8* pRow = HBufC8::NewLC(128); 00138 TPtr8 ptrRow = pRow->Des(); 00139 if (item->MobilePhoneL() != KNullDesC8) 00140 { 00141 ptrRow.Append(KHasPhoneChar); 00142 } 00143 ptrRow.Append(KTab); 00144 ptrRow.Append(item->LastName()); 00145 ptrRow.Append(KSpace); 00146 ptrRow.Append(item->FirstName()); 00147 ptrRow.Append(KTab); 00148 ptrRow.Append(KTab); 00149 00150 HBufC* pRowAsUnicode = SenXmlUtils::ToUnicodeLC(ptrRow); 00151 if(pRowAsUnicode) 00152 { 00153 iItemList->AppendL(*pRowAsUnicode); 00154 } 00155 CleanupStack::PopAndDestroy(pRowAsUnicode); 00156 CleanupStack::PopAndDestroy(pRow); 00157 } 00158 00159 iSearchList->HandleItemAdditionL(); 00160 iSearchList->SetFocus(ETrue, EDrawNow); 00161 iSearchList->SetCurrentItemIndexAndDraw(0); 00162 } 00163 else 00164 { 00165 iSearchList->HandleItemRemovalL(); 00166 } 00167 }
|
|
|
is needed to browse Contact information Definition at line 249 of file AddressBookView.cpp. References AppendRowL(), CAddressBookContact::Country(), CAddressBookContact::Email(), CAddressBookContact::ExtraAddress(), CAddressBookContact::FaxL(), CAddressBookContact::FirstName(), CAddressBookEngine::GetContact(), iDetailedView, iEngine, iSearchList, CAddressBookContact::LastName(), CAddressBookContact::Locality(), CAddressBookContact::MiddleName(), CAddressBookContact::MobilePhoneL(), CAddressBookContact::Organization(), CAddressBookContact::PhoneL(), CAddressBookContact::PostCode(), CAddressBookContact::Region(), SizeChanged(), CAddressBookContact::Street(), CAddressBookContact::Title(), and CAddressBookContact::Unit(). 00250 { 00251 if (iDetailedView) 00252 return; 00253 00254 CAddressBookContact* item = NULL; 00255 TInt success = iEngine.GetContact(iSearchList->CurrentItemIndex(), item); 00256 if (success == KErrNotFound) 00257 return; 00258 iSearchList->MakeVisible(EFalse); 00259 CDesCArray* array = new (ELeave) CDesCArrayFlat(3); 00260 00261 AppendRowL(item->LastName(), KLastname, *array); 00262 AppendRowL(item->FirstName(), KFirstname,*array); 00263 AppendRowL(item->MiddleName(), KMiddlename, *array); 00264 AppendRowL(item->ExtraAddress(), KExtAddr, *array); 00265 AppendRowL(item->Street(), KStreet, *array); 00266 AppendRowL(item->Locality(), KLocality, *array); 00267 AppendRowL(item->Region(), KRegion, *array); 00268 AppendRowL(item->PostCode(), KPCode, *array); 00269 AppendRowL(item->Country(), KCountry, *array); 00270 AppendRowL(item->PhoneL(), KPhone, *array); 00271 AppendRowL(item->MobilePhoneL(), KMobile, *array); 00272 AppendRowL(item->FaxL(), KFax, *array); 00273 AppendRowL(item->Email(), KEmail, *array); 00274 AppendRowL(item->Title(), KTitle, *array); 00275 AppendRowL(item->Organization(), KOrganization, *array); 00276 AppendRowL(item->Unit(), KUnit, *array); 00277 00278 iDetailedView = ETrue; 00279 iDetailList->Model()->SetItemTextArray(array); 00280 iDetailList->MakeVisible(ETrue); 00281 iDetailList->SetCurrentItemIndexAndDraw(0); 00282 SizeChanged(); 00283 iDetailList->ActivateL(); 00284 }
|
|
|
It is called when Contact information was browsed and needed to be closed Definition at line 237 of file AddressBookView.cpp. References iDetailedView, and iSearchList. 00238 { 00239 iDetailedView = EFalse; 00240 iSearchList->MakeVisible(ETrue); 00241 iDetailList->MakeVisible(EFalse); 00242 DrawDeferred(); 00243 }
|
|
||||||||||||
|
It is called when need to open or close some item to change common button area
Definition at line 319 of file AddressBookView.cpp. 00320 { 00321 CEikButtonGroupContainer* Cba = CEikButtonGroupContainer::Current(); 00322 if(Cba) 00323 { 00324 Cba->SetCommandSetL(aResourceId); 00325 00326 if(aDrawNow) 00327 Cba->DrawNow(); 00328 else 00329 Cba->DrawDeferred(); 00330 } 00331 }
|
|
|
Shows information about Address Book aplication.
Definition at line 338 of file AddressBookView.cpp. References iSearchList. 00339 { 00340 iSearchList->MakeVisible(!aAboutVisible); 00341 iDetailList->MakeVisible(EFalse); 00342 DrawDeferred(); 00343 }
|
|
|
Is needed to add current contact into PnoneBook database.
Definition at line 350 of file AddressBookView.cpp. References CAddressBookEngine::GetContact(), iEngine, and iSearchList. 00351 { 00352 CAddressBookContact* pContact = NULL; 00353 iEngine.GetContact(iSearchList->CurrentItemIndex(), 00354 pContact // pContact remains NULL if not found 00355 ); 00356 return pContact; 00357 }
|
|
||||||||||||||||
|
Creates card (full contact information) about a person who was found
Definition at line 365 of file AddressBookView.cpp. 00367 { 00368 if (aValue != KNullDesC8) 00369 { 00370 TBuf8<64> row; 00371 HBufC* pRowAsUnicode = NULL; 00372 row.Format(KRowFormat, &aFieldName, &aValue); 00373 pRowAsUnicode = SenXmlUtils::ToUnicodeLC(row); 00374 if(pRowAsUnicode) 00375 { 00376 aArray.AppendL(*pRowAsUnicode); 00377 CleanupStack::PopAndDestroy(pRowAsUnicode); 00378 } 00379 } 00380 }
|
|
||||||||||||
|
From MEikListBoxObserver, is called when user want to browse the card (full contact information) about employees who was found
Definition at line 304 of file AddressBookView.cpp. References ChangeCbaL(), and OpenItemL(). 00305 { 00306 if (aEventType == EEventEnterKeyPressed) 00307 { 00308 OpenItemL(); 00309 ChangeCbaL(R_AVKON_SOFTKEYS_OPTIONS_BACK, EDrawNow); 00310 } 00311 }
|
|
|
From CCoeControl, is called by framework when the view size is changed Definition at line 109 of file AddressBookView.cpp. References iDetailList, and iSearchList. 00110 { 00111 if (iSearchList) 00112 { 00113 iSearchList->SetExtent( TPoint(0,0), iSearchList->MinimumSize() ); 00114 } 00115 if (iDetailList) 00116 { 00117 iDetailList->SetExtent( TPoint(0,0), iDetailList->MinimumSize() ); 00118 } 00119 }
|
|
|
From CCoeControl, is called by the active scheduler to controll count of components
Definition at line 174 of file AddressBookView.cpp.
|
|
|
From CCoeControl, is called by the active scheduler to controll components
Definition at line 184 of file AddressBookView.cpp. References iDetailedView, and iSearchList. 00185 { 00186 switch ( aIndex ) 00187 { 00188 case 0: 00189 if (iDetailedView) 00190 return iDetailList; 00191 else 00192 { 00193 return iSearchList; 00194 } 00195 default: 00196 return NULL; 00197 } 00198 }
|
|
|
From CCoeControl, draws rects
Definition at line 204 of file AddressBookView.cpp. References iFont. 00205 { 00206 CWindowGc& gc = SystemGc(); 00207 00208 gc.SetPenStyle( CGraphicsContext::ENullPen ); 00209 gc.SetBrushColor( KRgbWhite ); 00210 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); 00211 gc.DrawRect( aRect ); 00212 00213 gc.UseFont(iFont); 00214 TInt lineHeight = iFont->HeightInPixels()+1; 00215 00216 const TInt col = 5; 00217 gc.DrawText(KAboutString1, TPoint(col, lineHeight)); 00218 gc.DrawText(KAboutString2, TPoint(col, lineHeight*2)); 00219 gc.DrawText(KAboutString3, TPoint(col, lineHeight*3)); 00220 gc.DrawText(KAboutString4, TPoint(col, lineHeight*4)); 00221 gc.DrawText(KAboutString5, TPoint(col, lineHeight*5)); 00222 }
|
|
||||||||||||
|
From MCoeControlObserver, acts upon changes in the hosted control's state.
Definition at line 228 of file AddressBookView.cpp.
|
|
||||||||||||
|
From CCoeControl the key event handler function, is called every time when user presses some button.
Definition at line 292 of file AddressBookView.cpp. References ComponentControl(). 00294 { 00295 return ComponentControl(0)->OfferKeyEventL(aKeyEvent,aType); 00296 }
|
|
© Nokia 2006 |