diff --git a/src/misc/settings.cpp b/src/misc/settings.cpp index 773ec5457..1d201ff96 100644 --- a/src/misc/settings.cpp +++ b/src/misc/settings.cpp @@ -16,6 +16,7 @@ #include "settings.h" #include "smileypack.h" +#include "src/corestructs.h" #include #include @@ -151,6 +152,11 @@ void Settings::load() typingNotification = s.value("typingNotification", false).toBool(); s.endGroup(); + s.beginGroup("AutoAccept"); + for (auto& key : s.childKeys()) + autoAccept[key] = s.value(key).toString(); + s.endGroup(); + // try to set a smiley pack if none is selected if (!SmileyPack::isValid(smileyPack) && !SmileyPack::listSmileyPacks().isEmpty()) smileyPack = SmileyPack::listSmileyPacks()[0].second; @@ -258,6 +264,11 @@ void Settings::save(QString path) s.beginGroup("Privacy"); s.setValue("typingNotification", typingNotification); s.endGroup(); + + s.beginGroup("AutoAccept"); + for (auto& id : autoAccept.keys()) + s.setValue(id, autoAccept.value(id)); + s.endGroup(); } QString Settings::getSettingsDirPath() @@ -480,6 +491,16 @@ void Settings::setAutoAwayTime(int newValue) autoAwayTime = newValue; } +QString Settings::getAutoAcceptDir(const QString& id) const +{ + return autoAccept.value(id.left(TOX_ID_PUBLIC_KEY_LENGTH)); +} + +void Settings::setAutoAcceptDir(const QString&id, const QString& dir) +{ + autoAccept[id.left(TOX_ID_PUBLIC_KEY_LENGTH)] = dir; +} + void Settings::setWidgetData(const QString& uniqueName, const QByteArray& data) { widgetSettings[uniqueName] = data; diff --git a/src/misc/settings.h b/src/misc/settings.h index ee85b4177..5d4363f31 100644 --- a/src/misc/settings.h +++ b/src/misc/settings.h @@ -125,6 +125,9 @@ public: int getEmojiFontPointSize() const; void setEmojiFontPointSize(int value); + QString getAutoAcceptDir(const QString& id) const; + void setAutoAcceptDir(const QString&id, const QString& dir); + // ChatView int getFirstColumnHandlePos() const; void setFirstColumnHandlePos(const int pos); @@ -197,6 +200,7 @@ private: int autoAwayTime; QHash widgetSettings; + QHash autoAccept; // GUI bool enableSmoothAnimation;