Skip to content

Commit

Permalink
Move settings sync to syncRecentConnectionsToSettings()
Browse files Browse the repository at this point in the history
  • Loading branch information
basyskom-jvoe authored and khaexy committed Mar 13, 2024
1 parent 79d26be commit 31b0dc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,17 +787,8 @@ void BackEnd::removeRecentConnection(const QString &name)
if (mLastServerHosts.contains(name)) {
mLastServerHosts.removeAll(name);

QSettings settings;
settings.remove(Constants::SettingsKey::RecentConnections);

settings.beginWriteArray(Constants::SettingsKey::RecentConnections);
for (qsizetype i = 0; i < qMin(10, mLastServerHosts.count()); ++i) {
settings.setArrayIndex(i);
settings.setValue(Constants::SettingsKey::Url, mLastServerHosts.at(i));
}
settings.endArray();

emit recentConnectionsChanged();
syncRecentConnectionsToSettings();
}
}

Expand Down Expand Up @@ -831,14 +822,18 @@ void BackEnd::saveServerHost(const QString &host)

mLastServerHosts.prepend(host);
emit recentConnectionsChanged();
syncRecentConnectionsToSettings();
}

void BackEnd::syncRecentConnectionsToSettings()
{
QSettings settings;
settings.remove(Constants::SettingsKey::RecentConnections);

settings.beginWriteArray(Constants::SettingsKey::RecentConnections);
for (qsizetype i = 0; i < qMin(10, mLastServerHosts.count()); ++i) {
settings.setArrayIndex(i);
settings.setValue(Constants::SettingsKey::Url, mLastServerHosts[i]);
settings.setValue(Constants::SettingsKey::Url, mLastServerHosts.at(i));
}
settings.endArray();
}
Expand Down
1 change: 1 addition & 0 deletions src/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ private slots:
void saveLastDashboards();
void loadLastServerHostsFromSettings();
void saveServerHost(const QString &host);
void syncRecentConnectionsToSettings();

void findCompanionSpecObjects();
QFuture<QString> findAllSubtypes(const QString &nodeId,
Expand Down

0 comments on commit 31b0dc9

Please sign in to comment.