idlefw/plugins/mcsplugin/settings/src/mcspluginsettings.cpp
branchRCL_3
changeset 130 67f2ed48ad91
parent 118 8baec10861af
equal deleted inserted replaced
122:6cadd6867c17 130:67f2ed48ad91
    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     
       
    80     FeatureManager::InitializeLibL();
    78     FeatureManager::InitializeLibL();
    81 
    79 
    82     TParsePtrC driveParse(PathInfo::RomRootPath());
    80     TParsePtrC driveParse(PathInfo::RomRootPath());
    83     TFileName resourceName(driveParse.Drive());
    81     TFileName resourceName(driveParse.Drive());
    84     // Find the resource file.
    82     // Find the resource file.
   113 CMCSPluginSettings::~CMCSPluginSettings()
   111 CMCSPluginSettings::~CMCSPluginSettings()
   114 {
   112 {
   115     FeatureManager::UnInitializeLib();
   113     FeatureManager::UnInitializeLib();
   116     iResourceLoader.Close();
   114     iResourceLoader.Close();
   117     delete iModel;
   115     delete iModel;
   118     
       
   119     if (iTimer->IsActive())
       
   120         {
       
   121         iTimer->Cancel();
       
   122         }
       
   123     delete iTimer;
       
   124 }
   116 }
   125 
   117 
   126 // ---------------------------------------------------------------------------
   118 // ---------------------------------------------------------------------------
   127 // From CAknView
   119 // From CAknView
   128 // Returns view id.
   120 // Returns view id.
   166 // First method called by the Avkon framwork
   158 // First method called by the Avkon framwork
   167 // ----------------------------------------------------------------------------
   159 // ----------------------------------------------------------------------------
   168 //
   160 //
   169 void CMCSPluginSettings::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
   161 void CMCSPluginSettings::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
   170     {
   162     {
   171     // Parse the custom message
   163     iModel->SetPluginIdL( aCustomMessage );
   172     TInt locate = aCustomMessage.Locate('/');
       
   173     TInt editIdx = -1;
       
   174     
       
   175     iModel->UpdateAppListL( EFalse );
   164     iModel->UpdateAppListL( EFalse );
   176     iModel->UpdateBkmListL( EFalse );
   165     iModel->UpdateBkmListL( EFalse );
   177     
   166     iModel->UpdateSettingsL();
   178     if (locate > 0)
   167     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
   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         }
       
   214     }
   168     }
   215 
   169 
   216 // ----------------------------------------------------------------------------
   170 // ----------------------------------------------------------------------------
   217 // From CAknView
   171 // From CAknView
   218 // Called by the Avkon view framework when closing.
   172 // Called by the Avkon view framework when closing.
   302 void CMCSPluginSettings::HandleListBoxSelectionL()
   256 void CMCSPluginSettings::HandleListBoxSelectionL()
   303 {
   257 {
   304     Container()->HandleChangeCommandL();
   258     Container()->HandleChangeCommandL();
   305 }
   259 }
   306 
   260 
   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 
       
   321 // End of File.
   261 // End of File.