equal
deleted
inserted
replaced
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // System includes |
18 // System includes |
19 #include <QTimer> |
19 #include <QTimer> |
|
20 #include <qsysteminfo.h> |
20 #include <HbDeviceMessageBox> |
21 #include <HbDeviceMessageBox> |
21 |
22 |
22 // User includes |
23 // User includes |
23 #include "radioapplication.h" |
24 #include "radioapplication.h" |
24 #include "radiowindow.h" |
25 #include "radiowindow.h" |
69 *Private slot |
70 *Private slot |
70 * |
71 * |
71 */ |
72 */ |
72 void RadioApplication::init() |
73 void RadioApplication::init() |
73 { |
74 { |
74 bool okToStart = !RadioUiEngine::isOfflineProfile(); |
75 // If started as a service, there is no need for offline-check |
|
76 const Hb::ActivationReason reason = activateReason(); |
|
77 bool okToStart = reason == Hb::ActivationReasonService; |
|
78 QScopedPointer<QtMobility::QSystemDeviceInfo> deviceInfo( new QtMobility::QSystemDeviceInfo() ); |
75 |
79 |
76 if ( !okToStart ) { |
80 if ( !okToStart ) { |
77 HbDeviceMessageBox box( hbTrId( "txt_rad_info_activate_radio_in_offline_mode" ), HbMessageBox::MessageTypeQuestion ); |
81 if ( deviceInfo->currentProfile() != QtMobility::QSystemDeviceInfo::OfflineProfile ) { |
78 box.setTimeout( HbPopup::NoTimeout ); |
82 okToStart = true; |
79 box.exec(); |
83 } else { |
80 okToStart = box.isAcceptAction( box.triggeredAction() ); |
84 // Device is in offline profile, ask the user for permission to start |
|
85 HbDeviceMessageBox box( hbTrId( "txt_rad_info_activate_radio_in_offline_mode" ), HbMessageBox::MessageTypeQuestion ); |
|
86 box.setTimeout( HbPopup::NoTimeout ); |
|
87 box.exec(); |
|
88 okToStart = box.isAcceptAction( box.triggeredAction() ); |
|
89 } |
81 } |
90 } |
82 |
91 |
83 if ( okToStart ) { |
92 if ( okToStart ) { |
84 |
93 |
85 // MainWindow needs to be alive to be able to show the offline query dialog. |
94 // MainWindow needs to be alive to be able to show the offline query dialog. |
90 CREATE_WIN32_TEST_WINDOW |
99 CREATE_WIN32_TEST_WINDOW |
91 |
100 |
92 INIT_WIN32_TEST_WINDOW |
101 INIT_WIN32_TEST_WINDOW |
93 |
102 |
94 // Construct the real views |
103 // Construct the real views |
95 mMainWindow->init(); |
104 mMainWindow->init( deviceInfo.take() ); |
96 |
105 |
97 mMainWindow->show(); |
106 mMainWindow->show(); |
98 } else { |
107 } else { |
99 quit(); |
108 quit(); |
100 } |
109 } |