cmmanager/gsconnsettingsplugin/src/gsconnsettingsselectiondlg.cpp
branchRCL_3
changeset 45 4c83dcfb6f1a
parent 0 5a93021fdf25
equal deleted inserted replaced
36:04408506c6e0 45:4c83dcfb6f1a
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Includes
    18 // Includes
    19 #include "gsconnsettingsselectiondlg.h"
    19 #include "gsconnsettingsselectiondlg.h"
    20 #include <AknInfoPopupNoteController.h>
       
    21 #include <StringLoader.h>
    20 #include <StringLoader.h>
    22 #include <eiklbo.h>
    21 #include <eiklbo.h>
    23 #include <gulalign.h>
    22 #include <gulalign.h>
    24 
    23 
    25 #include <gsconnsettingspluginrsc.rsg>
    24 #include <gsconnsettingspluginrsc.rsg>
    32 
    31 
    33 // ---------------------------------------------------------------------------
    32 // ---------------------------------------------------------------------------
    34 // CGSConnSettingsSelectionDlg::NewL
    33 // CGSConnSettingsSelectionDlg::NewL
    35 // ---------------------------------------------------------------------------
    34 // ---------------------------------------------------------------------------
    36 //
    35 //
    37 CGSConnSettingsSelectionDlg* CGSConnSettingsSelectionDlg::NewL(TInt aResourceID, 
    36 CGSConnSettingsSelectionDlg* CGSConnSettingsSelectionDlg::NewL( TInt aResourceID, 
    38                 TInt& aCurrentSelectionIndex, 
    37                 TInt& aCurrentSelectionIndex, 
    39                 const MDesCArray* aItemArray,
    38                 const MDesCArray* aItemArray )
    40                 TInt aPopupResource)
       
    41     {
    39     {
    42     CGSConnSettingsSelectionDlg* self = new( ELeave ) CGSConnSettingsSelectionDlg(
    40     CGSConnSettingsSelectionDlg* self = new( ELeave ) CGSConnSettingsSelectionDlg(
    43                                                         aResourceID,
    41                                                         aResourceID,
    44                                                         aCurrentSelectionIndex,
    42                                                         aCurrentSelectionIndex,
    45                                                         aItemArray,
    43                                                         aItemArray );
    46                                                         aPopupResource );
       
    47     CleanupStack::PushL( self );
       
    48     self->ConstructL( aPopupResource );
       
    49     CleanupStack::Pop( self );
       
    50     return self;
    44     return self;
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CGSConnSettingsSelectionDlg::ConstructL
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 void CGSConnSettingsSelectionDlg::ConstructL( TInt aPopupResource)
       
    58     {
       
    59     iPopupController = CAknInfoPopupNoteController::NewL();
       
    60     iPopupItems = iCoeEnv->ReadDesC16ArrayResourceL( aPopupResource );
       
    61 //    ShowInfoPopupL();
       
    62     }
    45     }
    63 
    46 
    64 // ---------------------------------------------------------------------------
    47 // ---------------------------------------------------------------------------
    65 // CGSConnSettingsSelectionDlg::CGSConnSettingsSelectionDlg
    48 // CGSConnSettingsSelectionDlg::CGSConnSettingsSelectionDlg
    66 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    67 //
    50 //
    68 CGSConnSettingsSelectionDlg::CGSConnSettingsSelectionDlg(
    51 CGSConnSettingsSelectionDlg::CGSConnSettingsSelectionDlg(
    69                 TInt aResourceID, 
    52                 TInt aResourceID, 
    70                 TInt& aCurrentSelectionIndex, 
    53                 TInt& aCurrentSelectionIndex, 
    71                 const MDesCArray* aItemArray,
    54                 const MDesCArray* aItemArray )
    72                 TInt /* aPopupResource */)
       
    73         :    CAknRadioButtonSettingPage( 
    55         :    CAknRadioButtonSettingPage( 
    74                 aResourceID,
    56                 aResourceID,
    75                 aCurrentSelectionIndex,
    57                 aCurrentSelectionIndex,
    76                 aItemArray )
    58                 aItemArray )
    77     {
    59     {
    82 // CGSConnSettingsSelectionDlg::~CGSConnSettingsSelectionDlg
    64 // CGSConnSettingsSelectionDlg::~CGSConnSettingsSelectionDlg
    83 // ---------------------------------------------------------------------------
    65 // ---------------------------------------------------------------------------
    84 //
    66 //
    85 CGSConnSettingsSelectionDlg::~CGSConnSettingsSelectionDlg()
    67 CGSConnSettingsSelectionDlg::~CGSConnSettingsSelectionDlg()
    86     {
    68     {
    87     if ( iPopupController )
       
    88         {
       
    89         delete iPopupController;
       
    90         }
       
    91     
       
    92     if ( iPopupItems )
       
    93         {
       
    94         iPopupItems->Reset();
       
    95         delete iPopupItems;        
       
    96         }
       
    97     }
    69     }
    98 
    70 
    99 // ---------------------------------------------------------------------------
    71 // ---------------------------------------------------------------------------
   100 // CGSConnSettingsSelectionDlg::OfferKeyEventL
    72 // CGSConnSettingsSelectionDlg::OfferKeyEventL
   101 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
   102 //
    74 //
   103 TKeyResponse CGSConnSettingsSelectionDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType)
    75 TKeyResponse CGSConnSettingsSelectionDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType)
   104     {    
    76     {    
   105     TKeyResponse response ( EKeyWasNotConsumed );
    77     TKeyResponse response( EKeyWasNotConsumed );
   106     
       
   107     response =  CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
    78     response =  CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
   108     
       
   109     //EKeyNull enables here launching of popup note immediately when we enter the setting page
       
   110     if ( aKeyEvent.iCode == EKeyNull ||
       
   111          aKeyEvent.iCode == EKeyUpArrow || 
       
   112          aKeyEvent.iCode == EKeyDownArrow )
       
   113         {
       
   114         ShowInfoPopupL();
       
   115         }   
       
   116     return response;
    79     return response;
   117     }
    80     }
   118 
    81 
   119 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
   120 // CGSConnSettingsSelectionDlg::HandleListBoxEventL
    83 // CGSConnSettingsSelectionDlg::HandleListBoxEventL
   122 //
    85 //
   123 void CGSConnSettingsSelectionDlg::HandleListBoxEventL( 
    86 void CGSConnSettingsSelectionDlg::HandleListBoxEventL( 
   124         CEikListBox* aListBox, 
    87         CEikListBox* aListBox, 
   125         TListBoxEvent aEventType )
    88         TListBoxEvent aEventType )
   126     {
    89     {
   127     if ( aEventType == EEventItemClicked || 
    90     CAknRadioButtonSettingPage::HandleListBoxEventL( aListBox, aEventType );
   128          aEventType == EEventItemSingleClicked )
       
   129         {
       
   130         ShowInfoPopupL();
       
   131         }
       
   132     CAknRadioButtonSettingPage::HandleListBoxEventL(aListBox, aEventType);
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // CGSConnSettingsSelectionDlg::ShowInfoPopupL
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 void CGSConnSettingsSelectionDlg::ShowInfoPopupL()
       
   140     {
       
   141     TInt currentIndex = this->ListBoxControl()->CurrentItemIndex();
       
   142 
       
   143     iPopupController->HideInfoPopupNote();
       
   144 
       
   145     iPopupController->SetTextL( (*iPopupItems)[currentIndex] );
       
   146     iPopupController->SetTimeDelayBeforeShow( 500 );
       
   147     iPopupController->SetTimePopupInView( 0 ); //Zero means that popup stays in screen until it is destroyed
       
   148     iPopupController->ShowInfoPopupNote();
       
   149     }
    91     }
   150 
    92 
   151 // End of file
    93 // End of file
   152 
    94