Commit 5c066f59 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent 762c8022
Pipeline #23242 passed with stage
in 41 minutes and 35 seconds
......@@ -42,7 +42,7 @@ void FilterActionEncryptTest::shouldEncrypt_data()
QDir testDir(QString::fromUtf8(TEST_PATH) + QStringLiteral("/gpgdata"));
const auto tests = testDir.entryInfoList({ QStringLiteral("*.msg") }, QDir::Files, QDir::Name);
for (const auto test : tests) {
for (const auto &test : tests) {
QFile plain(test.absoluteFilePath());
QVERIFY(plain.open(QIODevice::ReadOnly));
const auto plainData = plain.readAll();
......@@ -98,7 +98,6 @@ void FilterActionEncryptTest::shouldEncrypt()
QCOMPARE(newMsg->date()->asUnicodeString(), msg->date()->asUnicodeString());
QCOMPARE(newMsg->subject()->asUnicodeString(), msg->subject()->asUnicodeString());
QString gpgexe;
QByteArray resultContent;
GPGHelper::CryptoType crypto;
if (key.startsWith(QLatin1String("PGP"))) {
......
......@@ -28,12 +28,12 @@ QStringList FilterActionWithCrypto::getEncryptionKeysFromContent(const KMime::Me
{
if (protocol == GpgME::CMS && mGpgSmPath.isNull()) {
const auto path = QStandardPaths::findExecutable(QStringLiteral("gpgsm"));
mGpgSmPath = path.isEmpty() ? QStringLiteral("") : path;
mGpgSmPath = path.isEmpty() ? QString() : path;
} else if (protocol == GpgME::OpenPGP && mGpgPath.isNull()) {
auto path = QStandardPaths::findExecutable(QStringLiteral("gpg2"));
if (path.isEmpty()) {
path = QStandardPaths::findExecutable(QStringLiteral("gpg"));
mGpgPath = path.isEmpty() ? QStringLiteral("") : path;
mGpgPath = path.isEmpty() ? QString() : path;
} else {
mGpgPath = path;
}
......
......@@ -287,8 +287,7 @@ void KMFilterListBox::createFilter(const QByteArray &field, const QString &value
MailFilter *newFilter = new MailFilter();
newFilter->pattern()->append(newRule);
newFilter->pattern()->setName(QStringLiteral("<%1>: %2").
arg(QString::fromLatin1(field)).
arg(value));
arg(QString::fromLatin1(field), value));
FilterActionDesc *desc = MailCommon::FilterManager::filterActionDict()->value(QStringLiteral("transfer"));
if (desc) {
......
......@@ -642,7 +642,7 @@ const QString MailFilter::asString() const
result += QLatin1String("Filter name: ") + name() + QLatin1String(" (") + mIdentifier + QLatin1String(")\n");
result += mPattern.asString() + QLatin1Char('\n');
result += QString("Filter is %1\n").arg(bEnabled ? QStringLiteral("enabled") : QStringLiteral("disabled"));
result += QStringLiteral("Filter is %1\n").arg(bEnabled ? QStringLiteral("enabled") : QStringLiteral("disabled"));
QVector<FilterAction *>::const_iterator it(mActions.constBegin());
QVector<FilterAction *>::const_iterator end(mActions.constEnd());
......
......@@ -237,8 +237,7 @@ void BackupJob::archiveNextMessage()
return;
}
Akonadi::Item item = mPendingMessages.front();
mPendingMessages.pop_front();
const Akonadi::Item item = mPendingMessages.takeFirst();
qCDebug(MAILCOMMON_LOG) << "Fetching item with ID" << item.id() << "for folder" << mCurrentFolder.name();
mCurrentJob = new Akonadi::ItemFetchJob(item);
......
......@@ -112,7 +112,7 @@ Akonadi::MessageStatus SearchRuleStatus::statusFromEnglishName(const QString &aS
QString SearchRuleStatus::informationAboutNotValidRules() const
{
//TODO
return QStringLiteral("");
return QString();
}
bool SearchRuleStatus::isEmpty() const
......
......@@ -150,7 +150,7 @@ bool SearchRuleString::matches(const Akonadi::Item &item) const
} else {
// make sure to treat messages with multiple header lines for
// the same header correctly
msgContents = QStringLiteral("");
msgContents.clear();
if (auto hrd = msg->headerByType(field().constData())) {
msgContents = hrd->asUnicodeString();
}
......@@ -159,7 +159,7 @@ bool SearchRuleString::matches(const Akonadi::Item &item) const
if (function() == FuncIsInAddressbook
|| function() == FuncIsNotInAddressbook) {
// I think only the "from"-field makes sense.
msgContents = QStringLiteral("");
msgContents.clear();
if (auto hrd = msg->headerByType(field().constData())) {
msgContents = hrd->asUnicodeString();
}
......
......@@ -70,7 +70,7 @@ public:
explicit SnippetsModel(QObject *parent = nullptr);
~SnippetsModel() override;
Q_REQUIRED_RESULT bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role) const override;
......
......@@ -24,7 +24,7 @@ class QContextMenuEvent;
namespace MailCommon {
class SnippetsManager;
class SnippetInfo;
struct SnippetInfo;
/**
* @author Robert Gruber
*/
......
......@@ -67,7 +67,7 @@ Q_REQUIRED_RESULT MAILCOMMON_EXPORT bool isVirtualCollection(const QString &reso
Q_REQUIRED_RESULT MAILCOMMON_EXPORT QString fullCollectionPath(const Akonadi::Collection &collection, bool addAccountName = true);
Q_REQUIRED_RESULT MAILCOMMON_EXPORT bool showJobErrorMessage(KJob *job);
MAILCOMMON_EXPORT bool showJobErrorMessage(KJob *job);
Q_REQUIRED_RESULT MAILCOMMON_EXPORT Akonadi::AgentInstance::List agentInstances(bool excludeMailTransport = true);
......
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