[Account] - Removing TODOs from the Account module
authorAndrzej Popowski <a.popowski@samsung.com>
Wed, 7 Oct 2015 10:09:43 +0000 (12:09 +0200)
committerAndrzej Popowski <a.popowski@samsung.com>
Wed, 7 Oct 2015 10:09:43 +0000 (12:09 +0200)
Change-Id: I298bfe2984d50b5c2faef703b7a46deeba4d8f5e
Signed-off-by: Andrzej Popowski <a.popowski@samsung.com>
src/account/account_api.js
src/account/account_manager.cc

index 6c1c84c42cf439c82c8f0c9b6a77a6c649bcc0c8..044d8cde4e2e6c52fffbf33d6f70bac0eb3a476f 100755 (executable)
@@ -115,8 +115,6 @@ Account.prototype.getExtendedData = function() {
             }
         ]);
 
-        // TODO handling exceptions
-
         native_.call('Account_getExtendedData', { accountId: this.id },
             function(result) {
                 if (native_.isFailure(result)) {
@@ -256,8 +254,6 @@ AccountManager.prototype.getAccounts = function() {
         { name: 'applicationId', type: types_.STRING, optional: true, nullable: true }
     ]);
 
-    // TODO handling exceptions
-
     native_.call('AccountManager_getAccounts',
         {
             applicationId: args.applicationId
@@ -315,8 +311,6 @@ AccountManager.prototype.getProviders = function() {
         { name: 'capability', type: types_.STRING, optional: true, nullable: true }
     ]);
 
-    // TODO handling exceptions
-
     native_.call( 'AccountManager_getProviders',
         {
             capability: args.capability
index 409ac752c39082fe13d35d19efdd3411ec790969..4d1043df131f90d65bd61bfe787a6cf8c34dd4ff 100755 (executable)
@@ -17,6 +17,7 @@
 #include "account/account_manager.h"
 
 #include <functional>
+#include <locale>
 
 #include "common/logger.h"
 #include "common/scope_exit.h"
@@ -335,8 +336,13 @@ bool AccountManager::ConvertProviderToObject(account_type_h provider,
   out["applicationId"] = picojson::value(provider_id);
   free(provider_id);
 
-  // TODO: Which label should be returned?
-  ret = account_type_get_label_by_locale(provider, "default", &display_name);
+  std::string language("default");
+  std::locale loc("");
+  if (loc.name().length() >= 5) {
+    language = loc.name().substr(0, 5);
+  }
+
+  ret = account_type_get_label_by_locale(provider, language.c_str(), &display_name);
   if (ret == ACCOUNT_ERROR_NONE) {
     out["displayName"] = picojson::value(display_name);
     free(display_name);