Commit ae7f51c0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent c2163f1b
Pipeline #39551 passed with stage
in 10 minutes and 40 seconds
......@@ -58,8 +58,8 @@ class KLEO_EXPORT DN
{
public:
class Attribute;
typedef QVector<Attribute> AttributeList;
typedef AttributeList::const_iterator const_iterator;
using AttributeList = QVector<Attribute>;
using const_iterator = AttributeList::const_iterator;
DN();
explicit DN(const QString &dn);
......@@ -100,7 +100,7 @@ private:
class KLEO_EXPORT DN::Attribute
{
public:
typedef DN::AttributeList List;
using List = DN::AttributeList;
explicit Attribute(const QString &name = QString(), const QString &value = QString())
: mName(name.toUpper()), mValue(value) {}
......
......@@ -298,7 +298,7 @@ const std::shared_ptr<KeyFilter> &KeyFilterManager::fromModelIndex(const QModelI
QModelIndex KeyFilterManager::toModelIndex(const std::shared_ptr<KeyFilter> &kf) const
{
if (!kf) {
return QModelIndex();
return {};
}
const auto pair = std::equal_range(d->filters.cbegin(), d->filters.cend(), kf, ByDecreasingSpecificity());
const auto it = std::find(pair.first, pair.second, kf);
......@@ -372,7 +372,7 @@ static QColor get_color(const std::vector<std::shared_ptr<KeyFilter>> &filters,
&& (filter.get()->*fun)().isValid();
});
if (it == filters.cend()) {
return QColor();
return {};
} else {
return (it->get()->*fun)();
}
......
......@@ -166,7 +166,7 @@ Value accumulate_transform_if(InputIterator first, InputIterator last, UnaryFunc
template <typename InputIterator, typename BinaryOperation>
BinaryOperation for_each_adjacent_pair(InputIterator first, InputIterator last, BinaryOperation op)
{
typedef typename std::iterator_traits<InputIterator>::value_type ValueType;
using ValueType = typename std::iterator_traits<InputIterator>::value_type;
if (first == last) {
return op;
}
......
......@@ -86,7 +86,7 @@ public:
std::vector<Key>::const_iterator find(const std::vector<Key> &keys, const char *key) const
{
ensureCachePopulated();
const std::vector<Key>::const_iterator it =
const auto it =
std::lower_bound(keys.begin(), keys.end(), key, Comp<std::less>());
if (it == keys.end() || Comp<std::equal_to>()(*it, key)) {
return it;
......@@ -99,7 +99,7 @@ public:
std::vector<Subkey>::const_iterator find(const std::vector<Subkey> &keys, const char *key) const
{
ensureCachePopulated();
const std::vector<Subkey>::const_iterator it =
const auto it =
std::lower_bound(keys.begin(), keys.end(), key, Comp<std::less>());
if (it == keys.end() || Comp<std::equal_to>()(*it, key)) {
return it;
......@@ -888,7 +888,7 @@ template <
template <template <typename T> class Op> class T2
> struct lexicographically
{
typedef bool result_type;
using result_type = bool;
template <typename U, typename V>
bool operator()(const U &lhs, const V &rhs) const
......
......@@ -113,7 +113,7 @@ std::vector<Key> AbstractKeyListModel::keys(const QList<QModelIndex> &indexes) c
QModelIndex AbstractKeyListModel::index(const Key &key, int col) const
{
if (key.isNull() || col < 0 || col >= NumColumns) {
return QModelIndex();
return {};
} else {
return doMapFromKey(key, col);
}
......@@ -471,7 +471,7 @@ QModelIndex FlatKeyListModel::doMapFromKey(const Key &key, int col) const
= std::lower_bound(mKeysByFingerprint.begin(), mKeysByFingerprint.end(),
key, _detail::ByFingerprint<std::less>());
if (it == mKeysByFingerprint.end() || !_detail::ByFingerprint<std::equal_to>()(*it, key)) {
return QModelIndex();
return {};
} else {
return createIndex(it - mKeysByFingerprint.begin(), col);
}
......@@ -485,7 +485,7 @@ QList<QModelIndex> FlatKeyListModel::doAddKeys(const std::vector<Key> &keys)
return QList<QModelIndex>();
}
for (std::vector<Key>::const_iterator it = keys.begin(), end = keys.end(); it != end; ++it) {
for (auto it = keys.begin(), end = keys.end(); it != end; ++it) {
// find an insertion point:
const std::vector<Key>::iterator pos = std::upper_bound(mKeysByFingerprint.begin(), mKeysByFingerprint.end(), *it, _detail::ByFingerprint<std::less>());
......@@ -562,7 +562,7 @@ QModelIndex HierarchicalKeyListModel::index(int row, int col, const QModelIndex
{
if (row < 0 || col < 0 || col >= NumColumns) {
return QModelIndex();
return {};
}
// toplevel item:
......@@ -591,7 +591,7 @@ QModelIndex HierarchicalKeyListModel::parent(const QModelIndex &idx) const
{
const Key key = this->key(idx);
if (key.isNull() || key.isRoot()) {
return QModelIndex();
return {};
}
const std::vector<Key>::const_iterator it
= qBinaryFind(mKeysByFingerprint.begin(), mKeysByFingerprint.end(),
......@@ -629,7 +629,7 @@ QModelIndex HierarchicalKeyListModel::doMapFromKey(const Key &key, int col) cons
{
if (key.isNull()) {
return QModelIndex();
return {};
}
const char *issuer_fpr = cleanChainID(key);
......@@ -798,8 +798,8 @@ QList<QModelIndex> HierarchicalKeyListModel::doAddKeys(const std::vector<Key> &k
// Step 1: For new keys, remove children from toplevel:
if (!keyAlreadyExisted) {
std::vector<Key>::iterator last = mTopLevels.begin();
std::vector<Key>::iterator lastFP = mKeysByFingerprint.begin();
auto last = mTopLevels.begin();
auto lastFP = mKeysByFingerprint.begin();
for (const Key &k : qAsConst(children)) {
last = qBinaryFind(last, mTopLevels.end(), k, _detail::ByFingerprint<std::less>());
......
......@@ -79,7 +79,7 @@ QModelIndex AbstractKeyListSortFilterProxyModel::index(const Key &key) const
if (const KeyListModelInterface *const klmi = dynamic_cast<KeyListModelInterface *>(sourceModel())) {
return mapFromSource(klmi->index(key));
} else {
return QModelIndex();
return {};
}
}
......
......@@ -23,7 +23,7 @@ KeyRearrangeColumnsProxyModel::KeyRearrangeColumnsProxyModel(QObject *parent) :
KeyListModelInterface *KeyRearrangeColumnsProxyModel::klm() const
{
KeyListModelInterface *ret = dynamic_cast<KeyListModelInterface *>(sourceModel());
auto *ret = dynamic_cast<KeyListModelInterface *>(sourceModel());
Q_ASSERT(ret);
return ret;
}
......
......@@ -103,7 +103,7 @@ QModelIndex SubkeyListModel::index(const Subkey &subkey, int col) const
if (qstricmp(subkey.keyID(), d->key.subkey(row).keyID()) == 0) {
return index(row, col);
}
return QModelIndex();
return {};
}
QList<QModelIndex> SubkeyListModel::indexes(const std::vector<Subkey> &subkeys) const
......
......@@ -196,14 +196,14 @@ void UserIDListModel::setKey(const Key &key)
mRootItem = new UIDModelItem(mRemarksEnabled);
for (int i = 0, ids = key.numUserIDs(); i < ids; ++i) {
UserID uid = key.userID(i);
UIDModelItem *uidItem = new UIDModelItem(uid, mRootItem);
auto *uidItem = new UIDModelItem(uid, mRootItem);
mRootItem->appendChild(uidItem);
std::vector<UserID::Signature> sigs = uid.signatures();
#ifdef GPGME_USERID_SIGNATURES_ARE_SORTABLE
std::sort(sigs.begin(), sigs.end());
#endif
for (const auto &sig : sigs) {
UIDModelItem *sigItem = new UIDModelItem(sig, uidItem, mRemarksEnabled);
auto *sigItem = new UIDModelItem(sig, uidItem, mRemarksEnabled);
uidItem->appendChild(sigItem);
}
}
......@@ -243,7 +243,7 @@ int UserIDListModel::rowCount(const QModelIndex &parent) const
QModelIndex UserIDListModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent)) {
return QModelIndex();
return {};
}
UIDModelItem *parentItem = nullptr;
......@@ -265,9 +265,9 @@ QModelIndex UserIDListModel::index(int row, int column, const QModelIndex &paren
QModelIndex UserIDListModel::parent(const QModelIndex &index) const
{
if (!index.isValid()) {
return QModelIndex();
return {};
}
UIDModelItem *childItem = static_cast<UIDModelItem*>(index.internalPointer());
auto *childItem = static_cast<UIDModelItem*>(index.internalPointer());
UIDModelItem *parentItem = childItem->parentItem();
if (parentItem == mRootItem) {
......@@ -298,7 +298,7 @@ QVariant UserIDListModel::data(const QModelIndex &index, int role) const
return QVariant();
}
UIDModelItem *item = static_cast<UIDModelItem*>(index.internalPointer());
auto *item = static_cast<UIDModelItem*>(index.internalPointer());
if (role == Qt::ToolTipRole) {
return item->toolTip(index.column());
......@@ -317,7 +317,7 @@ QVector<UserID> UserIDListModel::userIDs (const QModelIndexList &indexs) const {
if (!idx.isValid()) {
continue;
}
UIDModelItem *item = static_cast<UIDModelItem*>(idx.internalPointer());
auto *item = static_cast<UIDModelItem*>(idx.internalPointer());
if (!item->uid().isNull()) {
ret << item->uid();
}
......@@ -331,7 +331,7 @@ QVector<UserID::Signature> UserIDListModel::signatures (const QModelIndexList &i
if (!idx.isValid()) {
continue;
}
UIDModelItem *item = static_cast<UIDModelItem*>(idx.internalPointer());
auto *item = static_cast<UIDModelItem*>(idx.internalPointer());
if (!item->signature().isNull()) {
ret << item->signature();
}
......
......@@ -51,9 +51,9 @@ KeyGenerator::KeyGenerator(QWidget *parent)
setWindowTitle(QStringLiteral("KeyGenerationJob test"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(mainWidget);
QPushButton *user1Button = new QPushButton;
auto *user1Button = new QPushButton;
buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KeyGenerator::reject);
user1Button->setDefault(true);
......@@ -63,7 +63,7 @@ KeyGenerator::KeyGenerator(QWidget *parent)
mainLayout->addWidget(w);
mainLayout->addWidget(buttonBox);
QGridLayout *glay = new QGridLayout(w);
auto *glay = new QGridLayout(w);
int row = -1;
......@@ -152,7 +152,7 @@ int main(int argc, char **argv)
parser.process(app);
aboutData.processCommandLine(&parser);
KeyGenerator *keygen = new KeyGenerator(nullptr);
auto *keygen = new KeyGenerator(nullptr);
keygen->setObjectName(QStringLiteral("KeyGenerator top-level"));
keygen->show();
......
......@@ -124,7 +124,7 @@ int main(int argc, char **argv)
parser.process(app);
aboutData.processCommandLine(&parser);
CertListView *clv = new CertListView;
auto *clv = new CertListView;
clv->show();
QTimer::singleShot(5000, clv, &CertListView::slotStart);
......
......@@ -154,7 +154,7 @@ int main(int argc, char **argv)
}
resolver.setOverrideKeys(overrides);
SignalRecipient * recp = new SignalRecipient(&resolver);
auto * recp = new SignalRecipient(&resolver);
QObject::connect (&resolver, &KeyResolver::keysResolved, recp, &SignalRecipient::keysResolved);
QTimer::singleShot(1000, [&parser, &resolver]() {
......
......@@ -35,7 +35,7 @@ int main(int argc, char **argv)
if (dlg.exec() == QDialog::Accepted) {
qDebug() << "accepted; selected key:" << (dlg.selectedKey().userID(0).id() ? dlg.selectedKey().userID(0).id() : "<null>") << "\nselected _keys_:";
for (std::vector<GpgME::Key>::const_iterator it = dlg.selectedKeys().begin(); it != dlg.selectedKeys().end(); ++it) {
for (auto it = dlg.selectedKeys().begin(); it != dlg.selectedKeys().end(); ++it) {
qDebug() << (it->userID(0).id() ? it->userID(0).id() : "<null>");
}
} else {
......
......@@ -36,13 +36,13 @@ AuditLogViewer::AuditLogViewer(const QString &log, QWidget *parent)
setWindowTitle(i18nc("@title:window", "View GnuPG Audit Log"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *copyClipBtn = new QPushButton;
auto *copyClipBtn = new QPushButton;
copyClipBtn->setText(i18n("&Copy to Clipboard"));
copyClipBtn->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
buttonBox->addButton(copyClipBtn, QDialogButtonBox::ActionRole);
connect(copyClipBtn, &QPushButton::clicked, this, &AuditLogViewer::slotCopyClip);
QPushButton *saveAsBtn = new QPushButton;
auto *saveAsBtn = new QPushButton;
saveAsBtn->setText(i18n("&Save to Disk..."));
saveAsBtn->setIcon(QIcon::fromTheme(QStringLiteral("document-save-as")));
buttonBox->addButton(saveAsBtn, QDialogButtonBox::ActionRole);
......@@ -51,7 +51,7 @@ AuditLogViewer::AuditLogViewer(const QString &log, QWidget *parent)
m_textEdit->setObjectName(QStringLiteral("m_textEdit"));
m_textEdit->setReadOnly(true);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(m_textEdit);
mainLayout->addWidget(buttonBox);
......
......@@ -20,11 +20,11 @@ Kleo::CryptoConfigDialog::CryptoConfigDialog(QGpgME::CryptoConfig *config, QWidg
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Configure GnuPG Backend"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults | QDialogButtonBox::Apply, this);
QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
QPushButton *user1Button = new QPushButton(this);
auto *user1Button = new QPushButton(this);
mButtonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
connect(mButtonBox, &QDialogButtonBox::accepted, this, &CryptoConfigDialog::accept);
connect(mButtonBox, &QDialogButtonBox::rejected, this, &CryptoConfigDialog::reject);
......
......@@ -55,7 +55,7 @@ public:
QSize sizeHint() const override
{
const QSize wsz = widget() ? widget()->sizeHint() : QSize();
return QSize(wsz.width() + style()->pixelMetric(QStyle::PM_ScrollBarExtent), QScrollArea::sizeHint().height());
return {wsz.width() + style()->pixelMetric(QStyle::PM_ScrollBarExtent), QScrollArea::sizeHint().height()};
}
};
......@@ -124,9 +124,9 @@ void Kleo::CryptoConfigModule::init(Layout layout)
if (type == Plain) {
QWidget *w = new QWidget(this);
QVBoxLayout *l = new QVBoxLayout(w);
auto *l = new QVBoxLayout(w);
l->setContentsMargins(0, 0, 0, 0);
QScrollArea *s = new QScrollArea(w);
auto *s = new QScrollArea(w);
s->setFrameStyle(QFrame::NoFrame);
s->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
s->setWidgetResizable(true);
......@@ -347,7 +347,7 @@ Kleo::CryptoConfigComponentGUI::CryptoConfigComponentGUI(
: QWidget(parent),
mComponent(component)
{
QGridLayout *glay = new QGridLayout(this);
auto *glay = new QGridLayout(this);
const QStringList groups = module->sortGroupList(mComponent->name(), mComponent->groupList());
if (groups.size() > 1) {
glay->setColumnMinimumWidth(0, KDHorizontalLine::indentHint());
......@@ -358,7 +358,7 @@ Kleo::CryptoConfigComponentGUI::CryptoConfigComponentGUI(
continue;
}
const QString title = group->description();
KDHorizontalLine *hl = new KDHorizontalLine(title.isEmpty() ? *it : title, this);
auto *hl = new KDHorizontalLine(title.isEmpty() ? *it : title, this);
const int row = glay->rowCount();
glay->addWidget(hl, row, 0, 1, 3);
mGroupGUIs.append(new CryptoConfigGroupGUI(module, group, glay, this));
......@@ -468,7 +468,7 @@ void Kleo::CryptoConfigGroupGUI::defaults()
////
typedef CryptoConfigEntryGUI *(*constructor)(CryptoConfigModule *, QGpgME::CryptoConfigEntry *, const QString &, QGridLayout *, QWidget *);
using constructor = CryptoConfigEntryGUI *(*)(CryptoConfigModule *, QGpgME::CryptoConfigEntry *, const QString &, QGridLayout *, QWidget *);
namespace
{
......@@ -855,7 +855,7 @@ Kleo::CryptoConfigEntryLDAPURL::CryptoConfigEntryLDAPURL(
QLabel *label = new QLabel(description(), widget);
label->setBuddy(mPushButton);
glay->addWidget(label, row, 1);
QHBoxLayout *hlay = new QHBoxLayout;
auto *hlay = new QHBoxLayout;
glay->addLayout(hlay, row, 2);
hlay->addWidget(mLabel, 1);
hlay->addWidget(mPushButton);
......@@ -892,7 +892,7 @@ void prepareURLCfgDialog(QDialog *dialog, DirectoryServicesWidget *dirserv, bool
QObject::connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
QVBoxLayout *layout = new QVBoxLayout;
auto *layout = new QVBoxLayout;
layout->addWidget(dirserv);
layout->addWidget(buttonBox);
dialog->setLayout(layout);
......@@ -905,7 +905,7 @@ void Kleo::CryptoConfigEntryLDAPURL::slotOpenDialog()
QDialog dialog(mPushButton->parentWidget());
dialog.setWindowTitle(i18nc("@title:window", "Configure LDAP Servers"));
DirectoryServicesWidget *dirserv = new DirectoryServicesWidget(&dialog);
auto *dirserv = new DirectoryServicesWidget(&dialog);
prepareURLCfgDialog(&dialog, dirserv, mEntry->isReadOnly());
......@@ -944,7 +944,7 @@ Kleo::CryptoConfigEntryKeyserver::CryptoConfigEntryKeyserver(
QLabel *label = new QLabel(i18n("Use keyserver at"), widget);
label->setBuddy(mPushButton);
glay->addWidget(label, row, 1);
QHBoxLayout *hlay = new QHBoxLayout;
auto *hlay = new QHBoxLayout;
glay->addLayout(hlay, row, 2);
hlay->addWidget(mLabel, 1);
hlay->addWidget(mPushButton);
......@@ -1036,7 +1036,7 @@ void Kleo::CryptoConfigEntryKeyserver::slotOpenDialog()
QDialog dialog(mPushButton->parentWidget());
dialog.setWindowTitle(i18nc("@title:window", "Configure Keyservers"));
DirectoryServicesWidget *dirserv = new DirectoryServicesWidget(&dialog);
auto *dirserv = new DirectoryServicesWidget(&dialog);
prepareURLCfgDialog(&dialog, dirserv, mEntry->isReadOnly());
......
......@@ -116,8 +116,8 @@ static unsigned short display_port(const QUrl &url)
static QRect calculate_geometry(const QRect &cell, const QSize &sizeHint)
{
const int height = qMax(cell.height(), sizeHint.height());
return QRect(cell.left(), cell.top() - (height - cell.height()) / 2,
cell.width(), height);
return {cell.left(), cell.top() - (height - cell.height()) / 2,
cell.width(), height};
}
/* The Model contains a bit historic cruft because in the past it was
......@@ -189,7 +189,7 @@ public:
QModelIndex duplicateRow(unsigned int row)
{
if (row >= m_items.size()) {
return QModelIndex();
return {};
}
beginInsertRows(QModelIndex(), row + 1, row + 1);
......@@ -332,7 +332,7 @@ public:
private:
QWidget *createPortWidget(QWidget *parent) const
{
QSpinBox *sb = new QSpinBox(parent);
auto *sb = new QSpinBox(parent);
sb->setRange(1, USHRT_MAX); // valid port numbers
return sb;
}
......
......@@ -56,7 +56,7 @@ Kleo::DNAttributeOrderConfigWidget::DNAttributeOrderConfigWidget(DNAttributeMapp
Q_ASSERT(mapper);
d->mapper = mapper;
QGridLayout *glay = new QGridLayout(this);
auto *glay = new QGridLayout(this);
glay->setContentsMargins(0, 0, 0, 0);
glay->setColumnStretch(0, 1);
glay->setColumnStretch(2, 1);
......@@ -90,7 +90,7 @@ Kleo::DNAttributeOrderConfigWidget::DNAttributeOrderConfigWidget(DNAttributeMapp
// the up/down/left/right arrow cross:
QGridLayout *xlay = new QGridLayout();
auto *xlay = new QGridLayout();
xlay->setSpacing(0);
xlay->setObjectName(QStringLiteral("xlay"));
xlay->setAlignment(Qt::AlignCenter);
......@@ -160,7 +160,7 @@ void Kleo::DNAttributeOrderConfigWidget::load()
const QStringList::const_iterator end(all.end());
for (QStringList::const_iterator it = all.begin(); it != end; ++it) {
if (!order.contains(*it)) {
QTreeWidgetItem *item = new QTreeWidgetItem(d->availableLV);
auto *item = new QTreeWidgetItem(d->availableLV);
item->setText(0, *it);
item->setText(1, d->mapper->name2label(*it));
}
......
......@@ -95,7 +95,7 @@ void KDHorizontalLine::calculateFrame()
QSizePolicy KDHorizontalLine::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
return {QSizePolicy::Minimum, QSizePolicy::Fixed};
}
QSize KDHorizontalLine::sizeHint() const
......
......@@ -86,7 +86,7 @@ Kleo::KeyApprovalDialog::KeyApprovalDialog(const std::vector<Item> &recipients,
d(new Private())
{
setWindowTitle(i18nc("@title:window", "Encryption Key Approval"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......@@ -98,18 +98,18 @@ Kleo::KeyApprovalDialog::KeyApprovalDialog(const std::vector<Item> &recipients,
QFrame *page = new QFrame(this);
mainLayout->addWidget(page);
mainLayout->addWidget(buttonBox);
QVBoxLayout *vlay = new QVBoxLayout(page);
auto *vlay = new QVBoxLayout(page);
vlay->setContentsMargins(0, 0, 0, 0);
vlay->addWidget(new QLabel(i18n("The following keys will be used for encryption:"), page));
QScrollArea *sv = new QScrollArea(page);
auto *sv = new QScrollArea(page);
sv->setWidgetResizable(true);
vlay->addWidget(sv);
QWidget *view = new QWidget(sv->viewport());
QGridLayout *glay = new QGridLayout(view);
auto *glay = new QGridLayout(view);
glay->setColumnStretch(1, 1);
sv->setWidget(view);
......@@ -127,7 +127,7 @@ Kleo::KeyApprovalDialog::KeyApprovalDialog(const std::vector<Item> &recipients,
const QStringList prefs = preferencesStrings();
for (std::vector<Item>::const_iterator it = recipients.begin(); it != recipients.end(); ++it) {
for (auto it = recipients.begin(); it != recipients.end(); ++it) {
++row;
glay->addWidget(new QLabel(i18n("Recipient:"), view), row, 0);
glay->addWidget(new QLabel(it->address, view), row, 1);
......@@ -142,7 +142,7 @@ Kleo::KeyApprovalDialog::KeyApprovalDialog(const std::vector<Item> &recipients,
++row;
glay->addWidget(new QLabel(i18n("Encryption preference:"), view), row, 0);
QComboBox *cb = new QComboBox(view);
auto *cb = new QComboBox(view);
cb->setEditable(false);
cb->addItems(prefs);
glay->addWidget(cb, row, 1);
......@@ -177,8 +177,8 @@ std::vector<Kleo::KeyApprovalDialog::Item> Kleo::KeyApprovalDialog::items() cons
std::vector<Item> result;
result.reserve(d->requesters.size());
QStringList::const_iterator ait = d->addresses.constBegin();
std::vector<KeyRequester *>::iterator rit = d->requesters.begin();
std::vector<QComboBox *>::iterator cit = d->preferences.begin();
auto rit = d->requesters.begin();
auto cit = d->preferences.begin();
while (ait != d->addresses.constEnd()) {
result.push_back(Item(*ait++, (*rit++)->keys(), cb2pref((*cit++)->currentIndex())));
}
......
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