Skip to content

Commit

Permalink
#1285 #1340: Disable SSH tab for existing replica set connections as …
Browse files Browse the repository at this point in the history
…well
  • Loading branch information
simsekgokhan committed Jan 6, 2021
1 parent ea78a36 commit c260a63
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/robomongo/gui/dialogs/ConnectionBasicTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ namespace Robomongo
{
bool const isReplica = static_cast<bool>(index);

_connectionDialog->toggleSshSupport(!isReplica);
_connectionDialog->toggleSshSupport(isReplica);

// Replica set
_membersLabel->setVisible(isReplica);
Expand Down
7 changes: 3 additions & 4 deletions src/robomongo/gui/dialogs/ConnectionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,13 @@ namespace Robomongo
_advancedTab->setDefaultDb(defaultDb);
}

void ConnectionDialog::toggleSshSupport(bool newVal)
void ConnectionDialog::toggleSshSupport(bool isReplicaSet)
{
if (!_sshTab)
return;

_sshTab->setEnabled(newVal);
_sshTab->setSshCheckboxToolTip(newVal ? "" :
"SSH is currently not supported for Replica Set connections");
_sshTab->setDisabled(isReplicaSet);
_sshTab->toggleSshCheckboxToolTip(isReplicaSet);
}

void ConnectionDialog::restoreWindowSettings()
Expand Down
2 changes: 1 addition & 1 deletion src/robomongo/gui/dialogs/ConnectionDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Robomongo
void setAuthTab(QString const& db, QString const& username, QString const& pwd);
void enableSslBasic();
void setDefaultDb(QString const& defaultDb);
void toggleSshSupport(bool newVal);
void toggleSshSupport(bool isReplicaSet);

public Q_SLOTS:
/**
Expand Down
6 changes: 4 additions & 2 deletions src/robomongo/gui/dialogs/SSHTunnelTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,18 @@ namespace Robomongo
#endif

setDisabled(_settings->isReplicaSet());
toggleSshCheckboxToolTip(_settings->isReplicaSet());
}

bool SshTunnelTab::sshEnabled() const
{
return _sshSupport->isChecked();
}

void SshTunnelTab::setSshCheckboxToolTip(QString const & text)
void SshTunnelTab::toggleSshCheckboxToolTip(bool isReplicaSet)
{
_sshSupport->setToolTip(text);
_sshSupport->setToolTip(!isReplicaSet ? "" :
"SSH is currently not supported for Replica Set connections");
}

void SshTunnelTab::setPasswordFieldsEnabled(bool enabled)
Expand Down
2 changes: 1 addition & 1 deletion src/robomongo/gui/dialogs/SSHTunnelTab.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Robomongo
*/
bool sshEnabled() const;

void setSshCheckboxToolTip(QString const& text);
void toggleSshCheckboxToolTip(bool isReplicaSet);

private Q_SLOTS:
void sshSupportStateChange(int checked);
Expand Down

0 comments on commit c260a63

Please sign in to comment.