|
1 /* |
|
2 * Copyright (c) 2006 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CATALOGSSMSSENDER_H |
|
20 #define C_CATALOGSSMSSENDER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <msvapi.h> // MMsvSessionObserver |
|
24 |
|
25 |
|
26 class CCatalogsSmsOperation; |
|
27 class CMsvSession; |
|
28 class CClientMtmRegistry; |
|
29 class CSmsClientMtm; |
|
30 |
|
31 /** |
|
32 * SMS sender class |
|
33 */ |
|
34 class CCatalogsSmsSender : public CActive, public MMsvSessionObserver |
|
35 { |
|
36 public: |
|
37 |
|
38 static CCatalogsSmsSender* NewL( CCatalogsSmsOperation& aObserver ); |
|
39 |
|
40 ~CCatalogsSmsSender(); |
|
41 |
|
42 public: |
|
43 /** |
|
44 * Start the operation |
|
45 * |
|
46 * @param aRecipient Message recipient |
|
47 * @param aBody Message body |
|
48 */ |
|
49 void StartL( const TDesC& aRecipient, const TDesC& aBody ); |
|
50 |
|
51 /** |
|
52 * Cancels the operation and removes any created messages |
|
53 */ |
|
54 void CancelOperation(); |
|
55 |
|
56 protected: // From CActive |
|
57 |
|
58 void RunL(); |
|
59 |
|
60 void DoCancel(); |
|
61 |
|
62 TInt RunError( TInt aError ); |
|
63 |
|
64 |
|
65 protected: // Constructor |
|
66 |
|
67 CCatalogsSmsSender( CCatalogsSmsOperation& aObserver ); |
|
68 |
|
69 private: // from MMsvSessionObserver |
|
70 |
|
71 void HandleSessionEventL( TMsvSessionEvent aEvent, |
|
72 TAny* aArg1, TAny* aArg2, TAny* aArg3 ); |
|
73 |
|
74 |
|
75 private: |
|
76 |
|
77 void CreateMessageL(); |
|
78 void SendMessageL(); |
|
79 void FinishMessageL(); |
|
80 void DeleteMessageL(); |
|
81 void Cleanup(); |
|
82 |
|
83 |
|
84 private: |
|
85 |
|
86 enum TCatalogsSmsState |
|
87 { |
|
88 ECatalogsSmsStateIdle = 0, |
|
89 ECatalogsSmsStateSessionReady, |
|
90 ECatalogsSmsStateStarting, |
|
91 ECatalogsSmsStateMoving, |
|
92 ECatalogsSmsStateSending, |
|
93 ECatalogsSmsStateDeletingSchedule, |
|
94 ECatalogsSmsStateDeletingMessage, |
|
95 ECatalogsSmsStateDone |
|
96 }; |
|
97 |
|
98 private: |
|
99 |
|
100 CCatalogsSmsOperation& iObserver; |
|
101 |
|
102 CMsvSession* iSession; |
|
103 CClientMtmRegistry* iMtmRegistry; |
|
104 |
|
105 HBufC* iRecipient; |
|
106 HBufC* iBody; |
|
107 |
|
108 // This represents an entry in the Message Server index |
|
109 TMsvEntry iMsvEntry; |
|
110 CSmsClientMtm* iSmsMtm; |
|
111 CMsvEntry* iParentEntry; |
|
112 CMsvOperation* iOp; |
|
113 CMsvEntrySelection* iSelection; |
|
114 |
|
115 TCatalogsSmsState iSmsState; |
|
116 TBool iCancelled; |
|
117 TMsvId iMovedId; |
|
118 TMsvSendState iSendState; |
|
119 }; |
|
120 |
|
121 #endif // C_CATALOGSSMSSENDER_H |