D9420: Compile commenting remove_defintion(QT_NO_CAST_FROM_ASCII )

Laurent Montel noreply at phabricator.kde.org
Wed Dec 20 17:55:24 UTC 2017


mlaurent requested changes to this revision.
mlaurent added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kaboutdatatest.cpp:48
>  
> -static const char AppName[] =            "app";
> -static const char ProgramName[] =        "ProgramName";
> -static const char ProgramIconName[] =    "program-icon";
> -static const char Version[] =            "Version";
> -static const char ShortDescription[] =   "ShortDescription";
> -static const char CopyrightStatement[] = "CopyrightStatement";
> -static const char Text[] =               "Text";
> -static const char HomePageAddress[] =    "http://test.no.where/";
> -static const char HomePageSecure[] =     "https://test.no.where/";
> -static const char OrganizationDomain[] = "no.where";
> -static const char BugsEmailAddress[] =   "bugs at no.else";
> -static const char LicenseText[] =        "free to write, reading forbidden";
> -static const char LicenseFileName[] =    "testlicensefile";
> -static const char LicenseFileText[] =    "free to write, reading forbidden, in the file";
> +static const QString AppName =            QString::fromLatin1("app");
> +static const QString ProgramName =        QString::fromLatin1("ProgramName");

no we need to keep const char ...[] and use QString::fromLatin1(...) in method as it's already done previously

> kautosavefiletest.cpp:83
>  {
> -    QUrl normalFile = QUrl::fromLocalFile(QDir::temp().absoluteFilePath("test directory/tîst me.txt"));
> +    QUrl normalFile = QUrl::fromLocalFile(QDir::temp().absoluteFilePath(QLatin1String("test directory/tîst me.txt")));
>  

QStringLiteral(...)

> kformattest.cpp:36
>  
> -    QCOMPARE(format.formatByteSize(0), QString("0 B"));
> -    QCOMPARE(format.formatByteSize(50), QString("50 B"));
> -    QCOMPARE(format.formatByteSize(500), QString("500 B"));
> -    QCOMPARE(format.formatByteSize(5000), QString("4.9 KiB"));
> -    QCOMPARE(format.formatByteSize(50000), QString("48.8 KiB"));
> -    QCOMPARE(format.formatByteSize(500000), QString("488.3 KiB"));
> -    QCOMPARE(format.formatByteSize(5000000), QString("4.8 MiB"));
> -    QCOMPARE(format.formatByteSize(50000000), QString("47.7 MiB"));
> -    QCOMPARE(format.formatByteSize(500000000), QString("476.8 MiB"));
> +    QCOMPARE(format.formatByteSize(0), QLatin1String("0 B"));
> +    QCOMPARE(format.formatByteSize(50), QLatin1String("50 B"));

QStringLiteral here and others.

> kformattest.cpp:308
>      testDate = QDate::currentDate().addDays(-7);
>      QCOMPARE(format.formatRelativeDate(testDate, QLocale::LongFormat),
> +             QString::fromLatin1("Last %1").arg(QLocale::c().dayName(testDate.dayOfWeek(), QLocale::LongFormat)));

QStringLiteral here too

> kpluginfactorytest.cpp:34
>      {
> -        KPluginLoader multiplugin("multiplugin");
> +        KPluginLoader multiplugin(QLatin1String("multiplugin"));
>          KPluginFactory *factory = multiplugin.factory();

QStringLiteral(...)

> kpluginmetadatatest.cpp:49
>      {
> -        QString location = KPluginLoader::findPlugin("jsonplugin");
> +        QString location = KPluginLoader::findPlugin(QLatin1String("jsonplugin"));
>          QVERIFY2(!location.isEmpty(),"Could not find jsonplugin");

Same

> kpluginmetadatatest.cpp:207
>          QTest::ignoreMessage(QtWarningMsg, "Expected JSON property \"String\" to be a string list. Treating it as a list with a single entry: \"foo\" ");
> -        QCOMPARE(KPluginMetaData::readStringList(jo, "String"), QStringList("foo"));
> -        QCOMPARE(KPluginMetaData::readStringList(jo, "OneArrayEntry"), QStringList("foo"));
> +        QCOMPARE(KPluginMetaData::readStringList(jo, QLatin1String("String")), QStringList(QLatin1String("foo")));
> +        QCOMPARE(KPluginMetaData::readStringList(jo, QLatin1String("OneArrayEntry")), QStringList(QLatin1String("foo")));

Same

> kshelltest.cpp:58
>      QString me(KUser().loginName());
> -    QCOMPARE(KShell::tildeExpand("~"), QDir::homePath());
> -    QCOMPARE(KShell::tildeExpand("~/dir"), QString(QDir::homePath() + "/dir"));
> -    QCOMPARE(KShell::tildeExpand('~' + me), myHomePath());
> -    QCOMPARE(KShell::tildeExpand('~' + me + "/dir"), QString(myHomePath() + "/dir"));
> +    QCOMPARE(KShell::tildeExpand(QString::fromLatin1("~")), QDir::homePath());
> +    QCOMPARE(KShell::tildeExpand(QString::fromLatin1("~/dir")), QString(QDir::homePath() + QString::fromLatin1("/dir")));

QStringLiteral...

> kshelltest.cpp:84
>  #else
> -    QCOMPARE(KShell::quoteArg("a space"), QString("'a space'"));
> +    QCOMPARE(KShell::quoteArg(QString::fromLatin1("a space")), QString::fromLatin1("'a space'"));
>  #endif

you can change QString::fromLatin1(...) by QStringLiteral in all code that you modified

REPOSITORY
  R244 KCoreAddons

REVISION DETAIL
  https://phabricator.kde.org/D9420

To: velurimithun, mlaurent
Cc: #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171220/02cff785/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list