qtinternetradio/ui/src/irapplication.cpp
changeset 12 608f67c22514
parent 11 f683e24efca3
child 14 896e9dbc5f19
equal deleted inserted replaced
11:f683e24efca3 12:608f67c22514
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <hbaction.h>
    18 #include <hbaction.h>
       
    19 #include <hbapplication.h>
    19 #include <qcoreapplication.h>
    20 #include <qcoreapplication.h>
    20 #include <hbdevicemessagebox.h>
    21 #include <hbdevicemessagebox.h>
    21 #include <hbprogressdialog.h>
    22 #include <hbprogressdialog.h>
    22 #include <QLocalServer>
    23 #include <QLocalServer>
    23 #include <QLocalSocket>
    24 #include <QLocalSocket>
    24 #include <QFile>
    25 #include <QFile>
    25 #include <QTextStream>
    26 #include <QTextStream>
    26 #include <QDir>
    27 #include <QDir>
       
    28 #include <hbmessagebox.h>
    27 
    29 
    28 #include <xqserviceutil.h>
    30 #include <xqserviceutil.h>
    29 #include <hbiconitem.h>
    31 #include <hbiconitem.h>
    30 #include <hbiconanimator.h>
    32 #include <hbiconanimator.h>
    31 #include <hbiconanimationmanager.h>
    33 #include <hbiconanimationmanager.h>
       
    34 #ifdef HS_WIDGET_ENABLED
       
    35 #include <XQSettingsManager>
       
    36 #include <XQPublishAndSubscribeSettingsKey>
       
    37 #include <XQPublishAndSubscribeUtils>
       
    38 #include <QDateTime>
       
    39 #endif
    32 
    40 
    33 #ifdef LOCALIZATION 
    41 #ifdef LOCALIZATION 
    34 #include <QTranslator>
    42 #include <QTranslator>
    35 #include "irqutility.h" 
    43 #include "irqutility.h" 
    36 #endif
    44 #endif
    49 #include "irqlogger.h"
    57 #include "irqlogger.h"
    50 #include "iruidefines.h"
    58 #include "iruidefines.h"
    51 #include "irqsystemeventhandler.h"
    59 #include "irqsystemeventhandler.h"
    52 #include "irabstractlistviewbase.h"
    60 #include "irabstractlistviewbase.h"
    53 #include "irfileviewservice.h"
    61 #include "irfileviewservice.h"
       
    62 #ifdef HS_WIDGET_ENABLED
       
    63 #include "irmonitorservice.h"
       
    64 #include "ircontrolservice.h"
       
    65 #include "irservicedef.h"
       
    66 #include "irqisdsdatastructure.h"
       
    67 #include "irsearchchannelsview.h"
       
    68 #endif
    54 /*
    69 /*
    55  * Description : constructor, initialize all data members
    70  * Description : constructor, initialize all data members
    56  * Parameters  : aViewManager : pointer to the view manager object
    71  * Parameters  : aViewManager : pointer to the view manager object
    57  * Return      : None
    72  * Return      : None
    58  */
    73  */
    76                                      iLocalServer(NULL),
    91                                      iLocalServer(NULL),
    77                                      iLoadingNote(NULL),
    92                                      iLoadingNote(NULL),
    78                                      #ifdef LOCALIZATION
    93                                      #ifdef LOCALIZATION
    79                                      iTranslator(NULL),
    94                                      iTranslator(NULL),
    80                                      #endif
    95                                      #endif
    81                                      iSystemEventHandler(aSystemEventHandler),
    96                                      iSystemEventHandler(aSystemEventHandler), 
    82                                      iLoadingAnimation(NULL),
    97                                      iUseNetworkReason(EIR_UseNetwork_NoReason),									 
    83                                      iFileViewService(NULL)
    98                                      iAppFullyStarted(false),
       
    99 									 #ifdef HS_WIDGET_ENABLED
       
   100                                      iControlService(NULL),
       
   101                                      iMonitorService(NULL),
       
   102 									 #endif                                     
       
   103                                      iFileViewService(NULL),
       
   104                                      iMessageBox(NULL)
    84                                      
   105                                      
    85 {
   106 {
    86     LOG_METHOD;
   107     LOG_METHOD;
    87     
   108     
    88     iViewManager->setApplication(this);
   109     iViewManager->setApplication(this);
    94 
   115 
    95     createComponents();
   116     createComponents();
    96     // get advertisement setting
   117     // get advertisement setting
    97     iSettings->getGlobalAdvFlag(iEnableGlobalAdv);
   118     iSettings->getGlobalAdvFlag(iEnableGlobalAdv);
    98     setupConnection();
   119     setupConnection();
    99     setLaunchView();
   120     
       
   121     if (!XQServiceUtil::isService())
       
   122     {
       
   123         setLaunchView();
       
   124     }
   100     
   125     
   101     QString name = XQServiceUtil::interfaceName();
   126     QString name = XQServiceUtil::interfaceName();
   102     if (name == QString("com.nokia.symbian.IFileView"))
   127     if (name == QString("com.nokia.symbian.IFileView"))
   103     {
   128     {
   104         iFileViewService = new IRFileViewService(this);
   129         iFileViewService = new IRFileViewService(this);
   105     }
   130     }
       
   131     
       
   132     iMessageBox = new HbMessageBox(hbTrId("No network connection!"),HbMessageBox::MessageTypeWarning,NULL);
   106 } 
   133 } 
   107 
   134 
   108 /*
   135 /*
   109  * Description : destructor, destroy all data members
   136  * Description : destructor, destroy all data members
   110  * Parameters  : None
   137  * Parameters  : None
   112  */
   139  */
   113 IRApplication::~IRApplication()
   140 IRApplication::~IRApplication()
   114 {
   141 {
   115     LOG_METHOD;
   142     LOG_METHOD;
   116     setExitingView();
   143     setExitingView();
       
   144     iViewManager->saveActivity();
       
   145     
   117     destroyComponents();
   146     destroyComponents();
   118     
   147     
   119     if (iLocalServer)
   148     if (iLocalServer)
   120     {
   149     {
   121         iLocalServer->close();
   150         iLocalServer->close();
   124     delete iLastPlayedStationInfo;
   153     delete iLastPlayedStationInfo;
   125     iLastPlayedStationInfo = NULL;
   154     iLastPlayedStationInfo = NULL;
   126     
   155     
   127     delete iLoadingNote;
   156     delete iLoadingNote;
   128     iLoadingNote = NULL;
   157     iLoadingNote = NULL;
       
   158     
       
   159     delete iMessageBox;
       
   160     iMessageBox = NULL;
   129     
   161     
   130     delete iSystemEventHandler;
   162     delete iSystemEventHandler;
   131     
   163     
   132 #ifdef LOCALIZATION
   164 #ifdef LOCALIZATION
   133     if( iTranslator )
   165     if( iTranslator )
   138     }
   170     }
   139 #endif
   171 #endif
   140     
   172     
   141     delete iFileViewService;
   173     delete iFileViewService;
   142     iFileViewService = NULL;
   174     iFileViewService = NULL;
       
   175 	
       
   176 #ifdef HS_WIDGET_ENABLED	
       
   177     XQSettingsManager settingsManager;
       
   178     XQPublishAndSubscribeUtils psUtils(settingsManager);
       
   179     XQPublishAndSubscribeSettingsKey irStartupKey(KInternetRadioPSUid, KInternetRadioStartupKey);
       
   180     psUtils.deleteProperty(irStartupKey);        
       
   181 #endif	
   143 }
   182 }
   144 
   183 
   145  
   184  
   146 /*
   185 /*
   147  * Description : When ir application is launched, set the correct view according to whether the 
   186  * Description : When ir application is launched, set the correct view according to whether the 
   149  * Parameters  : None
   188  * Parameters  : None
   150  * Return      : None
   189  * Return      : None
   151  */
   190  */
   152 void IRApplication::setLaunchView()
   191 void IRApplication::setLaunchView()
   153 {
   192 {
   154     if (!XQServiceUtil::isService())
   193     //get starting view id according to activate reason
   155     {
   194     TIRViewId viewId = EIRView_CategoryView;
   156         //normal launch, launch starting view
   195     HbApplication *hbApp = qobject_cast<HbApplication*>(qApp);
   157         TIRViewId viewId = EIRView_CategoryView;
   196 
       
   197     if (hbApp->activateReason() == Hb::ActivationReasonActivity)
       
   198     {
       
   199         QVariant data = hbApp->activateData();
       
   200         QByteArray serializedModel = data.toByteArray();
       
   201         QDataStream stream(&serializedModel, QIODevice::ReadOnly);
       
   202         int id = 0;
       
   203         stream>>id;
       
   204         viewId = TIRViewId(id);
       
   205     }
       
   206     else
       
   207     {
   158         iSettings->getStartingViewId(viewId);
   208         iSettings->getStartingViewId(viewId);
   159         if (EIRView_PlayingView == viewId)
   209         if (EIRView_PlayingView == viewId)
   160         {
   210         {
   161             //handle error case
   211             //handle error case
   162             if (NULL == getLastPlayedStationInfo()->getLastPlayedStation())
   212             if (NULL == getLastPlayedStationInfo()->getLastPlayedStation())
   163             {
   213             {
   164                 viewId = EIRView_CategoryView;
   214                 viewId = EIRView_CategoryView;
   165             }
   215             }
   166         }
   216         }
   167         
   217     }
   168         launchStartingView(viewId);
   218     
   169     }
   219     launchStartingView(viewId);
   170 }
   220 }
   171 
   221 
   172 /*
   222 /*
   173  * Description : verify if the network connection has been established
   223  * Description : verify if the network connection has been established
   174  * Parameters  : None
   224  * Parameters  : None
   181     
   231     
   182     bool ret = true;
   232     bool ret = true;
   183     
   233     
   184     if (!iNetworkController->getNetworkStatus())
   234     if (!iNetworkController->getNetworkStatus())
   185     {
   235     {
       
   236         LOG( "IRApplication::verifyNetworkConnectivity--1");
   186         ret = false;
   237         ret = false;
   187         if (!iNetworkController->isConnectRequestIssued())
   238         if (!iNetworkController->isConnectRequestIssued())
   188         {
   239         {
       
   240             LOG( "IRApplication::verifyNetworkConnectivity--2");
   189             iConnectingText = aConnectingText;
   241             iConnectingText = aConnectingText;
   190             iNetworkController->chooseAccessPoint();
   242             iNetworkController->chooseAccessPoint();
   191         }
   243         }
   192     }
   244     }
   193     
   245     
   194     return ret;
   246     return ret;
   195 }
   247 } 
   196 
       
   197 void IRApplication::startLoadingAnimation(const QPointF& aPos)
       
   198 {
       
   199     if( NULL == iLoadingAnimation )
       
   200     {
       
   201         getLoadingAnimation();
       
   202     }
       
   203     
       
   204     if (iLoadingAnimation)
       
   205     {
       
   206         iLoadingAnimation->setPos(aPos);
       
   207         iLoadingAnimation->show();
       
   208         iLoadingAnimation->animator().startAnimation();
       
   209     }    
       
   210 }
       
   211 
   248 
   212 void IRApplication::startLoadingAnimation(const QObject *aReceiver, const char *aFunc)
   249 void IRApplication::startLoadingAnimation(const QObject *aReceiver, const char *aFunc)
   213 {
   250 {
   214     LOG_METHOD_ENTER;
   251     LOG_METHOD_ENTER;
   215     
   252     
   216     //for downloading logos in stations view, favorites view and history view, network connection
   253     //for downloading logos in stations view, favorites view and history view, network connection
   217     //is initiated by low layer, we don't show any dialog
   254     //is initiated by low layer, we don't show any dialog
   218     if (!iNetworkController->getNetworkStatus())
   255     if (!iNetworkController->getNetworkStatus())
   219     {
   256     {
   220         IRBaseView *currentView = static_cast<IRBaseView*>(iViewManager->currentView());
   257         if (EIR_UseNetwork_NoReason == iUseNetworkReason) // network is not used by the Application
   221         if (currentView && EIR_UseNetwork_NoReason == currentView->getUseNetworkReason())
   258         {            
   222         {
   259             IRBaseView *currentView = static_cast<IRBaseView*>(iViewManager->currentView());
   223             return;
   260             if (currentView && EIR_UseNetwork_NoReason == currentView->getUseNetworkReason())
   224         }
   261             {
   225     }
   262                 return;
   226     
   263             }
   227     //if in search, we could not show the dialog
   264         }
   228     TIRViewId curViewID = static_cast<IRBaseView*>(iViewManager->currentView())->id();
       
   229     if ( EIRView_SearchView == curViewID )
       
   230     {
       
   231         return;        
       
   232     }
   265     }
   233     
   266     
   234     if (NULL == iLoadingNote)
   267     if (NULL == iLoadingNote)
   235     {
   268     {
   236         iLoadingNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
   269         iLoadingNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
   237         iLoadingNote->setModal(true);
   270         iLoadingNote->setModal(true);
   238         iLoadingNote->setTimeout(HbPopup::NoTimeout);
   271         iLoadingNote->setTimeout(HbPopup::NoTimeout);
   239         QAction *action = iLoadingNote->actions().at(0);
   272         QAction *action = iLoadingNote->actions().at(0);
       
   273 #ifdef SUBTITLE_STR_BY_LOCID
   240         action->setText(hbTrId("txt_common_button_cancel"));
   274         action->setText(hbTrId("txt_common_button_cancel"));
       
   275 #else
       
   276         action->setText(hbTrId("Cancel"));        
       
   277 #endif
   241     }
   278     }
   242     
   279     
   243     iLoadingNote->disconnect(SIGNAL(cancelled()));
   280     iLoadingNote->disconnect(SIGNAL(cancelled()));
   244     connect(iLoadingNote, SIGNAL(cancelled()), aReceiver, aFunc);
   281     connect(iLoadingNote, SIGNAL(cancelled()), aReceiver, aFunc);
   245 
   282 
   254         iLoadingNote->setText(iConnectingText);
   291         iLoadingNote->setText(iConnectingText);
   255         iConnectingText = "";
   292         iConnectingText = "";
   256     }
   293     }
   257     else
   294     else
   258     {
   295     {
       
   296 #ifdef SUBTITLE_STR_BY_LOCID
   259         iLoadingNote->setText(hbTrId("txt_common_info_loading"));
   297         iLoadingNote->setText(hbTrId("txt_common_info_loading"));
       
   298 #else
       
   299         iLoadingNote->setText(hbTrId("Loading"));        
       
   300 #endif
   260     }
   301     }
   261     
   302     
   262     iLoadingNote->show();
   303     iLoadingNote->show();
   263 }
   304 }
   264 
   305 
   265 void IRApplication::stopLoadingAnimation()
   306 void IRApplication::stopLoadingAnimation()
   266 {
   307 {
   267     LOG_METHOD_ENTER;
   308     LOG_METHOD_ENTER;
       
   309 
       
   310     // this function is the endpoint of cancel loading actions for all views
       
   311 	// so we can do cleanup action here, including player stop action.
       
   312 	// No need to stop the player in each views in the slot connected to the cancel signal of the loading note
       
   313     if (!getPlayController()->isPlaying())
       
   314     {
       
   315         getPlayController()->stop(EIRQUnknownTermination);
       
   316     }
       
   317     
   268     if (iLoadingNote)
   318     if (iLoadingNote)
   269     {
   319     {
   270         iLoadingNote->close();
   320         iLoadingNote->close();
   271     }
   321     } 
   272     
       
   273     if( iLoadingAnimation )
       
   274     {
       
   275         iLoadingAnimation->animator().stopAnimation();
       
   276         iLoadingAnimation->hide();         
       
   277     }
       
   278 }
   322 }
   279 
   323 
   280 /*
   324 /*
   281  * Description : return the pointer to the view manager object
   325  * Description : return the pointer to the view manager object
   282  * Parameters  : None
   326  * Parameters  : None
   405  * Return      : None
   449  * Return      : None
   406  */
   450  */
   407 void IRApplication::createComponents()
   451 void IRApplication::createComponents()
   408 {
   452 {
   409     getSettings();
   453     getSettings();
       
   454 #ifdef HS_WIDGET_ENABLED    
       
   455     iControlService = new IrControlService(this);
       
   456     iMonitorService = new IrMonitorService(this);	
       
   457 #endif	
   410 }
   458 }
   411 
   459 
   412 /*
   460 /*
   413  * Descriiption : destroy all the application level components 
   461  * Descriiption : destroy all the application level components 
   414  * Parameters   : None
   462  * Parameters   : None
   443         iSettings = NULL;
   491         iSettings = NULL;
   444     }
   492     }
   445     
   493     
   446     delete iMediaKeyObserver;
   494     delete iMediaKeyObserver;
   447     iMediaKeyObserver = NULL;
   495     iMediaKeyObserver = NULL;
       
   496 	
       
   497 #ifdef HS_WIDGET_ENABLED    
       
   498     delete iControlService;
       
   499     iControlService = NULL;
       
   500     
       
   501     delete iMonitorService;
       
   502     iMonitorService = NULL;
       
   503 #endif	
   448 }
   504 }
   449 
   505 
   450 void IRApplication::setupConnection()
   506 void IRApplication::setupConnection()
   451 {
   507 {
   452     connect(this, SIGNAL(quit()), qApp, SLOT(quit()));
   508     connect(this, SIGNAL(quit()), qApp, SLOT(quit()));
   512             }
   568             }
   513             break;
   569             break;
   514             
   570             
   515         case EIRQDisplayNetworkMessageNoConnectivity:
   571         case EIRQDisplayNetworkMessageNoConnectivity:
   516             {
   572             {
   517                 stopLoadingAnimation();
   573                 stopLoadingAnimation();                
   518                 HbMessageBox::warning(hbTrId("txt_irad_info_no_network_connectiion"), (QObject*)NULL, NULL);
   574                 LOG("IRApplication::networkEventNotified::no network connection");
       
   575                 if( !iMessageBox->isVisible() )
       
   576                 {
       
   577                     LOG("IRApplication::networkEventNotified::no network connection -- show dialog");
       
   578                     iMessageBox->show();
       
   579                 }
       
   580                 
   519                 if (!iDisconnected)
   581                 if (!iDisconnected)
   520                 {
   582                 {
   521                     /* the handling is up to each view */
   583                     /* the handling is up to each view */
   522                     iNetworkController->notifyActiveNetworkObservers(EIRQDisplayNetworkMessageNoConnectivity);
   584                     iNetworkController->notifyActiveNetworkObservers(EIRQDisplayNetworkMessageNoConnectivity);
   523                 }                
   585                 }                
   535     LOG_SLOT_CALLER;
   597     LOG_SLOT_CALLER;
   536     bool hasCache = iIsdsClient->isdsIsCategoryCached(IRQIsdsClient::EGenre);
   598     bool hasCache = iIsdsClient->isdsIsCategoryCached(IRQIsdsClient::EGenre);
   537 
   599 
   538     if (!hasCache)
   600     if (!hasCache)
   539     {
   601     {
   540         IRBaseView *currView = static_cast<IRBaseView*>(iViewManager->currentView());
   602         iUseNetworkReason = EIR_UseNetwork_LoadCategory;
   541         Q_ASSERT(currView);
       
   542         currView->setUseNetworkReason(EIR_UseNetwork_LoadCategory);
       
   543         if (false == verifyNetworkConnectivity())
   603         if (false == verifyNetworkConnectivity())
   544         {
   604         {
   545             return;
   605             return;
   546         }
   606         }
   547         currView->setUseNetworkReason(EIR_UseNetwork_NoReason);
   607         iUseNetworkReason = EIR_UseNetwork_NoReason;
   548     }
   608     }
   549     
   609     
   550     IRCategoryView *categoryView = static_cast<IRCategoryView*>(getViewManager()->getView(EIRView_CategoryView, true));
   610     IRCategoryView *categoryView = static_cast<IRCategoryView*>(getViewManager()->getView(EIRView_CategoryView, true));
   551     categoryView->loadCategory(IRQIsdsClient::EGenre);
   611     categoryView->loadCategory(IRQIsdsClient::EGenre);
   552 }
   612 }
   559         return;
   619         return;
   560     }
   620     }
   561     delete socket;
   621     delete socket;
   562     
   622     
   563     iViewManager->raise();
   623     iViewManager->raise();
   564 }
   624 } 
   565 
       
   566 void IRApplication::getLoadingAnimation()
       
   567 {
       
   568     HbIconAnimationManager::global()->addDefinitionFile("qtg_anim_loading.axml");
       
   569     iLoadingAnimation = new HbIconItem("qtg_anim_loading");
       
   570     iLoadingAnimation->hide();
       
   571     QGraphicsScene *targetScene = getViewManager()->scene();
       
   572     QGraphicsScene *oldScene = iLoadingAnimation->scene();
       
   573 
       
   574     if (targetScene != oldScene)
       
   575     {
       
   576         if (oldScene)
       
   577         {
       
   578             oldScene->removeItem(iLoadingAnimation);
       
   579         }
       
   580         targetScene->addItem(iLoadingAnimation); // takes ownership
       
   581     }
       
   582 
       
   583 }
       
   584 
   625 
   585 void IRApplication::initApp()
   626 void IRApplication::initApp()
   586 {
   627 {
   587     getNetworkController();    
   628     getNetworkController();    
   588     
   629     
   593         view->launchAction();
   634         view->launchAction();
   594     }
   635     }
   595     getMediaKeyObserver();	
   636     getMediaKeyObserver();	
   596     startSystemEventMonitor();
   637     startSystemEventMonitor();
   597     startLocalServer();
   638     startLocalServer();
       
   639     //when IR is running, remove activity. Otherwise user can see two items in task switcher
       
   640     iViewManager->removeActivity();
       
   641     
       
   642 #ifdef HS_WIDGET_ENABLED		
       
   643     // Write the startup timestamp to P&S key for the homescreen widget
       
   644     XQSettingsManager settingsManager;
       
   645     XQPublishAndSubscribeUtils psUtils(settingsManager);
       
   646     XQPublishAndSubscribeSettingsKey irStartupKey(KInternetRadioPSUid, KInternetRadioStartupKey);
       
   647     if (psUtils.defineProperty(irStartupKey, XQSettingsManager::TypeInt))
       
   648     {
       
   649         settingsManager.writeItemValue(irStartupKey, (int)QDateTime::currentDateTime().toTime_t());
       
   650     } 
       
   651 #endif        
   598 }
   652 }
   599 
   653 
   600 bool IRApplication::event(QEvent* e)
   654 bool IRApplication::event(QEvent* e)
   601 {
   655 {
   602     if(e->type() == iInitEvent)
   656     if(e->type() == iInitEvent)
   608     return QObject::event(e);
   662     return QObject::event(e);
   609 }
   663 }
   610 
   664 
   611 TIRHandleResult IRApplication::handleConnectionEstablished()
   665 TIRHandleResult IRApplication::handleConnectionEstablished()
   612 {
   666 {
   613     IRBaseView *currView = static_cast<IRBaseView*>(iViewManager->currentView());
   667     TIRHandleResult retVal = EIR_DoDefault;
   614     Q_ASSERT(currView);
   668     switch (iUseNetworkReason)
   615     
   669     {
   616     if (EIR_UseNetwork_LoadCategory == currView->getUseNetworkReason())
   670         case EIR_UseNetwork_LoadCategory:
   617     {
   671         {
   618         IRCategoryView *categoryView = static_cast<IRCategoryView*>(getViewManager()->getView(EIRView_CategoryView, true));
   672             IRCategoryView *categoryView = static_cast<IRCategoryView*>(getViewManager()->getView(EIRView_CategoryView, true));
   619         categoryView->loadCategory(IRQIsdsClient::EGenre);
   673             categoryView->loadCategory(IRQIsdsClient::EGenre); 
   620         currView->setUseNetworkReason(EIR_UseNetwork_NoReason);
   674             retVal = EIR_NoDefault;        
   621         return EIR_NoDefault;
   675             break;    
   622     }
   676         }
   623     
   677             
   624     return EIR_DoDefault;
   678 #ifdef HS_WIDGET_ENABLED            
       
   679         case EIR_UseNetwork_PlayStation: // play last station when player is in Idle state while there is no connection.
       
   680             getPlayController()->resume();
       
   681             retVal = EIR_NoDefault;        
       
   682             break;  
       
   683 #endif
       
   684         default:
       
   685             break;
       
   686     }
       
   687     
       
   688     iUseNetworkReason = EIR_UseNetwork_NoReason;    
       
   689     return retVal;
   625 }
   690 }
   626 
   691 
   627 void IRApplication::handleTermsConsAccepted()
   692 void IRApplication::handleTermsConsAccepted()
   628 {
   693 {
   629     iSettings->reSetFlagTermsAndConditions();
   694     iSettings->reSetFlagTermsAndConditions();
   637     QCoreApplication::postEvent(this, initEvent, Qt::HighEventPriority); 	 
   702     QCoreApplication::postEvent(this, initEvent, Qt::HighEventPriority); 	 
   638 }
   703 }
   639 
   704 
   640 void IRApplication::launchStartingView(TIRViewId aViewId)
   705 void IRApplication::launchStartingView(TIRViewId aViewId)
   641 {
   706 {
   642     bool isFirstTimeUsage = false;
   707     iStartingViewId = aViewId;
       
   708     /* bool isFirstTimeUsage = false;
   643     iSettings->isFlagTermsAndConditions(isFirstTimeUsage);
   709     iSettings->isFlagTermsAndConditions(isFirstTimeUsage);
   644     iStartingViewId = aViewId;
   710     
   645     if(isFirstTimeUsage)
   711     if(isFirstTimeUsage)
   646     {
   712     {
   647         iViewManager->activateView(EIRView_TermsConsView);  
   713         iViewManager->activateView(EIRView_TermsConsView);  
   648 		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);    
   714 		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);    
   649     }
   715     }
   650     else
   716     else*/
   651     {
   717     {
   652         iViewManager->activateView(iStartingViewId);
   718         iViewManager->activateView(iStartingViewId);
   653         QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
   719         QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
   654         QEvent* initEvent = new QEvent(iInitEvent);
   720         QEvent* initEvent = new QEvent(iInitEvent);
   655         QCoreApplication::postEvent(this, initEvent, Qt::HighEventPriority);         
   721         QCoreApplication::postEvent(this, initEvent, Qt::HighEventPriority);         
   656     }	
   722     }
       
   723     
       
   724     iAppFullyStarted = true;
       
   725 }
       
   726 
       
   727 bool IRApplication::isAppFullyStarted() const
       
   728 {
       
   729     return iAppFullyStarted;
   657 }
   730 }
   658 
   731 
   659 void IRApplication::setExitingView()
   732 void IRApplication::setExitingView()
   660 {
   733 {  
   661     if (XQServiceUtil::isService())
       
   662     {
       
   663         return;
       
   664     }    
       
   665     TIRViewId viewId = iViewManager->getExitingView();
   734     TIRViewId viewId = iViewManager->getExitingView();
   666     if(EIRView_InvalidId != viewId)
   735     if(EIRView_InvalidId != viewId)
   667     {
   736     {
   668         getSettings()->setStartingViewId(viewId);
   737         getSettings()->setStartingViewId(viewId);
   669     }
   738     }
   670 }
   739 }
       
   740 
       
   741 
       
   742 #ifdef HS_WIDGET_ENABLED
       
   743 bool IRApplication::startPlaying()
       
   744 {
       
   745     // if any loading is in progress, disallow to play
       
   746     if (iLoadingNote && iLoadingNote->isVisible())
       
   747     {
       
   748         LOG( "IRApplication::startPlaying() in the return false1");
       
   749         return false;
       
   750     }
       
   751     
       
   752     if (getPlayController()->isStopped())
       
   753     {         
       
   754         LOG_FORMAT( "IRApplication::startPlaying(), the station name is %s", 
       
   755                 STRING2CHAR(getPlayController()->getNowPlayingPreset()->name));
       
   756         iUseNetworkReason = EIR_UseNetwork_PlayStation;
       
   757         getPlayController()->setConnectingStationName(getPlayController()->getNowPlayingPreset()->name);
       
   758         if (verifyNetworkConnectivity())
       
   759         {
       
   760             iUseNetworkReason = EIR_UseNetwork_NoReason;
       
   761             getPlayController()->resume();
       
   762         }
       
   763         return true;
       
   764     }
       
   765     else
       
   766     {
       
   767         LOG( "IRApplication::startPlaying() in the return false2");
       
   768         return false;
       
   769     }
       
   770 }
       
   771 
       
   772 void IRApplication::cancelPlayerLoading()
       
   773 {
       
   774     if (IRPlayController::EConnecting == getPlayController()->state() 
       
   775         || IRPlayController::EBuffering == getPlayController()->state())
       
   776     {       
       
   777         if (iLoadingNote && iLoadingNote->isVisible())
       
   778         {
       
   779             iLoadingNote->cancel();
       
   780         }      
       
   781     }   
       
   782 }
       
   783 
       
   784 #endif
       
   785 
   671 
   786 
   672 void IRApplication::startLocalServer()
   787 void IRApplication::startLocalServer()
   673 {
   788 {
   674     QString serverName = QCoreApplication::applicationName();
   789     QString serverName = QCoreApplication::applicationName();
   675     iLocalServer = new QLocalServer(this);
   790     iLocalServer = new QLocalServer(this);
   743 }
   858 }
   744     
   859     
   745 void IRApplication::handleDiskSpaceLow(qint64 aCriticalLevel)
   860 void IRApplication::handleDiskSpaceLow(qint64 aCriticalLevel)
   746 {
   861 {
   747     Q_UNUSED(aCriticalLevel);
   862     Q_UNUSED(aCriticalLevel);
   748     HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_no_space_on_c_drive_internet_radio_closed"),
   863 #ifdef SUBTITLE_STR_BY_LOCID
       
   864     HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_insufficient_disk_space"),
   749             HbMessageBox::MessageTypeWarning);
   865             HbMessageBox::MessageTypeWarning);
       
   866 #else
       
   867     HbDeviceMessageBox messageBox(hbTrId("Insufficient disk space"),
       
   868                 HbMessageBox::MessageTypeWarning);    
       
   869 #endif
   750     messageBox.setTimeout(HbPopup::NoTimeout);
   870     messageBox.setTimeout(HbPopup::NoTimeout);
   751     messageBox.exec();
   871     messageBox.exec();
   752     qApp->quit();    
   872     qApp->quit();    
   753 }
   873 }
   754 
   874