|
Nokia N97 SDK 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 * @return aAboutVisible 00116 */ 00117 bool ShowAbout(TBool aAboutVisible = ETrue); 00118 00119 /** 00120 * Is needed to add current contact into PnoneBook database. 00121 * @return descriptor on current contact 00122 */ 00123 CAddressBookContact* CurrentContact(); 00124 00125 /** 00126 * Creates card (full contact information) about a person who was found 00127 * @param aValue - value of field that is needed to locate in the aArray 00128 * @param aFieldName - name of field whose value contains in aValue 00129 * @param aArray - pointer on the array where will be located this card 00130 */ 00131 void AppendRowL(TPtrC8 aValue, const TDesC8& aFieldName, CDesCArray& aArray); 00132 00133 // Functions from base classes 00134 00135 /** 00136 * From MEikListBoxObserver, is called when user want to browse 00137 * the card (full contact information) about employees who was found 00138 * @param aEventType - type of event 00139 */ 00140 void HandleListBoxEventL(CEikListBox*, TListBoxEvent aEventType); 00141 00142 private: 00143 00144 /** 00145 * From CCoeControl, is called by framework when the view size is changed 00146 */ 00147 void SizeChanged(); 00148 00149 /** 00150 * From CCoeControl, is called by the active scheduler to controll count of components 00151 * @return 1 00152 */ 00153 TInt CountComponentControls() const; 00154 00155 /** 00156 * From CCoeControl, is called by the active scheduler to controll components 00157 * @param aIndex 00158 * @return - iDetailList/iSearchList(if aIndex == 0)/NULL (if aInex != 0) 00159 */ 00160 CCoeControl* ComponentControl(TInt aIndex) const; 00161 00162 /** 00163 * From CCoeControl, draws rects 00164 * @param aRect - pointer on rectangle that has to be drawn 00165 */ 00166 void Draw(const TRect& aRect) const; 00167 00168 /** 00169 * From MCoeControlObserver, acts upon changes in the hosted control's state. 00170 * @param aControl - The control changing its state 00171 * @param aEventType - The type of control event 00172 */ 00173 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00174 00175 /** 00176 * From CCoeControl the key event handler function, is called every time 00177 * when user presses some button. 00178 * @param aKeyEvent - Event to handled. 00179 * @param aType - Type of the key event. 00180 * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 00181 */ 00182 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); 00183 00184 private: // Data 00185 00186 CAddressBookEngine& iEngine; 00187 TBool iDetailedView; 00188 CEikColumnListBox* iSearchList; 00189 CEikTextListBox* iDetailList; 00190 CDesCArray* iItemList; 00191 const CFont* iFont; 00192 }; 00193 00194 #endif // ADDRESSBOOKVIEW_H 00195 00196 // End of File 00197
|
© Nokia 2009 |