mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
parent
bd8bf91fdb
commit
627f35f6a5
3 changed files with 21 additions and 1 deletions
|
@ -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();
|
||||
|
@ -789,6 +790,15 @@ UserSettings::setDeviceId(QString deviceId)
|
|||
save();
|
||||
}
|
||||
|
||||
void
|
||||
UserSettings::setCurrentTagId(const QString currentTagId)
|
||||
{
|
||||
if (currentTagId == currentTagId_)
|
||||
return;
|
||||
currentTagId_ = currentTagId;
|
||||
save();
|
||||
}
|
||||
|
||||
void
|
||||
UserSettings::setHomeserver(QString 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",
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue