Nokia N97 SDK
Example Applications Guide

ccontcontainer.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : ccontcontainer.h
00004 *  Part of     : Contacts database example
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2004 - 2006 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 #ifndef __CCONTCONTAINER_H__
00017 #define __CCONTCONTAINER_H__
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021 #include <eiklbx.h>
00022 #include <aknsfld.h>
00023 #include <aknutils.h>
00024 #include <aknlists.h>
00025 #include <cntdb.h>
00026 #include <badesca.h>
00027 #include <eiktxlbm.h>
00028 
00029 // CONSTANTS
00030 
00031 #include "ContactsConstants.h"
00032 
00033 // CLASS DECLARATION
00034 
00035 /**
00036 *  CContContainer container control class.
00037 *
00038 */
00039 class CContContainer : public CCoeControl,
00040                               MCoeControlObserver,
00041                               MEikListBoxObserver
00042     {
00043 
00044     public: // Constructors and destructor
00045 
00046         /**
00047         * Default constructor
00048         */
00049         void ConstructL( const TRect& aRect );
00050 
00051         /**
00052         * Destructor.
00053         * Destructor is always virtual
00054         */
00055         virtual ~CContContainer();
00056 
00057         /**
00058         * Constructor
00059         */
00060         CContContainer();
00061 
00062     public: // New functions
00063 
00064         /**
00065         * AddNewContactDlgL
00066         * The method adds new contact
00067         */
00068         void AddNewContactDlgL();
00069 
00070         /**
00071         * EditContactDlgL
00072         * The method edits contact
00073         */
00074         void EditContactDlgL();
00075 
00076         /**
00077         * DeleteContactDlgL
00078         * The method deletes contact
00079         */
00080         void DeleteContactDlgL();
00081 
00082         /**
00083         * AddContactToGrpL
00084         * The method adds contact to selected contact group
00085         */
00086         void AddContactToGrpL();
00087 
00088         /**
00089         * GetSelectedContactL
00090         * The method stores selected contact and open group
00091         * list to the listbox
00092         */
00093         void GetSelectedContactL();
00094 
00095         /**
00096         * CreateContactTemplateL
00097         * The method creates new contact template
00098         */
00099         void CreateContactTemplateL();
00100 
00101         /**
00102         * CreateContactGroupL
00103         * The method Creates new contact group
00104         */
00105         void CreateContactGroupL();
00106 
00107         /**
00108         * DeleteContactGroupL
00109         * The method deletes contact group
00110         */
00111         void DeleteContactGroupL();
00112 
00113         /**
00114         * ShowContactsL
00115         * The method shows contacts in the listbox
00116         */
00117         void ShowContactsL();
00118 
00119         /**
00120         * ShowContactGroupsL
00121         * The method shows contact groups in the listbox
00122         */
00123         void ShowContactGroupsL();
00124 
00125         /**
00126         * IsContactsOnListBox
00127         * The method returns true if contacs are in the listbox
00128         * @return status of listbox
00129         */
00130         TBool IsContactsOnListBox();
00131 
00132         /**
00133         * IfContactDbSelected
00134         * The method returns true if contacs are opened.
00135         * @return status of contact database attribute
00136         */
00137         TBool IfContactDbSelected();
00138 
00139         /**
00140         * CanAddContactToGroupL
00141         * The method returns ETrue is contact database
00142         * has been opened and contains at least one contact item
00143         * @return status of contact group
00144         */
00145         TBool CanAddContactToGroupL();
00146 
00147         /**
00148         * OpenDefaultDatabaseL
00149         * The method opens default contact database
00150         */
00151         void OpenDefaultDatabaseL();
00152 
00153         /**
00154         * OpenContactDatabase
00155         * The method stores name of the contact database
00156         * complete path
00157         * to the variable iDbName
00158         * @param aDbName name of the contact database
00159         */
00160         void UpdateContactDbName( TDesC& aDbName );
00161 
00162     private: // Functions from base classes
00163 
00164         /**
00165         * From CoeControl,SizeChanged
00166         * Called by framework when the view size is changed
00167         */
00168         void SizeChanged();
00169 
00170         /**
00171         * From CoeControl,CountComponentControls
00172         * @return Number of controls inside this container
00173         */
00174         TInt CountComponentControls() const;
00175 
00176         /**
00177         * From CCoeControl,ComponentControl
00178         * @param aIndex The index of the control queried
00179         * @return Pointer to the control queried
00180         */
00181         CCoeControl* ComponentControl( TInt aIndex ) const;
00182 
00183         /**
00184         * From CCoeControl,Draw
00185         * @param aRect rectangle for drawing
00186         */
00187         void Draw( const TRect& aRect ) const;
00188 
00189         /**
00190         * From CCoeControl
00191         * event handling section
00192         * e.g Listbox events
00193         * @param aControl name of the contact database
00194         * @param aEventType The event type
00195         */
00196         void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
00197 
00198         /**
00199         * From CCoeControl
00200         * event handling section
00201         * e.g Listbox events
00202         * @param aKeyEvent Event to handled.
00203         * @param aType Type of the key event.
00204         * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed).
00205         */
00206         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
00207 
00208         /**
00209         * From MEikListBoxObserver,HandleListBoxEventL.
00210         * Handles listbox events.
00211         * @param aListBox, pointer to listbox - not in use
00212         * @param aEventType, event which happened
00213         */
00214         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
00215 
00216     private: // New functions
00217 
00218         /**
00219         * UpdateListBoxL
00220         * The method updates listbox
00221         */
00222         void UpdateListBoxL();
00223 
00224         /**
00225         * ReadContactsFromDbL
00226         * The method reads contacts from contact database
00227         */
00228         void ReadContactsFromDbL();
00229 
00230         /**
00231         * ReadContactGroupsFromDbL
00232         * The method reads contact groups from contact database
00233         */
00234         void ReadContactGroupsFromDbL();
00235         /**
00236         * ShowDeleteConfirmationQueryL
00237         * The method shows confirmation query display
00238         * @param aTextResourceId ID for text string
00239         * @return Status for query
00240         */
00241         TBool ShowDeleteConfirmationQueryL( const TInt aTextResourceId );
00242 
00243         /**
00244         * OpenTextBoxQueryL
00245         * The method shows text query display
00246         * @param aTextResourceId  ID for text string
00247         * @param aTextData pointer of return textdata.
00248         * @param aTextLength max length for text
00249         * @return Status for query
00250         */
00251         TBool OpenTextBoxQueryL( const TInt aTextResourceId,
00252                                  TPtr aTextData,
00253                                                          TInt aTextLength = KMaxTextLength );
00254 
00255 
00256         /**
00257         * ShowInformationNoteNoDbL
00258         * The method shows no contact database selected information note
00259         */
00260         void ShowInformationNoteNoDbL();
00261 
00262     private: //data
00263         /**
00264         * iContactDb the contact database
00265         * Owned by CContContainer object
00266         */
00267         CContactDatabase* iContactDb;
00268 
00269         /**
00270         * iListBox the listbox
00271         * Owned by CContContainer object, instantiated in
00272         * ConstructL, deleted in destructor
00273         */
00274         CEikTextListBox* iListBox;
00275 
00276         /**
00277         * iContactArray the array of the contacts
00278         * Owned by CContContainer object, instantiated in
00279         * ConstructL, deleted in destructor
00280         */
00281         CDesCArray*       iContactArray;
00282 
00283         /**
00284         * iContactGroupArray the array of the contacts
00285         * Owned by CContContainer object, instantiated in
00286         * ConstructL, deleted in destructor
00287         */
00288         CDesCArray*       iContactGroupArray;
00289 
00290         /**
00291         * iDbName the name of the contact database
00292         * variable contains path and name
00293         */
00294         TBuf<KMaxDatabasePathAndNameLength>       iDbName;
00295 
00296         /**
00297         * iSelectedItemId the id of the selected item
00298         */
00299         TContactItemId    iSelectedItemId;
00300     };
00301 
00302 #endif // __CCONTCONTAINER_H__
00303 
00304 // End of File

© Nokia 2009

Back to top