sipplugins/sippsipsettingsui/src/sipsettingscontainer.cpp
changeset 0 307788aac0a8
child 1 dd3853b8dc3f
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005 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 "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:  Container for SIPSettings view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    <aknlists.h>
       
    21 #include    <csxhelp/cp.hlp.hrh>
       
    22 #include    <gsfwviewuids.h>
       
    23 #include    <gssipsettingspluginrsc.rsg>
       
    24 #include    <gssipsettingsplugin.mbg>
       
    25 #include    <AknIconArray.h>
       
    26 #include    <aknsutils.h>     //for loading icons
       
    27 #include    <akntitle.h>
       
    28 #include    <eikspane.h>
       
    29 #include     <aknnavi.h>
       
    30 #include    <stringloader.h>
       
    31 #include    "sipsettingscontainer.h"
       
    32 #include    "sipsettingsmodel.h"
       
    33 #include    "sipsettingsplugin.h"
       
    34 #include    "gssippluginlogger.h"
       
    35 
       
    36 #include    "barsread.h"
       
    37 
       
    38 // LOCAL CONSTANTS AND MACROS
       
    39 
       
    40 const TInt KNumberOfControls = 1;
       
    41 const TInt KControlListBox = 0;
       
    42 const TInt KUnknownListBoxIndex = -1;
       
    43 const TInt KGranularity = 1;
       
    44 
       
    45 
       
    46 // MODULE DATA STRUCTURES
       
    47 
       
    48 /**
       
    49  * Listbox item drawer for CSIPSettingsContainer.
       
    50  */
       
    51 class CSIPSettingsContainer::CItemDrawer : 
       
    52         public CFormattedCellListBoxItemDrawer
       
    53     {
       
    54     public: // interface
       
    55         /**
       
    56          * Constructor.
       
    57          */
       
    58         inline CItemDrawer( MTextListBoxModel* aTextListBoxModel, 
       
    59                 const CFont* aFont, 
       
    60                 CFormattedCellListBoxData* aFormattedCellData );
       
    61 
       
    62         /**
       
    63          * Sets iMod to aModel.
       
    64          */
       
    65         inline void SetModel( CSIPSettingsModel& aModel );
       
    66 
       
    67     private: // From CListItemDrawer returns list item properties
       
    68         TListItemProperties Properties( TInt aItemIndex ) const;
       
    69 
       
    70     private: // data members
       
    71         // Ref: array of SIP Settings.
       
    72         CSIPSettingsModel* iMod;        
       
    73     };
       
    74 
       
    75 /**
       
    76  * Listbox for CSIPSettingsContainer
       
    77  */
       
    78 class CSIPSettingsContainer::CListBox : public CAknDoubleGraphicStyleListBox
       
    79     {
       
    80     public: // constructor
       
    81         inline CListBox();
       
    82         inline CItemDrawer* ItemDrawer() const;
       
    83         inline void SetIconArray( CArrayPtr<CGulIcon>* aIconArray );
       
    84         inline CArrayPtr<CGulIcon>* IconArray();
       
    85     public: // from CEikFormattedCellListBox
       
    86         void CreateItemDrawerL();
       
    87 
       
    88     };
       
    89 
       
    90 // ================= MEMBER FUNCTIONS =======================
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CSIPSettingsContainer::CItemDrawer::CItemDrawer
       
    94 // C++ default constructor can NOT contain any code, that
       
    95 // might leave.
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 inline
       
    99 CSIPSettingsContainer::CItemDrawer::CItemDrawer
       
   100         ( MTextListBoxModel* aTextListBoxModel, 
       
   101         const CFont* aFont, 
       
   102         CFormattedCellListBoxData* aFormattedCellData ) :
       
   103     CFormattedCellListBoxItemDrawer(
       
   104         aTextListBoxModel, 
       
   105         aFont, 
       
   106         aFormattedCellData )
       
   107     {
       
   108     __GSLOGSTRING("CSIPSettingsContainer::CItemDrawer::CItemDrawer" )
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CSIPSettingsContainer::CItemDrawer::SetModel
       
   113 // Sets model for underlining default sip profile.
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 inline
       
   117 void CSIPSettingsContainer::CItemDrawer::SetModel( CSIPSettingsModel& aModel )
       
   118     {
       
   119     iMod = &aModel;
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CSIPSettingsContainer::CItemDrawer::Properties
       
   124 // Gets list box item properties.
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TListItemProperties CSIPSettingsContainer::CItemDrawer::Properties(
       
   128     TInt aItemIndex ) const
       
   129     {
       
   130     __GSLOGSTRING("CSIPSettingsContainer::CItemDrawer::Properties" )
       
   131     TListItemProperties result = 
       
   132         CFormattedCellListBoxItemDrawer::Properties( aItemIndex );
       
   133     
       
   134     if ( iMod && ( aItemIndex == iMod->DefaultProfileIndex() ) )
       
   135         {
       
   136         result.SetUnderlined(ETrue);        
       
   137         }
       
   138 
       
   139     return result;
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CSIPSettingsContainer::CListBox::CListBox
       
   144 // C++ default constructor can NOT contain any code, that
       
   145 // might leave.
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 inline
       
   149 CSIPSettingsContainer::CListBox::CListBox()
       
   150     {
       
   151     __GSLOGSTRING("CSIPSettingsContainer::CListBox::CListBox" )
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CSIPSettingsContainer::CListBox::ItemDrawer
       
   156 // Gets the object used by this list box view to draw its items.
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 inline
       
   160 CSIPSettingsContainer::CItemDrawer* 
       
   161     CSIPSettingsContainer::CListBox::ItemDrawer(  ) const
       
   162     {
       
   163     return static_cast<CSIPSettingsContainer::CItemDrawer*>(
       
   164         CAknDoubleGraphicStyleListBox::ItemDrawer() );
       
   165     }
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // CSIPSettingsContainer::CListBox::SetIconArray
       
   169 // Sets the icon array used when drawing bitmaps.
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 inline
       
   173 void CSIPSettingsContainer::CListBox::SetIconArray(
       
   174     CArrayPtr<CGulIcon>* aIconArray )
       
   175     {
       
   176     ItemDrawer()->ColumnData()->SetIconArray( aIconArray );
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CSIPSettingsContainer::CListBox::IconArray
       
   181 // Queries the icon array used when drawing bitmaps for the listbox items.
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 inline
       
   185 CArrayPtr<CGulIcon>* CSIPSettingsContainer::CListBox::IconArray()
       
   186     {
       
   187     return ItemDrawer()->ColumnData()->IconArray();
       
   188     }
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // CSIPSettingsContainer::CListBox::CreateItemDrawerL
       
   192 // Chooses which itemdrawer to use.
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 void CSIPSettingsContainer::CListBox::CreateItemDrawerL()
       
   196     {
       
   197     __GSLOGSTRING("CSIPSettingsContainer::CListBox::CreateItemDrawerL" )
       
   198     CFormattedCellListBoxData* formattedData = CFormattedCellListBoxData::NewL();
       
   199     CleanupStack::PushL( formattedData );
       
   200     iItemDrawer = new(ELeave) CSIPSettingsContainer::CItemDrawer(
       
   201         Model(),
       
   202         iEikonEnv->NormalFont(),
       
   203         formattedData );
       
   204     CleanupStack::Pop( formattedData );
       
   205     }
       
   206 
       
   207 // -----------------------------------------------------------------------------
       
   208 // CSIPSettingsContainer::CSIPSettingsContainer
       
   209 // C++ default constructor can NOT contain any code, that
       
   210 // might leave.
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 CSIPSettingsContainer::CSIPSettingsContainer( CSIPSettingsPlugin* aObserver )
       
   214     : iObs( aObserver )
       
   215     {
       
   216     __GSLOGSTRING("CSIPSettingsContainer::CSIPSettingsContainer" )
       
   217     }
       
   218 
       
   219 // -----------------------------------------------------------------------------
       
   220 // CSIPSettingsContainer::ConstructL
       
   221 // Symbian 2nd phase constructor can leave.
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 void CSIPSettingsContainer::ConstructL(
       
   225     const TRect& aRect, 
       
   226     TInt aActiveIndex,
       
   227     CSIPSettingsModel* aModel )
       
   228     {
       
   229     __GSLOGSTRING("CSIPSettingsContainer::ConstructL Start" )
       
   230     // Change the text on the title pane
       
   231     HBufC* titleBuf = StringLoader::LoadLC( R_QTN_APP_CAPTION_STRING );
       
   232     
       
   233     CEikStatusPane* sp = iAvkonAppUi->StatusPane();
       
   234     CAknTitlePane* title = static_cast<CAknTitlePane*>( 
       
   235         sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   236     title->SetTextL( *titleBuf );
       
   237     CleanupStack::PopAndDestroy( titleBuf );
       
   238 
       
   239        // Set navipane to default
       
   240     CAknNavigationControlContainer* naviContainer = 
       
   241       static_cast<CAknNavigationControlContainer*> 
       
   242           (sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi ) ) );
       
   243     naviContainer->PushDefaultL();
       
   244 
       
   245     CreateWindowL();
       
   246     iLongTapDetector = CAknLongTapDetector::NewL( this );
       
   247     
       
   248     SetLongPress( EFalse );
       
   249 
       
   250     // Initialize list box outlook    
       
   251     iListBox = new ( ELeave ) CListBox;
       
   252     iListBox->SetContainerWindowL( *this );
       
   253     iListBox->ConstructL( this, EAknListBoxSelectionList );
       
   254     
       
   255     iListBox->View()->ItemDrawer()->SetFlags( CTextListItemDrawer::ESingleClickEnabled );
       
   256     
       
   257     CAknIconArray* icons = new (ELeave) CAknIconArray( KGranularity );
       
   258     CleanupStack::PushL( icons );
       
   259 
       
   260     // locked icon
       
   261     CGulIcon* iconLocked = AknsUtils::CreateGulIconL(
       
   262         AknsUtils::SkinInstance(), 
       
   263         KAknsIIDQgnIndiSettProtectedAdd, 
       
   264         KGSDefaultSIPIconFileName,
       
   265         EMbmGssipsettingspluginQgn_prop_sip_locked, 
       
   266         EMbmGssipsettingspluginQgn_prop_sip_locked );
       
   267     
       
   268     CleanupStack::PushL( iconLocked );
       
   269     icons->AppendL( iconLocked );        
       
   270     CleanupStack::Pop( iconLocked );
       
   271     
       
   272     // empty icon
       
   273     CGulIcon* iconEmpty = AknsUtils::CreateGulIconL(
       
   274         AknsUtils::SkinInstance(), 
       
   275         KAknsIIDQgnIndiSettProtectedAdd, 
       
   276         KGSDefaultSIPIconFileName,
       
   277         EMbmGssipsettingspluginEmpty13x13, 
       
   278         EMbmGssipsettingspluginEmpty13x13 );
       
   279     
       
   280     CleanupStack::PushL( iconEmpty );
       
   281     icons->AppendL( iconEmpty );        
       
   282     CleanupStack::Pop( iconEmpty );
       
   283     
       
   284     iListBox->SetIconArray( icons );
       
   285     CleanupStack::Pop( icons );
       
   286 
       
   287     iListBox->ItemDrawer()->SetModel( *aModel );
       
   288 
       
   289     iListBox->CreateScrollBarFrameL( ETrue );
       
   290     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   291         CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );    
       
   292     
       
   293     // Set empty listbox's text.
       
   294     HBufC* text = iCoeEnv->AllocReadResourceLC( R_GS_SIP_NO_SIP_SETTINGS );
       
   295     iListBox->View()->SetListEmptyTextL( *text );
       
   296     CleanupStack::PopAndDestroy( text );
       
   297        
       
   298     // Set the model
       
   299     iListBox->SetListBoxObserver( iObs );
       
   300     iListBox->Model()->SetItemTextArray( aModel );
       
   301     // List box won't delete model, the Controller object will take care of it
       
   302     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   303 
       
   304     // Set limits to the view & activate it
       
   305     SetRect( aRect );
       
   306     ActivateL();
       
   307 
       
   308     if ( aActiveIndex != KUnknownListBoxIndex && 
       
   309          aModel->NumOfProfiles() > 0 )
       
   310         {
       
   311         iListBox->SetCurrentItemIndex( aActiveIndex );
       
   312         }
       
   313 
       
   314     iTimer = CGSSIPTimer::NewL( *this, *(iListBox->View()->ItemDrawer()) );
       
   315     
       
   316     iStylusPopupMenu = NULL;
       
   317     
       
   318     DrawNow();
       
   319     __GSLOGSTRING("CSIPSettingsContainer::ConstructL End" )
       
   320     }
       
   321 
       
   322 // -----------------------------------------------------------------------------
       
   323 // CSIPSettingsContainer::~CSIPSettingsContainer()
       
   324 // Destructor
       
   325 // -----------------------------------------------------------------------------
       
   326 //
       
   327 CSIPSettingsContainer::~CSIPSettingsContainer()
       
   328     {
       
   329     __GSLOGSTRING("CSIPSettingsContainer::~CSIPSettingsContainer" )
       
   330     delete iListBox;    
       
   331     delete iLongTapDetector;
       
   332     iLongTapDetector = NULL;
       
   333     delete iStylusPopupMenu;
       
   334     iStylusPopupMenu = NULL;
       
   335     delete iTimer;
       
   336     iTimer = NULL;
       
   337     }
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CSIPSettingsContainer::CurrentIndex()
       
   341 // Returns the current active index from the list box
       
   342 // -----------------------------------------------------------------------------
       
   343 //
       
   344 TInt CSIPSettingsContainer::CurrentIndex()
       
   345     {
       
   346     return iListBox->CurrentItemIndex();
       
   347     }
       
   348 
       
   349 // -----------------------------------------------------------------------------
       
   350 // CSIPSettingsContainer::ListItemModifiedL
       
   351 // Selects the existing index and redraws the view
       
   352 // -----------------------------------------------------------------------------
       
   353 //      
       
   354 void CSIPSettingsContainer::ListItemModifiedL( TInt aIndex )
       
   355     {    
       
   356     __GSLOGSTRING("CSIPSettingsContainer::ListItemModifiedL" )
       
   357     iListBox->SetCurrentItemIndex( aIndex );
       
   358     iListBox->HandleItemAdditionL();
       
   359     
       
   360     if ( iListBox->CurrentItemIndex() == KUnknownListBoxIndex )
       
   361         {
       
   362         if ( iListBox->Model()->ItemTextArray()->MdcaCount() > 0 )
       
   363             {
       
   364             iListBox->SetCurrentItemIndex( 
       
   365                 iListBox->Model()->ItemTextArray()->MdcaCount() - 1 );
       
   366             }
       
   367         }
       
   368 
       
   369     iListBox->DrawNow();
       
   370     }
       
   371 
       
   372 // -----------------------------------------------------------------------------
       
   373 // CSIPSettingsContainer::ListItemDeletedL
       
   374 // Selects the existing index and redraws the view
       
   375 // -----------------------------------------------------------------------------
       
   376 //      
       
   377 void CSIPSettingsContainer::ListItemDeletedL()
       
   378     {    
       
   379     __GSLOGSTRING("CSIPSettingsContainer::ListItemDeletedL" )
       
   380     iListBox->HandleItemRemovalL();
       
   381 
       
   382     if ( iListBox->CurrentItemIndex() == KUnknownListBoxIndex )
       
   383         {
       
   384         if ( iListBox->Model()->ItemTextArray()->MdcaCount() > 0 )
       
   385             {
       
   386             iListBox->SetCurrentItemIndex( 
       
   387                 iListBox->Model()->ItemTextArray()->MdcaCount() - 1 );
       
   388             }
       
   389         }
       
   390     
       
   391     iListBox->DrawNow();    
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 // CSIPSettingsContainer::CurrentFeatureId()
       
   396 //
       
   397 // ---------------------------------------------------------------------------
       
   398 //
       
   399 TInt CSIPSettingsContainer::CurrentFeatureId( )
       
   400     {
       
   401     return CurrentIndex();
       
   402     }
       
   403 
       
   404 // ---------------------------------------------------------------------------
       
   405 // Sets observer for MSK label updations.
       
   406 // ---------------------------------------------------------------------------
       
   407 //
       
   408 void CSIPSettingsContainer::SetMiddleSoftkeyObserver( 
       
   409     MGsFWMSKObserver* aObserver )
       
   410     {
       
   411     if ( !iMSKObserver && aObserver )
       
   412         {        
       
   413         iMSKObserver = aObserver;
       
   414         }
       
   415     }
       
   416 
       
   417 // -----------------------------------------------------------------------------
       
   418 // CSIPSettingsContainer::CountComponentControls()
       
   419 // Returns the amount of controls on the view
       
   420 // -----------------------------------------------------------------------------
       
   421 //
       
   422 TInt CSIPSettingsContainer::CountComponentControls() const
       
   423     {
       
   424     return KNumberOfControls;
       
   425     }
       
   426 
       
   427 // -----------------------------------------------------------------------------
       
   428 // CSIPSettingsContainer::ComponentControl
       
   429 // Returns list box
       
   430 // -----------------------------------------------------------------------------
       
   431 //
       
   432 CCoeControl* CSIPSettingsContainer::ComponentControl( 
       
   433     TInt aIndex ) const
       
   434     {
       
   435     __GSLOGSTRING("CSIPSettingsContainer::ComponentControl" )
       
   436     CCoeControl* cntrl = NULL;
       
   437 
       
   438     if ( aIndex == KControlListBox )
       
   439         {
       
   440         cntrl = iListBox;
       
   441         }
       
   442                                                                   
       
   443     return cntrl;
       
   444     }
       
   445 
       
   446 // -----------------------------------------------------------------------------
       
   447 // CSIPSettingsContainer::SizeChanged
       
   448 // Sets new size for the list box
       
   449 // -----------------------------------------------------------------------------
       
   450 //
       
   451 void CSIPSettingsContainer::SizeChanged()
       
   452     {
       
   453     iListBox->SetRect( Rect() );
       
   454     }
       
   455 
       
   456 // -----------------------------------------------------------------------------
       
   457 // CSIPSettingsContainer::OfferKeyEventL()
       
   458 // Handles the key events, pushes them to list box
       
   459 // -----------------------------------------------------------------------------
       
   460 //
       
   461 TKeyResponse CSIPSettingsContainer::OfferKeyEventL( 
       
   462     const TKeyEvent& aKeyEvent,
       
   463     TEventCode aType )
       
   464     {   
       
   465     __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 )
       
   475         {
       
   476          iObs->HandleCommandL( EGSCmdAppDelete );
       
   477          return EKeyWasConsumed;
       
   478            }
       
   479     
       
   480     // Pass the key event to list box
       
   481     return iListBox->OfferKeyEventL( aKeyEvent, aType );
       
   482     }
       
   483     
       
   484 // -----------------------------------------------------------------------------
       
   485 // CSIPSettingsContainer::FocusChanged()
       
   486 // Responds to a change in focus
       
   487 // -----------------------------------------------------------------------------
       
   488 //
       
   489 void CSIPSettingsContainer::FocusChanged( TDrawNow aDrawNow )
       
   490     {
       
   491     __GSLOGSTRING("CSIPSettingsContainer::FocusChanged" )
       
   492     CCoeControl::FocusChanged( aDrawNow );
       
   493     if( iListBox )
       
   494         {
       
   495         iListBox->SetFocus( IsFocused(), aDrawNow );
       
   496         }
       
   497        iTimer -> StopTimer();
       
   498           
       
   499     }
       
   500 
       
   501 // ---------------------------------------------------------------------------
       
   502 // CSIPSettingsContainer::HandleResourceChange
       
   503 // Resource change handling
       
   504 // ---------------------------------------------------------------------------
       
   505 // 
       
   506 void CSIPSettingsContainer::HandleResourceChange( TInt aType )
       
   507     {
       
   508     __GSLOGSTRING("CSIPSettingsContainer::HandleResourceChange" )
       
   509     //Handle layout orientation or skin change
       
   510     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   511         {
       
   512         TRect mainPaneRect;
       
   513         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   514                                            mainPaneRect);
       
   515         SetRect( mainPaneRect );
       
   516         }
       
   517     CCoeControl::HandleResourceChange( aType );
       
   518     }
       
   519 
       
   520 // ---------------------------------------------------------------------------
       
   521 // CSIPSettingsContainer::GetHelpContext(TCoeHelpContext& aContext) const
       
   522 // Gets Help 
       
   523 //  
       
   524 // ---------------------------------------------------------------------------
       
   525 //
       
   526 void CSIPSettingsContainer::GetHelpContext(
       
   527     TCoeHelpContext& aContext ) const
       
   528     {
       
   529     __GSLOGSTRING("CSIPSettingsContainer::GetHelpContext" )
       
   530     aContext.iMajor = KUidGS;
       
   531     aContext.iContext = KSIP_HLP_MAIN;
       
   532     }  
       
   533 
       
   534 // -----------------------------------------------------------------------------
       
   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()
       
   571 // Handle ProcessCommandL
       
   572 // -----------------------------------------------------------------------------
       
   573 //
       
   574 void CSIPSettingsContainer::ProcessCommandL( TInt aCommand )
       
   575     {
       
   576     __GSLOGSTRING1("CSIPSettingsContainer::ProcessCommandL aCommand: %d", aCommand)
       
   577     switch( aCommand )    
       
   578         {
       
   579         case EGSCmdAppEdit:
       
   580             iObs->EditProfileL();
       
   581         break;
       
   582         
       
   583         case EGSCmdAppDelete:
       
   584             iObs->DeleteProfileL();
       
   585         break;
       
   586         
       
   587         case EGSCmdAppDefault:
       
   588             iObs->ChangeDefaultProfileL();                
       
   589         default:
       
   590         break;
       
   591         }
       
   592     }
       
   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*/ )
       
   620     {
       
   621      
       
   622     }
       
   623 
       
   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