TizenRefApp-8554 Implement data roaming required case 57/130957/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 24 May 2017 13:44:00 +0000 (16:44 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 24 May 2017 13:44:00 +0000 (16:44 +0300)
Change-Id: Ic0196e13aa3fd363760354b49a0c567be0a7ffde
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/SystemSettingsManager/inc/SystemSettingsManager.h
src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp
src/Composer/Controller/inc/MsgBodyFrame.h
src/Composer/Controller/src/MsgBodyFrame.cpp

index 177771b742d2e77082c17e0c050b8f86f527592e..c012a788cdc9a6b56c057d0f537708e442449697 100644 (file)
@@ -72,6 +72,18 @@ namespace Msg
              */
             bool isFlightModeEnabled() const;
 
+            /**
+             * @brief Checks roaming status
+             * @return true if roaming, false otherwise.
+             */
+            bool isRoaming() const;
+
+            /**
+             * @brief Checks whether roaming data is enabled or not
+             * @return true if enabled, false otherwise.
+             */
+            bool isRoamingDataEnabled() const;
+
         private:
             SystemSettingsManager(SystemSettingsManager&) = delete;
             SystemSettingsManager &operator =(const SystemSettingsManager&) = delete;
index 7179cc8829ede9161844e94c1e03235947c59d85..c7dda860881d17815bdb26196ab5fbdb5aa21f1d 100644 (file)
@@ -20,6 +20,8 @@
 #include <algorithm>
 #include <system_settings.h>
 #include <dpm/restriction.h>
+#include <vconf-internal-telephony-keys.h>
+#include <vconf.h>
 
 using namespace Msg;
 
@@ -113,18 +115,29 @@ bool SystemSettingsManager::isFlightModeEnabled() const
     return res;
 }
 
+bool SystemSettingsManager::isRoaming() const
+{
+    bool status = false;
+    telephony_h telHandle = m_TelHandleList.handle[0];
+    telephony_network_get_roaming_status(telHandle, &status);
+    return status;
+}
+
+bool SystemSettingsManager::isRoamingDataEnabled() const
+{
+    int enabled = false;
+    vconf_get_bool(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, &enabled);
+    return enabled;
+}
+
 void SystemSettingsManager::onTimeFormatChanged()
 {
     for (ISystemSettingsManager *it : m_Listeners)
-    {
         it->onTimeFormatChanged();
-    }
 }
 
 void SystemSettingsManager::onLanguageChanged()
 {
     for (ISystemSettingsManager *it : m_Listeners)
-    {
         it->onLanguageChanged();
-    }
 }
index add8fe8bf5ecb9c23a2c0da45f83ffd492391e54..c395abe3ae9fe830e9c379d49194208e420ab126 100644 (file)
@@ -88,7 +88,7 @@ namespace Msg {
             void showSentWhenServiceBecomesAvailablePopup();
             void showMobileNetworkSettingsPopup();
             void showMmsTextLimitExceededPopup();
-            void showUnableToSendMmsPopup();
+            void showUnableDataRoamingPopup();
             void showDiscardMsgPopup();
 
             // Popup callback:
index 4c1c8737e18c21e0588495552b9570cf07161ef9..450b0c6e77ad2c1077647fea33291ce18bce5583 100644 (file)
@@ -138,19 +138,28 @@ void MsgBodyFrame::handleSendResult( MsgTransport::SendResult result)
 
 bool MsgBodyFrame::checkBeforeSend(Message::Type type)
 {
-    if (!App::getInst().getSysSettingsManager().isSimInserted()) {
+    auto &settings = App::getInst().getSysSettingsManager();
+
+    if (!settings.isSimInserted()) {
          // TODO: popup for No SIM card
         return false;
     }
 
-    if (App::getInst().getSysSettingsManager().isFlightModeEnabled()) {
+    if (settings.isFlightModeEnabled()) {
         showDisableFlightModePopup();
         return false;
     }
 
-    if (MsgUtils::isMms(type) && !App::getInst().getSysSettingsManager().isMobileDataEnabled()) {
-        showMobileNetworkSettingsPopup();
-        return false;
+    if (MsgUtils::isMms(type)) {
+        if (!settings.isMobileDataEnabled()) {
+            showMobileNetworkSettingsPopup();
+            return false;
+        }
+
+        if (settings.isRoaming() && !settings.isRoamingDataEnabled()) {
+            showUnableDataRoamingPopup();
+            return false;
+        }
     }
 
     return true;
@@ -351,7 +360,7 @@ void MsgBodyFrame::showMmsTextLimitExceededPopup()
     popup->show();
 }
 
-void MsgBodyFrame::showUnableToSendMmsPopup()
+void MsgBodyFrame::showUnableDataRoamingPopup()
 {
     auto *popup = new StandardPopup(StandardPopup::buttons2Style);
     popup->setText(msgt("WDS_MSG_BODY_UNABLE_TO_SEND_MMS_ENABLE_DATA_ROAMING"));
@@ -403,12 +412,14 @@ void MsgBodyFrame::onEnableDataRoamingClicked(Popup &popup)
 {
     MSG_LOG("");
     popup.destroy();
+    // TODO: run network settings
 }
 
 void MsgBodyFrame::onMobileNetworkSettingsClicked(Popup &popup)
 {
     MSG_LOG("");
     popup.destroy();
+    // TODO: run network settings
 }
 
 void MsgBodyFrame::onDiscardMsgClicked(Popup &popup)