sipplugins/sippsipsettingsui/src/sipsettingscontainer.cpp
changeset 15 8248b03a2669
parent 0 307788aac0a8
equal deleted inserted replaced
0:307788aac0a8 15:8248b03a2669
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include    <aknlists.h>
    20 #include    <aknlists.h>
    21 #include    <csxhelp/cp.hlp.hrh>
    21 #include    <cshelp/conset.hlp.hrh>
    22 #include    <gsfwviewuids.h>
    22 #include    <gsfwviewuids.h>
    23 #include    <gssipsettingspluginrsc.rsg>
    23 #include    <gssipsettingspluginrsc.rsg>
    24 #include    <gssipsettingsplugin.mbg>
    24 #include    <gssipsettingsplugin.mbg>
    25 #include    <AknIconArray.h>
    25 #include    <AknIconArray.h>
    26 #include    <aknsutils.h>     //for loading icons
    26 #include    <AknsUtils.h>     //for loading icons
    27 #include    <akntitle.h>
    27 #include    <akntitle.h>
    28 #include    <eikspane.h>
    28 #include    <eikspane.h>
    29 #include     <aknnavi.h>
    29 #include     <aknnavi.h>
    30 #include    <stringloader.h>
    30 #include    <StringLoader.h>
    31 #include    "sipsettingscontainer.h"
    31 #include    "sipsettingscontainer.h"
    32 #include    "sipsettingsmodel.h"
    32 #include    "sipsettingsmodel.h"
    33 #include    "sipsettingsplugin.h"
    33 #include    "sipsettingsplugin.h"
    34 #include    "gssippluginlogger.h"
    34 #include    "gssippluginlogger.h"
    35 
    35 
   241       static_cast<CAknNavigationControlContainer*> 
   241       static_cast<CAknNavigationControlContainer*> 
   242           (sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi ) ) );
   242           (sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi ) ) );
   243     naviContainer->PushDefaultL();
   243     naviContainer->PushDefaultL();
   244 
   244 
   245     CreateWindowL();
   245     CreateWindowL();
   246     iLongTapDetector = CAknLongTapDetector::NewL( this );
       
   247     
       
   248     SetLongPress( EFalse );
       
   249 
       
   250     // Initialize list box outlook    
   246     // Initialize list box outlook    
   251     iListBox = new ( ELeave ) CListBox;
   247     iListBox = new ( ELeave ) CListBox;
   252     iListBox->SetContainerWindowL( *this );
   248     iListBox->SetContainerWindowL( *this );
   253     iListBox->ConstructL( this, EAknListBoxSelectionList );
   249     iListBox->ConstructL( this, EAknListBoxSelectionList );
   254     
   250     
   309          aModel->NumOfProfiles() > 0 )
   305          aModel->NumOfProfiles() > 0 )
   310         {
   306         {
   311         iListBox->SetCurrentItemIndex( aActiveIndex );
   307         iListBox->SetCurrentItemIndex( aActiveIndex );
   312         }
   308         }
   313 
   309 
   314     iTimer = CGSSIPTimer::NewL( *this, *(iListBox->View()->ItemDrawer()) );
       
   315     
       
   316     iStylusPopupMenu = NULL;
       
   317     
   310     
   318     DrawNow();
   311     DrawNow();
   319     __GSLOGSTRING("CSIPSettingsContainer::ConstructL End" )
   312     __GSLOGSTRING("CSIPSettingsContainer::ConstructL End" )
   320     }
   313     }
   321 
   314 
   326 //
   319 //
   327 CSIPSettingsContainer::~CSIPSettingsContainer()
   320 CSIPSettingsContainer::~CSIPSettingsContainer()
   328     {
   321     {
   329     __GSLOGSTRING("CSIPSettingsContainer::~CSIPSettingsContainer" )
   322     __GSLOGSTRING("CSIPSettingsContainer::~CSIPSettingsContainer" )
   330     delete iListBox;    
   323     delete iListBox;    
   331     delete iLongTapDetector;
       
   332     iLongTapDetector = NULL;
       
   333     delete iStylusPopupMenu;
       
   334     iStylusPopupMenu = NULL;
       
   335     delete iTimer;
       
   336     iTimer = NULL;
       
   337     }
   324     }
   338 
   325 
   339 // -----------------------------------------------------------------------------
   326 // -----------------------------------------------------------------------------
   340 // CSIPSettingsContainer::CurrentIndex()
   327 // CSIPSettingsContainer::CurrentIndex()
   341 // Returns the current active index from the list box
   328 // Returns the current active index from the list box
   461 TKeyResponse CSIPSettingsContainer::OfferKeyEventL( 
   448 TKeyResponse CSIPSettingsContainer::OfferKeyEventL( 
   462     const TKeyEvent& aKeyEvent,
   449     const TKeyEvent& aKeyEvent,
   463     TEventCode aType )
   450     TEventCode aType )
   464     {   
   451     {   
   465     __GSLOGSTRING("CSIPSettingsContainer::OfferKeyEventL" )
   452     __GSLOGSTRING("CSIPSettingsContainer::OfferKeyEventL" )
   466     if ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow )
       
   467         {
       
   468         iListBox->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
       
   469 
       
   470         iTimer->StartTimer();
       
   471 
       
   472         }
       
   473 
       
   474     if ( aType == EEventKey && aKeyEvent.iCode == EKeyBackspace )
   453     if ( aType == EEventKey && aKeyEvent.iCode == EKeyBackspace )
   475         {
   454         {
   476          iObs->HandleCommandL( EGSCmdAppDelete );
   455          iObs->HandleCommandL( EGSCmdAppDelete );
   477          return EKeyWasConsumed;
   456          return EKeyWasConsumed;
   478            }
   457            }
   492     CCoeControl::FocusChanged( aDrawNow );
   471     CCoeControl::FocusChanged( aDrawNow );
   493     if( iListBox )
   472     if( iListBox )
   494         {
   473         {
   495         iListBox->SetFocus( IsFocused(), aDrawNow );
   474         iListBox->SetFocus( IsFocused(), aDrawNow );
   496         }
   475         }
   497        iTimer -> StopTimer();
       
   498           
       
   499     }
   476     }
   500 
   477 
   501 // ---------------------------------------------------------------------------
   478 // ---------------------------------------------------------------------------
   502 // CSIPSettingsContainer::HandleResourceChange
   479 // CSIPSettingsContainer::HandleResourceChange
   503 // Resource change handling
   480 // Resource change handling
   530     aContext.iMajor = KUidGS;
   507     aContext.iMajor = KUidGS;
   531     aContext.iContext = KSIP_HLP_MAIN;
   508     aContext.iContext = KSIP_HLP_MAIN;
   532     }  
   509     }  
   533 
   510 
   534 // -----------------------------------------------------------------------------
   511 // -----------------------------------------------------------------------------
   535 // CSIPSettingsContainer::HandleLongTapEventL()
       
   536 // Responds to Long Tap Event
       
   537 // -----------------------------------------------------------------------------
       
   538 //
       
   539 void CSIPSettingsContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /*aPenEventScreenLocation*/ )
       
   540     {
       
   541      __GSLOGSTRING("CSIPSettingsContainer::HandleLongTapEventL" )
       
   542    
       
   543     iPoint = aPenEventLocation;
       
   544         
       
   545     delete iStylusPopupMenu;
       
   546     iStylusPopupMenu = NULL;
       
   547          
       
   548     iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , PenEventLocation() ); 
       
   549     TResourceReader reader;  
       
   550     iCoeEnv->CreateResourceReaderLC( reader, R_STYLUS_POPUP_MENU ); 
       
   551     iStylusPopupMenu->ConstructFromResourceL( reader );  
       
   552     CleanupStack::PopAndDestroy(); 
       
   553  
       
   554     iStylusPopupMenu->ShowMenu();  
       
   555     iStylusPopupMenu->SetPosition( PenEventLocation() );
       
   556     SetLongPress( ETrue );
       
   557     }
       
   558 
       
   559 // -----------------------------------------------------------------------------
       
   560 // CSIPSettingsContainer::HandleLongTapEventL()
       
   561 // Responds to Long Tap Event
       
   562 // -----------------------------------------------------------------------------
       
   563 //
       
   564 TPoint CSIPSettingsContainer::PenEventLocation()
       
   565     {
       
   566      return iPoint;
       
   567     }
       
   568 
       
   569 // -----------------------------------------------------------------------------
       
   570 // CSIPSettingsContainer::ProcessCommandL()
   512 // CSIPSettingsContainer::ProcessCommandL()
   571 // Handle ProcessCommandL
   513 // Handle ProcessCommandL
   572 // -----------------------------------------------------------------------------
   514 // -----------------------------------------------------------------------------
   573 //
   515 //
   574 void CSIPSettingsContainer::ProcessCommandL( TInt aCommand )
   516 void CSIPSettingsContainer::ProcessCommandL( TInt aCommand )
   575     {
   517     {
   576     __GSLOGSTRING1("CSIPSettingsContainer::ProcessCommandL aCommand: %d", aCommand)
   518     __GSLOGSTRING1("CSIPSettingsContainer::ProcessCommandL aCommand: %d", aCommand)
   577     switch( aCommand )    
   519     switch( aCommand )    
   578         {
   520         {
   579         case EGSCmdAppEdit:
       
   580             iObs->EditProfileL();
       
   581         break;
       
   582         
       
   583         case EGSCmdAppDelete:
   521         case EGSCmdAppDelete:
   584             iObs->DeleteProfileL();
   522             iObs->DeleteProfileL();
   585         break;
   523         break;
   586         
   524         
   587         case EGSCmdAppDefault:
   525         case EGSCmdAppDefault:
   588             iObs->ChangeDefaultProfileL();                
   526             iObs->ChangeDefaultProfileL();                
   589         default:
   527         default:
   590         break;
   528         break;
   591         }
   529         }
   592     }
   530     }
   593 
       
   594 // -----------------------------------------------------------------------------
       
   595 // CSIPSettingsContainer::HandlePointerEventL()
       
   596 // Responds to a Pointer Event.
       
   597 // -----------------------------------------------------------------------------
       
   598 //
       
   599 void CSIPSettingsContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   600     {
       
   601     __GSLOGSTRING("CSIPSettingsContainer::HandlePointerEventL" )
       
   602       iListBox->View()->ItemDrawer()->ClearFlags( CTextListItemDrawer::EDisableHighlight );
       
   603       DrawNow();   
       
   604       iPointerEvent = aPointerEvent;
       
   605       CCoeControl::HandlePointerEventL( aPointerEvent );
       
   606     }
       
   607 
       
   608 // -----------------------------------------------------------------------------
       
   609 // CSIPSettingsContainer::IfPointerEvent()
       
   610 // Check if it is Pointer Event.
       
   611 // -----------------------------------------------------------------------------
       
   612 //
       
   613 TBool CSIPSettingsContainer::IfPointerEvent()
       
   614     {
       
   615     __GSLOGSTRING("CSIPSettingsContainer::IfPointerEvent" )
       
   616      return !( iTimer->IsStarted() );
       
   617     }
       
   618 
       
   619 void CSIPSettingsContainer::SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ )
   531 void CSIPSettingsContainer::SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ )
   620     {
   532     {
   621      
   533      
   622     }
   534     }
   623 
   535 
   624 
       
   625 // -----------------------------------------------------------------------------
       
   626 // CSIPSettingsContainer::LongPressStatus()
       
   627 // Check if Long Press happen.
       
   628 // -----------------------------------------------------------------------------
       
   629 //
       
   630 TBool CSIPSettingsContainer::LongPressStatus()
       
   631     {
       
   632     return iLongPress;
       
   633     }
       
   634 
       
   635 // -----------------------------------------------------------------------------
       
   636 // CSIPSettingsContainer::SetLongPress()
       
   637 // Set Long Press.
       
   638 // -----------------------------------------------------------------------------
       
   639 //
       
   640 void CSIPSettingsContainer::SetLongPress(TBool aLongPress )
       
   641     {
       
   642     __GSLOGSTRING("CSIPSettingsContainer::SetLongPress" )
       
   643     this->iLongPress = aLongPress;
       
   644     }
       
   645 
       
   646 
       
   647 CAknLongTapDetector* CSIPSettingsContainer::LongTapDetector()
       
   648 	{
       
   649 	return iLongTapDetector;
       
   650 	}
       
   651 
       
   652 
       
   653 TPointerEvent CSIPSettingsContainer::PointerEvent()
       
   654 	{
       
   655 	return iPointerEvent;
       
   656 	}
       
   657 
       
   658 
       
   659 //  End of File  
   536 //  End of File