Commit fae151b2 authored by Mikel Johnson's avatar Mikel Johnson

Use QStringLiteral and QLatin1String where it makes sense

parent ed891891
......@@ -114,7 +114,7 @@ QVariantList ContactEntry::actions() const
{
QVariantList actionList;
actionList << Kicker::createActionItem(i18n("Show Contact Information..."), QString("identity"), QStringLiteral("showContactInfo"));
actionList << Kicker::createActionItem(i18n("Show Contact Information..."), QStringLiteral("identity"), QStringLiteral("showContactInfo"));
return actionList;
}
......
......@@ -411,7 +411,7 @@ void RootModel::refresh()
int separatorPosition = 0;
if (allModel) {
m_entryList.prepend(new GroupEntry(this, i18n("All Applications"), QString("applications-all"), allModel));
m_entryList.prepend(new GroupEntry(this, i18n("All Applications"), QStringLiteral("applications-all"), allModel));
++separatorPosition;
}
......@@ -432,7 +432,7 @@ void RootModel::refresh()
if (m_showRecentContacts) {
m_recentContactsModel = new RecentContactsModel(this);
m_entryList.prepend(new GroupEntry(this, i18n("Recent Contacts"), QString("view-history"), m_recentContactsModel));
m_entryList.prepend(new GroupEntry(this, i18n("Recent Contacts"), QStringLiteral("view-history"), m_recentContactsModel));
++separatorPosition;
}
......@@ -443,8 +443,8 @@ void RootModel::refresh()
? i18n("Recent Files")
: i18n("Often Used Files"),
m_recentOrdering == RecentUsageModel::Recent
? QString("view-history")
: QString("office-chart-pie"),
? QStringLiteral("view-history")
: QStringLiteral("office-chart-pie"),
m_recentDocsModel));
++separatorPosition;
}
......@@ -456,8 +456,8 @@ void RootModel::refresh()
? i18n("Recent Applications")
: i18n("Often Used Applications"),
m_recentOrdering == RecentUsageModel::Recent
? QString("view-history")
: QString("office-chart-pie"),
? QStringLiteral("view-history")
: QStringLiteral("office-chart-pie"),
m_recentAppsModel));
++separatorPosition;
}
......@@ -470,7 +470,7 @@ void RootModel::refresh()
m_systemModel = new SystemModel(this);
if (m_showPowerSession) {
m_entryList << new GroupEntry(this, i18n("Power / Session"), QString("system-log-out"), m_systemModel);
m_entryList << new GroupEntry(this, i18n("Power / Session"), QStringLiteral("system-log-out"), m_systemModel);
}
endResetModel();
......
......@@ -964,10 +964,10 @@ void CKCmFontInst::setStatusBar()
if(disabled||partial)
{
text+=QString(" (<img src=\"%1\" />%2").arg(KIconLoader::global()->iconPath("dialog-ok", -KIconLoader::SizeSmall)).arg(enabled)
+QString(" <img src=\"%1\" />%2").arg(KIconLoader::global()->iconPath("dialog-cancel", -KIconLoader::SizeSmall)).arg(disabled);
text+=QLatin1String(" (<img src=\"%1\" />%2").arg(KIconLoader::global()->iconPath("dialog-ok", -KIconLoader::SizeSmall)).arg(enabled)
+QLatin1String(" <img src=\"%1\" />%2").arg(KIconLoader::global()->iconPath("dialog-cancel", -KIconLoader::SizeSmall)).arg(disabled);
if(partial)
text+=QString(" <img src=\"%1\" />%2").arg(partialIcon()).arg(partial);
text+=QLatin1String(" <img src=\"%1\" />%2").arg(partialIcon()).arg(partial);
text+=QLatin1Char(')');
itsStatusLabel->setToolTip(partial
? i18n("<table>"
......
......@@ -416,8 +416,8 @@ void runRdb( uint flags )
// Export the Xcursor theme & size settings
KConfigGroup mousecfg(KSharedConfig::openConfig( QStringLiteral("kcminputrc") ), "Mouse" );
QString theme = mousecfg.readEntry("cursorTheme", QString("breeze_cursors"));
QString size = mousecfg.readEntry("cursorSize", QString("24"));
QString theme = mousecfg.readEntry("cursorTheme", QStringLiteral("breeze_cursors"));
QString size = mousecfg.readEntry("cursorSize", QStringLiteral("24"));
QString contents;
if (!theme.isNull())
......
......@@ -100,7 +100,7 @@ void KcmTest::testWidgetStyle()
KConfigGroup cg(&config, "KDE");
// We have to use an actual theme name here because setWidgetStyle checks
// if the theme can actually be used before it changes the config
QCOMPARE(cg.readEntry("widgetStyle", QString()), QString("Fusion"));
QCOMPARE(cg.readEntry("widgetStyle", QString()), QStringLiteral("Fusion"));
}
void KcmTest::testColors()
......@@ -110,7 +110,7 @@ void KcmTest::testColors()
KConfig config(QStringLiteral("kdeglobals"));
KConfigGroup cg(&config, "General");
QCOMPARE(cg.readEntry("ColorScheme", QString()), QString("customTestValue"));
QCOMPARE(cg.readEntry("ColorScheme", QString()), QStringLiteral("customTestValue"));
}
void KcmTest::testIcons()
......@@ -119,7 +119,7 @@ void KcmTest::testIcons()
KConfig config(QStringLiteral("kdeglobals"));
KConfigGroup cg(&config, "Icons");
QCOMPARE(cg.readEntry("Theme", QString()), QString("customTestValue"));
QCOMPARE(cg.readEntry("Theme", QString()), QStringLiteral("customTestValue"));
}
void KcmTest::testPlasmaTheme()
......@@ -128,7 +128,7 @@ void KcmTest::testPlasmaTheme()
KConfig config(QStringLiteral("plasmarc"));
KConfigGroup cg(&config, "Theme");
QCOMPARE(cg.readEntry("name", QString()), QString("customTestValue"));
QCOMPARE(cg.readEntry("name", QString()), QStringLiteral("customTestValue"));
}
void KcmTest::testCursorTheme()
......@@ -137,7 +137,7 @@ void KcmTest::testCursorTheme()
KConfig config(QStringLiteral("kcminputrc"));
KConfigGroup cg(&config, "Mouse");
QCOMPARE(cg.readEntry("cursorTheme", QString()), QString("customTestValue"));
QCOMPARE(cg.readEntry("cursorTheme", QString()), QStringLiteral("customTestValue"));
}
void KcmTest::testSplashScreen()
......@@ -146,8 +146,8 @@ void KcmTest::testSplashScreen()
KConfig config(QStringLiteral("ksplashrc"));
KConfigGroup cg(&config, "KSplash");
QCOMPARE(cg.readEntry("Theme", QString()), QString("customTestValue"));
QCOMPARE(cg.readEntry("Engine", QString()), QString("KSplashQML"));
QCOMPARE(cg.readEntry("Theme", QString()), QStringLiteral("customTestValue"));
QCOMPARE(cg.readEntry("Engine", QString()), QStringLiteral("KSplashQML"));
}
void KcmTest::testLockScreen()
......@@ -156,7 +156,7 @@ void KcmTest::testLockScreen()
KConfig config(QStringLiteral("kscreenlockerrc"));
KConfigGroup cg(&config, "Greeter");
QCOMPARE(cg.readEntry("Theme", QString()), QString("customTestValue"));
QCOMPARE(cg.readEntry("Theme", QString()), QStringLiteral("customTestValue"));
}
void KcmTest::testWindowSwitcher()
......@@ -185,31 +185,31 @@ void KcmTest::testKCMSave()
KConfig config(QStringLiteral("kdeglobals"));
KConfigGroup cg(&config, "KDE");
// See comment in testWidgetStyle
QCOMPARE(cg.readEntry("widgetStyle", QString()), QString("Fusion"));
QCOMPARE(cg.readEntry("widgetStyle", QString()), QStringLiteral("Fusion"));
cg = KConfigGroup(&config, "General");
//save() capitalizes the ColorScheme
QCOMPARE(cg.readEntry("ColorScheme", QString()), QString("TestValue"));
QCOMPARE(cg.readEntry("ColorScheme", QString()), QStringLiteral("TestValue"));
cg = KConfigGroup(&config, "Icons");
QCOMPARE(cg.readEntry("Theme", QString()), QString("testValue"));
QCOMPARE(cg.readEntry("Theme", QString()), QStringLiteral("testValue"));
KConfig plasmaConfig(QStringLiteral("plasmarc"));
cg = KConfigGroup(&plasmaConfig, "Theme");
QCOMPARE(cg.readEntry("name", QString()), QString("testValue"));
QCOMPARE(cg.readEntry("name", QString()), QStringLiteral("testValue"));
KConfig inputConfig(QStringLiteral("kcminputrc"));
cg = KConfigGroup(&inputConfig, "Mouse");
QCOMPARE(cg.readEntry("cursorTheme", QString()), QString("testValue"));
QCOMPARE(cg.readEntry("cursorTheme", QString()), QStringLiteral("testValue"));
KConfig splashConfig(QStringLiteral("ksplashrc"));
cg = KConfigGroup(&splashConfig, "KSplash");
QCOMPARE(cg.readEntry("Theme", QString()), QString("customTestValue"));
QCOMPARE(cg.readEntry("Engine", QString()), QString("KSplashQML"));
QCOMPARE(cg.readEntry("Theme", QString()), QStringLiteral("customTestValue"));
QCOMPARE(cg.readEntry("Engine", QString()), QStringLiteral("KSplashQML"));
KConfig lockerConfig(QStringLiteral("kscreenlockerrc"));
cg = KConfigGroup(&lockerConfig, "Greeter");
QCOMPARE(cg.readEntry("Theme", QString()), QString("org.kde.test"));
QCOMPARE(cg.readEntry("Theme", QString()), QStringLiteral("org.kde.test"));
KConfig kwinConfig(QStringLiteral("kwinrc"));
cg = KConfigGroup(&kwinConfig, "TabBox");
......
......@@ -159,11 +159,11 @@ void TaskToolsTest::createAppLink()
{
KDesktopFile file(appLinkPath());
KConfigGroup group = file.desktopGroup();
group.writeEntry(QLatin1String("Type"), QString("Application"));
group.writeEntry(QLatin1String("Type"), QStringLiteral("Application"));
group.writeEntry(QLatin1String("Name"), m_referenceAppData.name);
group.writeEntry(QLatin1String("GenericName"), m_referenceAppData.genericName);
group.writeEntry(QLatin1String("Icon"), QString("konversation"));
group.writeEntry(QLatin1String("Exec"), QString("konversation"));
group.writeEntry(QLatin1String("Icon"), QStringLiteral("konversation"));
group.writeEntry(QLatin1String("Exec"), QStringLiteral("konversation"));
file.sync();
QVERIFY(file.hasApplicationType());
......@@ -192,7 +192,7 @@ void TaskToolsTest::createIcon()
KConfig config(themeFile);
KConfigGroup group(config.group(QLatin1String("Icon Theme")));
group.writeEntry(QLatin1String("Name"), KIconTheme::defaultThemeName());
group.writeEntry(QLatin1String("Inherits"), QString("hicolor"));
group.writeEntry(QLatin1String("Inherits"), QStringLiteral("hicolor"));
config.sync();
QVERIFY(QFile::exists(themeFile));
......
......@@ -700,7 +700,7 @@ QString defaultApplication(const QUrl &url)
}
}
return QString("");
return QLatin1String("");
}
bool launcherUrlsMatch(const QUrl &a, const QUrl &b, UrlComparisonMode mode)
......
......@@ -35,7 +35,7 @@ void TestChromeBookmarks::initTestCase()
void TestChromeBookmarks::bookmarkFinderShouldFindEachProfileDirectory()
{
FindChromeProfile findChrome("chromium", "./chrome-config-home");
QString profileTemplate = QString("./chrome-config-home/.config/%1/%2/Bookmarks");
QString profileTemplate = QStringLiteral("./chrome-config-home/.config/%1/%2/Bookmarks");
QList<Profile> profiles = findChrome.find();
QCOMPARE(profiles.size(), 2);
......
......@@ -97,7 +97,7 @@ int ScriptEngine::defaultPanelScreen() const
QJSValue ScriptEngine::newError(const QString &message)
{
return evaluate(QString("new Error('%1');").arg(message));
return evaluate(QStringLiteral("new Error('%1');").arg(message));
}
QString ScriptEngine::onlyExec(const QString &commandLine)
......
......@@ -26,7 +26,7 @@ QString formatResolution(const QString &str)
{
QSize size = resSize(str);
float aspectRatio = (size.height() > 0 ) ? size.width() / (float)size.height() : 0;
return QString("%1 (%2)").arg(str, 9).arg(aspectRatio, 7);
return QStringLiteral("%1 (%2)").arg(str, 9).arg(aspectRatio, 7);
}
class TestResolutions: public QObject
......
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