aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/src/qgpgmenewcryptoconfig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lang/qt/src/qgpgmenewcryptoconfig.cpp')
-rw-r--r--lang/qt/src/qgpgmenewcryptoconfig.cpp50
1 files changed, 27 insertions, 23 deletions
diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp
index 94e3fb2b..15d50b4a 100644
--- a/lang/qt/src/qgpgmenewcryptoconfig.cpp
+++ b/lang/qt/src/qgpgmenewcryptoconfig.cpp
@@ -97,7 +97,7 @@ void QGpgMENewCryptoConfig::reloadConfiguration(bool)
KMessageBox::error(0, wmsg);
}
#endif
- Q_FOREACH(const Component & c, components) {
+ for (const Component &c : components) {
const std::shared_ptr<QGpgMENewCryptoConfigComponent> comp(new QGpgMENewCryptoConfigComponent);
comp->setComponent(c);
m_componentsByName[ comp->name() ] = comp;
@@ -127,8 +127,9 @@ QGpgMENewCryptoConfigComponent *QGpgMENewCryptoConfig::component(const QString &
void QGpgMENewCryptoConfig::sync(bool runtime)
{
- Q_FOREACH(const std::shared_ptr<QGpgMENewCryptoConfigComponent> &c, m_componentsByName)
- c->sync(runtime);
+ for (const std::shared_ptr<QGpgMENewCryptoConfigComponent> &c : qAsConst(m_componentsByName)) {
+ c->sync(runtime);
+ }
}
void QGpgMENewCryptoConfig::clear()
@@ -156,19 +157,20 @@ void QGpgMENewCryptoConfigComponent::setComponent(const Component &component)
std::shared_ptr<QGpgMENewCryptoConfigGroup> group;
const std::vector<Option> options = m_component.options();
- Q_FOREACH(const Option & o, options)
- if (o.flags() & Group) {
- if (group) {
- m_groupsByName[group->name()] = group;
+ for (const Option &o : options) {
+ if (o.flags() & Group) {
+ if (group) {
+ m_groupsByName[group->name()] = group;
+ }
+ group.reset(new QGpgMENewCryptoConfigGroup(shared_from_this(), o));
+ } else if (group) {
+ const std::shared_ptr<QGpgMENewCryptoConfigEntry> entry(new QGpgMENewCryptoConfigEntry(group, o));
+ const QString name = entry->name();
+ group->m_entryNames.push_back(name);
+ group->m_entriesByName[name] = entry;
+ } else {
+ qCWarning(QGPGME_LOG) << "found no group for entry" << o.name() << "of component" << name();
}
- group.reset(new QGpgMENewCryptoConfigGroup(shared_from_this(), o));
- } else if (group) {
- const std::shared_ptr<QGpgMENewCryptoConfigEntry> entry(new QGpgMENewCryptoConfigEntry(group, o));
- const QString name = entry->name();
- group->m_entryNames.push_back(name);
- group->m_entriesByName[name] = entry;
- } else {
- qCWarning(QGPGME_LOG) << "found no group for entry" << o.name() << "of component" << name();
}
if (group) {
m_groupsByName[group->name()] = group;
@@ -578,13 +580,14 @@ QList<QUrl> QGpgMENewCryptoConfigEntry::urlValueList() const
const Argument arg = m_option.currentValue();
const std::vector<const char *> values = arg.stringValues();
QList<QUrl> ret;
- Q_FOREACH(const char *value, values)
- if (type == FilenameType) {
- QUrl url;
- url.setPath(QFile::decodeName(value));
- ret << url;
- } else {
- ret << parseURL(type, QString::fromUtf8(value));
+ for (const char *value : values) {
+ if (type == FilenameType) {
+ QUrl url;
+ url.setPath(QFile::decodeName(value));
+ ret << url;
+ } else {
+ ret << parseURL(type, QString::fromUtf8(value));
+ }
}
return ret;
}
@@ -678,12 +681,13 @@ void QGpgMENewCryptoConfigEntry::setURLValueList(const QList<QUrl> &urls)
Q_ASSERT(isList());
std::vector<std::string> values;
values.reserve(urls.size());
- Q_FOREACH (const QUrl &url, urls)
+ for (const QUrl &url : urls) {
if (type == FilenameType) {
values.push_back(QFile::encodeName(url.path()).constData());
} else {
values.push_back(splitURL(type, url).toUtf8().constData());
}
+ }
const auto err = m_option.setNewValue(m_option.createStringListArgument(values));
if (err) {
qCWarning(QGPGME_LOG) << "setURLValueList: failed to set new value:" << err;