phonesettings/cpphonesettingsplugins/cptelephonyutils/src/cpplugincommon.cpp
changeset 56 5bcb308bd24d
parent 46 bc5a64e5bc3c
child 60 1eef62f5c541
equal deleted inserted replaced
46:bc5a64e5bc3c 56:5bcb308bd24d
   134 
   134 
   135     return errorTextFound;
   135     return errorTextFound;
   136 }
   136 }
   137 
   137 
   138 CpSettingsWrapper::CpSettingsWrapper(QObject *parent): 
   138 CpSettingsWrapper::CpSettingsWrapper(QObject *parent): 
   139     QObject(parent)
   139     QObject(parent),
   140 {
   140     m_settings(NULL),
   141     m_Settings = new XQSettingsManager();
   141     m_deviceInfo(NULL)
       
   142 {
       
   143     m_settings = new XQSettingsManager(this);
       
   144     m_deviceInfo = new QSystemDeviceInfo(this);
   142 }
   145 }
   143 
   146 
   144 CpSettingsWrapper::~CpSettingsWrapper()
   147 CpSettingsWrapper::~CpSettingsWrapper()
   145 {
   148 {
   146     delete m_Settings;
   149     
   147 }
   150 }
   148 
   151 
   149 bool CpSettingsWrapper::showCallDuration()
   152 bool CpSettingsWrapper::showCallDuration()
   150 {
   153 {
   151     bool showDuration; 
   154     bool showDuration; 
   224 
   227 
   225 QVariant CpSettingsWrapper::readCenrepValue(
   228 QVariant CpSettingsWrapper::readCenrepValue(
   226     const long int uid, const unsigned long int key) const
   229     const long int uid, const unsigned long int key) const
   227 {
   230 {
   228     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   231     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   229     QVariant ret = m_Settings->readItemValue(settingsKey);
   232     QVariant ret = m_settings->readItemValue(settingsKey);
   230     DPRINT << "ret: " << ret;
   233     DPRINT << "ret: " << ret;
   231     return ret;
   234     return ret;
   232 }
   235 }
   233 
   236 
   234 QVariant CpSettingsWrapper::readPubSubValue(
   237 QVariant CpSettingsWrapper::readPubSubValue(
   235     const long int uid, const unsigned long int key) const
   238     const long int uid, const unsigned long int key) const
   236 {
   239 {
   237     XQSettingsKey settingsKey(XQSettingsKey::TargetPublishAndSubscribe, uid, key);
   240     XQSettingsKey settingsKey(XQSettingsKey::TargetPublishAndSubscribe, uid, key);
   238     QVariant ret = m_Settings->readItemValue(settingsKey);
   241     QVariant ret = m_settings->readItemValue(settingsKey);
   239     DPRINT << "PubSub ret: " << ret;
   242     DPRINT << "PubSub ret: " << ret;
   240     return ret;
   243     return ret;
   241 }
   244 }
   242 
   245 
   243 QString CpSettingsWrapper::readCenrepString(
   246 QString CpSettingsWrapper::readCenrepString(
   244     const long int uid, const unsigned long int key) const
   247     const long int uid, const unsigned long int key) const
   245 {
   248 {
   246     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   249     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   247     QString text = m_Settings->readItemValue(settingsKey, XQSettingsManager::TypeString).toString();
   250     QString text = m_settings->readItemValue(settingsKey, XQSettingsManager::TypeString).toString();
   248     DPRINT << "text: " << text;
   251     DPRINT << "text: " << text;
   249     return text;
   252     return text;
   250 }
   253 }
   251 
   254 
   252 int CpSettingsWrapper::writeCenrepValue(
   255 int CpSettingsWrapper::writeCenrepValue(
   253     const long int uid, const unsigned long int key, const QVariant &settingsKeyValue ) const
   256     const long int uid, const unsigned long int key, const QVariant &settingsKeyValue ) const
   254 {
   257 {
   255     DPRINT << "uid:" << uid << ", key:" << key << ", settingsKeyValue:" << settingsKeyValue;
   258     DPRINT << "uid:" << uid << ", key:" << key << ", settingsKeyValue:" << settingsKeyValue;
   256     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   259     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   257     int err = m_Settings->writeItemValue(settingsKey, settingsKeyValue );
   260     int err = m_settings->writeItemValue(settingsKey, settingsKeyValue );
   258     DPRINT << "err: " << err;
   261     DPRINT << "err: " << err;
   259     return err;
   262     return err;
   260 }
   263 }
   261 
   264 
   262 bool CpSettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled()
   265 bool CpSettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled()
   266     return enabled;
   269     return enabled;
   267 }
   270 }
   268 
   271 
   269 bool CpSettingsWrapper::isPhoneOffline() const
   272 bool CpSettingsWrapper::isPhoneOffline() const
   270 {
   273 {
   271     bool offLinesupport(false);
   274     return QSystemDeviceInfo::OfflineProfile == m_deviceInfo->currentProfile();
   272     if (XQSysInfo::isSupported(KFeatureIdOfflineMode)) {
       
   273         offLinesupport = !readCenrepValue(
       
   274                 KCRUidCoreApplicationUIs.iUid, 
       
   275                 KCoreAppUIsNetworkConnectionAllowed).toBool();
       
   276     }
       
   277     return offLinesupport;
       
   278 }
   275 }
   279 
   276 
   280 bool CpSettingsWrapper::isOngoingCall() const
   277 bool CpSettingsWrapper::isOngoingCall() const
   281 {
   278 {
   282     bool callOngoing(false);
   279     bool callOngoing(false);
   284             readPubSubValue(KPSUidCtsyCallInformation.iUid, KCTsyCallState).toInt()) {
   281             readPubSubValue(KPSUidCtsyCallInformation.iUid, KCTsyCallState).toInt()) {
   285         callOngoing = true; 
   282         callOngoing = true; 
   286     }
   283     }
   287     return callOngoing;
   284     return callOngoing;
   288 }
   285 }
   289