messagingappbase/msgerrorwatcher/inc/MsgSentItemsObserver.h
changeset 0 72b543305e3a
child 77 da6ac9d688df
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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 *       CMsgSentItemsObserver declaration file
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MSGSENTITEMSOBSERVER_H
       
    22 #define MSGSENTITEMSOBSERVER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <msvapi.h>
       
    27 #include <cenrepnotifyhandler.h> // link against CenRepNotifHandler.lib
       
    28 
       
    29 #include "MsgErrorWatcher.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 
       
    33 class CRepository;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * CMsgSentItemsObserver
       
    39 *
       
    40 * @lib msgerrorwatcher.dll
       
    41 * @since 2.0
       
    42 */
       
    43 class CMsgSentItemsObserver : public CActive,
       
    44                               public MMsvEntryObserver,
       
    45                               public MCenRepNotifyHandlerCallback
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48 
       
    49         /**
       
    50         * Two-phased constructor.
       
    51         *
       
    52         * @param aWatcher A pointer to CMsgErrorWatcher
       
    53         * @param aSession A pointer to CMsvSession
       
    54         */
       
    55         static CMsgSentItemsObserver* NewL( 
       
    56             CMsgErrorWatcher* aWatcher,
       
    57             CMsvSession* aSession );
       
    58         
       
    59         /**
       
    60         * Destructor.
       
    61         */
       
    62         ~CMsgSentItemsObserver();
       
    63     
       
    64     public: // from base classes
       
    65     
       
    66         /**
       
    67         * From MMsvEntryObserver
       
    68         *
       
    69         * Call back from msg that the sent items folder has changed
       
    70         * so check if messages need to be deleted.
       
    71         */
       
    72         void HandleEntryEventL(
       
    73             TMsvEntryEvent aEvent,
       
    74             TAny* aArg1,
       
    75             TAny* aArg2,
       
    76             TAny* aArg3 );
       
    77 
       
    78         /**
       
    79         * From MCenRepNotifyHandlerCallback
       
    80         *
       
    81         * Notifications from CenRep
       
    82         */
       
    83         void HandleNotifyInt(TUint32 aId, TInt aNewValue);
       
    84         void HandleNotifyError(TUint32 aId, TInt error, CCenRepNotifyHandler* aHandler);
       
    85         void HandleNotifyGeneric(TUint32 aId);
       
    86 
       
    87     private:
       
    88 
       
    89         enum TCleanupFlags
       
    90             {
       
    91             EMsvSessionOpened               =0x00000001,
       
    92             ESentItemsFolderObserverAdded   =0x00000002,
       
    93             EUserSettingsConnected          =0x00000004, 
       
    94             EUserSettingsNotifierSet        =0x00000010
       
    95             };
       
    96     private:
       
    97 
       
    98         /**
       
    99         * By default Symbian OS constructor is private.
       
   100         */
       
   101         void ConstructL();
       
   102 
       
   103         /**
       
   104         * Private C++ constructor.
       
   105         *
       
   106         * @param aWatcher A pointer to CMsgErrorWatcher
       
   107         * @param aSession A pointer to CMsvSession
       
   108         */
       
   109         CMsgSentItemsObserver(
       
   110             CMsgErrorWatcher* aWatcher,
       
   111             CMsvSession* aSession );
       
   112 
       
   113         /**
       
   114         * Returns the user setting for use of the sent folder. If there
       
   115         * is an error then the default value of ON (i.e ETrue) will
       
   116         * be returned.
       
   117         *
       
   118         * @return ETrue, Sent folder is in use
       
   119         *         EFalse, Sent foler is not in use
       
   120         */
       
   121         TBool SentFolderIsBeingUsed();
       
   122 
       
   123         /**
       
   124         * Returns the user setting for max limit to the number of messages
       
   125         * in the sent folder. If there is an error then the default value of
       
   126         * 15 will be returned
       
   127         *
       
   128         * @return Maximum amount of messages in Sent folder
       
   129         */
       
   130         TInt SentFolderUpperLimit();
       
   131 
       
   132         /**
       
   133         * If there are more messages in the sent folder than the upper
       
   134         * limit set by the user then delete the oldest messages.
       
   135         */
       
   136         void DeleteOldMessagesFromSentFolderL();
       
   137 
       
   138         /**
       
   139         * Delete the messages specified by aSelection
       
   140         *
       
   141         * @param aSelection Enties to be deleted
       
   142         */
       
   143         void DeleteMessagesFromSentFolderL( CMsvEntrySelection* aSelection );
       
   144 
       
   145     private: //from CActive
       
   146 
       
   147         /**
       
   148         * From CActive
       
   149         */
       
   150         void RunL();
       
   151 
       
   152         /**
       
   153         * From CActive
       
   154         */
       
   155         void DoCancel();
       
   156 
       
   157     private:    // Data
       
   158 
       
   159         CMsgErrorWatcher* iWatcher;
       
   160         CMsvSession* iSession;
       
   161         CMsvEntry* iSentItemsFolder;
       
   162         CMsvEntry* iEntry;
       
   163         CCenRepNotifyHandler* iNotifyHandler;
       
   164         CRepository* iRepository;
       
   165         TInt8 iCleanupFlags;
       
   166         CMsvOperation* iOp;
       
   167         TUint iRetryCounter;
       
   168         TInt iMsgStoreDrive;
       
   169     };
       
   170 
       
   171 #endif      // MSGSENTITEMSOBSERVER_H
       
   172             
       
   173 // End of File