email/alwaysonlineemailplugin/inc/AlwaysOnlineImap4FolderObserver.h
changeset 79 2981cb3aa489
parent 0 72b543305e3a
equal deleted inserted replaced
25:84d9eb65b26f 79:2981cb3aa489
       
     1 /*
       
     2 * Copyright (c) 2004 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 *     Observer of the given folder. If new messages are created to the folder, 
       
    16 *     calls HandleFolderEntryL.
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef __ALWAYSONLINEIMAP4FOLDEROBSERVER_H__
       
    21 #define __ALWAYSONLINEIMAP4FOLDEROBSERVER_H__
       
    22 
       
    23 #include <msvstd.h> // general messaging
       
    24 #include <msvapi.h> // MMsvEntryObserver
       
    25 
       
    26 
       
    27 /**
       
    28 * MAlwaysOnlineImap4FolderObserver 
       
    29 *
       
    30 * 
       
    31 */
       
    32 
       
    33 class MAlwaysOnlineImap4FolderObserver
       
    34     {
       
    35     public:
       
    36     	virtual void HandleFolderEntryL( const CMsvEntrySelection& aFolderArray ) = 0;
       
    37     };
       
    38 
       
    39 
       
    40 /**
       
    41 * CAlwaysOnlineImap4FolderObserver 
       
    42 *
       
    43 * 
       
    44 */
       
    45 class CAlwaysOnlineImap4FolderObserver : 
       
    46     public CActive,
       
    47     public MMsvSessionObserver
       
    48     {
       
    49     public:
       
    50        /**
       
    51         * 2-phase constructor.
       
    52         */
       
    53         static CAlwaysOnlineImap4FolderObserver* NewL(
       
    54             CMsvSession& aMsvSession,
       
    55             MAlwaysOnlineImap4FolderObserver& aObserver );
       
    56 
       
    57         /**
       
    58         *
       
    59         */
       
    60         static CAlwaysOnlineImap4FolderObserver* NewL(
       
    61             CMsvSession& aMsvSession,
       
    62             CMsvEntrySelection* aFoldersToWatch,
       
    63             MAlwaysOnlineImap4FolderObserver& aObserver );
       
    64         
       
    65         /**
       
    66         * Destructor.
       
    67         */
       
    68         virtual ~CAlwaysOnlineImap4FolderObserver();
       
    69 
       
    70     public:
       
    71         /**
       
    72         *
       
    73         */
       
    74         void Start();
       
    75         void Stop();
       
    76 
       
    77         /**
       
    78         *
       
    79         */
       
    80         void AppendFolderL( TMsvId aFolderId );
       
    81 
       
    82         /**
       
    83         *
       
    84         */
       
    85         void RemoveFolder( TMsvId aFolderId );
       
    86 
       
    87         /**
       
    88         *
       
    89         */
       
    90         void ResetFoldersL( CMsvEntrySelection* aFoldersToWatch );
       
    91 
       
    92         /**
       
    93         *
       
    94         */
       
    95         void SetMailbox( const TMsvId aMailboxId );
       
    96 
       
    97 
       
    98 
       
    99 
       
   100     public:
       
   101         void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
   102 
       
   103 
       
   104     private:
       
   105         /**
       
   106         * From CActive
       
   107         */
       
   108         virtual void DoCancel();
       
   109 
       
   110 
       
   111         /**
       
   112         * From CActive ?member_description
       
   113         */
       
   114         virtual void RunL();
       
   115 
       
   116        /**
       
   117         * C++ constructor.
       
   118         */
       
   119         CAlwaysOnlineImap4FolderObserver( 
       
   120             CMsvSession& aMsvSession,
       
   121             MAlwaysOnlineImap4FolderObserver& aObserver );
       
   122 
       
   123         /**
       
   124         * constructor.
       
   125         */
       
   126         void ConstructL( CMsvEntrySelection* aFoldersToWatch );
       
   127         
       
   128     private:
       
   129         RTimer          iTimer;
       
   130         CMsvSession&    iMsvSession;
       
   131         CMsvEntrySelection* iFolders;
       
   132         CMsvEntrySelection* iChangedFolders;
       
   133         TBool           iRunning;
       
   134         MAlwaysOnlineImap4FolderObserver& iObserver;
       
   135         TBool           iSendNotification;
       
   136         TMsvId          iMailboxId;
       
   137     };
       
   138 
       
   139 
       
   140 
       
   141 #endif
       
   142 //EOF