Commit da6b8b9f authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Read/write integer config entries depending on their signedness

With GnuPG 2.3 the type of some entries changed from unsigned int to int.

GnuPG-bug-id: 5217
parent 060bcf14
Pipeline #57856 passed with stage
in 14 minutes and 10 seconds
...@@ -288,6 +288,25 @@ void DirectoryServicesConfigurationPage::load() ...@@ -288,6 +288,25 @@ void DirectoryServicesConfigurationPage::load()
#endif #endif
} }
namespace
{
void updateIntegerConfigEntry(QGpgME::CryptoConfigEntry *configEntry, int value) {
if (!configEntry) {
return;
}
if (configEntry->argType() == CryptoConfigEntry::ArgType_Int) {
if (configEntry->intValue() != value) {
configEntry->setIntValue(value);
}
} else {
const unsigned int newValue = static_cast<unsigned>(value);
if (configEntry->uintValue() != newValue) {
configEntry->setUIntValue(newValue);
}
}
}
}
void DirectoryServicesConfigurationPage::save() void DirectoryServicesConfigurationPage::save()
{ {
if (mX509ServicesEntry) { if (mX509ServicesEntry) {
...@@ -305,14 +324,11 @@ void DirectoryServicesConfigurationPage::save() ...@@ -305,14 +324,11 @@ void DirectoryServicesConfigurationPage::save()
} }
} }
QTime time(mTimeout->time()); const QTime time{mTimeout->time()};
unsigned int timeout = time.minute() * 60 + time.second(); updateIntegerConfigEntry(mTimeoutConfigEntry, time.minute() * 60 + time.second());
if (mTimeoutConfigEntry && mTimeoutConfigEntry->uintValue() != timeout) {
mTimeoutConfigEntry->setUIntValue(timeout); updateIntegerConfigEntry(mMaxItemsConfigEntry, mMaxItems->value());
}
if (mMaxItemsConfigEntry && mMaxItemsConfigEntry->uintValue() != (uint)mMaxItems->value()) {
mMaxItemsConfigEntry->setUIntValue(mMaxItems->value());
}
#ifdef NOT_USEFUL_CURRENTLY #ifdef NOT_USEFUL_CURRENTLY
if (mAddNewServersConfigEntry && mAddNewServersConfigEntry->boolValue() != mAddNewServersCB->isChecked()) { if (mAddNewServersConfigEntry && mAddNewServersConfigEntry->boolValue() != mAddNewServersCB->isChecked()) {
mAddNewServersConfigEntry->setBoolValue(mAddNewServersCB->isChecked()); mAddNewServersConfigEntry->setBoolValue(mAddNewServersCB->isChecked());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment