emailuis/emailui/inc/FreestyleEmailUiSettingsList.h
changeset 2 5253a20d2a1e
parent 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
1:12c456ceeff2 2:5253a20d2a1e
    13 *
    13 *
    14 * Description:  Freestyle Email header file
    14 * Description:  Freestyle Email header file
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 
       
    20 #ifndef FSSETTINGSSYNCLIST_H
    18 #ifndef FSSETTINGSSYNCLIST_H
    21 #define FSSETTINGSSYNCLIST_H
    19 #define FSSETTINGSSYNCLIST_H
    22 
    20 
    23 // SYSTEM INCLUDES
    21 // SYSTEM INCLUDES
    24 #include <coecntrl.h>
    22 #include <coecntrl.h>
    25 #include <e32cmn.h>
    23 #include <e32cmn.h>
    26 //<cmail>
       
    27 #include "MFSMailRequestObserver.h"
    24 #include "MFSMailRequestObserver.h"
    28 //</cmail>
       
    29 #include <AknWaitDialog.h>
    25 #include <AknWaitDialog.h>
       
    26 #include <aknlongtapdetector.h>
    30 
    27 
    31 // FORWARD DECLARATIONS
    28 // FORWARD DECLARATIONS
    32 class CFSMailClient;        
    29 class CFSMailClient;        
    33 class CAknSingleGraphicStyleListBox;
    30 class CAknSingleGraphicStyleListBox;
    34 class CEikTextListBox;
    31 class CEikTextListBox;
    35 class TFSMailMsgId;
    32 class TFSMailMsgId;
    36 class CFSMailBox;
    33 class CFSMailBox;
    37 class CFreestyleEmailUiAppUi;
    34 class CFreestyleEmailUiAppUi;
    38 
    35 
    39 typedef CAknSingleGraphicStyleListBox CSettingsListType;
    36 typedef CAknSingleGraphicStyleListBox CSettingsListType;
       
    37 
    40 
    38 
    41 /**
    39 /**
    42  * Container class for CFsEmailSettingsList
    40  * Container class for CFsEmailSettingsList
    43  * 
    41  * 
    44  * @class   CFsEmailSettingsList
    42  * @class   CFsEmailSettingsList
    45  */
    43  */
    46 class CFsEmailSettingsList : 
    44 class CFsEmailSettingsList : 
    47     public CCoeControl, 
    45     public CCoeControl, 
    48     public MEikListBoxObserver, 
    46     public MEikListBoxObserver, 
    49     public MFSMailRequestObserver,
    47     public MFSMailRequestObserver,
    50     public MProgressDialogCallback
    48     public MProgressDialogCallback,
       
    49     public MAknLongTapDetectorCallBack
    51     {
    50     {
    52 public:
    51 public: // Constructors and destructor.
    53     // constructors and destructor
    52 
    54     static CFsEmailSettingsList* NewL( 
    53     static CFsEmailSettingsList* NewL( 
    55         const TRect& aRect, 
    54         const TRect& aRect, 
    56         const CCoeControl* aParent,
    55         const CCoeControl* aParent,
    57         CFreestyleEmailUiAppUi& aAppUi,
    56         CFreestyleEmailUiAppUi& aAppUi,
    58         CFSMailClient& aMailClient,
    57         CFSMailClient& aMailClient,
    65         CFSMailClient& aMailClient,
    64         CFSMailClient& aMailClient,
    66         CFsEmailSettingsListView& aView );
    65         CFsEmailSettingsListView& aView );
    67     
    66     
    68     virtual ~CFsEmailSettingsList();
    67     virtual ~CFsEmailSettingsList();
    69 
    68 
    70 public:
    69 
    71     // from base class CCoeControl
    70 private: // Construction.
       
    71 
       
    72 	void ConstructL( const TRect& aRect, const CCoeControl* aParent);
       
    73     
       
    74     CFsEmailSettingsList( CFreestyleEmailUiAppUi& aAppUi,
       
    75 						  CFSMailClient& aMailClient,
       
    76 						  CFsEmailSettingsListView& aView );
       
    77 
       
    78 
       
    79 public: // From base class CCoeControl.
       
    80 
    72     TInt CountComponentControls() const;
    81     TInt CountComponentControls() const;
       
    82 
    73     CCoeControl* ComponentControl( TInt aIndex ) const;
    83     CCoeControl* ComponentControl( TInt aIndex ) const;
    74 
    84 
    75     TKeyResponse OfferKeyEventL( 
    85     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
    76             const TKeyEvent& aKeyEvent, 
    86 								 TEventCode aType );
    77             TEventCode aType );
       
    78     
    87     
    79     void HandleResourceChange( TInt aType );
    88     void HandleResourceChange( TInt aType );
       
    89     
       
    90     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
    91 
    80     void AddAccountL();
    92     void AddAccountL();
    81     void RemoveAccountL();
    93 
       
    94     /**
       
    95      * If confirmed by the user, will delete a mailbox.
       
    96      * @return True if a mailbox was deleted, false otherwise.
       
    97      */
       
    98     TBool RemoveAccountL();
       
    99 
    82     void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
   100     void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
       
   101 
    83     TBool PIMSyncItemVisible();
   102     TBool PIMSyncItemVisible();
    84 
   103 
    85 public:     
   104 
       
   105 public: // From MAknLongTapDetectorCallBack.
       
   106 	
       
   107     void HandleLongTapEventL( const TPoint& aPenEventLocation, 
       
   108 							  const TPoint& aPenEventScreenLocation );
       
   109 
       
   110 
       
   111 public: // New methods.
       
   112 
    86     CSettingsListType* ListBox();
   113     CSettingsListType* ListBox();
    87     
   114     
    88     static HBufC* CreateListBoxItemLC( 
   115     static HBufC* CreateListBoxItemLC( 
    89             const TDesC& aMainText );
   116             const TDesC& aMainText );
    90     
   117     
   190     void GoToTop();
   217     void GoToTop();
   191     void GoToBottom();
   218     void GoToBottom();
   192     
   219     
   193     void PageUp();
   220     void PageUp();
   194     void PageDown();
   221     void PageDown();
   195     
   222 
   196 public: 
   223     /**
       
   224      * Used to check if the currently selected item is a mailbox.
       
   225      * @param True if the selected item is a mailbox. False otherwise.
       
   226      */
       
   227     TBool SelectedItemIsMailbox() const;
       
   228 
       
   229     /**
       
   230      * Removes the focus.
       
   231      */
       
   232     void ClearFocus(); 
       
   233 
       
   234 
       
   235 public:
       
   236 
   197     enum TControls
   237     enum TControls
   198         {
   238         {
   199         EListBox,
   239         EListBox,
   200         ELastControl
   240         ELastControl
   201         };
   241         };
   202     enum TListBoxImages
   242     enum TListBoxImages
   203         {
   243         {
   204         EListBoxFirstUserImageIndex
   244         EListBoxFirstUserImageIndex
   205         };  
   245         };  
   206     
   246     
   207 protected:
   247 
   208     // from base class CCoeControl
   248 protected: // From base class CCoeControl.
       
   249 
   209     void SizeChanged();
   250     void SizeChanged();
   210     
   251 
   211 protected: // from MProgressDialogCallback
   252 
       
   253 protected: // From MProgressDialogCallback.
       
   254 
   212     void DialogDismissedL( TInt aButtonId );
   255     void DialogDismissedL( TInt aButtonId );
   213     
   256 
       
   257 
       
   258 private: // From base class CCoeControl.
       
   259 
       
   260     void Draw( const TRect& aRect ) const;
       
   261 
       
   262 
   214 private:
   263 private:
   215     // from base class CCoeControl
   264 
   216     void Draw( const TRect& aRect ) const;
       
   217 
       
   218 private:
       
   219     void ConstructL( 
       
   220         const TRect& aRect, 
       
   221         const CCoeControl* aParent);
       
   222     
       
   223     CFsEmailSettingsList(CFreestyleEmailUiAppUi& aAppUi, CFSMailClient& aMailClient, CFsEmailSettingsListView& aView );
       
   224     void HandleListBoxEventL( CEikListBox *aListBox, TListBoxEvent aEventType );
   265     void HandleListBoxEventL( CEikListBox *aListBox, TListBoxEvent aEventType );
   225     void InitializeControlsL();
   266     void InitializeControlsL();
   226     void LayoutControls();
   267     void LayoutControls();
   227     void LoadAccountsToListL();
   268     void LoadAccountsToListL();
   228     void SetDefaultPIMAccountL();
   269     void SetDefaultPIMAccountL();
   229     TPtrC GetMailBoxNameL( const CFSMailBox& aMailBox ) const;
   270     TPtrC GetMailBoxNameL( const CFSMailBox& aMailBox ) const;
   230     
   271 
   231 private:
   272 
       
   273 private: // Data.
       
   274 
   232     enum TFsEmailSettingsSubViewType
   275     enum TFsEmailSettingsSubViewType
   233         {
   276         {
   234         EFsEmailSettingsMainListView,
   277         EFsEmailSettingsMainListView,
   235         EFsEmailSettingsMailboxView,
   278         EFsEmailSettingsMailboxView,
   236         EFsEmailSettingsPimView
   279         EFsEmailSettingsPimView
   237         };
   280         };
       
   281 
   238     TFsEmailSettingsSubViewType iCurrentSubView;
   282     TFsEmailSettingsSubViewType iCurrentSubView;
   239 
   283     CSettingsListType* iListBox;
   240     CSettingsListType*          iListBox;
   284     CFreestyleEmailUiAppUi& iAppUi;
   241     CFreestyleEmailUiAppUi&     iAppUi;
   285     CCoeControl* iFocusControl;
   242     CCoeControl*                iFocusControl;
   286     CAknLongTapDetector* iLongTapDetector;
   243     CFSMailClient&              iMailClient;
   287     CFSMailClient& iMailClient;
   244     TFSMailMsgId                iSelectedAccountInfo;
   288     TFSMailMsgId iSelectedAccountInfo;
   245     TUid                        iSelectedPluginSettings;
   289     TUid iSelectedPluginSettings;
   246     TInt                        iPIMSyncMailboxIndex;
   290     TInt iPIMSyncMailboxIndex;
   247     TBool                       iPIMListActivation;
   291     TBool iPIMListActivation;
   248     TBool                       iPIMServiceSettingsSelection;
   292     TBool iPIMServiceSettingsSelection;
   249     CAknWaitDialog*             iWaitDialog;
   293     CAknWaitDialog* iWaitDialog;
   250     TInt                        iMailboxCount;
   294     TInt iMailboxCount;
   251     TInt                        iDeleteMailboxId;
   295     TInt iDeleteMailboxId;
   252     TInt                        iDeletedIndex;
   296     TInt iDeletedIndex;
   253     TInt                        iPIMSyncCount;
   297     TInt iPIMSyncCount;
   254     TInt                        iSelectedSubListIndex;
   298     TInt iSelectedSubListIndex;
   255     CFsEmailSettingsListView& 	iView; 
   299     CFsEmailSettingsListView& iView; 
   256 	// it is used to properly handle taps
   300     TBool iLongTapEventConsumed;
   257     // first tap highlights an item on the settings list, second tap selects the item
   301     
   258     TInt                        iPrevSelected;
   302 	// Used to properly handle taps. First tap highlights an item on the
       
   303     // settings list, second tap selects the item.
       
   304     TInt iPrevSelected;
   259     };
   305     };
   260                 
   306 
       
   307 
   261 #endif // FSSETTINGSSYNCLIST_H
   308 #endif // FSSETTINGSSYNCLIST_H