Fix most of Clazy warnings in plasma-framework

REVIEW: 126672
This commit is contained in:
Aleix Pol 2016-02-29 00:08:05 +01:00
parent 3c8cb82d44
commit 9f62532674
65 changed files with 755 additions and 749 deletions

View File

@ -28,11 +28,11 @@ Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint apple
const QVariantList &args) const QVariantList &args)
{ {
Q_UNUSED(args) Q_UNUSED(args)
if (name == "simpleapplet") { if (name == QLatin1String("simpleapplet")) {
return new SimpleApplet(0, QString(), appletId); return new SimpleApplet(0, QString(), appletId);
} else if (name == "simplecontainment") { } else if (name == QLatin1String("simplecontainment")) {
return new SimpleContainment(0, QString(), appletId); return new SimpleContainment(0, QString(), appletId);
} else if (name == "simplenoscreencontainment") { } else if (name == QLatin1String("simplenoscreencontainment")) {
return new SimpleNoScreenContainment(0, QString(), appletId); return new SimpleNoScreenContainment(0, QString(), appletId);
} else { } else {
return 0; return 0;
@ -103,10 +103,10 @@ SimpleNoScreenContainment::SimpleNoScreenContainment(QObject *parent , const QSt
static void runKBuildSycoca() static void runKBuildSycoca()
{ {
QProcess proc; QProcess proc;
const QString kbuildsycoca = QStandardPaths::findExecutable(KBUILDSYCOCA_EXENAME); const QString kbuildsycoca = QStandardPaths::findExecutable(QStringLiteral(KBUILDSYCOCA_EXENAME));
QVERIFY(!kbuildsycoca.isEmpty()); QVERIFY(!kbuildsycoca.isEmpty());
QStringList args; QStringList args;
args << "--testmode"; args << QStringLiteral("--testmode");
proc.setProcessChannelMode(QProcess::MergedChannels); // silence kbuildsycoca output proc.setProcessChannelMode(QProcess::MergedChannels); // silence kbuildsycoca output
proc.start(kbuildsycoca, args); proc.start(kbuildsycoca, args);
@ -130,7 +130,7 @@ void CoronaTest::initTestCase()
m_configDir = QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)); m_configDir = QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
m_configDir.removeRecursively(); m_configDir.removeRecursively();
QVERIFY(m_configDir.mkpath(".")); QVERIFY(m_configDir.mkpath(QStringLiteral(".")));
QVERIFY(QFile::copy(QStringLiteral(":/plasma-test-appletsrc"), m_configDir.filePath(QStringLiteral("plasma-test-appletsrc")))); QVERIFY(QFile::copy(QStringLiteral(":/plasma-test-appletsrc"), m_configDir.filePath(QStringLiteral("plasma-test-appletsrc"))));
} }
@ -143,10 +143,10 @@ void CoronaTest::cleanupTestCase()
void CoronaTest::restore() void CoronaTest::restore()
{ {
m_corona->loadLayout("plasma-test-appletsrc"); m_corona->loadLayout(QStringLiteral("plasma-test-appletsrc"));
QCOMPARE(m_corona->containments().count(), 3); QCOMPARE(m_corona->containments().count(), 3);
for (auto cont : m_corona->containments()) { foreach (auto cont, m_corona->containments()) {
switch (cont->id()) { switch (cont->id()) {
case 1: case 1:
QCOMPARE(cont->applets().count(), 2); QCOMPARE(cont->applets().count(), 2);
@ -166,41 +166,41 @@ void CoronaTest::checkOrder()
QCOMPARE(m_corona->containments().count(), 3); QCOMPARE(m_corona->containments().count(), 3);
//check containments order //check containments order
QCOMPARE(m_corona->containments()[0]->id(), (uint)1); QCOMPARE(m_corona->containments().at(0)->id(), (uint)1);
QCOMPARE(m_corona->containments()[1]->id(), (uint)4); QCOMPARE(m_corona->containments().at(1)->id(), (uint)4);
QCOMPARE(m_corona->containments()[2]->id(), (uint)5); QCOMPARE(m_corona->containments().at(2)->id(), (uint)5);
//check applets order //check applets order
QCOMPARE(m_corona->containments()[0]->applets().count(), 2); QCOMPARE(m_corona->containments().at(0)->applets().count(), 2);
QCOMPARE(m_corona->containments()[0]->applets()[0]->id(), (uint)2); QCOMPARE(m_corona->containments().at(0)->applets().at(0)->id(), (uint)2);
QCOMPARE(m_corona->containments()[0]->applets()[1]->id(), (uint)3); QCOMPARE(m_corona->containments().at(0)->applets().at(1)->id(), (uint)3);
} }
void CoronaTest::startupCompletion() void CoronaTest::startupCompletion()
{ {
QVERIFY(!m_corona->isStartupCompleted()); QVERIFY(!m_corona->isStartupCompleted());
QVERIFY(!m_corona->containments().first()->isUiReady()); QVERIFY(!m_corona->containments().at(0)->isUiReady());
QSignalSpy spy(m_corona, SIGNAL(startupCompleted())); QSignalSpy spy(m_corona, SIGNAL(startupCompleted()));
QVERIFY(spy.wait(1000)); QVERIFY(spy.wait(1000));
QVERIFY(m_corona->isStartupCompleted()); QVERIFY(m_corona->isStartupCompleted());
QVERIFY(m_corona->containments().first()->isUiReady()); QVERIFY(m_corona->containments().at(0)->isUiReady());
} }
void CoronaTest::addRemoveApplets() void CoronaTest::addRemoveApplets()
{ {
m_corona->containments().first()->createApplet("invalid"); m_corona->containments().at(0)->createApplet(QStringLiteral("invalid"));
QCOMPARE(m_corona->containments().first()->applets().count(), 3); QCOMPARE(m_corona->containments().at(0)->applets().count(), 3);
//remove action present //remove action present
QVERIFY(m_corona->containments().first()->applets().first()->actions()->action("remove")); QVERIFY(m_corona->containments().at(0)->applets().at(0)->actions()->action(QStringLiteral("remove")));
//kill an applet //kill an applet
m_corona->containments().first()->applets().first()->destroy(); m_corona->containments().at(0)->applets().at(0)->destroy();
QSignalSpy spy(m_corona->containments().first()->applets().first(), SIGNAL(destroyed())); QSignalSpy spy(m_corona->containments().at(0)->applets().at(0), SIGNAL(destroyed()));
QVERIFY(spy.wait(1000)); QVERIFY(spy.wait(1000));
QCOMPARE(m_corona->containments().first()->applets().count(), 2); QCOMPARE(m_corona->containments().at(0)->applets().count(), 2);
} }
//this test has to be the last, since systemimmutability //this test has to be the last, since systemimmutability
@ -212,9 +212,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(Plasma::Types::UserImmutable); m_corona->setImmutability(Plasma::Types::UserImmutable);
QCOMPARE(m_corona->immutability(), Plasma::Types::UserImmutable); QCOMPARE(m_corona->immutability(), Plasma::Types::UserImmutable);
for (Plasma::Containment *cont : m_corona->containments()) { foreach (Plasma::Containment *cont, m_corona->containments()) {
QCOMPARE(cont->immutability(), Plasma::Types::UserImmutable); QCOMPARE(cont->immutability(), Plasma::Types::UserImmutable);
for (Plasma::Applet *app : cont->applets()) { foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::UserImmutable); QCOMPARE(app->immutability(), Plasma::Types::UserImmutable);
} }
} }
@ -222,9 +222,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(Plasma::Types::Mutable); m_corona->setImmutability(Plasma::Types::Mutable);
QCOMPARE(m_corona->immutability(), Plasma::Types::Mutable); QCOMPARE(m_corona->immutability(), Plasma::Types::Mutable);
for (Plasma::Containment *cont : m_corona->containments()) { foreach (Plasma::Containment *cont, m_corona->containments()) {
QCOMPARE(cont->immutability(), Plasma::Types::Mutable); QCOMPARE(cont->immutability(), Plasma::Types::Mutable);
for (Plasma::Applet *app : cont->applets()) { foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::Mutable); QCOMPARE(app->immutability(), Plasma::Types::Mutable);
} }
} }
@ -232,9 +232,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(Plasma::Types::SystemImmutable); m_corona->setImmutability(Plasma::Types::SystemImmutable);
QCOMPARE(m_corona->immutability(), Plasma::Types::SystemImmutable); QCOMPARE(m_corona->immutability(), Plasma::Types::SystemImmutable);
for (Plasma::Containment *cont : m_corona->containments()) { foreach (Plasma::Containment *cont, m_corona->containments()) {
QCOMPARE(cont->immutability(), Plasma::Types::SystemImmutable); QCOMPARE(cont->immutability(), Plasma::Types::SystemImmutable);
for (Plasma::Applet *app : cont->applets()) { foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::SystemImmutable); QCOMPARE(app->immutability(), Plasma::Types::SystemImmutable);
} }
} }
@ -243,9 +243,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(Plasma::Types::Mutable); m_corona->setImmutability(Plasma::Types::Mutable);
QCOMPARE(m_corona->immutability(), Plasma::Types::SystemImmutable); QCOMPARE(m_corona->immutability(), Plasma::Types::SystemImmutable);
for (Plasma::Containment *cont : m_corona->containments()) { foreach (Plasma::Containment *cont, m_corona->containments()) {
QCOMPARE(cont->immutability(), Plasma::Types::SystemImmutable); QCOMPARE(cont->immutability(), Plasma::Types::SystemImmutable);
for (Plasma::Applet *app : cont->applets()) { foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::SystemImmutable); QCOMPARE(app->immutability(), Plasma::Types::SystemImmutable);
} }
} }

View File

@ -60,7 +60,7 @@ void DialogQmlTest::loadAndShow()
QQmlComponent component(&engine); QQmlComponent component(&engine);
QSignalSpy spy(&component, SIGNAL(statusChanged(QQmlComponent::Status))); QSignalSpy spy(&component, SIGNAL(statusChanged(QQmlComponent::Status)));
component.setData(dialogQml, QUrl("test://dialogTest")); component.setData(dialogQml, QUrl(QStringLiteral("test://dialogTest")));
spy.wait(); spy.wait();
PlasmaQuick::Dialog *dialog = qobject_cast< PlasmaQuick::Dialog* >(component.beginCreate(engine.rootContext())); PlasmaQuick::Dialog *dialog = qobject_cast< PlasmaQuick::Dialog* >(component.beginCreate(engine.rootContext()));

View File

@ -29,11 +29,11 @@
void FallbackPackageTest::initTestCase() void FallbackPackageTest::initTestCase()
{ {
m_fallPackagePath = QFINDTESTDATA("data/testpackage"); m_fallPackagePath = QFINDTESTDATA("data/testpackage");
m_fallbackPkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); m_fallbackPkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Generic"));
m_fallbackPkg.setPath(m_fallPackagePath); m_fallbackPkg.setPath(m_fallPackagePath);
m_packagePath = QFINDTESTDATA("data/testfallbackpackage"); m_packagePath = QFINDTESTDATA("data/testfallbackpackage");
m_pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); m_pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Generic"));
m_pkg.setPath(m_packagePath); m_pkg.setPath(m_packagePath);
} }
@ -43,8 +43,8 @@ void FallbackPackageTest::beforeFallback()
QVERIFY(m_pkg.hasValidStructure()); QVERIFY(m_pkg.hasValidStructure());
//m_fallbackPkg should have otherfile.qml, m_pkg shouldn't //m_fallbackPkg should have otherfile.qml, m_pkg shouldn't
QVERIFY(!m_fallbackPkg.filePath("ui", "otherfile.qml").isEmpty()); QVERIFY(!m_fallbackPkg.filePath("ui", QStringLiteral("otherfile.qml")).isEmpty());
QVERIFY(m_pkg.filePath("ui", "otherfile.qml").isEmpty()); QVERIFY(m_pkg.filePath("ui", QStringLiteral("otherfile.qml")).isEmpty());
} }
void FallbackPackageTest::afterFallback() void FallbackPackageTest::afterFallback()
@ -53,8 +53,8 @@ void FallbackPackageTest::afterFallback()
//after setting the fallback, m_pkg should resolve the exact same file as m_fallbackPkg //after setting the fallback, m_pkg should resolve the exact same file as m_fallbackPkg
// for otherfile.qml // for otherfile.qml
QVERIFY(!m_pkg.filePath("ui", "otherfile.qml").isEmpty()); QVERIFY(!m_pkg.filePath("ui", QStringLiteral("otherfile.qml")).isEmpty());
QCOMPARE(m_fallbackPkg.filePath("ui", "otherfile.qml"), m_pkg.filePath("ui", "otherfile.qml")); QCOMPARE(m_fallbackPkg.filePath("ui", QStringLiteral("otherfile.qml")), m_pkg.filePath("ui", QStringLiteral("otherfile.qml")));
QVERIFY(m_fallbackPkg.filePath("mainscript") != m_pkg.filePath("mainscript")); QVERIFY(m_fallbackPkg.filePath("mainscript") != m_pkg.filePath("mainscript"));
} }
@ -64,7 +64,7 @@ void FallbackPackageTest::cycle()
m_pkg.setFallbackPackage(m_fallbackPkg); m_pkg.setFallbackPackage(m_fallbackPkg);
//The cycle should have been detected and filePath should take a not infinite time //The cycle should have been detected and filePath should take a not infinite time
QTRY_COMPARE_WITH_TIMEOUT(m_fallbackPkg.filePath("ui", "otherfile.qml"), m_pkg.filePath("ui", "otherfile.qml"), 1000); QTRY_COMPARE_WITH_TIMEOUT(m_fallbackPkg.filePath("ui", QStringLiteral("otherfile.qml")), m_pkg.filePath("ui", QStringLiteral("otherfile.qml")), 1000);
} }
QTEST_MAIN(FallbackPackageTest) QTEST_MAIN(FallbackPackageTest)

View File

@ -35,17 +35,17 @@ public:
: Plasma::Package(new Plasma::PackageStructure) : Plasma::Package(new Plasma::PackageStructure)
{ {
setContentsPrefixPaths(QStringList()); setContentsPrefixPaths(QStringList());
addDirectoryDefinition("bin", "bin", "bin"); addDirectoryDefinition("bin", QStringLiteral("bin"), QStringLiteral("bin"));
addFileDefinition("MultiplePaths", "first", "Description proper"); addFileDefinition("MultiplePaths", QStringLiteral("first"), QStringLiteral("Description proper"));
addFileDefinition("MultiplePaths", "second", "Description proper"); addFileDefinition("MultiplePaths", QStringLiteral("second"), QStringLiteral("Description proper"));
setPath("/"); setPath(QStringLiteral("/"));
} }
}; };
void PackageStructureTest::initTestCase() void PackageStructureTest::initTestCase()
{ {
m_packagePath = QFINDTESTDATA("data/testpackage"); m_packagePath = QFINDTESTDATA("data/testpackage");
ps = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); ps = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Generic"));
ps.setPath(m_packagePath); ps.setPath(m_packagePath);
} }
@ -53,19 +53,19 @@ void PackageStructureTest::validStructures()
{ {
QVERIFY(ps.hasValidStructure()); QVERIFY(ps.hasValidStructure());
QVERIFY(!Plasma::Package().hasValidStructure()); QVERIFY(!Plasma::Package().hasValidStructure());
QVERIFY(!Plasma::PluginLoader::self()->loadPackage("doesNotExist").hasValidStructure()); QVERIFY(!Plasma::PluginLoader::self()->loadPackage(QStringLiteral("doesNotExist")).hasValidStructure());
} }
void PackageStructureTest::validPackages() void PackageStructureTest::validPackages()
{ {
QVERIFY(ps.isValid()); QVERIFY(ps.isValid());
QVERIFY(!Plasma::Package().isValid()); QVERIFY(!Plasma::Package().isValid());
QVERIFY(!Plasma::PluginLoader::self()->loadPackage("doesNotExist").isValid()); QVERIFY(!Plasma::PluginLoader::self()->loadPackage(QStringLiteral("doesNotExist")).isValid());
QVERIFY(NoPrefixes().isValid()); QVERIFY(NoPrefixes().isValid());
Plasma::Package p = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic"); Plasma::Package p = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Generic"));
QVERIFY(!p.isValid()); QVERIFY(!p.isValid());
p.setPath("/does/not/exist"); p.setPath(QStringLiteral("/does/not/exist"));
QVERIFY(!p.isValid()); QVERIFY(!p.isValid());
p.setPath(ps.path()); p.setPath(ps.path());
QVERIFY(p.isValid()); QVERIFY(p.isValid());
@ -120,18 +120,18 @@ void PackageStructureTest::mutateAfterCopy()
copy = ps; copy = ps;
QStringList copyContentsPrefixPaths = contentsPrefixPaths; QStringList copyContentsPrefixPaths = contentsPrefixPaths;
copyContentsPrefixPaths << "more/"; copyContentsPrefixPaths << QStringLiteral("more/");
copy.setContentsPrefixPaths(copyContentsPrefixPaths); copy.setContentsPrefixPaths(copyContentsPrefixPaths);
QCOMPARE(ps.contentsPrefixPaths(), contentsPrefixPaths); QCOMPARE(ps.contentsPrefixPaths(), contentsPrefixPaths);
QCOMPARE(copy.contentsPrefixPaths(), copyContentsPrefixPaths); QCOMPARE(copy.contentsPrefixPaths(), copyContentsPrefixPaths);
copy = ps; copy = ps;
copy.addFileDefinition("nonsense", "foobar", QString()); copy.addFileDefinition("nonsense", QStringLiteral("foobar"), QString());
QCOMPARE(ps.files(), files); QCOMPARE(ps.files(), files);
QVERIFY(ps.files() != copy.files()); QVERIFY(ps.files() != copy.files());
copy = ps; copy = ps;
copy.addDirectoryDefinition("nonsense", "foobar", QString()); copy.addDirectoryDefinition("nonsense", QStringLiteral("foobar"), QString());
QCOMPARE(ps.directories(), dirs); QCOMPARE(ps.directories(), dirs);
QVERIFY(ps.directories() != copy.directories()); QVERIFY(ps.directories() != copy.directories());
@ -152,7 +152,7 @@ void PackageStructureTest::mutateAfterCopy()
copy = ps; copy = ps;
QStringList copyDefaultMimeTypes = defaultMimeTypes; QStringList copyDefaultMimeTypes = defaultMimeTypes;
copyDefaultMimeTypes << "rubbish"; copyDefaultMimeTypes << QStringLiteral("rubbish");
copy.setDefaultMimeTypes(copyDefaultMimeTypes); copy.setDefaultMimeTypes(copyDefaultMimeTypes);
QCOMPARE(ps.mimeTypes("translations"), defaultMimeTypes); QCOMPARE(ps.mimeTypes("translations"), defaultMimeTypes);
QCOMPARE(copy.mimeTypes("translations"), copyDefaultMimeTypes); QCOMPARE(copy.mimeTypes("translations"), copyDefaultMimeTypes);
@ -162,15 +162,15 @@ void PackageStructureTest::mutateAfterCopy()
void PackageStructureTest::emptyContentsPrefix() void PackageStructureTest::emptyContentsPrefix()
{ {
NoPrefixes package; NoPrefixes package;
QString path(package.filePath("bin", "ls")); QString path(package.filePath("bin", QStringLiteral("ls")));
//qDebug() << path; //qDebug() << path;
QCOMPARE(path, QString("/bin/ls")); QCOMPARE(path, QStringLiteral("/bin/ls"));
} }
void PackageStructureTest::multiplePaths() void PackageStructureTest::multiplePaths()
{ {
NoPrefixes package; NoPrefixes package;
QCOMPARE(package.name("MultiplePaths"), QString("Description proper")); QCOMPARE(package.name("MultiplePaths"), QStringLiteral("Description proper"));
} }
void PackageStructureTest::directories() void PackageStructureTest::directories()
@ -248,9 +248,9 @@ void PackageStructureTest::requiredFiles()
void PackageStructureTest::path() void PackageStructureTest::path()
{ {
QCOMPARE(ps.filePath("images"), QDir(m_packagePath + QString("/contents/images")).canonicalPath()); QCOMPARE(ps.filePath("images"), QDir(m_packagePath + QStringLiteral("/contents/images")).canonicalPath());
QCOMPARE(ps.filePath("theme"), QDir(m_packagePath + QString("/contents/theme")).canonicalPath()); QCOMPARE(ps.filePath("theme"), QDir(m_packagePath + QStringLiteral("/contents/theme")).canonicalPath());
QCOMPARE(ps.filePath("mainscript"), QFileInfo(m_packagePath + QString("/contents/ui/main.qml")).canonicalFilePath()); QCOMPARE(ps.filePath("mainscript"), QFileInfo(m_packagePath + QStringLiteral("/contents/ui/main.qml")).canonicalFilePath());
} }
void PackageStructureTest::name() void PackageStructureTest::name()
@ -267,7 +267,7 @@ void PackageStructureTest::required()
void PackageStructureTest::mimeTypes() void PackageStructureTest::mimeTypes()
{ {
QStringList mimeTypes; QStringList mimeTypes;
mimeTypes << "image/svg+xml" << "image/png" << "image/jpeg"; mimeTypes << QStringLiteral("image/svg+xml") << QStringLiteral("image/png") << QStringLiteral("image/jpeg");
QCOMPARE(ps.mimeTypes("images"), mimeTypes); QCOMPARE(ps.mimeTypes("images"), mimeTypes);
QCOMPARE(ps.mimeTypes("theme"), mimeTypes); QCOMPARE(ps.mimeTypes("theme"), mimeTypes);
} }

View File

@ -38,7 +38,7 @@ bool buildonly = true;
void PluginTest::listEngines() void PluginTest::listEngines()
{ {
KPluginInfo::List plugins = Plasma::PluginLoader::listEngineInfo(); KPluginInfo::List plugins = Plasma::PluginLoader::listEngineInfo();
foreach (const KPluginInfo info, plugins) { foreach (const KPluginInfo& info, plugins) {
//qDebug() << " Found DataEngine: " << info.pluginName() << info.name(); //qDebug() << " Found DataEngine: " << info.pluginName() << info.name();
} }
qDebug() << " Found " << plugins.count() << " DataEngines"; qDebug() << " Found " << plugins.count() << " DataEngines";
@ -54,14 +54,14 @@ void PluginTest::listAppletCategories()
void PluginTest::listContainmentActions() void PluginTest::listContainmentActions()
{ {
const KPluginInfo::List plugins = Plasma::PluginLoader::self()->listContainmentActionsInfo("plasma-shell"); const KPluginInfo::List plugins = Plasma::PluginLoader::self()->listContainmentActionsInfo(QStringLiteral("plasma-shell"));
qDebug() << "Categories: " << plugins.count(); qDebug() << "Categories: " << plugins.count();
//QVERIFY(plugins.count() > 0 || buildonly); //QVERIFY(plugins.count() > 0 || buildonly);
} }
void PluginTest::listContainmentsOfType() void PluginTest::listContainmentsOfType()
{ {
const KPluginInfo::List plugins = Plasma::PluginLoader::listContainmentsOfType("Desktop"); const KPluginInfo::List plugins = Plasma::PluginLoader::listContainmentsOfType(QStringLiteral("Desktop"));
qDebug() << "Desktop Containments: " << plugins.count(); qDebug() << "Desktop Containments: " << plugins.count();
QVERIFY(plugins.count() > 0 || buildonly); QVERIFY(plugins.count() > 0 || buildonly);
@ -69,7 +69,7 @@ void PluginTest::listContainmentsOfType()
void PluginTest::loadDataEngine() void PluginTest::loadDataEngine()
{ {
Plasma::DataEngine *engine = Plasma::PluginLoader::self()->loadDataEngine("time"); Plasma::DataEngine *engine = Plasma::PluginLoader::self()->loadDataEngine(QStringLiteral("time"));
//qDebug() << "Engine loaded successfully" << engine->pluginInfo().name(); //qDebug() << "Engine loaded successfully" << engine->pluginInfo().name();
QVERIFY(engine != 0 || buildonly); QVERIFY(engine != 0 || buildonly);

View File

@ -65,18 +65,18 @@ void SortFilterModelTest::setFilterRegExp()
SortFilterModel filterModel; SortFilterModel filterModel;
QSignalSpy spy(&filterModel, SIGNAL(filterRegExpChanged(QString))); QSignalSpy spy(&filterModel, SIGNAL(filterRegExpChanged(QString)));
filterModel.setFilterRegExp("foo"); filterModel.setFilterRegExp(QStringLiteral("foo"));
QCOMPARE(spy.count(), 1); QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst(); QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toString(), QString("foo")); QCOMPARE(arguments.at(0).toString(), QStringLiteral("foo"));
filterModel.setFilterRegExp("foo"); filterModel.setFilterRegExp(QStringLiteral("foo"));
QCOMPARE(spy.count(), 0); QCOMPARE(spy.count(), 0);
} }
void SortFilterModelTest::mapRowToSource() void SortFilterModelTest::mapRowToSource()
{ {
QStringList list = QStringList() << "Foo" << "Bar" << "Baz"; QStringList list = QStringList() << QStringLiteral("Foo") << QStringLiteral("Bar") << QStringLiteral("Baz");
QStringListModel model(list); QStringListModel model(list);
SortFilterModel filterModel; SortFilterModel filterModel;
@ -87,7 +87,7 @@ void SortFilterModelTest::mapRowToSource()
QCOMPARE(filterModel.mapRowToSource(3), -1); QCOMPARE(filterModel.mapRowToSource(3), -1);
QCOMPARE(filterModel.mapRowToSource(-1), -1); QCOMPARE(filterModel.mapRowToSource(-1), -1);
filterModel.setFilterRegExp("Ba"); filterModel.setFilterRegExp(QStringLiteral("Ba"));
// filterModel now contains "Bar" and "Baz" // filterModel now contains "Bar" and "Baz"
QCOMPARE(filterModel.mapRowToSource(0), 1); QCOMPARE(filterModel.mapRowToSource(0), 1);
QCOMPARE(filterModel.mapRowToSource(1), 2); QCOMPARE(filterModel.mapRowToSource(1), 2);
@ -97,7 +97,7 @@ void SortFilterModelTest::mapRowToSource()
void SortFilterModelTest::mapRowFromSource() void SortFilterModelTest::mapRowFromSource()
{ {
QStringList list = QStringList() << "Foo" << "Bar" << "Baz"; QStringList list = QStringList() << QStringLiteral("Foo") << QStringLiteral("Bar") << QStringLiteral("Baz");
QStringListModel model(list); QStringListModel model(list);
SortFilterModel filterModel; SortFilterModel filterModel;
@ -108,7 +108,7 @@ void SortFilterModelTest::mapRowFromSource()
QCOMPARE(filterModel.mapRowFromSource(3), -1); QCOMPARE(filterModel.mapRowFromSource(3), -1);
QCOMPARE(filterModel.mapRowFromSource(-1), -1); QCOMPARE(filterModel.mapRowFromSource(-1), -1);
filterModel.setFilterRegExp("Ba"); filterModel.setFilterRegExp(QStringLiteral("Ba"));
// filterModel now contains "Bar" and "Baz" // filterModel now contains "Bar" and "Baz"
QCOMPARE(filterModel.mapRowFromSource(0), -1); QCOMPARE(filterModel.mapRowFromSource(0), -1);
QCOMPARE(filterModel.mapRowFromSource(1), 0); QCOMPARE(filterModel.mapRowFromSource(1), 0);

View File

@ -26,20 +26,20 @@ void StorageTest::initTestCase()
{ {
QStandardPaths::enableTestMode(true); QStandardPaths::enableTestMode(true);
m_data.insert("String 1", "Fork"); m_data.insert(QStringLiteral("String 1"), "Fork");
m_data.insert("String 2", "Spoon"); m_data.insert(QStringLiteral("String 2"), "Spoon");
m_data.insert("String 3", "Knife"); m_data.insert(QStringLiteral("String 3"), "Knife");
m_data.insert("Int 1", 3141); m_data.insert(QStringLiteral("Int 1"), 3141);
m_data.insert("Int 2", 60); m_data.insert(QStringLiteral("Int 2"), 60);
QByteArray bytes("yadda yadda yadda"); QByteArray bytes("yadda yadda yadda");
m_data.insert("Binary Data", bytes); m_data.insert(QStringLiteral("Binary Data"), bytes);
} }
void StorageTest::store() void StorageTest::store()
{ {
Storage storage; Storage storage;
QVariantMap op = storage.operationDescription("save"); QVariantMap op = storage.operationDescription(QStringLiteral("save"));
op["group"] = "Test"; op[QStringLiteral("group")] = "Test";
Plasma::ServiceJob *job = storage.startOperationCall(op); Plasma::ServiceJob *job = storage.startOperationCall(op);
StorageJob *storageJob = qobject_cast<StorageJob *>(job); StorageJob *storageJob = qobject_cast<StorageJob *>(job);
@ -54,8 +54,8 @@ void StorageTest::store()
void StorageTest::retrieve() void StorageTest::retrieve()
{ {
Storage storage; Storage storage;
QVariantMap op = storage.operationDescription("retrieve"); QVariantMap op = storage.operationDescription(QStringLiteral("retrieve"));
op["group"] = "Test"; op[QStringLiteral("group")] = "Test";
Plasma::ServiceJob *job = storage.startOperationCall(op); Plasma::ServiceJob *job = storage.startOperationCall(op);
StorageJob *storageJob = qobject_cast<StorageJob *>(job); StorageJob *storageJob = qobject_cast<StorageJob *>(job);
@ -70,8 +70,8 @@ void StorageTest::retrieve()
void StorageTest::deleteEntry() void StorageTest::deleteEntry()
{ {
Storage storage; Storage storage;
QVariantMap op = storage.operationDescription("delete"); QVariantMap op = storage.operationDescription(QStringLiteral("delete"));
op["group"] = "Test"; op[QStringLiteral("group")] = "Test";
Plasma::ServiceJob *job = storage.startOperationCall(op); Plasma::ServiceJob *job = storage.startOperationCall(op);
StorageJob *storageJob = qobject_cast<StorageJob *>(job); StorageJob *storageJob = qobject_cast<StorageJob *>(job);
@ -82,8 +82,8 @@ void StorageTest::deleteEntry()
QVERIFY(storageJob->result().toBool()); QVERIFY(storageJob->result().toBool());
} }
op = storage.operationDescription("retrieve"); op = storage.operationDescription(QStringLiteral("retrieve"));
op["group"] = "Test"; op[QStringLiteral("group")] = "Test";
job = storage.startOperationCall(op); job = storage.startOperationCall(op);
storageJob = qobject_cast<StorageJob *>(job); storageJob = qobject_cast<StorageJob *>(job);

View File

@ -192,7 +192,7 @@ QString Calendar::monthName() const
// locale and take the month name from that. // locale and take the month name from that.
// //
// See https://bugs.kde.org/show_bug.cgi?id=353715 // See https://bugs.kde.org/show_bug.cgi?id=353715
const QString lang = QLocale().uiLanguages().first(); const QString lang = QLocale().uiLanguages().at(0);
// If lang is empty, it will create just a system locale // If lang is empty, it will create just a system locale
QLocale langLocale(lang); QLocale langLocale(lang);
return langLocale.standaloneMonthName(m_displayedDate.month()); return langLocale.standaloneMonthName(m_displayedDate.month());

View File

@ -132,7 +132,7 @@ void DaysModel::onEventModified(const CalendarEvents::EventData &data)
m_agendaNeedsUpdate = true; m_agendaNeedsUpdate = true;
} }
Q_FOREACH (const QDate &date, updatesList) { Q_FOREACH (const QDate date, updatesList) {
const QModelIndex changedIndex = indexForDate(date); const QModelIndex changedIndex = indexForDate(date);
if (changedIndex.isValid()) { if (changedIndex.isValid()) {
Q_EMIT dataChanged(changedIndex, changedIndex); Q_EMIT dataChanged(changedIndex, changedIndex);
@ -158,7 +158,7 @@ void DaysModel::onEventRemoved(const QString &uid)
m_agendaNeedsUpdate = true; m_agendaNeedsUpdate = true;
} }
Q_FOREACH (const QDate &date, updatesList) { Q_FOREACH (const QDate date, updatesList) {
const QModelIndex changedIndex = indexForDate(date); const QModelIndex changedIndex = indexForDate(date);
if (changedIndex.isValid()) { if (changedIndex.isValid()) {
Q_EMIT dataChanged(changedIndex, changedIndex); Q_EMIT dataChanged(changedIndex, changedIndex);

View File

@ -58,10 +58,10 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
QQmlContext *context = engine->rootContext(); QQmlContext *context = engine->rootContext();
Plasma::QuickTheme *theme = new Plasma::QuickTheme(engine); Plasma::QuickTheme *theme = new Plasma::QuickTheme(engine);
context->setContextProperty("theme", theme); context->setContextProperty(QStringLiteral("theme"), theme);
Units *units = new Units(context); Units *units = new Units(context);
context->setContextProperty("units", units); context->setContextProperty(QStringLiteral("units"), units);
if (!engine->rootContext()->contextObject()) { if (!engine->rootContext()->contextObject()) {
KDeclarative::KDeclarative kdeclarative; KDeclarative::KDeclarative kdeclarative;
@ -83,7 +83,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
qmlRegisterType<Plasma::FrameSvgItem>(uri, 2, 0, "FrameSvgItem"); qmlRegisterType<Plasma::FrameSvgItem>(uri, 2, 0, "FrameSvgItem");
//qmlRegisterType<ThemeProxy>(uri, 2, 0, "Theme"); //qmlRegisterType<ThemeProxy>(uri, 2, 0, "Theme");
qmlRegisterUncreatableType<Plasma::QuickTheme>(uri, 2, 0, "Theme", "It is not possible to instantiate Theme directly."); qmlRegisterUncreatableType<Plasma::QuickTheme>(uri, 2, 0, "Theme", QStringLiteral("It is not possible to instantiate Theme directly."));
qmlRegisterType<ColorScope>(uri, 2, 0, "ColorScope"); qmlRegisterType<ColorScope>(uri, 2, 0, "ColorScope");
qmlRegisterType<Plasma::DataSource>(uri, 2, 0, "DataSource"); qmlRegisterType<Plasma::DataSource>(uri, 2, 0, "DataSource");

View File

@ -223,7 +223,7 @@ DataModel::DataModel(QObject *parent)
{ {
//There is one reserved role name: DataEngineSource //There is one reserved role name: DataEngineSource
m_roleNames[m_maxRoleId] = QByteArrayLiteral("DataEngineSource"); m_roleNames[m_maxRoleId] = QByteArrayLiteral("DataEngineSource");
m_roleIds["DataEngineSource"] = m_maxRoleId; m_roleIds[QStringLiteral("DataEngineSource")] = m_maxRoleId;
++m_maxRoleId; ++m_maxRoleId;
setObjectName(QStringLiteral("DataModel")); setObjectName(QStringLiteral("DataModel"));
@ -257,7 +257,7 @@ void DataModel::dataUpdated(const QString &sourceName, const QVariantMap &data)
QVariant value = m_dataSource->data()->value(key); QVariant value = m_dataSource->data()->value(key);
if (value.isValid() && value.canConvert<Plasma::DataEngine::Data>()) { if (value.isValid() && value.canConvert<Plasma::DataEngine::Data>()) {
Plasma::DataEngine::Data data = value.value<Plasma::DataEngine::Data>(); Plasma::DataEngine::Data data = value.value<Plasma::DataEngine::Data>();
data["DataEngineSource"] = key; data[QStringLiteral("DataEngineSource")] = key;
list.append(data); list.append(data);
} }
} }

View File

@ -34,7 +34,7 @@ DataSource::DataSource(QObject *parent)
{ {
m_models = new QQmlPropertyMap(this); m_models = new QQmlPropertyMap(this);
m_data = new QQmlPropertyMap(this); m_data = new QQmlPropertyMap(this);
setObjectName("DataSource"); setObjectName(QStringLiteral("DataSource"));
} }
void DataSource::classBegin() void DataSource::classBegin()

View File

@ -76,13 +76,13 @@ ToolTip::~ToolTip()
void ToolTip::settingsChanged() void ToolTip::settingsChanged()
{ {
KSharedConfig::openConfig("plasmarc")->reparseConfiguration(); KSharedConfig::openConfig(QStringLiteral("plasmarc"))->reparseConfiguration();
loadSettings(); loadSettings();
} }
void ToolTip::loadSettings() void ToolTip::loadSettings()
{ {
KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig("plasmarc"), "PlasmaToolTips"); KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("plasmarc")), "PlasmaToolTips");
m_interval = cfg.readEntry("Delay", 700); m_interval = cfg.readEntry("Delay", 700);
m_tooltipsEnabledGlobally = (m_interval > 0); m_tooltipsEnabledGlobally = (m_interval > 0);
} }

View File

@ -149,7 +149,7 @@ void ToolTipDialog::setInteractive(bool interactive)
void ToolTipDialog::valueChanged(const QVariant &value) void ToolTipDialog::valueChanged(const QVariant &value)
{ {
setPosition(value.value<QPoint>()); setPosition(value.toPoint());
} }
#include "moc_tooltipdialog.cpp" #include "moc_tooltipdialog.cpp"

View File

@ -33,8 +33,8 @@
#include <KDirWatch> #include <KDirWatch>
#include <KIconLoader> #include <KIconLoader>
const QString plasmarc = QStringLiteral("plasmarc"); QString plasmarc() { return QStringLiteral("plasmarc"); }
const QString groupName = QStringLiteral("Units"); QString groupName() { return QStringLiteral("Units"); }
const int defaultLongDuration = 120; const int defaultLongDuration = 120;
@ -78,7 +78,7 @@ Units::Units(QObject *parent)
connect(KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged, this, &Units::iconLoaderSettingsChanged); connect(KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged, this, &Units::iconLoaderSettingsChanged);
QObject::connect(s_sharedAppFilter, SIGNAL(fontChanged()), this, SLOT(updateSpacing())); QObject::connect(s_sharedAppFilter, SIGNAL(fontChanged()), this, SLOT(updateSpacing()));
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + plasmarc; const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + plasmarc();
KDirWatch::self()->addFile(configFile); KDirWatch::self()->addFile(configFile);
// Catch both, direct changes to the config file ... // Catch both, direct changes to the config file ...
@ -95,8 +95,8 @@ Units::~Units()
void Units::settingsFileChanged(const QString &file) void Units::settingsFileChanged(const QString &file)
{ {
if (file.endsWith(plasmarc)) { if (file.endsWith(plasmarc())) {
KSharedConfigPtr cfg = KSharedConfig::openConfig(plasmarc); KSharedConfigPtr cfg = KSharedConfig::openConfig(plasmarc());
cfg->reparseConfiguration(); cfg->reparseConfiguration();
updatePlasmaRCSettings(); updatePlasmaRCSettings();
} }
@ -104,7 +104,7 @@ void Units::settingsFileChanged(const QString &file)
void Units::updatePlasmaRCSettings() void Units::updatePlasmaRCSettings()
{ {
KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig(plasmarc), groupName); KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig(plasmarc()), groupName());
// Animators with a duration of 0 do not fire reliably // Animators with a duration of 0 do not fire reliably
// see Bug 357532 and QTBUG-39766 // see Bug 357532 and QTBUG-39766
const int longDuration = qMax(1, cfg.readEntry("longDuration", defaultLongDuration)); const int longDuration = qMax(1, cfg.readEntry("longDuration", defaultLongDuration));
@ -118,15 +118,15 @@ void Units::updatePlasmaRCSettings()
void Units::iconLoaderSettingsChanged() void Units::iconLoaderSettingsChanged()
{ {
m_iconSizes->insert("desktop", devicePixelIconSize(KIconLoader::global()->currentSize(KIconLoader::Desktop))); m_iconSizes->insert(QStringLiteral("desktop"), devicePixelIconSize(KIconLoader::global()->currentSize(KIconLoader::Desktop)));
m_iconSizes->insert("tiny", devicePixelIconSize(KIconLoader::SizeSmall) / 2); m_iconSizes->insert(QStringLiteral("tiny"), devicePixelIconSize(KIconLoader::SizeSmall) / 2);
m_iconSizes->insert("small", devicePixelIconSize(KIconLoader::SizeSmall)); m_iconSizes->insert(QStringLiteral("small"), devicePixelIconSize(KIconLoader::SizeSmall));
m_iconSizes->insert("smallMedium", devicePixelIconSize(KIconLoader::SizeSmallMedium)); m_iconSizes->insert(QStringLiteral("smallMedium"), devicePixelIconSize(KIconLoader::SizeSmallMedium));
m_iconSizes->insert("medium", devicePixelIconSize(KIconLoader::SizeMedium)); m_iconSizes->insert(QStringLiteral("medium"), devicePixelIconSize(KIconLoader::SizeMedium));
m_iconSizes->insert("large", devicePixelIconSize(KIconLoader::SizeLarge)); m_iconSizes->insert(QStringLiteral("large"), devicePixelIconSize(KIconLoader::SizeLarge));
m_iconSizes->insert("huge", devicePixelIconSize(KIconLoader::SizeHuge)); m_iconSizes->insert(QStringLiteral("huge"), devicePixelIconSize(KIconLoader::SizeHuge));
m_iconSizes->insert("enormous", devicePixelIconSize(KIconLoader::SizeEnormous)); m_iconSizes->insert(QStringLiteral("enormous"), devicePixelIconSize(KIconLoader::SizeEnormous));
emit iconSizesChanged(); emit iconSizesChanged();
} }
@ -235,7 +235,7 @@ int Units::largeSpacing() const
void Units::updateSpacing() void Units::updateSpacing()
{ {
int gridUnit = QFontMetrics(QGuiApplication::font()).boundingRect("M").height(); int gridUnit = QFontMetrics(QGuiApplication::font()).boundingRect(QStringLiteral("M")).height();
if (gridUnit % 2 != 0) { if (gridUnit % 2 != 0) {
gridUnit++; gridUnit++;

View File

@ -245,7 +245,7 @@ void WindowThumbnail::iconToTexture(WindowTextureNode *textureNode)
icon = KWindowSystem::self()->icon(m_winId); icon = KWindowSystem::self()->icon(m_winId);
} else { } else {
// fallback to plasma icon // fallback to plasma icon
icon = QIcon::fromTheme("plasma"); icon = QIcon::fromTheme(QStringLiteral("plasma"));
} }
QImage image = icon.pixmap(boundingRect().size().toSize()).toImage(); QImage image = icon.pixmap(boundingRect().size().toSize()).toImage();
textureNode->reset(window()->createTextureFromImage(image)); textureNode->reset(window()->createTextureFromImage(image));
@ -513,7 +513,7 @@ bool WindowThumbnail::loadGLXTexture()
// As the GLXFBConfig might be context specific and we cannot be sure // As the GLXFBConfig might be context specific and we cannot be sure
// that the code might be entered from different contexts, the cache // that the code might be entered from different contexts, the cache
// also maps the cached configs against the context. // also maps the cached configs against the context.
static QMap<GLXContext, QMap<int, GLXFBConfig> > s_fbConfigs; static QHash<GLXContext, QMap<int, GLXFBConfig> > s_fbConfigs;
auto it = s_fbConfigs.find(glxContext); auto it = s_fbConfigs.find(glxContext);
if (it == s_fbConfigs.end()) { if (it == s_fbConfigs.end()) {
// create a map entry for the current context // create a map entry for the current context

View File

@ -57,7 +57,7 @@ QQmlEngine *EngineBookKeeping::engine() const
qWarning() << "No engines found, this should never happen"; qWarning() << "No engines found, this should never happen";
return 0; return 0;
} else { } else {
return m_engines.values().first(); return m_engines.values().at(0);
} }
} }

View File

@ -63,7 +63,7 @@ void QMenuItem::setIcon(const QVariant &i)
if (i.canConvert<QIcon>()) { if (i.canConvert<QIcon>()) {
m_action->setIcon(i.value<QIcon>()); m_action->setIcon(i.value<QIcon>());
} else if (i.canConvert<QString>()) { } else if (i.canConvert<QString>()) {
m_action->setIcon(QIcon::fromTheme(i.value<QString>())); m_action->setIcon(QIcon::fromTheme(i.toString()));
} }
emit iconChanged(); emit iconChanged();
} }

View File

@ -32,7 +32,7 @@
void PlasmaExtraComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) void PlasmaExtraComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{ {
Q_ASSERT(uri == QLatin1String("org.kde.plasma.extras")); Q_ASSERT(uri == QLatin1String("org.kde.plasma.extras"));
engine->addImageProvider(QLatin1String("appbackgrounds"), new AppBackgroundProvider); engine->addImageProvider(QStringLiteral("appbackgrounds"), new AppBackgroundProvider);
} }
void PlasmaExtraComponentsPlugin::registerTypes(const char *uri) void PlasmaExtraComponentsPlugin::registerTypes(const char *uri)

View File

@ -238,7 +238,7 @@ KConfigGroup Applet::config() const
KConfigGroup Applet::globalConfig() const KConfigGroup Applet::globalConfig() const
{ {
KConfigGroup globalAppletConfig; KConfigGroup globalAppletConfig;
QString group = isContainment() ? "ContainmentGlobals" : "AppletGlobals"; QString group = isContainment() ? QStringLiteral("ContainmentGlobals") : QStringLiteral("AppletGlobals");
Containment *cont = containment(); Containment *cont = containment();
Corona *corona = 0; Corona *corona = 0;
@ -481,24 +481,24 @@ void Applet::flushPendingConstraintsEvents()
if (c & Plasma::Types::StartupCompletedConstraint) { if (c & Plasma::Types::StartupCompletedConstraint) {
//common actions //common actions
bool unlocked = immutability() == Types::Mutable; bool unlocked = immutability() == Types::Mutable;
QAction *closeApplet = d->actions->action("remove"); QAction *closeApplet = d->actions->action(QStringLiteral("remove"));
if (closeApplet) { if (closeApplet) {
closeApplet->setEnabled(unlocked); closeApplet->setEnabled(unlocked);
closeApplet->setVisible(unlocked); closeApplet->setVisible(unlocked);
connect(closeApplet, SIGNAL(triggered(bool)), this, SLOT(askDestroy()), Qt::UniqueConnection); connect(closeApplet, SIGNAL(triggered(bool)), this, SLOT(askDestroy()), Qt::UniqueConnection);
} }
QAction *configAction = d->actions->action("configure"); QAction *configAction = d->actions->action(QStringLiteral("configure"));
if (configAction) { if (configAction) {
if (d->hasConfigurationInterface) { if (d->hasConfigurationInterface) {
bool canConfig = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked"); bool canConfig = unlocked || KAuthorized::authorize(QStringLiteral("plasma/allow_configure_when_locked"));
configAction->setVisible(canConfig); configAction->setVisible(canConfig);
configAction->setEnabled(canConfig); configAction->setEnabled(canConfig);
} }
} }
QAction *runAssociatedApplication = d->actions->action("run associated application"); QAction *runAssociatedApplication = d->actions->action(QStringLiteral("run associated application"));
if (runAssociatedApplication) { if (runAssociatedApplication) {
connect(runAssociatedApplication, SIGNAL(triggered(bool)), this, SLOT(runAssociatedApplication()), Qt::UniqueConnection); connect(runAssociatedApplication, SIGNAL(triggered(bool)), this, SLOT(runAssociatedApplication()), Qt::UniqueConnection);
} }
@ -508,21 +508,21 @@ void Applet::flushPendingConstraintsEvents()
if (c & Plasma::Types::ImmutableConstraint) { if (c & Plasma::Types::ImmutableConstraint) {
bool unlocked = immutability() == Types::Mutable; bool unlocked = immutability() == Types::Mutable;
QAction *action = d->actions->action("remove"); QAction *action = d->actions->action(QStringLiteral("remove"));
if (action) { if (action) {
action->setVisible(unlocked); action->setVisible(unlocked);
action->setEnabled(unlocked); action->setEnabled(unlocked);
} }
action = d->actions->action("alternatives"); action = d->actions->action(QStringLiteral("alternatives"));
if (action) { if (action) {
action->setVisible(unlocked); action->setVisible(unlocked);
action->setEnabled(unlocked); action->setEnabled(unlocked);
} }
action = d->actions->action("configure"); action = d->actions->action(QStringLiteral("configure"));
if (action && d->hasConfigurationInterface) { if (action && d->hasConfigurationInterface) {
bool canConfig = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked"); bool canConfig = unlocked || KAuthorized::authorize(QStringLiteral("plasma/allow_configure_when_locked"));
action->setVisible(canConfig); action->setVisible(canConfig);
action->setEnabled(canConfig); action->setEnabled(canConfig);
} }
@ -690,7 +690,7 @@ void Applet::setAssociatedApplication(const QString &string)
{ {
AssociatedApplicationManager::self()->setApplication(this, string); AssociatedApplicationManager::self()->setApplication(this, string);
QAction *runAssociatedApplication = d->actions->action("run associated application"); QAction *runAssociatedApplication = d->actions->action(QStringLiteral("run associated application"));
if (runAssociatedApplication) { if (runAssociatedApplication) {
bool valid = AssociatedApplicationManager::self()->appletHasValidAssociatedApplication(this); bool valid = AssociatedApplicationManager::self()->appletHasValidAssociatedApplication(this);
runAssociatedApplication->setVisible(valid); runAssociatedApplication->setVisible(valid);
@ -702,7 +702,7 @@ void Applet::setAssociatedApplicationUrls(const QList<QUrl> &urls)
{ {
AssociatedApplicationManager::self()->setUrls(this, urls); AssociatedApplicationManager::self()->setUrls(this, urls);
QAction *runAssociatedApplication = d->actions->action("run associated application"); QAction *runAssociatedApplication = d->actions->action(QStringLiteral("run associated application"));
if (runAssociatedApplication) { if (runAssociatedApplication) {
bool valid = AssociatedApplicationManager::self()->appletHasValidAssociatedApplication(this); bool valid = AssociatedApplicationManager::self()->appletHasValidAssociatedApplication(this);
runAssociatedApplication->setVisible(valid); runAssociatedApplication->setVisible(valid);

View File

@ -101,7 +101,7 @@ void Containment::init()
if (d->type == Types::NoContainmentType) { if (d->type == Types::NoContainmentType) {
//setContainmentType(Plasma::Types::DesktopContainment); //setContainmentType(Plasma::Types::DesktopContainment);
//Try to determine the containment type. It must be done as soon as possible //Try to determine the containment type. It must be done as soon as possible
QString type = pluginInfo().property("X-Plasma-ContainmentType").toString(); QString type = pluginInfo().property(QStringLiteral("X-Plasma-ContainmentType")).toString();
if (type == QLatin1String("Panel")) { if (type == QLatin1String("Panel")) {
setContainmentType(Plasma::Types::PanelContainment); setContainmentType(Plasma::Types::PanelContainment);
@ -142,7 +142,7 @@ void Containment::init()
QAction *lockDesktopAction = corona()->actions()->action(QStringLiteral("lock widgets")); QAction *lockDesktopAction = corona()->actions()->action(QStringLiteral("lock widgets"));
//keep a pointer so nobody notices it moved to corona //keep a pointer so nobody notices it moved to corona
if (lockDesktopAction) { if (lockDesktopAction) {
actions()->addAction(QLatin1String("lock widgets"), lockDesktopAction); actions()->addAction(QStringLiteral("lock widgets"), lockDesktopAction);
} }
} }
@ -287,7 +287,7 @@ void Containment::restoreContents(KConfigGroup &group)
d->createApplet(plugin, QVariantList(), appId); d->createApplet(plugin, QVariantList(), appId);
} }
for (Applet *applet : Containment::applets()) { foreach (Applet *applet, Containment::applets()) {
if (!applet->pluginInfo().isValid()) { if (!applet->pluginInfo().isValid()) {
applet->updateConstraints(Plasma::Types::UiReadyConstraint); applet->updateConstraints(Plasma::Types::UiReadyConstraint);
} }

View File

@ -134,7 +134,7 @@ QString ContainmentActions::eventToString(QEvent *event)
QWheelEvent *e = static_cast<QWheelEvent *>(event); QWheelEvent *e = static_cast<QWheelEvent *>(event);
int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations"); int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o); QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
trigger = "wheel:"; trigger = QStringLiteral("wheel:");
trigger += orient.valueToKey(e->orientation()); trigger += orient.valueToKey(e->orientation());
modifiers = e->modifiers(); modifiers = e->modifiers();
break; break;

View File

@ -302,7 +302,7 @@ void Corona::setImmutability(const Types::ImmutabilityType immutable)
emit immutabilityChanged(immutable); emit immutabilityChanged(immutable);
//update our actions //update our actions
QAction *action = d->actions.action("lock widgets"); QAction *action = d->actions.action(QStringLiteral("lock widgets"));
if (action) { if (action) {
if (d->immutability == Types::SystemImmutable) { if (d->immutability == Types::SystemImmutable) {
action->setEnabled(false); action->setEnabled(false);
@ -310,7 +310,7 @@ void Corona::setImmutability(const Types::ImmutabilityType immutable)
} else { } else {
bool unlocked = d->immutability == Types::Mutable; bool unlocked = d->immutability == Types::Mutable;
action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets")); action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"));
action->setIcon(QIcon::fromTheme(unlocked ? "object-locked" : "object-unlocked")); action->setIcon(QIcon::fromTheme(unlocked ? QStringLiteral("object-locked") : QStringLiteral("object-unlocked")));
action->setEnabled(true); action->setEnabled(true);
action->setVisible(true); action->setVisible(true);
} }
@ -361,7 +361,7 @@ CoronaPrivate::CoronaPrivate(Corona *corona)
if (QCoreApplication::instance()) { if (QCoreApplication::instance()) {
configName = QCoreApplication::instance()->applicationName() + "-appletsrc"; configName = QCoreApplication::instance()->applicationName() + "-appletsrc";
} else { } else {
configName = "plasma-appletsrc"; configName = QStringLiteral("plasma-appletsrc");
} }
} }
@ -378,15 +378,15 @@ void CoronaPrivate::init()
QObject::connect(configSyncTimer, SIGNAL(timeout()), q, SLOT(syncConfig())); QObject::connect(configSyncTimer, SIGNAL(timeout()), q, SLOT(syncConfig()));
//some common actions //some common actions
actions.setConfigGroup("Shortcuts"); actions.setConfigGroup(QStringLiteral("Shortcuts"));
QAction *lockAction = actions.add<QAction>("lock widgets"); QAction *lockAction = actions.add<QAction>(QStringLiteral("lock widgets"));
QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability())); QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability()));
lockAction->setText(i18n("Lock Widgets")); lockAction->setText(i18n("Lock Widgets"));
lockAction->setAutoRepeat(true); lockAction->setAutoRepeat(true);
lockAction->setIcon(QIcon::fromTheme("object-locked")); lockAction->setIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
lockAction->setData(Plasma::Types::ControlAction); lockAction->setData(Plasma::Types::ControlAction);
lockAction->setShortcut(QKeySequence("alt+d, l")); lockAction->setShortcut(QKeySequence(QStringLiteral("alt+d, l")));
lockAction->setShortcutContext(Qt::ApplicationShortcut); lockAction->setShortcutContext(Qt::ApplicationShortcut);
//fake containment/applet actions //fake containment/applet actions
@ -450,12 +450,12 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
// qCDebug(LOG_PLASMA) << "Loading" << name << args << id; // qCDebug(LOG_PLASMA) << "Loading" << name << args << id;
if (pluginName.isEmpty() || pluginName == "default") { if (pluginName.isEmpty() || pluginName == QLatin1String("default")) {
// default to the desktop containment // default to the desktop containment
pluginName = desktopDefaultsConfig.readEntry("Containment", "org.kde.desktopcontainment"); pluginName = desktopDefaultsConfig.readEntry("Containment", "org.kde.desktopcontainment");
} }
bool loadingNull = pluginName == "null"; bool loadingNull = pluginName == QLatin1String("null");
if (!loadingNull) { if (!loadingNull) {
applet = PluginLoader::self()->loadApplet(pluginName, id, args); applet = PluginLoader::self()->loadApplet(pluginName, id, args);
containment = dynamic_cast<Containment *>(applet); containment = dynamic_cast<Containment *>(applet);

View File

@ -249,8 +249,8 @@ void DataContainerPrivate::store()
storage = new Storage(q); storage = new Storage(q);
} }
QVariantMap op = storage->operationDescription("save"); QVariantMap op = storage->operationDescription(QStringLiteral("save"));
op["group"] = q->objectName(); op[QStringLiteral("group")] = q->objectName();
StorageJob *job = static_cast<StorageJob *>(storage->startOperationCall(op)); StorageJob *job = static_cast<StorageJob *>(storage->startOperationCall(op));
job->setData(data); job->setData(data);
storageCount++; storageCount++;
@ -277,8 +277,8 @@ void DataContainerPrivate::retrieve()
storage = new Storage(q); storage = new Storage(q);
} }
QVariantMap retrieveGroup = storage->operationDescription("retrieve"); QVariantMap retrieveGroup = storage->operationDescription(QStringLiteral("retrieve"));
retrieveGroup["group"] = q->objectName(); retrieveGroup[QStringLiteral("group")] = q->objectName();
ServiceJob *retrieveJob = storage->startOperationCall(retrieveGroup); ServiceJob *retrieveJob = storage->startOperationCall(retrieveGroup);
QObject::connect(retrieveJob, SIGNAL(result(KJob*)), q, QObject::connect(retrieveJob, SIGNAL(result(KJob*)), q,
SLOT(populateFromStoredData(KJob*))); SLOT(populateFromStoredData(KJob*)));
@ -303,9 +303,9 @@ void DataContainerPrivate::populateFromStoredData(KJob *job)
q->forceImmediateUpdate(); q->forceImmediateUpdate();
} }
QVariantMap expireGroup = storage->operationDescription("expire"); QVariantMap expireGroup = storage->operationDescription(QStringLiteral("expire"));
//expire things older than 4 days //expire things older than 4 days
expireGroup["age"] = 345600; expireGroup[QStringLiteral("age")] = 345600;
storage->startOperationCall(expireGroup); storage->startOperationCall(expireGroup);
} }

View File

@ -233,9 +233,9 @@ void DataEngine::removeData(const QString &source, const QString &key)
void DataEngine::setModel(const QString &source, QAbstractItemModel *model) void DataEngine::setModel(const QString &source, QAbstractItemModel *model)
{ {
if (model) { if (model) {
setData(source, "HasModel", true); setData(source, QStringLiteral("HasModel"), true);
} else { } else {
removeData(source, "HasModel"); removeData(source, QStringLiteral("HasModel"));
} }
Plasma::DataContainer *s = containerForSource(source); Plasma::DataContainer *s = containerForSource(source);
@ -425,18 +425,18 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, con
if (dataEngineDescription.isValid()) { if (dataEngineDescription.isValid()) {
e->setObjectName(dataEngineDescription.name()); e->setObjectName(dataEngineDescription.name());
} else { } else {
e->setObjectName("NullEngine"); e->setObjectName(QStringLiteral("NullEngine"));
} }
if (dataEngineDescription.isValid()) { if (dataEngineDescription.isValid()) {
QString api = dataEngineDescription.property("X-Plasma-API").toString(); QString api = dataEngineDescription.property(QStringLiteral("X-Plasma-API")).toString();
if (!api.isEmpty()) { if (!api.isEmpty()) {
const QString path = const QString path =
QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStandardPaths::locate(QStandardPaths::GenericDataLocation,
PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/" + dataEngineDescription.pluginName() + '/', PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/" + dataEngineDescription.pluginName() + '/',
QStandardPaths::LocateDirectory); QStandardPaths::LocateDirectory);
package = new Package(PluginLoader::self()->loadPackage("Plasma/DataEngine", api)); package = new Package(PluginLoader::self()->loadPackage(QStringLiteral("Plasma/DataEngine"), api));
package->setPath(path); package->setPath(path);
if (package->isValid()) { if (package->isValid()) {

View File

@ -39,7 +39,7 @@ void DataEngineConsumerPrivate::slotJobFinished(Plasma::ServiceJob *job)
#ifndef NDEBUG #ifndef NDEBUG
// qCDebug(LOG_PLASMA) << "engine ready!"; // qCDebug(LOG_PLASMA) << "engine ready!";
#endif #endif
QString engineName = job->parameters()["EngineName"].toString(); QString engineName = job->parameters().value(QStringLiteral("EngineName")).toString();
QString location = job->destination(); QString location = job->destination();
QPair<QString, QString> pair(location, engineName); QPair<QString, QString> pair(location, engineName);
#ifndef NDEBUG #ifndef NDEBUG
@ -68,8 +68,8 @@ void DataEngineConsumerPrivate::slotServiceReady(Plasma::Service *plasmoidServic
#ifndef NDEBUG #ifndef NDEBUG
// qCDebug(LOG_PLASMA) << "requesting dataengine!"; // qCDebug(LOG_PLASMA) << "requesting dataengine!";
#endif #endif
QVariantMap op = plasmoidService->operationDescription("DataEngine"); QVariantMap op = plasmoidService->operationDescription(QStringLiteral("DataEngine"));
op["EngineName"] = engineNameForService.value(plasmoidService); op[QStringLiteral("EngineName")] = engineNameForService.value(plasmoidService);
plasmoidService->startOperationCall(op); plasmoidService->startOperationCall(op);
connect(plasmoidService, SIGNAL(finished(Plasma::ServiceJob*)), connect(plasmoidService, SIGNAL(finished(Plasma::ServiceJob*)),
this, SLOT(slotJobFinished(Plasma::ServiceJob*))); this, SLOT(slotJobFinished(Plasma::ServiceJob*)));

View File

@ -193,16 +193,16 @@ void FrameSvg::setElementPrefix(Plasma::Types::Location location)
{ {
switch (location) { switch (location) {
case Types::TopEdge: case Types::TopEdge:
setElementPrefix("north"); setElementPrefix(QStringLiteral("north"));
break; break;
case Types::BottomEdge: case Types::BottomEdge:
setElementPrefix("south"); setElementPrefix(QStringLiteral("south"));
break; break;
case Types::LeftEdge: case Types::LeftEdge:
setElementPrefix("west"); setElementPrefix(QStringLiteral("west"));
break; break;
case Types::RightEdge: case Types::RightEdge:
setElementPrefix("east"); setElementPrefix(QStringLiteral("east"));
break; break;
default: default:
setElementPrefix(QString()); setElementPrefix(QString());

View File

@ -249,7 +249,7 @@ void Package::setMimeTypes(const char *key, QStringList mimeTypes)
QList<const char *> Package::directories() const QList<const char *> Package::directories() const
{ {
QList<const char *> dirs; QList<const char *> dirs;
for (auto data : d->internalPackage->directories()) { foreach (const auto &data, d->internalPackage->directories()) {
dirs << data.constData(); dirs << data.constData();
} }
@ -259,7 +259,7 @@ QList<const char *> Package::directories() const
QList<const char *> Package::requiredDirectories() const QList<const char *> Package::requiredDirectories() const
{ {
QList<const char *> dirs; QList<const char *> dirs;
for (auto data : d->internalPackage->requiredDirectories()) { foreach (const auto &data, d->internalPackage->requiredDirectories()) {
dirs << data.constData(); dirs << data.constData();
} }
@ -269,7 +269,7 @@ QList<const char *> Package::requiredDirectories() const
QList<const char *> Package::files() const QList<const char *> Package::files() const
{ {
QList<const char *> files; QList<const char *> files;
for (auto data : d->internalPackage->files()) { foreach (const auto &data, d->internalPackage->files()) {
files << data.constData(); files << data.constData();
} }
@ -279,7 +279,7 @@ QList<const char *> Package::files() const
QList<const char *> Package::requiredFiles() const QList<const char *> Package::requiredFiles() const
{ {
QList<const char *> files; QList<const char *> files;
for (auto data : d->internalPackage->requiredFiles()) { foreach (const auto &data, d->internalPackage->requiredFiles()) {
files << data.constData(); files << data.constData();
} }

View File

@ -160,8 +160,8 @@ void PackageStructurePrivate::installPathChanged(const QString &path)
} }
} }
} }
QDBusInterface sycoca("org.kde.kded5", "/kbuildsycoca"); QDBusInterface sycoca(QStringLiteral("org.kde.kded5"), QStringLiteral("/kbuildsycoca"));
sycoca.asyncCall("recreate"); sycoca.asyncCall(QStringLiteral("recreate"));
} }

View File

@ -59,11 +59,11 @@ public:
: isDefaultLoader(false), : isDefaultLoader(false),
packageRE(QLatin1String("[^a-zA-Z0-9\\-_]")) packageRE(QLatin1String("[^a-zA-Z0-9\\-_]"))
{ {
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new PlasmoidPackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new PlasmoidPackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/DataEngine"), new DataEnginePackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Theme"), new ThemePackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Theme"), new ThemePackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/ContainmentActions"), new ContainmentActionsPackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/ContainmentActions"), new ContainmentActionsPackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Generic"), new GenericPackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Generic"), new GenericPackage());
} }
static QSet<QString> knownCategories(); static QSet<QString> knownCategories();
@ -94,26 +94,26 @@ QSet<QString> PluginLoaderPrivate::knownCategories()
// this is to trick the tranlsation tools into making the correct // this is to trick the tranlsation tools into making the correct
// strings for translation // strings for translation
QSet<QString> categories = s_customCategories; QSet<QString> categories = s_customCategories;
categories << QString(I18N_NOOP("Accessibility")).toLower() categories << QStringLiteral(I18N_NOOP("Accessibility")).toLower()
<< QString(I18N_NOOP("Application Launchers")).toLower() << QStringLiteral(I18N_NOOP("Application Launchers")).toLower()
<< QString(I18N_NOOP("Astronomy")).toLower() << QStringLiteral(I18N_NOOP("Astronomy")).toLower()
<< QString(I18N_NOOP("Date and Time")).toLower() << QStringLiteral(I18N_NOOP("Date and Time")).toLower()
<< QString(I18N_NOOP("Development Tools")).toLower() << QStringLiteral(I18N_NOOP("Development Tools")).toLower()
<< QString(I18N_NOOP("Education")).toLower() << QStringLiteral(I18N_NOOP("Education")).toLower()
<< QString(I18N_NOOP("Environment and Weather")).toLower() << QStringLiteral(I18N_NOOP("Environment and Weather")).toLower()
<< QString(I18N_NOOP("Examples")).toLower() << QStringLiteral(I18N_NOOP("Examples")).toLower()
<< QString(I18N_NOOP("File System")).toLower() << QStringLiteral(I18N_NOOP("File System")).toLower()
<< QString(I18N_NOOP("Fun and Games")).toLower() << QStringLiteral(I18N_NOOP("Fun and Games")).toLower()
<< QString(I18N_NOOP("Graphics")).toLower() << QStringLiteral(I18N_NOOP("Graphics")).toLower()
<< QString(I18N_NOOP("Language")).toLower() << QStringLiteral(I18N_NOOP("Language")).toLower()
<< QString(I18N_NOOP("Mapping")).toLower() << QStringLiteral(I18N_NOOP("Mapping")).toLower()
<< QString(I18N_NOOP("Miscellaneous")).toLower() << QStringLiteral(I18N_NOOP("Miscellaneous")).toLower()
<< QString(I18N_NOOP("Multimedia")).toLower() << QStringLiteral(I18N_NOOP("Multimedia")).toLower()
<< QString(I18N_NOOP("Online Services")).toLower() << QStringLiteral(I18N_NOOP("Online Services")).toLower()
<< QString(I18N_NOOP("Productivity")).toLower() << QStringLiteral(I18N_NOOP("Productivity")).toLower()
<< QString(I18N_NOOP("System Information")).toLower() << QStringLiteral(I18N_NOOP("System Information")).toLower()
<< QString(I18N_NOOP("Utilities")).toLower() << QStringLiteral(I18N_NOOP("Utilities")).toLower()
<< QString(I18N_NOOP("Windows and Tasks")).toLower(); << QStringLiteral(I18N_NOOP("Windows and Tasks")).toLower();
return categories; return categories;
} }
@ -194,7 +194,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
}; };
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_plasmoidsPluginDir, filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_plasmoidsPluginDir, filter);
if (plugins.count()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath()); KPluginLoader loader(lst.first().libraryPath());
if (!Plasma::isPluginVersionCompatible(loader.pluginVersion())) { if (!Plasma::isPluginVersionCompatible(loader.pluginVersion())) {
@ -285,7 +285,7 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name)
}; };
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter);
if (plugins.count()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath()); KPluginLoader loader(lst.first().libraryPath());
const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap(); const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap();
@ -308,8 +308,8 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name)
QStringList PluginLoader::listAllEngines(const QString &parentApp) QStringList PluginLoader::listAllEngines(const QString &parentApp)
{ {
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/DataEngine")) { if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/DataEngine", new DataEnginePackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
} }
QStringList engines; QStringList engines;
@ -325,12 +325,12 @@ QStringList PluginLoader::listAllEngines(const QString &parentApp)
plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter); plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter);
} }
for (auto plugin : plugins) { foreach (auto& plugin, plugins) {
engines << plugin.pluginId(); engines << plugin.pluginId();
} }
const QList<KPluginMetaData> packagePlugins = KPackage::PackageLoader::self()->listPackages("Plasma/DataEngine"); const QList<KPluginMetaData> packagePlugins = KPackage::PackageLoader::self()->listPackages(QStringLiteral("Plasma/DataEngine"));
for (auto plugin : packagePlugins) { for (auto& plugin : packagePlugins) {
engines << plugin.pluginId(); engines << plugin.pluginId();
} }
@ -339,16 +339,16 @@ QStringList PluginLoader::listAllEngines(const QString &parentApp)
KPluginInfo::List PluginLoader::listEngineInfo(const QString &parentApp) KPluginInfo::List PluginLoader::listEngineInfo(const QString &parentApp)
{ {
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/DataEngine")) { if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/DataEngine", new DataEnginePackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
} }
return PluginLoader::self()->listDataEngineInfo(parentApp); return PluginLoader::self()->listDataEngineInfo(parentApp);
} }
KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category, const QString &parentApp) KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category, const QString &parentApp)
{ {
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/DataEngine")) { if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/DataEngine", new DataEnginePackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
} }
KPluginInfo::List list; KPluginInfo::List list;
@ -374,7 +374,7 @@ KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category
//TODO FIXME: PackageLoader needs to have a function to inject packageStructures //TODO FIXME: PackageLoader needs to have a function to inject packageStructures
const QList<KPluginMetaData> packagePlugins = KPackage::PackageLoader::self()->listPackages("Plasma/DataEngine"); const QList<KPluginMetaData> packagePlugins = KPackage::PackageLoader::self()->listPackages(QStringLiteral("Plasma/DataEngine"));
list << KPluginInfo::fromMetaData(packagePlugins.toVector()); list << KPluginInfo::fromMetaData(packagePlugins.toVector());
return list; return list;
@ -402,7 +402,7 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args
}; };
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_servicesPluginDir, filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_servicesPluginDir, filter);
if (plugins.count()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath()); KPluginLoader loader(lst.first().libraryPath());
if (!Plasma::isPluginVersionCompatible(loader.pluginVersion())) { if (!Plasma::isPluginVersionCompatible(loader.pluginVersion())) {
@ -443,7 +443,7 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co
}; };
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_containmentActionsPluginDir, filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_containmentActionsPluginDir, filter);
if (plugins.count()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath()); KPluginLoader loader(lst.first().libraryPath());
const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap(); const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap();
@ -538,8 +538,8 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s
structure->d->internalStructure = internalStructure; structure->d->internalStructure = internalStructure;
//fallback to old structures //fallback to old structures
} else { } else {
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(packageFormat); const QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(packageFormat);
structure = KPluginTrader::createInstanceFromQuery<Plasma::PackageStructure>(PluginLoaderPrivate::s_packageStructurePluginDir, "Plasma/PackageStructure", constraint, 0); structure = KPluginTrader::createInstanceFromQuery<Plasma::PackageStructure>(PluginLoaderPrivate::s_packageStructurePluginDir, QStringLiteral("Plasma/PackageStructure"), constraint, 0);
if (structure) { if (structure) {
structure->d->internalStructure = new PackageStructureWrapper(structure); structure->d->internalStructure = new PackageStructureWrapper(structure);
} }
@ -579,7 +579,8 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS
//NOTE: it still produces kplugininfos from KServices because some user code expects //NOTE: it still produces kplugininfos from KServices because some user code expects
//info.sevice() to be valid and would crash ohtherwise //info.sevice() to be valid and would crash ohtherwise
for (auto md : KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter)) { auto plugins = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
foreach (auto& md, plugins) {
auto pi = KPluginInfo(KService::serviceByStorageId(md.metaDataFileName())); auto pi = KPluginInfo(KService::serviceByStorageId(md.metaDataFileName()));
if (!pi.isValid()) { if (!pi.isValid()) {
qCWarning(LOG_PLASMA) << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin"; qCWarning(LOG_PLASMA) << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin";
@ -605,7 +606,8 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS
//NOTE: it still produces kplugininfos from KServices because some user code expects //NOTE: it still produces kplugininfos from KServices because some user code expects
//info.sevice() to be valid and would crash ohtherwise //info.sevice() to be valid and would crash ohtherwise
for (auto md : KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter)) { const auto plugins = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
foreach (auto& md, plugins) {
auto pi = KPluginInfo(KService::serviceByStorageId(md.metaDataFileName())); auto pi = KPluginInfo(KService::serviceByStorageId(md.metaDataFileName()));
if (!pi.isValid()) { if (!pi.isValid()) {
qCWarning(LOG_PLASMA) << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin"; qCWarning(LOG_PLASMA) << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin";
@ -623,7 +625,7 @@ KPluginInfo::List PluginLoader::listAppletInfoForMimeType(const QString &mimeTyp
{ {
return md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType); return md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType);
}; };
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter).toVector()); return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector());
} }
KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url) KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
@ -639,11 +641,11 @@ KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
return (pa.isEmpty() || pa == parentApp) && !md.value(QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty(); return (pa.isEmpty() || pa == parentApp) && !md.value(QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty();
}; };
KPluginInfo::List allApplets = KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter).toVector()); KPluginInfo::List allApplets = KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector());
KPluginInfo::List filtered; KPluginInfo::List filtered;
foreach (const KPluginInfo &info, allApplets) { foreach (const KPluginInfo &info, allApplets) {
QStringList urlPatterns = info.property("X-Plasma-DropUrlPatterns").toStringList(); QStringList urlPatterns = info.property(QStringLiteral("X-Plasma-DropUrlPatterns")).toStringList();
foreach (const QString &glob, urlPatterns) { foreach (const QString &glob, urlPatterns) {
QRegExp rx(glob); QRegExp rx(glob);
rx.setPatternSyntax(QRegExp::Wildcard); rx.setPatternSyntax(QRegExp::Wildcard);
@ -674,7 +676,7 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
QStringList categories; QStringList categories;
for (auto plugin : allApplets) { foreach (auto& plugin, allApplets) {
if (plugin.category().isEmpty()) { if (plugin.category().isEmpty()) {
if (!categories.contains(i18nc("misc category", "Miscellaneous"))) { if (!categories.contains(i18nc("misc category", "Miscellaneous"))) {
categories << i18nc("misc category", "Miscellaneous"); categories << i18nc("misc category", "Miscellaneous");
@ -721,8 +723,8 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type,
const QString &category, const QString &category,
const QString &parentApp) const QString &parentApp)
{ {
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) { if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new PlasmoidPackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new PlasmoidPackage());
} }
KConfigGroup group(KSharedConfig::openConfig(), "General"); KConfigGroup group(KSharedConfig::openConfig(), "General");
@ -753,8 +755,8 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type,
KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeType) KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeType)
{ {
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) { if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new DataEnginePackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new DataEnginePackage());
} }
auto filter = [&mimeType](const KPluginMetaData &md) -> bool auto filter = [&mimeType](const KPluginMetaData &md) -> bool
{ {
@ -767,14 +769,14 @@ KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeT
QStringList PluginLoader::listContainmentTypes() QStringList PluginLoader::listContainmentTypes()
{ {
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) { if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new DataEnginePackage()); KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new DataEnginePackage());
} }
KPluginInfo::List containmentInfos = listContainments(); KPluginInfo::List containmentInfos = listContainments();
QSet<QString> types; QSet<QString> types;
foreach (const KPluginInfo &containmentInfo, containmentInfos) { foreach (const KPluginInfo &containmentInfo, containmentInfos) {
QStringList theseTypes = containmentInfo.service()->property("X-Plasma-ContainmentType").toStringList(); QStringList theseTypes = containmentInfo.service()->property(QStringLiteral("X-Plasma-ContainmentType")).toStringList();
foreach (const QString &type, theseTypes) { foreach (const QString &type, theseTypes) {
types.insert(type); types.insert(type);
} }

View File

@ -123,9 +123,9 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
closeApplet->setText(i18nc("%1 is the name of the applet", "Remove this %1", q->title())); closeApplet->setText(i18nc("%1 is the name of the applet", "Remove this %1", q->title()));
} }
QAction *configAction = actions->action("configure"); QAction *configAction = actions->action(QStringLiteral("configure"));
if (configAction) { if (configAction) {
configAction->setText(i18nc("%1 is the name of the applet", "%1 Settings...", q->title().replace('&', "&&"))); configAction->setText(i18nc("%1 is the name of the applet", "%1 Settings...", q->title().replace(QLatin1Char('&'), QStringLiteral("&&"))));
} }
if (!appletDescription.isValid()) { if (!appletDescription.isValid()) {
@ -137,18 +137,18 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
return; return;
} }
QString api = appletDescription.property("X-Plasma-API").toString(); QString api = appletDescription.property(QStringLiteral("X-Plasma-API")).toString();
if (api.isEmpty()) { if (api.isEmpty()) {
q->setLaunchErrorMessage(i18n("The %1 widget did not define which ScriptEngine to use.", appletDescription.name())); q->setLaunchErrorMessage(i18n("The %1 widget did not define which ScriptEngine to use.", appletDescription.name()));
return; return;
} }
QString path = appletDescription.property("X-Plasma-RootPath").toString(); QString path = appletDescription.property(QStringLiteral("X-Plasma-RootPath")).toString();
if (path.isEmpty()) { if (path.isEmpty()) {
path = packagePath.isEmpty() ? appletDescription.pluginName() : packagePath; path = packagePath.isEmpty() ? appletDescription.pluginName() : packagePath;
} }
Plasma::Package p = PluginLoader::self()->loadPackage("Plasma/Applet", api); Plasma::Package p = PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"), api);
p.setPath(path); p.setPath(path);
package = new KPackage::Package(*p.d->internalPackage); package = new KPackage::Package(*p.d->internalPackage);
@ -185,7 +185,7 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
if (!q->isContainment() && q->pluginInfo().isValid()) { if (!q->isContainment() && q->pluginInfo().isValid()) {
QString constraint; QString constraint;
QStringList provides = q->pluginInfo().property("X-Plasma-Provides").toStringList(); QStringList provides = q->pluginInfo().property(QStringLiteral("X-Plasma-Provides")).toStringList();
if (!provides.isEmpty()) { if (!provides.isEmpty()) {
auto filter = [&provides](const KPluginMetaData &md) -> bool auto filter = [&provides](const KPluginMetaData &md) -> bool
{ {
@ -196,11 +196,11 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
} }
return false; return false;
}; };
QList<KPluginMetaData> applets = KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter); QList<KPluginMetaData> applets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
if (applets.count() > 1) { if (applets.count() > 1) {
QAction *a = new QAction(QIcon::fromTheme("preferences-desktop-default-applications"), i18n("Alternatives..."), q); QAction *a = new QAction(QIcon::fromTheme(QStringLiteral("preferences-desktop-default-applications")), i18n("Alternatives..."), q);
q->actions()->addAction("alternatives", a); q->actions()->addAction(QStringLiteral("alternatives"), a);
QObject::connect(a, &QAction::triggered,[=] { QObject::connect(a, &QAction::triggered,[=] {
if (q->containment()) { if (q->containment()) {
emit q->containment()->appletAlternativesRequested(q); emit q->containment()->appletAlternativesRequested(q);
@ -253,10 +253,10 @@ void AppletPrivate::askDestroy()
emit q->immutabilityChanged(q->immutability()); emit q->immutabilityChanged(q->immutability());
//no parent, but it won't leak, since it will be closed both in case of timeout //no parent, but it won't leak, since it will be closed both in case of timeout
//or direct action //or direct action
deleteNotification = new KNotification("plasmoidDeleted", KNotification::Persistent, 0); deleteNotification = new KNotification(QStringLiteral("plasmoidDeleted"), KNotification::Persistent, 0);
deleteNotification->setFlags(KNotification::SkipGrouping); deleteNotification->setFlags(KNotification::SkipGrouping);
deleteNotification->setComponentName("plasma_workspace"); deleteNotification->setComponentName(QStringLiteral("plasma_workspace"));
QStringList actions; QStringList actions;
deleteNotification->setIconName(q->icon()); deleteNotification->setIconName(q->icon());
Plasma::Containment *asContainment = qobject_cast<Plasma::Containment *>(q); Plasma::Containment *asContainment = qobject_cast<Plasma::Containment *>(q);
@ -358,27 +358,27 @@ void AppletPrivate::globalShortcutChanged()
KActionCollection *AppletPrivate::defaultActions(QObject *parent) KActionCollection *AppletPrivate::defaultActions(QObject *parent)
{ {
KActionCollection *actions = new KActionCollection(parent); KActionCollection *actions = new KActionCollection(parent);
actions->setConfigGroup("Shortcuts-Applet"); actions->setConfigGroup(QStringLiteral("Shortcuts-Applet"));
QAction *configAction = actions->add<QAction>("configure"); QAction *configAction = actions->add<QAction>(QStringLiteral("configure"));
configAction->setAutoRepeat(false); configAction->setAutoRepeat(false);
configAction->setText(i18n("Widget Settings")); configAction->setText(i18n("Widget Settings"));
configAction->setIcon(QIcon::fromTheme("configure")); configAction->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
configAction->setShortcut(QKeySequence("alt+d, s")); configAction->setShortcut(QKeySequence(QStringLiteral("alt+d, s")));
configAction->setData(Plasma::Types::ConfigureAction); configAction->setData(Plasma::Types::ConfigureAction);
QAction *closeApplet = actions->add<QAction>("remove"); QAction *closeApplet = actions->add<QAction>(QStringLiteral("remove"));
closeApplet->setAutoRepeat(false); closeApplet->setAutoRepeat(false);
closeApplet->setText(i18n("Remove this Widget")); closeApplet->setText(i18n("Remove this Widget"));
closeApplet->setIcon(QIcon::fromTheme("edit-delete")); closeApplet->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
closeApplet->setShortcut(QKeySequence("alt+d, r")); closeApplet->setShortcut(QKeySequence(QStringLiteral("alt+d, r")));
closeApplet->setData(Plasma::Types::DestructiveAction); closeApplet->setData(Plasma::Types::DestructiveAction);
QAction *runAssociatedApplication = actions->add<QAction>("run associated application"); QAction *runAssociatedApplication = actions->add<QAction>(QStringLiteral("run associated application"));
runAssociatedApplication->setAutoRepeat(false); runAssociatedApplication->setAutoRepeat(false);
runAssociatedApplication->setText(i18n("Run the Associated Application")); runAssociatedApplication->setText(i18n("Run the Associated Application"));
runAssociatedApplication->setIcon(QIcon::fromTheme("system-run")); runAssociatedApplication->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
runAssociatedApplication->setShortcut(QKeySequence("alt+d, t")); runAssociatedApplication->setShortcut(QKeySequence(QStringLiteral("alt+d, t")));
runAssociatedApplication->setVisible(false); runAssociatedApplication->setVisible(false);
runAssociatedApplication->setEnabled(false); runAssociatedApplication->setEnabled(false);
runAssociatedApplication->setData(Plasma::Types::ControlAction); runAssociatedApplication->setData(Plasma::Types::ControlAction);
@ -400,7 +400,7 @@ void AppletPrivate::updateShortcuts()
//we pull them out, then read, then put them back //we pull them out, then read, then put them back
QList<QString> names; QList<QString> names;
QList<QAction *> qactions; QList<QAction *> qactions;
names << "add sibling containment" << "configure shortcuts" << "lock widgets"; names << QStringLiteral("add sibling containment") << QStringLiteral("configure shortcuts") << QStringLiteral("lock widgets");
foreach (const QString &name, names) { foreach (const QString &name, names) {
QAction *a = actions->action(name); QAction *a = actions->action(name);
actions->takeAction(a); //FIXME this is stupid, KActionCollection needs a takeAction(QString) method actions->takeAction(a); //FIXME this is stupid, KActionCollection needs a takeAction(QString) method

View File

@ -71,7 +71,7 @@ public:
QHash<const Plasma::Applet *, QList<QUrl> >::iterator i; QHash<const Plasma::Applet *, QList<QUrl> >::iterator i;
for (i = urlLists.begin(); i != urlLists.end(); ++i) { for (i = urlLists.begin(); i != urlLists.end(); ++i) {
QAction *a = i.key()->actions()->action("run associated application"); QAction *a = i.key()->actions()->action(QStringLiteral("run associated application"));
if (a) { if (a) {
const QString mimeType = mimeDb.mimeTypeForUrl(i.value().first()).name(); const QString mimeType = mimeDb.mimeTypeForUrl(i.value().first()).name();
const KService::List apps = KMimeTypeTrader::self()->query(mimeType); const KService::List apps = KMimeTypeTrader::self()->query(mimeType);
@ -79,7 +79,7 @@ public:
a->setIcon(QIcon::fromTheme(apps.first()->icon())); a->setIcon(QIcon::fromTheme(apps.first()->icon()));
a->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name())); a->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name()));
} else { } else {
a->setIcon(QIcon::fromTheme("system-run")); a->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
a->setText(i18n("Run the Associated Application")); a->setText(i18n("Run the Associated Application"));
} }
} }
@ -121,9 +121,9 @@ void AssociatedApplicationManager::setApplication(Plasma::Applet *applet, const
if (service || !QStandardPaths::findExecutable(application).isNull() || QFile::exists(application)) { if (service || !QStandardPaths::findExecutable(application).isNull() || QFile::exists(application)) {
d->applicationNames[applet] = application; d->applicationNames[applet] = application;
if (d->urlLists.contains(applet)) { if (d->urlLists.contains(applet)) {
QAction *a = applet->actions()->action("run associated application"); QAction *a = applet->actions()->action(QStringLiteral("run associated application"));
if (a) { if (a) {
a->setIcon(QIcon::fromTheme("system-run")); a->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
a->setText(i18n("Run the Associated Application")); a->setText(i18n("Run the Associated Application"));
} }
} }
@ -140,7 +140,7 @@ void AssociatedApplicationManager::setUrls(Plasma::Applet *applet, const QList<Q
{ {
d->urlLists[applet] = urls; d->urlLists[applet] = urls;
if (!d->applicationNames.contains(applet)) { if (!d->applicationNames.contains(applet)) {
QAction *a = applet->actions()->action("run associated application"); QAction *a = applet->actions()->action(QStringLiteral("run associated application"));
if (a) { if (a) {
QMimeDatabase mimeDb; QMimeDatabase mimeDb;
const QString mimeType = mimeDb.mimeTypeForUrl(urls.first()).name(); const QString mimeType = mimeDb.mimeTypeForUrl(urls.first()).name();
@ -149,7 +149,7 @@ void AssociatedApplicationManager::setUrls(Plasma::Applet *applet, const QList<Q
a->setIcon(QIcon::fromTheme(apps.first()->icon())); a->setIcon(QIcon::fromTheme(apps.first()->icon()));
a->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name())); a->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name()));
} else { } else {
a->setIcon(QIcon::fromTheme("system-run")); a->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
a->setText(i18n("Run the Associated Application")); a->setText(i18n("Run the Associated Application"));
} }
} }

View File

@ -75,9 +75,9 @@ void ComponentInstaller::installMissingComponent(const QString &type,
d->alreadyPrompted.insert(searchString); d->alreadyPrompted.insert(searchString);
QDBusInterface packageKit(QLatin1String("org.freedesktop.PackageKit"), QDBusInterface packageKit(QStringLiteral("org.freedesktop.PackageKit"),
QLatin1String("/org/freedesktop/PackageKit"), QStringLiteral("/org/freedesktop/PackageKit"),
QLatin1String("org.freedesktop.PackageKit.Modify")); QStringLiteral("org.freedesktop.PackageKit.Modify"));
// We don't check packageKit.isValid() because the service is activated on // We don't check packageKit.isValid() because the service is activated on
// demand, so it will show up as "not valid". // demand, so it will show up as "not valid".
WId wid = 0; WId wid = 0;
@ -86,7 +86,7 @@ void ComponentInstaller::installMissingComponent(const QString &type,
} }
QStringList resources; QStringList resources;
resources.append(searchString); resources.append(searchString);
packageKit.asyncCall(QLatin1String("InstallResources"), (unsigned int) wid, packageKit.asyncCall(QStringLiteral("InstallResources"), (unsigned int) wid,
QLatin1String("plasma-service"), resources, QString()); QLatin1String("plasma-service"), resources, QString());
#else #else
Q_UNUSED(type); Q_UNUSED(type);

View File

@ -72,7 +72,7 @@ Plasma::ContainmentPrivate::~ContainmentPrivate()
void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containment *c) void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containment *c)
{ {
actions->setConfigGroup(QLatin1String("Shortcuts-Containment")); actions->setConfigGroup(QStringLiteral("Shortcuts-Containment"));
//adjust applet actions //adjust applet actions
QAction *appAction = qobject_cast<QAction *>(actions->action(QStringLiteral("remove"))); QAction *appAction = qobject_cast<QAction *>(actions->action(QStringLiteral("remove")));
@ -90,10 +90,10 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
} }
//add our own actions //add our own actions
QAction *appletBrowserAction = actions->add<QAction>(QLatin1String("add widgets")); QAction *appletBrowserAction = actions->add<QAction>(QStringLiteral("add widgets"));
appletBrowserAction->setAutoRepeat(false); appletBrowserAction->setAutoRepeat(false);
appletBrowserAction->setText(i18n("Add Widgets...")); appletBrowserAction->setText(i18n("Add Widgets..."));
appletBrowserAction->setIcon(QIcon::fromTheme(QLatin1String("list-add"))); appletBrowserAction->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
appletBrowserAction->setShortcut(QKeySequence(Qt::ALT+Qt::Key_D, Qt::Key_A)); appletBrowserAction->setShortcut(QKeySequence(Qt::ALT+Qt::Key_D, Qt::Key_A));
appletBrowserAction->setData(Plasma::Types::AddAction); appletBrowserAction->setData(Plasma::Types::AddAction);
} }
@ -147,13 +147,13 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Types::Constraints
//update actions //update actions
const bool unlocked = q->immutability() == Types::Mutable; const bool unlocked = q->immutability() == Types::Mutable;
QAction *action = q->actions()->action("remove"); QAction *action = q->actions()->action(QStringLiteral("remove"));
if (action) { if (action) {
action->setEnabled(unlocked); action->setEnabled(unlocked);
action->setVisible(unlocked); action->setVisible(unlocked);
} }
action = q->actions()->action("add widgets"); action = q->actions()->action(QStringLiteral("add widgets"));
if (action) { if (action) {
action->setEnabled(unlocked); action->setEnabled(unlocked);
action->setVisible(unlocked); action->setVisible(unlocked);

View File

@ -137,7 +137,7 @@ Plasma::DataEngine *DataEngineManager::loadEngine(const QString &name)
if (!engine) { if (!engine) {
qCDebug(LOG_PLASMA) << "Can't find a dataengine named" << name; qCDebug(LOG_PLASMA) << "Can't find a dataengine named" << name;
// Try installing the engine. However, it's too late for this request. // Try installing the engine. However, it's too late for this request.
ComponentInstaller::self()->installMissingComponent("dataengine", name); ComponentInstaller::self()->installMissingComponent(QStringLiteral("dataengine"), name);
return d->nullEngine(); return d->nullEngine();
} }

View File

@ -42,13 +42,13 @@ namespace Plasma
void ChangeableMainScriptPackage::initPackage(KPackage::Package *package) void ChangeableMainScriptPackage::initPackage(KPackage::Package *package)
{ {
package->addFileDefinition("mainscript", "ui/main.qml", i18n("Main Script File")); package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File"));
package->setRequired("mainscript", true); package->setRequired("mainscript", true);
} }
QString ChangeableMainScriptPackage::mainScriptConfigKey() const QString ChangeableMainScriptPackage::mainScriptConfigKey() const
{ {
return QLatin1String("X-Plasma-MainScript"); return QStringLiteral("X-Plasma-MainScript");
} }
void ChangeableMainScriptPackage::pathChanged(KPackage::Package *package) void ChangeableMainScriptPackage::pathChanged(KPackage::Package *package)
@ -78,44 +78,44 @@ void GenericPackage::initPackage(KPackage::Package *package)
it.setValue("platformcontents/" + it.value()); it.setValue("platformcontents/" + it.value());
} }
platform.append("contents"); platform.append(QStringLiteral("contents"));
package->setContentsPrefixPaths(platform); package->setContentsPrefixPaths(platform);
} }
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/"); package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/"));
package->addDirectoryDefinition("images", "images", i18n("Images")); package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images"));
package->addDirectoryDefinition("theme", "theme", i18n("Themed Images")); package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images"));
QStringList mimetypes; QStringList mimetypes;
mimetypes << "image/svg+xml" << "image/png" << "image/jpeg"; mimetypes << QStringLiteral("image/svg+xml") << QStringLiteral("image/png") << QStringLiteral("image/jpeg");
package->setMimeTypes("images", mimetypes); package->setMimeTypes("images", mimetypes);
package->setMimeTypes("theme", mimetypes); package->setMimeTypes("theme", mimetypes);
package->addDirectoryDefinition("config", "config", i18n("Configuration Definitions")); package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
mimetypes.clear(); mimetypes.clear();
mimetypes << "text/xml"; mimetypes << QStringLiteral("text/xml");
package->setMimeTypes("config", mimetypes); package->setMimeTypes("config", mimetypes);
package->addDirectoryDefinition("ui", "ui", i18n("User Interface")); package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface"));
package->addDirectoryDefinition("data", "data", i18n("Data Files")); package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files"));
package->addDirectoryDefinition("scripts", "code", i18n("Executable Scripts")); package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts"));
mimetypes.clear(); mimetypes.clear();
mimetypes << "text/plain"; mimetypes << QStringLiteral("text/plain");
package->setMimeTypes("scripts", mimetypes); package->setMimeTypes("scripts", mimetypes);
package->addFileDefinition("screenshot", "screenshot.png", i18n("Screenshot")); package->addFileDefinition("screenshot", QStringLiteral("screenshot.png"), i18n("Screenshot"));
package->addDirectoryDefinition("translations", "locale", i18n("Translations")); package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations"));
} }
void PlasmoidPackage::initPackage(KPackage::Package *package) void PlasmoidPackage::initPackage(KPackage::Package *package)
{ {
GenericPackage::initPackage(package); GenericPackage::initPackage(package);
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/"); package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/"));
package->addFileDefinition("configmodel", "config/config.qml", i18n("Configuration UI pages model")); package->addFileDefinition("configmodel", QStringLiteral("config/config.qml"), i18n("Configuration UI pages model"));
package->addFileDefinition("mainconfigxml", "config/main.xml", i18n("Configuration XML file")); package->addFileDefinition("mainconfigxml", QStringLiteral("config/main.xml"), i18n("Configuration XML file"));
} }
void PlasmoidPackage::pathChanged(KPackage::Package *package) void PlasmoidPackage::pathChanged(KPackage::Package *package)
@ -125,8 +125,8 @@ void PlasmoidPackage::pathChanged(KPackage::Package *package)
if (!package->metadata().isValid()) { if (!package->metadata().isValid()) {
return; return;
} }
if (package->metadata().serviceTypes().contains("Plasma/Containment")) { if (package->metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) {
package->addFileDefinition("compactapplet", "applet/CompactApplet.qml", i18n("Custom expander for compact applets")); package->addFileDefinition("compactapplet", QStringLiteral("applet/CompactApplet.qml"), i18n("Custom expander for compact applets"));
} else { } else {
package->removeDefinition("compactapplet"); package->removeDefinition("compactapplet");
} }
@ -135,19 +135,19 @@ void PlasmoidPackage::pathChanged(KPackage::Package *package)
void DataEnginePackage::initPackage(KPackage::Package *package) void DataEnginePackage::initPackage(KPackage::Package *package)
{ {
ChangeableMainScriptPackage::initPackage(package); ChangeableMainScriptPackage::initPackage(package);
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/"); package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/"));
package->addDirectoryDefinition("data", "data", i18n("Data Files")); package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files"));
package->addDirectoryDefinition("scripts", "code", i18n("Executable Scripts")); package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts"));
QStringList mimetypes; QStringList mimetypes;
mimetypes << "text/plain"; mimetypes << QStringLiteral("text/plain");
package->setMimeTypes("scripts", mimetypes); package->setMimeTypes("scripts", mimetypes);
package->addDirectoryDefinition("services", "services/", i18n("Service Descriptions")); package->addDirectoryDefinition("services", QStringLiteral("services/"), i18n("Service Descriptions"));
package->setMimeTypes("services", mimetypes); package->setMimeTypes("services", mimetypes);
package->addDirectoryDefinition("translations", "locale", i18n("Translations")); package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations"));
} }
void ThemePackage::initPackage(KPackage::Package *package) void ThemePackage::initPackage(KPackage::Package *package)
@ -156,104 +156,104 @@ void ThemePackage::initPackage(KPackage::Package *package)
// but for the themes we don't want that, so unset it. // but for the themes we don't want that, so unset it.
package->setContentsPrefixPaths(QStringList()); package->setContentsPrefixPaths(QStringList());
package->addDirectoryDefinition("dialogs", "dialogs/", i18n("Images for dialogs")); package->addDirectoryDefinition("dialogs", QStringLiteral("dialogs/"), i18n("Images for dialogs"));
package->addFileDefinition("dialogs/background", "dialogs/background.svg", package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svg"),
i18n("Generic dialog background")); i18n("Generic dialog background"));
package->addFileDefinition("dialogs/background", "dialogs/background.svgz", package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svgz"),
i18n("Generic dialog background")); i18n("Generic dialog background"));
package->addFileDefinition("dialogs/shutdowndialog", "dialogs/shutdowndialog.svg", package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svg"),
i18n("Theme for the logout dialog")); i18n("Theme for the logout dialog"));
package->addFileDefinition("dialogs/shutdowndialog", "dialogs/shutdowndialog.svgz", package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svgz"),
i18n("Theme for the logout dialog")); i18n("Theme for the logout dialog"));
package->addDirectoryDefinition("wallpapers", "wallpapers/", i18n("Wallpaper packages")); package->addDirectoryDefinition("wallpapers", QStringLiteral("wallpapers/"), i18n("Wallpaper packages"));
package->addDirectoryDefinition("widgets", "widgets/", i18n("Images for widgets")); package->addDirectoryDefinition("widgets", QStringLiteral("widgets/"), i18n("Images for widgets"));
package->addFileDefinition("widgets/background", "widgets/background.svg", package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svg"),
i18n("Background image for widgets")); i18n("Background image for widgets"));
package->addFileDefinition("widgets/background", "widgets/background.svgz", package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svgz"),
i18n("Background image for widgets")); i18n("Background image for widgets"));
package->addFileDefinition("widgets/clock", "widgets/clock.svg", package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svg"),
i18n("Analog clock face")); i18n("Analog clock face"));
package->addFileDefinition("widgets/clock", "widgets/clock.svgz", package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svgz"),
i18n("Analog clock face")); i18n("Analog clock face"));
package->addFileDefinition("widgets/panel-background", "widgets/panel-background.svg", package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svg"),
i18n("Background image for panels")); i18n("Background image for panels"));
package->addFileDefinition("widgets/panel-background", "widgets/panel-background.svgz", package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svgz"),
i18n("Background image for panels")); i18n("Background image for panels"));
package->addFileDefinition("widgets/plot-background", "widgets/plot-background.svg", package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svg"),
i18n("Background for graphing widgets")); i18n("Background for graphing widgets"));
package->addFileDefinition("widgets/plot-background", "widgets/plot-background.svgz", package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svgz"),
i18n("Background for graphing widgets")); i18n("Background for graphing widgets"));
package->addFileDefinition("widgets/tooltip", "widgets/tooltip.svg", package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svg"),
i18n("Background image for tooltips")); i18n("Background image for tooltips"));
package->addFileDefinition("widgets/tooltip", "widgets/tooltip.svgz", package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svgz"),
i18n("Background image for tooltips")); i18n("Background image for tooltips"));
package->addDirectoryDefinition("opaque/dialogs", "opaque/dialogs/", i18n("Opaque images for dialogs")); package->addDirectoryDefinition("opaque/dialogs", QStringLiteral("opaque/dialogs/"), i18n("Opaque images for dialogs"));
package->addFileDefinition("opaque/dialogs/background", "opaque/dialogs/background.svg", package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svg"),
i18n("Opaque generic dialog background")); i18n("Opaque generic dialog background"));
package->addFileDefinition("opaque/dialogs/background", "opaque/dialogs/background.svgz", package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svgz"),
i18n("Opaque generic dialog background")); i18n("Opaque generic dialog background"));
package->addFileDefinition("opaque/dialogs/shutdowndialog", "opaque/dialogs/shutdowndialog.svg", package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svg"),
i18n("Opaque theme for the logout dialog")); i18n("Opaque theme for the logout dialog"));
package->addFileDefinition("opaque/dialogs/shutdowndialog", "opaque/dialogs/shutdowndialog.svgz", package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svgz"),
i18n("Opaque theme for the logout dialog")); i18n("Opaque theme for the logout dialog"));
package->addDirectoryDefinition("opaque/widgets", "opaque/widgets/", i18n("Opaque images for widgets")); package->addDirectoryDefinition("opaque/widgets", QStringLiteral("opaque/widgets/"), i18n("Opaque images for widgets"));
package->addFileDefinition("opaque/widgets/panel-background", "opaque/widgets/panel-background.svg", package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svg"),
i18n("Opaque background image for panels")); i18n("Opaque background image for panels"));
package->addFileDefinition("opaque/widgets/panel-background", "opaque/widgets/panel-background.svgz", package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svgz"),
i18n("Opaque background image for panels")); i18n("Opaque background image for panels"));
package->addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svg", package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svg"),
i18n("Opaque background image for tooltips")); i18n("Opaque background image for tooltips"));
package->addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svgz", package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svgz"),
i18n("Opaque background image for tooltips")); i18n("Opaque background image for tooltips"));
package->addDirectoryDefinition("locolor/dialogs", "locolor/dialogs/", package->addDirectoryDefinition("locolor/dialogs", QStringLiteral("locolor/dialogs/"),
i18n("Low color images for dialogs")); i18n("Low color images for dialogs"));
package->addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svg", package->addFileDefinition("locolor/dialogs/background", QStringLiteral("locolor/dialogs/background.svg"),
i18n("Low color generic dialog background")); i18n("Low color generic dialog background"));
package->addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svgz", package->addFileDefinition("locolor/dialogs/background", QStringLiteral("locolor/dialogs/background.svgz"),
i18n("Low color generic dialog background")); i18n("Low color generic dialog background"));
package->addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svg", package->addFileDefinition("locolor/dialogs/shutdowndialog", QStringLiteral("locolor/dialogs/shutdowndialog.svg"),
i18n("Low color theme for the logout dialog")); i18n("Low color theme for the logout dialog"));
package->addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svgz", package->addFileDefinition("locolor/dialogs/shutdowndialog", QStringLiteral("locolor/dialogs/shutdowndialog.svgz"),
i18n("Low color theme for the logout dialog")); i18n("Low color theme for the logout dialog"));
package->addDirectoryDefinition("locolor/widgets", "locolor/widgets/", i18n("Images for widgets")); package->addDirectoryDefinition("locolor/widgets", QStringLiteral("locolor/widgets/"), i18n("Images for widgets"));
package->addFileDefinition("locolor/widgets/background", "locolor/widgets/background.svg", package->addFileDefinition("locolor/widgets/background", QStringLiteral("locolor/widgets/background.svg"),
i18n("Low color background image for widgets")); i18n("Low color background image for widgets"));
package->addFileDefinition("locolor/widgets/background", "locolor/widgets/background.svgz", package->addFileDefinition("locolor/widgets/background", QStringLiteral("locolor/widgets/background.svgz"),
i18n("Low color background image for widgets")); i18n("Low color background image for widgets"));
package->addFileDefinition("locolor/widgets/clock", "locolor/widgets/clock.svg", package->addFileDefinition("locolor/widgets/clock", QStringLiteral("locolor/widgets/clock.svg"),
i18n("Low color analog clock face")); i18n("Low color analog clock face"));
package->addFileDefinition("locolor/widgets/clock", "locolor/widgets/clock.svgz", package->addFileDefinition("locolor/widgets/clock", QStringLiteral("locolor/widgets/clock.svgz"),
i18n("Low color analog clock face")); i18n("Low color analog clock face"));
package->addFileDefinition("locolor/widgets/panel-background", "locolor/widgets/panel-background.svg", package->addFileDefinition("locolor/widgets/panel-background", QStringLiteral("locolor/widgets/panel-background.svg"),
i18n("Low color background image for panels")); i18n("Low color background image for panels"));
package->addFileDefinition("locolor/widgets/panel-background", "locolor/widgets/panel-background.svgz", package->addFileDefinition("locolor/widgets/panel-background", QStringLiteral("locolor/widgets/panel-background.svgz"),
i18n("Low color background image for panels")); i18n("Low color background image for panels"));
package->addFileDefinition("locolor/widgets/plot-background", "locolor/widgets/plot-background.svg", package->addFileDefinition("locolor/widgets/plot-background", QStringLiteral("locolor/widgets/plot-background.svg"),
i18n("Low color background for graphing widgets")); i18n("Low color background for graphing widgets"));
package->addFileDefinition("locolor/widgets/plot-background", "locolor/widgets/plot-background.svgz", package->addFileDefinition("locolor/widgets/plot-background", QStringLiteral("locolor/widgets/plot-background.svgz"),
i18n("Low color background for graphing widgets")); i18n("Low color background for graphing widgets"));
package->addFileDefinition("locolor/widgets/tooltip", "locolor/widgets/tooltip.svg", package->addFileDefinition("locolor/widgets/tooltip", QStringLiteral("locolor/widgets/tooltip.svg"),
i18n("Low color background image for tooltips")); i18n("Low color background image for tooltips"));
package->addFileDefinition("locolor/widgets/tooltip", "locolor/widgets/tooltip.svgz", package->addFileDefinition("locolor/widgets/tooltip", QStringLiteral("locolor/widgets/tooltip.svgz"),
i18n("Low color background image for tooltips")); i18n("Low color background image for tooltips"));
package->addFileDefinition("colors", "colors", i18n("KColorScheme configuration file")); package->addFileDefinition("colors", QStringLiteral("colors"), i18n("KColorScheme configuration file"));
QStringList mimetypes; QStringList mimetypes;
mimetypes << "image/svg+xml"; mimetypes << QStringLiteral("image/svg+xml");
package->setDefaultMimeTypes(mimetypes); package->setDefaultMimeTypes(mimetypes);
} }
void ContainmentActionsPackage::initPackage(KPackage::Package *package) void ContainmentActionsPackage::initPackage(KPackage::Package *package)
{ {
ChangeableMainScriptPackage::initPackage(package); ChangeableMainScriptPackage::initPackage(package);
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions/"); package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions/"));
} }
} // namespace Plasma } // namespace Plasma

View File

@ -56,7 +56,7 @@ public:
: Service(parent) : Service(parent)
{ {
setDestination(target); setDestination(target);
setName("NullService"); setName(QStringLiteral("NullService"));
} }
ServiceJob *createJob(const QString &operation, QVariantMap &) Q_DECL_OVERRIDE ServiceJob *createJob(const QString &operation, QVariantMap &) Q_DECL_OVERRIDE

View File

@ -75,19 +75,19 @@ void StorageJob::start()
//FIXME: QHASH //FIXME: QHASH
QVariantMap params = parameters(); QVariantMap params = parameters();
QString valueGroup = params["group"].toString(); QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) { if (valueGroup.isEmpty()) {
valueGroup = "default"; valueGroup = QStringLiteral("default");
} }
QWeakPointer<StorageJob> me(this); QWeakPointer<StorageJob> me(this);
if (operationName() == "save") { if (operationName() == QLatin1String("save")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "save", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params)); QMetaObject::invokeMethod(Plasma::StorageThread::self(), "save", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params));
} else if (operationName() == "retrieve") { } else if (operationName() == QLatin1String("retrieve")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "retrieve", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params)); QMetaObject::invokeMethod(Plasma::StorageThread::self(), "retrieve", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params));
} else if (operationName() == "delete") { } else if (operationName() == QLatin1String("delete")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "deleteEntry", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params)); QMetaObject::invokeMethod(Plasma::StorageThread::self(), "deleteEntry", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params));
} else if (operationName() == "expire") { } else if (operationName() == QLatin1String("expire")) {
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "expire", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params)); QMetaObject::invokeMethod(Plasma::StorageThread::self(), "expire", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap &, params));
} else { } else {
setError(true); setError(true);
@ -117,7 +117,7 @@ Plasma::ServiceJob *Storage::createJob(const QString &operation, QVariantMap &pa
//Storage implementation //Storage implementation
Storage::Storage(QObject *parent) Storage::Storage(QObject *parent)
: Plasma::Service(parent), : Plasma::Service(parent),
m_clientName("data") m_clientName(QStringLiteral("data"))
{ {
//search among parents for an applet or dataengine: if found call the table as its plugin name //search among parents for an applet or dataengine: if found call the table as its plugin name
QObject *parentObject = this; QObject *parentObject = this;
@ -136,10 +136,10 @@ Storage::Storage(QObject *parent)
} }
} }
m_clientName = m_clientName.replace('.', "_"); m_clientName = m_clientName.replace(QLatin1Char('.'), QLatin1Char('_'));
m_clientName = m_clientName.replace('-', "_"); m_clientName = m_clientName.replace(QLatin1Char('-'), QLatin1Char('_'));
setName("storage"); setName(QStringLiteral("storage"));
} }
Storage::~Storage() Storage::~Storage()

View File

@ -78,7 +78,7 @@ void StorageThread::closeDb()
void StorageThread::initializeDb(StorageJob *caller) void StorageThread::initializeDb(StorageJob *caller)
{ {
if (!m_db.open()) { if (!m_db.open()) {
m_db = QSqlDatabase::addDatabase("QSQLITE", QString("plasma-storage-%1").arg((quintptr)this)); m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), QStringLiteral("plasma-storage-%1").arg((quintptr)this));
const QString storageDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation); const QString storageDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
QDir().mkpath(storageDir); QDir().mkpath(storageDir);
m_db.setDatabaseName(storageDir + QLatin1Char('/') + "plasma-storage2.db"); m_db.setDatabaseName(storageDir + QLatin1Char('/') + "plasma-storage2.db");
@ -88,7 +88,7 @@ void StorageThread::initializeDb(StorageJob *caller)
qCWarning(LOG_PLASMA) << "Unable to open the plasma storage cache database: " << m_db.lastError(); qCWarning(LOG_PLASMA) << "Unable to open the plasma storage cache database: " << m_db.lastError();
} else if (!m_db.tables().contains(caller->clientName())) { } else if (!m_db.tables().contains(caller->clientName())) {
QSqlQuery query(m_db); QSqlQuery query(m_db);
query.prepare(QString("create table ") + caller->clientName() + " (valueGroup varchar(256), id varchar(256), txt TEXT, int INTEGER, float REAL, binary BLOB, creationTime datetime, accessTime datetime, primary key (valueGroup, id))"); query.prepare(QStringLiteral("create table ") + caller->clientName() + " (valueGroup varchar(256), id varchar(256), txt TEXT, int INTEGER, float REAL, binary BLOB, creationTime datetime, accessTime datetime, primary key (valueGroup, id))");
if (!query.exec()) { if (!query.exec()) {
qCWarning(LOG_PLASMA) << "Unable to create table for" << caller->clientName(); qCWarning(LOG_PLASMA) << "Unable to create table for" << caller->clientName();
m_db.close(); m_db.close();
@ -105,13 +105,13 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
} }
initializeDb(caller); initializeDb(caller);
QString valueGroup = params["group"].toString(); QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) { if (valueGroup.isEmpty()) {
valueGroup = "default"; valueGroup = QStringLiteral("default");
} }
QSqlQuery query(m_db); QSqlQuery query(m_db);
if (params.value("key").toString().isNull()) { if (params.value(QStringLiteral("key")).toString().isNull()) {
caller->data().insert(params.value("key").toString(), params.value("data")); caller->data().insert(params.value(QStringLiteral("key")).toString(), params.value(QStringLiteral("data")));
} }
QMapIterator<QString, QVariant> it(caller->data()); QMapIterator<QString, QVariant> it(caller->data());
@ -119,7 +119,7 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
QString ids; QString ids;
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
QSqlField field(":id", QVariant::String); QSqlField field(QStringLiteral(":id"), QVariant::String);
field.setValue(it.key()); field.setValue(it.key());
if (!ids.isEmpty()) { if (!ids.isEmpty()) {
ids.append(", "); ids.append(", ");
@ -128,7 +128,7 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
} }
query.prepare("delete from " + caller->clientName() + " where valueGroup = :valueGroup and id in (" + ids + ");"); query.prepare("delete from " + caller->clientName() + " where valueGroup = :valueGroup and id in (" + ids + ");");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
if (!query.exec()) { if (!query.exec()) {
m_db.commit(); m_db.commit();
@ -137,39 +137,39 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
} }
query.prepare("insert into " + caller->clientName() + " values(:valueGroup, :id, :txt, :int, :float, :binary, date('now'), date('now'))"); query.prepare("insert into " + caller->clientName() + " values(:valueGroup, :id, :txt, :int, :float, :binary, date('now'), date('now'))");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(":txt", QVariant()); query.bindValue(QStringLiteral(":txt"), QVariant());
query.bindValue(":int", QVariant()); query.bindValue(QStringLiteral(":int"), QVariant());
query.bindValue(":float", QVariant()); query.bindValue(QStringLiteral(":float"), QVariant());
query.bindValue(":binary", QVariant()); query.bindValue(QStringLiteral(":binary"), QVariant());
const QString key = params.value("key").toString(); const QString key = params.value(QStringLiteral("key")).toString();
if (!key.isEmpty()) { if (!key.isEmpty()) {
caller->data().insert(key, params["data"]); caller->data().insert(key, params[QStringLiteral("data")]);
} }
it.toFront(); it.toFront();
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
//qCDebug(LOG_PLASMA) << "going to insert" << valueGroup << it.key(); //qCDebug(LOG_PLASMA) << "going to insert" << valueGroup << it.key();
query.bindValue(":id", it.key()); query.bindValue(QStringLiteral(":id"), it.key());
QString field; QString field;
bool binary = false; bool binary = false;
switch (QMetaType::Type(it.value().type())) { switch (QMetaType::Type(it.value().type())) {
case QVariant::String: case QVariant::String:
field = ":txt"; field = QStringLiteral(":txt");
break; break;
case QVariant::Int: case QVariant::Int:
field = ":int"; field = QStringLiteral(":int");
break; break;
case QVariant::Double: case QVariant::Double:
case QMetaType::Float: case QMetaType::Float:
field = ":float"; field = QStringLiteral(":float");
break; break;
case QVariant::ByteArray: case QVariant::ByteArray:
binary = true; binary = true;
field = ":binary"; field = QStringLiteral(":binary");
break; break;
default: default:
continue; continue;
@ -208,32 +208,32 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap
const QString clientName = caller->clientName(); const QString clientName = caller->clientName();
initializeDb(caller); initializeDb(caller);
QString valueGroup = params["group"].toString(); QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) { if (valueGroup.isEmpty()) {
valueGroup = "default"; valueGroup = QStringLiteral("default");
} }
QSqlQuery query(m_db); QSqlQuery query(m_db);
//a bit redundant but should be the faster way with less string concatenation as possible //a bit redundant but should be the faster way with less string concatenation as possible
if (params["key"].toString().isEmpty()) { if (params[QStringLiteral("key")].toString().isEmpty()) {
//update modification time //update modification time
query.prepare("update " + clientName + " set accessTime=date('now') where valueGroup=:valueGroup"); query.prepare("update " + clientName + " set accessTime=date('now') where valueGroup=:valueGroup");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.exec(); query.exec();
query.prepare("select * from " + clientName + " where valueGroup=:valueGroup"); query.prepare("select * from " + clientName + " where valueGroup=:valueGroup");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
} else { } else {
//update modification time //update modification time
query.prepare("update " + clientName + " set accessTime=date('now') where valueGroup=:valueGroup and id=:key"); query.prepare("update " + clientName + " set accessTime=date('now') where valueGroup=:valueGroup and id=:key");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(":key", params["key"].toString()); query.bindValue(QStringLiteral(":key"), params[QStringLiteral("key")].toString());
query.exec(); query.exec();
query.prepare("select * from " + clientName + " where valueGroup=:valueGroup and id=:key"); query.prepare("select * from " + clientName + " where valueGroup=:valueGroup and id=:key");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(":key", params["key"].toString()); query.bindValue(QStringLiteral(":key"), params[QStringLiteral("key")].toString());
} }
const bool success = query.exec(); const bool success = query.exec();
@ -242,11 +242,11 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap
if (success) { if (success) {
QSqlRecord rec = query.record(); QSqlRecord rec = query.record();
const int keyColumn = rec.indexOf("id"); const int keyColumn = rec.indexOf(QStringLiteral("id"));
const int textColumn = rec.indexOf("txt"); const int textColumn = rec.indexOf(QStringLiteral("txt"));
const int intColumn = rec.indexOf("int"); const int intColumn = rec.indexOf(QStringLiteral("int"));
const int floatColumn = rec.indexOf("float"); const int floatColumn = rec.indexOf(QStringLiteral("float"));
const int binaryColumn = rec.indexOf("binary"); const int binaryColumn = rec.indexOf(QStringLiteral("binary"));
QVariantMap data; QVariantMap data;
while (query.next()) { while (query.next()) {
@ -280,20 +280,20 @@ void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariant
} }
initializeDb(caller); initializeDb(caller);
QString valueGroup = params["group"].toString(); QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) { if (valueGroup.isEmpty()) {
valueGroup = "default"; valueGroup = QStringLiteral("default");
} }
QSqlQuery query(m_db); QSqlQuery query(m_db);
if (params["key"].toString().isEmpty()) { if (params[QStringLiteral("key")].toString().isEmpty()) {
query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup"); query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
} else { } else {
query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup and id=:key"); query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup and id=:key");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(":key", params["key"].toString()); query.bindValue(QStringLiteral(":key"), params[QStringLiteral("key")].toString());
} }
const bool success = query.exec(); const bool success = query.exec();
@ -310,21 +310,21 @@ void StorageThread::expire(QWeakPointer<StorageJob> wcaller, const QVariantMap &
} }
initializeDb(caller); initializeDb(caller);
QString valueGroup = params["group"].toString(); QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) { if (valueGroup.isEmpty()) {
valueGroup = "default"; valueGroup = QStringLiteral("default");
} }
QSqlQuery query(m_db); QSqlQuery query(m_db);
if (valueGroup.isEmpty()) { if (valueGroup.isEmpty()) {
query.prepare("delete from " + caller->clientName() + " where accessTime < :date"); query.prepare("delete from " + caller->clientName() + " where accessTime < :date");
QDateTime time(QDateTime::currentDateTime().addSecs(-params["age"].toUInt())); QDateTime time(QDateTime::currentDateTime().addSecs(-params[QStringLiteral("age")].toUInt()));
query.bindValue(":date", time.toTime_t()); query.bindValue(QStringLiteral(":date"), time.toTime_t());
} else { } else {
query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup and accessTime < :date"); query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup and accessTime < :date");
query.bindValue(":valueGroup", valueGroup); query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
QDateTime time(QDateTime::currentDateTime().addSecs(-params["age"].toUInt())); QDateTime time(QDateTime::currentDateTime().addSecs(-params[QStringLiteral("age")].toUInt()));
query.bindValue(":date", time.toTime_t()); query.bindValue(QStringLiteral(":date"), time.toTime_t());
} }
const bool success = query.exec(); const bool success = query.exec();

View File

@ -33,6 +33,7 @@ class Svg;
class SharedSvgRenderer : public QSvgRenderer, public QSharedData class SharedSvgRenderer : public QSvgRenderer, public QSharedData
{ {
Q_OBJECT
public: public:
typedef QExplicitlySharedDataPointer<SharedSvgRenderer> Ptr; typedef QExplicitlySharedDataPointer<SharedSvgRenderer> Ptr;

View File

@ -99,7 +99,7 @@ ThemePrivate::ThemePrivate(QObject *parent)
#if HAVE_X11 #if HAVE_X11
//watch for background contrast effect property changes as well //watch for background contrast effect property changes as well
if (!s_backgroundContrastEffectWatcher) { if (!s_backgroundContrastEffectWatcher) {
s_backgroundContrastEffectWatcher = new EffectWatcher("_KDE_NET_WM_BACKGROUND_CONTRAST_REGION"); s_backgroundContrastEffectWatcher = new EffectWatcher(QStringLiteral("_KDE_NET_WM_BACKGROUND_CONTRAST_REGION"));
} }
QObject::connect(s_backgroundContrastEffectWatcher, &EffectWatcher::effectChanged, this, [this](bool active) { QObject::connect(s_backgroundContrastEffectWatcher, &EffectWatcher::effectChanged, this, [this](bool active) {
@ -604,7 +604,7 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
void ThemePrivate::processWallpaperSettings(KConfigBase *metadata) void ThemePrivate::processWallpaperSettings(KConfigBase *metadata)
{ {
if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != DEFAULT_WALLPAPER_THEME) { if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != QStringLiteral(DEFAULT_WALLPAPER_THEME)) {
return; return;
} }
@ -674,7 +674,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
if (themePath.isEmpty() && themeName.isEmpty()) { if (themePath.isEmpty() && themeName.isEmpty()) {
// note: can't use QStringLiteral("foo" "bar") on Windows // note: can't use QStringLiteral("foo" "bar") on Windows
themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/default"), QStandardPaths::LocateDirectory); themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/default"), QStandardPaths::LocateDirectory);
if (themePath.isEmpty()) { if (themePath.isEmpty()) {
return; return;

View File

@ -40,8 +40,8 @@ public:
Q_FOREACH(const ObjectHistory& history, m_data) { Q_FOREACH(const ObjectHistory& history, m_data) {
QVariantMap map; QVariantMap map;
map["events"] = serializeEvents(history.events); map[QStringLiteral("events")] = serializeEvents(history.events);
map["initial"] = history.initial; map[QStringLiteral("initial")] = history.initial;
array.append(QJsonValue::fromVariant(map)); array.append(QJsonValue::fromVariant(map));
} }
@ -68,8 +68,8 @@ private:
Q_ASSERT(!events.isEmpty()); Q_ASSERT(!events.isEmpty());
foreach(const TimeEvent& ev, events) { foreach(const TimeEvent& ev, events) {
QVariantMap map; QVariantMap map;
map["comment"] = ev.comment; map[QStringLiteral("comment")] = ev.comment;
map["time"] = ev.moment.toMSecsSinceEpoch(); map[QStringLiteral("time")] = ev.moment.toMSecsSinceEpoch();
ret.append(map); ret.append(map);
} }
Q_ASSERT(ret.count() == events.count()); Q_ASSERT(ret.count() == events.count());
@ -81,7 +81,7 @@ Q_GLOBAL_STATIC(TimeTrackerWriter, s_writer);
TimeTracker::TimeTracker(QObject* o) TimeTracker::TimeTracker(QObject* o)
: QObject(o) : QObject(o)
{ {
m_history.events.append(TimeEvent { QDateTime::currentDateTime(), QString("constructed %1 %2").arg(o->metaObject()->className()).arg(o->objectName()) }); m_history.events.append(TimeEvent { QDateTime::currentDateTime(), QStringLiteral("constructed %1 %2").arg(o->metaObject()->className(), o->objectName()) });
QTimer* t = new QTimer(this); QTimer* t = new QTimer(this);
t->setInterval(2000); t->setInterval(2000);
@ -135,9 +135,9 @@ void TimeTracker::propertyChanged()
} }
if (val.isEmpty()) { if (val.isEmpty()) {
val = QString("<unknown %1>").arg(prop.typeName()); val = QStringLiteral("<unknown %1>").arg(prop.typeName());
} }
m_history.events.append(TimeEvent { QDateTime::currentDateTime(), QString("property %1 changed to %2").arg(prop.name()).arg(val)}); m_history.events.append(TimeEvent { QDateTime::currentDateTime(), QStringLiteral("property %1 changed to %2").arg(prop.name(), val)});
break; break;
} }
} }

View File

@ -64,10 +64,10 @@ QStringList knownLanguages(Types::ComponentTypes types)
QStringList languages; QStringList languages;
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines")); const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"));
for (auto plugin : plugins) { foreach (const auto &plugin, plugins) {
const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes")); const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes"));
if (((types & Types::AppletComponent) && !componentTypes.contains(QLatin1String("Applet"))) if (((types & Types::AppletComponent) && !componentTypes.contains(QStringLiteral("Applet")))
||((types & Types::DataEngineComponent) && !componentTypes.contains(QLatin1String("DataEngine")))) { ||((types & Types::DataEngineComponent) && !componentTypes.contains(QStringLiteral("DataEngine")))) {
languages << plugin.value(QStringLiteral("X-Plasma-API")); languages << plugin.value(QStringLiteral("X-Plasma-API"));
} }
} }
@ -86,10 +86,10 @@ ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QOb
}; };
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"), filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"), filter);
if (plugins.count()) { if (!plugins.isEmpty()) {
const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes")); const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes"));
if (((type & Types::AppletComponent) && !componentTypes.contains(QLatin1String("Applet"))) if (((type & Types::AppletComponent) && !componentTypes.contains(QStringLiteral("Applet")))
|| ((type & Types::DataEngineComponent) && !componentTypes.contains(QLatin1String("DataEngine")))) { || ((type & Types::DataEngineComponent) && !componentTypes.contains(QStringLiteral("DataEngine")))) {
qCWarning(LOG_PLASMA) << "ScriptEngine" << plugins.first().name() << "does not provide Applet or DataEngine components, returning empty."; qCWarning(LOG_PLASMA) << "ScriptEngine" << plugins.first().name() << "does not provide Applet or DataEngine components, returning empty.";
return 0; return 0;

View File

@ -98,7 +98,7 @@ ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject
{ {
// TODO: nested groups? // TODO: nested groups?
ServiceJob *job = 0; ServiceJob *job = 0;
const QString op = !description.isEmpty() ? description.value("_name").toString() : QString(); const QString op = !description.isEmpty() ? description.value(QStringLiteral("_name")).toString() : QString();
if (d->operationsMap.keys().isEmpty()) { if (d->operationsMap.keys().isEmpty()) {
#ifndef NDEBUG #ifndef NDEBUG
@ -173,11 +173,11 @@ void Service::setOperationsScheme(QIODevice *xml)
// KSharedConfig. We need a config object for the config loader even // KSharedConfig. We need a config object for the config loader even
// though we dont' actually want to use any config parts from it, // though we dont' actually want to use any config parts from it,
// we just want to share the KConfigLoader XML parsing. // we just want to share the KConfigLoader XML parsing.
KSharedConfigPtr config = KSharedConfig::openConfig("/dev/null"); KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("/dev/null"));
KConfigLoader loader(config, xml); KConfigLoader loader(config, xml);
foreach (const QString &group, loader.groupList()) { foreach (const QString &group, loader.groupList()) {
d->operationsMap[group]["_name"] = group; d->operationsMap[group][QStringLiteral("_name")] = group;
} }
foreach (KConfigSkeletonItem *item, loader.items()) { foreach (KConfigSkeletonItem *item, loader.items()) {
d->operationsMap[item->group()][item->key()] = item->property(); d->operationsMap[item->group()][item->key()] = item->property();

View File

@ -94,12 +94,12 @@ bool SharedSvgRenderer::load(
style = style.nextSiblingElement(STYLE)) { style = style.nextSiblingElement(STYLE)) {
if (style.attribute(QStringLiteral("id")) == QLatin1String("current-color-scheme")) { if (style.attribute(QStringLiteral("id")) == QLatin1String("current-color-scheme")) {
QDomElement colorScheme = svg.createElement(STYLE); QDomElement colorScheme = svg.createElement(STYLE);
colorScheme.setAttribute(QLatin1String("type"), QLatin1String("text/css")); colorScheme.setAttribute(QStringLiteral("type"), QStringLiteral("text/css"));
colorScheme.setAttribute(QLatin1String("id"), QLatin1String("current-color-scheme")); colorScheme.setAttribute(QStringLiteral("id"), QStringLiteral("current-color-scheme"));
defs.replaceChild(colorScheme, style); defs.replaceChild(colorScheme, style);
colorScheme.appendChild(svg.createCDATASection(styleSheet)); colorScheme.appendChild(svg.createCDATASection(styleSheet));
interestingElements.insert(QLatin1String("current-color-scheme"), QRect(0, 0, 1, 1)); interestingElements.insert(QStringLiteral("current-color-scheme"), QRect(0, 0, 1, 1));
break; break;
} }
@ -278,7 +278,7 @@ Theme *SvgPrivate::cacheAndColorsTheme()
// use a separate cache source for unthemed svg's // use a separate cache source for unthemed svg's
if (!s_systemColorsCache) { if (!s_systemColorsCache) {
//FIXME: reference count this, so that it is deleted when no longer in use //FIXME: reference count this, so that it is deleted when no longer in use
s_systemColorsCache = new Plasma::Theme(QLatin1String("internal-system-colors")); s_systemColorsCache = new Plasma::Theme(QStringLiteral("internal-system-colors"));
} }
return s_systemColorsCache.data(); return s_systemColorsCache.data();
@ -738,7 +738,7 @@ void Svg::setScaleFactor(qreal ratio)
//not resize() because we want to do it unconditionally //not resize() because we want to do it unconditionally
QRectF rect; QRectF rect;
if (d->cacheAndColorsTheme()->findInRectsCache(d->path, QString("_Natural_%1").arg(d->scaleFactor), rect)) { if (d->cacheAndColorsTheme()->findInRectsCache(d->path, QStringLiteral("_Natural_%1").arg(d->scaleFactor), rect)) {
d->naturalSize = rect.size(); d->naturalSize = rect.size();
} else { } else {
d->createRenderer(); d->createRenderer();

View File

@ -469,7 +469,7 @@ QFont Theme::smallestFont() const
QSizeF Theme::mSize(const QFont &font) const QSizeF Theme::mSize(const QFont &font) const
{ {
return QFontMetrics(font).boundingRect("M").size(); return QFontMetrics(font).boundingRect(QStringLiteral("M")).size();
} }
bool Theme::backgroundContrastEnabled() const bool Theme::backgroundContrastEnabled() const

View File

@ -53,21 +53,21 @@ int main(int argc, char **argv)
parser.addVersionOption(); parser.addVersionOption();
parser.addHelpOption(); parser.addHelpOption();
parser.setApplicationDescription(description); parser.setApplicationDescription(description);
parser.addOption(QCommandLineOption(QStringList() << "hash", i18nc("Do not translate <path>", "Generate a SHA1 hash for the package at <path>"), "path")); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("hash"), i18nc("Do not translate <path>", "Generate a SHA1 hash for the package at <path>"), QStringLiteral("path")));
parser.addOption(QCommandLineOption(QStringList() << "g" << "global", i18n("For install or remove, operates on packages installed for all users."))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("g") << QStringLiteral("global"), i18n("For install or remove, operates on packages installed for all users.")));
parser.addOption(QCommandLineOption(QStringList() << "t" << "type", parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("t") << QStringLiteral("type"),
i18nc("theme, wallpaper, etc. are keywords, but they may be translated, as both versions " i18nc("theme, wallpaper, etc. are keywords, but they may be translated, as both versions "
"are recognized by the application " "are recognized by the application "
"(if translated, should be same as messages with 'package type' context below)", "(if translated, should be same as messages with 'package type' context below)",
"The type of package, e.g. theme, wallpaper, plasmoid, dataengine, runner, layout-template, etc."), "The type of package, e.g. theme, wallpaper, plasmoid, dataengine, runner, layout-template, etc."),
"type", "plasmoid")); QStringLiteral("type"), QStringLiteral("plasmoid")));
parser.addOption(QCommandLineOption(QStringList() << "i" << "install", i18nc("Do not translate <path>", "Install the package at <path>"), "path")); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("i") << QStringLiteral("install"), i18nc("Do not translate <path>", "Install the package at <path>"), QStringLiteral("path")));
parser.addOption(QCommandLineOption(QStringList() << "s" << "show", i18nc("Do not translate <name>", "Show information of package <name>"), "name")); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("show"), i18nc("Do not translate <name>", "Show information of package <name>"), QStringLiteral("name")));
parser.addOption(QCommandLineOption(QStringList() << "u" << "upgrade", i18nc("Do not translate <path>", "Upgrade the package at <path>"), "path")); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("u") << QStringLiteral("upgrade"), i18nc("Do not translate <path>", "Upgrade the package at <path>"), QStringLiteral("path")));
parser.addOption(QCommandLineOption(QStringList() << "l" << "list", i18n("List installed packages"))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("l") << QStringLiteral("list"), i18n("List installed packages")));
parser.addOption(QCommandLineOption(QStringList() << "list-types", i18n("List all known package types that can be installed"))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("list-types"), i18n("List all known package types that can be installed")));
parser.addOption(QCommandLineOption(QStringList() << "r" << "remove", i18nc("Do not translate <name>", "Remove the package named <name>"), "name")); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("r") << QStringLiteral("remove"), i18nc("Do not translate <name>", "Remove the package named <name>"), QStringLiteral("name")));
parser.addOption(QCommandLineOption(QStringList() << "p" << "packageroot", i18n("Absolute path to the package root. If not supplied, then the standard data directories for this KDE session will be searched instead."), "path")); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("p") << QStringLiteral("packageroot"), i18n("Absolute path to the package root. If not supplied, then the standard data directories for this KDE session will be searched instead."), QStringLiteral("path")));
parser.process(app); parser.process(app);

View File

@ -91,8 +91,8 @@ PlasmaPkg::~PlasmaPkg()
void PlasmaPkg::runMain() void PlasmaPkg::runMain()
{ {
Plasma::PackageStructure *structure = new Plasma::PackageStructure; Plasma::PackageStructure *structure = new Plasma::PackageStructure;
if (d->parser->isSet("hash")) { if (d->parser->isSet(QStringLiteral("hash"))) {
const QString path = d->parser->value("hash"); const QString path = d->parser->value(QStringLiteral("hash"));
Plasma::Package package(structure); Plasma::Package package(structure);
package.setPath(path); package.setPath(path);
const QString hash = package.contentsHash(); const QString hash = package.contentsHash();
@ -106,156 +106,156 @@ void PlasmaPkg::runMain()
return; return;
} }
if (d->parser->isSet("list-types")) { if (d->parser->isSet(QStringLiteral("list-types"))) {
d->listTypes(); d->listTypes();
exit(0); exit(0);
return; return;
} }
QString type = d->parser->value("type"); QString type = d->parser->value(QStringLiteral("type"));
QString packageRoot = type; QString packageRoot = type;
d->pluginTypes.clear(); d->pluginTypes.clear();
d->installer = 0; d->installer = 0;
if (d->parser->isSet("remove")) { if (d->parser->isSet(QStringLiteral("remove"))) {
d->package = d->parser->value("remove"); d->package = d->parser->value(QStringLiteral("remove"));
} else if (d->parser->isSet("upgrade")) { } else if (d->parser->isSet(QStringLiteral("upgrade"))) {
d->package = d->parser->value("upgrade"); d->package = d->parser->value(QStringLiteral("upgrade"));
} else if (d->parser->isSet("install")) { } else if (d->parser->isSet(QStringLiteral("install"))) {
d->package = d->parser->value("install"); d->package = d->parser->value(QStringLiteral("install"));
} else if (d->parser->isSet("show")) { } else if (d->parser->isSet(QStringLiteral("show"))) {
d->package = d->parser->value("show"); d->package = d->parser->value(QStringLiteral("show"));
} }
if (!QDir::isAbsolutePath(d->package)) { if (!QDir::isAbsolutePath(d->package)) {
d->packageFile = QDir(QDir::currentPath() + '/' + d->package).absolutePath(); d->packageFile = QDir(QDir::currentPath() + '/' + d->package).absolutePath();
d->packageFile = QFileInfo(d->packageFile).canonicalFilePath(); d->packageFile = QFileInfo(d->packageFile).canonicalFilePath();
if (d->parser->isSet("upgrade")) { if (d->parser->isSet(QStringLiteral("upgrade"))) {
d->package = d->packageFile; d->package = d->packageFile;
} }
} else { } else {
d->packageFile = d->package; d->packageFile = d->package;
} }
if (!d->packageFile.isEmpty() && (!d->parser->isSet("type") || if (!d->packageFile.isEmpty() && (!d->parser->isSet(QStringLiteral("type")) ||
type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0 || type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0 ||
type.compare("wallpaper", Qt::CaseInsensitive) == 0)) { type.compare(QLatin1String("wallpaper"), Qt::CaseInsensitive) == 0)) {
// Check type for common plasma packages // Check type for common plasma packages
Plasma::Package package(structure); Plasma::Package package(structure);
QString serviceType; QString serviceType;
if (d->parser->isSet("remove")) { if (d->parser->isSet(QStringLiteral("remove"))) {
package.setPath(d->package); package.setPath(d->package);
} else { } else {
package.setPath(d->packageFile); package.setPath(d->packageFile);
} }
if (package.isValid() && package.metadata().isValid()) { if (package.isValid() && package.metadata().isValid()) {
serviceType = package.metadata().property("X-Plasma-ServiceType").toString(); serviceType = package.metadata().property(QStringLiteral("X-Plasma-ServiceType")).toString();
} }
if (!serviceType.isEmpty()) { if (!serviceType.isEmpty()) {
if (serviceType.contains("Plasma/Applet") || if (serviceType.contains(QStringLiteral("Plasma/Applet")) ||
//serviceType.contains("Plasma/PopupApplet") || //serviceType.contains("Plasma/PopupApplet") ||
serviceType.contains("Plasma/Containment")) { serviceType.contains(QStringLiteral("Plasma/Containment"))) {
type = "plasmoid"; type = QStringLiteral("plasmoid");
} else if (serviceType == "Plasma/Generic") { } else if (serviceType == QLatin1String("Plasma/Generic")) {
type = "package"; type = QStringLiteral("package");
} else if (serviceType == "Plasma/DataEngine") { } else if (serviceType == QLatin1String("Plasma/DataEngine")) {
type = "dataengine"; type = QStringLiteral("dataengine");
} else if (serviceType == "Plasma/Runner") { } else if (serviceType == QLatin1String("Plasma/Runner")) {
type = "runner"; type = QStringLiteral("runner");
} else if (serviceType == "Plasma/LookAndFeel") { } else if (serviceType == QLatin1String("Plasma/LookAndFeel")) {
type = "lookandfeel"; type = QStringLiteral("lookandfeel");
} else if (serviceType == "Plasma/Shell") { } else if (serviceType == QLatin1String("Plasma/Shell")) {
type = "shell"; type = QStringLiteral("shell");
} else if (serviceType == "Plasma/Wallpaper") { } else if (serviceType == QLatin1String("Plasma/Wallpaper")) {
// This also changes type to wallpaperplugin when --type wallpaper // This also changes type to wallpaperplugin when --type wallpaper
// was specified and we have wallpaper plugin package (instead of // was specified and we have wallpaper plugin package (instead of
// wallpaper image package) // wallpaper image package)
type = "wallpaperplugin"; type = QStringLiteral("wallpaperplugin");
} else if (serviceType == "KWin/WindowSwitcher") { } else if (serviceType == QLatin1String("KWin/WindowSwitcher")) {
type = "windowswitcher"; type = QStringLiteral("windowswitcher");
} else if (serviceType == "KWin/Effect") { } else if (serviceType == QLatin1String("KWin/Effect")) {
type = "kwineffect"; type = QStringLiteral("kwineffect");
} else if (serviceType == "KWin/Script") { } else if (serviceType == QLatin1String("KWin/Script")) {
type = "kwinscript"; type = QStringLiteral("kwinscript");
} else if (serviceType == "Plasma/LayoutTemplate") { } else if (serviceType == QLatin1String("Plasma/LayoutTemplate")) {
type = "layout-template"; type = QStringLiteral("layout-template");
} else { } else {
type = serviceType; type = serviceType;
//qDebug() << "fallthrough type is" << serviceType; //qDebug() << "fallthrough type is" << serviceType;
} }
} else { } else {
if (type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0) { if (type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0) {
serviceType = "Plasma/Wallpaper"; serviceType = QStringLiteral("Plasma/Wallpaper");
} }
} }
} }
if (type.compare(i18nc("package type", "plasmoid"), Qt::CaseInsensitive) == 0 || if (type.compare(i18nc("package type", "plasmoid"), Qt::CaseInsensitive) == 0 ||
type.compare("plasmoid", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("plasmoid"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/");
d->servicePrefix = "plasma-applet-"; d->servicePrefix = QStringLiteral("plasma-applet-");
d->pluginTypes << "Plasma/Applet"; d->pluginTypes << QStringLiteral("Plasma/Applet");
d->pluginTypes << "Plasma/Containment"; d->pluginTypes << QStringLiteral("Plasma/Containment");
} else if (type.compare(i18nc("package type", "package"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "package"), Qt::CaseInsensitive) == 0 ||
type.compare("package", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("package"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/");
d->servicePrefix = "plasma-package-"; d->servicePrefix = QStringLiteral("plasma-package-");
d->pluginTypes << "Plasma/Generic"; d->pluginTypes << QStringLiteral("Plasma/Generic");
} else if (type.compare(i18nc("package type", "theme"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "theme"), Qt::CaseInsensitive) == 0 ||
type.compare("theme", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("theme"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/");
d->pluginTypes << "Plasma/Theme"; d->pluginTypes << QStringLiteral("Plasma/Theme");
} else if (type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0 ||
type.compare("wallpaper", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("wallpaper"), Qt::CaseInsensitive) == 0) {
d->pluginTypes << "Plasma/ImageWallpaper"; // we'll catch that later d->pluginTypes << QStringLiteral("Plasma/ImageWallpaper"); // we'll catch that later
d->packageRoot = "wallpapers/"; d->packageRoot = QStringLiteral("wallpapers/");
d->servicePrefix = "plasma-wallpaper-"; d->servicePrefix = QStringLiteral("plasma-wallpaper-");
} else if (type.compare(i18nc("package type", "dataengine"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "dataengine"), Qt::CaseInsensitive) == 0 ||
type.compare("dataengine", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("dataengine"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/");
d->servicePrefix = "plasma-dataengine-"; d->servicePrefix = QStringLiteral("plasma-dataengine-");
d->pluginTypes << "Plasma/DataEngine"; d->pluginTypes << QStringLiteral("Plasma/DataEngine");
} else if (type.compare(i18nc("package type", "runner"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "runner"), Qt::CaseInsensitive) == 0 ||
type.compare("runner", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("runner"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/runners/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/runners/");
d->servicePrefix = "plasma-runner-"; d->servicePrefix = QStringLiteral("plasma-runner-");
d->pluginTypes << "Plasma/Runner"; d->pluginTypes << QStringLiteral("Plasma/Runner");
} else if (type.compare(i18nc("package type", "wallpaperplugin"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "wallpaperplugin"), Qt::CaseInsensitive) == 0 ||
type.compare("wallpaperplugin", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("wallpaperplugin"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/");
d->servicePrefix = "plasma-wallpaper-"; d->servicePrefix = QStringLiteral("plasma-wallpaper-");
d->pluginTypes << "Plasma/Wallpaper"; d->pluginTypes << QStringLiteral("Plasma/Wallpaper");
} else if (type.compare(i18nc("package type", "lookandfeel"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "lookandfeel"), Qt::CaseInsensitive) == 0 ||
type.compare("lookandfeel", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("lookandfeel"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/");
d->servicePrefix = "plasma-lookandfeel-"; d->servicePrefix = QStringLiteral("plasma-lookandfeel-");
d->pluginTypes << "Plasma/LookAndFeel"; d->pluginTypes << QStringLiteral("Plasma/LookAndFeel");
} else if (type.compare(i18nc("package type", "shell"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "shell"), Qt::CaseInsensitive) == 0 ||
type.compare("shell", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("shell"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/");
d->servicePrefix = "plasma-shell-"; d->servicePrefix = QStringLiteral("plasma-shell-");
d->pluginTypes << "Plasma/Shell"; d->pluginTypes << QStringLiteral("Plasma/Shell");
} else if (type.compare(i18nc("package type", "layout-template"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "layout-template"), Qt::CaseInsensitive) == 0 ||
type.compare("layout-template", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("layout-template"), Qt::CaseInsensitive) == 0) {
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates/"; d->packageRoot = QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates/");
d->servicePrefix = "plasma-layout-"; d->servicePrefix = QStringLiteral("plasma-layout-");
d->pluginTypes << "Plasma/LayoutTemplate"; d->pluginTypes << QStringLiteral("Plasma/LayoutTemplate");
} else if (type.compare(i18nc("package type", "kwineffect"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "kwineffect"), Qt::CaseInsensitive) == 0 ||
type.compare("kwineffect", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("kwineffect"), Qt::CaseInsensitive) == 0) {
d->packageRoot = "kwin/effects/"; d->packageRoot = QStringLiteral("kwin/effects/");
d->servicePrefix = "kwin-effect-"; d->servicePrefix = QStringLiteral("kwin-effect-");
d->pluginTypes << "KWin/Effect"; d->pluginTypes << QStringLiteral("KWin/Effect");
} else if (type.compare(i18nc("package type", "windowswitcher"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "windowswitcher"), Qt::CaseInsensitive) == 0 ||
type.compare("windowswitcher", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("windowswitcher"), Qt::CaseInsensitive) == 0) {
d->packageRoot = "kwin/tabbox/"; d->packageRoot = QStringLiteral("kwin/tabbox/");
d->servicePrefix = "kwin-windowswitcher-"; d->servicePrefix = QStringLiteral("kwin-windowswitcher-");
d->pluginTypes << "KWin/WindowSwitcher"; d->pluginTypes << QStringLiteral("KWin/WindowSwitcher");
} else if (type.compare(i18nc("package type", "kwinscript"), Qt::CaseInsensitive) == 0 || } else if (type.compare(i18nc("package type", "kwinscript"), Qt::CaseInsensitive) == 0 ||
type.compare("kwinscript", Qt::CaseInsensitive) == 0) { type.compare(QLatin1String("kwinscript"), Qt::CaseInsensitive) == 0) {
d->packageRoot = "kwin/scripts/"; d->packageRoot = QStringLiteral("kwin/scripts/");
d->servicePrefix = "kwin-script-"; d->servicePrefix = QStringLiteral("kwin-script-");
d->pluginTypes << "KWin/Script"; d->pluginTypes << QStringLiteral("KWin/Script");
//do it trough normal plugin loading //do it trough normal plugin loading
} else { } else {
@ -271,15 +271,15 @@ void PlasmaPkg::runMain()
//d->packageRoot = d->installer->defaultPackageRoot(); //d->packageRoot = d->installer->defaultPackageRoot();
d->pluginTypes << type; d->pluginTypes << type;
} }
if (d->parser->isSet("show")) { if (d->parser->isSet(QStringLiteral("show"))) {
const QString pluginName = d->package; const QString pluginName = d->package;
showPackageInfo(pluginName); showPackageInfo(pluginName);
exit(0); exit(0);
return; return;
} }
if (d->parser->isSet("list")) { if (d->parser->isSet(QStringLiteral("list"))) {
d->coutput(i18n("Listing service types: %1", d->pluginTypes.join(", "))); d->coutput(i18n("Listing service types: %1", d->pluginTypes.join(QStringLiteral(", "))));
listPackages(d->pluginTypes); listPackages(d->pluginTypes);
exit(0); exit(0);
} else { } else {
@ -292,7 +292,7 @@ void PlasmaPkg::runMain()
d->packageRoot = findPackageRoot(d->package, d->packageRoot); d->packageRoot = findPackageRoot(d->package, d->packageRoot);
if (d->parser->isSet("remove") || d->parser->isSet("upgrade")) { if (d->parser->isSet(QStringLiteral("remove")) || d->parser->isSet(QStringLiteral("upgrade"))) {
QString pkgPath; QString pkgPath;
foreach (const QString &t, d->pluginTypes) { foreach (const QString &t, d->pluginTypes) {
Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage(t); Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage(t);
@ -309,7 +309,7 @@ void PlasmaPkg::runMain()
pkgPath = d->package; pkgPath = d->package;
} }
if (d->parser->isSet("upgrade")) { if (d->parser->isSet(QStringLiteral("upgrade"))) {
d->installer->setPath(d->package); d->installer->setPath(d->package);
} }
QString _p = d->packageRoot; QString _p = d->packageRoot;
@ -356,7 +356,7 @@ void PlasmaPkg::runMain()
exit(2); exit(2);
} }
} }
if (d->parser->isSet("install")) { if (d->parser->isSet(QStringLiteral("install"))) {
KJob *installJob = d->installer->install(d->packageFile, d->packageRoot); KJob *installJob = d->installer->install(d->packageFile, d->packageRoot);
connect(installJob, SIGNAL(result(KJob*)), SLOT(packageInstalled(KJob*))); connect(installJob, SIGNAL(result(KJob*)), SLOT(packageInstalled(KJob*)));
return; return;
@ -380,8 +380,8 @@ void PlasmaPkgPrivate::runKbuildsycoca()
{ {
return; return;
if (KSycoca::isAvailable()) { if (KSycoca::isAvailable()) {
QDBusInterface dbus("org.kde.kded5", "/kbuildsycoca", "org.kde.kbuildsycoca"); QDBusInterface dbus(QStringLiteral("org.kde.kded5"), QStringLiteral("/kbuildsycoca"), QStringLiteral("org.kde.kbuildsycoca"));
dbus.call(QDBus::NoBlock, "recreate"); dbus.call(QDBus::NoBlock, QStringLiteral("recreate"));
} }
} }
@ -391,13 +391,13 @@ QStringList PlasmaPkgPrivate::packages(const QStringList &types)
foreach (const QString &type, types) { foreach (const QString &type, types) {
if (type.compare("Plasma/Generic", Qt::CaseInsensitive) == 0) { if (type.compare(QLatin1String("Plasma/Generic"), Qt::CaseInsensitive) == 0) {
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/", QStandardPaths::LocateDirectory); const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/"), QStandardPaths::LocateDirectory);
foreach (const QString &ppath, packs) { foreach (const QString &ppath, packs) {
const QDir cd(ppath); const QDir cd(ppath);
const QStringList &entries = cd.entryList(QDir::Dirs); const QStringList &entries = cd.entryList(QDir::Dirs);
foreach (const QString pack, entries) { foreach (const QString& pack, entries) {
if ((pack != "." && pack != "..") && if ((pack != QLatin1String(".") && pack != QLatin1String("..")) &&
(QFile::exists(ppath + '/' + pack + "/metadata.desktop"))) { (QFile::exists(ppath + '/' + pack + "/metadata.desktop"))) {
result << pack; result << pack;
@ -406,13 +406,13 @@ QStringList PlasmaPkgPrivate::packages(const QStringList &types)
} }
} }
if (type.compare("Plasma/ImageWallpaper", Qt::CaseInsensitive) == 0) { if (type.compare(QLatin1String("Plasma/ImageWallpaper"), Qt::CaseInsensitive) == 0) {
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "wallpapers/", QStandardPaths::LocateDirectory); const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("wallpapers/"), QStandardPaths::LocateDirectory);
foreach (const QString &ppath, packs) { foreach (const QString &ppath, packs) {
const QDir cd(ppath); const QDir cd(ppath);
const QStringList &entries = cd.entryList(QDir::Dirs); const QStringList &entries = cd.entryList(QDir::Dirs);
foreach (const QString pack, entries) { foreach (const QString& pack, entries) {
if ((pack != "." && pack != "..") && if ((pack != QLatin1String(".") && pack != QLatin1String("..")) &&
(QFile::exists(ppath + '/' + pack + "/metadata.desktop"))) { (QFile::exists(ppath + '/' + pack + "/metadata.desktop"))) {
result << pack; result << pack;
@ -421,13 +421,13 @@ QStringList PlasmaPkgPrivate::packages(const QStringList &types)
} }
} }
if (type.compare("Plasma/Theme", Qt::CaseInsensitive) == 0) { if (type.compare(QLatin1String("Plasma/Theme"), Qt::CaseInsensitive) == 0) {
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/", QStandardPaths::LocateDirectory); const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/"), QStandardPaths::LocateDirectory);
foreach (const QString &ppath, packs) { foreach (const QString &ppath, packs) {
const QDir cd(ppath); const QDir cd(ppath);
const QStringList &entries = cd.entryList(QDir::Dirs); const QStringList &entries = cd.entryList(QDir::Dirs);
foreach (const QString pack, entries) { foreach (const QString& pack, entries) {
if ((pack != "." && pack != "..") && if ((pack != QLatin1String(".") && pack != QLatin1String("..")) &&
(QFile::exists(ppath + '/' + pack + "/metadata.desktop"))) { (QFile::exists(ppath + '/' + pack + "/metadata.desktop"))) {
result << pack; result << pack;
@ -441,7 +441,7 @@ QStringList PlasmaPkgPrivate::packages(const QStringList &types)
//of packages succeed //of packages succeed
Plasma::PluginLoader::self()->loadPackage(type); Plasma::PluginLoader::self()->loadPackage(type);
const QList<KPluginMetaData> plugins = KPackage::PackageLoader::self()->listPackages(type); const QList<KPluginMetaData> plugins = KPackage::PackageLoader::self()->listPackages(type);
for (auto plugin : plugins) { for (auto& plugin : plugins) {
const QString _plugin = plugin.pluginId(); const QString _plugin = plugin.pluginId();
if (!result.contains(_plugin)) { if (!result.contains(_plugin)) {
result << _plugin; result << _plugin;
@ -486,13 +486,13 @@ void PlasmaPkg::showPackageInfo(const QString &pluginName)
QString PlasmaPkg::findPackageRoot(const QString &pluginName, const QString &prefix) QString PlasmaPkg::findPackageRoot(const QString &pluginName, const QString &prefix)
{ {
QString packageRoot; QString packageRoot;
if (d->parser->isSet("packageroot") && d->parser->isSet("global")) { if (d->parser->isSet(QStringLiteral("packageroot")) && d->parser->isSet(QStringLiteral("global"))) {
qWarning() << i18nc("The user entered conflicting options packageroot and global, this is the error message telling the user he can use only one", "The packageroot and global options conflict each other, please select only one."); qWarning() << i18nc("The user entered conflicting options packageroot and global, this is the error message telling the user he can use only one", "The packageroot and global options conflict each other, please select only one.");
::exit(7); ::exit(7);
} else if (d->parser->isSet("packageroot")) { } else if (d->parser->isSet(QStringLiteral("packageroot"))) {
packageRoot = d->parser->value("packageroot"); packageRoot = d->parser->value(QStringLiteral("packageroot"));
//qDebug() << "(set via arg) d->packageRoot is: " << d->packageRoot; //qDebug() << "(set via arg) d->packageRoot is: " << d->packageRoot;
} else if (d->parser->isSet("global")) { } else if (d->parser->isSet(QStringLiteral("global"))) {
packageRoot = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, d->packageRoot, QStandardPaths::LocateDirectory).last(); packageRoot = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, d->packageRoot, QStandardPaths::LocateDirectory).last();
} else { } else {
packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + d->packageRoot; packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + d->packageRoot;
@ -567,29 +567,29 @@ void PlasmaPkgPrivate::listTypes()
coutput(i18n("Built in:")); coutput(i18n("Built in:"));
QMap<QString, QStringList> builtIns; QMap<QString, QStringList> builtIns;
builtIns.insert(i18n("DataEngine"), QStringList() << "Plasma/DataEngine" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/" << "dataengine"); builtIns.insert(i18n("DataEngine"), QStringList() << QStringLiteral("Plasma/DataEngine") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/") << QStringLiteral("dataengine"));
builtIns.insert(i18n("Layout Template"), QStringList() << "Plasma/LayoutTemplate" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates/" << "layout-template"); builtIns.insert(i18n("Layout Template"), QStringList() << QStringLiteral("Plasma/LayoutTemplate") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates/") << QStringLiteral("layout-template"));
builtIns.insert(i18n("Look and Feel"), QStringList() << "Plasma/LookAndFeel" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/" << "lookandfeel"); builtIns.insert(i18n("Look and Feel"), QStringList() << QStringLiteral("Plasma/LookAndFeel") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/") << QStringLiteral("lookandfeel"));
builtIns.insert(i18n("Package"), QStringList() << "Plasma/Generic" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/" << "package"); builtIns.insert(i18n("Package"), QStringList() << QStringLiteral("Plasma/Generic") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/") << QStringLiteral("package"));
builtIns.insert(i18n("Plasmoid"), QStringList() << "Plasma/Applet" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/" << "plasmoid"); builtIns.insert(i18n("Plasmoid"), QStringList() << QStringLiteral("Plasma/Applet") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/") << QStringLiteral("plasmoid"));
builtIns.insert(i18n("Runner"), QStringList() << "Plasma/Runner" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/runners/" << "runner"); builtIns.insert(i18n("Runner"), QStringList() << QStringLiteral("Plasma/Runner") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/runners/") << QStringLiteral("runner"));
builtIns.insert(i18n("Shell"), QStringList() << "Plasma/Shell" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/" << "shell"); builtIns.insert(i18n("Shell"), QStringList() << QStringLiteral("Plasma/Shell") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/") << QStringLiteral("shell"));
builtIns.insert(i18n("Theme"), QStringList() << "" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/" << "theme"); builtIns.insert(i18n("Theme"), QStringList() << "" << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") << QStringLiteral("theme"));
builtIns.insert(i18n("Wallpaper Images"), QStringList() << "" << "wallpapers/" << "wallpaper"); builtIns.insert(i18n("Wallpaper Images"), QStringList() << "" << QStringLiteral("wallpapers/") << QStringLiteral("wallpaper"));
builtIns.insert(i18n("Animated Wallpaper"), QStringList() << "Plasma/Wallpaper" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/" << "wallpaperplugin"); builtIns.insert(i18n("Animated Wallpaper"), QStringList() << QStringLiteral("Plasma/Wallpaper") << QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/") << QStringLiteral("wallpaperplugin"));
builtIns.insert(i18n("KWin Effect"), QStringList() << "KWin/Effect" << "kwin/effects/" << "kwineffect"); builtIns.insert(i18n("KWin Effect"), QStringList() << QStringLiteral("KWin/Effect") << QStringLiteral("kwin/effects/") << QStringLiteral("kwineffect"));
builtIns.insert(i18n("KWin Window Switcher"), QStringList() << "KWin/WindowSwitcher" << "kwin/tabbox/" << "windowswitcher"); builtIns.insert(i18n("KWin Window Switcher"), QStringList() << QStringLiteral("KWin/WindowSwitcher") << QStringLiteral("kwin/tabbox/") << QStringLiteral("windowswitcher"));
builtIns.insert(i18n("KWin Script"), QStringList() << "KWin/Script" << "kwin/scripts/" << "kwinscript"); builtIns.insert(i18n("KWin Script"), QStringList() << QStringLiteral("KWin/Script") << QStringLiteral("kwin/scripts/") << QStringLiteral("kwinscript"));
renderTypeTable(builtIns); renderTypeTable(builtIns);
const KPluginInfo::List offers = KPluginTrader::self()->query("kpackage/packagestructure", "KPackage/PackageStructure"); const KPluginInfo::List offers = KPluginTrader::self()->query(QStringLiteral("kpackage/packagestructure"), QStringLiteral("KPackage/PackageStructure"));
if (!offers.isEmpty()) { if (!offers.isEmpty()) {
std::cout << std::endl; std::cout << std::endl;
coutput(i18n("Provided by plugins:")); coutput(i18n("Provided by plugins:"));
QMap<QString, QStringList> plugins; QMap<QString, QStringList> plugins;
for (auto info : offers) { for (auto& info : offers) {
//const QString proot = ""; //const QString proot = "";
//Plasma::PackageStructure* structure = Plasma::PackageStructure::load(info.pluginName()); //Plasma::PackageStructure* structure = Plasma::PackageStructure::load(info.pluginName());
QString name = info.name(); QString name = info.name();
@ -604,7 +604,7 @@ void PlasmaPkgPrivate::listTypes()
renderTypeTable(plugins); renderTypeTable(plugins);
} }
QStringList desktopFiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/packageformats/*rc", QStandardPaths::LocateFile); QStringList desktopFiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packageformats/*rc"), QStandardPaths::LocateFile);
if (!desktopFiles.isEmpty()) { if (!desktopFiles.isEmpty()) {
coutput(i18n("Provided by .desktop files:")); coutput(i18n("Provided by .desktop files:"));
@ -627,7 +627,7 @@ void PlasmaPkg::packageInstalled(KJob *job)
bool success = (job->error() == KJob::NoError); bool success = (job->error() == KJob::NoError);
int exitcode = 0; int exitcode = 0;
if (success) { if (success) {
if (d->parser->isSet("upgrade")) { if (d->parser->isSet(QStringLiteral("upgrade"))) {
d->coutput(i18n("Successfully upgraded %1", d->packageFile)); d->coutput(i18n("Successfully upgraded %1", d->packageFile));
} else { } else {
d->coutput(i18n("Successfully installed %1", d->packageFile)); d->coutput(i18n("Successfully installed %1", d->packageFile));
@ -644,7 +644,7 @@ void PlasmaPkg::packageUninstalled(KJob *job)
bool success = (job->error() == KJob::NoError); bool success = (job->error() == KJob::NoError);
int exitcode = 0; int exitcode = 0;
if (success) { if (success) {
if (d->parser->isSet("upgrade")) { if (d->parser->isSet(QStringLiteral("upgrade"))) {
d->coutput(i18n("Upgrading package from file: %1", d->packageFile)); d->coutput(i18n("Upgrading package from file: %1", d->packageFile));
KJob *installJob = d->installer->install(d->packageFile, d->packageRoot); KJob *installJob = d->installer->install(d->packageFile, d->packageRoot);
connect(installJob, SIGNAL(result(KJob*)), SLOT(packageInstalled(KJob*))); connect(installJob, SIGNAL(result(KJob*)), SLOT(packageInstalled(KJob*)));

View File

@ -146,16 +146,16 @@ QVariant ConfigModelPrivate::get(int row) const
return value; return value;
} }
value["name"] = categories.at(row)->name(); value[QStringLiteral("name")] = categories.at(row)->name();
value["icon"] = categories.at(row)->icon(); value[QStringLiteral("icon")] = categories.at(row)->icon();
value["pluginName"] = categories.at(row)->pluginName(); value[QStringLiteral("pluginName")] = categories.at(row)->pluginName();
if (appletInterface) { if (appletInterface) {
value["source"] = QUrl::fromLocalFile(appletInterface.data()->package().filePath("ui", categories.at(row)->source())); value[QStringLiteral("source")] = QUrl::fromLocalFile(appletInterface.data()->package().filePath("ui", categories.at(row)->source()));
} else { } else {
value["source"] = categories.at(row)->source(); value[QStringLiteral("source")] = categories.at(row)->source();
} }
value["visible"] = categories.at(row)->visible(); value[QStringLiteral("visible")] = categories.at(row)->visible();
value["kcm"] = q->data(q->index(row, 0), ConfigModel::KCMRole); value[QStringLiteral("kcm")] = q->data(q->index(row, 0), ConfigModel::KCMRole);
return value; return value;
} }

View File

@ -90,7 +90,7 @@ void ConfigViewPrivate::init()
KDeclarative::KDeclarative kdeclarative; KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(q->engine()); kdeclarative.setDeclarativeEngine(q->engine());
const QString rootPath = applet.data()->pluginInfo().property("X-Plasma-RootPath").toString(); const QString rootPath = applet.data()->pluginInfo().property(QStringLiteral("X-Plasma-RootPath")).toString();
if (!rootPath.isEmpty()) { if (!rootPath.isEmpty()) {
kdeclarative.setTranslationDomain("plasma_applet_" + rootPath); kdeclarative.setTranslationDomain("plasma_applet_" + rootPath);
} else { } else {
@ -139,7 +139,7 @@ void ConfigViewPrivate::init()
delete object; delete object;
} }
const QStringList kcms = applet.data()->pluginInfo().property("X-Plasma-ConfigPlugins").value<QStringList>(); const QStringList kcms = applet.data()->pluginInfo().property(QStringLiteral("X-Plasma-ConfigPlugins")).toStringList();
if (!kcms.isEmpty()) { if (!kcms.isEmpty()) {
if (!configModel) { if (!configModel) {
configModel = new ConfigModel(q); configModel = new ConfigModel(q);
@ -158,8 +158,8 @@ void ConfigViewPrivate::init()
} }
} }
q->engine()->rootContext()->setContextProperty("plasmoid", applet.data()->property("_plasma_graphicObject").value<QObject *>()); q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoid"), applet.data()->property("_plasma_graphicObject").value<QObject *>());
q->engine()->rootContext()->setContextProperty("configDialog", q); q->engine()->rootContext()->setContextProperty(QStringLiteral("configDialog"), q);
component->completeCreate(); component->completeCreate();
delete component; delete component;
} }
@ -261,7 +261,7 @@ ConfigView::ConfigView(Plasma::Applet *applet, QWindow *parent)
: QQuickView(parent), : QQuickView(parent),
d(new ConfigViewPrivate(applet, this)) d(new ConfigViewPrivate(applet, this))
{ {
setIcon(QIcon::fromTheme("configure")); setIcon(QIcon::fromTheme(QStringLiteral("configure")));
d->init(); d->init();
qmlRegisterType<ConfigModel>("org.kde.plasma.configuration", 2, 0, "ConfigModel"); qmlRegisterType<ConfigModel>("org.kde.plasma.configuration", 2, 0, "ConfigModel");
qmlRegisterType<ConfigCategory>("org.kde.plasma.configuration", 2, 0, "ConfigCategory"); qmlRegisterType<ConfigCategory>("org.kde.plasma.configuration", 2, 0, "ConfigCategory");

View File

@ -215,9 +215,9 @@ void DialogPrivate::updateTheme()
DialogShadows::self()->removeWindow(q); DialogShadows::self()->removeWindow(q);
} else { } else {
if (type == Dialog::Tooltip) { if (type == Dialog::Tooltip) {
frameSvgItem->setImagePath("widgets/tooltip"); frameSvgItem->setImagePath(QStringLiteral("widgets/tooltip"));
} else { } else {
frameSvgItem->setImagePath("dialogs/background"); frameSvgItem->setImagePath(QStringLiteral("dialogs/background"));
} }
KWindowEffects::enableBlurBehind(q->winId(), true, frameSvgItem->frameSvg()->mask()); KWindowEffects::enableBlurBehind(q->winId(), true, frameSvgItem->frameSvg()->mask());
@ -661,7 +661,7 @@ Dialog::Dialog(QQuickItem *parent)
setColor(QColor(Qt::transparent)); setColor(QColor(Qt::transparent));
setFlags(Qt::FramelessWindowHint); setFlags(Qt::FramelessWindowHint);
setIcon(QIcon::fromTheme("plasma")); setIcon(QIcon::fromTheme(QStringLiteral("plasma")));
connect(this, &QWindow::xChanged, [=]() { d->slotWindowPositionChanged(); }); connect(this, &QWindow::xChanged, [=]() { d->slotWindowPositionChanged(); });
connect(this, &QWindow::yChanged, [=]() { d->slotWindowPositionChanged(); }); connect(this, &QWindow::yChanged, [=]() { d->slotWindowPositionChanged(); });
@ -998,9 +998,9 @@ void Dialog::setType(WindowType type)
d->frameSvgItem->setImagePath(QString()); d->frameSvgItem->setImagePath(QString());
} else { } else {
if (d->type == Tooltip) { if (d->type == Tooltip) {
d->frameSvgItem->setImagePath("widgets/tooltip"); d->frameSvgItem->setImagePath(QStringLiteral("widgets/tooltip"));
} else { } else {
d->frameSvgItem->setImagePath("dialogs/background"); d->frameSvgItem->setImagePath(QStringLiteral("dialogs/background"));
} }
} }

View File

@ -252,22 +252,22 @@ QPixmap DialogShadows::Private::initEmptyPixmap(const QSize &size)
void DialogShadows::Private::setupPixmaps() void DialogShadows::Private::setupPixmaps()
{ {
clearPixmaps(); clearPixmaps();
initPixmap("shadow-top"); initPixmap(QStringLiteral("shadow-top"));
initPixmap("shadow-topright"); initPixmap(QStringLiteral("shadow-topright"));
initPixmap("shadow-right"); initPixmap(QStringLiteral("shadow-right"));
initPixmap("shadow-bottomright"); initPixmap(QStringLiteral("shadow-bottomright"));
initPixmap("shadow-bottom"); initPixmap(QStringLiteral("shadow-bottom"));
initPixmap("shadow-bottomleft"); initPixmap(QStringLiteral("shadow-bottomleft"));
initPixmap("shadow-left"); initPixmap(QStringLiteral("shadow-left"));
initPixmap("shadow-topleft"); initPixmap(QStringLiteral("shadow-topleft"));
m_emptyCornerPix = initEmptyPixmap(QSize(1, 1)); m_emptyCornerPix = initEmptyPixmap(QSize(1, 1));
m_emptyCornerLeftPix = initEmptyPixmap(QSize(q->elementSize("shadow-topleft").width(), 1)); m_emptyCornerLeftPix = initEmptyPixmap(QSize(q->elementSize(QStringLiteral("shadow-topleft")).width(), 1));
m_emptyCornerTopPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-topleft").height())); m_emptyCornerTopPix = initEmptyPixmap(QSize(1, q->elementSize(QStringLiteral("shadow-topleft")).height()));
m_emptyCornerRightPix = initEmptyPixmap(QSize(q->elementSize("shadow-bottomright").width(), 1)); m_emptyCornerRightPix = initEmptyPixmap(QSize(q->elementSize(QStringLiteral("shadow-bottomright")).width(), 1));
m_emptyCornerBottomPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-bottomright").height())); m_emptyCornerBottomPix = initEmptyPixmap(QSize(1, q->elementSize(QStringLiteral("shadow-bottomright")).height()));
m_emptyVerticalPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-left").height())); m_emptyVerticalPix = initEmptyPixmap(QSize(1, q->elementSize(QStringLiteral("shadow-left")).height()));
m_emptyHorizontalPix = initEmptyPixmap(QSize(q->elementSize("shadow-top").width(), 1)); m_emptyHorizontalPix = initEmptyPixmap(QSize(q->elementSize(QStringLiteral("shadow-top")).width(), 1));
} }
@ -358,7 +358,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
QSize marginHint; QSize marginHint;
if (enabledBorders & Plasma::FrameSvg::TopBorder) { if (enabledBorders & Plasma::FrameSvg::TopBorder) {
marginHint = q->elementSize("shadow-hint-top-margin"); marginHint = q->elementSize(QStringLiteral("shadow-hint-top-margin"));
if (marginHint.isValid()) { if (marginHint.isValid()) {
top = marginHint.height(); top = marginHint.height();
} else { } else {
@ -369,7 +369,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
} }
if (enabledBorders & Plasma::FrameSvg::RightBorder) { if (enabledBorders & Plasma::FrameSvg::RightBorder) {
marginHint = q->elementSize("shadow-hint-right-margin"); marginHint = q->elementSize(QStringLiteral("shadow-hint-right-margin"));
if (marginHint.isValid()) { if (marginHint.isValid()) {
right = marginHint.width(); right = marginHint.width();
} else { } else {
@ -380,7 +380,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
} }
if (enabledBorders & Plasma::FrameSvg::BottomBorder) { if (enabledBorders & Plasma::FrameSvg::BottomBorder) {
marginHint = q->elementSize("shadow-hint-bottom-margin"); marginHint = q->elementSize(QStringLiteral("shadow-hint-bottom-margin"));
if (marginHint.isValid()) { if (marginHint.isValid()) {
bottom = marginHint.height(); bottom = marginHint.height();
} else { } else {
@ -391,7 +391,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
} }
if (enabledBorders & Plasma::FrameSvg::LeftBorder) { if (enabledBorders & Plasma::FrameSvg::LeftBorder) {
marginHint = q->elementSize("shadow-hint-left-margin"); marginHint = q->elementSize(QStringLiteral("shadow-hint-left-margin"));
if (marginHint.isValid()) { if (marginHint.isValid()) {
left = marginHint.width(); left = marginHint.width();
} else { } else {
@ -502,7 +502,7 @@ void DialogShadows::Private::clearShadow(const QWindow *window)
bool DialogShadows::enabled() const bool DialogShadows::enabled() const
{ {
return hasElement("shadow-left"); return hasElement(QStringLiteral("shadow-left"));
} }
#include "moc_dialogshadows_p.cpp" #include "moc_dialogshadows_p.cpp"

View File

@ -29,7 +29,7 @@ class DialogShadows : public Plasma::Svg
Q_OBJECT Q_OBJECT
public: public:
explicit DialogShadows(QObject *parent = 0, const QString &prefix = "dialogs/background"); explicit DialogShadows(QObject *parent = 0, const QString &prefix = QStringLiteral("dialogs/background"));
~DialogShadows(); ~DialogShadows();
static DialogShadows *self(); static DialogShadows *self();

View File

@ -94,7 +94,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
if (PackageUrlInterceptorPrivate::s_packages.contains(pkgName)) { if (PackageUrlInterceptorPrivate::s_packages.contains(pkgName)) {
package = PackageUrlInterceptorPrivate::s_packages.value(pkgName); package = PackageUrlInterceptorPrivate::s_packages.value(pkgName);
} else { } else {
package = Plasma::PluginLoader::self()->loadPackage("Plasma/Applet"); package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"));
package.setPath(pkgName); package.setPath(pkgName);
PackageUrlInterceptorPrivate::s_packages[pkgName] = package; PackageUrlInterceptorPrivate::s_packages[pkgName] = package;
} }
@ -149,7 +149,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
components.pop_front(); components.pop_front();
//obtain a string in the form foo/bar/baz.qml: ui/ gets discarded //obtain a string in the form foo/bar/baz.qml: ui/ gets discarded
const QString &filename = components.join("/"); const QString &filename = components.join(QStringLiteral("/"));
QUrl ret = QUrl::fromLocalFile(package.filePath(prefixForType(type, filename), filename)); QUrl ret = QUrl::fromLocalFile(package.filePath(prefixForType(type, filename), filename));

View File

@ -31,59 +31,59 @@
void LookAndFeelPackage::initPackage(Plasma::Package *package) void LookAndFeelPackage::initPackage(Plasma::Package *package)
{ {
// http://community.kde.org/Plasma/lookAndFeelPackage# // http://community.kde.org/Plasma/lookAndFeelPackage#
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/"); package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/"));
//Defaults //Defaults
package->addFileDefinition("defaults", "defaults", i18n("Default settings for theme, etc.")); package->addFileDefinition("defaults", QStringLiteral("defaults"), i18n("Default settings for theme, etc."));
//Colors //Colors
package->addFileDefinition("colors", "colors", i18n("Color scheme to use for applications.")); package->addFileDefinition("colors", QStringLiteral("colors"), i18n("Color scheme to use for applications."));
//Directories //Directories
package->addDirectoryDefinition("previews", "previews", i18n("Preview Images")); package->addDirectoryDefinition("previews", QStringLiteral("previews"), i18n("Preview Images"));
package->addFileDefinition("loginmanagerpreview", "previews/loginmanager.png", i18n("Preview for the Login Manager")); package->addFileDefinition("loginmanagerpreview", QStringLiteral("previews/loginmanager.png"), i18n("Preview for the Login Manager"));
package->addFileDefinition("lockscreenpreview", "previews/lockscreen.png", i18n("Preview for the Lock Screen")); package->addFileDefinition("lockscreenpreview", QStringLiteral("previews/lockscreen.png"), i18n("Preview for the Lock Screen"));
package->addFileDefinition("userswitcherpreview", "previews/userswitcher.png", i18n("Preview for the Userswitcher")); package->addFileDefinition("userswitcherpreview", QStringLiteral("previews/userswitcher.png"), i18n("Preview for the Userswitcher"));
package->addFileDefinition("desktopswitcherpreview", "previews/desktopswitcher.png", i18n("Preview for the Virtual Desktop Switcher")); package->addFileDefinition("desktopswitcherpreview", QStringLiteral("previews/desktopswitcher.png"), i18n("Preview for the Virtual Desktop Switcher"));
package->addFileDefinition("splashpreview", "previews/splash.png", i18n("Preview for Splash Screen")); package->addFileDefinition("splashpreview", QStringLiteral("previews/splash.png"), i18n("Preview for Splash Screen"));
package->addFileDefinition("runcommandpreview", "previews/runcommand.png", i18n("Preview for KRunner")); package->addFileDefinition("runcommandpreview", QStringLiteral("previews/runcommand.png"), i18n("Preview for KRunner"));
package->addFileDefinition("windowdecorationpreview", "previews/windowdecoration.png", i18n("Preview for the Window Decorations")); package->addFileDefinition("windowdecorationpreview", QStringLiteral("previews/windowdecoration.png"), i18n("Preview for the Window Decorations"));
package->addFileDefinition("windowswitcherpreview", "previews/windowswitcher.png", i18n("Preview for Window Switcher")); package->addFileDefinition("windowswitcherpreview", QStringLiteral("previews/windowswitcher.png"), i18n("Preview for Window Switcher"));
package->addDirectoryDefinition("loginmanager", "loginmanager", i18n("Login Manager")); package->addDirectoryDefinition("loginmanager", QStringLiteral("loginmanager"), i18n("Login Manager"));
package->addFileDefinition("loginmanagermainscript", "loginmanager/LoginManager.qml", i18n("Main Script for Login Manager")); package->addFileDefinition("loginmanagermainscript", QStringLiteral("loginmanager/LoginManager.qml"), i18n("Main Script for Login Manager"));
package->addDirectoryDefinition("logout", "logout", i18n("Logout Dialog")); package->addDirectoryDefinition("logout", QStringLiteral("logout"), i18n("Logout Dialog"));
package->addFileDefinition("logoutmainscript", "logout/Logout.qml", i18n("Main Script for Logout Dialog")); package->addFileDefinition("logoutmainscript", QStringLiteral("logout/Logout.qml"), i18n("Main Script for Logout Dialog"));
package->addDirectoryDefinition("lockscreen", "lockscreen", i18n("Screenlocker")); package->addDirectoryDefinition("lockscreen", QStringLiteral("lockscreen"), i18n("Screenlocker"));
package->addFileDefinition("lockscreenmainscript", "lockscreen/LockScreen.qml", i18n("Main Script for Lock Screen")); package->addFileDefinition("lockscreenmainscript", QStringLiteral("lockscreen/LockScreen.qml"), i18n("Main Script for Lock Screen"));
package->addDirectoryDefinition("userswitcher", "userswitcher", i18n("UI for fast user switching")); package->addDirectoryDefinition("userswitcher", QStringLiteral("userswitcher"), i18n("UI for fast user switching"));
package->addFileDefinition("userswitchermainscript", "userswitcher/UserSwitcher.qml", i18n("Main Script for User Switcher")); package->addFileDefinition("userswitchermainscript", QStringLiteral("userswitcher/UserSwitcher.qml"), i18n("Main Script for User Switcher"));
package->addDirectoryDefinition("desktopswitcher", "desktopswitcher", i18n("Virtual Desktop Switcher")); package->addDirectoryDefinition("desktopswitcher", QStringLiteral("desktopswitcher"), i18n("Virtual Desktop Switcher"));
package->addFileDefinition("desktopswitchermainscript", "desktopswitcher/DesktopSwitcher.qml", i18n("Main Script for Virtual Desktop Switcher")); package->addFileDefinition("desktopswitchermainscript", QStringLiteral("desktopswitcher/DesktopSwitcher.qml"), i18n("Main Script for Virtual Desktop Switcher"));
package->addDirectoryDefinition("osd", "osd", i18n("On-Screen Display Notifications")); package->addDirectoryDefinition("osd", QStringLiteral("osd"), i18n("On-Screen Display Notifications"));
package->addFileDefinition("osdmainscript", "osd/Osd.qml", i18n("Main Script for On-Screen Display Notifications")); package->addFileDefinition("osdmainscript", QStringLiteral("osd/Osd.qml"), i18n("Main Script for On-Screen Display Notifications"));
package->addDirectoryDefinition("splash", "splash", i18n("Splash Screen")); package->addDirectoryDefinition("splash", QStringLiteral("splash"), i18n("Splash Screen"));
package->addFileDefinition("splashmainscript", "splash/Splash.qml", i18n("Main Script for Splash Screen")); package->addFileDefinition("splashmainscript", QStringLiteral("splash/Splash.qml"), i18n("Main Script for Splash Screen"));
package->addDirectoryDefinition("runcommand", "runcommand", i18n("KRunner UI")); package->addDirectoryDefinition("runcommand", QStringLiteral("runcommand"), i18n("KRunner UI"));
package->addFileDefinition("runcommandmainscript", "runcommand/RunCommand.qml", i18n("Main Script KRunner")); package->addFileDefinition("runcommandmainscript", QStringLiteral("runcommand/RunCommand.qml"), i18n("Main Script KRunner"));
package->addDirectoryDefinition("windowdecoration", "windowdecoration", i18n("Window Decoration")); package->addDirectoryDefinition("windowdecoration", QStringLiteral("windowdecoration"), i18n("Window Decoration"));
package->addFileDefinition("windowdecorationmainscript", "windowdecoration/WindowDecoration.qml", i18n("Main Script for Window Decoration")); package->addFileDefinition("windowdecorationmainscript", QStringLiteral("windowdecoration/WindowDecoration.qml"), i18n("Main Script for Window Decoration"));
package->addDirectoryDefinition("windowswitcher", "windowswitcher", i18n("Window Switcher")); package->addDirectoryDefinition("windowswitcher", QStringLiteral("windowswitcher"), i18n("Window Switcher"));
package->addFileDefinition("windowswitchermainscript", "windowswitcher/WindowSwitcher.qml", i18n("Main Script for Window Switcher")); package->addFileDefinition("windowswitchermainscript", QStringLiteral("windowswitcher/WindowSwitcher.qml"), i18n("Main Script for Window Switcher"));
} }
void QmlWallpaperPackage::initPackage(Plasma::Package *package) void QmlWallpaperPackage::initPackage(Plasma::Package *package)
{ {
package->addFileDefinition("mainscript", "ui/main.qml", i18n("Main Script File")); package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File"));
package->setRequired("mainscript", true); package->setRequired("mainscript", true);
QStringList platform = KDeclarative::KDeclarative::runtimePlatform(); QStringList platform = KDeclarative::KDeclarative::runtimePlatform();
@ -94,40 +94,40 @@ void QmlWallpaperPackage::initPackage(Plasma::Package *package)
it.setValue("platformcontents/" + it.value()); it.setValue("platformcontents/" + it.value());
} }
platform.append("contents"); platform.append(QStringLiteral("contents"));
package->setContentsPrefixPaths(platform); package->setContentsPrefixPaths(platform);
} }
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/"); package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/"));
package->addDirectoryDefinition("images", "images", i18n("Images")); package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images"));
package->addDirectoryDefinition("theme", "theme", i18n("Themed Images")); package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images"));
QStringList mimetypes; QStringList mimetypes;
mimetypes << "image/svg+xml" << "image/png" << "image/jpeg"; mimetypes << QStringLiteral("image/svg+xml") << QStringLiteral("image/png") << QStringLiteral("image/jpeg");
package->setMimeTypes("images", mimetypes); package->setMimeTypes("images", mimetypes);
package->setMimeTypes("theme", mimetypes); package->setMimeTypes("theme", mimetypes);
package->addDirectoryDefinition("config", "config", i18n("Configuration Definitions")); package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
mimetypes.clear(); mimetypes.clear();
mimetypes << "text/xml"; mimetypes << QStringLiteral("text/xml");
package->setMimeTypes("config", mimetypes); package->setMimeTypes("config", mimetypes);
package->addDirectoryDefinition("ui", "ui", i18n("User Interface")); package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface"));
package->addDirectoryDefinition("data", "data", i18n("Data Files")); package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files"));
package->addDirectoryDefinition("scripts", "code", i18n("Executable Scripts")); package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts"));
mimetypes.clear(); mimetypes.clear();
mimetypes << "text/plain"; mimetypes << QStringLiteral("text/plain");
package->setMimeTypes("scripts", mimetypes); package->setMimeTypes("scripts", mimetypes);
package->addDirectoryDefinition("translations", "locale", i18n("Translations")); package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations"));
} }
void LayoutTemplatePackage::initPackage(Plasma::Package *package) void LayoutTemplatePackage::initPackage(Plasma::Package *package)
{ {
package->setServicePrefix("plasma-layout-template"); package->setServicePrefix(QStringLiteral("plasma-layout-template"));
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates"); package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates"));
package->addFileDefinition("mainscript", "layout.js", i18n("Main Script File")); package->addFileDefinition("mainscript", QStringLiteral("layout.js"), i18n("Main Script File"));
package->setRequired("mainscript", true); package->setRequired("mainscript", true);
} }

View File

@ -27,18 +27,21 @@
class LookAndFeelPackage : public Plasma::PackageStructure class LookAndFeelPackage : public Plasma::PackageStructure
{ {
Q_OBJECT
public: public:
void initPackage(Plasma::Package *package) Q_DECL_OVERRIDE; void initPackage(Plasma::Package *package) Q_DECL_OVERRIDE;
}; };
class QmlWallpaperPackage : public Plasma::PackageStructure class QmlWallpaperPackage : public Plasma::PackageStructure
{ {
Q_OBJECT
public: public:
void initPackage(Plasma::Package *package) Q_DECL_OVERRIDE; void initPackage(Plasma::Package *package) Q_DECL_OVERRIDE;
}; };
class LayoutTemplatePackage : public Plasma::PackageStructure class LayoutTemplatePackage : public Plasma::PackageStructure
{ {
Q_OBJECT
public: public:
void initPackage(Plasma::Package *package) Q_DECL_OVERRIDE; void initPackage(Plasma::Package *package) Q_DECL_OVERRIDE;
}; };

View File

@ -534,7 +534,7 @@ int AppletInterface::apiVersion() const
return -1; return -1;
} }
return plugins.first().value("X-KDE-PluginInfo-Version").toInt(); return plugins.first().value(QStringLiteral("X-KDE-PluginInfo-Version")).toInt();
} }
void AppletInterface::setAssociatedApplication(const QString &string) void AppletInterface::setAssociatedApplication(const QString &string)
@ -686,7 +686,7 @@ bool AppletInterface::event(QEvent *event)
} }
bool keySequenceUsed = false; bool keySequenceUsed = false;
for (auto a : actions) { foreach (auto a, actions) {
if (a->shortcut().isEmpty()) { if (a->shortcut().isEmpty()) {
continue; continue;
@ -756,7 +756,7 @@ bool AppletInterface::eventFilter(QObject *watched, QEvent *event)
return true; return true;
} }
QAction *action = plugin->contextualActions().first(); QAction *action = plugin->contextualActions().at(0);
action->setData(e->globalPos()); action->setData(e->globalPos());
action->trigger(); action->trigger();
return true; return true;

View File

@ -150,8 +150,8 @@ void ContainmentInterface::init()
qmlObject()->rootObject()->setProperty("parent", QVariant::fromValue(this)); qmlObject()->rootObject()->setProperty("parent", QVariant::fromValue(this));
//set anchors //set anchors
QQmlExpression expr(qmlObject()->engine()->rootContext(), qmlObject()->rootObject(), "parent"); QQmlExpression expr(qmlObject()->engine()->rootContext(), qmlObject()->rootObject(), QStringLiteral("parent"));
QQmlProperty prop(qmlObject()->rootObject(), "anchors.fill"); QQmlProperty prop(qmlObject()->rootObject(), QStringLiteral("anchors.fill"));
prop.write(expr.evaluate()); prop.write(expr.evaluate());
} }
@ -457,8 +457,8 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y)
qDebug() << "Arrived mimeData" << mimeData->urls() << mimeData->formats() << "at" << x << ", " << y; qDebug() << "Arrived mimeData" << mimeData->urls() << mimeData->formats() << "at" << x << ", " << y;
if (mimeData->hasFormat("text/x-plasmoidservicename")) { if (mimeData->hasFormat(QStringLiteral("text/x-plasmoidservicename"))) {
QString data = mimeData->data("text/x-plasmoidservicename"); QString data = mimeData->data(QStringLiteral("text/x-plasmoidservicename"));
const QStringList appletNames = data.split('\n', QString::SkipEmptyParts); const QStringList appletNames = data.split('\n', QString::SkipEmptyParts);
foreach (const QString &appletName, appletNames) { foreach (const QString &appletName, appletNames) {
qDebug() << "adding" << appletName; qDebug() << "adding" << appletName;
@ -488,8 +488,8 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y)
QObject::connect(job, SIGNAL(mimetype(KIO::Job*,QString)), QObject::connect(job, SIGNAL(mimetype(KIO::Job*,QString)),
this, SLOT(mimeTypeRetrieved(KIO::Job*,QString))); this, SLOT(mimeTypeRetrieved(KIO::Job*,QString)));
QMenu *choices = new QMenu("Content dropped"); QMenu *choices = new QMenu(i18n("Content dropped"));
choices->addAction(QIcon::fromTheme("process-working"), i18n("Fetching file type...")); choices->addAction(QIcon::fromTheme(QStringLiteral("process-working")), i18n("Fetching file type..."));
choices->popup(window() ? window()->mapToGlobal(QPoint(x, y)) : QPoint(x, y)); choices->popup(window() ? window()->mapToGlobal(QPoint(x, y)) : QPoint(x, y));
m_dropMenus[job] = choices; m_dropMenus[job] = choices;
@ -584,7 +584,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
return; return;
} }
KPluginInfo::List appletList = Plasma::PluginLoader::self()->listAppletInfoForUrl(tjob->url()); KPluginInfo::List appletList = Plasma::PluginLoader::self()->listAppletInfoForUrl(tjob->url());
if (mimetype.isEmpty() && !appletList.count()) { if (mimetype.isEmpty() && appletList.isEmpty()) {
clearDataForMimeJob(job); clearDataForMimeJob(job);
qDebug() << "No applets found matching the url (" << tjob->url() << ") or the mimetype (" << mimetype << ")"; qDebug() << "No applets found matching the url (" << tjob->url() << ") or the mimetype (" << mimetype << ")";
return; return;
@ -646,7 +646,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
actionsToApplets.insert(action, info.pluginName()); actionsToApplets.insert(action, info.pluginName());
qDebug() << info.pluginName(); qDebug() << info.pluginName();
} }
actionsToApplets.insert(choices->addAction(i18n("Icon")), "org.kde.plasma.icon"); actionsToApplets.insert(choices->addAction(i18n("Icon")), QStringLiteral("org.kde.plasma.icon"));
QHash<QAction *, QString> actionsToWallpapers; QHash<QAction *, QString> actionsToWallpapers;
if (!wallpaperList.isEmpty()) { if (!wallpaperList.isEmpty()) {
@ -672,7 +672,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
// HACK If the QMenu becomes empty at any point after the "determining mimetype" // HACK If the QMenu becomes empty at any point after the "determining mimetype"
// popup was shown, it self-destructs, does not matter if we call clear() or remove // popup was shown, it self-destructs, does not matter if we call clear() or remove
// the action manually, hence we remove the aforementioned item after we populated the menu // the action manually, hence we remove the aforementioned item after we populated the menu
choices->removeAction(choices->actions().first()); choices->removeAction(choices->actions().at(0));
QAction *choice = choices->exec(); QAction *choice = choices->exec();
if (choice) { if (choice) {
@ -737,7 +737,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
} }
} else { } else {
// we can at least create an icon as a link to the URL // we can at least create an icon as a link to the URL
Plasma::Applet *applet = createApplet("org.kde.plasma.icon", QVariantList(), posi); Plasma::Applet *applet = createApplet(QStringLiteral("org.kde.plasma.icon"), QVariantList(), posi);
setAppletArgs(applet, mimetype, tjob->url().toString()); setAppletArgs(applet, mimetype, tjob->url().toString());
} }
} }
@ -803,8 +803,8 @@ void ContainmentInterface::loadWallpaper()
m_wallpaperInterface->setProperty("parent", QVariant::fromValue(this)); m_wallpaperInterface->setProperty("parent", QVariant::fromValue(this));
//set anchors //set anchors
QQmlExpression expr(qmlObject()->engine()->rootContext(), m_wallpaperInterface, "parent"); QQmlExpression expr(qmlObject()->engine()->rootContext(), m_wallpaperInterface, QStringLiteral("parent"));
QQmlProperty prop(m_wallpaperInterface, "anchors.fill"); QQmlProperty prop(m_wallpaperInterface, QStringLiteral("anchors.fill"));
prop.write(expr.evaluate()); prop.write(expr.evaluate());
m_containment->setProperty("wallpaperGraphicsObject", QVariant::fromValue(m_wallpaperInterface)); m_containment->setProperty("wallpaperGraphicsObject", QVariant::fromValue(m_wallpaperInterface));
@ -834,7 +834,7 @@ QList<QObject *> ContainmentInterface::actions() const
//FIXME: giving directly a QList<QAction*> crashes //FIXME: giving directly a QList<QAction*> crashes
QStringList actionOrder; QStringList actionOrder;
actionOrder << "add widgets" << "manage activities" << "remove" << "lock widgets" << "run associated application" << "configure"; actionOrder << QStringLiteral("add widgets") << QStringLiteral("manage activities") << QStringLiteral("remove") << QStringLiteral("lock widgets") << QStringLiteral("run associated application") << QStringLiteral("configure");
QHash<QString, QAction *> orderedActions; QHash<QString, QAction *> orderedActions;
//use a multimap to sort by action type //use a multimap to sort by action type
QMultiMap<int, QObject *> actions; QMultiMap<int, QObject *> actions;
@ -911,7 +911,7 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
//Don't have an action list? execute as single action //Don't have an action list? execute as single action
//and set the event position as action data //and set the event position as action data
if (plugin->contextualActions().length() == 1) { if (plugin->contextualActions().length() == 1) {
QAction *action = plugin->contextualActions().first(); QAction *action = plugin->contextualActions().at(0);
action->setData(event->pos()); action->setData(event->pos());
action->trigger(); action->trigger();
event->accept(); event->accept();
@ -1002,16 +1002,16 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
} }
if (!applet->failedToLaunch()) { if (!applet->failedToLaunch()) {
QAction *runAssociatedApplication = applet->actions()->action("run associated application"); QAction *runAssociatedApplication = applet->actions()->action(QStringLiteral("run associated application"));
if (runAssociatedApplication && runAssociatedApplication->isEnabled()) { if (runAssociatedApplication && runAssociatedApplication->isEnabled()) {
desktopMenu.addAction(runAssociatedApplication); desktopMenu.addAction(runAssociatedApplication);
} }
QAction *configureApplet = applet->actions()->action("configure"); QAction *configureApplet = applet->actions()->action(QStringLiteral("configure"));
if (configureApplet && configureApplet->isEnabled()) { if (configureApplet && configureApplet->isEnabled()) {
desktopMenu.addAction(configureApplet); desktopMenu.addAction(configureApplet);
} }
QAction *appletAlternatives = applet->actions()->action("alternatives"); QAction *appletAlternatives = applet->actions()->action(QStringLiteral("alternatives"));
if (appletAlternatives && appletAlternatives->isEnabled()) { if (appletAlternatives && appletAlternatives->isEnabled()) {
desktopMenu.addAction(appletAlternatives); desktopMenu.addAction(appletAlternatives);
} }
@ -1047,7 +1047,7 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
if (m_containment->immutability() == Plasma::Types::Mutable && if (m_containment->immutability() == Plasma::Types::Mutable &&
(m_containment->containmentType() != Plasma::Types::PanelContainment || m_containment->isUserConfiguring())) { (m_containment->containmentType() != Plasma::Types::PanelContainment || m_containment->isUserConfiguring())) {
QAction *closeApplet = applet->actions()->action("remove"); QAction *closeApplet = applet->actions()->action(QStringLiteral("remove"));
//qDebug() << "checking for removal" << closeApplet; //qDebug() << "checking for removal" << closeApplet;
if (closeApplet) { if (closeApplet) {
if (!desktopMenu.isEmpty()) { if (!desktopMenu.isEmpty()) {
@ -1063,7 +1063,7 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
void ContainmentInterface::addContainmentActions(QMenu &desktopMenu, QEvent *event) void ContainmentInterface::addContainmentActions(QMenu &desktopMenu, QEvent *event)
{ {
if (m_containment->corona()->immutability() != Plasma::Types::Mutable && if (m_containment->corona()->immutability() != Plasma::Types::Mutable &&
!KAuthorized::authorizeKAction("plasma/containment_actions")) { !KAuthorized::authorizeKAction(QStringLiteral("plasma/containment_actions"))) {
//qDebug() << "immutability"; //qDebug() << "immutability";
return; return;
} }
@ -1093,8 +1093,8 @@ void ContainmentInterface::addContainmentActions(QMenu &desktopMenu, QEvent *eve
//a better plugin. note that if the user sets no-plugin this won't happen... //a better plugin. note that if the user sets no-plugin this won't happen...
if ((m_containment->containmentType() != Plasma::Types::PanelContainment && if ((m_containment->containmentType() != Plasma::Types::PanelContainment &&
m_containment->containmentType() != Plasma::Types::CustomPanelContainment) && m_containment->containmentType() != Plasma::Types::CustomPanelContainment) &&
m_containment->actions()->action("configure")) { m_containment->actions()->action(QStringLiteral("configure"))) {
desktopMenu.addAction(m_containment->actions()->action("configure")); desktopMenu.addAction(m_containment->actions()->action(QStringLiteral("configure")));
} }
} else { } else {
desktopMenu.addActions(actions); desktopMenu.addActions(actions);

View File

@ -56,12 +56,12 @@ DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariant
/*qmlRegisterUncreatableType<AppletLoader>("org.kde.plasma.plasmoid", 2, 0, "Plasmoid", /*qmlRegisterUncreatableType<AppletLoader>("org.kde.plasma.plasmoid", 2, 0, "Plasmoid",
QLatin1String("Do not create objects of type Plasmoid"));*/ QLatin1String("Do not create objects of type Plasmoid"));*/
qmlRegisterUncreatableType<AppletInterface>("org.kde.plasma.plasmoid", 2, 0, "Plasmoid", qmlRegisterUncreatableType<AppletInterface>("org.kde.plasma.plasmoid", 2, 0, "Plasmoid",
QLatin1String("Do not create objects of type Plasmoid")); QStringLiteral("Do not create objects of type Plasmoid"));
qmlRegisterUncreatableType<ContainmentInterface>("org.kde.plasma.plasmoid", 2, 0, "Containment", qmlRegisterUncreatableType<ContainmentInterface>("org.kde.plasma.plasmoid", 2, 0, "Containment",
QLatin1String("Do not create objects of type Containment")); QStringLiteral("Do not create objects of type Containment"));
qmlRegisterUncreatableType<WallpaperInterface>("org.kde.plasma.plasmoid", 2, 0, "Wallpaper", qmlRegisterUncreatableType<WallpaperInterface>("org.kde.plasma.plasmoid", 2, 0, "Wallpaper",
QLatin1String("Do not create objects of type Wallpaper")); QStringLiteral("Do not create objects of type Wallpaper"));
qmlRegisterType<KDeclarative::ConfigPropertyMap>(); qmlRegisterType<KDeclarative::ConfigPropertyMap>();
} }

View File

@ -73,12 +73,12 @@ KPluginInfo::List WallpaperInterface::listWallpaperInfoForMimetype(const QString
{ {
auto filter = [&mimetype, &formFactor](const KPluginMetaData &md) -> bool auto filter = [&mimetype, &formFactor](const KPluginMetaData &md) -> bool
{ {
if (!formFactor.isEmpty() && !md.value("X-Plasma-FormFactors").contains(formFactor)) { if (!formFactor.isEmpty() && !md.value(QStringLiteral("X-Plasma-FormFactors")).contains(formFactor)) {
return false; return false;
} }
return md.value("X-Plasma-DropMimeTypes").contains(mimetype); return md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimetype);
}; };
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Wallpaper", QString(), filter).toVector()); return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Wallpaper"), QString(), filter).toVector());
} }
Plasma::Package WallpaperInterface::package() const Plasma::Package WallpaperInterface::package() const
@ -100,7 +100,7 @@ KConfigLoader *WallpaperInterface::configScheme()
{ {
if (!m_configLoader) { if (!m_configLoader) {
//FIXME: do we need "mainconfigxml" in wallpaper packagestructures? //FIXME: do we need "mainconfigxml" in wallpaper packagestructures?
const QString xmlPath = m_pkg.filePath("config", "main.xml"); const QString xmlPath = m_pkg.filePath("config", QStringLiteral("main.xml"));
KConfigGroup cfg = m_containmentInterface->containment()->config(); KConfigGroup cfg = m_containmentInterface->containment()->config();
cfg = KConfigGroup(&cfg, "Wallpaper"); cfg = KConfigGroup(&cfg, "Wallpaper");
@ -134,7 +134,7 @@ void WallpaperInterface::syncWallpaperPackage()
} }
m_actions->clear(); m_actions->clear();
m_pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Wallpaper"); m_pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Wallpaper"));
m_pkg.setPath(m_wallpaperPlugin); m_pkg.setPath(m_wallpaperPlugin);
if (!m_pkg.isValid()) { if (!m_pkg.isValid()) {
qWarning() << "Error loading the wallpaper, no valid package loaded"; qWarning() << "Error loading the wallpaper, no valid package loaded";
@ -150,12 +150,12 @@ void WallpaperInterface::syncWallpaperPackage()
} }
m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript"))); m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript")));
m_qmlObject->rootContext()->setContextProperty("wallpaper", this); m_qmlObject->rootContext()->setContextProperty(QStringLiteral("wallpaper"), this);
//initialize with our size to avoid as much resize events as possible //initialize with our size to avoid as much resize events as possible
QVariantHash props; QVariantHash props;
props["width"] = width(); props[QStringLiteral("width")] = width();
props["height"] = height(); props[QStringLiteral("height")] = height();
m_qmlObject->completeInitialization(props); m_qmlObject->completeInitialization(props);
} }
@ -168,8 +168,8 @@ void WallpaperInterface::loadFinished()
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this)); m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
//set anchors //set anchors
QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent"); QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), QStringLiteral("parent"));
QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill"); QQmlProperty prop(m_qmlObject->rootObject(), QStringLiteral("anchors.fill"));
prop.write(expr.evaluate()); prop.write(expr.evaluate());
} else if (m_qmlObject->mainComponent()) { } else if (m_qmlObject->mainComponent()) {
@ -201,7 +201,7 @@ bool WallpaperInterface::supportsMimetype(const QString &mimetype) const
void WallpaperInterface::setUrl(const QUrl &url) void WallpaperInterface::setUrl(const QUrl &url)
{ {
if (m_qmlObject->rootObject()) { if (m_qmlObject->rootObject()) {
QMetaObject::invokeMethod(m_qmlObject->rootObject(), QString("setUrl").toLatin1(), Qt::DirectConnection, Q_ARG(QVariant, QVariant::fromValue(url))); QMetaObject::invokeMethod(m_qmlObject->rootObject(), QStringLiteral("setUrl").toLatin1(), Qt::DirectConnection, Q_ARG(QVariant, QVariant::fromValue(url)));
} }
} }

View File

@ -39,7 +39,7 @@ int main(int argc, char **argv)
parser->addVersionOption(); parser->addVersionOption();
parser->setApplicationDescription(description); parser->setApplicationDescription(description);
parser->addOption(QCommandLineOption(QStringList() << "s" << "show", i18nc("Do not translate <name>", "Show icon sizes"), "name")); parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("show"), i18nc("Do not translate <name>", "Show icon sizes"), QStringLiteral("name")));
return app.exec(); return app.exec();
} }

View File

@ -36,7 +36,7 @@ int main(int argc, char **argv)
parser->addVersionOption(); parser->addVersionOption();
parser->setApplicationDescription(description); parser->setApplicationDescription(description);
parser->addOption(QCommandLineOption(QStringList() << "s" << "show", i18nc("Do not translate <name>", "Show plugins"), "name")); parser->addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("show"), i18nc("Do not translate <name>", "Show plugins"), QStringLiteral("name")));
return app.exec(); return app.exec();
} }

View File

@ -91,10 +91,10 @@ bool PluginTest::loadKPlugin()
{ {
bool ok = false; bool ok = false;
qDebug() << "Load KPlugin"; qDebug() << "Load KPlugin";
QString pluginPath = "/home/sebas/kf5/install/lib/x86_64-linux-gnu/kplugins/"; QString pluginPath = QStringLiteral("/home/sebas/kf5/install/lib/x86_64-linux-gnu/kplugins/");
QCoreApplication::addLibraryPath(pluginPath); QCoreApplication::addLibraryPath(pluginPath);
//QPluginLoader loader("/home/sebas/kf5/install/lib/x86_64-linux-gnu/kplugins/libkqpluginfactory.so", this); //QPluginLoader loader("/home/sebas/kf5/install/lib/x86_64-linux-gnu/kplugins/libkqpluginfactory.so", this);
QPluginLoader loader("/home/sebas/kf5/install/lib/x86_64-linux-gnu/plugins/kf5/kplugins/libplasma_engine_time.so", this); QPluginLoader loader(QStringLiteral("/home/sebas/kf5/install/lib/x86_64-linux-gnu/plugins/kf5/kplugins/libplasma_engine_time.so"), this);
KPluginFactory *factory = qobject_cast<KPluginFactory *>(loader.instance()); KPluginFactory *factory = qobject_cast<KPluginFactory *>(loader.instance());
//QObject *factory = loader.instance(); //QObject *factory = loader.instance();
if (factory) { if (factory) {
@ -109,7 +109,7 @@ bool PluginTest::loadKPlugin()
if (time_engine) { if (time_engine) {
qDebug() << "Successfully loaded timeengine"; qDebug() << "Successfully loaded timeengine";
time_engine->connectSource("Europe/Amsterdam", this); time_engine->connectSource(QStringLiteral("Europe/Amsterdam"), this);
qDebug() << "SOURCE: " << time_engine->sources(); qDebug() << "SOURCE: " << time_engine->sources();
ok = true; ok = true;
} else { } else {
@ -130,8 +130,8 @@ bool PluginTest::loadFromKService(const QString &name)
DataEngine *engine = 0; DataEngine *engine = 0;
// load the engine, add it to the engines // load the engine, add it to the engines
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(name); QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine", KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/DataEngine"),
constraint); constraint);
QString error; QString error;
@ -140,7 +140,7 @@ bool PluginTest::loadFromKService(const QString &name)
} else { } else {
QVariantList allArgs; QVariantList allArgs;
allArgs << offers.first()->storageId(); allArgs << offers.first()->storageId();
QString api = offers.first()->property("X-Plasma-API").toString(); QString api = offers.first()->property(QStringLiteral("X-Plasma-API")).toString();
if (api.isEmpty()) { if (api.isEmpty()) {
if (offers.first()) { if (offers.first()) {
KPluginLoader plugin(*offers.first()); KPluginLoader plugin(*offers.first());
@ -164,8 +164,8 @@ bool PluginTest::loadFromPlasma()
foreach (const QString &e, allEngines) { foreach (const QString &e, allEngines) {
Plasma::DataEngine *engine = Plasma::PluginLoader::self()->loadDataEngine(e); Plasma::DataEngine *engine = Plasma::PluginLoader::self()->loadDataEngine(e);
if (engine) { if (engine) {
engine->connectSource("Europe/Amsterdam", this); engine->connectSource(QStringLiteral("Europe/Amsterdam"), this);
engine->connectSource("Battery", this); engine->connectSource(QStringLiteral("Battery"), this);
engine->connectAllSources(this); engine->connectAllSources(this);
qDebug() << "SOURCE: " << engine->sources(); qDebug() << "SOURCE: " << engine->sources();
ok = true; ok = true;
@ -219,9 +219,9 @@ bool PluginTest::loadKService(const QString &name)
qDebug() << "Load KService"; qDebug() << "Load KService";
DataEngine *engine = 0; DataEngine *engine = 0;
// load the engine, add it to the engines // load the engine, add it to the engines
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(name); QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
constraint = QString(); constraint = QString();
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine", KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/DataEngine"),
constraint); constraint);
QString error; QString error;
@ -232,7 +232,7 @@ bool PluginTest::loadKService(const QString &name)
QVariantList allArgs; QVariantList allArgs;
allArgs << offers.first()->storageId(); allArgs << offers.first()->storageId();
QString api = offers.first()->property("X-Plasma-API").toString(); QString api = offers.first()->property(QStringLiteral("X-Plasma-API")).toString();
if (api.isEmpty()) { if (api.isEmpty()) {
if (offers.first()) { if (offers.first()) {
KPluginLoader plugin(*offers.first()); KPluginLoader plugin(*offers.first());
@ -242,7 +242,7 @@ bool PluginTest::loadKService(const QString &name)
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error); engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
qDebug() << "DE"; qDebug() << "DE";
if (engine) { if (engine) {
engine->connectSource("Europe/Amsterdam", this); engine->connectSource(QStringLiteral("Europe/Amsterdam"), this);
qDebug() << "SOURCE: " << engine->sources(); qDebug() << "SOURCE: " << engine->sources();
//qDebug() << "DataEngine ID: " << engine->pluginInfo().name(); //qDebug() << "DataEngine ID: " << engine->pluginInfo().name();
} else { } else {
@ -258,7 +258,7 @@ bool PluginTest::loadKService(const QString &name)
} }
QStringList result; QStringList result;
foreach (const KService::Ptr &service, offers) { foreach (const KService::Ptr &service, offers) {
const QString _plugin = service->property("X-KDE-PluginInfo-Name", QVariant::String).toString(); const QString _plugin = service->property(QStringLiteral("X-KDE-PluginInfo-Name"), QVariant::String).toString();
qDebug() << "Found plugin: " << _plugin; qDebug() << "Found plugin: " << _plugin;
if (!result.contains(_plugin)) { if (!result.contains(_plugin)) {
result << _plugin; result << _plugin;

View File

@ -45,7 +45,7 @@ public:
public Q_SLOTS: public Q_SLOTS:
void runMain(); void runMain();
bool loadKPlugin(); bool loadKPlugin();
bool loadFromKService(const QString &name = "time"); bool loadFromKService(const QString &name = QStringLiteral("time"));
bool loadFromPlasma(); bool loadFromPlasma();
void loadKQPlugin(); void loadKQPlugin();
bool loadKService(const QString &name = QString()); bool loadKService(const QString &name = QString());

View File

@ -46,119 +46,119 @@ TestEngine::~TestEngine()
void TestEngine::init() void TestEngine::init()
{ {
QString dsn("TestEngine"); QString dsn(QStringLiteral("TestEngine"));
// QVariant::Invalid // QVariant::Invalid
// QVariant::BitArray // QVariant::BitArray
setData(dsn, "QBitArray", QVariant(QBitArray(97, false))); setData(dsn, QStringLiteral("QBitArray"), QVariant(QBitArray(97, false)));
// QVariant::Bitmap // QVariant::Bitmap
setData(dsn, "QBitmap", QVariant(QBitmap(12, 57))); setData(dsn, QStringLiteral("QBitmap"), QVariant(QBitmap(12, 57)));
// QVariant::Bool // QVariant::Bool
setData(dsn, "bool", QVariant((bool)true)); setData(dsn, QStringLiteral("bool"), QVariant((bool)true));
// QVariant::Brush // QVariant::Brush
setData(dsn, "QBrush", QVariant(QBrush(Qt::SolidPattern))); setData(dsn, QStringLiteral("QBrush"), QVariant(QBrush(Qt::SolidPattern)));
// QVariant::ByteArray // QVariant::ByteArray
QByteArray byteArray; QByteArray byteArray;
for (int i = 0; i < 256; ++i) { for (int i = 0; i < 256; ++i) {
byteArray.append(i); byteArray.append(i);
} }
setData(dsn, "QByteArray1", QVariant(byteArray)); setData(dsn, QStringLiteral("QByteArray1"), QVariant(byteArray));
setData(dsn, "QByteArray2", QVariant(QByteArray("KDE4"))); setData(dsn, QStringLiteral("QByteArray2"), QVariant(QByteArray("KDE4")));
// QVariant::Char // QVariant::Char
setData(dsn, "QChar", QVariant(QChar(0x4B))); setData(dsn, QStringLiteral("QChar"), QVariant(QChar(0x4B)));
// QVariant::Color // QVariant::Color
setData(dsn, "QColor", QVariant(QColor("#031337"))); setData(dsn, QStringLiteral("QColor"), QVariant(QColor("#031337")));
// QVariant::Cursor // QVariant::Cursor
setData(dsn, "QCursor", QVariant(QCursor(Qt::ArrowCursor))); setData(dsn, QStringLiteral("QCursor"), QVariant(QCursor(Qt::ArrowCursor)));
// QVariant::Date // QVariant::Date
setData(dsn, "QDate", QVariant(QDate(2008, 1, 11))); setData(dsn, QStringLiteral("QDate"), QVariant(QDate(2008, 1, 11)));
// QVariant::DateTime // QVariant::DateTime
setData(dsn, "QDateTime", QVariant(QDateTime(QDate(2008, 1, 11), QTime(12, 34, 56)))); setData(dsn, QStringLiteral("QDateTime"), QVariant(QDateTime(QDate(2008, 1, 11), QTime(12, 34, 56))));
// QVariant::Double // QVariant::Double
setData(dsn, "double", QVariant((double)12.34)); setData(dsn, QStringLiteral("double"), QVariant((double)12.34));
// QVariant::Font // QVariant::Font
setData(dsn, "QFont", QVariant(QFont())); setData(dsn, QStringLiteral("QFont"), QVariant(QFont()));
// QVariant::Icon // QVariant::Icon
setData(dsn, "QIcon", QVariant(QIcon(QPixmap(12, 34)))); setData(dsn, QStringLiteral("QIcon"), QVariant(QIcon(QPixmap(12, 34))));
// QVariant::Image // QVariant::Image
setData(dsn, "QImage", QVariant(QImage(56, 78, QImage::Format_Mono))); setData(dsn, QStringLiteral("QImage"), QVariant(QImage(56, 78, QImage::Format_Mono)));
// QVariant::Int // QVariant::Int
setData(dsn, "int", QVariant((int) - 4321)); setData(dsn, QStringLiteral("int"), QVariant((int) - 4321));
// QVariant::KeySequence (???) // QVariant::KeySequence (???)
// QVariant::Line // QVariant::Line
setData(dsn, "QLine", QVariant(QLine(12, 34, 56, 78))); setData(dsn, QStringLiteral("QLine"), QVariant(QLine(12, 34, 56, 78)));
// QVariant::LineF // QVariant::LineF
setData(dsn, "QLineF", QVariant(QLineF(1.2, 3.4, 5.6, 7.8))); setData(dsn, QStringLiteral("QLineF"), QVariant(QLineF(1.2, 3.4, 5.6, 7.8)));
// QVariant::List // QVariant::List
QList<QVariant> list; QList<QVariant> list;
list << QString("KDE4") << QBrush() << QPen(); list << QStringLiteral("KDE4") << QBrush() << QPen();
setData(dsn, "QList", QVariant(list)); setData(dsn, QStringLiteral("QList"), QVariant(list));
// QVariant::Locale // QVariant::Locale
setData(dsn, "QLocale", QVariant(QLocale("fr_FR"))); setData(dsn, QStringLiteral("QLocale"), QVariant(QLocale(QStringLiteral("fr_FR"))));
// QVariant::LongLong // QVariant::LongLong
setData(dsn, "qlonglong", QVariant((qlonglong) - 4321)); setData(dsn, QStringLiteral("qlonglong"), QVariant((qlonglong) - 4321));
// QVariant::Map // QVariant::Map
QMap<QString, QVariant> map; QMap<QString, QVariant> map;
for (int i = 0; i < 123; ++i) { for (int i = 0; i < 123; ++i) {
QString key = QString("key%1").arg(i); QString key = QStringLiteral("key%1").arg(i);
QString val = QString("value%1").arg(i); QString val = QStringLiteral("value%1").arg(i);
map[key] = val; map[key] = val;
} }
setData(dsn, "QMap", QVariant(map)); setData(dsn, QStringLiteral("QMap"), QVariant(map));
// QVariant::Matrix // QVariant::Matrix
setData(dsn, "QMatrix", QVariant(QMatrix())); setData(dsn, QStringLiteral("QMatrix"), QVariant(QMatrix()));
// QVariant::Transform // QVariant::Transform
setData(dsn, "QTransform", QVariant(QTransform())); setData(dsn, QStringLiteral("QTransform"), QVariant(QTransform()));
// QVariant::Palette // QVariant::Palette
setData(dsn, "QPalette", QVariant(QPalette())); setData(dsn, QStringLiteral("QPalette"), QVariant(QPalette()));
// QVariant::Pen // QVariant::Pen
setData(dsn, "QPen", QVariant(QPen(Qt::SolidLine))); setData(dsn, QStringLiteral("QPen"), QVariant(QPen(Qt::SolidLine)));
// QVariant::Pixmap // QVariant::Pixmap
setData(dsn, "QPixmap", QVariant(QPixmap(12, 34))); setData(dsn, QStringLiteral("QPixmap"), QVariant(QPixmap(12, 34)));
// QVariant::Point // QVariant::Point
setData(dsn, "QPoint", QVariant(QPoint(12, 34))); setData(dsn, QStringLiteral("QPoint"), QVariant(QPoint(12, 34)));
// QVariant::PointArray (obsoloted in Qt4, see QPolygon) // QVariant::PointArray (obsoloted in Qt4, see QPolygon)
// QVariant::PointF // QVariant::PointF
setData(dsn, "QPointF", QVariant(QPointF(12.34, 56.78))); setData(dsn, QStringLiteral("QPointF"), QVariant(QPointF(12.34, 56.78)));
// QVariant::Polygon // QVariant::Polygon
setData(dsn, "QPolygon", QVariant(QPolygon(42))); setData(dsn, QStringLiteral("QPolygon"), QVariant(QPolygon(42)));
// QVariant::Rect // QVariant::Rect
setData(dsn, "QRect", QVariant(QRect(12, 34, 56, 78))); setData(dsn, QStringLiteral("QRect"), QVariant(QRect(12, 34, 56, 78)));
// QVariant::RectF // QVariant::RectF
setData(dsn, "QRectF", QVariant(QRectF(1.2, 3.4, 5.6, 7.8))); setData(dsn, QStringLiteral("QRectF"), QVariant(QRectF(1.2, 3.4, 5.6, 7.8)));
// QVariant::RegExp // QVariant::RegExp
setData(dsn, "QRegExp", QVariant(QRegExp("^KDE4$"))); setData(dsn, QStringLiteral("QRegExp"), QVariant(QRegExp("^KDE4$")));
// QVariant::Region // QVariant::Region
setData(dsn, "QRegion", QVariant(QRegion(10, 20, 30, 40))); setData(dsn, QStringLiteral("QRegion"), QVariant(QRegion(10, 20, 30, 40)));
// QVariant::Size // QVariant::Size
setData(dsn, "QSize", QVariant(QSize(12, 34))); setData(dsn, QStringLiteral("QSize"), QVariant(QSize(12, 34)));
// QVariant::SizeF // QVariant::SizeF
setData(dsn, "QSizeF", QVariant(QSizeF(12.34, 56.78))); setData(dsn, QStringLiteral("QSizeF"), QVariant(QSizeF(12.34, 56.78)));
// QVariant::SizePolicy // QVariant::SizePolicy
setData(dsn, "QSizePolicy", QVariant(QSizePolicy())); setData(dsn, QStringLiteral("QSizePolicy"), QVariant(QSizePolicy()));
// QVariant::String // QVariant::String
setData(dsn, "QString", QVariant(QString("KDE4 ROCKS!"))); setData(dsn, QStringLiteral("QString"), QVariant(QStringLiteral("KDE4 ROCKS!")));
// QVariant::StringList // QVariant::StringList
QStringList stringList; QStringList stringList;
stringList << "K" << "D" << "E" << "4"; stringList << QStringLiteral("K") << QStringLiteral("D") << QStringLiteral("E") << QStringLiteral("4");
setData(dsn, "QStringList", QVariant(stringList)); setData(dsn, QStringLiteral("QStringList"), QVariant(stringList));
// QVariant::TextFormat // QVariant::TextFormat
setData(dsn, "QTextFormat", QVariant(QTextFormat())); setData(dsn, QStringLiteral("QTextFormat"), QVariant(QTextFormat()));
// QVariant::TextLength // QVariant::TextLength
setData(dsn, "QTextLength", QVariant(QTextLength())); setData(dsn, QStringLiteral("QTextLength"), QVariant(QTextLength()));
// QVariant::Time // QVariant::Time
setData(dsn, "QTime", QVariant(QTime(12, 34, 56))); setData(dsn, QStringLiteral("QTime"), QVariant(QTime(12, 34, 56)));
// QVariant::UInt // QVariant::UInt
setData(dsn, "uint", QVariant((uint)4321)); setData(dsn, QStringLiteral("uint"), QVariant((uint)4321));
// QVariant::ULongLong // QVariant::ULongLong
setData(dsn, "qulonglong", QVariant((qulonglong)4321)); setData(dsn, QStringLiteral("qulonglong"), QVariant((qulonglong)4321));
// QVariant::Url // QVariant::Url
setData(dsn, "QUrl", QVariant(QUrl("http://user:password@example.com:80/test.php?param1=foo&param2=bar"))); setData(dsn, QStringLiteral("QUrl"), QVariant(QUrl(QStringLiteral("http://user:password@example.com:80/test.php?param1=foo&param2=bar"))));
// QVariant::UserType // QVariant::UserType
MyUserType userType; MyUserType userType;
QVariant v; QVariant v;
v.setValue(userType); v.setValue(userType);
setData(dsn, "UserType", v); setData(dsn, QStringLiteral("UserType"), v);
} // init() } // init()
bool TestEngine::sourceRequestEvent(const QString &source) bool TestEngine::sourceRequestEvent(const QString &source)