fep/aknfep/inc/aknfepuserdbdlg.h
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:            Define dialog for user DB management
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 #ifndef C_CAKNFEPUSERDBDLG_H
       
    30 #define C_CAKNFEPUSERDBDLG_H
       
    31 
       
    32 // INCLUDES
       
    33 #include <e32std.h>
       
    34 #include <e32base.h>
       
    35 #include <aknselectionlist.h> //CAknMarkableListDialog
       
    36 #include <AknProgressDialog.h> 
       
    37 #include <eiklbo.h> // MEikListBoxObserver 
       
    38 #include <eiklbx.h> //MListBoxItemChangeObserver
       
    39 
       
    40 const TInt KMaxInputSize(7);
       
    41 const TInt KMaxCharSize(7);
       
    42 
       
    43 // CLASS DECLARATION
       
    44 class CDBManagement;
       
    45 class CPtiEngine;
       
    46 class CAknFepManager;
       
    47 class CAknProgressDialog;
       
    48 class CEikProgressInfo;
       
    49 class CAknFepUserDBQueryDlg;
       
    50 
       
    51 /**
       
    52  *  Dialog for user DB management
       
    53  *  In this Dialog of user DB management, it has add,remove,
       
    54  *  edit and mark/unmark function
       
    55  *
       
    56  *  @code
       
    57  *   ?good_class_usage_example(s)
       
    58  *  @endcode
       
    59  *
       
    60  *  @lib ?library
       
    61  *  @since S60 v3.1
       
    62  */
       
    63 class CAknFepUserdbDlg : public CAknMarkableListDialog,
       
    64                          public MListBoxItemChangeObserver 
       
    65     {
       
    66 public:
       
    67     // Constructors and destructor
       
    68 
       
    69     /**
       
    70      * Destructor.
       
    71      */
       
    72     ~CAknFepUserdbDlg();
       
    73 
       
    74     /**
       
    75      * Two-phased constructor.
       
    76      * @param aOpenedItem Index of the item focusing on
       
    77      * @param aSelectedItems Selected of list items
       
    78      * @param aArray Content of list items
       
    79      * @param aMenuBarResourceId Menu bar id
       
    80      * @param aCommand Default value is zero
       
    81      */
       
    82     static CAknFepUserdbDlg* NewL( TInt &aOpenedItem,
       
    83             CArrayFix< TInt > *aSelectedItems, MDesCArray *aArray,
       
    84             TInt aMenuBarResourceId, CPtiEngine* aPtiEngine, CAknFepManager* aOwner,
       
    85             MEikCommandObserver *aObserver=0 );
       
    86     
       
    87     /**
       
    88      * Refresh user db view
       
    89      *
       
    90      * @since S60 v3.1
       
    91      * @param none
       
    92      * @return none
       
    93      */
       
    94     void OnChangeLanguageL( TInt aInputLanguage );
       
    95 
       
    96     /**
       
    97      * Refresh user db view when the screen size was changed.
       
    98      *
       
    99      * @since S60 vTB9.1
       
   100      * @param none
       
   101      * @return none
       
   102      */
       
   103     void SizeChanged();
       
   104 	
       
   105 	/**
       
   106      * Return control to application framework.
       
   107      *
       
   108      * @since S60 vTB9.2
       
   109      * @param TInt aIndex is the index of control
       
   110      * @return CCoeControl object pointer
       
   111      */
       
   112     CCoeControl* ComponentControl(TInt aIndex) const; 
       
   113 	
       
   114 	/**
       
   115      * Return number of controls in this dialog
       
   116      *
       
   117      * @since S60 vTB9.2
       
   118      * @param none
       
   119      * @return number of controls
       
   120      */
       
   121     TInt CountComponentControls() const;
       
   122 	
       
   123 private:
       
   124 
       
   125     /**
       
   126      * C++ constructor.
       
   127      * @param aOpenedItem Index of the item focusing on
       
   128      * @param aSelectedItems Selected of list items
       
   129      * @param aArray Content of list items
       
   130      * @param aCommand Default value is zero
       
   131      */
       
   132     CAknFepUserdbDlg( TInt &aValue, CArrayFix< TInt > *aSelectedItems,
       
   133             MDesCArray *aArray, CPtiEngine* aPtiEngine, CAknFepManager* aOwner,
       
   134             MEikCommandObserver *aObserver );
       
   135 
       
   136     /**
       
   137      * Symbian second-phase constructor.
       
   138      * @param aMenuBarResourceId Menu bar id
       
   139      */
       
   140     void ConstructL( TInt aMenuBarResourceId );
       
   141     
       
   142     /**
       
   143      * Construct Context Menu
       
   144      *
       
   145      * @since S60 v3.1
       
   146      * @param None
       
   147      * @return None 
       
   148      */
       
   149     void ConstructContextMenuL();
       
   150     
       
   151     /**
       
   152      * Init items in the list from user DB
       
   153      *
       
   154      * @since S60 v3.1
       
   155      * @param None
       
   156      * @return Whether there are any items in list, ETrue is have items 
       
   157      */
       
   158     TBool InitListBoxItemL( );
       
   159     
       
   160     /**
       
   161      * Add phrase to listbox and user DB
       
   162      *
       
   163      * @since S60 v3.1
       
   164      * @param none
       
   165      * @return none
       
   166      */
       
   167     void AddItemL();
       
   168 
       
   169     /**
       
   170      * Delete phrase in listbox and user DB
       
   171      *
       
   172      * @since S60 v3.1
       
   173      * @param none
       
   174      * @return none
       
   175      */
       
   176     void RemoveItemL();
       
   177 
       
   178     /**
       
   179      * Edit phrase in listbox and user DB
       
   180      *
       
   181      * @@since S60 v3.1
       
   182      * @param none
       
   183      * @return none
       
   184      */
       
   185     void EditItemL();
       
   186 
       
   187     /**
       
   188      * Mark/Unmark phrase in listbox and user DB
       
   189      *
       
   190      * @since S60 v3.1
       
   191      * @param aItemIndex item's index which would be mark or unmark
       
   192      * @return aMark set for the item mark
       
   193      */
       
   194     void CmdMarkL( TInt aItemIndex, TBool aMark );
       
   195     
       
   196     /**
       
   197      * Change the current cba to the specific cba
       
   198      *
       
   199      * @since S60 v3.1
       
   200      * @param aCbaResourceId cba id
       
   201      * @return none
       
   202      */
       
   203     void ChangeCurrentCbaL ( TInt aCbaResourceId );
       
   204     
       
   205     /**
       
   206      * Show context menu
       
   207      *
       
   208      * @since S60 v3.1
       
   209      * @param none
       
   210      * @return none
       
   211      */
       
   212     void ShowContextMenuL();
       
   213     
       
   214     /**
       
   215      * Set the Search Field blank
       
   216      *
       
   217      * @since S60 v3.1
       
   218      * @param none
       
   219      * @return none
       
   220      */
       
   221     void ResetSearchFieldL();
       
   222     
       
   223     /**
       
   224      * Find item's real Index in list
       
   225      *
       
   226      * @since S60 v3.1
       
   227      * @param aItemIndex Item's index in the view which want to find the actual index
       
   228      * @return The actual index of the item
       
   229      */
       
   230     TInt FindActualIndex( const TInt aItemIndex ); 
       
   231     /**
       
   232      * Mark or unmark item in list
       
   233      *
       
   234      * @since S60 v3.1
       
   235      * @param none
       
   236      * @return none
       
   237      */
       
   238     void MarkOrUnmarkItemL();
       
   239     
       
   240     /**
       
   241      * Add '\t' to item array
       
   242      *
       
   243      * @since S60 v3.1
       
   244      * @param aDataArray array which want to be inserted '\t'
       
   245      * @return none
       
   246      */
       
   247     void InsertIconL( CDesC16Array* aDataArray );
       
   248     
       
   249     /**
       
   250      * To update cba of dialg
       
   251      *
       
   252      * @since S60 v3.1
       
   253      * @param aCommandId command id from menu, 0 for command except mark
       
   254      * @return none
       
   255      */
       
   256     void UpdateListBoxL( TInt aCommandId = 0);
       
   257         
       
   258     //From base class CAknMarkableListDialog
       
   259     /**
       
   260      * From base class CAknMarkableListDialog
       
   261      * Deal the commands that have recevied
       
   262      * @param aCommandId Commands' Id
       
   263      * @return None
       
   264      */
       
   265     void ProcessCommandL( TInt aCommandId );
       
   266     
       
   267     /**
       
   268      * From base class CAknMarkableListDialog
       
   269      * Deal the softkey event
       
   270      * @param aButtonId softkey Id
       
   271      * @return ETrue to validate and exit the dialog, EFalse to keep the dialog active.
       
   272      */
       
   273     TBool OkToExitL( TInt aButtonId );
       
   274     
       
   275     /**
       
   276      * From base class CAknMarkableListDialog
       
   277      * Dynamically initialises a menu pane.
       
   278      * @param aResourceId Menu pane id
       
   279      * @param aMenuPane The in-memory representation of the menu pane.
       
   280      * @return None
       
   281      */
       
   282     void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane );
       
   283     
       
   284     void FocusChanged(TDrawNow aDrawNow);
       
   285     
       
   286     /**
       
   287      * From base class CAknMarkableListDialog
       
   288      * Initializes the dialog's controls after the 
       
   289      * dialog has been sized but before it has been activated
       
   290      * @param None
       
   291      * @return None
       
   292      */
       
   293     void PostLayoutDynInitL();
       
   294     
       
   295     /**
       
   296      * From base class CAknMarkableListDialog
       
   297      * @param aKeyEvent The key event.
       
   298      * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown
       
   299      * @return Indicates whether or not the key event was used by this control
       
   300      */
       
   301     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   302 
       
   303     //From base class MEikListBoxObserver
       
   304     /**
       
   305      * From base class MEikListBoxObserver
       
   306      * Observer callback from the listbox..
       
   307      * @param aListBox  ptr to listbox that is calling the method  
       
   308      * @param aEventType  type of event; defined by MEikListBoxObserver 
       
   309      * @return None
       
   310      */
       
   311     void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); 
       
   312     
       
   313     //From base class MListBoxItemChangeObserver
       
   314     /**
       
   315      * From base class MListBoxItemChangeObserver
       
   316      * Item change observer will be notified when list box items have been 
       
   317      * added or removed or the list box has been reset.
       
   318      * @param aListBox  ptr to listbox that is calling the method  
       
   319      * @return None
       
   320      */
       
   321     void ListBoxItemsChanged( CEikListBox* aListBox );
       
   322     
       
   323 private: //data
       
   324 
       
   325     /**
       
   326      * Engine
       
   327      * Own
       
   328      */
       
   329 	CDBManagement* iDBEngine;  
       
   330 	
       
   331     /**
       
   332      * Progress dialog
       
   333      * Own, but doesn't need delete by myself
       
   334      */
       
   335 	CAknProgressDialog*  iProgressDialog;
       
   336 	
       
   337     /**
       
   338      * progress info
       
   339      * Own, but doesn't need delete by myself
       
   340      */
       
   341 	CEikProgressInfo*    iProgressInfo;
       
   342 	
       
   343     /**
       
   344      * Item array
       
   345      * Own, but doesn't need delete by myself,listbox would free it automatic
       
   346      */
       
   347 	CDesC16Array* iItems;
       
   348 	
       
   349     /**
       
   350      * Pti Engine
       
   351      * Not Own
       
   352      */
       
   353     CPtiEngine* iPtiEngine;
       
   354     
       
   355     /**
       
   356      * AknFepManager need by DBEngine
       
   357      * Not own
       
   358      */
       
   359 	CAknFepManager* iOwner;
       
   360 	
       
   361     /**
       
   362      * Context menu bar
       
   363      * Own
       
   364      */
       
   365 	CEikMenuBar* iContextMenuBar;
       
   366     
       
   367     /**
       
   368      * Old highLight postion
       
   369      */
       
   370     TInt iOldIndex;
       
   371 
       
   372     /**
       
   373      * Old Language
       
   374      */
       
   375     TInt iOldLanguage;
       
   376     
       
   377     /**
       
   378      * Query for add and edit. Not Own.
       
   379      */
       
   380     CAknFepUserDBQueryDlg* iQueryDlg;
       
   381     
       
   382     /**
       
   383      * Old cba resouce
       
   384      */
       
   385     TInt iOldCbaRes;
       
   386     };
       
   387 
       
   388 #endif // C_CAKNFEPUSERDBDLG_H