phoneapp/phoneui2/src/phoneuihousehold_p.cpp
changeset 77 2be0b271d017
parent 72 c76a0b1755b9
equal deleted inserted replaced
72:c76a0b1755b9 77:2be0b271d017
    20 #include <telinternalpskeys.h>
    20 #include <telinternalpskeys.h>
    21 #include <QLocale>
    21 #include <QLocale>
    22 #include <HbTranslator>
    22 #include <HbTranslator>
    23 #include <telremotepartyinformationpskeys.h>
    23 #include <telremotepartyinformationpskeys.h>
    24 #include <telinformationpskeys.h>
    24 #include <telinformationpskeys.h>
    25 #include <UikonInternalPSKeys.h>
       
    26 #include <startupdomainpskeys.h>
    25 #include <startupdomainpskeys.h>
    27 #include <featmgr.h>        // for FeatureManager
    26 #include <featmgr.h>        // for FeatureManager
    28 #include <hbmainwindow.h>
    27 #include <hbmainwindow.h>
    29 #include "phoneconstants.h"
    28 #include "phoneconstants.h"
    30 #include "cphonelogger.h"
    29 #include "cphonelogger.h"
    73         !appUi->iLightIdleReached ?
    72         !appUi->iLightIdleReached ?
    74             appUi->DoStartupSignalIdleL() :
    73             appUi->DoStartupSignalIdleL() :
    75             appUi->DoStartupSignalSecurityL();
    74             appUi->DoStartupSignalSecurityL();
    76 }
    75 }
    77 
    76 
       
    77 
    78 TInt PhoneUiHouseHoldPrivate::DoStartupSignalIdleL()
    78 TInt PhoneUiHouseHoldPrivate::DoStartupSignalIdleL()
    79     {
    79     {
    80     TBool idleReached = EFalse;
    80     PHONE_DEBUG("phoneui::DoStartupSignalIdleL()");
    81     
    81     // Idle application has already started
    82     // Check if Idle application has been started.
    82     if ( !( iAppsReady & EPhoneIdleStartedUp ) )
    83     const TInt idleUid = 0x20022F35;
    83         {
    84     PHONE_DEBUG2("phoneui::DoStartupSignalIdleL() idleUID=", idleUid);
    84         PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle App started ");
    85     
    85         iAppsReady += EPhoneIdleStartedUp;
    86     if ( idleUid != 0 && idleUid != KErrNotFound )
    86         
    87         {
    87         // Remove Phone application from Fast Swap Window.
    88         // Idle application has already started
    88         //    iPhoneViewController->SetHiddenL( ETrue );
    89         if ( !( iAppsReady & EPhoneIdleStartedUp ) )
    89         
    90             {
    90         // Avkon removal            
    91             PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle App started ");
    91         // hack to make sure EPhonePhase1Ok is set - to be fixed properly
    92             iAppsReady += EPhoneIdleStartedUp;
    92        
    93             
    93         PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Phone and Idle apps have both been started");    
    94             // Remove Phone application from Fast Swap Window.
    94         CPhonePubSubProxy::Instance()->ChangePropertyValue(
    95 //            iPhoneViewController->SetHiddenL( ETrue );
    95             KPSUidStartup,
    96             
    96             KPSPhonePhase1Ok,
    97             // Set Idle's UID to PubSub.
    97             EPhonePhase1Ok );
    98             CPhonePubSubProxy::Instance()->ChangePropertyValue(
    98         
    99                 KPSUidUikon,
       
   100                 KUikVideoCallTopApp,
       
   101                 idleUid );
       
   102                 
       
   103             // hack to make sure EPhonePhase1Ok is set - to be fixed properly
       
   104             idleReached = true;
       
   105             PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Phone and Idle apps have both been started");    
       
   106             CPhonePubSubProxy::Instance()->ChangePropertyValue(
       
   107                 KPSUidStartup,
       
   108                 KPSPhonePhase1Ok,
       
   109                 EPhonePhase1Ok );
       
   110             }
       
   111         }
       
   112 
       
   113     if ( idleReached )
       
   114         {
       
   115         PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle reached!");
       
   116         // Now err == KErrNone and it means that
       
   117         // we have succeeded in signalling.
       
   118         CPhoneRecoverySystem::Instance()->EnablePreconditionL();
    99         CPhoneRecoverySystem::Instance()->EnablePreconditionL();
   119 
       
   120         // Update the Phone light idle flag
   100         // Update the Phone light idle flag
   121         iLightIdleReached = ETrue;
   101         iLightIdleReached = ETrue;
   122 
       
   123         // Notify the UI controller that the phone is ready
   102         // Notify the UI controller that the phone is ready
   124         iPhoneUIController->HandlePhoneStartupL();
   103         iPhoneUIController->HandlePhoneStartupL();
   125         }
   104         }
   126     else 
   105     else 
   127         {
   106         {
   129         // Idle has not been reached yet. Indicate to the recovery
   108         // Idle has not been reached yet. Indicate to the recovery
   130         // system that this iteration has failed so that it will
   109         // system that this iteration has failed so that it will
   131         // try again at a later time.
   110         // try again at a later time.
   132         User::Leave( KErrNotReady );
   111         User::Leave( KErrNotReady );
   133         }
   112         }
   134 
       
   135     return KErrNone;
   113     return KErrNone;
   136     }
   114     }
   137 
   115 
   138 TInt PhoneUiHouseHoldPrivate::DoStartupSignalSecurityL()
   116 TInt PhoneUiHouseHoldPrivate::DoStartupSignalSecurityL()
   139     {
   117     {
   188     }
   166     }
   189 
   167 
   190     PhoneUIQtView *view = new PhoneUIQtView(m_window);
   168     PhoneUIQtView *view = new PhoneUIQtView(m_window);
   191     iViewAdapter = new PhoneUIQtViewAdapter(*view);
   169     iViewAdapter = new PhoneUIQtViewAdapter(*view);
   192     iPhoneUIController = CPhoneUIController::NewL(iViewAdapter);
   170     iPhoneUIController = CPhoneUIController::NewL(iViewAdapter);
       
   171     iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo());
   193     
   172     
   194     m_window.addView (view);
   173     m_window.addView (view);
   195     m_window.setCurrentView (view);
   174     m_window.setCurrentView (view);
   196     m_window.scene ()->setFocusItem (view);
   175     m_window.scene ()->setFocusItem (view);
   197     iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController);
   176     iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController);
   202     QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *)));
   181     QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *)));
   203     QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)),
   182     QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)),
   204                      Qt::QueuedConnection); // async to enable deletion of widget during signal handling
   183                      Qt::QueuedConnection); // async to enable deletion of widget during signal handling
   205     QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated()));
   184     QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated()));
   206     QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated()));
   185     QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated()));
   207     
   186     QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost()));
       
   187     QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained()));
   208     QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), 
   188     QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), 
   209                      iCommandAdapter, SLOT(handleCommand (int))); 
   189                      iCommandAdapter, SLOT(handleCommand (int))); 
   210     
   190     
   211     // Disable default Send key functionality in application framework 
   191     // Disable default Send key functionality in application framework 
   212     CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
   192     // avkon removal
   213     appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | 
   193 //    CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
   214                              CAknAppUiBase::EDisableSendKeyLong );
   194 //    appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | 
       
   195 //                             CAknAppUiBase::EDisableSendKeyLong );
   215     
   196     
   216     // CLI Name.
   197     // CLI Name.
   217     TInt err = RProperty::Define( 
   198     TInt err = RProperty::Define( 
   218         KPSUidTelRemotePartyInformation,
   199         KPSUidTelRemotePartyInformation,
   219         KTelCLIName,
   200         KTelCLIName,
   226         KPSUidTelRemotePartyInformation,
   207         KPSUidTelRemotePartyInformation,
   227         KTelCLINumber,
   208         KTelCLINumber,
   228         RProperty::EText,
   209         RProperty::EText,
   229         KPhoneReadPolicy,
   210         KPhoneReadPolicy,
   230         KPhoneWritePolicy );
   211         KPhoneWritePolicy );
   231 
       
   232     // Define the top application system property
       
   233     err = RProperty::Define( 
       
   234         KPSUidUikon,
       
   235         KUikVideoCallTopApp,
       
   236         RProperty::EInt,
       
   237         KPhoneReadPolicy,
       
   238         KPhoneWritePolicy );
       
   239 
       
   240 
   212 
   241     // Startup event signalling
   213     // Startup event signalling
   242     // Define the telephony application system property 
   214     // Define the telephony application system property 
   243  
   215  
   244      err = RProperty::Define( 
   216      err = RProperty::Define( 
   330         }
   302         }
   331 
   303 
   332     // Update the Apps ready flag
   304     // Update the Apps ready flag
   333     iAppsReady += EPhoneStartedUp;
   305     iAppsReady += EPhoneStartedUp;
   334 
   306 
   335      HbMainWindow *main = hbInstance->allMainWindows().at(0);
   307     HbMainWindow *main = hbInstance->allMainWindows().at(0);
   336     RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow());
   308     RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow());
   337 
   309 
   338     CEikonEnv* env = CEikonEnv::Static();
   310     CEikonEnv* env = CEikonEnv::Static();
   339     if ( env ) {
   311     if ( env ) {
   340         env->SetSystem(ETrue);
   312         env->SetSystem(ETrue);