|
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 * When the phone mode is changed from offline to online mode, this class |
|
16 * sends the messages in outbox, that are in suspended or failed state |
|
17 * because of the offline mode. When phone is changed from online to |
|
18 * offline mode, the currently running sending operation will be |
|
19 * cancelled. |
|
20 * |
|
21 */ |
|
22 |
|
23 |
|
24 |
|
25 #ifndef __COUTBOXSENDOPERATION_H__ |
|
26 #define __COUTBOXSENDOPERATION_H__ |
|
27 |
|
28 // INCLUDES |
|
29 #include <msvapi.h> |
|
30 #include <MuiuMsvSingleOpWatcher.h> |
|
31 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CMsvEntrySelection; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Sends messages from Outbox when user selects "Start" in Outbox. |
|
40 */ |
|
41 class COutboxSendOperation : public CMsvOperation |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * A two-phased constructor. |
|
47 */ |
|
48 static COutboxSendOperation* NewL( |
|
49 CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus); |
|
50 |
|
51 /** |
|
52 * A destructor. |
|
53 */ |
|
54 virtual ~COutboxSendOperation(); |
|
55 |
|
56 /** |
|
57 * Returns the current operation. |
|
58 */ |
|
59 virtual const TDesC8& ProgressL(); |
|
60 |
|
61 private: |
|
62 |
|
63 /** |
|
64 * A C++ constructor |
|
65 */ |
|
66 COutboxSendOperation( |
|
67 CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus); |
|
68 |
|
69 /** |
|
70 * Creates the sending operation session. |
|
71 */ |
|
72 void ConstructL(); |
|
73 |
|
74 private: // Functions from base classes |
|
75 |
|
76 /** |
|
77 * Cancels sending operation. |
|
78 */ |
|
79 void DoCancel(); |
|
80 |
|
81 /** |
|
82 * Keeps the message sending operaion active until all |
|
83 * messages are sent. |
|
84 */ |
|
85 void RunL(); |
|
86 |
|
87 /** |
|
88 * Handles the runtime error events |
|
89 */ |
|
90 TInt RunError( TInt aError ); |
|
91 |
|
92 private: // New functions |
|
93 |
|
94 /** |
|
95 * Starts sending operation for next selection. |
|
96 */ |
|
97 void StartSendingL(); |
|
98 |
|
99 /** |
|
100 * Sets the selected messages to sending state. |
|
101 */ |
|
102 void SendWaitingSMSMessages(); |
|
103 |
|
104 /** |
|
105 * Sets the selected messages to sending state. |
|
106 */ |
|
107 void SendWaitingSMSMessagesL(); |
|
108 |
|
109 /** |
|
110 * Creates selection of spesified type of messages in outbox |
|
111 */ |
|
112 void CreateSelectionL( |
|
113 const TUid& aUidForSel, |
|
114 const TMsvId& aServiceId, |
|
115 CMsvEntrySelection*& aSelection ); |
|
116 |
|
117 /** |
|
118 * Checks if MTM is available and creates selection |
|
119 */ |
|
120 TBool CheckAndCreateSelectionL(); |
|
121 |
|
122 /** |
|
123 * Completes operation and cancels notify |
|
124 */ |
|
125 void CompleteObserver( TInt aStatus ); |
|
126 |
|
127 /** |
|
128 * Deletes the selection |
|
129 */ |
|
130 void RemoveSelection(); |
|
131 |
|
132 /** |
|
133 * Checks if there is need to continue sending operation |
|
134 */ |
|
135 TBool IsSendingNeeded( TUid& aMtm ) const; |
|
136 |
|
137 /** |
|
138 * Removes the sending flag |
|
139 */ |
|
140 void RemoveSendingFlag( const TUid& aMtm ); |
|
141 |
|
142 /** |
|
143 * Complete own request |
|
144 */ |
|
145 void CompleteSelf( TInt aValue ); |
|
146 |
|
147 |
|
148 private: // Data |
|
149 enum |
|
150 { |
|
151 ESupportsSmsSending = 0x01, |
|
152 ESendSms = 0x10, |
|
153 }; |
|
154 |
|
155 // Selection queue |
|
156 CArrayPtrFlat<CMsvEntrySelection> iSelections; |
|
157 // Services selection |
|
158 CMsvEntrySelection iServices; |
|
159 // Pointer to Msv Operation |
|
160 CMsvOperation* iOperation; |
|
161 // Entry pointer |
|
162 CMsvEntry* iEntry; |
|
163 // Supported message types |
|
164 TUint iSupportedMsgs; |
|
165 }; |
|
166 |
|
167 |
|
168 #endif // __COUTBOXSENDOPERATION_H__ |
|
169 |
|
170 // End of file |