13 * |
13 * |
14 * Description: Handles publishing to title pane. |
14 * Description: Handles publishing to title pane. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 // System includes |
19 #include <eikbtgpc.h> |
19 #include <eikbtgpc.h> |
20 #include <aknappui.h> |
20 #include <aknappui.h> |
21 #include <StringLoader.h> |
21 #include <StringLoader.h> |
22 #include <AiNativeUi.rsg> |
|
23 #include <gulicon.h> |
22 #include <gulicon.h> |
24 #include <AknIconUtils.h> |
23 #include <AknIconUtils.h> |
25 #include <AknsConstants.h> |
24 #include <AknsConstants.h> |
26 #include <aknlayoutscalable_avkon.cdl.h> |
25 #include <aknlayoutscalable_avkon.cdl.h> |
27 #include <AknStatuspaneUtils.h> |
26 #include <AknStatuspaneUtils.h> |
28 #include <layoutmetadata.cdl.h> |
27 #include <layoutmetadata.cdl.h> |
29 #include <AknUtils.h> |
28 #include <AknUtils.h> |
30 #include <eiksoftkeyimage.h> |
29 #include <eiksoftkeyimage.h> |
31 #include <AknSgcc.h> |
30 #include <AknSgcc.h> |
32 #include <aiscutplugindomaincrkeys.h> |
31 |
|
32 // User includes |
|
33 #include <hscontentpublisher.h> |
|
34 #include <hspublisherinfo.h> |
|
35 |
|
36 #include <AiNativeUi.rsg> |
33 |
37 |
34 #include "ainativeui.hrh" |
38 #include "ainativeui.hrh" |
35 #include "aisoftkeyrenderer.h" |
39 #include "aisoftkeyrenderer.h" |
36 #include "ainativeuiplugins.h" |
40 #include "ainativeuiplugins.h" |
37 #include "aiscutdefs.h" |
|
38 |
|
39 |
41 |
40 using namespace AiNativeUiController; |
42 using namespace AiNativeUiController; |
41 |
43 |
|
44 // Constants |
42 // Index for left softkey; defined in avkon |
45 // Index for left softkey; defined in avkon |
43 const TInt KNativeUiLeftSoftkeyId = 0; |
46 //const TInt KNativeUiLeftSoftkeyId = 0; |
44 |
47 |
45 // Index for right softkey; defined in avkon |
48 // Index for right softkey; defined in avkon |
46 const TInt KNativeUiRightSoftkeyId = 2; |
49 //const TInt KNativeUiRightSoftkeyId = 2; |
47 |
50 |
48 const TInt KControlArrayCBAButton1Posn =0; |
51 const TInt KControlArrayCBAButton1Posn =0; |
49 const TInt KControlArrayCBAButton2Posn =2; |
52 const TInt KControlArrayCBAButton2Posn =2; |
50 const TInt KControlArrayCBAButtonMiddlePosn =3; |
53 const TInt KControlArrayCBAButtonMiddlePosn =3; |
51 |
54 |
52 const TInt KWideScreenWidth = 640; |
55 const TInt KWideScreenWidth = 640; |
53 |
56 |
54 |
57 // ======== LOCAL FUNCTIONS ======== |
55 inline TAknWindowComponentLayout DoCompose( TAknWindowComponentLayout aLine1, |
58 inline TAknWindowComponentLayout DoCompose( TAknWindowComponentLayout aLine1, |
56 TAknWindowComponentLayout aLine2 ) |
59 TAknWindowComponentLayout aLine2 ) |
57 { |
60 { |
58 return TAknWindowComponentLayout::Compose( aLine1, aLine2 ); |
61 return TAknWindowComponentLayout::Compose( aLine1, aLine2 ); |
59 } |
62 } |
418 TSize size( SoftkeyRectL( aContainer, aPos, aImageOn ).Size() ); |
421 TSize size( SoftkeyRectL( aContainer, aPos, aImageOn ).Size() ); |
419 |
422 |
420 return size; |
423 return size; |
421 } |
424 } |
422 |
425 |
423 |
426 // ======== MEMBER FUNCTIONS ======== |
|
427 // ---------------------------------------------------------------------------- |
|
428 // CAiSoftKeyRenderer::ConstructL() |
|
429 // |
|
430 // ---------------------------------------------------------------------------- |
|
431 // |
424 void CAiSoftKeyRenderer::ConstructL() |
432 void CAiSoftKeyRenderer::ConstructL() |
425 { |
433 { |
426 // load default soft key labels from resource |
434 // load default soft key labels from resource |
427 CreateDefaultSoftKeysL(); |
435 CreateDefaultSoftKeysL(); |
428 } |
436 } |
429 |
437 |
430 |
438 // ---------------------------------------------------------------------------- |
|
439 // CAiSoftKeyRenderer::NewLC() |
|
440 // |
|
441 // ---------------------------------------------------------------------------- |
|
442 // |
431 CAiSoftKeyRenderer* CAiSoftKeyRenderer::NewLC() |
443 CAiSoftKeyRenderer* CAiSoftKeyRenderer::NewLC() |
432 { |
444 { |
433 CAiSoftKeyRenderer* self = new( ELeave ) CAiSoftKeyRenderer(); |
445 CAiSoftKeyRenderer* self = new( ELeave ) CAiSoftKeyRenderer(); |
434 CleanupStack::PushL( self ); |
446 CleanupStack::PushL( self ); |
435 self->ConstructL(); |
447 self->ConstructL(); |
436 return self; |
448 return self; |
437 } |
449 } |
438 |
450 |
439 |
451 // ---------------------------------------------------------------------------- |
|
452 // CAiSoftKeyRenderer::~CAiSoftKeyRenderer() |
|
453 // |
|
454 // ---------------------------------------------------------------------------- |
|
455 // |
440 CAiSoftKeyRenderer::~CAiSoftKeyRenderer() |
456 CAiSoftKeyRenderer::~CAiSoftKeyRenderer() |
441 { |
457 { |
442 delete iText; |
458 delete iText; |
443 |
459 |
444 if ( iCba ) |
460 if ( iCba ) |
448 iAppUi->RemoveFromStack( cba ); |
464 iAppUi->RemoveFromStack( cba ); |
449 } |
465 } |
450 delete iCba; |
466 delete iCba; |
451 } |
467 } |
452 |
468 |
453 |
469 // ---------------------------------------------------------------------------- |
|
470 // CAiSoftKeyRenderer::CAiSoftKeyRenderer() |
|
471 // |
|
472 // ---------------------------------------------------------------------------- |
|
473 // |
454 CAiSoftKeyRenderer::CAiSoftKeyRenderer() |
474 CAiSoftKeyRenderer::CAiSoftKeyRenderer() |
455 { |
475 { |
456 iAppUi = iAvkonAppUi; |
476 iAppUi = iAvkonAppUi; |
457 } |
477 } |
458 |
478 |
459 |
479 // ---------------------------------------------------------------------------- |
460 |
480 // CAiSoftKeyRenderer::DoPublishL() |
461 |
481 // |
462 void CAiSoftKeyRenderer::DoPublishL( MAiPropertyExtension& aPlugin, |
482 // ---------------------------------------------------------------------------- |
463 TInt aContent, |
483 // |
464 const TDesC16& aText, |
484 void CAiSoftKeyRenderer::DoPublishL( CHsContentPublisher& /*aPlugin*/, |
465 TInt aIndex ) |
485 TInt /*aContent*/, const TDesC16& /*aText*/, TInt /*aIndex*/ ) |
466 { |
486 { |
467 if( aPlugin.PublisherInfoL()->iUid == KShortcutPluginUid ) |
487 User::Leave( KErrNotFound ); |
468 { |
488 } |
469 if( aContent == KAiScutContent[EAiScutContentShortcutShortCaption].id ) |
489 |
470 { |
490 // ---------------------------------------------------------------------------- |
471 HBufC* temp = aText.AllocL(); |
491 // CAiSoftKeyRenderer::DoPublishL() |
472 delete iText; |
492 // |
473 iText = temp; |
493 // ---------------------------------------------------------------------------- |
474 |
494 // |
475 UpdateSoftKeyL( aIndex, NULL ); |
495 void CAiSoftKeyRenderer::DoPublishL( CHsContentPublisher& /*aPlugin*/, |
476 } |
496 TInt /*aContent*/, TInt /*aResource*/, TInt /*aIndex*/ ) |
477 } |
497 { |
478 else |
498 User::Leave( KErrNotFound ); |
479 { |
499 } |
480 User::Leave( KErrNotFound ); |
500 |
481 } |
501 // ---------------------------------------------------------------------------- |
482 } |
502 // CAiSoftKeyRenderer::DoPublishL() |
483 |
503 // |
484 |
504 // ---------------------------------------------------------------------------- |
485 void CAiSoftKeyRenderer::DoPublishL( MAiPropertyExtension& aPlugin, |
505 // |
486 TInt aContent, |
506 void CAiSoftKeyRenderer::DoPublishL( CHsContentPublisher& /*aPlugin*/, |
487 TInt aResource, |
507 TInt /*aContent*/, const TDesC8& /*aBuf*/, TInt /*aIndex*/ ) |
488 TInt aIndex ) |
508 { |
489 { |
509 User::Leave( KErrNotFound ); |
490 if( aPlugin.PublisherInfoL()->iUid == KShortcutPluginUid ) |
510 } |
491 { |
511 |
492 if( aContent == KAiScutContent[EAiScutContentShortcutShortCaption].id ) |
512 // ---------------------------------------------------------------------------- |
493 { |
513 // CAiSoftKeyRenderer::CreateDefaultSoftKeysL() |
494 TInt internalId = KErrNotFound; |
514 // |
495 switch( aResource ) |
515 // ---------------------------------------------------------------------------- |
496 { |
516 // |
497 case EAiScutResourceBackCaption: |
|
498 { |
|
499 internalId = R_NATIVEUI_SK_BACK; |
|
500 break; |
|
501 } |
|
502 case EAiScutResourceNewMsgShortCaption: |
|
503 { |
|
504 internalId = R_NATIVEUI_SK_NEWMSG; |
|
505 break; |
|
506 } |
|
507 case EAiScutResourceNewEmailShortCaption: |
|
508 { |
|
509 internalId = R_NATIVEUI_SK_EMAIL; |
|
510 break; |
|
511 } |
|
512 case EAiScutResourceNewSyncMLMailShortCaption: |
|
513 { |
|
514 internalId = R_NATIVEUI_SK_SYNCMLMAIL; |
|
515 break; |
|
516 } |
|
517 case EAiScutResourceNewPostcardShortCaption: |
|
518 { |
|
519 internalId = R_NATIVEUI_SK_MMSPOSTCARD; |
|
520 break; |
|
521 } |
|
522 case EAiScutResourceSelectMsgTypeShortCaption: |
|
523 { |
|
524 internalId = R_NATIVEUI_SK_MSGTYPE; |
|
525 break; |
|
526 } |
|
527 case EAiScutResourceNewAudioMsgShortCaption: |
|
528 { |
|
529 internalId = R_NATIVEUI_SK_AUDIOMSG; |
|
530 break; |
|
531 } |
|
532 case EAiScutResourceChangeThemeShortCaption: |
|
533 { |
|
534 internalId = R_NATIVEUI_SK_CHANGETHEME; |
|
535 break; |
|
536 } |
|
537 default: |
|
538 { |
|
539 User::Leave( KErrNotFound ); |
|
540 } |
|
541 } |
|
542 |
|
543 HBufC* temp = StringLoader::LoadL( internalId ); |
|
544 delete iText; |
|
545 iText = temp; |
|
546 |
|
547 UpdateSoftKeyL( aIndex, NULL ); |
|
548 } |
|
549 } |
|
550 else |
|
551 { |
|
552 User::Leave( KErrNotFound ); |
|
553 } |
|
554 } |
|
555 |
|
556 |
|
557 void CAiSoftKeyRenderer::DoPublishL( MAiPropertyExtension& aPlugin, |
|
558 TInt aContent, |
|
559 const TDesC8& aBuf, |
|
560 TInt aIndex ) |
|
561 { |
|
562 if( aPlugin.PublisherInfoL()->iUid == KShortcutPluginUid ) |
|
563 { |
|
564 if( aContent == KAiScutContent[EAiScutContentShortcutSkIcon].id ) |
|
565 { |
|
566 CGulIcon* icon = NULL; |
|
567 TPckg<CGulIcon*>( icon ).Copy( aBuf ); |
|
568 // icon ownership is transferred |
|
569 UpdateSoftKeyL( aIndex, icon ); |
|
570 } |
|
571 else |
|
572 { |
|
573 User::Leave( KErrNotSupported ); |
|
574 } |
|
575 } |
|
576 else |
|
577 { |
|
578 User::Leave( KErrNotFound ); |
|
579 } |
|
580 } |
|
581 |
|
582 |
|
583 void CAiSoftKeyRenderer::CreateDefaultSoftKeysL() |
517 void CAiSoftKeyRenderer::CreateDefaultSoftKeysL() |
584 { |
518 { |
585 // If we already have cba, then do nothing. |
519 // If we already have cba, then do nothing. |
586 if ( iCba ) |
520 if ( iCba ) |
587 { |
521 { |
609 iAppUi->AddToStackL( cba, |
543 iAppUi->AddToStackL( cba, |
610 KNativeUiCbaPriority, |
544 KNativeUiCbaPriority, |
611 ECoeStackFlagRefusesFocus | ECoeStackFlagRefusesAllKeys ); |
545 ECoeStackFlagRefusesFocus | ECoeStackFlagRefusesAllKeys ); |
612 } |
546 } |
613 |
547 |
614 |
548 // ---------------------------------------------------------------------------- |
615 void CAiSoftKeyRenderer::UpdateSoftKeyL( TInt aKey, CGulIcon* aIcon ) |
549 // CAiSoftKeyRenderer::UpdateSoftKeyL() |
|
550 // |
|
551 // ---------------------------------------------------------------------------- |
|
552 // |
|
553 void CAiSoftKeyRenderer::UpdateSoftKeyL( TInt /*aKey*/, CGulIcon* /*aIcon*/ ) |
616 { |
554 { |
617 if( !iCba ) |
555 if( !iCba ) |
618 { |
556 { |
619 iCba = iAppUi->Cba(); |
557 iCba = iAppUi->Cba(); |
620 } |
558 } |
621 |
559 |
622 // remove the locked flag if any |
560 // remove the locked flag if any |
623 aKey &= KScutBitMaskLocked; |
561 // NOTE ai_shortcut_command_api has been removed! |
624 |
562 //aKey &= KScutBitMaskLocked; |
625 TInt buttonPosImage; |
563 |
|
564 /*TInt buttonPosImage; |
626 TInt buttonPosText; |
565 TInt buttonPosText; |
627 TInt buttonCmd; |
566 TInt buttonCmd; |
628 |
567 |
629 if( aKey == KLeftSoftkeyId ) |
568 if( aKey == KLeftSoftkeyId ) |
630 { |
569 { |