24 #include "ccappmycard.hrh" |
24 #include "ccappmycard.hrh" |
25 #include <spbcontactdatamodel.h> |
25 #include <spbcontactdatamodel.h> |
26 #include <ccappmycardpluginrsc.rsg> |
26 #include <ccappmycardpluginrsc.rsg> |
27 #include <Pbk2UIControls.rsg> |
27 #include <Pbk2UIControls.rsg> |
28 #include <data_caging_path_literals.hrh> |
28 #include <data_caging_path_literals.hrh> |
29 #include <phonebook2.mbg> |
|
30 #include <mccappengine.h> |
29 #include <mccappengine.h> |
31 #include <bautils.h> |
30 #include <bautils.h> |
32 #include <AknsUtils.h> |
31 #include <AknsUtils.h> |
33 #include <AiwServiceHandler.h> |
32 #include <AiwServiceHandler.h> |
34 #include <MVPbkContactLink.h> |
33 #include <MVPbkContactLink.h> |
46 #include <StringLoader.h> |
45 #include <StringLoader.h> |
47 #include <AknQueryDialog.h> |
46 #include <AknQueryDialog.h> |
48 #include <mccapppluginparameter.h> |
47 #include <mccapppluginparameter.h> |
49 #include <mccaparameter.h> |
48 #include <mccaparameter.h> |
50 #include <CVPbkContactManager.h> |
49 #include <CVPbkContactManager.h> |
|
50 #include <MVPbkFieldType.h> |
|
51 #include <TVPbkFieldVersitProperty.h> |
51 |
52 |
52 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
53 // Constants |
54 // Constants |
54 // --------------------------------------------------------------------------- |
55 // --------------------------------------------------------------------------- |
55 |
56 |
56 /// MyCard own resource file |
57 /// MyCard own resource file |
57 _LIT( KMyCardResourceFileName, "ccappmycardpluginrsc.rsc" ); |
58 _LIT( KMyCardResourceFileName, "ccappmycardpluginrsc.rsc" ); |
58 |
|
59 _LIT( KMyCardIconFileName, "\\resource\\apps\\phonebook2.mif"); |
|
60 /// Phonebook2 UI controls resource file |
59 /// Phonebook2 UI controls resource file |
61 _LIT( KMyCardPbk2UiControlsResFileName, "pbk2uicontrols.rsc" ); |
60 _LIT( KMyCardPbk2UiControlsResFileName, "pbk2uicontrols.rsc" ); |
62 // pbk2 common ui |
61 // pbk2 common ui |
63 _LIT( KPbk2CommonUiDllResFileName, "Pbk2CommonUi.rsc" ); |
62 _LIT( KPbk2CommonUiDllResFileName, "Pbk2CommonUi.rsc" ); |
64 // pbk2 commands |
63 // pbk2 commands |
253 { |
252 { |
254 CCA_DP(KMyCardLogFile, CCA_L("->CCCAppMyCardPlugin::ProvideBitmapL()")); |
253 CCA_DP(KMyCardLogFile, CCA_L("->CCCAppMyCardPlugin::ProvideBitmapL()")); |
255 |
254 |
256 if ( ECCAppTabIcon == aIconType ) |
255 if ( ECCAppTabIcon == aIconType ) |
257 { |
256 { |
258 CFbsBitmap* bmp = NULL; |
257 // CCA expects to always receive real icons. MyCard does not have |
259 CFbsBitmap* bmpMask = NULL; |
258 // tab icon defined, so provide some dummy icons. |
260 |
259 aIcon.SetBitmap( new(ELeave) CFbsBitmap ); |
261 // TODO: Change icon |
260 aIcon.SetMask( new(ELeave) CFbsBitmap ); |
262 AknsUtils::CreateIconL( |
|
263 AknsUtils::SkinInstance(), |
|
264 KAknsIIDDefault,//todo; get a proper skin |
|
265 bmp, |
|
266 bmpMask, |
|
267 KMyCardIconFileName, |
|
268 EMbmPhonebook2Qgn_prop_pb_photo_tab3, |
|
269 EMbmPhonebook2Qgn_prop_pb_photo_tab3_mask ); |
|
270 |
|
271 aIcon.SetBitmap( bmp ); |
|
272 aIcon.SetMask( bmpMask ); |
|
273 } |
261 } |
274 |
262 |
275 CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardPlugin::ProvideBitmapL()")); |
263 CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardPlugin::ProvideBitmapL()")); |
276 } |
264 } |
277 |
265 |
287 } |
275 } |
288 return NULL; |
276 return NULL; |
289 } |
277 } |
290 |
278 |
291 // --------------------------------------------------------------------------- |
279 // --------------------------------------------------------------------------- |
292 // CCCAppMyCardPlugin::DynInitMenuPaneL |
|
293 // --------------------------------------------------------------------------- |
|
294 // |
|
295 void CCCAppMyCardPlugin::DynInitMenuPaneL( |
|
296 TInt /*aResourceId*/, |
|
297 CEikMenuPane* /*aMenuPane*/ ) |
|
298 { |
|
299 // TODO: menupane handling |
|
300 } |
|
301 |
|
302 // --------------------------------------------------------------------------- |
|
303 // CCCAppMyCardPlugin::HandleCommandL |
280 // CCCAppMyCardPlugin::HandleCommandL |
304 // --------------------------------------------------------------------------- |
281 // --------------------------------------------------------------------------- |
305 // |
282 // |
306 void CCCAppMyCardPlugin::HandleCommandL( TInt aCommand ) |
283 void CCCAppMyCardPlugin::HandleCommandL( TInt aCommand ) |
307 { |
284 { |
308 CCA_DP(KMyCardLogFile, |
285 CCA_DP(KMyCardLogFile, |
309 CCA_L("->CCCAppMyCardPlugin::HandleCommandL command=%d"), aCommand ); |
286 CCA_L("->CCCAppMyCardPlugin::HandleCommandL command=%d"), aCommand ); |
310 |
287 |
311 switch( aCommand ) |
288 switch( aCommand ) |
312 { |
289 { |
313 case ECCAppMyCardCmdEdit: |
290 case ECCAppMyCardCmdEdit: |
314 { |
291 { |
315 // when editor is called via options menu, focus first field always |
292 TInt index; |
316 EditL( iMyCard->PresentationContactL(). |
293 MVPbkStoreContact& storeContact = iMyCard->StoreContact(); |
317 PresentationFields().StoreIndexOfField( 0 ) ); |
294 |
|
295 TRAPD( err, |
|
296 { |
|
297 index = iMyCard->PresentationContactL().PresentationFields().StoreIndexOfField( 0 ); |
|
298 |
|
299 MVPbkBaseContactField* field = storeContact.Fields().FieldAtLC( index ); |
|
300 |
|
301 const MVPbkFieldType* type = field->BestMatchingFieldType(); |
|
302 const TArray<TVPbkFieldVersitProperty> fieldProperty = type->VersitProperties(); |
|
303 |
|
304 if( fieldProperty.Count() ) |
|
305 { |
|
306 const TVPbkFieldVersitProperty property = fieldProperty[0]; |
|
307 |
|
308 if( property.Name() == EVPbkVersitNameADR ) |
|
309 { |
|
310 index = KErrNotSupported; |
|
311 } |
|
312 } |
|
313 |
|
314 if( field ) |
|
315 { |
|
316 CleanupStack::PopAndDestroy( field ); |
|
317 } |
|
318 |
|
319 EditL( index ); |
|
320 } ); |
|
321 |
|
322 if( err != KErrNone ) |
|
323 { |
|
324 HandleError( err ); |
|
325 } |
318 break; |
326 break; |
319 } |
327 } |
320 case ECCappMyCardCmdSendVCard: |
328 case ECCappMyCardCmdSendVCard: |
321 { |
329 { |
322 SendBusinessCardL(); |
330 SendBusinessCardL(); |