email/imum/Utils/Inc/IMSFolderSubscription.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2006 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: 
       
    15 *       folder subscription dialog
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #if !defined(__IMSFOLDERSUBSCRIPTION_H__)
       
    21 #define __IMSFOLDERSUBSCRIPTION_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <msvstd.h>
       
    25 #include <msvapi.h>
       
    26 #include <AknForm.h> // CAknDialog
       
    27 #include <eiklbo.h>
       
    28 #include <gulicon.h> // CGulIcon
       
    29 #include <MuiuMsvSingleOpWatcher.h>
       
    30 #include "IMSSoftkeyControl.h"
       
    31 #include "IMSFolderListArray.h"
       
    32 
       
    33 //enumeration for folder icon indexes.
       
    34 enum TImumFolderIconIndexes
       
    35     {
       
    36     EImumFolderSingleUnsubbed = 0,
       
    37     EImumFolderSingleSubbed,
       
    38     EImumFolderSingleSubbedNew,
       
    39     EImumFolderSubfoldersUnsubbed,
       
    40     EImumFolderSubfoldersSubbed,
       
    41     EImumFolderSubfoldersSubbedNew,
       
    42     EImumFolderUnsubbedNew,
       
    43     EImumFolderSubfoldersUnsubbedNew,
       
    44     };
       
    45 
       
    46 class CMtmStore;
       
    47 class CBaseMtmUiData;
       
    48 class CBaseMtmUi;
       
    49 class CAknWaitDialog;
       
    50 class CMuiuFlags;
       
    51 class CImumInternalApiImpl;
       
    52 class MImumInMailboxUtilities;
       
    53 
       
    54 class CAknNavigationControlContainer;
       
    55 class CAknNavigationDecorator;
       
    56 
       
    57 /**
       
    58 * CImapSubscriptionDialog
       
    59 * Folder subscription dialog class
       
    60 */
       
    61 class CImapSubscriptionDialog :
       
    62     public CAknDialog,
       
    63     public MEikListBoxObserver,
       
    64     public MMsvSessionObserver
       
    65     {
       
    66     public:
       
    67 
       
    68         /**
       
    69         * NewL()
       
    70         * @param CMuiuFlags&, flags
       
    71         * @param TMsvId, folder id
       
    72         * @param TMsvId, mailbox id
       
    73         * @param TBool&, login info changed (in/out)
       
    74         * @param const TDesC8&, user name
       
    75         * @param const TDesC8&, password
       
    76         * @param CMsvSession& session reference
       
    77         * @return CImapSubscriptionDialog*
       
    78         */
       
    79         static CImapSubscriptionDialog* NewL(
       
    80             CMuiuFlags& aFlags,
       
    81             TMsvId aServiceId,
       
    82             TMsvId aMailboxId,
       
    83             TBool& aLoginChanged,
       
    84             const TDesC8& aUserName,
       
    85             const TDesC8& aPassword,
       
    86             CImumInternalApiImpl& aMailboxApi );
       
    87 
       
    88             ~CImapSubscriptionDialog();
       
    89 
       
    90 
       
    91         /**
       
    92         * From MMsvSessionObserver
       
    93         * HandleSessionEventL
       
    94         * @param TMsvSessionEvent, event id
       
    95         * @param TAny*
       
    96         * @param TAny*
       
    97         * @param TAny*
       
    98         */
       
    99         virtual void HandleSessionEventL(
       
   100             TMsvSessionEvent aEvent,
       
   101             TAny* aArg1,
       
   102             TAny* aArg2,
       
   103             TAny* aArg3 );
       
   104 
       
   105         /**
       
   106         * SynchroniseFoldersL()
       
   107         */
       
   108         void SynchroniseFoldersL();
       
   109 
       
   110         /**
       
   111         * DisplayFinalProgressDialog()
       
   112         * To deal with final progress from suboperations
       
   113         * @param CMsvOperation&
       
   114         */
       
   115         void DisplayFinalProgressDialog(
       
   116             CMsvOperation& aCompletedOperation) const;
       
   117 
       
   118         /**
       
   119         * from CCoeControl
       
   120         * OfferKeyEventL()
       
   121         * @param TKeyEvent&, key event
       
   122         * @param TEventCode
       
   123         * @return TKeyResponse
       
   124         */
       
   125         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   126 
       
   127 
       
   128         /**
       
   129         * From CAknDialog
       
   130         * DynInitMenuPaneL()
       
   131         * @param TInt, resource id
       
   132         * @param CEikMenuPane*
       
   133         */
       
   134         virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) ;
       
   135 
       
   136         /**
       
   137         * From CAknDialog
       
   138         * ProcessCommandL()
       
   139         * @param TInt, command id
       
   140         */
       
   141         virtual void ProcessCommandL( TInt aCommandId );
       
   142 
       
   143         /**
       
   144         * from CCoeControl
       
   145         * ActivateL()
       
   146         */
       
   147         virtual void ActivateL();
       
   148 
       
   149     protected:
       
   150 
       
   151         /**
       
   152         * From MEikListBoxObserver
       
   153         * @param CEikListBox*
       
   154         * @param TListBoxEvent
       
   155         */
       
   156         virtual void HandleListBoxEventL(
       
   157             CEikListBox* aListBox,
       
   158             TListBoxEvent aEventType );
       
   159 
       
   160         /**
       
   161         * HandleSubscriptionL()
       
   162         * @param TInt type of subscription, either subscribed or unsubscribed
       
   163         * @param CMsvEntrySelection&, selection to subscribe
       
   164         */
       
   165         void HandleSubscriptionL( TInt aSubType, CMsvEntrySelection& aSelection );
       
   166 
       
   167         /**
       
   168         * CheckAreAllFoldersIncludedL()
       
   169         * Checks if all subfolders are either subscribed of unsubscribed
       
   170         * @param TInt, type of subscription, either subscribed or unsubscribed
       
   171         * @param CMsvEntrySelection*, selection to check
       
   172         * @return TBool, ETrue if all subfolders have same subscription state
       
   173         */
       
   174         TBool CheckAreAllFoldersIncludedL( TInt aSubType, CMsvEntrySelection* sel );
       
   175 
       
   176     private:
       
   177 
       
   178         /**
       
   179         * PreLayoutDynInitL()
       
   180         */
       
   181         virtual void PreLayoutDynInitL();
       
   182 
       
   183         /**
       
   184         * PostLayoutDynInitL()
       
   185         */
       
   186         virtual void PostLayoutDynInitL();
       
   187 
       
   188         /**
       
   189         * OkToExitL()
       
   190         * @param TInt
       
   191         * @return TBool
       
   192         */
       
   193         virtual TBool OkToExitL(TInt aButtonId);
       
   194 
       
   195         /**
       
   196         * C++ constructor
       
   197         * @param CMuiuFlags&, flags
       
   198         * @param TMsvId, folder id
       
   199         * @param TMsvId, mailbox id
       
   200         * @param TBool&, login info changed (in/out)
       
   201         * @param const TDesC8&, user name
       
   202         * @param const TDesC8&, password
       
   203         * @param CMsvSession& session reference
       
   204         */
       
   205         CImapSubscriptionDialog(
       
   206             CMuiuFlags& aFlags,
       
   207             TMsvId aServiceId,
       
   208             TMsvId aMailboxId,
       
   209             TBool& aLoginChanged,
       
   210             const TDesC8& aUserName,
       
   211             const TDesC8& aPassword,
       
   212             CImumInternalApiImpl& aMailboxApi );
       
   213 
       
   214         /**
       
   215         * ConstructL()
       
   216         */
       
   217         void ConstructL();
       
   218 
       
   219         /**
       
   220         * CreateOperationL()
       
   221         * @param TInt, button id
       
   222         */
       
   223         void CreateOperationL(TInt aButtonId);
       
   224 
       
   225         /**
       
   226         * ContextHasChildFolders()
       
   227         * @return TBool, ETrue if has children
       
   228         */
       
   229         TBool ContextHasChildFolders() const;
       
   230 
       
   231         /**
       
   232         * GetMtmUiL()
       
   233         */
       
   234         void GetMtmUiL();
       
   235 
       
   236 
       
   237         /**
       
   238         * AppendIconsL()
       
   239         * Appends icons to icon array
       
   240         * @param TFileName&: Bitmap filename with path
       
   241         * @param CArrayPtrFlat<CGulIcon>*: icon array where bitmap is append
       
   242         */
       
   243         void AppendIconsL(
       
   244             TFileName& aFileName,
       
   245             CArrayPtrFlat<CGulIcon>* aIcons);
       
   246 
       
   247         /**
       
   248         * CurrentFolderL()
       
   249         * @return TMsvId, id of current folder
       
   250         */
       
   251         TMsvId CurrentFolderL();
       
   252 
       
   253         /**
       
   254         * HandleRefreshL
       
   255         */
       
   256         void HandleRefreshL();
       
   257 
       
   258         /**
       
   259         * LaunchHelpL()
       
   260         * Launches help
       
   261         */
       
   262         void LaunchHelpL();
       
   263 
       
   264         /**
       
   265         * Gets the text resource for MSK, based on the selected item
       
   266         * @since S60 3.1
       
   267         * @return Text resource
       
   268         */
       
   269         TInt GetResourceForMiddlekeyL();
       
   270 
       
   271         /**
       
   272         * Refresh folder list array and change listbox to root view
       
   273         * @since S60 3.2
       
   274         */
       
   275         void RefreshFolderListL();
       
   276 
       
   277         /**
       
   278         * Set Folder Back to Folder where user was before refresh
       
   279         * @since S60 3.2
       
   280         */
       
   281         void SetBackToOldFolderL();
       
   282 
       
   283         /**
       
   284         * Save login information into database
       
   285         * @since S60 3.2
       
   286         */
       
   287         void SetLoginInformationL();
       
   288 
       
   289         /**
       
   290         * Set middle softkey label
       
   291         * @since S60 3.2
       
   292         */
       
   293         void SetMskL();
       
   294 
       
   295 
       
   296         /**
       
   297         * Set folder depth for the navi pane icons
       
   298         * @since S60 5.0
       
   299         */
       
   300         void SetFolderDepthL( TInt aDepth );
       
   301 
       
   302     private:
       
   303 
       
   304         CImumInternalApiImpl&           iMailboxApi;
       
   305         CMuiuFlags&                     iFlags;
       
   306         TMsvId                          iServiceId;
       
   307         TMsvId                          iMailboxId;
       
   308         TBool&                          iLoginChanged;
       
   309         const TDesC8&                   iUserName;
       
   310         const TDesC8&                   iPassword;
       
   311 
       
   312         TBool                           iLoginSaved;
       
   313         CMtmStore*                      iMtmStore;
       
   314         CBaseMtmUiData*                 iMtmUiData;
       
   315         CBaseMtmUi*                     iMtmUi;
       
   316         CMsvEntry*                      iContextEntry;
       
   317         CImapFolderListArray*           iFolderListArray;
       
   318         CIMSSoftkeyControl*             iSoftkeys;
       
   319         TMsvId                          iOpenedFolderId;
       
   320         TInt                            iPreviousSubscriptionRID;
       
   321         TInt                            iPreviousFolderOpenRID;
       
   322         MImumInMailboxUtilities*        iUtils;
       
   323         RArray< TMsvId >                iFolderIdArray;
       
   324 
       
   325 		// depth of the folder structure
       
   326 		// used for drawing the folder icons to navipane
       
   327         TInt							iDepth;
       
   328         // pointer to navipane
       
   329         CAknNavigationControlContainer* iNaviPane;
       
   330         // pointer to navi pane decorator
       
   331 		CAknNavigationDecorator*        iFolderIndicator;
       
   332     };
       
   333 
       
   334 #endif // __IMSFOLDERSUBSCRIPTION_H__