|
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 * The purpose of this class is to observe if there are messages |
|
16 * in the outbox. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef NCNOUTBOXOBSERVER_H |
|
24 #define NCNOUTBOXOBSERVER_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include <msvapi.h> // for MMsvSessionObserver |
|
29 #include "MNcnMsvSessionHandlerObserver.h" |
|
30 #include "MNcnSignalStrengthObserver.h" |
|
31 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CNcnModelBase; |
|
35 class CMsvSession; |
|
36 class CNcnOutboxSender; |
|
37 class MNcnSignalStrengthHandler; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Observes if there are messages in the OutBox.. |
|
43 */ |
|
44 class CNcnOutboxObserver : |
|
45 public CBase, public MMsvEntryObserver, public MNcnMsvSessionHandlerObserver, |
|
46 public MNcnSignalStrengthObserver |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * A Two-phased constructor. |
|
52 */ |
|
53 static CNcnOutboxObserver* NewL( CNcnModelBase* aModel ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CNcnOutboxObserver(); |
|
59 |
|
60 private: // From MNcnSignalStrengthObserver |
|
61 |
|
62 void SignalStrengthAndBarUpdatedL( TInt aNewSignalValue, TInt aNewBarValue ); |
|
63 |
|
64 public: // From MNcnMsvSessionHandlerObserver |
|
65 |
|
66 void HandleMsvSessionReadyL( CMsvSession& aMsvSession ); |
|
67 void HandleMsvSessionClosedL(); |
|
68 |
|
69 public: // Functions from base classes |
|
70 |
|
71 /** |
|
72 * The messaging server sends notifications of changes in the |
|
73 * observed entry to CNcnOutboxObserver by calling this method. |
|
74 */ |
|
75 void HandleEntryEventL( |
|
76 TMsvEntryEvent aEvent, TAny* /*aArg1*/, |
|
77 TAny* /*aArg2*/, TAny* /*aArg3*/ ); |
|
78 |
|
79 |
|
80 |
|
81 public: // New functions |
|
82 |
|
83 /** |
|
84 * Informs the networkstatus to Outbox Sender |
|
85 */ |
|
86 void InformOutboxSenderL( const TInt& aNetworkBars ); |
|
87 |
|
88 private: |
|
89 |
|
90 /** |
|
91 * A C++ constructor. |
|
92 */ |
|
93 CNcnOutboxObserver( CNcnModelBase* aModel ); |
|
94 |
|
95 /** |
|
96 * By default Symbian OS constructor is private. |
|
97 */ |
|
98 void ConstructL(); |
|
99 |
|
100 /** |
|
101 * By default, prohibit copy constructor |
|
102 */ |
|
103 CNcnOutboxObserver( const CNcnOutboxObserver& ); |
|
104 |
|
105 /** |
|
106 * Prohibit assigment operator |
|
107 */ |
|
108 CNcnOutboxObserver& operator= ( const CNcnOutboxObserver& ); |
|
109 |
|
110 private: // New functions |
|
111 |
|
112 /** |
|
113 * Checks if any items found from outbox and turns the indicator |
|
114 * ON/OFF accordingly. |
|
115 */ |
|
116 void CheckOutboxAndNotifyL(); |
|
117 |
|
118 /** |
|
119 * Creates the Msv Session and sets the outbox |
|
120 * observer and outbox sender. |
|
121 * @param aMsvSession The Msv session to use. |
|
122 */ |
|
123 void StartSessionsL( CMsvSession& aMsvSession ); |
|
124 |
|
125 /** |
|
126 * Delete session, outbox observer and outbox sender. |
|
127 */ |
|
128 void EndSessions(); |
|
129 |
|
130 private: // Data |
|
131 |
|
132 // A pointer to the event monitor object. |
|
133 CNcnModelBase* iModel; |
|
134 // In-box folder entry. Note that the entry is not owned by this class. |
|
135 CMsvEntry* iOutboxFolder; |
|
136 // Pointer to Outbox Sender. |
|
137 CNcnOutboxSender* iOutboxSender; |
|
138 |
|
139 // Signal strength handler. Owned. |
|
140 MNcnSignalStrengthHandler* iSignalStrengthHandler; |
|
141 }; |
|
142 |
|
143 #endif // NCNOUTBOXOBSERVER_H |
|
144 |
|
145 // End of File |