From f5e61fa49dc7db116e4c32053ee25f4c0dde76da Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Tue, 18 Sep 2018 08:17:15 +0200 Subject: [PATCH] Make it compiles --- CMakeLists.txt | 2 +- autotests/favoritestest.cpp | 2 +- src/filter/autotests/filteractionaddtoaddressbooktest.cpp | 4 ++-- src/filter/autotests/filteractiondeletetest.cpp | 2 +- src/filter/autotests/filteractionpipethroughtest.cpp | 2 +- src/filter/autotests/filteractionremoveheadertest.cpp | 6 +++--- src/filter/autotests/filteractionrewriteheadertest.cpp | 6 +++--- src/filter/autotests/gpghelper.cpp | 4 ++-- .../filteractions/filteractionsendfakedisposition.cpp | 2 +- .../filterimporter/autotests/filterimportclawmailtest.cpp | 2 +- src/filter/mailfilter.cpp | 4 ++-- src/search/searchrule/searchrule.cpp | 2 +- src/search/searchrule/searchrulestring.cpp | 4 ++-- src/widgets/redirectdialog.cpp | 4 ++-- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bb8797..15c97ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,7 +81,7 @@ find_package(Xsltproc) set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces for all Akonadi resources.") ########### Targets ########### - +remove_definitions( -DQT_NO_CAST_FROM_ASCII ) add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) diff --git a/autotests/favoritestest.cpp b/autotests/favoritestest.cpp index 2dd04a3..ce1974e 100644 --- a/autotests/favoritestest.cpp +++ b/autotests/favoritestest.cpp @@ -101,7 +101,7 @@ void FavoriteProxyTest::testReordering() const Akonadi::Collection favoriteCollection = index.data(EntityTreeModel::CollectionRole).value(); QVERIFY(favoriteCollection.isValid()); collectionIds.push_back(favoriteCollection.id()); - order.push_back("c" + QString::number(favoriteCollection.id())); + order.push_back(QStringLiteral("c") + QString::number(favoriteCollection.id())); labels << folderName; } diff --git a/src/filter/autotests/filteractionaddtoaddressbooktest.cpp b/src/filter/autotests/filteractionaddtoaddressbooktest.cpp index c0c830a..d9ea3f6 100644 --- a/src/filter/autotests/filteractionaddtoaddressbooktest.cpp +++ b/src/filter/autotests/filteractionaddtoaddressbooktest.cpp @@ -63,7 +63,7 @@ void FilterActionAddToAddressBookTest::shouldReportErrorWhenArgumentIsEmpty() item.setPayload(msgPtr); MailCommon::ItemContext context(item, false); - filter.argsFromString(""); + filter.argsFromString(QString()); QVERIFY(filter.isEmpty()); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn); QCOMPARE(context.needsPayloadStore(), false); @@ -79,7 +79,7 @@ void FilterActionAddToAddressBookTest::shouldReportErrorWhenCollectionIsInvalid( item.setPayload(msgPtr); MailCommon::ItemContext context(item, false); - filter.argsFromString("foo\t-1\tddd"); + filter.argsFromString(QStringLiteral("foo\t-1\tddd")); QVERIFY(filter.isEmpty()); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn); QCOMPARE(context.needsPayloadStore(), false); diff --git a/src/filter/autotests/filteractiondeletetest.cpp b/src/filter/autotests/filteractiondeletetest.cpp index 6a6e687..459f928 100644 --- a/src/filter/autotests/filteractiondeletetest.cpp +++ b/src/filter/autotests/filteractiondeletetest.cpp @@ -65,7 +65,7 @@ void FilterActionDeleteTest::shouldDeleteItem() item.setPayload(msgPtr); MailCommon::ItemContext context(item, false); - filter.argsFromString(""); + filter.argsFromString(QString()); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn); QCOMPARE(context.needsPayloadStore(), false); QCOMPARE(context.deleteItem(), true); diff --git a/src/filter/autotests/filteractionpipethroughtest.cpp b/src/filter/autotests/filteractionpipethroughtest.cpp index 9033673..844c822 100644 --- a/src/filter/autotests/filteractionpipethroughtest.cpp +++ b/src/filter/autotests/filteractionpipethroughtest.cpp @@ -30,7 +30,7 @@ FilterActionPipeThroughTest::FilterActionPipeThroughTest() void FilterActionPipeThroughTest::setOutput(FilterAction *filter, const QByteArray &output) { QByteArray sendData = output; - filter->argsFromString(QLatin1String("echo \"") + sendData.replace('"', "\\\"") + "\""); + filter->argsFromString(QLatin1String("echo \"") + QString::fromUtf8(sendData.replace('"', "\\\"")) + QStringLiteral("\"")); } void FilterActionPipeThroughTest::testWithNoCommand() diff --git a/src/filter/autotests/filteractionremoveheadertest.cpp b/src/filter/autotests/filteractionremoveheadertest.cpp index 4fcb03c..bb1d84a 100644 --- a/src/filter/autotests/filteractionremoveheadertest.cpp +++ b/src/filter/autotests/filteractionremoveheadertest.cpp @@ -61,7 +61,7 @@ void FilterActionRemoveHeaderTest::shouldNotExecuteActionWhenParameterIsEmpty() item.setPayload(msgPtr); MailCommon::ItemContext context(item, true); - filter.argsFromString(""); + filter.argsFromString(QString()); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn); QCOMPARE(context.needsPayloadStore(), false); } @@ -92,7 +92,7 @@ void FilterActionRemoveHeaderTest::shouldRemoveHeader() item.setPayload(msgPtr); MailCommon::ItemContext context(item, true); - filter.argsFromString("testheader"); + filter.argsFromString(QStringLiteral("testheader")); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn); QCOMPARE(context.needsPayloadStore(), true); QCOMPARE(msgPtr->encodedContent(), output); @@ -117,7 +117,7 @@ void FilterActionRemoveHeaderTest::shouldNotTryToRemoveHeaderWhenItDoesntExist() item.setPayload(msgPtr); MailCommon::ItemContext context(item, true); - filter.argsFromString("testheader"); + filter.argsFromString(QStringLiteral("testheader")); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn); QCOMPARE(context.needsPayloadStore(), false); QCOMPARE(msgPtr->encodedContent(), data); diff --git a/src/filter/autotests/filteractionrewriteheadertest.cpp b/src/filter/autotests/filteractionrewriteheadertest.cpp index 38fcdd8..d7f6145 100644 --- a/src/filter/autotests/filteractionrewriteheadertest.cpp +++ b/src/filter/autotests/filteractionrewriteheadertest.cpp @@ -72,7 +72,7 @@ void FilterActionRewriteHeaderTest::shouldNotExecuteActionWhenParameterIsEmpty() item.setPayload(msgPtr); MailCommon::ItemContext context(item, true); - filter.argsFromString(QStringLiteral("")); + filter.argsFromString(QString()); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::ErrorButGoOn); QCOMPARE(context.needsPayloadStore(), false); } @@ -121,7 +121,7 @@ void FilterActionRewriteHeaderTest::shouldRewriteHeader() item.setPayload(msgPtr); MailCommon::ItemContext context(item, true); - filter.argsFromString("testheader\tfoo\tbla"); + filter.argsFromString(QStringLiteral("testheader\tfoo\tbla")); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn); QCOMPARE(context.needsPayloadStore(), true); QCOMPARE(msgPtr->encodedContent(), output); @@ -145,7 +145,7 @@ void FilterActionRewriteHeaderTest::shouldNotRewriteHeaderWhenHeaderNotFound() item.setPayload(msgPtr); MailCommon::ItemContext context(item, true); - filter.argsFromString("testheader\tfoo\tbla"); + filter.argsFromString(QStringLiteral("testheader\tfoo\tbla")); QCOMPARE(filter.process(context, false), MailCommon::FilterAction::GoOn); QCOMPARE(context.needsPayloadStore(), false); QCOMPARE(msgPtr->encodedContent(), data); diff --git a/src/filter/autotests/gpghelper.cpp b/src/filter/autotests/gpghelper.cpp index 5e2e234..b782120 100644 --- a/src/filter/autotests/gpghelper.cpp +++ b/src/filter/autotests/gpghelper.cpp @@ -72,7 +72,7 @@ GPGHelper::~GPGHelper() // shutdown gpg-agent QProcess gpgshutdown; auto env = gpgshutdown.processEnvironment(); - env.insert("GNUPGHOME", gnupgHome()); + env.insert(QStringLiteral("GNUPGHOME"), gnupgHome()); gpgshutdown.setProcessEnvironment(env); gpgshutdown.start(QStringLiteral("gpg-connect-agent")); QVERIFY(gpgshutdown.waitForStarted()); @@ -91,7 +91,7 @@ QByteArray GPGHelper::runGpg(const QByteArray &in, GPGHelper::CryptoType crypto, QProcess gpg; gpg.setReadChannel(QProcess::StandardOutput); auto env = gpg.processEnvironment(); - env.insert("GNUPGHOME", gnupgHome()); + env.insert(QStringLiteral("GNUPGHOME"), gnupgHome()); gpg.setProcessEnvironment(env); gpg.start(gpgexe(crypto), args); if (!gpg.waitForStarted()) { diff --git a/src/filter/filteractions/filteractionsendfakedisposition.cpp b/src/filter/filteractions/filteractionsendfakedisposition.cpp index f9288a4..175263e 100644 --- a/src/filter/filteractions/filteractionsendfakedisposition.cpp +++ b/src/filter/filteractions/filteractionsendfakedisposition.cpp @@ -91,7 +91,7 @@ SearchRule::RequiredPart FilterActionSendFakeDisposition::requiredPart() const void FilterActionSendFakeDisposition::argsFromString(const QString &argsStr) { if (argsStr.length() == 1) { - if (argsStr[ 0 ] == 'I') { // ignore + if (argsStr[ 0 ] == QLatin1Char('I')) { // ignore mParameter = mParameterList.at(1); return; } diff --git a/src/filter/filterimporter/autotests/filterimportclawmailtest.cpp b/src/filter/filterimporter/autotests/filterimportclawmailtest.cpp index b77f9e0..14288d2 100644 --- a/src/filter/filterimporter/autotests/filterimportclawmailtest.cpp +++ b/src/filter/filterimporter/autotests/filterimportclawmailtest.cpp @@ -33,7 +33,7 @@ void FilterImportClawMailtest::initTestCase() void FilterImportClawMailtest::testImportFilters() { MailCommon::FilterImporterClawsMails importer; - MailCommon::MailFilter *filter = importer.parseLine("enabled rulename \"foo\" subject matchcase \"fff\" add_to_addressbook \"From\" \"addrbook-000002.xml\""); + MailCommon::MailFilter *filter = importer.parseLine(QStringLiteral("enabled rulename \"foo\" subject matchcase \"fff\" add_to_addressbook \"From\" \"addrbook-000002.xml\"")); QCOMPARE(filter->toolbarName(), QStringLiteral("foo")); QVERIFY(filter->isEnabled()); delete filter; diff --git a/src/filter/mailfilter.cpp b/src/filter/mailfilter.cpp index bc97c46..a25f184 100644 --- a/src/filter/mailfilter.cpp +++ b/src/filter/mailfilter.cpp @@ -647,8 +647,8 @@ const QString MailFilter::asString() const { QString result; - result += "Filter name: " + name() + " (" + mIdentifier + ")\n"; - result += mPattern.asString() + '\n'; + result += QStringLiteral("Filter name: ") + name() + QStringLiteral(" (") + mIdentifier + QStringLiteral(")\n"); + result += mPattern.asString() + QLatin1Char('\n'); result += QString("Filter is %1\n").arg(bEnabled ? QStringLiteral("enabled") : QStringLiteral("disabled")); diff --git a/src/search/searchrule/searchrule.cpp b/src/search/searchrule/searchrule.cpp index 9f509db..e51f648 100644 --- a/src/search/searchrule/searchrule.cpp +++ b/src/search/searchrule/searchrule.cpp @@ -519,7 +519,7 @@ QString SearchRule::contents() const const QString SearchRule::asString() const { - QString result = QLatin1String("\"") + mField + QLatin1String("\" <"); + QString result = QLatin1String("\"") + QString::fromLatin1(mField) + QLatin1String("\" <"); result += functionToString(mFunction); result += QStringLiteral("> \"") + mContents + QStringLiteral("\""); diff --git a/src/search/searchrule/searchrulestring.cpp b/src/search/searchrule/searchrulestring.cpp index c99dc09..56915ee 100644 --- a/src/search/searchrule/searchrulestring.cpp +++ b/src/search/searchrule/searchrulestring.cpp @@ -137,8 +137,8 @@ bool SearchRuleString::matches(const Akonadi::Item &item) const || matchesInternal(msg->bcc()->asUnicodeString()); } msgContents = msg->to()->asUnicodeString(); - msgContents += ", " + msg->cc()->asUnicodeString(); - msgContents += ", " + msg->bcc()->asUnicodeString(); + msgContents += QStringLiteral(", ") + msg->cc()->asUnicodeString(); + msgContents += QStringLiteral(", ") + msg->bcc()->asUnicodeString(); } else if (qstricmp(field().constData(), "") == 0) { //port? // const Nepomuk2::Resource res( item.url() ); diff --git a/src/widgets/redirectdialog.cpp b/src/widgets/redirectdialog.cpp index 1e1e704..d512698 100644 --- a/src/widgets/redirectdialog.cpp +++ b/src/widgets/redirectdialog.cpp @@ -186,8 +186,8 @@ RedirectDialog::RedirectDialog(SendMode mode, QWidget *parent) d->mTransportCombobox = new MailTransport::TransportComboBox; formLayout->addRow(i18n("Transport:"), d->mTransportCombobox); - KGuiItem::assign(d->mUser1Button, KGuiItem(i18n("&Send Now"), QIcon::fromTheme("mail-send"))); - KGuiItem::assign(d->mUser2Button, KGuiItem(i18n("Send &Later"), QIcon::fromTheme("mail-queue"))); + KGuiItem::assign(d->mUser1Button, KGuiItem(i18n("&Send Now"), QIcon::fromTheme(QStringLiteral("mail-send")))); + KGuiItem::assign(d->mUser2Button, KGuiItem(i18n("Send &Later"), QIcon::fromTheme(QStringLiteral("mail-queue")))); connect(d->mUser1Button, &QPushButton::clicked, this, [this]() { d->slotUser1(); });