fix: update conversation when account deleted

Update main ring window when an account is removed.

Change-Id: I7ae06098aec450c1497aff4e6bca8ea2b638402d
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
diff --git a/src/AccountsVC.mm b/src/AccountsVC.mm
index d0d14d2..7fbfb97 100644
--- a/src/AccountsVC.mm
+++ b/src/AccountsVC.mm
@@ -93,6 +93,8 @@
 NSInteger const TAG_STATUS      =   300;
 NSInteger const TAG_TYPE        =   400;
 
+QMetaObject::Connection accountChangedConnection, selectedAccountChangedConnection, accountTypeChangedConnection;
+
 
 - (void)awakeFromNib
 {
@@ -105,7 +107,10 @@
     [accountsListView bind:@"sortDescriptors" toObject:treeController withKeyPath:@"sortDescriptors" options:nil];
     [accountsListView bind:@"selectionIndexPaths" toObject:treeController withKeyPath:@"selectionIndexPaths" options:nil];
 
-    QObject::connect(&AccountModel::instance(),
+    QObject::disconnect(accountChangedConnection);
+    QObject::disconnect(selectedAccountChangedConnection);
+
+    accountChangedConnection = QObject::connect(&AccountModel::instance(),
                      &QAbstractItemModel::dataChanged,
                      [=](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
                         [accountsListView reloadDataForRowIndexes:
@@ -113,7 +118,7 @@
                         columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, accountsListView.tableColumns.count)]];
                      });
 
-    QObject::connect(AccountModel::instance().selectionModel(),
+    selectedAccountChangedConnection = QObject::connect(AccountModel::instance().selectionModel(),
                      &QItemSelectionModel::currentChanged,
                      [=](const QModelIndex &current, const QModelIndex &previous) {
                          [accountDetailsView setHidden:!current.isValid()];
@@ -124,14 +129,14 @@
 
                         [treeController setSelectionQModelIndex:current];
                      });
-
-
     AccountModel::instance().selectionModel()->clearCurrentIndex();
 
+
     QModelIndex qProtocolIdx = AccountModel::instance().protocolModel()->selectionModel()->currentIndex();
     [self.protocolList addItemWithTitle:
                            AccountModel::instance().protocolModel()->data(qProtocolIdx, Qt::DisplayRole).toString().toNSString()];
-    QObject::connect(AccountModel::instance().protocolModel()->selectionModel(),
+    QObject::disconnect(accountTypeChangedConnection);
+    accountTypeChangedConnection = QObject::connect(AccountModel::instance().protocolModel()->selectionModel(),
                      &QItemSelectionModel::currentChanged,
                      [=](const QModelIndex &current, const QModelIndex &previous) {
                          if (!current.isValid()) {