13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 // System includes |
18 #include <ecom/implementationproxy.h> |
19 #include <ecom/implementationproxy.h> |
19 #include <eikenv.h> |
20 #include <eikenv.h> |
20 #include <sendui.h> |
21 #include <sendui.h> |
21 #include <SendUiConsts.h> |
22 #include <SendUiConsts.h> |
22 |
|
23 #include <mcsmenuutils.h> |
|
24 #include <mcsmenuitem.h> |
|
25 |
|
26 #include <viewcli.h> // For CVwsSessionWrapper |
23 #include <viewcli.h> // For CVwsSessionWrapper |
27 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
28 #include <viewclipartner.h> |
25 #include <viewclipartner.h> |
29 #endif |
26 #endif |
30 |
27 |
31 #include <vwsdef.h> // For TVwsViewId |
28 #include <vwsdef.h> // For TVwsViewId |
|
29 #include <mcsmenuutils.h> |
|
30 #include <mcsmenuitem.h> |
32 #include <mcspluginparamval.h> |
31 #include <mcspluginparamval.h> |
33 #include <LogsUiCmdStarter.h> |
32 #include <LogsUiCmdStarter.h> |
34 |
33 |
|
34 // User includes |
35 #include "mcsplugincompletedoperation.h" |
35 #include "mcsplugincompletedoperation.h" |
36 #include "mcspluginhandler.h" |
36 #include "mcspluginhandler.h" |
37 #include "mcspluginuids.hrh" |
37 #include "mcspluginuids.hrh" |
38 |
38 |
39 #include "aiscutdefs.h" |
39 // Constants |
40 class CVwsSessionWrapper; |
|
41 |
|
42 _LIT( KMenuTypeShortcut, "menu:shortcut" ); ///< Menu folder type. |
40 _LIT( KMenuTypeShortcut, "menu:shortcut" ); ///< Menu folder type. |
43 _LIT( KMenuAttrParamLogs, "logs:dialed" ); |
41 _LIT( KMenuAttrParamLogs, "logs:dialed" ); |
44 |
42 |
45 /** Argument value for parameter*/ |
43 /** Argument value for parameter*/ |
46 _LIT( KMenuAttrParam, "param" ); |
44 _LIT( KMenuAttrParam, "param" ); |
47 |
45 |
|
46 #define KMCSCmailUidValue 0x2001E277 |
|
47 #define KMCSCmailMailboxViewIdValue 0x2 |
|
48 #define KMCSCmailMtmUidValue 0x2001F406 |
|
49 |
48 const TInt KImplUidMCSPluginHandler = AI_UID_ECOM_IMPLEMENTATION_MCSPLUGIN_HANDLER; |
50 const TInt KImplUidMCSPluginHandler = AI_UID_ECOM_IMPLEMENTATION_MCSPLUGIN_HANDLER; |
49 |
51 |
50 const TImplementationProxy ImplementationTable[] = |
52 const TImplementationProxy ImplementationTable[] = |
51 { |
53 { |
52 IMPLEMENTATION_PROXY_ENTRY( KImplUidMCSPluginHandler, CMCSPluginHandler::NewL) |
54 IMPLEMENTATION_PROXY_ENTRY( KImplUidMCSPluginHandler, CMCSPluginHandler::NewL) |
59 // --------------------------------------------------------- |
61 // --------------------------------------------------------- |
60 // |
62 // |
61 CMCSPluginHandler::~CMCSPluginHandler() |
63 CMCSPluginHandler::~CMCSPluginHandler() |
62 { |
64 { |
63 delete iVwsSession; |
65 delete iVwsSession; |
|
66 delete iMsvSession; |
64 } |
67 } |
65 |
68 |
66 // --------------------------------------------------------- |
69 // --------------------------------------------------------- |
67 // CMCSPluginHandler::NewL |
70 // CMCSPluginHandler::NewL |
68 // --------------------------------------------------------- |
71 // --------------------------------------------------------- |
92 // |
95 // |
93 void CMCSPluginHandler::ConstructL() |
96 void CMCSPluginHandler::ConstructL() |
94 { |
97 { |
95 BaseConstructL(); |
98 BaseConstructL(); |
96 iVwsSession = CVwsSessionWrapper::NewL(); |
99 iVwsSession = CVwsSessionWrapper::NewL(); |
|
100 iMsvSession = CMsvSession::OpenAsObserverL(*this); |
97 } |
101 } |
98 |
102 |
99 // --------------------------------------------------------- |
103 // --------------------------------------------------------- |
100 // Supported menu item types |
104 // Supported menu item types |
101 // --------------------------------------------------------- |
105 // --------------------------------------------------------- |
148 User::Leave ( KErrNotSupported ); |
152 User::Leave ( KErrNotSupported ); |
149 } |
153 } |
150 return NULL; |
154 return NULL; |
151 } |
155 } |
152 |
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // From class MMsvSessionObserver. |
|
159 // Handles an event from the message server. |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 void CMCSPluginHandler::HandleSessionEventL( |
|
163 TMsvSessionEvent /*aEvent*/, |
|
164 TAny* /*aArg1*/, |
|
165 TAny* /*aArg2*/, |
|
166 TAny* /*aArg3*/ ) |
|
167 { |
|
168 // No event handling |
|
169 } |
|
170 |
153 // --------------------------------------------------------- |
171 // --------------------------------------------------------- |
154 // Handles menu:shortcut specific commands |
172 // Handles menu:shortcut specific commands |
155 // Must be extended to launch e.g. MailBoxes |
173 // Must be extended to launch e.g. MailBoxes |
156 // caiscuttargetmessagingview.cpp implements the mailbox launching in old shortcut plugin |
174 // caiscuttargetmessagingview.cpp implements the mailbox launching in old shortcut plugin |
157 // --------------------------------------------------------- |
175 // --------------------------------------------------------- |
185 { |
203 { |
186 sendUi->CreateAndSendMessageL(KSenduiMtmUniMessageUid, NULL, KNullUid, EFalse); |
204 sendUi->CreateAndSendMessageL(KSenduiMtmUniMessageUid, NULL, KNullUid, EFalse); |
187 } |
205 } |
188 else if ( param == KParamValueEmail ) // New email |
206 else if ( param == KParamValueEmail ) // New email |
189 { |
207 { |
190 sendUi->CreateAndSendMessageL( KSenduiMtmSmtpUid, NULL, KNullUid, EFalse ); |
208 if ( GetEmailAccountCountL() > 0 ) |
|
209 { |
|
210 sendUi->CreateAndSendMessageL( KSenduiMtmSmtpUid, NULL, KNullUid, EFalse ); |
|
211 } |
|
212 else |
|
213 { |
|
214 iVwsSession->StartApp( TUid::Uid( KMCSCmailUidValue ) ); |
|
215 } |
|
216 |
191 } |
217 } |
192 #ifdef __SYNCML_DS_EMAIL |
218 #ifdef __SYNCML_DS_EMAIL |
193 else if ( param == KParamValueSyncMLMail ) // New SyncML mail |
219 else if ( param == KParamValueSyncMLMail ) // New SyncML mail |
194 { |
220 { |
195 sendUi->CreateAndSendMessageL( KSenduiMtmSyncMLEmailUid, NULL, KNullUid, EFalse ); |
221 sendUi->CreateAndSendMessageL( KSenduiMtmSyncMLEmailUid, NULL, KNullUid, EFalse ); |
213 { |
239 { |
214 TInt number; |
240 TInt number; |
215 TLex16 lextmp( mailboxId ); |
241 TLex16 lextmp( mailboxId ); |
216 lextmp.Val( number ); |
242 lextmp.Val( number ); |
217 TUid uId = TUid::Uid( number ); |
243 TUid uId = TUid::Uid( number ); |
218 const TVwsViewId viewId( KScutMessagingUid, KScutRemoteMailboxViewId ); |
244 const TVwsViewId viewId( TUid::Uid( KMCSCmailUidValue ), TUid::Uid( KMCSCmailMailboxViewIdValue ) ); |
219 iVwsSession->CreateActivateViewEvent( viewId, uId, KNullDesC8() ); |
245 iVwsSession->CreateActivateViewEvent( viewId, uId, KNullDesC8() ); |
220 } |
246 } |
221 } |
247 } |
222 else if ( param.Find( KMenuAttrParamLogs ) != KErrNotFound ) |
248 else if ( param.Find( KMenuAttrParamLogs ) != KErrNotFound ) |
223 { |
249 { |
224 LogsUiCmdStarter::CmdStartL( LogsUiCmdStarterConsts::KDialledView() ); |
250 LogsUiCmdStarter::CmdStartL( LogsUiCmdStarterConsts::KDialledView() ); |
225 } |
251 } |
226 CleanupStack::PopAndDestroy( sendUi ); |
252 CleanupStack::PopAndDestroy( sendUi ); |
|
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // Returns count of Email accounts |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 TInt CMCSPluginHandler::GetEmailAccountCountL() |
|
260 { |
|
261 CMsvEntry* rootEntry = iMsvSession->GetEntryL( KMsvRootIndexEntryIdValue ); |
|
262 CleanupStack::PushL(rootEntry); |
|
263 |
|
264 TInt cnt = rootEntry->Count(); |
|
265 if ( cnt > 0 ) |
|
266 { |
|
267 cnt = 0; |
|
268 rootEntry->SetSortTypeL( TMsvSelectionOrdering( |
|
269 KMsvGroupByType | KMsvGroupByStandardFolders, |
|
270 EMsvSortByDetailsReverse, ETrue ) ); |
|
271 |
|
272 for ( TInt i = rootEntry->Count(); --i >= 0; ) |
|
273 { |
|
274 const TMsvEntry& tentry = (*rootEntry)[i]; |
|
275 |
|
276 if (tentry.iMtm.iUid == KMCSCmailMtmUidValue ) |
|
277 { |
|
278 cnt++; |
|
279 } |
|
280 } |
|
281 } |
|
282 CleanupStack::PopAndDestroy(rootEntry); |
|
283 return cnt; |
227 } |
284 } |
228 |
285 |
229 // ============================ GLOBAL FUNCTIONS =============================== |
286 // ============================ GLOBAL FUNCTIONS =============================== |
230 |
287 |
231 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
288 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |