Auth token is stored in settings and deleted if a request is not authorized (with automatic re-login). Failed request need to be resend.

This commit is contained in:
2026-05-08 14:44:40 +02:00
parent ceaf6b5fbd
commit 0feaf09d83
9 changed files with 189 additions and 6 deletions

View File

@ -40,4 +40,48 @@ void SettingsHandler::saveSettings(QVariantMap settingMap, QString group) {
settings.sync();
}
void SettingsHandler::deleteSettings(QStringList keys, QString group) {
qInfo() << "deleting settings...";
QSettings settings;
if (!group.isEmpty()) {
qDebug() << "starting group:" << group;
settings.beginGroup(group);
}
foreach (QString key, keys) {
qDebug() << "removing:" << key;
settings.remove(key);
}
if (!group.isEmpty()) {
settings.endGroup();
}
settings.sync();
}
QVariantMap SettingsHandler::getChangeset(QVariantMap newSettings, QString group) {
const QVariantMap oldSettings = getSettings(group);
QVariantMap result;
for (QVariantMap::const_iterator iter = newSettings.begin(); iter != newSettings.end(); ++iter) {
qDebug() << iter.key() << iter.value();
QString key = iter.key();
QVariant newValue = iter.value();
QVariant oldValue = oldSettings.value(key);
if (oldValue == newValue) {
qInfo() << "oldValue == newValue -> ignoring...";
} else {
const QString debugString =
QString("oldValue != newValue -> adding '%1' to changeset...").arg(key);
qInfo() << debugString;
result.insert(key, newValue);
}
}
return result;
}
SettingsHandler::SettingsHandler() {}