|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: Declaration of CPushLoadServiceOp. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PUSHLOADSERVICEOP_H |
|
21 #define PUSHLOADSERVICEOP_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 |
|
25 //#include "PushMtmOperation.h" |
|
26 #include "PushMtmUiOperation.h" |
|
27 #include <e32base.h> |
|
28 #include <e32std.h> |
|
29 #include <apparc.h> |
|
30 #include <AknServerApp.h> |
|
31 // FORWARD DECLARATIONS |
|
32 |
|
33 class CSchemeHandler; |
|
34 class CPushMsgEntryBase; |
|
35 class CPushMtmSettings; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * This asynchronous operation is responsible for downloading service that is |
|
41 * indicated by the URL field of the pushed service message. It means that it |
|
42 * is applicable only for SI and SL pushed messages. |
|
43 * The operation uses the Scheme Handler to launch the appropriate handler |
|
44 * application for the given URL. |
|
45 */ |
|
46 class CPushLoadServiceOp : public CPushMtmUiOperation, |
|
47 public MAknServerAppExitObserver |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. Leaves on failure. |
|
53 * @param aSession Message Server Session to be used by this operation. |
|
54 * @param aEntryId Id of entry to operate on. |
|
55 * @param aObserverStatus Observer's status. |
|
56 * @return The constructed object. |
|
57 */ |
|
58 static CPushLoadServiceOp* NewL( CMsvSession& aSession, |
|
59 TMsvId aEntryId, |
|
60 TRequestStatus& aObserverStatus ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CPushLoadServiceOp(); |
|
66 |
|
67 public: // Functions from CPushMtmOperation |
|
68 |
|
69 /** |
|
70 * Start or restart the operation. The expiration state of the entry |
|
71 * is checked (of course only in case of SI) and if it is expired, |
|
72 * then the entry is deleted and the operation is cancelled. |
|
73 * @return None. |
|
74 */ |
|
75 void StartL(); |
|
76 |
|
77 protected: // Constructors |
|
78 |
|
79 /** |
|
80 * Constructor. |
|
81 * @param aSession Message Server Session to be used by this operation. |
|
82 * @param aEntryId Id of entry to operate on. |
|
83 * @param aObserverStatus Observer's status. |
|
84 */ |
|
85 CPushLoadServiceOp( CMsvSession& aSession, |
|
86 TMsvId aEntryId, |
|
87 TRequestStatus& aObserverStatus ); |
|
88 |
|
89 /** |
|
90 * Symbian OS constructor. |
|
91 */ |
|
92 void ConstructL(); |
|
93 |
|
94 protected: // New functions |
|
95 |
|
96 /** |
|
97 * Check the expiration state of the context. It is SI specific. |
|
98 * In case of other push messages it returns EFalse. |
|
99 * @return ETrue or EFalse. |
|
100 */ |
|
101 TBool IsExpiredL( const TMsvEntry& aTEntry ) const; |
|
102 |
|
103 /** |
|
104 * Retrieve the context and get the URL from the context. |
|
105 * @param aUrl The URL filled from the context. |
|
106 * @return The context entry. |
|
107 */ |
|
108 CPushMsgEntryBase* RetrieveContextAndGetUrlLC( TPtrC& aUrl ) const; |
|
109 |
|
110 /** |
|
111 * Authenticate the message and display user query if necessary. |
|
112 * @param aPushMsg The push message to be authenticated. |
|
113 * @param aMtmSettings The push settings. |
|
114 * @return ETrue if the message is authenticated. |
|
115 */ |
|
116 TBool AuthenticateL( const CPushMsgEntryBase& aPushMsg, |
|
117 const CPushMtmSettings& aMtmSettings ) const; |
|
118 |
|
119 /** |
|
120 * Execute a query which asks the user if (s)he wants to download |
|
121 * the service anyway. |
|
122 * @param aResId Resource to be used. |
|
123 * @return ETrue, if the user wants to download it. |
|
124 */ |
|
125 TBool ExecuteUserQueryL( TInt aResId ) const; |
|
126 |
|
127 /** |
|
128 * If no scheme exists in the URL, then "http://" is insetred. |
|
129 * @param aUrl The original URL. |
|
130 * @return The validated URL. |
|
131 */ |
|
132 HBufC* ValidateLC( TDesC& aUrl ) const; |
|
133 |
|
134 protected: // Functions from base classes |
|
135 |
|
136 /** |
|
137 * If the operation was not cancelled in StartL, then it extracts |
|
138 * the URL from the message and launches the Document Handler to |
|
139 * execute the proper handler for the scheme. |
|
140 * @return None. |
|
141 */ |
|
142 void RunL(); |
|
143 |
|
144 /** |
|
145 * Cancel protocol implementation. |
|
146 */ |
|
147 void DoCancel(); |
|
148 |
|
149 /** |
|
150 * It calls CPushMtmOperation::RunError( aError ). |
|
151 */ |
|
152 TInt RunError( TInt aError ); |
|
153 |
|
154 void HandleServerAppExit(TInt aReason); |
|
155 |
|
156 private: |
|
157 |
|
158 TMsvEntry iTEntry; ///< Current context. |
|
159 TBool iDone; ///< Indicates that the operation is ready. |
|
160 CSchemeHandler* iSchemeHandler; ///< Handles the URL. Owned. |
|
161 }; |
|
162 |
|
163 #endif // PUSHLOADSERVICEOP_H |
|
164 |
|
165 // End of file. |