phonesettings/cpphonesettingsplugins/cptelephonyutils/src/cpplugincommon.cpp
changeset 76 cfea66083b62
parent 65 2a5d4ab426d3
child 78 baacf668fe89
equal deleted inserted replaced
74:d1c62c765e48 76:cfea66083b62
    57 bool Tools::videoSupported()
    57 bool Tools::videoSupported()
    58 {
    58 {
    59     return XQSysInfo::isSupported(KFeatureIdCsVideoTelephony);
    59     return XQSysInfo::isSupported(KFeatureIdCsVideoTelephony);
    60 }
    60 }
    61 
    61 
    62 CpSettingsWrapper::CpSettingsWrapper(QObject *parent): 
    62 SettingsWrapper::SettingsWrapper(QObject *parent): 
    63     QObject(parent),
    63     QObject(parent),
    64     m_settings(NULL),
    64     m_settings(NULL),
    65     m_deviceInfo(NULL)
    65     m_deviceInfo(NULL)
    66 {
    66 {
    67     m_settings = new XQSettingsManager(this);
    67     m_settings = new XQSettingsManager(this);
    68     m_deviceInfo = new QSystemDeviceInfo(this);
    68     m_deviceInfo = new QSystemDeviceInfo(this);
    69 }
    69 }
    70 
    70 
    71 CpSettingsWrapper::~CpSettingsWrapper()
    71 SettingsWrapper::~SettingsWrapper()
    72 {
    72 {
    73     
    73     
    74 }
    74 }
    75 
    75 
    76 bool CpSettingsWrapper::showCallDuration()
    76 bool SettingsWrapper::showCallDuration()
    77 {
    77 {
    78     bool showDuration; 
    78     bool showDuration; 
    79     if (CenrepKeyValueOn == readCenrepValue(KCRUidLogs.iUid, KLogsShowCallDuration).toInt()) {
    79     if (CenrepKeyValueOn == readCenrepValue(KCRUidLogs.iUid, KLogsShowCallDuration).toInt()) {
    80         showDuration = true; 
    80         showDuration = true; 
    81     } else {
    81     } else {
    84     
    84     
    85     DPRINT << "show call duration:" << showDuration;
    85     DPRINT << "show call duration:" << showDuration;
    86     return showDuration;
    86     return showDuration;
    87 }
    87 }
    88 
    88 
    89 int CpSettingsWrapper::setShowCallDuration(bool value)
    89 int SettingsWrapper::setShowCallDuration(bool value)
    90 {
    90 {
    91     int cenrepValue; 
    91     int cenrepValue; 
    92     DPRINT << "show call duration:" << value;
    92     DPRINT << "show call duration:" << value;
    93 
    93 
    94     if (value) {
    94     if (value) {
    97         cenrepValue = CenrepKeyValueOff; 
    97         cenrepValue = CenrepKeyValueOff; 
    98     }
    98     }
    99     return writeCenrepValue(KCRUidLogs.iUid, KLogsShowCallDuration, cenrepValue );
    99     return writeCenrepValue(KCRUidLogs.iUid, KLogsShowCallDuration, cenrepValue );
   100 }
   100 }
   101 
   101 
   102 int CpSettingsWrapper::readVtVideoSending()
   102 int SettingsWrapper::readVtVideoSending()
   103 {
   103 {
   104     DPRINT << ": IN";
   104     DPRINT << ": IN";
   105     return readCenrepValue(KCRUidTelephonySettings.iUid, KSettingsVTVideoSending).toInt();
   105     return readCenrepValue(KCRUidTelephonySettings.iUid, KSettingsVTVideoSending).toInt();
   106 }
   106 }
   107 
   107 
   108 int CpSettingsWrapper::writeVtVideoSending(int value)
   108 int SettingsWrapper::writeVtVideoSending(int value)
   109 {
   109 {
   110     DPRINT << ": IN";
   110     DPRINT << ": IN";
   111     return writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsVTVideoSending, value);
   111     return writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsVTVideoSending, value);
   112 }
   112 }
   113 
   113 
   114 void CpSettingsWrapper::readSoftRejectText(QString &text, bool &userDefined )
   114 void SettingsWrapper::readSoftRejectText(QString &text, bool &userDefined )
   115 {
   115 {
   116     if (SoftRejectTextDefault ==
   116     if (SoftRejectTextDefault ==
   117         readCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectDefaultInUse ).toInt()) {
   117         readCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectDefaultInUse ).toInt()) {
   118         userDefined = false; 
   118         userDefined = false; 
   119     } else {
   119     } else {
   122         
   122         
   123     text = readCenrepString(KCRUidTelephonySettings.iUid, KSettingsSoftRejectText);
   123     text = readCenrepString(KCRUidTelephonySettings.iUid, KSettingsSoftRejectText);
   124     DPRINT << "text:" << text << " ,userDefined:" << userDefined;
   124     DPRINT << "text:" << text << " ,userDefined:" << userDefined;
   125 }
   125 }
   126 
   126 
   127 int CpSettingsWrapper::writeSoftRejectText(const QString &text, bool userDefined )
   127 int SettingsWrapper::writeSoftRejectText(const QString &text, bool userDefined )
   128 {
   128 {
   129     int err = writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectText, text);
   129     int err = writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectText, text);
   130     int cenrepValue; 
   130     int cenrepValue; 
   131     if (userDefined) {
   131     if (userDefined) {
   132         cenrepValue = SoftRejectTextUserDefined; 
   132         cenrepValue = SoftRejectTextUserDefined; 
   136     err |= writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectDefaultInUse, cenrepValue);
   136     err |= writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectDefaultInUse, cenrepValue);
   137     DPRINT << "text:" << text << " ,userDefined:" << userDefined << " , err:" << err;
   137     DPRINT << "text:" << text << " ,userDefined:" << userDefined << " , err:" << err;
   138     return err;
   138     return err;
   139 }
   139 }
   140 
   140 
   141  bool CpSettingsWrapper::numberGroupingSupported() const
   141  bool SettingsWrapper::numberGroupingSupported() const
   142  {
   142  {
   143      return readCenrepValue(KCRUidNumberGrouping.iUid, KNumberGrouping).toBool();
   143      return readCenrepValue(KCRUidNumberGrouping.iUid, KNumberGrouping).toBool();
   144  }
   144  }
   145  
   145  
   146  bool CpSettingsWrapper::forbiddenIconSupported() const
   146  bool SettingsWrapper::forbiddenIconSupported() const
   147  {
   147  {
   148      int keyValue = readCenrepValue(KCRUidTelVariation.iUid, KTelVariationFlags).toInt();
   148      int keyValue = readCenrepValue(KCRUidTelVariation.iUid, KTelVariationFlags).toInt();
   149      return (KTelephonyLVFlagForbiddenIcon & keyValue);
   149      return (KTelephonyLVFlagForbiddenIcon & keyValue);
   150  }
   150  }
   151 
   151 
   152 QVariant CpSettingsWrapper::readCenrepValue(
   152 QVariant SettingsWrapper::readCenrepValue(
   153     const long int uid, const unsigned long int key) const
   153     const long int uid, const unsigned long int key) const
   154 {
   154 {
   155     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   155     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   156     QVariant ret = m_settings->readItemValue(settingsKey);
   156     QVariant ret = m_settings->readItemValue(settingsKey);
   157     DPRINT << "ret: " << ret;
   157     DPRINT << "ret: " << ret;
   158     return ret;
   158     return ret;
   159 }
   159 }
   160 
   160 
   161 QVariant CpSettingsWrapper::readPubSubValue(
   161 QVariant SettingsWrapper::readPubSubValue(
   162     const long int uid, const unsigned long int key) const
   162     const long int uid, const unsigned long int key) const
   163 {
   163 {
   164     XQSettingsKey settingsKey(XQSettingsKey::TargetPublishAndSubscribe, uid, key);
   164     XQSettingsKey settingsKey(XQSettingsKey::TargetPublishAndSubscribe, uid, key);
   165     QVariant ret = m_settings->readItemValue(settingsKey);
   165     QVariant ret = m_settings->readItemValue(settingsKey);
   166     DPRINT << "PubSub ret: " << ret;
   166     DPRINT << "PubSub ret: " << ret;
   167     return ret;
   167     return ret;
   168 }
   168 }
   169 
   169 
   170 QString CpSettingsWrapper::readCenrepString(
   170 QString SettingsWrapper::readCenrepString(
   171     const long int uid, const unsigned long int key) const
   171     const long int uid, const unsigned long int key) const
   172 {
   172 {
   173     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   173     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   174     QString text = m_settings->readItemValue(settingsKey, XQSettingsManager::TypeString).toString();
   174     QString text = m_settings->readItemValue(settingsKey, XQSettingsManager::TypeString).toString();
   175     DPRINT << "text: " << text;
   175     DPRINT << "text: " << text;
   176     return text;
   176     return text;
   177 }
   177 }
   178 
   178 
   179 int CpSettingsWrapper::writeCenrepValue(
   179 int SettingsWrapper::writeCenrepValue(
   180     const long int uid, const unsigned long int key, const QVariant &settingsKeyValue ) const
   180     const long int uid, const unsigned long int key, const QVariant &settingsKeyValue ) const
   181 {
   181 {
   182     DPRINT << "uid:" << uid << ", key:" << key << ", settingsKeyValue:" << settingsKeyValue;
   182     DPRINT << "uid:" << uid << ", key:" << key << ", settingsKeyValue:" << settingsKeyValue;
   183     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   183     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key);
   184     int err = m_settings->writeItemValue(settingsKey, settingsKeyValue );
   184     int err = m_settings->writeItemValue(settingsKey, settingsKeyValue );
   185     DPRINT << "err: " << err;
   185     DPRINT << "err: " << err;
   186     return err;
   186     return err;
   187 }
   187 }
   188 
   188 
   189 bool CpSettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled()
   189 bool SettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled()
   190 {
   190 {
   191     bool enabled = readCenrepValue(KCRUidPhoneSettings.iUid, KPSetCallWaiting).toBool();
   191     bool enabled = readCenrepValue(KCRUidPhoneSettings.iUid, KPSetCallWaiting).toBool();
   192     DPRINT << "enabled: " << enabled;
   192     DPRINT << "enabled: " << enabled;
   193     return enabled;
   193     return enabled;
   194 }
   194 }
   195 
   195 
   196 bool CpSettingsWrapper::isPhoneOffline() const
   196 bool SettingsWrapper::isPhoneOffline() const
   197 {
   197 {
   198     bool networkConnectionAllowed = readCenrepValue(KCRUidCoreApplicationUIs.iUid,
   198     bool networkConnectionAllowed = readCenrepValue(KCRUidCoreApplicationUIs.iUid,
   199                                 KCoreAppUIsNetworkConnectionAllowed).toBool();
   199                                 KCoreAppUIsNetworkConnectionAllowed).toBool();
   200     // 0 = Offline Mode, 1 = Online Mode
   200     // 0 = Offline Mode, 1 = Online Mode
   201     DPRINT << "networkConnectionAllowed: " << networkConnectionAllowed;
   201     DPRINT << "networkConnectionAllowed: " << networkConnectionAllowed;
   202     return !networkConnectionAllowed;
   202     return !networkConnectionAllowed;
   203 }
   203 }
   204 
   204 
   205 bool CpSettingsWrapper::isOngoingCall() const
   205 bool SettingsWrapper::isOngoingCall() const
   206 {
   206 {
   207     bool callOngoing(false);
   207     bool callOngoing(false);
   208     if (EPSCTsyCallStateNone < 
   208     if (EPSCTsyCallStateNone < 
   209             readPubSubValue(KPSUidCtsyCallInformation.iUid, KCTsyCallState).toInt()) {
   209             readPubSubValue(KPSUidCtsyCallInformation.iUid, KCTsyCallState).toInt()) {
   210         callOngoing = true; 
   210         callOngoing = true;