|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : AddressBookView.h 00004 * Part of : AddressBook 00005 * Interface : 00006 * Description : Application View class, CAddressBookView - 00007 * shows the application state on the screen 00008 * Version : 00009 * 00010 * Copyright (c) 2002-2006 Nokia Corporation. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia Corporation. 00014 * ============================================================================== 00015 */ 00016 00017 #ifndef ADDRESSBOOKVIEW_H 00018 #define ADDRESSBOOKVIEW_H 00019 00020 // INCLUDES 00021 #include <coecntrl.h> 00022 #include <aknlists.h> 00023 00024 // CONSTANTS 00025 _LIT(KMultiImagePathName, "\\recource\\apps\\ADDRESSBOOK.MBM"); 00026 00027 // AddressBook item ("vCard") constants: 00028 _LIT8(KLastname, "Family Name:"); 00029 _LIT8(KFirstname, "Given Name:"); 00030 _LIT8(KMiddlename, "Middle Name:"); 00031 _LIT8(KExtAddr, "Extra address:"); 00032 _LIT8(KStreet, "Street:"); 00033 _LIT8(KLocality, "Locality:"); 00034 _LIT8(KRegion, "Region:"); 00035 _LIT8(KPCode, "Post code:"); 00036 _LIT8(KCountry, "Country:"); 00037 _LIT8(KMobile, "Mobile:"); 00038 _LIT8(KFax, "Fax:"); 00039 _LIT8(KPhone, "Phone:"); 00040 _LIT8(KEmail, "Email:"); 00041 _LIT8(KTitle, "Title:"); 00042 _LIT8(KOrganization, "Organization:"); 00043 _LIT8(KUnit, "Unit:"); 00044 00045 _LIT8(KRowFormat, "\t%S\t%S\t"); 00046 00047 _LIT8(KTab,"\t"); 00048 _LIT8(KSpace," "); 00049 _LIT8(KHasPhoneChar,"X"); 00050 00051 _LIT(KAboutString1, "Liberty Enabled Address Book."); 00052 _LIT(KAboutString2, "Web Service Demo Client"); 00053 _LIT(KAboutString3, "by Nokia."); 00054 _LIT(KAboutString4, "Server functionality powered"); 00055 _LIT(KAboutString5, "by Trustgenix."); 00056 00057 // FORWARD DECLARATIONS 00058 class CAddressBookContact; 00059 class CAddressBookEngine; 00060 00061 // CLASS DECLARATION 00062 /** 00063 * CAddressBookView container control class, 00064 * shows the application state on the screen 00065 */ 00066 class CAddressBookView : public CCoeControl, MCoeControlObserver, MEikListBoxObserver 00067 { 00068 public: // Constructors and destructor 00069 00070 /** 00071 * By default Symbian 2nd phase constructor is private. 00072 * @param aRect Frame rectangle for container. 00073 */ 00074 void ConstructL(const TRect& aRect); 00075 00076 /** 00077 * C++ default constructor. 00078 */ 00079 CAddressBookView(CAddressBookEngine& aEngine); 00080 00081 /** 00082 * Destructor. 00083 */ 00084 ~CAddressBookView(); 00085 00086 // New functions 00087 00088 /** 00089 * Updates bufer containing the contact information when search was finished 00090 * @param aContactArray - descriptor on the array connecting finding information 00091 */ 00092 void UpdateL(RPointerArray<CAddressBookContact>& aContactArray); 00093 00094 /** 00095 * is needed to browse Contact information 00096 */ 00097 void OpenItemL(); 00098 00099 /** 00100 * It is called when Contact information was browsed and needed to be closed 00101 */ 00102 void CloseItem(); 00103 00104 /** 00105 * It is called when need to open or close some item to change common button area 00106 * @param aResourceId - Id of Resource 00107 * @param aDrawNow - ENoDrawNow - Redraw of the control is not required immediately. 00108 EDrawNow - Redraw control immediately. 00109 */ 00110 void ChangeCbaL(TInt aResourceId, TDrawNow aDrawNow); 00111 00112 /** 00113 * Shows information about Address Book aplication. 00114 * @param aAboutVisible - ETrue in case that to show information on the screen 00115 */ 00116 void ShowAbout(TBool aAboutVisible = ETrue); 00117 00118 /** 00119 * Is needed to add current contact into PnoneBook database. 00120 * @return descriptor on current contact 00121 */ 00122 CAddressBookContact* CurrentContact(); 00123 00124 /** 00125 * Creates card (full contact information) about a person who was found 00126 * @param aValue - value of field that is needed to locate in the aArray 00127 * @param aFieldName - name of field whose value contains in aValue 00128 * @param aArray - pointer on the array where will be located this card 00129 */ 00130 void AppendRowL(TPtrC8 aValue, const TDesC8& aFieldName, CDesCArray& aArray); 00131 00132 // Functions from base classes 00133 00134 /** 00135 * From MEikListBoxObserver, is called when user want to browse 00136 * the card (full contact information) about employees who was found 00137 * @param aEventType - type of event 00138 */ 00139 void HandleListBoxEventL(CEikListBox*, TListBoxEvent aEventType); 00140 00141 private: 00142 00143 /** 00144 * From CCoeControl, is called by framework when the view size is changed 00145 */ 00146 void SizeChanged(); 00147 00148 /** 00149 * From CCoeControl, is called by the active scheduler to controll count of components 00150 * @return 1 00151 */ 00152 TInt CountComponentControls() const; 00153 00154 /** 00155 * From CCoeControl, is called by the active scheduler to controll components 00156 * @param aIndex 00157 * @return - iDetailList/iSearchList(if aIndex == 0)/NULL (if aInex != 0) 00158 */ 00159 CCoeControl* ComponentControl(TInt aIndex) const; 00160 00161 /** 00162 * From CCoeControl, draws rects 00163 * @param aRect - pointer on rectangle that has to be drawn 00164 */ 00165 void Draw(const TRect& aRect) const; 00166 00167 /** 00168 * From MCoeControlObserver, acts upon changes in the hosted control's state. 00169 * @param aControl - The control changing its state 00170 * @param aEventType - The type of control event 00171 */ 00172 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00173 00174 /** 00175 * From CCoeControl the key event handler function, is called every time 00176 * when user presses some button. 00177 * @param aKeyEvent - Event to handled. 00178 * @param aType - Type of the key event. 00179 * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 00180 */ 00181 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); 00182 00183 private: // Data 00184 00185 CAddressBookEngine& iEngine; 00186 TBool iDetailedView; 00187 CEikColumnListBox* iSearchList; 00188 CEikTextListBox* iDetailList; 00189 CDesCArray* iItemList; 00190 const CFont* iFont; 00191 }; 00192 00193 #endif // ADDRESSBOOKVIEW_H 00194 00195 // End of File 00196
|
© Nokia 2006 |