mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +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();
|
homeserver_ = settings.value(prefix + "auth/home_server", "").toString();
|
||||||
userId_ = settings.value(prefix + "auth/user_id", "").toString();
|
userId_ = settings.value(prefix + "auth/user_id", "").toString();
|
||||||
deviceId_ = settings.value(prefix + "auth/device_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();
|
hiddenTags_ = settings.value(prefix + "user/hidden_tags", QStringList{}).toStringList();
|
||||||
mutedTags_ = settings.value(prefix + "user/muted_tags", QStringList{"global"}).toStringList();
|
mutedTags_ = settings.value(prefix + "user/muted_tags", QStringList{"global"}).toStringList();
|
||||||
hiddenPins_ = settings.value(prefix + "user/hidden_pins", QStringList{}).toStringList();
|
hiddenPins_ = settings.value(prefix + "user/hidden_pins", QStringList{}).toStringList();
|
||||||
|
@ -789,6 +790,15 @@ UserSettings::setDeviceId(QString deviceId)
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserSettings::setCurrentTagId(const QString currentTagId)
|
||||||
|
{
|
||||||
|
if (currentTagId == currentTagId_)
|
||||||
|
return;
|
||||||
|
currentTagId_ = currentTagId;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserSettings::setHomeserver(QString homeserver)
|
UserSettings::setHomeserver(QString homeserver)
|
||||||
{
|
{
|
||||||
|
@ -937,7 +947,7 @@ UserSettings::save()
|
||||||
settings.setValue(prefix + "auth/home_server", homeserver_);
|
settings.setValue(prefix + "auth/home_server", homeserver_);
|
||||||
settings.setValue(prefix + "auth/user_id", userId_);
|
settings.setValue(prefix + "auth/user_id", userId_);
|
||||||
settings.setValue(prefix + "auth/device_id", deviceId_);
|
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",
|
settings.setValue(prefix + "user/automatically_share_keys_with_trusted_users",
|
||||||
shareKeysWithTrustedUsers_);
|
shareKeysWithTrustedUsers_);
|
||||||
settings.setValue(prefix + "user/only_share_keys_with_verified_users",
|
settings.setValue(prefix + "user/only_share_keys_with_verified_users",
|
||||||
|
|
|
@ -198,6 +198,7 @@ public:
|
||||||
void setUserId(QString userId);
|
void setUserId(QString userId);
|
||||||
void setAccessToken(QString accessToken);
|
void setAccessToken(QString accessToken);
|
||||||
void setDeviceId(QString deviceId);
|
void setDeviceId(QString deviceId);
|
||||||
|
void setCurrentTagId(QString currentTagId);
|
||||||
void setHomeserver(QString homeserver);
|
void setHomeserver(QString homeserver);
|
||||||
void setDisableCertificateValidation(bool disabled);
|
void setDisableCertificateValidation(bool disabled);
|
||||||
void setHiddenTags(const QStringList &hiddenTags);
|
void setHiddenTags(const QStringList &hiddenTags);
|
||||||
|
@ -272,6 +273,7 @@ public:
|
||||||
QString userId() const { return userId_; }
|
QString userId() const { return userId_; }
|
||||||
QString accessToken() const { return accessToken_; }
|
QString accessToken() const { return accessToken_; }
|
||||||
QString deviceId() const { return deviceId_; }
|
QString deviceId() const { return deviceId_; }
|
||||||
|
QString currentTagId() const { return currentTagId_; }
|
||||||
QString homeserver() const { return homeserver_; }
|
QString homeserver() const { return homeserver_; }
|
||||||
bool disableCertificateValidation() const { return disableCertificateValidation_; }
|
bool disableCertificateValidation() const { return disableCertificateValidation_; }
|
||||||
QStringList hiddenTags() const { return hiddenTags_; }
|
QStringList hiddenTags() const { return hiddenTags_; }
|
||||||
|
@ -410,6 +412,7 @@ private:
|
||||||
QString userId_;
|
QString userId_;
|
||||||
QString accessToken_;
|
QString accessToken_;
|
||||||
QString deviceId_;
|
QString deviceId_;
|
||||||
|
QString currentTagId_;
|
||||||
QString homeserver_;
|
QString homeserver_;
|
||||||
QStringList hiddenTags_;
|
QStringList hiddenTags_;
|
||||||
QStringList mutedTags_;
|
QStringList mutedTags_;
|
||||||
|
|
|
@ -383,6 +383,8 @@ CommunitiesModel::initializeSidebar()
|
||||||
emit tagsChanged();
|
emit tagsChanged();
|
||||||
emit hiddenTagsChanged();
|
emit hiddenTagsChanged();
|
||||||
emit containsSubspacesChanged();
|
emit containsSubspacesChanged();
|
||||||
|
|
||||||
|
setCurrentTagId(UserSettings::instance()->currentTagId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -585,6 +587,7 @@ CommunitiesModel::setCurrentTagId(const QString &tagId)
|
||||||
for (const auto &t : qAsConst(tags_)) {
|
for (const auto &t : qAsConst(tags_)) {
|
||||||
if (t == tag) {
|
if (t == tag) {
|
||||||
this->currentTagId_ = tagId;
|
this->currentTagId_ = tagId;
|
||||||
|
UserSettings::instance()->setCurrentTagId(tagId);
|
||||||
emit currentTagIdChanged(currentTagId_);
|
emit currentTagIdChanged(currentTagId_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -594,17 +597,20 @@ CommunitiesModel::setCurrentTagId(const QString &tagId)
|
||||||
for (const auto &t : spaceOrder_.tree) {
|
for (const auto &t : spaceOrder_.tree) {
|
||||||
if (t.id == tag) {
|
if (t.id == tag) {
|
||||||
this->currentTagId_ = tagId;
|
this->currentTagId_ = tagId;
|
||||||
|
UserSettings::instance()->setCurrentTagId(tagId);
|
||||||
emit currentTagIdChanged(currentTagId_);
|
emit currentTagIdChanged(currentTagId_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (tagId == QLatin1String("dm")) {
|
} else if (tagId == QLatin1String("dm")) {
|
||||||
this->currentTagId_ = tagId;
|
this->currentTagId_ = tagId;
|
||||||
|
UserSettings::instance()->setCurrentTagId(tagId);
|
||||||
emit currentTagIdChanged(currentTagId_);
|
emit currentTagIdChanged(currentTagId_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->currentTagId_ = QLatin1String("");
|
this->currentTagId_ = QLatin1String("");
|
||||||
|
UserSettings::instance()->setCurrentTagId(tagId);
|
||||||
emit currentTagIdChanged(currentTagId_);
|
emit currentTagIdChanged(currentTagId_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,6 +620,7 @@ CommunitiesModel::trySwitchToSpace(const QString &tag)
|
||||||
for (const auto &t : spaceOrder_.tree) {
|
for (const auto &t : spaceOrder_.tree) {
|
||||||
if (t.id == tag) {
|
if (t.id == tag) {
|
||||||
this->currentTagId_ = "space:" + tag;
|
this->currentTagId_ = "space:" + tag;
|
||||||
|
UserSettings::instance()->setCurrentTagId(tag);
|
||||||
emit currentTagIdChanged(currentTagId_);
|
emit currentTagIdChanged(currentTagId_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue