From 8d4c642e0c2fd6b06d82e18073aa418e3d5cac1e Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Tue, 30 Jul 2019 14:20:01 -0400
Subject: [PATCH] lrc: merge setAccountEnabled() and enableAccount() functions
 into one

Change-Id: I4b76a87f1c4e40c5b8ce80d38d8b0551dbde2fc7
---
 src/api/newaccountmodel.h |  6 ------
 src/newaccountmodel.cpp   | 17 ++++++-----------
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/api/newaccountmodel.h b/src/api/newaccountmodel.h
index 406e9331..c9c0d47c 100644
--- a/src/api/newaccountmodel.h
+++ b/src/api/newaccountmodel.h
@@ -128,12 +128,6 @@ public:
     bool changeAccountPassword(const std::string& accountId,
                                const std::string& currentPassword,
                                const std::string& newPassword) const;
-    /**
-     * Enable or disable an account
-     * @param accountId
-     * @param enable
-     */
-    void enableAccount(const std::string& accountId, bool enabled);
     /**
      * Change the avatar of an account
      * @param accountId
diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp
index 3400ef28..14151bbf 100644
--- a/src/newaccountmodel.cpp
+++ b/src/newaccountmodel.cpp
@@ -178,7 +178,12 @@ NewAccountModel::getAccountList() const
 void
 NewAccountModel::setAccountEnabled(const std::string& accountId, bool enabled) const
 {
-     ConfigurationManager::instance().sendRegister(QString::fromStdString(accountId), enabled);
+    auto accountInfo = pimpl_->accounts.find(accountId);
+    if (accountInfo == pimpl_->accounts.end()) {
+        throw std::out_of_range("NewAccountModel::getAccountConfig, can't find " + accountId);
+    }
+    accountInfo->second.enabled = enabled;
+    ConfigurationManager::instance().sendRegister(QString::fromStdString(accountId), enabled);
 }
 
 void
@@ -226,16 +231,6 @@ NewAccountModel::getAccountConfig(const std::string& accountId) const
     return accountInfo->second.confProperties;
 }
 
-void
-NewAccountModel::enableAccount(const std::string& accountId, bool enabled)
-{
-    auto accountInfo = pimpl_->accounts.find(accountId);
-    if (accountInfo == pimpl_->accounts.end()) {
-        throw std::out_of_range("NewAccountModel::getAccountConfig, can't find " + accountId);
-    }
-    accountInfo->second.enabled = enabled;
-}
-
 void
 NewAccountModel::setAlias(const std::string& accountId, const std::string& alias)
 {
-- 
GitLab