aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/src
diff options
context:
space:
mode:
Diffstat (limited to 'lang/qt/src')
-rw-r--r--lang/qt/src/cryptoconfig.cpp20
-rw-r--r--lang/qt/src/cryptoconfig.h22
2 files changed, 35 insertions, 7 deletions
diff --git a/lang/qt/src/cryptoconfig.cpp b/lang/qt/src/cryptoconfig.cpp
index 71212200..d52dce73 100644
--- a/lang/qt/src/cryptoconfig.cpp
+++ b/lang/qt/src/cryptoconfig.cpp
@@ -43,3 +43,23 @@ QStringList CryptoConfigEntry::stringValueList() const
}
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;
+}
diff --git a/lang/qt/src/cryptoconfig.h b/lang/qt/src/cryptoconfig.h
index d7aae9d7..651e2af1 100644
--- a/lang/qt/src/cryptoconfig.h
+++ b/lang/qt/src/cryptoconfig.h
@@ -373,18 +373,26 @@ public:
/**
* 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.
*
* @return the configuration object for a single configuration entry, 0 if not found.
* The object is owned by CryptoConfig, don't delete it.
*/
- CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const
- {
- const QGpgME::CryptoConfigComponent *comp = component(componentName);
- const QGpgME::CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr;
- return group ? group->entry(entryName) : nullptr;
- }
+ CryptoConfigEntry *entry(const QString &componentName, const QString &entryName) const;
+
+ /**
+ * This function is obsolete. It is provided to keep old source code working.
+ * 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