From 3e94259e738a7a86771ac076add04ddd1920661a Mon Sep 17 00:00:00 2001
From: Inso <insomniak.fr@gmail.com>
Date: Sun, 26 Apr 2015 15:57:04 +0200
Subject: [PATCH] Fixed bugs with account management - Deleting the default
 account no longer tries to load it at the beginning - Fixed the account name
 check with account import

---
 src/cutecoin/core/app.py           | 2 ++
 src/cutecoin/gui/import_account.py | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py
index 8c31a77c..3893d143 100644
--- a/src/cutecoin/core/app.py
+++ b/src/cutecoin/core/app.py
@@ -92,6 +92,8 @@ class Application(QObject):
         self.accounts.pop(account.name)
         if self.current_account == account:
             self.current_account = None
+        with open(config.parameters['data'], 'w') as outfile:
+            json.dump(self.jsonify(), outfile, indent=4, sort_keys=True)
 
     def change_current_account(self, account):
         '''
diff --git a/src/cutecoin/gui/import_account.py b/src/cutecoin/gui/import_account.py
index 5fd598c8..5550e5a9 100644
--- a/src/cutecoin/gui/import_account.py
+++ b/src/cutecoin/gui/import_account.py
@@ -58,7 +58,7 @@ class ImportAccountDialog(QDialog, Ui_ImportAccountDialog):
             self.label_errors.setText("Please enter a name")
             return
         for account in self.app.accounts:
-            if name == account.name:
+            if name == account:
                 self.button_box.button(QDialogButtonBox.Ok).setEnabled(False)
                 self.label_errors.setText("Name already exists")
                 return
-- 
GitLab