RemoteDialog: Fix button states after adding remote

As adding a remote leads to a model reset which does not
trigger the selectionChanged signal, all buttons were
enabled despite no remote was selected.

Change-Id: I2f752fcf5f1830728d1bcf9810ca4648bd2f287b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2021-09-28 13:45:39 +02:00
committed by André Hartmann
parent 23a58a320e
commit 2dfb9ff539
3 changed files with 6 additions and 0 deletions

View File

@@ -145,6 +145,8 @@ RemoteDialog::RemoteDialog(QWidget *parent) :
connect(m_ui->remoteView->selectionModel(), &QItemSelectionModel::selectionChanged, connect(m_ui->remoteView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &RemoteDialog::updateButtonState); this, &RemoteDialog::updateButtonState);
connect(m_remoteModel, &RemoteModel::refreshed,
this, &RemoteDialog::updateButtonState);
updateButtonState(); updateButtonState();
} }

View File

@@ -199,6 +199,7 @@ bool RemoteModel::refresh(const FilePath &workingDirectory, QString *errorMessag
m_remotes.push_back(newRemote); m_remotes.push_back(newRemote);
} }
endResetModel(); endResetModel();
emit refreshed();
return true; return true;
} }

View File

@@ -65,6 +65,9 @@ public:
Utils::FilePath workingDirectory() const; Utils::FilePath workingDirectory() const;
int findRemoteByName(const QString &name) const; int findRemoteByName(const QString &name) const;
signals:
void refreshed();
protected: protected:
class Remote { class Remote {
public: public: