Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 196710f8 authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent 0f656f39
......@@ -38,7 +38,7 @@ void FilterActionDecryptTest::shouldDecrypt_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();
......
......@@ -94,7 +94,7 @@ void FilterActionPipeThroughTest::testCommandWithoutOutput()
item.setPayload<KMime::Message::Ptr>(msgPtr);
ItemContext context(item, true);
filter.argsFromString("echo ''");
filter.argsFromString(QStringLiteral("echo ''"));
QCOMPARE(filter.process(context, false), FilterAction::ErrorButGoOn);
QCOMPARE(context.needsPayloadStore(), false);
}
......
......@@ -50,7 +50,6 @@ SelectThunderbirdFilterFilesWidget::SelectThunderbirdFilterFilesWidget(const QSt
slotProfileChanged(0);
connect(ui->fileUrl, &KUrlRequester::textChanged, this, &SelectThunderbirdFilterFilesWidget::slotUrlChanged);
connect(ui->listFiles, &QListWidget::itemSelectionChanged, this, &SelectThunderbirdFilterFilesWidget::slotItemSelectionChanged);
Q_EMIT enableOkButton(false);
}
SelectThunderbirdFilterFilesWidget::~SelectThunderbirdFilterFilesWidget()
......@@ -115,6 +114,7 @@ QStringList SelectThunderbirdFilterFilesWidget::selectedFiles() const
listFiles << ui->fileUrl->url().path();
} else {
const QList<QListWidgetItem *> list = ui->listFiles->selectedItems();
listFiles.reserve(list.count());
for (QListWidgetItem *item : list) {
listFiles << item->text();
}
......
......@@ -209,7 +209,7 @@ QString FilterActionAddHeader::sieveCode() const
if (isEmpty()) {
return QStringLiteral("# invalid filter. Need to fix it by hand");
} else {
return QStringLiteral("addheader \"%1\" \"%2\";").arg(mParameter).arg(mValue);
return QStringLiteral("addheader \"%1\" \"%2\";").arg(mParameter, mValue);
}
}
......
......@@ -151,10 +151,10 @@ FilterAction::ReturnCode FilterActionEncrypt::process(ItemContext &context, bool
if (mKey.protocol() == GpgME::OpenPGP) {
std::vector<std::string> ids;
ids.reserve(encryptionKeys.size());
for (const auto key : encryptionKeys) {
for (const auto &key : encryptionKeys) {
ids.push_back(key.toStdString());
}
for (const auto key : mKeyCache->findByKeyIDOrFingerprint(ids)) {
for (const auto &key : mKeyCache->findByKeyIDOrFingerprint(ids)) {
if (qstrcmp(key.primaryFingerprint(), mKey.primaryFingerprint()) == 0) {
// This email is already encrypted with the target key,
// so there's no need to re-encrypt it
......@@ -164,7 +164,7 @@ FilterAction::ReturnCode FilterActionEncrypt::process(ItemContext &context, bool
}
} else if (mKey.protocol() == GpgME::CMS) {
// We are only able to get serial
for (const auto key : mKeyCache->secretKeys()) {
for (const auto &key : mKeyCache->secretKeys()) {
if (qstrcmp(key.issuerSerial(), mKey.issuerSerial()) == 0) {
// This email is already encrypted with the target key,
// so there's no need to re-encrypt it
......
......@@ -56,7 +56,7 @@
using namespace MailCommon;
QList<MailFilter *> FilterImporterExporter::readFiltersFromConfig(
const KSharedConfig::Ptr config, QStringList &emptyFilters)
const KSharedConfig::Ptr &config, QStringList &emptyFilters)
{
const KConfigGroup group = config->group("General");
......
......@@ -100,8 +100,7 @@ public:
* Reads a list of filters from the given @p config file.
* Return list of empty filter
*/
static QList<MailFilter *> readFiltersFromConfig(
const KSharedConfig::Ptr config, QStringList &emptyFilter);
static QList<MailFilter *> readFiltersFromConfig(const KSharedConfig::Ptr &config, QStringList &emptyFilter);
private:
//@cond PRIVATE
......
......@@ -250,7 +250,7 @@ void FilterManager::filter(const Akonadi::Collection::List &collections, FilterS
{
QList<qint64> colIds;
colIds.reserve(collections.size());
for (const auto col : collections) {
for (const auto &col : collections) {
colIds << col.id();
}
......@@ -266,7 +266,7 @@ void FilterManager::filter(const Akonadi::Collection::List &collections, const Q
{
QList<qint64> colIds;
colIds.reserve(collections.size());
for (const auto col : collections) {
for (const auto &col : collections) {
colIds << col.id();
}
......
......@@ -103,14 +103,6 @@ const char _wt_filterlist_rename[]
"naming back, click this button and select <em>Clear</em> followed "
"by <em>OK</em> in the appearing dialog.</p></qt>");
const char _wt_filterdlg_showLater[]
= I18N_NOOP("<qt><p>Check this button to force the confirmation dialog to be "
"displayed.</p><p>This is useful if you have defined a ruleset that tags "
"messages to be downloaded later. Without the possibility to force "
"the dialog popup, these messages could never be downloaded if no "
"other large messages were waiting on the server, or if you wanted to "
"change the ruleset to tag the messages differently.</p></qt>");
//=============================================================================
//
// class KMFilterListBox (the filter list manipulator)
......@@ -428,7 +420,7 @@ QList<MailFilter *> KMFilterListBox::filtersForSaving(bool closeAfterSaving, boo
void KMFilterListBox::slotSelectionChanged()
{
if (mListWidget->selectedItems().count() > 1) {
resetWidgets();
Q_EMIT resetWidgets();
}
enableControls();
}
......
......@@ -652,49 +652,49 @@ const QString MailFilter::asString() const
QList<FilterAction *>::const_iterator it(mActions.constBegin());
QList<FilterAction *>::const_iterator end(mActions.constEnd());
for (; it != end; ++it) {
result += " action: ";
result += QStringLiteral(" action: ");
result += (*it)->label();
result += ' ';
result += QLatin1Char(' ');
result += (*it)->argsAsString();
result += '\n';
result += QLatin1Char('\n');
}
result += "This filter belongs to the following sets:";
result += QStringLiteral("This filter belongs to the following sets:");
if (bApplyOnInbound) {
result += " Inbound";
result += QStringLiteral(" Inbound");
}
if (bApplyBeforeOutbound) {
result += " before-Outbound";
result += QStringLiteral(" before-Outbound");
}
if (bApplyOnOutbound) {
result += " Outbound";
result += QStringLiteral(" Outbound");
}
if (bApplyOnExplicit) {
result += " Explicit";
result += QStringLiteral(" Explicit");
}
if (bApplyOnAllFolders) {
result += " All Folders";
result += QStringLiteral(" All Folders");
}
result += '\n';
result += QLatin1Char('\n');
if (bApplyOnInbound && mApplicability == All) {
result += "This filter applies to all accounts.\n";
result += QStringLiteral("This filter applies to all accounts.\n");
} else if (bApplyOnInbound && mApplicability == ButImap) {
result += "This filter applies to all but IMAP accounts.\n";
result += QStringLiteral("This filter applies to all but IMAP accounts.\n");
} else if (bApplyOnInbound) {
result += "This filter applies to the following accounts:";
result += QStringLiteral("This filter applies to the following accounts:");
if (mAccounts.isEmpty()) {
result += " None";
result += QStringLiteral(" None");
} else {
for (QStringList::ConstIterator it2 = mAccounts.begin(), it2End = mAccounts.end(); it2 != it2End; ++it2) {
if (Akonadi::AgentManager::self()->instance(*it2).isValid()) {
result += ' ' + Akonadi::AgentManager::self()->instance(*it2).name();
result += QLatin1Char(' ') + Akonadi::AgentManager::self()->instance(*it2).name();
}
}
}
result += '\n';
result += QLatin1Char('\n');
}
if (bStopProcessingHere) {
result += "If it matches, processing stops at this filter.\n";
result += QStringLiteral("If it matches, processing stops at this filter.\n");
}
return result;
......
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