qt: Add method for getting config entries for components by entry name
* lang/qt/src/cryptoconfig.h, lang/qt/src/cryptoconfig.cpp (CryptoConfig::entry): Move implementation to cpp. Add overload not requiring a group name. -- The group name is not needed for identifying a config entry because the groups only provide a logical grouping of config entry for user interfaces. To improve usability entries are sometimes moved to a different group, but this shouldn't break existing applications trying to access those entries. The new group-agnostic overload makes applications robust against regrouping of config entries. GnuPG-bug-id: 5217
This commit is contained in:
parent
c8fd8870b3
commit
fe900a41bf
4
NEWS
4
NEWS
@ -2,6 +2,10 @@ Noteworthy changes in version 1.15.2 (unreleased)
|
|||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
* Interface changes relative to the 1.15.1 release:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
qt: CryptoConfig::entry CHANGED: Added overload; deprecated old
|
||||||
|
|
||||||
|
|
||||||
Noteworthy changes in version 1.15.1 (2021-01-08)
|
Noteworthy changes in version 1.15.1 (2021-01-08)
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
@ -43,3 +43,23 @@ QStringList CryptoConfigEntry::stringValueList() const
|
|||||||
}
|
}
|
||||||
return entry->stringValueList();
|
return entry->stringValueList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGpgME::CryptoConfigEntry *CryptoConfig::entry(const QString &componentName, const QString &entryName) const
|
||||||
|
{
|
||||||
|
const CryptoConfigComponent *comp = component(componentName);
|
||||||
|
const QStringList groupNames = comp->groupList();
|
||||||
|
for (const auto &groupName : groupNames) {
|
||||||
|
const CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr;
|
||||||
|
if (CryptoConfigEntry *entry = group->entry(entryName)) {
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QGpgME::CryptoConfigEntry *CryptoConfig::entry(const QString &componentName, const QString &groupName, const QString &entryName) const
|
||||||
|
{
|
||||||
|
const CryptoConfigComponent *comp = component(componentName);
|
||||||
|
const CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr;
|
||||||
|
return group ? group->entry(entryName) : nullptr;
|
||||||
|
}
|
||||||
|
@ -373,18 +373,26 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to get hold of a single configuration entry when
|
* Convenience method to get hold of a single configuration entry when
|
||||||
* its component, group and name are known. This can be used to read
|
* its component and name are known. This can be used to read
|
||||||
* the value and/or to set a value to it.
|
* the value and/or to set a value to it.
|
||||||
*
|
*
|
||||||
* @return the configuration object for a single configuration entry, 0 if not found.
|
* @return the configuration object for a single configuration entry, 0 if not found.
|
||||||
* The object is owned by CryptoConfig, don't delete it.
|
* The object is owned by CryptoConfig, don't delete it.
|
||||||
*/
|
*/
|
||||||
CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const
|
CryptoConfigEntry *entry(const QString &componentName, const QString &entryName) const;
|
||||||
{
|
|
||||||
const QGpgME::CryptoConfigComponent *comp = component(componentName);
|
/**
|
||||||
const QGpgME::CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr;
|
* This function is obsolete. It is provided to keep old source code working.
|
||||||
return group ? group->entry(entryName) : nullptr;
|
* We strongly advise against using it in new code.
|
||||||
}
|
*
|
||||||
|
* This function overloads @ref entry().
|
||||||
|
*
|
||||||
|
* Use the entry overload that does not require a group name instead. The group name
|
||||||
|
* is not needed to identify a configuration entry because it only provides logical
|
||||||
|
* grouping for user interfaces. Sometimes configuration entries are moved to different
|
||||||
|
* groups to improve usability.
|
||||||
|
*/
|
||||||
|
QGPGME_DEPRECATED CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write back changes
|
* Write back changes
|
||||||
|
Loading…
Reference in New Issue
Block a user