Git: BranchDialog: Disable buttons when selection disappears

Steps to reproduce the old and wrong behavior:
1. Open branch dialog
2. Select a branch
3. Select checkout
4. Branch is checked out, but no longer selected
5. Buttons like "Log" stay enabled, but don't serve
   any purpose

Change-Id: I3974b7cb87553d1ff57fd5578b908f02c949a509
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Andre Hartmann
2017-02-08 23:11:29 +01:00
committed by André Hartmann
parent 0e25c08942
commit 95e6dfe8e0

View File

@@ -93,7 +93,7 @@ BranchDialog::BranchDialog(QWidget *parent) :
connect(m_model, &QAbstractItemModel::rowsInserted, this, &BranchDialog::resizeColumns); connect(m_model, &QAbstractItemModel::rowsInserted, this, &BranchDialog::resizeColumns);
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &BranchDialog::resizeColumns); connect(m_model, &QAbstractItemModel::rowsRemoved, this, &BranchDialog::resizeColumns);
enableButtons(); m_ui->branchView->selectionModel()->clear();
} }
BranchDialog::~BranchDialog() BranchDialog::~BranchDialog()
@@ -258,7 +258,7 @@ void BranchDialog::checkout()
else if (branchCheckoutDialog.popStashOfNextBranch()) else if (branchCheckoutDialog.popStashOfNextBranch())
client->synchronousStashRestore(m_repository, stashName, true); client->synchronousStashRestore(m_repository, stashName, true);
} }
enableButtons(); m_ui->branchView->selectionModel()->clear();
} }
/* Prompt to delete a local branch and do so. */ /* Prompt to delete a local branch and do so. */
@@ -320,7 +320,7 @@ void BranchDialog::rename()
m_model->renameBranch(oldName, branchAddDialog.branchName()); m_model->renameBranch(oldName, branchAddDialog.branchName());
refreshCurrentRepository(); refreshCurrentRepository();
} }
enableButtons(); m_ui->branchView->selectionModel()->clear();
} }
void BranchDialog::diff() void BranchDialog::diff()