examples/SFExamples/symbian_os_communications_programming_book_v2/chapter8/receivingmessages/CMessageSummaryEngine.h

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 #ifndef _CMessageSummaryEngine_H
00018 #define _CMessageSummaryEngine_H
00019 
00020 #include <e32base.h>
00021 #include <e32cons.h>
00022 
00023 #include <msvstd.h>
00024 #include <msvapi.h>
00025 #include <msvids.h>
00026 
00027 #include "CMessageSummaryGenerator.h"
00028 
00029 class MSummaryEngineObserver
00030         {
00031 public:
00032         virtual void Refresh() = 0;
00033         };
00034 
00035 class CMessageSummaryEngine : public CActive, public MMsvSessionObserver
00036         {
00037 public:
00038 
00039         static CMessageSummaryEngine* NewL(MSummaryEngineObserver& aObserver);
00040 
00041         // Start the summary operation
00042         void StartL();
00043         
00044         // CActive functions
00045         void DoCancel();
00046         void RunL();
00047         
00048         // From MMsvSessionObserver
00049         void HandleSessionEventL(TMsvSessionEvent aEvent, TAny *aArg1, TAny *aArg2, TAny *aArg3);
00050         
00051         const CMessageSummaryGenerator& SmsSummary();
00052         const CMessageSummaryGenerator* EmailSummary();
00053         
00054         ~CMessageSummaryEngine();
00055         
00056 protected:
00057         CMessageSummaryEngine(MSummaryEngineObserver& aObserver);
00058         void ConstructL();
00059         TBool UpdateNextSummary();
00060         void CreateSummaryGeneratorsL();
00061         TBool FindPop3ServiceEntryL(TMsvId& aPop3MailboxId);
00062         
00063 private:
00064         CMessageSummaryGenerator* iEmailInboxSummary; // Only support a single POP3 inbox for now, pick the first one found
00065         CMessageSummaryGenerator* iSmsInboxSummary;
00066         
00067         MSummaryEngineObserver& iObserver;
00068         
00069         // Symbian OS messaging classes
00070         CMsvSession* iMessagingSession;
00071         CMsvEntry* iMessagingEntry;
00072         
00073 private:
00074 
00075         enum TSummaryEngineState
00076                 {
00077                 EConnectingToMessageServer,
00078                 EScanningForSms,
00079                 EScanningForEmail,
00080                 ERefreshing
00081                 };
00082         
00083         TBool iRefreshSms; // True if the SMS summaries must be updated
00084         TBool iRefreshEmail; // True if the Email summaries must be updated
00085 
00086         TSummaryEngineState iState;
00087         };
00088 
00089 #endif

Generated by  doxygen 1.6.2