phoneapp/phoneui2/src/phoneuihousehold_p.cpp
changeset 78 baacf668fe89
parent 74 d1c62c765e48
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
    39 #include "cphoneclearblacklist.h"
    39 #include "cphoneclearblacklist.h"
    40 #include "hbinstance.h"
    40 #include "hbinstance.h"
    41 
    41 
    42 PhoneUiHouseHoldPrivate::PhoneUiHouseHoldPrivate(HbMainWindow &window) :
    42 PhoneUiHouseHoldPrivate::PhoneUiHouseHoldPrivate(HbMainWindow &window) :
    43     iAppsReady (0), iStartupSignalRecoveryId (0), iLightIdleReached (EFalse), 
    43     iAppsReady (0), iStartupSignalRecoveryId (0), iLightIdleReached (EFalse), 
    44     iPhoneUIController (0), m_window (window)
    44     iPhoneUIController (0), m_window (window), m_featMgrInit(false)
    45 {
    45 {
    46     PHONE_DEBUG("phoneui - Start phoneapp");
    46     PHONE_DEBUG("phoneui - Start phoneapp");
    47     
    47     
    48     TRAPD( error, ConstructL() );
    48     QT_TRAP_THROWING( ConstructL() );
    49     qt_symbian_throwIfError(error);
       
    50 }
    49 }
    51 
    50 
    52 PhoneUiHouseHoldPrivate::~PhoneUiHouseHoldPrivate()
    51 PhoneUiHouseHoldPrivate::~PhoneUiHouseHoldPrivate()
    53 {
    52 {
    54     while (!m_translators.isEmpty()) {
    53     resetTranslators();
    55         HbTranslator *translator = m_translators.takeFirst();
    54 
    56         delete translator;
       
    57         translator = 0;
       
    58     }
       
    59     
       
    60     delete iKeyEventAdapter;
    55     delete iKeyEventAdapter;
    61     delete iCommandAdapter;
    56     delete iCommandAdapter;
    62     delete iPhoneUIController;
    57     delete iPhoneUIController;
    63     delete iViewAdapter;
    58     delete iViewAdapter;
       
    59     if (m_featMgrInit) {
       
    60         FeatureManager::UnInitializeLib();
       
    61     }
    64 }
    62 }
    65 
    63 
    66 TInt PhoneUiHouseHoldPrivate::DoStartupSignalL( TAny* aAny )
    64 TInt PhoneUiHouseHoldPrivate::DoStartupSignalL( TAny* aAny )
    67 {
    65 {
    68     PhoneUiHouseHoldPrivate* appUi =
    66     PhoneUiHouseHoldPrivate* appUi =
    72         !appUi->iLightIdleReached ?
    70         !appUi->iLightIdleReached ?
    73             appUi->DoStartupSignalIdleL() :
    71             appUi->DoStartupSignalIdleL() :
    74             appUi->DoStartupSignalSecurityL();
    72             appUi->DoStartupSignalSecurityL();
    75 }
    73 }
    76 
    74 
    77 
       
    78 TInt PhoneUiHouseHoldPrivate::DoStartupSignalIdleL()
    75 TInt PhoneUiHouseHoldPrivate::DoStartupSignalIdleL()
    79     {
    76     {
    80     PHONE_DEBUG("phoneui::DoStartupSignalIdleL()");
    77     PHONE_DEBUG("phoneui::DoStartupSignalIdleL()");
       
    78     //Workaround: pre-load libs
       
    79     m_window.show();
    81     // Idle application has already started
    80     // Idle application has already started
    82     if ( !( iAppsReady & EPhoneIdleStartedUp ) )
    81     if ( !( iAppsReady & EPhoneIdleStartedUp ) )
    83         {
    82         {
    84         PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle App started ");
    83         PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle App started ");
    85         iAppsReady += EPhoneIdleStartedUp;
    84         iAppsReady += EPhoneIdleStartedUp;
    86         
       
    87         // Remove Phone application from Fast Swap Window.
       
    88         //    iPhoneViewController->SetHiddenL( ETrue );
       
    89         
       
    90         // Avkon removal            
       
    91         // hack to make sure EPhonePhase1Ok is set - to be fixed properly
       
    92        
    85        
    93         PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Phone and Idle apps have both been started");    
    86         PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Phone and Idle apps have both been started");    
    94         CPhonePubSubProxy::Instance()->ChangePropertyValue(
    87         CPhonePubSubProxy::Instance()->ChangePropertyValue(
    95             KPSUidStartup,
    88             KPSUidStartup,
    96             KPSPhonePhase1Ok,
    89             KPSPhonePhase1Ok,
   122 void PhoneUiHouseHoldPrivate::HandlePropertyChangedL(
   115 void PhoneUiHouseHoldPrivate::HandlePropertyChangedL(
   123         const TUid& aCategory, const TUint /*aKey*/, const TInt /*aValue*/)
   116         const TUid& aCategory, const TUint /*aKey*/, const TInt /*aValue*/)
   124 {
   117 {
   125     PHONE_DEBUG("phoneui::HandlePropertyChangedL()");
   118     PHONE_DEBUG("phoneui::HandlePropertyChangedL()");
   126     
   119     
   127     if ( aCategory == KPSUidStartup )
   120     if ( aCategory == KPSUidStartup ){
   128         {
       
   129         
   121         
   130         const TInt startupState = CPhonePubSubProxy::Instance()->Value(
   122         const TInt startupState = CPhonePubSubProxy::Instance()->Value(
   131             KPSUidStartup,
   123             KPSUidStartup,
   132             KPSGlobalSystemState );
   124             KPSGlobalSystemState );
   133         
   125         
   135        
   127        
   136         if ( startupState == ESwStateCriticalPhaseOK ||
   128         if ( startupState == ESwStateCriticalPhaseOK ||
   137             startupState == ESwStateEmergencyCallsOnly ||
   129             startupState == ESwStateEmergencyCallsOnly ||
   138             startupState == ESwStateNormalRfOn ||
   130             startupState == ESwStateNormalRfOn ||
   139             startupState == ESwStateNormalRfOff ||
   131             startupState == ESwStateNormalRfOff ||
   140             startupState == ESwStateNormalBTSap )
   132             startupState == ESwStateNormalBTSap ){
   141             {
       
   142             PHONE_DEBUG("phoneui::HandlePropertyChangedL() Try to update the startup signal again..." );
   133             PHONE_DEBUG("phoneui::HandlePropertyChangedL() Try to update the startup signal again..." );
   143             // Try to update the startup signal again
   134             // Try to update the startup signal again
   144             CPhoneRecoverySystem::Instance()->RecoverNow(
   135             CPhoneRecoverySystem::Instance()->RecoverNow(
   145                 iStartupSignalRecoveryId, 
   136                 iStartupSignalRecoveryId, 
   146                 CTeleRecoverySystem::EPhonePriorityHigh );    
   137                 CTeleRecoverySystem::EPhonePriorityHigh );    
   147             }
   138         }
   148         }
   139     }
   149 }
   140 }
   150 
   141 
   151 void PhoneUiHouseHoldPrivate::ConstructL()
   142 void PhoneUiHouseHoldPrivate::ConstructL()
   152 {
   143 {
   153     new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton );
   144     new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton );
   154     FeatureManager::InitializeLibL();
   145     FeatureManager::InitializeLibL();
   155     
   146     m_featMgrInit = true;
   156     HbTranslator *translator = new HbTranslator(QString("telephone"));
   147     
   157 
   148     loadTranslators();
   158 	if (translator) {
   149     
   159         translator->loadCommon();
       
   160         m_translators.append(translator);
       
   161 	}
       
   162     
       
   163 	HbTranslator *translator2 = new HbTranslator(QString("telephone_cp"));
       
   164     if (translator2) {
       
   165         m_translators.append(translator2);
       
   166     }
       
   167 
       
   168     PhoneUIQtView *view = new PhoneUIQtView(m_window);
   150     PhoneUIQtView *view = new PhoneUIQtView(m_window);
   169     iViewAdapter = new PhoneUIQtViewAdapter(*view);
   151     iViewAdapter = new PhoneUIQtViewAdapter(*view);
   170     iPhoneUIController = CPhoneUIController::NewL(iViewAdapter);
   152     iPhoneUIController = CPhoneUIController::NewL(iViewAdapter);
   171     iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo());
   153     iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo());
   172     
   154     
   186     QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost()));
   168     QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost()));
   187     QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained()));
   169     QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained()));
   188     QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), 
   170     QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), 
   189                      iCommandAdapter, SLOT(handleCommand (int))); 
   171                      iCommandAdapter, SLOT(handleCommand (int))); 
   190     
   172     
   191     // Disable default Send key functionality in application framework 
       
   192     // avkon removal
       
   193 //    CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
       
   194 //    appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | 
       
   195 //                             CAknAppUiBase::EDisableSendKeyLong );
       
   196     
       
   197     // CLI Name.
   173     // CLI Name.
   198     TInt err = RProperty::Define( 
   174     TInt err = RProperty::Define( 
   199         KPSUidTelRemotePartyInformation,
   175         KPSUidTelRemotePartyInformation,
   200         KTelCLIName,
   176         KTelCLIName,
   201         RProperty::EText,
   177         RProperty::EText,
   313         // Blacklist singleton is initialized here
   289         // Blacklist singleton is initialized here
   314         CPhoneClearBlacklist::CreateL( env->WsSession(), *win);
   290         CPhoneClearBlacklist::CreateL( env->WsSession(), *win);
   315     }
   291     }
   316 }
   292 }
   317 
   293 
       
   294 void PhoneUiHouseHoldPrivate::loadTranslators()
       
   295 {
       
   296     PHONE_DEBUG2("PhoneUiHouseHoldPrivate::LoadTranslators, locale:", QLocale::system().name());
       
   297     resetTranslators();
       
   298     
       
   299     HbTranslator *translator2 = new HbTranslator(QString("telephone_cp"));
       
   300     if (translator2) {
       
   301         m_translators.append(translator2);
       
   302     }
       
   303     
       
   304     HbTranslator *translator = new HbTranslator(QString("telephone"));
       
   305     if (translator) {
       
   306         translator->loadCommon();
       
   307         m_translators.append(translator); //most used translation file added last
       
   308     }
       
   309 }
       
   310 
       
   311 void PhoneUiHouseHoldPrivate::resetTranslators()
       
   312 {
       
   313     while (!m_translators.isEmpty()) {
       
   314         HbTranslator *translator = m_translators.takeFirst();
       
   315         delete translator;
       
   316         translator = 0;
       
   317     }
       
   318 }