From 797fa1aeb11db7f8e184baf47757955e0eca93ad Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Wed, 31 Aug 2016 09:55:53 -0400
Subject: [PATCH] accounts: adds an account ID property to the Account class

- adds account id property to the Account class
- adds reference to account ID in AccountsViewModel
- adds loading of account ID in RingD::reloadAccountList

Change-Id: I757443fb08e3f48f1e39f2b21785384d6f41d8b6
Tuleap: #976
---
 Account.cpp           | 4 +++-
 Account.h             | 3 ++-
 AccountsViewModel.cpp | 5 +++--
 AccountsViewModel.h   | 2 +-
 RingD.cpp             | 3 ++-
 5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Account.cpp b/Account.cpp
index e5e38b0..cdbd9e2 100644
--- a/Account.cpp
+++ b/Account.cpp
@@ -29,11 +29,13 @@ using namespace RingClientUWP;
 
 Account::Account(String^ name,
                  String^ ringID,
-                 String^ accountType)
+                 String^ accountType,
+                 String^ accountID)
 {
     name_ = name;
     ringID_ = ringID;
     accountType_ = accountType;
+    accountID_ = accountID;
 }
 
 void
diff --git a/Account.h b/Account.h
index 9ffc164..f9ee448 100644
--- a/Account.h
+++ b/Account.h
@@ -27,13 +27,14 @@ namespace RingClientUWP
 public ref class Account sealed : public INotifyPropertyChanged
 {
 public:
-    Account(String^ name, String^ ringID, String^ accountType);
+    Account(String^ name, String^ ringID, String^ accountType, String^ accountID);
 
     virtual event PropertyChangedEventHandler^ PropertyChanged;
 
     property String^ name_;
     property String^ ringID_;
     property String^ accountType_;
+    property String^ accountID_;
 
 protected:
     void NotifyPropertyChanged(String^ propertyName);
diff --git a/AccountsViewModel.cpp b/AccountsViewModel.cpp
index 11b8c86..36e891f 100644
--- a/AccountsViewModel.cpp
+++ b/AccountsViewModel.cpp
@@ -29,12 +29,13 @@ AccountsViewModel::AccountsViewModel()
 }
 
 void
-AccountsViewModel::add(std::string& name, std::string& ringID, std::string& accountType)
+AccountsViewModel::add(std::string& name, std::string& ringID, std::string& accountType, std::string& accountID)
 {
     accountsList_->Append(ref new Account(
                               Utils::toPlatformString(name),
                               Utils::toPlatformString(ringID),
-                              Utils::toPlatformString(accountType)
+                              Utils::toPlatformString(accountType),
+                              Utils::toPlatformString(accountID)
                           ));
 }
 
diff --git a/AccountsViewModel.h b/AccountsViewModel.h
index 0aa5977..fcbd4b7 100644
--- a/AccountsViewModel.h
+++ b/AccountsViewModel.h
@@ -42,7 +42,7 @@ internal:
     }
 
     /* functions */
-    void add(std::string& name, std::string& ringID, std::string& accountType);
+    void add(std::string& name, std::string& ringID, std::string& accountType, std::string& accountID);
     void clearAccountList();
 
     /* properties */
diff --git a/RingD.cpp b/RingD.cpp
index e714fc3..f632153 100644
--- a/RingD.cpp
+++ b/RingD.cpp
@@ -56,7 +56,8 @@ RingClientUWP::RingD::reloadAccountList()
         RingClientUWP::ViewModel::AccountsViewModel::instance->add(
             accountDetails.find(ring::Conf::CONFIG_ACCOUNT_ALIAS)->second,      //name
             ringID,                                                             //ringid
-            accountDetails.find(ring::Conf::CONFIG_ACCOUNT_TYPE)->second);      //type
+            accountDetails.find(ring::Conf::CONFIG_ACCOUNT_TYPE)->second,       //type
+            *rit);
     }
     // load user preferences
     Configuration::UserPreferences::instance->load();
-- 
GitLab