Commit 2e7a2b36 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent ae925e46
......@@ -127,7 +127,7 @@ public:
void applyWindowID(QWidget *w) const
{
return q->applyWindowID(w);
q->applyWindowID(w);
}
private:
......
......@@ -142,7 +142,7 @@ void ImportPaperKeyCommand::postSuccessHook(QWidget *)
if (!secKey.open(QIODevice::ReadOnly)) {
d->error(QStringLiteral("Failed to open temporary secret"), errorCaption());
qCWarning(KLEOPATRA_LOG) << "Failed to open tmp file";
finished();
Q_EMIT finished();
return;
}
auto data = secKey.readAll();
......@@ -153,19 +153,19 @@ void ImportPaperKeyCommand::postSuccessHook(QWidget *)
delete importjob;
if (result.error()) {
d->error(QString::fromUtf8(result.error().asString()), errorCaption());
finished();
Q_EMIT finished();
return;
}
if (!result.numSecretKeysImported() ||
(result.numSecretKeysUnchanged() == result.numSecretKeysImported())) {
d->error(i18n("Failed to restore any secret keys."), errorCaption());
finished();
Q_EMIT finished();
return;
}
// Refresh the key after success
KeyCache::mutableInstance()->reload(OpenPGP);
finished();
Q_EMIT finished();
d->information(xi18nc("@info", "Successfully restored the secret key parts from <filename>%1</filename>",
mFileName));
return;
......
......@@ -304,7 +304,7 @@ void DecryptVerifyFilesController::Private::prepareWizardFromPassedFiles()
const std::vector< std::shared_ptr<ArchiveDefinition> > archiveDefinitions = ArchiveDefinition::getArchiveDefinitions();
unsigned int counter = 0;
for (const auto &fname: m_passedFiles) {
for (const auto &fname: qAsConst(m_passedFiles)) {
kleo_assert(!fname.isEmpty());
const unsigned int classification = classify(fname);
......
......@@ -273,12 +273,12 @@ void SignEncryptWidget::addRecipient(const Key &key)
void SignEncryptWidget::clearAddedRecipients()
{
for (auto w: mUnknownWidgets) {
for (auto w: qAsConst(mUnknownWidgets)) {
mRecpLayout->removeWidget(w);
delete w;
}
for (auto &key: mAddedKeys) {
for (auto &key: qAsConst(mAddedKeys)) {
removeRecipient(key);
}
}
......@@ -453,7 +453,7 @@ void SignEncryptWidget::recpRemovalRequested(CertificateLineEdit *w)
void SignEncryptWidget::removeRecipient(const GpgME::Key &key)
{
for (CertificateLineEdit *edit: mRecpWidgets) {
for (CertificateLineEdit *edit: qAsConst(mRecpWidgets)) {
const auto editKey = edit->key();
if (key.isNull() && editKey.isNull()) {
recpRemovalRequested(edit);
......@@ -532,7 +532,7 @@ void SignEncryptWidget::setProtocol(GpgME::Protocol proto)
bool SignEncryptWidget::validate()
{
for (const auto edit: mRecpWidgets) {
for (const auto edit: qAsConst(mRecpWidgets)) {
if (!edit->isEmpty() && edit->key().isNull()) {
KMessageBox::error(this, i18nc("%1 is user input that could not be found",
"Could not find a key for '%1'", edit->text().toHtmlEscaped()),
......
......@@ -113,7 +113,7 @@ UiServer::~UiServer()
namespace {
using Iterator = std::vector<std::shared_ptr<AssuanCommandFactory>>::iterator;
static bool empty(const std::pair<Iterator, Iterator> &iters)
static bool empty(std::pair<Iterator, Iterator> iters)
{
return iters.first == iters.second;
}
......
......@@ -366,7 +366,7 @@ void KeyTreeView::restoreExpandState()
qCWarning(KLEOPATRA_LOG) << "Restore expand state before keycache available. Aborting.";
return;
}
for (const auto &fpr: m_expandedKeys) {
for (const auto &fpr: qAsConst(m_expandedKeys)) {
const KeyListModelInterface *km = dynamic_cast<const KeyListModelInterface*> (m_view->model());
if (!km) {
qCWarning(KLEOPATRA_LOG) << "invalid model";
......
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