idlefw/plugins/mcsplugin/settings/src/mcspluginsettings.cpp
branchRCL_3
changeset 118 8baec10861af
parent 114 a5a39a295112
child 130 67f2ed48ad91
equal deleted inserted replaced
114:a5a39a295112 118:8baec10861af
    73 // Second phase construction
    73 // Second phase construction
    74 // ---------------------------------------------------------------------------
    74 // ---------------------------------------------------------------------------
    75 //
    75 //
    76 void CMCSPluginSettings::ConstructL()
    76 void CMCSPluginSettings::ConstructL()
    77 {
    77 {
       
    78     iTimer = CPeriodic::NewL( CActive::EPriorityUserInput );
       
    79     
    78     FeatureManager::InitializeLibL();
    80     FeatureManager::InitializeLibL();
    79 
    81 
    80     TParsePtrC driveParse(PathInfo::RomRootPath());
    82     TParsePtrC driveParse(PathInfo::RomRootPath());
    81     TFileName resourceName(driveParse.Drive());
    83     TFileName resourceName(driveParse.Drive());
    82     // Find the resource file.
    84     // Find the resource file.
   111 CMCSPluginSettings::~CMCSPluginSettings()
   113 CMCSPluginSettings::~CMCSPluginSettings()
   112 {
   114 {
   113     FeatureManager::UnInitializeLib();
   115     FeatureManager::UnInitializeLib();
   114     iResourceLoader.Close();
   116     iResourceLoader.Close();
   115     delete iModel;
   117     delete iModel;
       
   118     
       
   119     if (iTimer->IsActive())
       
   120         {
       
   121         iTimer->Cancel();
       
   122         }
       
   123     delete iTimer;
   116 }
   124 }
   117 
   125 
   118 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   119 // From CAknView
   127 // From CAknView
   120 // Returns view id.
   128 // Returns view id.
   158 // First method called by the Avkon framwork
   166 // First method called by the Avkon framwork
   159 // ----------------------------------------------------------------------------
   167 // ----------------------------------------------------------------------------
   160 //
   168 //
   161 void CMCSPluginSettings::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
   169 void CMCSPluginSettings::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
   162     {
   170     {
   163     iModel->SetPluginIdL( aCustomMessage );
   171     // Parse the custom message
       
   172     TInt locate = aCustomMessage.Locate('/');
       
   173     TInt editIdx = -1;
       
   174     
   164     iModel->UpdateAppListL( EFalse );
   175     iModel->UpdateAppListL( EFalse );
   165     iModel->UpdateBkmListL( EFalse );
   176     iModel->UpdateBkmListL( EFalse );
   166     iModel->UpdateSettingsL();
   177     
   167     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
   178     if (locate > 0)
       
   179         {
       
   180         // if / is located in the custom mesage
       
   181         // upto / is the plugin id
       
   182         iModel->SetPluginIdL(aCustomMessage.Left(locate));
       
   183 
       
   184         // right most character is the edit index
       
   185         TLex8 lex(aCustomMessage.Right(1));
       
   186         lex.Val(editIdx);
       
   187 
       
   188         iModel->UpdateSettingsL();
       
   189         CGSBaseView::DoActivateL(aPrevViewId, aCustomMessageId,
       
   190                 aCustomMessage.Left(locate));        
       
   191 
       
   192         if (editIdx > 0)
       
   193             {
       
   194             // set the current edit item
       
   195             Container()->SetCurrentItemIndex(editIdx - 1);
       
   196             
       
   197             // Set timer for handle the change of shortcut item
       
   198             // Otherwise status bar is not shown correctly
       
   199             if (iTimer->IsActive())
       
   200                 {
       
   201                 iTimer->Cancel();
       
   202                 }
       
   203             iTimer->Start( 0, 0, TCallBack( TimerCallbackL, this ) );
       
   204             }
       
   205         }
       
   206     else
       
   207         { 
       
   208         // if '/' is not located, custommessage has only the plugin id 
       
   209         iModel->SetPluginIdL(aCustomMessage);
       
   210         iModel->UpdateSettingsL();
       
   211         CGSBaseView::DoActivateL(aPrevViewId, aCustomMessageId,
       
   212                 aCustomMessage);
       
   213         }
   168     }
   214     }
   169 
   215 
   170 // ----------------------------------------------------------------------------
   216 // ----------------------------------------------------------------------------
   171 // From CAknView
   217 // From CAknView
   172 // Called by the Avkon view framework when closing.
   218 // Called by the Avkon view framework when closing.
   256 void CMCSPluginSettings::HandleListBoxSelectionL()
   302 void CMCSPluginSettings::HandleListBoxSelectionL()
   257 {
   303 {
   258     Container()->HandleChangeCommandL();
   304     Container()->HandleChangeCommandL();
   259 }
   305 }
   260 
   306 
       
   307 // ---------------------------------------------------------------------------
       
   308 // Callback for direct settings change
       
   309 // ---------------------------------------------------------------------------
       
   310 //
       
   311 TInt CMCSPluginSettings::TimerCallbackL( TAny *aPtr )
       
   312     {
       
   313     CMCSPluginSettings* self = reinterpret_cast< CMCSPluginSettings* >( aPtr );
       
   314     self->iTimer->Cancel();
       
   315     // Handle the change
       
   316     self->HandleListBoxSelectionL();
       
   317     
       
   318     return 0;
       
   319     }
       
   320 
   261 // End of File.
   321 // End of File.