Fix spamming vfs request on store.

This commit is contained in:
Julien Wadel 2022-12-16 16:40:57 +01:00
parent 56cff70b1b
commit 3e713f0762
2 changed files with 6 additions and 8 deletions

View file

@ -71,23 +71,23 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
connect(&mVfsUtils, &VfsUtils::keyRead, this, [&](const QString& key, const QString& value){
if(key == mVfsUtils.getApplicationVfsEncryptionKey()){
if(!mVfsEncrypted){
mVfsEncrypted = true;
if(!getVfsEncrypted()){
mConfig->setBool(UiSection, "vfs_encryption_enabled", true);
emit vfsEncryptedChanged();
}
}
});
connect(&mVfsUtils, &VfsUtils::keyWritten, this, [&](const QString& key){
if(key == mVfsUtils.getApplicationVfsEncryptionKey()){
if(!mVfsEncrypted){
mVfsEncrypted = true;
if(!getVfsEncrypted()){
mConfig->setBool(UiSection, "vfs_encryption_enabled", true);
emit vfsEncryptedChanged();
}
}
});
connect(&mVfsUtils, &VfsUtils::keyDeleted, this, [&](const QString& key){
if(key == mVfsUtils.getApplicationVfsEncryptionKey()){
mVfsEncrypted = false;
mConfig->setBool(UiSection, "vfs_encryption_enabled", false);
emit vfsEncryptedChanged();
if(mVfsUtils.needToDeleteUserData())
Utils::deleteAllUserData();
@ -1731,8 +1731,7 @@ bool SettingsModel::getLogsEnabled (const shared_ptr<linphone::Config> &config)
// ---------------------------------------------------------------------------
bool SettingsModel::getVfsEncrypted (){
mVfsUtils.readKey(mVfsUtils.getApplicationVfsEncryptionKey());
return mVfsEncrypted;
return mConfig->getBool(UiSection, "vfs_encryption_enabled", false);
}
void SettingsModel::setVfsEncrypted (bool encrypted, const bool deleteUserData){

View file

@ -816,7 +816,6 @@ private:
MediastreamerUtils::SimpleCaptureGraph *mSimpleCaptureGraph = nullptr;
int mCaptureGraphListenerCount = 0;
VfsUtils mVfsUtils;
bool mVfsEncrypted = false;
std::shared_ptr<linphone::Config> mConfig;
};