--- a/radioapp/radioapplication/src/radioapplication.cpp Mon May 03 12:31:41 2010 +0300
+++ b/radioapp/radioapplication/src/radioapplication.cpp Fri May 14 15:52:32 2010 +0300
@@ -17,10 +17,11 @@
// System includes
#include <QTimer>
+#include <HbDeviceMessageBox>
// User includes
#include "radioapplication.h"
-#include "radiomainwindow.h"
+#include "radiowindow.h"
#include "radiouiengine.h"
#include "radio_global.h"
#include "radiologger.h"
@@ -43,8 +44,7 @@
* Constructor
*/
RadioApplication::RadioApplication( int &argc, char *argv[] ) :
- HbApplication( argc, argv ),
- mUiEngine( 0 )
+ HbApplication( argc, argv )
{
// Initializes the radio engine utils if UI logs are entered into the engine log
INIT_COMBINED_LOGGER
@@ -52,13 +52,6 @@
LOG_TIMESTAMP( "Start radio" );
setApplicationName( hbTrId( "txt_rad_title_fm_radio" ) );
- // MainWindow needs to be alive to be able to show the offline query dialog.
- // The window is only constructed half-way at this point because we may need to shut down if
- // offline usage is not allowed
- mMainWindow = RadioMainWindowPtr( new RadioMainWindow() );
-
- CREATE_WIN32_TEST_WINDOW
-
QTimer::singleShot( 0, this, SLOT(init()) );
}
@@ -78,24 +71,31 @@
*/
void RadioApplication::init()
{
- if ( RadioUiEngine::isOfflineProfile() && !mMainWindow->isOfflineUsageAllowed() ) {
- quit();
- return;
- }
+ bool okToStart = !RadioUiEngine::isOfflineProfile();
+
+ if ( !okToStart ) {
+ HbDeviceMessageBox box( hbTrId( "txt_rad_info_activate_radio_in_offline_mode" ), HbMessageBox::MessageTypeQuestion );
+ box.setTimeout( HbPopup::NoTimeout );
+ box.exec();
+ okToStart = box.isAcceptAction( box.triggeredAction() );
+ }
- // Start the engine
- mUiEngine = new RadioUiEngine( this );
- if ( !mUiEngine->startRadio() ) {
- //TODO: Get error message
-// mMainWindow->showErrorMessage( TRANSLATE( KErrorEngineStartFailed ) );
- quit();
- return;
- }
+ if ( okToStart ) {
+
+ // MainWindow needs to be alive to be able to show the offline query dialog.
+ // The window is only constructed half-way at this point because we may need to shut down if
+ // offline usage is not allowed
+ mMainWindow.reset( new RadioWindow() );
+
+ CREATE_WIN32_TEST_WINDOW
INIT_WIN32_TEST_WINDOW
// Construct the real views
- mMainWindow->init( mUiEngine );
+ mMainWindow->init();
mMainWindow->show();
+ } else {
+ quit();
+ }
}