15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // System includes |
18 // System includes |
19 #include <QDateTime> |
19 #include <QDateTime> |
20 // TODO: Profile information should be accessed from QtMobility when it is |
|
21 // ready. |
|
22 #include <ProfileEngineSDKCRKeys.h> |
|
23 #include "xqsettingsmanager.h" |
20 #include "xqsettingsmanager.h" |
24 #include "xqsettingskey.h" |
21 #include "xqsettingskey.h" |
25 #include "xqpublishandsubscribeutils.h" |
22 #include "xqpublishandsubscribeutils.h" |
26 |
23 |
27 // User includes |
24 // User includes |
28 #include "radiohswidgetprofilereader.h" |
25 #include "radiohswidgetprofilereader.h" |
29 #include "radiohswidget.h" |
26 #include "radiohswidget.h" |
30 #include "radioservicedef.h" |
27 #include "radioservicedef.h" |
|
28 #include "radio_global.h" |
31 #include "radiologger.h" |
29 #include "radiologger.h" |
32 |
30 |
33 // Constants |
31 // Constants |
34 /** Constant for radio running undefined status. */ |
32 /** Constant for radio running undefined status. */ |
35 const int RADIO_RUNNING_STATUS_UNDEFINED(-1); |
33 const int RADIO_RUNNING_STATUS_UNDEFINED(-1); |
36 /** Constant for Off-line profile. */ |
|
37 const int OFFLINE_PROFILE(5); |
|
38 |
34 |
39 /*! |
35 /*! |
40 \class RadioHsWidgetProfileReader |
36 \class RadioHsWidgetProfileReader |
41 \brief Implementation of P&S key reader and monitor. |
37 \brief Implementation of P&S key reader and monitor. |
42 |
38 |
90 radioRunningStatus( |
86 radioRunningStatus( |
91 mSettingsManager->readItemValue(radioRunningKey)); |
87 mSettingsManager->readItemValue(radioRunningKey)); |
92 } |
88 } |
93 |
89 |
94 /*! |
90 /*! |
95 Reads the current profile of the device and \returns \c true if the |
91 Checks if device is in offline mode and \returns \c true if it is |
96 current profile is offline, \c false otherwise. |
92 and \c false if not. |
97 */ |
93 */ |
98 bool RadioHsWidgetProfileReader::isCurrentProfileOffline() |
94 bool RadioHsWidgetProfileReader::isInOfflineMode() |
99 { |
95 { |
100 LOG_METHOD_RET("%d"); |
96 LOG_METHOD_RET("%d"); |
101 XQSettingsKey profileKey(XQSettingsKey::TargetCentralRepository, |
97 XQSettingsKey connectionKey( XQSettingsKey::TargetCentralRepository, |
102 KCRUidProfileEngine.iUid, KProEngActiveProfile); |
98 CENREP_CORE_APPLICATION_UIS, ID_NETWORK_CONNECTION_ALLOWED ); |
|
99 |
103 // Read current value. |
100 // Read current value. |
104 QVariant profile(mSettingsManager->readItemValue(profileKey)); |
101 const QVariant connectionAllowed = mSettingsManager->readItemValue( connectionKey ); |
105 if (profile.canConvert(QVariant::Int) && profile.toInt() == OFFLINE_PROFILE) { |
102 if ( connectionAllowed.canConvert( QVariant::Int ) && connectionAllowed.toInt() == NetworkNotAllowed ) { |
106 return true; |
103 return true; |
107 } |
104 } |
|
105 |
108 return false; |
106 return false; |
109 } |
107 } |
110 |
108 |
111 /*! |
109 /*! |
112 Handling of deletion of listened keys. |
110 Handling of deletion of listened keys. |