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

Port some clazy warning

parent ab4279b4
Pipeline #23072 passed with stage
in 13 minutes and 45 seconds
......@@ -171,8 +171,7 @@ private:
const auto time = QDateTime::fromSecsSinceEpoch(mKey.creationTime());
const auto timestamp = time.toString(QStringLiteral("yyyyMMdd'T'HHmmss"));
#ifdef GPGME_SUBKEY_HAS_KEYGRIP
const QString cmd = QStringLiteral("KEYTOCARD --force %1 %2 OPENPGP.%3 %4").arg(QString::fromLatin1(mKey.keyGrip()))
.arg(QString::fromStdString(mSerial))
const QString cmd = QStringLiteral("KEYTOCARD --force %1 %2 OPENPGP.%3 %4").arg(QString::fromLatin1(mKey.keyGrip()), QString::fromStdString(mSerial))
.arg(slot)
.arg(timestamp);
ReaderStatus::mutableInstance()->startSimpleTransaction(cmd.toUtf8(), q_func(), "keyToCardDone");
......
......@@ -87,19 +87,22 @@ static void resetDefaults()
return;
}
for (const auto &compName: config->componentList()) {
const QStringList componentList = config->componentList();
for (const auto &compName: componentList) {
auto comp = config->component(compName);
if (!comp) {
qCWarning(KLEOPATRA_LOG) << "Failed to find component:" << comp;
return;
}
for (const auto &grpName: comp->groupList()) {
const QStringList groupList = comp->groupList();
for (const auto &grpName: groupList) {
auto grp = comp->group(grpName);
if (!grp) {
qCWarning(KLEOPATRA_LOG) << "Failed to find group:" << grp << "in component:" << compName;
return;
}
for (const auto &entryName: grp->entryList()) {
const QStringList entries = grp->entryList();
for (const auto &entryName: entries) {
auto entry = grp->entry(entryName);
if (!entry) {
qCWarning(KLEOPATRA_LOG) << "Failed to find entry:" << entry << "in group:"<< grp << "in component:" << compName;
......
......@@ -98,7 +98,7 @@ void Controller::emitDoneOrError()
d->lastError = 0;
d->lastErrorString = QString();
} else {
Q_EMIT done();
done();
}
}
......@@ -77,8 +77,7 @@ public:
auto nameLabel = new QLabel(i18n("Name:"));
auto mailLabel = new QLabel(i18n("EMail:"));
mInvalidEmailLabel = new QLabel(QStringLiteral("<font size='small' color='%1'>%2</font>").arg(
KColorScheme(QPalette::Active, KColorScheme::View).foreground(KColorScheme::NegativeText).color().name()).arg(
i18n("Invalid EMail")));
KColorScheme(QPalette::Active, KColorScheme::View).foreground(KColorScheme::NegativeText).color().name(), i18n("Invalid EMail")));
int row = 0;
grid->addWidget(nameLabel, row, 0);
grid->addWidget(mNameEdit, row++, 1);
......
......@@ -49,7 +49,7 @@ static const about_data authors[] = {
AboutData::AboutData()
: KAboutData(QStringLiteral("kwatchgnupg"), i18n("KWatchGnuPG"),
QLatin1String(KWATCHGNUPG_VERSION_STRING), i18n("GnuPG log viewer"), KAboutLicense::GPL,
QStringLiteral(KWATCHGNUPG_VERSION_STRING), i18n("GnuPG log viewer"), KAboutLicense::GPL,
i18n("(c) 2004 Klar\xC3\xA4lvdalens Datakonsult AB\n"))
{
using ::authors;
......
......@@ -131,7 +131,11 @@ void SelectCertificateCommand::setSelectedCertificates(const QStringList &certs)
QStringList SelectCertificateCommand::selectedCertificates() const
{
const QByteArray data = receivedData();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
return QString::fromLatin1(data.data(), data.size()).split(QLatin1Char('\n'), Qt::SkipEmptyParts);
#else
return QString::fromLatin1(data.data(), data.size()).split(QLatin1Char('\n'), QString::SkipEmptyParts);
#endif
}
void SelectCertificateCommand::setSelectedCertificate(const QString &cert)
......
......@@ -219,7 +219,7 @@ void CertificateRequester::setSelectedCertificates(const QStringList &certs)
}
d->selectedCertificates = certs;
d->updateLineEdit();
/*emit*/ selectedCertificatesChanged(certs);
Q_EMIT selectedCertificatesChanged(certs);
}
QStringList CertificateRequester::selectedCertificates() const
......
......@@ -332,7 +332,7 @@ protected Q_SLOTS:
}
protected:
#define FIELD(type, name) type name() const { return field( QLatin1String(#name) ).value<type>(); }
#define FIELD(type, name) type name() const { return field( QStringLiteral(#name) ).value<type>(); }
FIELD(bool, pgp)
FIELD(bool, signingAllowed)
FIELD(bool, encryptionAllowed)
......@@ -582,7 +582,7 @@ public:
return ui.authenticationCB->isChecked();
}
void setExpiryDate(const QDate &date)
void setExpiryDate(QDate date)
{
if (date.isValid()) {
ui.expiryDE->setDate(date);
......
......@@ -96,7 +96,7 @@ public:
" %1\n"
"You might want to execute \"gpgconf %3\" on the command line.\n",
message, m_component.isEmpty() ? QStringLiteral("GnuPG") : m_component,
QStringLiteral("--check-options ") + (m_component.isEmpty() ? QStringLiteral("") : m_component));
QStringLiteral("--check-options ") + (m_component.isEmpty() ? QString() : m_component));
// To avoid modifying the l10n
m_explanation.replace(QLatin1Char('\n'), QStringLiteral("<br/>"));
......
......@@ -270,6 +270,7 @@ static void handle_netkey_card(std::shared_ptr<Card> &ci, std::shared_ptr<Contex
}
std::vector<Card::PinState> states;
states.reserve(chvStatus.count());
// CHV Status for NKS v3 is
// Pin1 (Normal pin) Pin2 (Normal PUK)
// SigG1 SigG PUK.
......
......@@ -65,7 +65,7 @@ inline T &__kdtools__dereference_for_methodcall(T *o)
return *o;
}
#define KDAB_SET_OBJECT_NAME( x ) __kdtools__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) )
#define KDAB_SET_OBJECT_NAME( x ) __kdtools__dereference_for_methodcall( x ).setObjectName( QStringLiteral( #x ) )
#define KDAB_SYNCHRONIZED( mutex ) if ( bool __counter_##__LINE__ = false ) {} else \
for ( QMutexLocker __locker_##__LINE__( &__kdtools__dereference_for_methodcall( mutex ) ) ; !__counter_##__LINE__ ; __counter_##__LINE__ = true )
......
......@@ -200,7 +200,7 @@ void NetKeyWidget::setCard(const NetKeyCard* card)
const auto errMsg = card->errorMsg();
if (!errMsg.isEmpty()) {
mErrorLabel->setText(QStringLiteral("<b>%1:</b> %2").arg(i18n("Error")).arg(errMsg));
mErrorLabel->setText(QStringLiteral("<b>%1:</b> %2").arg(i18n("Error"), errMsg));
mErrorLabel->setVisible(true);
} else {
mErrorLabel->setVisible(false);
......
......@@ -54,7 +54,7 @@ NullPinWidget::NullPinWidget()
"documentation and should be understandable by Netkey cardholders",
"The NullPIN is still active on this card.");
const auto nullDescription = i18n("You need to set a PIN before you can use the certificates.");
const auto descriptionLbl = new QLabel(QStringLiteral("<b>%1</b><br/>%2").arg(nullTitle).arg(nullDescription));
const auto descriptionLbl = new QLabel(QStringLiteral("<b>%1</b><br/>%2").arg(nullTitle, nullDescription));
auto vLay = new QVBoxLayout(this);
vLay->addWidget(descriptionLbl, 0, Qt::AlignCenter);
......
......@@ -400,7 +400,7 @@ public:
const auto sigKey = mSigEncWidget->signKey();
bool encrypt = mSigEncWidget->encryptSymmetric() || mSigEncWidget->recipients().size();
bool encrypt = mSigEncWidget->encryptSymmetric() || !mSigEncWidget->recipients().isEmpty();
bool sign = !sigKey.isNull();
if (sign) {
......
......@@ -493,6 +493,7 @@ void PGPCardWidget::updateKey(QLabel *label, const std::string &fpr)
return;
}
QStringList toolTips;
toolTips.reserve(subkeys.size());
for (const auto &sub: subkeys) {
// Yep you can have one subkey associated with multiple
// primary keys.
......
......@@ -98,7 +98,7 @@ public:
QVBoxLayout *vLay = new QVBoxLayout(q);
connect(backBtn, &QPushButton::clicked, q, [this] () {Q_EMIT (q->backRequested());});
connect(backBtn, &QPushButton::clicked, q, [this] () {Q_EMIT q->backRequested();});
vLay->addLayout(backH);
......
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