diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/UserSettingsPage.cpp | 12 | ||||
-rw-r--r-- | src/UserSettingsPage.h | 3 | ||||
-rw-r--r-- | src/timeline/CommunitiesModel.cpp | 7 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index dd4270a8..d5b7289c 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -140,6 +140,7 @@ UserSettings::load(std::optional<QString> profile) homeserver_ = settings.value(prefix + "auth/home_server", "").toString(); userId_ = settings.value(prefix + "auth/user_id", "").toString(); deviceId_ = settings.value(prefix + "auth/device_id", "").toString(); + currentTagId_ = settings.value(prefix + "user/current_tag_id", "").toString(); hiddenTags_ = settings.value(prefix + "user/hidden_tags", QStringList{}).toStringList(); mutedTags_ = settings.value(prefix + "user/muted_tags", QStringList{"global"}).toStringList(); hiddenPins_ = settings.value(prefix + "user/hidden_pins", QStringList{}).toStringList(); @@ -790,6 +791,15 @@ UserSettings::setDeviceId(QString deviceId) } void +UserSettings::setCurrentTagId(const QString currentTagId) +{ + if (currentTagId == currentTagId_) + return; + currentTagId_ = currentTagId; + save(); +} + +void UserSettings::setHomeserver(QString homeserver) { if (homeserver == homeserver_) @@ -937,7 +947,7 @@ UserSettings::save() settings.setValue(prefix + "auth/home_server", homeserver_); settings.setValue(prefix + "auth/user_id", userId_); settings.setValue(prefix + "auth/device_id", deviceId_); - + settings.setValue(prefix + "user/current_tag_id", currentTagId_); settings.setValue(prefix + "user/automatically_share_keys_with_trusted_users", shareKeysWithTrustedUsers_); settings.setValue(prefix + "user/only_share_keys_with_verified_users", diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index 5c05b143..657a362d 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -198,6 +198,7 @@ public: void setUserId(QString userId); void setAccessToken(QString accessToken); void setDeviceId(QString deviceId); + void setCurrentTagId(QString currentTagId); void setHomeserver(QString homeserver); void setDisableCertificateValidation(bool disabled); void setHiddenTags(const QStringList &hiddenTags); @@ -272,6 +273,7 @@ public: QString userId() const { return userId_; } QString accessToken() const { return accessToken_; } QString deviceId() const { return deviceId_; } + QString currentTagId() const { return currentTagId_; } QString homeserver() const { return homeserver_; } bool disableCertificateValidation() const { return disableCertificateValidation_; } QStringList hiddenTags() const { return hiddenTags_; } @@ -410,6 +412,7 @@ private: QString userId_; QString accessToken_; QString deviceId_; + QString currentTagId_; QString homeserver_; QStringList hiddenTags_; QStringList mutedTags_; diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp index a5f24c75..9a0d377c 100644 --- a/src/timeline/CommunitiesModel.cpp +++ b/src/timeline/CommunitiesModel.cpp @@ -383,6 +383,8 @@ CommunitiesModel::initializeSidebar() emit tagsChanged(); emit hiddenTagsChanged(); emit containsSubspacesChanged(); + + setCurrentTagId(UserSettings::instance()->currentTagId()); } void @@ -585,6 +587,7 @@ CommunitiesModel::setCurrentTagId(const QString &tagId) for (const auto &t : qAsConst(tags_)) { if (t == tag) { this->currentTagId_ = tagId; + UserSettings::instance()->setCurrentTagId(tagId); emit currentTagIdChanged(currentTagId_); return; } @@ -594,17 +597,20 @@ CommunitiesModel::setCurrentTagId(const QString &tagId) for (const auto &t : spaceOrder_.tree) { if (t.id == tag) { this->currentTagId_ = tagId; + UserSettings::instance()->setCurrentTagId(tagId); emit currentTagIdChanged(currentTagId_); return; } } } else if (tagId == QLatin1String("dm")) { this->currentTagId_ = tagId; + UserSettings::instance()->setCurrentTagId(tagId); emit currentTagIdChanged(currentTagId_); return; } this->currentTagId_ = QLatin1String(""); + UserSettings::instance()->setCurrentTagId(tagId); emit currentTagIdChanged(currentTagId_); } @@ -614,6 +620,7 @@ CommunitiesModel::trySwitchToSpace(const QString &tag) for (const auto &t : spaceOrder_.tree) { if (t.id == tag) { this->currentTagId_ = "space:" + tag; + UserSettings::instance()->setCurrentTagId(tag); emit currentTagIdChanged(currentTagId_); return true; } |