Commit f6697a77 authored by Sergio Martins's avatar Sergio Martins
Browse files

Replace fromUtf8 with QStringLiteral to save allocations

Only done when argument is a literal
parent b44b3ec0
...@@ -370,7 +370,7 @@ void Toolbox::setSelectedCategories(const QStringList &list) ...@@ -370,7 +370,7 @@ void Toolbox::setSelectedCategories(const QStringList &list)
QStringList Toolbox::currentTags() QStringList Toolbox::currentTags()
{ {
QStringList t = txtCatTags->text().split(QRegExp(QString::fromUtf8(",|،")), QString::SkipEmptyParts); QStringList t = txtCatTags->text().split(QRegExp(QStringLiteral(",|،")), QString::SkipEmptyParts);
for (int i = 0; i < t.count() ; ++i) { for (int i = 0; i < t.count() ; ++i) {
t[i] = t[i].trimmed(); t[i] = t[i].trimmed();
} }
......
...@@ -248,7 +248,7 @@ QStringList KCalPrefs::fullEmails() ...@@ -248,7 +248,7 @@ QStringList KCalPrefs::fullEmails()
fullEmails.reserve(1 + mAdditionalMails.count() + lst.count()); fullEmails.reserve(1 + mAdditionalMails.count() + lst.count());
// The user name and email from the config dialog: // The user name and email from the config dialog:
fullEmails << QString::fromUtf8("%1 <%2>").arg(fullName()).arg(email()); fullEmails << QStringLiteral("%1 <%2>").arg(fullName()).arg(email());
QStringList::Iterator it; QStringList::Iterator it;
KIdentityManagement::IdentityManager::ConstIterator it1; KIdentityManagement::IdentityManager::ConstIterator it1;
...@@ -258,7 +258,7 @@ QStringList KCalPrefs::fullEmails() ...@@ -258,7 +258,7 @@ QStringList KCalPrefs::fullEmails()
// Add emails configured in korganizer // Add emails configured in korganizer
lst = mAdditionalMails; lst = mAdditionalMails;
for (it = lst.begin(); it != lst.end(); ++it) { for (it = lst.begin(); it != lst.end(); ++it) {
fullEmails << QString::fromUtf8("%1 <%2>").arg(fullName()).arg(*it); fullEmails << QStringLiteral("%1 <%2>").arg(fullName()).arg(*it);
} }
// Warning, this list could contain duplicates. // Warning, this list could contain duplicates.
......
...@@ -848,15 +848,15 @@ QString cleanChars(const QString &text) ...@@ -848,15 +848,15 @@ QString cleanChars(const QString &text)
txt = txt.replace(QLatin1Char('<'), QStringLiteral("&lt;")); txt = txt.replace(QLatin1Char('<'), QStringLiteral("&lt;"));
txt = txt.replace(QLatin1Char('>'), QStringLiteral("&gt;")); txt = txt.replace(QLatin1Char('>'), QStringLiteral("&gt;"));
txt = txt.replace(QLatin1Char('\"'), QStringLiteral("&quot;")); txt = txt.replace(QLatin1Char('\"'), QStringLiteral("&quot;"));
txt = txt.replace(QString::fromUtf8("ä"), QStringLiteral("&auml;")); txt = txt.replace(QStringLiteral("ä"), QStringLiteral("&auml;"));
txt = txt.replace(QString::fromUtf8("Ä"), QStringLiteral("&Auml;")); txt = txt.replace(QStringLiteral("Ä"), QStringLiteral("&Auml;"));
txt = txt.replace(QString::fromUtf8("ö"), QStringLiteral("&ouml;")); txt = txt.replace(QStringLiteral("ö"), QStringLiteral("&ouml;"));
txt = txt.replace(QString::fromUtf8("Ö"), QStringLiteral("&Ouml;")); txt = txt.replace(QStringLiteral("Ö"), QStringLiteral("&Ouml;"));
txt = txt.replace(QString::fromUtf8("ü"), QStringLiteral("&uuml;")); txt = txt.replace(QStringLiteral("ü"), QStringLiteral("&uuml;"));
txt = txt.replace(QString::fromUtf8("Ü"), QStringLiteral("&Uuml;")); txt = txt.replace(QStringLiteral("Ü"), QStringLiteral("&Uuml;"));
txt = txt.replace(QString::fromUtf8("ß"), QStringLiteral("&szlig;")); txt = txt.replace(QStringLiteral("ß"), QStringLiteral("&szlig;"));
txt = txt.replace(QString::fromUtf8("€"), QStringLiteral("&euro;")); txt = txt.replace(QStringLiteral("€"), QStringLiteral("&euro;"));
txt = txt.replace(QString::fromUtf8("é"), QStringLiteral("&eacute;")); txt = txt.replace(QStringLiteral("é"), QStringLiteral("&eacute;"));
return txt; return txt;
} }
......
...@@ -166,13 +166,13 @@ QString CustomLogWidget::toHtml() const ...@@ -166,13 +166,13 @@ QString CustomLogWidget::toHtml() const
LogType type = static_cast<LogType>(itemWidget->data(CustomLogWidget::ItemLogType).toInt()); LogType type = static_cast<LogType>(itemWidget->data(CustomLogWidget::ItemLogType).toInt());
switch (type) { switch (type) {
case Title: case Title:
logText = QString::fromUtf8("<font color=%1>%2</font>").arg(QColor(Qt::black).name()).arg(itemText); logText = QStringLiteral("<font color=%1>%2</font>").arg(QColor(Qt::black).name()).arg(itemText);
break; break;
case Error: case Error:
logText = QString::fromUtf8("<font color=%1>%2</font>").arg(QColor(Qt::red).name()).arg(itemText); logText = QStringLiteral("<font color=%1>%2</font>").arg(QColor(Qt::red).name()).arg(itemText);
break; break;
case Info: case Info:
logText = QString::fromUtf8("<font color=%1>%2</font>").arg(QColor(Qt::green).name()).arg(itemText); logText = QStringLiteral("<font color=%1>%2</font>").arg(QColor(Qt::green).name()).arg(itemText);
break; break;
case EndLine: case EndLine:
logText = QLatin1String("<br/>"); logText = QLatin1String("<br/>");
......
...@@ -287,7 +287,7 @@ int main(int argc, char **argv) ...@@ -287,7 +287,7 @@ int main(int argc, char **argv)
cout << "Log-file initially: " << val.toLocal8Bit().constData() << endl; cout << "Log-file initially: " << val.toLocal8Bit().constData() << endl;
// Test setting the option, sync'ing, then querying again // Test setting the option, sync'ing, then querying again
entry->setStringValue(QString::fromUtf8("/tmp/test:%e5ä")); entry->setStringValue(QStringLiteral("/tmp/test:%e5ä"));
assert(entry->isDirty()); assert(entry->isDirty());
config->sync(true); config->sync(true);
...@@ -302,7 +302,7 @@ int main(int argc, char **argv) ...@@ -302,7 +302,7 @@ int main(int argc, char **argv)
assert(entry); assert(entry);
assert(entry->argType() == Kleo::CryptoConfigEntry::ArgType_Path); assert(entry->argType() == Kleo::CryptoConfigEntry::ArgType_Path);
cout << "Log-file now: " << entry->stringValue().toLocal8Bit().constData() << endl; cout << "Log-file now: " << entry->stringValue().toLocal8Bit().constData() << endl;
assert(entry->stringValue() == QString::fromUtf8("/tmp/test:%e5ä")); // (or even with %e5 decoded) assert(entry->stringValue() == QStringLiteral("/tmp/test:%e5ä")); // (or even with %e5 decoded)
// Reset old value // Reset old value
#if 0 #if 0
......
...@@ -101,11 +101,11 @@ void ComposerTest::testNonAsciiHeaders() ...@@ -101,11 +101,11 @@ void ComposerTest::testNonAsciiHeaders()
fillComposerData(composer); fillComposerData(composer);
const QString mailbox = QLatin1String(" <bla@example.com>"); const QString mailbox = QLatin1String(" <bla@example.com>");
const QString fromDisplayName = QString::fromUtf8("Hellö"); const QString fromDisplayName = QStringLiteral("Hellö");
const QString toDisplayName = QString::fromUtf8("æſłĸð"); const QString toDisplayName = QStringLiteral("æſłĸð");
const QString ccDisplayName = QString::fromUtf8("Вася"); const QString ccDisplayName = QStringLiteral("Вася");
const QString bccDisplayName = QString::fromUtf8("ĸłſðđøþĸµ»«„¢þµ¢”«ł„·ĸ”"); const QString bccDisplayName = QStringLiteral("ĸłſðđøþĸµ»«„¢þµ¢”«ł„·ĸ”");
const QString replyToDisplayName = QString::fromUtf8("æĸſłð˝đВасяðæĸđ"); const QString replyToDisplayName = QStringLiteral("æĸſłð˝đВасяðæĸđ");
const QString from = fromDisplayName + mailbox; const QString from = fromDisplayName + mailbox;
const QString to = toDisplayName + mailbox; const QString to = toDisplayName + mailbox;
const QString cc = ccDisplayName + mailbox; const QString cc = ccDisplayName + mailbox;
...@@ -140,7 +140,7 @@ void ComposerTest::testNonAsciiHeaders() ...@@ -140,7 +140,7 @@ void ComposerTest::testNonAsciiHeaders()
void ComposerTest::testBug271192() void ComposerTest::testBug271192()
{ {
const QString displayName = QString::fromUtf8("Интернет-компания example"); const QString displayName = QStringLiteral("Интернет-компания example");
const QString mailbox = QLatin1String("example@example.com"); const QString mailbox = QLatin1String("example@example.com");
Composer *composer = new Composer; Composer *composer = new Composer;
fillComposerData(composer); fillComposerData(composer);
......
...@@ -513,7 +513,7 @@ void CryptoComposerTest::testCTEquPr_data() ...@@ -513,7 +513,7 @@ void CryptoComposerTest::testCTEquPr_data()
QTest::newRow("CTEquPr:Encrypt") << data << false << true << Headers::CE7Bit; QTest::newRow("CTEquPr:Encrypt") << data << false << true << Headers::CE7Bit;
QTest::newRow("CTEquPr:SignEncrypt") << data << true << true << Headers::CE7Bit; QTest::newRow("CTEquPr:SignEncrypt") << data << true << true << Headers::CE7Bit;
data = QString::fromUtf8("All happy families are alike;\n\n\n\neach unhappy family is unhappy in its own way.\n--\n hallloasdfasdfsadfsdf asdf sadfasdf sdf sdf sdf sadfasdf sdaf daf sdf asdf sadf asdf asdf [ä]"); data = QStringLiteral("All happy families are alike;\n\n\n\neach unhappy family is unhappy in its own way.\n--\n hallloasdfasdfsadfsdf asdf sadfasdf sdf sdf sdf sadfasdf sdaf daf sdf asdf sadf asdf asdf [ä]");
QTest::newRow("CTEquPr:Sign:Newline") << data << true << false << Headers::CEquPr; QTest::newRow("CTEquPr:Sign:Newline") << data << true << false << Headers::CEquPr;
QTest::newRow("CTEquPr:Encrypt:Newline") << data << false << true << Headers::CE7Bit; QTest::newRow("CTEquPr:Encrypt:Newline") << data << false << true << Headers::CE7Bit;
QTest::newRow("CTEquPr:SignEncrypt:Newline") << data << true << true << Headers::CE7Bit; QTest::newRow("CTEquPr:SignEncrypt:Newline") << data << true << true << Headers::CE7Bit;
...@@ -534,7 +534,7 @@ void CryptoComposerTest::testCTEbase64_data() ...@@ -534,7 +534,7 @@ void CryptoComposerTest::testCTEbase64_data()
QTest::addColumn<bool>("encrypt"); QTest::addColumn<bool>("encrypt");
QTest::addColumn<Headers::contentEncoding>("cte"); QTest::addColumn<Headers::contentEncoding>("cte");
QString data(QString::fromUtf8("[ääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääää]")); QString data(QStringLiteral("[ääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääää]"));
QTest::newRow("CTEbase64:Sign") << data << true << false << Headers::CEbase64; QTest::newRow("CTEbase64:Sign") << data << true << false << Headers::CEbase64;
QTest::newRow("CTEbase64:Encrypt") << data << false << true << Headers::CE7Bit; QTest::newRow("CTEbase64:Encrypt") << data << false << true << Headers::CE7Bit;
QTest::newRow("CTEbase64:SignEncrypt") << data << true << true << Headers::CE7Bit; QTest::newRow("CTEbase64:SignEncrypt") << data << true << true << Headers::CE7Bit;
......
...@@ -95,7 +95,7 @@ void MainTextJobTest::testCustomCharset() ...@@ -95,7 +95,7 @@ void MainTextJobTest::testCustomCharset()
QByteArray charset("iso-8859-2"); QByteArray charset("iso-8859-2");
composer->globalPart()->setCharsets(QList<QByteArray>() << charset); composer->globalPart()->setCharsets(QList<QByteArray>() << charset);
TextPart *textPart = new TextPart; TextPart *textPart = new TextPart;
QString data = QString::fromUtf8("şi el o să se-nchidă cu o frunză de pelin"); QString data = QStringLiteral("şi el o să se-nchidă cu o frunză de pelin");
textPart->setWrappedPlainText(data); textPart->setWrappedPlainText(data);
MainTextJob *mjob = new MainTextJob(textPart, composer); MainTextJob *mjob = new MainTextJob(textPart, composer);
QVERIFY(mjob->exec()); QVERIFY(mjob->exec());
...@@ -133,7 +133,7 @@ void MainTextJobTest::testBadCharset() ...@@ -133,7 +133,7 @@ void MainTextJobTest::testBadCharset()
QByteArray charset("us-ascii"); // Cannot handle Romanian chars. QByteArray charset("us-ascii"); // Cannot handle Romanian chars.
composer->globalPart()->setCharsets(QList<QByteArray>() << charset); composer->globalPart()->setCharsets(QList<QByteArray>() << charset);
TextPart *textPart = new TextPart; TextPart *textPart = new TextPart;
QString data = QString::fromUtf8("el a plâns peste ţară cu lacrima limbii noastre"); QString data = QStringLiteral("el a plâns peste ţară cu lacrima limbii noastre");
textPart->setWrappedPlainText(data); textPart->setWrappedPlainText(data);
MainTextJob *mjob = new MainTextJob(textPart, composer); MainTextJob *mjob = new MainTextJob(textPart, composer);
QSKIP("This tests has been failing for a long time, please someone fix it", SkipSingle); QSKIP("This tests has been failing for a long time, please someone fix it", SkipSingle);
......
...@@ -131,7 +131,7 @@ void SignJobTest::testRecommentationRFC3156() ...@@ -131,7 +131,7 @@ void SignJobTest::testRecommentationRFC3156()
{ {
std::vector< GpgME::Key > keys = MessageCore::Test::getKeys(); std::vector< GpgME::Key > keys = MessageCore::Test::getKeys();
QString data = QString::fromUtf8("=2D Magic foo\nFrom test\n\n-- quaak\nOhno"); QString data = QStringLiteral("=2D Magic foo\nFrom test\n\n-- quaak\nOhno");
KMime::Headers::contentEncoding cte = KMime::Headers::CEquPr; KMime::Headers::contentEncoding cte = KMime::Headers::CEquPr;
MessageComposer::Composer *composer = new MessageComposer::Composer; MessageComposer::Composer *composer = new MessageComposer::Composer;
...@@ -155,7 +155,7 @@ void SignJobTest::testRecommentationRFC3156() ...@@ -155,7 +155,7 @@ void SignJobTest::testRecommentationRFC3156()
QByteArray body = MessageCore::NodeHelper::firstChild(result)->body(); QByteArray body = MessageCore::NodeHelper::firstChild(result)->body();
QCOMPARE(QString::fromUtf8(body), QCOMPARE(QString::fromUtf8(body),
QString::fromUtf8("=3D2D Magic foo\nFrom=20test\n\n=2D- quaak\nOhno")); QStringLiteral("=3D2D Magic foo\nFrom=20test\n\n=2D- quaak\nOhno"));
ComposerTestUtil::verify(true, false, result, data.toUtf8(), ComposerTestUtil::verify(true, false, result, data.toUtf8(),
Kleo::OpenPGPMIMEFormat, cte); Kleo::OpenPGPMIMEFormat, cte);
......
...@@ -54,7 +54,7 @@ void SinglepartJobTest::testContentDisposition() ...@@ -54,7 +54,7 @@ void SinglepartJobTest::testContentDisposition()
SinglepartJob *cjob = new SinglepartJob(composer); SinglepartJob *cjob = new SinglepartJob(composer);
QByteArray data("birds came flying from the underground"); QByteArray data("birds came flying from the underground");
cjob->setData(data); cjob->setData(data);
QString filename = QString::fromUtf8("test_ăîşţâ.txt"); QString filename = QStringLiteral("test_ăîşţâ.txt");
cjob->contentDisposition()->setDisposition(Headers::CDattachment); cjob->contentDisposition()->setDisposition(Headers::CDattachment);
cjob->contentDisposition()->setFilename(filename); cjob->contentDisposition()->setFilename(filename);
QVERIFY(cjob->exec()); QVERIFY(cjob->exec());
......
...@@ -37,7 +37,7 @@ void SkeletonMessageJobTest::testSubject_data() ...@@ -37,7 +37,7 @@ void SkeletonMessageJobTest::testSubject_data()
QTest::addColumn<QString>("subject"); QTest::addColumn<QString>("subject");
QTest::newRow("simple subject") << QStringLiteral("Antaa virrata sateen..."); QTest::newRow("simple subject") << QStringLiteral("Antaa virrata sateen...");
QTest::newRow("non-ascii subject") << QString::fromUtf8("Muzicologă în bej, vând whisky și tequila, preț fix."); QTest::newRow("non-ascii subject") << QStringLiteral("Muzicologă în bej, vând whisky și tequila, preț fix.");
// NOTE: This works fine, but shows ??s in the debug output. Why? // NOTE: This works fine, but shows ??s in the debug output. Why?
} }
...@@ -114,15 +114,15 @@ void SkeletonMessageJobTest::testAddresses_data() ...@@ -114,15 +114,15 @@ void SkeletonMessageJobTest::testAddresses_data()
} }
{ {
QString from = QString::fromUtf8("Şîşkin <one@example.com>"); QString from = QStringLiteral("Şîşkin <one@example.com>");
QStringList to; QStringList to;
to << QString::fromUtf8("Ivan Turbincă <two@example.com>"); to << QStringLiteral("Ivan Turbincă <two@example.com>");
to << QStringLiteral("two.two@example.com"); to << QStringLiteral("two.two@example.com");
QStringList cc; QStringList cc;
cc << QString::fromUtf8("Luceafărul <three@example.com>"); cc << QStringLiteral("Luceafărul <three@example.com>");
cc << QStringLiteral("three.three@example.com"); cc << QStringLiteral("three.three@example.com");
QStringList bcc; QStringList bcc;
bcc << QString::fromUtf8("Zburătorul <four@example.com>"); bcc << QStringLiteral("Zburătorul <four@example.com>");
bcc << QStringLiteral("four.four@example.com"); bcc << QStringLiteral("four.four@example.com");
QString replyto = QStringLiteral("Şîşzbură <five@example.com>"); QString replyto = QStringLiteral("Şîşzbură <five@example.com>");
......
...@@ -30,7 +30,7 @@ void UtilTest::testSelectCharset() ...@@ -30,7 +30,7 @@ void UtilTest::testSelectCharset()
{ {
// Pick a charset that actually works. // Pick a charset that actually works.
{ {
QString text = QString::fromUtf8("text 123 ăîşţâ"); QString text = QStringLiteral("text 123 ăîşţâ");
QList<QByteArray> charsets; QList<QByteArray> charsets;
charsets << "us-ascii"; charsets << "us-ascii";
charsets << "iso-8859-1"; charsets << "iso-8859-1";
...@@ -41,7 +41,7 @@ void UtilTest::testSelectCharset() ...@@ -41,7 +41,7 @@ void UtilTest::testSelectCharset()
// Pick as simple a charset as possible. // Pick as simple a charset as possible.
{ {
QString text = QString::fromUtf8("plain English text"); QString text = QStringLiteral("plain English text");
QList<QByteArray> charsets; QList<QByteArray> charsets;
charsets << "us-ascii"; // This one works. charsets << "us-ascii"; // This one works.
charsets << "iso-8859-1"; charsets << "iso-8859-1";
...@@ -52,7 +52,7 @@ void UtilTest::testSelectCharset() ...@@ -52,7 +52,7 @@ void UtilTest::testSelectCharset()
// Return empty charset if none works. // Return empty charset if none works.
{ {
QString text = QString::fromUtf8("text 123 ăîşţâ"); QString text = QStringLiteral("text 123 ăîşţâ");
QList<QByteArray> charsets; QList<QByteArray> charsets;
QByteArray choice = Util::selectCharset(charsets, text); QByteArray choice = Util::selectCharset(charsets, text);
QVERIFY(choice.isEmpty()); QVERIFY(choice.isEmpty());
......
...@@ -22,46 +22,46 @@ ...@@ -22,46 +22,46 @@
QMap<QString, QString> MessageViewer::AdBlockUtil::listSubscriptions() QMap<QString, QString> MessageViewer::AdBlockUtil::listSubscriptions()
{ {
QMap<QString, QString> lst; QMap<QString, QString> lst;
lst.insert(QString::fromUtf8("EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylist.txt")); lst.insert(QStringLiteral("EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylist.txt"));
lst.insert(QString::fromUtf8("EasyList without element hiding"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylist_noelemhide.txt")); lst.insert(QStringLiteral("EasyList without element hiding"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylist_noelemhide.txt"));
lst.insert(QString::fromUtf8("Corset"), QStringLiteral("http://brianyi.com/corset.txt")); lst.insert(QStringLiteral("Corset"), QStringLiteral("http://brianyi.com/corset.txt"));
lst.insert(QString::fromUtf8("EasyList Germany+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/ares+easylist.txt")); lst.insert(QStringLiteral("EasyList Germany+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/ares+easylist.txt"));
lst.insert(QString::fromUtf8("EasyList Germany"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylistgermany.txt")); lst.insert(QStringLiteral("EasyList Germany"), QStringLiteral("https://easylist-downloads.adblockplus.org/easylistgermany.txt"));
lst.insert(QString::fromUtf8("Liste FR+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/liste_fr+easylist.txt")); lst.insert(QStringLiteral("Liste FR+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/liste_fr+easylist.txt"));
lst.insert(QString::fromUtf8("Liste FR"), QStringLiteral("http://lian.info.tm/liste_fr.txt")); lst.insert(QStringLiteral("Liste FR"), QStringLiteral("http://lian.info.tm/liste_fr.txt"));
lst.insert(QString::fromUtf8("ROList+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/rolist+easylist.txt")); lst.insert(QStringLiteral("ROList+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/rolist+easylist.txt"));
lst.insert(QString::fromUtf8("ROList"), QStringLiteral("http://www.picpoc.ro/menetzrolist.txt")); lst.insert(QStringLiteral("ROList"), QStringLiteral("http://www.picpoc.ro/menetzrolist.txt"));
lst.insert(QString::fromUtf8("Việt Nam List"), QStringLiteral("http://adblockplus-vietnam.googlecode.com/svn/trunk/abpvn.txt")); lst.insert(QStringLiteral("Việt Nam List"), QStringLiteral("http://adblockplus-vietnam.googlecode.com/svn/trunk/abpvn.txt"));
lst.insert(QString::fromUtf8("AdblockList.org"), QStringLiteral("http://adblocklist.org/adblock-pxf-polish.txt")); lst.insert(QStringLiteral("AdblockList.org"), QStringLiteral("http://adblocklist.org/adblock-pxf-polish.txt"));
lst.insert(QString::fromUtf8("Bulgarian list"), QStringLiteral("http://stanev.org/abp/adblock_bg.txt")); lst.insert(QStringLiteral("Bulgarian list"), QStringLiteral("http://stanev.org/abp/adblock_bg.txt"));
lst.insert(QString::fromUtf8("EasyPrivacy+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy+easylist.txt")); lst.insert(QStringLiteral("EasyPrivacy+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy+easylist.txt"));
lst.insert(QString::fromUtf8("EasyPrivacy+Cédrics Liste"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy+cedrics.txt")); lst.insert(QStringLiteral("EasyPrivacy+Cédrics Liste"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy+cedrics.txt"));
lst.insert(QString::fromUtf8("EasyPrivacy"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy.txt")); lst.insert(QStringLiteral("EasyPrivacy"), QStringLiteral("https://easylist-downloads.adblockplus.org/easyprivacy.txt"));
lst.insert(QString::fromUtf8("void.gr"), QStringLiteral("http://www.void.gr/kargig/void-gr-filters.txt")); lst.insert(QStringLiteral("void.gr"), QStringLiteral("http://www.void.gr/kargig/void-gr-filters.txt"));
//lst.insert(QString::fromUtf8("Wiltteri"), QStringLiteral("http://www.wiltteri.net/wiltteri.txt")); //lst.insert(QStringLiteral("Wiltteri"), QStringLiteral("http://www.wiltteri.net/wiltteri.txt"));
lst.insert(QString::fromUtf8("ChinaList"), QStringLiteral("http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt")); lst.insert(QStringLiteral("ChinaList"), QStringLiteral("http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt"));
lst.insert(QString::fromUtf8("Filter von Dr.Evil"), QStringLiteral("http://adblock.maltekraus.de/adblock.txt")); lst.insert(QStringLiteral("Filter von Dr.Evil"), QStringLiteral("http://adblock.maltekraus.de/adblock.txt"));
lst.insert(QString::fromUtf8("RuAdList"), QStringLiteral("http://ruadlist.googlecode.com/svn/trunk/adblock.txt")); lst.insert(QStringLiteral("RuAdList"), QStringLiteral("http://ruadlist.googlecode.com/svn/trunk/adblock.txt"));
//lst.insert(QString::fromUtf8("AdblockRules.org"), QStringLiteral("http://adblockrules.org/download.php?typeall")); //lst.insert(QStringLiteral("AdblockRules.org"), QStringLiteral("http://adblockrules.org/download.php?typeall"));
lst.insert(QString::fromUtf8("BSI Lista Polska"), QStringLiteral("http://www.bsi.info.pl/filtrABP.txt")); lst.insert(QStringLiteral("BSI Lista Polska"), QStringLiteral("http://www.bsi.info.pl/filtrABP.txt"));
lst.insert(QString::fromUtf8("Czech List"), QStringLiteral("http://dajbych.net/adblock.txt")); lst.insert(QStringLiteral("Czech List"), QStringLiteral("http://dajbych.net/adblock.txt"));
lst.insert(QString::fromUtf8("Cédrics Liste"), QStringLiteral("http://chewey.de/mozilla/data/adblock.txt")); lst.insert(QStringLiteral("Cédrics Liste"), QStringLiteral("http://chewey.de/mozilla/data/adblock.txt"));
lst.insert(QString::fromUtf8("Fanboy's List"), QStringLiteral("http://www.fanboy.co.nz/adblock/fanboy-adblocklist-current-expanded.txt")); lst.insert(QStringLiteral("Fanboy's List"), QStringLiteral("http://www.fanboy.co.nz/adblock/fanboy-adblocklist-current-expanded.txt"));
lst.insert(QString::fromUtf8("Filter von MonztA"), QStringLiteral("http://monzta.maltekraus.de/adblock.txt")); lst.insert(QStringLiteral("Filter von MonztA"), QStringLiteral("http://monzta.maltekraus.de/adblock.txt"));
lst.insert(QString::fromUtf8("hufilter"), QStringLiteral("http://pete.teamlupus.hu/hufilter.txt")); lst.insert(QStringLiteral("hufilter"), QStringLiteral("http://pete.teamlupus.hu/hufilter.txt"));
lst.insert(QString::fromUtf8("Iceland List"), QStringLiteral("http://adblock-iceland.googlecode.com/files/icelandic%20filter.txt")); lst.insert(QStringLiteral("Iceland List"), QStringLiteral("http://adblock-iceland.googlecode.com/files/icelandic%20filter.txt"));
lst.insert(QString::fromUtf8("Japanese General Filter"), QStringLiteral("http://adblock-plus-japanese-filter.googlecode.com/svn/trunk/abp_jp_general.txt")); lst.insert(QStringLiteral("Japanese General Filter"), QStringLiteral("http://adblock-plus-japanese-filter.googlecode.com/svn/trunk/abp_jp_general.txt"));
lst.insert(QString::fromUtf8("Japanese Site-Specific Filter"), QStringLiteral("http://adblock-plus-japanese-filter.googlecode.com/svn/trunk/abp_jp_site_specific.txt")); lst.insert(QStringLiteral("Japanese Site-Specific Filter"), QStringLiteral("http://adblock-plus-japanese-filter.googlecode.com/svn/trunk/abp_jp_site_specific.txt"));
lst.insert(QString::fromUtf8("NLBlock"), QStringLiteral("http://www.verzijlbergh.com/adblock/nlblock.txt")); lst.insert(QStringLiteral("NLBlock"), QStringLiteral("http://www.verzijlbergh.com/adblock/nlblock.txt"));
lst.insert(QString::fromUtf8("PLgeneral"), QStringLiteral("http://www.niecko.pl/adblock/adblock.txt")); lst.insert(QStringLiteral("PLgeneral"), QStringLiteral("http://www.niecko.pl/adblock/adblock.txt"));
lst.insert(QString::fromUtf8("Schacks Adblock Plus liste"), QStringLiteral("http://adblock.schack.dk/block.txt")); lst.insert(QStringLiteral("Schacks Adblock Plus liste"), QStringLiteral("http://adblock.schack.dk/block.txt"));
lst.insert(QString::fromUtf8("Xfiles"), QStringLiteral("http://mozilla.gfsolone.com/filtri.txt")); lst.insert(QStringLiteral("Xfiles"), QStringLiteral("http://mozilla.gfsolone.com/filtri.txt"));
lst.insert(QString::fromUtf8("adblock.free.fr"), QStringLiteral("http://adblock.free.fr/adblock.txt")); lst.insert(QStringLiteral("adblock.free.fr"), QStringLiteral("http://adblock.free.fr/adblock.txt"));
lst.insert(QString::fromUtf8("adblock.free.fr basic (bloque les pubs uniquement)"), QStringLiteral("http://adblock.free.fr/adblock_basic.txt")); lst.insert(QStringLiteral("adblock.free.fr basic (bloque les pubs uniquement)"), QStringLiteral("http://adblock.free.fr/adblock_basic.txt"));
lst.insert(QString::fromUtf8("Ajnasz's list"), QStringLiteral("http://ajnasz.hu/adblock/recent")); lst.insert(QStringLiteral("Ajnasz's list"), QStringLiteral("http://ajnasz.hu/adblock/recent"));
lst.insert(QString::fromUtf8("Schuzak's Universal Filter"), QStringLiteral("http://www.schuzak.jp/other/abp.txt")); lst.insert(QStringLiteral("Schuzak's Universal Filter"), QStringLiteral("http://www.schuzak.jp/other/abp.txt"));
lst.insert(QString::fromUtf8("Rickroll Blacklist"), QStringLiteral("http://rickrolldb.com/ricklist.txt")); lst.insert(QStringLiteral("Rickroll Blacklist"), QStringLiteral("http://rickrolldb.com/ricklist.txt"));
lst.insert(QString::fromUtf8("Corset+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/corset+easylist.txt")); lst.insert(QStringLiteral("Corset+EasyList"), QStringLiteral("https://easylist-downloads.adblockplus.org/corset+easylist.txt"));
return lst; return lst;
} }
......
...@@ -732,11 +732,11 @@ bool AutoCorrection::autoFractions() ...@@ -732,11 +732,11 @@ bool AutoCorrection::autoFractions()
} }
if (trimmed.startsWith(QStringLiteral("1/2"))) { if (trimmed.startsWith(QStringLiteral("1/2"))) {
mWord.replace(0, 3, QString::fromUtf8("½")); mWord.replace(0, 3, QStringLiteral("½"));
} else if (trimmed.startsWith(QStringLiteral("1/4"))) { } else if (trimmed.startsWith(QStringLiteral("1/4"))) {
mWord.replace(0, 3, QString::fromUtf8("¼")); mWord.replace(0, 3, QStringLiteral("¼"));
} else if (trimmed.startsWith(QStringLiteral("3/4"))) { } else if (trimmed.startsWith(QStringLiteral("3/4"))) {
mWord.replace(0, 3, QString::fromUtf8("¾")); mWord.replace(0, 3, QStringLiteral("¾"));
} else { } else {
return false; return false;
} }
......
...@@ -314,7 +314,7 @@ void AutoCorrectionTest::shouldReplaceAutoFraction() ...@@ -314,7 +314,7 @@ void AutoCorrectionTest::shouldReplaceAutoFraction()
int position = text.length(); int position = text.length();
autocorrection.autocorrect(false, doc, position); autocorrection.autocorrect(false, doc, position);
QCOMPARE(doc.toPlainText(), QString::fromUtf8("½")); QCOMPARE(doc.toPlainText(), QStringLiteral("½"));
QString suffix = QStringLiteral(" after"); QString suffix = QStringLiteral(" after");
text = QStringLiteral("1/2"); text = QStringLiteral("1/2");
...@@ -322,7 +322,7 @@ void AutoCorrectionTest::shouldReplaceAutoFraction() ...@@ -322,7 +322,7 @@ void AutoCorrectionTest::shouldReplaceAutoFraction()
text += suffix; text += suffix;
doc.setPlainText(text); doc.setPlainText(text);
autocorrection.autocorrect(false, doc, position); autocorrection.autocorrect(false, doc, position);
QCOMPARE(doc.toPlainText(), QString(QString::fromUtf8("½") + suffix)); QCOMPARE(doc.toPlainText(), QString(QStringLiteral("½") + suffix));
QCOMPARE(position, 1); QCOMPARE(position, 1);
} }
......
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