Won't change if autoconnect enabled (#3602)

* Only will auto-select RR if autoconnect is not checked off.

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Only will auto-select RR if autoconnect is not checked off.

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* On disconnect, un-check autoconnect. Better naming.

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
This commit is contained in:
Zach H 2019-03-03 21:57:48 -05:00 committed by GitHub
parent 5a3f2fcff7
commit 754b9bdc5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View file

@ -190,15 +190,22 @@ void DlgConnect::rebuildComboBoxList(int failure)
UserConnection_Information uci; UserConnection_Information uci;
savedHostList = uci.getServerInfo(); savedHostList = uci.getServerInfo();
bool autoConnectEnabled = static_cast<bool>(settingsCache->servers().getAutoConnect());
QString autoConnectSaveName = settingsCache->servers().getSaveName();
int index = 0; int index = 0;
for (const auto &pair : savedHostList) { for (const auto &pair : savedHostList) {
auto tmp = pair.second; auto tmp = pair.second;
QString saveName = tmp.getSaveName(); QString saveName = tmp.getSaveName();
if (saveName.size()) { if (saveName.size()) {
previousHosts->addItem(saveName); previousHosts->addItem(saveName);
// On rebuild, set to RR if (autoConnectEnabled) {
if (saveName.compare("Rooster Ranges") == 0) { if (saveName.compare(autoConnectSaveName) == 0) {
previousHosts->setCurrentIndex(index);
}
} else if (saveName.compare("Rooster Ranges") == 0) {
previousHosts->setCurrentIndex(index); previousHosts->setCurrentIndex(index);
} }
@ -206,9 +213,6 @@ void DlgConnect::rebuildComboBoxList(int failure)
} }
} }
// Disable auto connect when updating
settingsCache->servers().setAutoConnect(false);
// Re-enable the refresh server button // Re-enable the refresh server button
btnRefreshServers->setDisabled(false); btnRefreshServers->setDisabled(false);
} }

View file

@ -493,6 +493,7 @@ void RemoteClient::activateToServer(const QString &_token)
void RemoteClient::disconnectFromServer() void RemoteClient::disconnectFromServer()
{ {
settingsCache->servers().setAutoConnect(false);
emit sigDisconnectFromServer(); emit sigDisconnectFromServer();
} }