TSAM-10862 app-side part of the fix 65/103865/2 submit/tizen_3.0/20161212.111530
authorAndrey Klimenko <and.klimenko@samsung.com>
Fri, 9 Dec 2016 14:43:31 +0000 (16:43 +0200)
committerAndrey Klimenko <and.klimenko@samsung.com>
Sun, 11 Dec 2016 08:44:48 +0000 (10:44 +0200)
Change-Id: I6aa1c6a6b551e7d1e958f7b0679fc2b64fb67338
Signed-off-by: Andrey Klimenko <and.klimenko@samsung.com>
src/Settings/Controller/src/SettingsSound.cpp

index b5d7e8a..f31d435 100644 (file)
@@ -30,12 +30,14 @@ namespace
     const char *sRingtoneKeySilent = "silent";
     const char *sRingtoneValueSilentShow = "silent show";
     const char *sRingtoneKeyDefault = "default";
+    const char *sRingtoneIsDefaultFlag = "is_default";
     const char *sRingtoneValueDefaultShow = "default show";
     const char *sRingtoneAppId = "org.tizen.setting-ringtone";
     const char* sRingtoneKeyDrmType = "drm_type";
     const char* sRingtoneValueDrmAll = "DRM_ALL";
     const char* sRingtoneKeyDomain = "domain";
     const char* sRingtoneKeyTitle = "title";
+    const char* sTrue = "true";
 }
 
 SettingsSound::SettingsSound(MsgSettings &settingsHandle)
@@ -61,14 +63,16 @@ void SettingsSound::onReply(app_control_h request, app_control_h reply, app_cont
     int count = 0;
     app_control_get_extra_data_array(reply, APP_CONTROL_DATA_SELECTED, &ringtones, &count);
 
-    if (!ringtones || !ringtones[0])
+    char *isDefault = nullptr;
+    app_control_get_extra_data(reply, sRingtoneIsDefaultFlag, &isDefault);
+
+    if (!ringtones || !ringtones[0] || !isDefault)
         return;
 
     char *ringtone = ringtones[0];
-
     if (strcmp(ringtone, sRingtoneKeySilent) == 0)
         m_SettingsHandle.setRingtoneType(MsgSettings::SilentRingtone);
-    else if (strcmp(ringtone, sRingtoneKeyDefault) == 0)
+    else if (strcmp(isDefault, sTrue) == 0)
         m_SettingsHandle.setRingtoneType(MsgSettings::DefaultRingtone);
     else
     {
@@ -77,9 +81,10 @@ void SettingsSound::onReply(app_control_h request, app_control_h reply, app_cont
     }
 
     for (int i = 0; i < count; ++i) {
-        free (ringtones[i]);
+        free(ringtones[i]);
     }
     free(ringtones);
+    free(isDefault);
 }
 
 bool SettingsSound::launch()