phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp
branchRCL_3
changeset 3 04ab22b956c2
parent 0 e686773b3f54
child 5 81f8547efd4f
equal deleted inserted replaced
0:e686773b3f54 3:04ab22b956c2
    37     VPbkFieldTypeSelectorFactory::EVideoCallSelector,
    37     VPbkFieldTypeSelectorFactory::EVideoCallSelector,
    38     VPbkFieldTypeSelectorFactory::EFindOnMapSelector
    38     VPbkFieldTypeSelectorFactory::EFindOnMapSelector
    39     };
    39     };
    40 
    40 
    41 const TInt KSupportedMethodsArrayLength = sizeof( KSupportedMethodsArray ) / sizeof( TInt );
    41 const TInt KSupportedMethodsArrayLength = sizeof( KSupportedMethodsArray ) / sizeof( TInt );
       
    42 const TInt KDelayTime = 30000000; // 30s
    42 
    43 
    43 // ======== MEMBER FUNCTIONS ========
    44 // ======== MEMBER FUNCTIONS ========
    44 
    45 
    45 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    46 // CCCAppCommLauncherPlugin::NewL
    47 // CCCAppCommLauncherPlugin::NewL
    80     if ( iWaitFinish && iWaitFinish->IsStarted() )
    81     if ( iWaitFinish && iWaitFinish->IsStarted() )
    81        {
    82        {
    82        iWaitFinish->AsyncStop();
    83        iWaitFinish->AsyncStop();
    83        }
    84        }
    84     delete iWaitFinish;
    85     delete iWaitFinish;
       
    86     
       
    87     delete iAiwRequestTimer;
    85 
    88 
    86     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherPlugin::~CCCAppCommLauncherPlugin()"));
    89     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherPlugin::~CCCAppCommLauncherPlugin()"));
    87     }
    90     }
    88 
    91 
    89 // ---------------------------------------------------------------------------
    92 // ---------------------------------------------------------------------------
    90 // CCCAppCommLauncherPlugin::CCCAppCommLauncherPlugin()
    93 // CCCAppCommLauncherPlugin::CCCAppCommLauncherPlugin()
    91 // ---------------------------------------------------------------------------
    94 // ---------------------------------------------------------------------------
    92 //
    95 //
    93 CCCAppCommLauncherPlugin::CCCAppCommLauncherPlugin()
    96 CCCAppCommLauncherPlugin::CCCAppCommLauncherPlugin() : iIsCcaForeground( ETrue ),
       
    97         iIsTimerStart( EFalse )
    94     {
    98     {
    95     CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherPlugin()"));
    99     CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherPlugin()"));
    96     }
   100     }
    97 
   101 
    98 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
   200     CCCAppViewPluginAknView::DoDeactivate();
   204     CCCAppViewPluginAknView::DoDeactivate();
   201 
   205 
   202     // if plugin is showing notifications, this is good place to disable those
   206     // if plugin is showing notifications, this is good place to disable those
   203     // until ActivatePluginViewL is called again
   207     // until ActivatePluginViewL is called again
   204 
   208 
       
   209     // After commlauncher view is deactivated, cancel the timer which started when requests
       
   210     // a call services.
       
   211     CancelTimer();
   205     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherPlugin::DoDeactivate()"));
   212     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherPlugin::DoDeactivate()"));
   206     }
   213     }
   207 
   214 
   208 // ---------------------------------------------------------------------------
   215 // ---------------------------------------------------------------------------
   209 // CCCAppCommLauncherPlugin::InitialisePreferredCommMethods
   216 // CCCAppCommLauncherPlugin::InitialisePreferredCommMethods
   358         iMenuHandler->SetContactStore( iContactHandler->ContactStore() );
   365         iMenuHandler->SetContactStore( iContactHandler->ContactStore() );
   359         }
   366         }
   360     }
   367     }
   361 
   368 
   362 // ---------------------------------------------------------------------------
   369 // ---------------------------------------------------------------------------
       
   370 // CCCAppCommLauncherPlugin::CloseCCApp
       
   371 // ---------------------------------------------------------------------------
       
   372 //
       
   373 void CCCAppCommLauncherPlugin::CloseCCApp()
       
   374     {
       
   375     // Cancel timer after timer triggered to make sure the same timer just be 
       
   376     // triggered once.
       
   377     CancelTimer();
       
   378     
       
   379     // If CCA is at background, close CCA application.
       
   380     if ( !iIsCcaForeground )
       
   381         {
       
   382         RWsSession& wsSession = CCoeEnv::Static()->WsSession();
       
   383 
       
   384         TApaTask ccapp( wsSession );
       
   385         TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
       
   386         ccapp.SetWgId( wgId );
       
   387         ccapp.EndTask();
       
   388         }
       
   389     }
       
   390 
       
   391 // ---------------------------------------------------------------------------
   363 // CCCAppCommLauncherContainer::ContactorService
   392 // CCCAppCommLauncherContainer::ContactorService
   364 // ---------------------------------------------------------------------------
   393 // ---------------------------------------------------------------------------
   365 //
   394 //
   366 CCAContactorService* CCCAppCommLauncherPlugin::ContactorService()
   395 CCAContactorService* CCCAppCommLauncherPlugin::ContactorService()
   367     {
   396     {
   368     return iContactorService;
   397     return iContactorService;
   369     }
   398     }
   370 
   399 
       
   400 // ---------------------------------------------------------------------------
       
   401 // CCCAppCommLauncherPlugin::DefaultSettingComplete
       
   402 // ---------------------------------------------------------------------------
       
   403 //
   371 void CCCAppCommLauncherPlugin::DefaultSettingComplete()
   404 void CCCAppCommLauncherPlugin::DefaultSettingComplete()
   372 	{
   405 	{
   373 	if ( iWaitFinish && iWaitFinish->IsStarted() )
   406 	if ( iWaitFinish && iWaitFinish->IsStarted() )
   374 	   {
   407 	   {
   375 	   iWaitFinish->AsyncStop();
   408 	   iWaitFinish->AsyncStop();
   376 	   }
   409 	   }
   377 	}
   410 	}
       
   411 
       
   412 // ---------------------------------------------------------------------------
       
   413 // CCCAppCommLauncherPlugin::StartTimerL
       
   414 // ---------------------------------------------------------------------------
       
   415 //
       
   416 void CCCAppCommLauncherPlugin::StartTimerL()
       
   417     {
       
   418     if ( !iAiwRequestTimer )
       
   419         {
       
   420         iAiwRequestTimer = CPeriodic::NewL( CActive::EPriorityStandard );
       
   421         }
       
   422     
       
   423     // Cancel the timer before start it to make sure formal timer can be canceled
       
   424     // when start a new timer.
       
   425     CancelTimer();
       
   426     
       
   427     TCallBack callback( ServiceTimeOutL, this );
       
   428     iAiwRequestTimer->Start( KDelayTime, KDelayTime, callback );
       
   429     
       
   430     iIsTimerStart = ETrue;
       
   431     }
       
   432 
       
   433 // ---------------------------------------------------------------------------
       
   434 // CCCAppCommLauncherPlugin::CancelTimer
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 void CCCAppCommLauncherPlugin::CancelTimer()
       
   438     {
       
   439     if ( iAiwRequestTimer && iIsTimerStart )
       
   440         {
       
   441         iAiwRequestTimer->Cancel();
       
   442         iIsTimerStart = EFalse;
       
   443         }
       
   444     }
       
   445 
   378 // ---------------------------------------------------------------------------
   446 // ---------------------------------------------------------------------------
   379 // CCCAppCommLauncherPlugin::IsTopContactL
   447 // CCCAppCommLauncherPlugin::IsTopContactL
   380 // ---------------------------------------------------------------------------
   448 // ---------------------------------------------------------------------------
   381 //
   449 //
   382 TBool CCCAppCommLauncherPlugin::IsTopContactL()
   450 TBool CCCAppCommLauncherPlugin::IsTopContactL()
   397 // CCCAppCommLauncherPlugin::HandleCommandL
   465 // CCCAppCommLauncherPlugin::HandleCommandL
   398 // ---------------------------------------------------------------------------
   466 // ---------------------------------------------------------------------------
   399 //
   467 //
   400 void CCCAppCommLauncherPlugin::HandleCommandL( TInt aCommand )
   468 void CCCAppCommLauncherPlugin::HandleCommandL( TInt aCommand )
   401     {
   469     {
       
   470     // Make sure the aiw request timer is canceled before executing another command.
       
   471     CancelTimer();
       
   472     
   402     // Forward the command handling 1st to base-class.
   473     // Forward the command handling 1st to base-class.
   403     // The "Exit"- and "Back"-commands are handled there.
   474     // The "Exit"- and "Back"-commands are handled there.
   404     CCCAppViewPluginAknView::HandleCommandL( aCommand );
   475     CCCAppViewPluginAknView::HandleCommandL( aCommand );
   405 
   476 
   406     // Rest to menuhandler
   477     // Rest to menuhandler
   474        }
   545        }
   475     return ret;
   546     return ret;
   476     }
   547     }
   477 
   548 
   478 // ---------------------------------------------------------------------------
   549 // ---------------------------------------------------------------------------
       
   550 // CCCAppCommLauncherPlugin::HandleForegroundEventL()
       
   551 // ---------------------------------------------------------------------------
       
   552 //
       
   553 void CCCAppCommLauncherPlugin::HandleForegroundEventL( TBool aForeground )
       
   554     {
       
   555     iIsCcaForeground = aForeground;
       
   556     }
       
   557 
       
   558 // ---------------------------------------------------------------------------
   479 // CCCAppCommLauncherPlugin::Id
   559 // CCCAppCommLauncherPlugin::Id
   480 // ---------------------------------------------------------------------------
   560 // ---------------------------------------------------------------------------
   481 //
   561 //
   482 TUid CCCAppCommLauncherPlugin::Id()const
   562 TUid CCCAppCommLauncherPlugin::Id()const
   483     {
   563     {
   534 
   614 
   535         cba->DrawDeferred();
   615         cba->DrawDeferred();
   536         }
   616         }
   537 }
   617 }
   538 
   618 
       
   619 // ---------------------------------------------------------------------------
       
   620 // CCCAppCommLauncherPlugin::ServiceTimeOutL
       
   621 // ---------------------------------------------------------------------------
       
   622 //
       
   623 TInt CCCAppCommLauncherPlugin::ServiceTimeOutL( TAny* aObject )
       
   624     {
       
   625     CCCAppCommLauncherPlugin* self = static_cast<CCCAppCommLauncherPlugin*> (aObject);
       
   626     self->CloseCCApp();
       
   627     return 0;
       
   628     }
       
   629 
   539 // End of File
   630 // End of File