messagingapp/msgsettings/msginit/inc/coutboxobserver.h
changeset 52 12db4185673b
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
       
     1 /*
       
     2  * Copyright (c) 2010 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  *       The purpose of this class is to observe if there are messages 
       
    16  *       in the outbox.
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef OUTBOXOBSERVER_H
       
    21 #define OUTBOXOBSERVER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <msvapi.h>         // for MMsvSessionObserver
       
    26 #include "msignalstrengthobserver.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 class CMsvSession;
       
    31 class COutboxSender;
       
    32 class MSignalStrengthHandler;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  *  Observes if there are messages in the OutBox..
       
    38  */
       
    39 class COutboxObserver: public CBase, public MMsvEntryObserver, public MSignalStrengthObserver
       
    40 {
       
    41 public:
       
    42     // Constructors and destructor
       
    43 
       
    44     /**
       
    45      *   A Two-phased constructor.
       
    46      */
       
    47     static COutboxObserver* NewL();
       
    48 
       
    49     /**
       
    50      *   Destructor.
       
    51      */
       
    52     virtual ~COutboxObserver();
       
    53 
       
    54 private:
       
    55     // From MSignalStrengthObserver
       
    56 
       
    57     void SignalStrengthAndBarUpdatedL(TInt aNewSignalValue, TInt aNewBarValue);
       
    58 
       
    59 public:
       
    60 
       
    61     void HandleMsvSessionReadyL(CMsvSession& aMsvSession);
       
    62     void HandleMsvSessionClosedL();
       
    63 
       
    64 public:
       
    65 
       
    66     /**
       
    67      *   The messaging server sends notifications of changes in the
       
    68      *   observed entry to COutboxObserver by calling this method.
       
    69      */
       
    70     void
       
    71         HandleEntryEventL(TMsvEntryEvent aEvent, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/);
       
    72 
       
    73 public:
       
    74     // New functions
       
    75 
       
    76     /**
       
    77      *  Informs the networkstatus to Outbox Sender
       
    78      */
       
    79     void InformOutboxSenderL(const TInt& aNetworkBars);
       
    80 
       
    81 private:
       
    82 
       
    83     /**
       
    84      *   A C++ constructor.
       
    85      */
       
    86     COutboxObserver();
       
    87 
       
    88     /**
       
    89      *   By default Symbian OS constructor is private.
       
    90      */
       
    91     void ConstructL();
       
    92 
       
    93     /**
       
    94      *   By default, prohibit copy constructor
       
    95      */
       
    96     COutboxObserver(const COutboxObserver&);
       
    97 
       
    98     /**
       
    99      *   Prohibit assigment operator
       
   100      */
       
   101     COutboxObserver& operator=(const COutboxObserver&);
       
   102 
       
   103     /**
       
   104      * Creates the Msv Session and sets the outbox 
       
   105      * observer and outbox sender.
       
   106      * @param aMsvSession The Msv session to use.
       
   107      */
       
   108     void StartSessionsL(CMsvSession& aMsvSession);
       
   109 
       
   110     /**
       
   111      *   Delete session, outbox observer and outbox sender.
       
   112      */
       
   113     void EndSessions();
       
   114 
       
   115 private:
       
   116     // In-box folder entry. Note that the entry is not owned by this class.
       
   117     CMsvEntry* iOutboxFolder;
       
   118     // Pointer to Outbox Sender.
       
   119     COutboxSender* iOutboxSender;
       
   120     // Signal strength handler. Owned.
       
   121     MSignalStrengthHandler* iSignalStrengthHandler;
       
   122 };
       
   123 
       
   124 #endif      // OUTBOXOBSERVER_H
       
   125 // End of File