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)
{
Q_UNUSED(args)
if (name == "simpleapplet") {
if (name == QLatin1String("simpleapplet")) {
return new SimpleApplet(0, QString(), appletId);
} else if (name == "simplecontainment") {
} else if (name == QLatin1String("simplecontainment")) {
return new SimpleContainment(0, QString(), appletId);
} else if (name == "simplenoscreencontainment") {
} else if (name == QLatin1String("simplenoscreencontainment")) {
return new SimpleNoScreenContainment(0, QString(), appletId);
} else {
return 0;
@ -103,10 +103,10 @@ SimpleNoScreenContainment::SimpleNoScreenContainment(QObject *parent , const QSt
static void runKBuildSycoca()
{
QProcess proc;
const QString kbuildsycoca = QStandardPaths::findExecutable(KBUILDSYCOCA_EXENAME);
const QString kbuildsycoca = QStandardPaths::findExecutable(QStringLiteral(KBUILDSYCOCA_EXENAME));
QVERIFY(!kbuildsycoca.isEmpty());
QStringList args;
args << "--testmode";
args << QStringLiteral("--testmode");
proc.setProcessChannelMode(QProcess::MergedChannels); // silence kbuildsycoca output
proc.start(kbuildsycoca, args);
@ -130,7 +130,7 @@ void CoronaTest::initTestCase()
m_configDir = QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
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"))));
}
@ -143,10 +143,10 @@ void CoronaTest::cleanupTestCase()
void CoronaTest::restore()
{
m_corona->loadLayout("plasma-test-appletsrc");
m_corona->loadLayout(QStringLiteral("plasma-test-appletsrc"));
QCOMPARE(m_corona->containments().count(), 3);
for (auto cont : m_corona->containments()) {
foreach (auto cont, m_corona->containments()) {
switch (cont->id()) {
case 1:
QCOMPARE(cont->applets().count(), 2);
@ -166,41 +166,41 @@ void CoronaTest::checkOrder()
QCOMPARE(m_corona->containments().count(), 3);
//check containments order
QCOMPARE(m_corona->containments()[0]->id(), (uint)1);
QCOMPARE(m_corona->containments()[1]->id(), (uint)4);
QCOMPARE(m_corona->containments()[2]->id(), (uint)5);
QCOMPARE(m_corona->containments().at(0)->id(), (uint)1);
QCOMPARE(m_corona->containments().at(1)->id(), (uint)4);
QCOMPARE(m_corona->containments().at(2)->id(), (uint)5);
//check applets order
QCOMPARE(m_corona->containments()[0]->applets().count(), 2);
QCOMPARE(m_corona->containments()[0]->applets()[0]->id(), (uint)2);
QCOMPARE(m_corona->containments()[0]->applets()[1]->id(), (uint)3);
QCOMPARE(m_corona->containments().at(0)->applets().count(), 2);
QCOMPARE(m_corona->containments().at(0)->applets().at(0)->id(), (uint)2);
QCOMPARE(m_corona->containments().at(0)->applets().at(1)->id(), (uint)3);
}
void CoronaTest::startupCompletion()
{
QVERIFY(!m_corona->isStartupCompleted());
QVERIFY(!m_corona->containments().first()->isUiReady());
QVERIFY(!m_corona->containments().at(0)->isUiReady());
QSignalSpy spy(m_corona, SIGNAL(startupCompleted()));
QVERIFY(spy.wait(1000));
QVERIFY(m_corona->isStartupCompleted());
QVERIFY(m_corona->containments().first()->isUiReady());
QVERIFY(m_corona->containments().at(0)->isUiReady());
}
void CoronaTest::addRemoveApplets()
{
m_corona->containments().first()->createApplet("invalid");
QCOMPARE(m_corona->containments().first()->applets().count(), 3);
m_corona->containments().at(0)->createApplet(QStringLiteral("invalid"));
QCOMPARE(m_corona->containments().at(0)->applets().count(), 3);
//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
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));
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
@ -212,9 +212,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(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);
for (Plasma::Applet *app : cont->applets()) {
foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::UserImmutable);
}
}
@ -222,9 +222,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(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);
for (Plasma::Applet *app : cont->applets()) {
foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::Mutable);
}
}
@ -232,9 +232,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(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);
for (Plasma::Applet *app : cont->applets()) {
foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::SystemImmutable);
}
}
@ -243,9 +243,9 @@ void CoronaTest::immutability()
m_corona->setImmutability(Plasma::Types::Mutable);
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);
for (Plasma::Applet *app : cont->applets()) {
foreach (Plasma::Applet *app, cont->applets()) {
QCOMPARE(app->immutability(), Plasma::Types::SystemImmutable);
}
}

View File

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

View File

@ -29,11 +29,11 @@
void FallbackPackageTest::initTestCase()
{
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_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);
}
@ -43,8 +43,8 @@ void FallbackPackageTest::beforeFallback()
QVERIFY(m_pkg.hasValidStructure());
//m_fallbackPkg should have otherfile.qml, m_pkg shouldn't
QVERIFY(!m_fallbackPkg.filePath("ui", "otherfile.qml").isEmpty());
QVERIFY(m_pkg.filePath("ui", "otherfile.qml").isEmpty());
QVERIFY(!m_fallbackPkg.filePath("ui", QStringLiteral("otherfile.qml")).isEmpty());
QVERIFY(m_pkg.filePath("ui", QStringLiteral("otherfile.qml")).isEmpty());
}
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
// for otherfile.qml
QVERIFY(!m_pkg.filePath("ui", "otherfile.qml").isEmpty());
QCOMPARE(m_fallbackPkg.filePath("ui", "otherfile.qml"), m_pkg.filePath("ui", "otherfile.qml"));
QVERIFY(!m_pkg.filePath("ui", QStringLiteral("otherfile.qml")).isEmpty());
QCOMPARE(m_fallbackPkg.filePath("ui", QStringLiteral("otherfile.qml")), m_pkg.filePath("ui", QStringLiteral("otherfile.qml")));
QVERIFY(m_fallbackPkg.filePath("mainscript") != m_pkg.filePath("mainscript"));
}
@ -64,7 +64,7 @@ void FallbackPackageTest::cycle()
m_pkg.setFallbackPackage(m_fallbackPkg);
//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)

View File

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

View File

@ -38,7 +38,7 @@ bool buildonly = true;
void PluginTest::listEngines()
{
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 " << plugins.count() << " DataEngines";
@ -54,14 +54,14 @@ void PluginTest::listAppletCategories()
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();
//QVERIFY(plugins.count() > 0 || buildonly);
}
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();
QVERIFY(plugins.count() > 0 || buildonly);
@ -69,7 +69,7 @@ void PluginTest::listContainmentsOfType()
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();
QVERIFY(engine != 0 || buildonly);

View File

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

View File

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

View File

@ -192,7 +192,7 @@ QString Calendar::monthName() const
// locale and take the month name from that.
//
// 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
QLocale langLocale(lang);
return langLocale.standaloneMonthName(m_displayedDate.month());

View File

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

View File

@ -58,10 +58,10 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
QQmlContext *context = engine->rootContext();
Plasma::QuickTheme *theme = new Plasma::QuickTheme(engine);
context->setContextProperty("theme", theme);
context->setContextProperty(QStringLiteral("theme"), theme);
Units *units = new Units(context);
context->setContextProperty("units", units);
context->setContextProperty(QStringLiteral("units"), units);
if (!engine->rootContext()->contextObject()) {
KDeclarative::KDeclarative kdeclarative;
@ -83,7 +83,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
qmlRegisterType<Plasma::FrameSvgItem>(uri, 2, 0, "FrameSvgItem");
//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<Plasma::DataSource>(uri, 2, 0, "DataSource");

View File

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

View File

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

View File

@ -76,13 +76,13 @@ ToolTip::~ToolTip()
void ToolTip::settingsChanged()
{
KSharedConfig::openConfig("plasmarc")->reparseConfiguration();
KSharedConfig::openConfig(QStringLiteral("plasmarc"))->reparseConfiguration();
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_tooltipsEnabledGlobally = (m_interval > 0);
}

View File

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

View File

@ -33,8 +33,8 @@
#include <KDirWatch>
#include <KIconLoader>
const QString plasmarc = QStringLiteral("plasmarc");
const QString groupName = QStringLiteral("Units");
QString plasmarc() { return QStringLiteral("plasmarc"); }
QString groupName() { return QStringLiteral("Units"); }
const int defaultLongDuration = 120;
@ -78,7 +78,7 @@ Units::Units(QObject *parent)
connect(KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged, this, &Units::iconLoaderSettingsChanged);
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);
// Catch both, direct changes to the config file ...
@ -95,8 +95,8 @@ Units::~Units()
void Units::settingsFileChanged(const QString &file)
{
if (file.endsWith(plasmarc)) {
KSharedConfigPtr cfg = KSharedConfig::openConfig(plasmarc);
if (file.endsWith(plasmarc())) {
KSharedConfigPtr cfg = KSharedConfig::openConfig(plasmarc());
cfg->reparseConfiguration();
updatePlasmaRCSettings();
}
@ -104,7 +104,7 @@ void Units::settingsFileChanged(const QString &file)
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
// see Bug 357532 and QTBUG-39766
const int longDuration = qMax(1, cfg.readEntry("longDuration", defaultLongDuration));
@ -118,15 +118,15 @@ void Units::updatePlasmaRCSettings()
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("small", devicePixelIconSize(KIconLoader::SizeSmall));
m_iconSizes->insert("smallMedium", devicePixelIconSize(KIconLoader::SizeSmallMedium));
m_iconSizes->insert("medium", devicePixelIconSize(KIconLoader::SizeMedium));
m_iconSizes->insert("large", devicePixelIconSize(KIconLoader::SizeLarge));
m_iconSizes->insert("huge", devicePixelIconSize(KIconLoader::SizeHuge));
m_iconSizes->insert("enormous", devicePixelIconSize(KIconLoader::SizeEnormous));
m_iconSizes->insert(QStringLiteral("tiny"), devicePixelIconSize(KIconLoader::SizeSmall) / 2);
m_iconSizes->insert(QStringLiteral("small"), devicePixelIconSize(KIconLoader::SizeSmall));
m_iconSizes->insert(QStringLiteral("smallMedium"), devicePixelIconSize(KIconLoader::SizeSmallMedium));
m_iconSizes->insert(QStringLiteral("medium"), devicePixelIconSize(KIconLoader::SizeMedium));
m_iconSizes->insert(QStringLiteral("large"), devicePixelIconSize(KIconLoader::SizeLarge));
m_iconSizes->insert(QStringLiteral("huge"), devicePixelIconSize(KIconLoader::SizeHuge));
m_iconSizes->insert(QStringLiteral("enormous"), devicePixelIconSize(KIconLoader::SizeEnormous));
emit iconSizesChanged();
}
@ -235,7 +235,7 @@ int Units::largeSpacing() const
void Units::updateSpacing()
{
int gridUnit = QFontMetrics(QGuiApplication::font()).boundingRect("M").height();
int gridUnit = QFontMetrics(QGuiApplication::font()).boundingRect(QStringLiteral("M")).height();
if (gridUnit % 2 != 0) {
gridUnit++;

View File

@ -245,7 +245,7 @@ void WindowThumbnail::iconToTexture(WindowTextureNode *textureNode)
icon = KWindowSystem::self()->icon(m_winId);
} else {
// fallback to plasma icon
icon = QIcon::fromTheme("plasma");
icon = QIcon::fromTheme(QStringLiteral("plasma"));
}
QImage image = icon.pixmap(boundingRect().size().toSize()).toImage();
textureNode->reset(window()->createTextureFromImage(image));
@ -513,7 +513,7 @@ bool WindowThumbnail::loadGLXTexture()
// As the GLXFBConfig might be context specific and we cannot be sure
// that the code might be entered from different contexts, the cache
// 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);
if (it == s_fbConfigs.end()) {
// 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";
return 0;
} 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>()) {
m_action->setIcon(i.value<QIcon>());
} else if (i.canConvert<QString>()) {
m_action->setIcon(QIcon::fromTheme(i.value<QString>()));
m_action->setIcon(QIcon::fromTheme(i.toString()));
}
emit iconChanged();
}

View File

@ -32,7 +32,7 @@
void PlasmaExtraComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
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)

View File

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

View File

@ -101,7 +101,7 @@ void Containment::init()
if (d->type == Types::NoContainmentType) {
//setContainmentType(Plasma::Types::DesktopContainment);
//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")) {
setContainmentType(Plasma::Types::PanelContainment);
@ -142,7 +142,7 @@ void Containment::init()
QAction *lockDesktopAction = corona()->actions()->action(QStringLiteral("lock widgets"));
//keep a pointer so nobody notices it moved to corona
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);
}
for (Applet *applet : Containment::applets()) {
foreach (Applet *applet, Containment::applets()) {
if (!applet->pluginInfo().isValid()) {
applet->updateConstraints(Plasma::Types::UiReadyConstraint);
}

View File

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

View File

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

View File

@ -249,8 +249,8 @@ void DataContainerPrivate::store()
storage = new Storage(q);
}
QVariantMap op = storage->operationDescription("save");
op["group"] = q->objectName();
QVariantMap op = storage->operationDescription(QStringLiteral("save"));
op[QStringLiteral("group")] = q->objectName();
StorageJob *job = static_cast<StorageJob *>(storage->startOperationCall(op));
job->setData(data);
storageCount++;
@ -277,8 +277,8 @@ void DataContainerPrivate::retrieve()
storage = new Storage(q);
}
QVariantMap retrieveGroup = storage->operationDescription("retrieve");
retrieveGroup["group"] = q->objectName();
QVariantMap retrieveGroup = storage->operationDescription(QStringLiteral("retrieve"));
retrieveGroup[QStringLiteral("group")] = q->objectName();
ServiceJob *retrieveJob = storage->startOperationCall(retrieveGroup);
QObject::connect(retrieveJob, SIGNAL(result(KJob*)), q,
SLOT(populateFromStoredData(KJob*)));
@ -303,9 +303,9 @@ void DataContainerPrivate::populateFromStoredData(KJob *job)
q->forceImmediateUpdate();
}
QVariantMap expireGroup = storage->operationDescription("expire");
QVariantMap expireGroup = storage->operationDescription(QStringLiteral("expire"));
//expire things older than 4 days
expireGroup["age"] = 345600;
expireGroup[QStringLiteral("age")] = 345600;
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)
{
if (model) {
setData(source, "HasModel", true);
setData(source, QStringLiteral("HasModel"), true);
} else {
removeData(source, "HasModel");
removeData(source, QStringLiteral("HasModel"));
}
Plasma::DataContainer *s = containerForSource(source);
@ -425,18 +425,18 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, con
if (dataEngineDescription.isValid()) {
e->setObjectName(dataEngineDescription.name());
} else {
e->setObjectName("NullEngine");
e->setObjectName(QStringLiteral("NullEngine"));
}
if (dataEngineDescription.isValid()) {
QString api = dataEngineDescription.property("X-Plasma-API").toString();
QString api = dataEngineDescription.property(QStringLiteral("X-Plasma-API")).toString();
if (!api.isEmpty()) {
const QString path =
QStandardPaths::locate(QStandardPaths::GenericDataLocation,
PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/" + dataEngineDescription.pluginName() + '/',
QStandardPaths::LocateDirectory);
package = new Package(PluginLoader::self()->loadPackage("Plasma/DataEngine", api));
package = new Package(PluginLoader::self()->loadPackage(QStringLiteral("Plasma/DataEngine"), api));
package->setPath(path);
if (package->isValid()) {

View File

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

View File

@ -193,16 +193,16 @@ void FrameSvg::setElementPrefix(Plasma::Types::Location location)
{
switch (location) {
case Types::TopEdge:
setElementPrefix("north");
setElementPrefix(QStringLiteral("north"));
break;
case Types::BottomEdge:
setElementPrefix("south");
setElementPrefix(QStringLiteral("south"));
break;
case Types::LeftEdge:
setElementPrefix("west");
setElementPrefix(QStringLiteral("west"));
break;
case Types::RightEdge:
setElementPrefix("east");
setElementPrefix(QStringLiteral("east"));
break;
default:
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 *> dirs;
for (auto data : d->internalPackage->directories()) {
foreach (const auto &data, d->internalPackage->directories()) {
dirs << data.constData();
}
@ -259,7 +259,7 @@ QList<const char *> Package::directories() const
QList<const char *> Package::requiredDirectories() const
{
QList<const char *> dirs;
for (auto data : d->internalPackage->requiredDirectories()) {
foreach (const auto &data, d->internalPackage->requiredDirectories()) {
dirs << data.constData();
}
@ -269,7 +269,7 @@ QList<const char *> Package::requiredDirectories() const
QList<const char *> Package::files() const
{
QList<const char *> files;
for (auto data : d->internalPackage->files()) {
foreach (const auto &data, d->internalPackage->files()) {
files << data.constData();
}
@ -279,7 +279,7 @@ QList<const char *> Package::files() const
QList<const char *> Package::requiredFiles() const
{
QList<const char *> files;
for (auto data : d->internalPackage->requiredFiles()) {
foreach (const auto &data, d->internalPackage->requiredFiles()) {
files << data.constData();
}

View File

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

View File

@ -59,11 +59,11 @@ public:
: isDefaultLoader(false),
packageRE(QLatin1String("[^a-zA-Z0-9\\-_]"))
{
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new PlasmoidPackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/DataEngine"), new DataEnginePackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Theme"), new ThemePackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/ContainmentActions"), new ContainmentActionsPackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Generic"), new GenericPackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new PlasmoidPackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Theme"), new ThemePackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/ContainmentActions"), new ContainmentActionsPackage());
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Generic"), new GenericPackage());
}
static QSet<QString> knownCategories();
@ -94,26 +94,26 @@ QSet<QString> PluginLoaderPrivate::knownCategories()
// this is to trick the tranlsation tools into making the correct
// strings for translation
QSet<QString> categories = s_customCategories;
categories << QString(I18N_NOOP("Accessibility")).toLower()
<< QString(I18N_NOOP("Application Launchers")).toLower()
<< QString(I18N_NOOP("Astronomy")).toLower()
<< QString(I18N_NOOP("Date and Time")).toLower()
<< QString(I18N_NOOP("Development Tools")).toLower()
<< QString(I18N_NOOP("Education")).toLower()
<< QString(I18N_NOOP("Environment and Weather")).toLower()
<< QString(I18N_NOOP("Examples")).toLower()
<< QString(I18N_NOOP("File System")).toLower()
<< QString(I18N_NOOP("Fun and Games")).toLower()
<< QString(I18N_NOOP("Graphics")).toLower()
<< QString(I18N_NOOP("Language")).toLower()
<< QString(I18N_NOOP("Mapping")).toLower()
<< QString(I18N_NOOP("Miscellaneous")).toLower()
<< QString(I18N_NOOP("Multimedia")).toLower()
<< QString(I18N_NOOP("Online Services")).toLower()
<< QString(I18N_NOOP("Productivity")).toLower()
<< QString(I18N_NOOP("System Information")).toLower()
<< QString(I18N_NOOP("Utilities")).toLower()
<< QString(I18N_NOOP("Windows and Tasks")).toLower();
categories << QStringLiteral(I18N_NOOP("Accessibility")).toLower()
<< QStringLiteral(I18N_NOOP("Application Launchers")).toLower()
<< QStringLiteral(I18N_NOOP("Astronomy")).toLower()
<< QStringLiteral(I18N_NOOP("Date and Time")).toLower()
<< QStringLiteral(I18N_NOOP("Development Tools")).toLower()
<< QStringLiteral(I18N_NOOP("Education")).toLower()
<< QStringLiteral(I18N_NOOP("Environment and Weather")).toLower()
<< QStringLiteral(I18N_NOOP("Examples")).toLower()
<< QStringLiteral(I18N_NOOP("File System")).toLower()
<< QStringLiteral(I18N_NOOP("Fun and Games")).toLower()
<< QStringLiteral(I18N_NOOP("Graphics")).toLower()
<< QStringLiteral(I18N_NOOP("Language")).toLower()
<< QStringLiteral(I18N_NOOP("Mapping")).toLower()
<< QStringLiteral(I18N_NOOP("Miscellaneous")).toLower()
<< QStringLiteral(I18N_NOOP("Multimedia")).toLower()
<< QStringLiteral(I18N_NOOP("Online Services")).toLower()
<< QStringLiteral(I18N_NOOP("Productivity")).toLower()
<< QStringLiteral(I18N_NOOP("System Information")).toLower()
<< QStringLiteral(I18N_NOOP("Utilities")).toLower()
<< QStringLiteral(I18N_NOOP("Windows and Tasks")).toLower();
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);
if (plugins.count()) {
if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath());
if (!Plasma::isPluginVersionCompatible(loader.pluginVersion())) {
@ -285,7 +285,7 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name)
};
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter);
if (plugins.count()) {
if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath());
const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap();
@ -308,8 +308,8 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name)
QStringList PluginLoader::listAllEngines(const QString &parentApp)
{
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/DataEngine")) {
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/DataEngine", new DataEnginePackage());
if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
}
QStringList engines;
@ -325,12 +325,12 @@ QStringList PluginLoader::listAllEngines(const QString &parentApp)
plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter);
}
for (auto plugin : plugins) {
foreach (auto& plugin, plugins) {
engines << plugin.pluginId();
}
const QList<KPluginMetaData> packagePlugins = KPackage::PackageLoader::self()->listPackages("Plasma/DataEngine");
for (auto plugin : packagePlugins) {
const QList<KPluginMetaData> packagePlugins = KPackage::PackageLoader::self()->listPackages(QStringLiteral("Plasma/DataEngine"));
for (auto& plugin : packagePlugins) {
engines << plugin.pluginId();
}
@ -339,16 +339,16 @@ QStringList PluginLoader::listAllEngines(const QString &parentApp)
KPluginInfo::List PluginLoader::listEngineInfo(const QString &parentApp)
{
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/DataEngine")) {
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/DataEngine", new DataEnginePackage());
if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
}
return PluginLoader::self()->listDataEngineInfo(parentApp);
}
KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category, const QString &parentApp)
{
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/DataEngine")) {
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/DataEngine", new DataEnginePackage());
if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/DataEngine"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/DataEngine"), new DataEnginePackage());
}
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
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());
return list;
@ -402,7 +402,7 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args
};
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_servicesPluginDir, filter);
if (plugins.count()) {
if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath());
if (!Plasma::isPluginVersionCompatible(loader.pluginVersion())) {
@ -443,7 +443,7 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co
};
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_containmentActionsPluginDir, filter);
if (plugins.count()) {
if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
KPluginLoader loader(lst.first().libraryPath());
const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap();
@ -538,8 +538,8 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s
structure->d->internalStructure = internalStructure;
//fallback to old structures
} else {
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(packageFormat);
structure = KPluginTrader::createInstanceFromQuery<Plasma::PackageStructure>(PluginLoaderPrivate::s_packageStructurePluginDir, "Plasma/PackageStructure", constraint, 0);
const QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(packageFormat);
structure = KPluginTrader::createInstanceFromQuery<Plasma::PackageStructure>(PluginLoaderPrivate::s_packageStructurePluginDir, QStringLiteral("Plasma/PackageStructure"), constraint, 0);
if (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
//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()));
if (!pi.isValid()) {
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
//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()));
if (!pi.isValid()) {
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 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)
@ -639,11 +641,11 @@ KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
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;
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) {
QRegExp rx(glob);
rx.setPatternSyntax(QRegExp::Wildcard);
@ -674,7 +676,7 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
QStringList categories;
for (auto plugin : allApplets) {
foreach (auto& plugin, allApplets) {
if (plugin.category().isEmpty()) {
if (!categories.contains(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 &parentApp)
{
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new PlasmoidPackage());
if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new PlasmoidPackage());
}
KConfigGroup group(KSharedConfig::openConfig(), "General");
@ -753,8 +755,8 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type,
KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeType)
{
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new DataEnginePackage());
if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new DataEnginePackage());
}
auto filter = [&mimeType](const KPluginMetaData &md) -> bool
{
@ -767,14 +769,14 @@ KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeT
QStringList PluginLoader::listContainmentTypes()
{
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new DataEnginePackage());
if (!KPackage::PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/Applet"))) {
KPackage::PackageLoader::self()->addKnownPackageStructure(QStringLiteral("Plasma/Applet"), new DataEnginePackage());
}
KPluginInfo::List containmentInfos = listContainments();
QSet<QString> types;
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) {
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()));
}
QAction *configAction = actions->action("configure");
QAction *configAction = actions->action(QStringLiteral("configure"));
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()) {
@ -137,18 +137,18 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
return;
}
QString api = appletDescription.property("X-Plasma-API").toString();
QString api = appletDescription.property(QStringLiteral("X-Plasma-API")).toString();
if (api.isEmpty()) {
q->setLaunchErrorMessage(i18n("The %1 widget did not define which ScriptEngine to use.", appletDescription.name()));
return;
}
QString path = appletDescription.property("X-Plasma-RootPath").toString();
QString path = appletDescription.property(QStringLiteral("X-Plasma-RootPath")).toString();
if (path.isEmpty()) {
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);
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()) {
QString constraint;
QStringList provides = q->pluginInfo().property("X-Plasma-Provides").toStringList();
QStringList provides = q->pluginInfo().property(QStringLiteral("X-Plasma-Provides")).toStringList();
if (!provides.isEmpty()) {
auto filter = [&provides](const KPluginMetaData &md) -> bool
{
@ -196,11 +196,11 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
}
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) {
QAction *a = new QAction(QIcon::fromTheme("preferences-desktop-default-applications"), i18n("Alternatives..."), q);
q->actions()->addAction("alternatives", a);
QAction *a = new QAction(QIcon::fromTheme(QStringLiteral("preferences-desktop-default-applications")), i18n("Alternatives..."), q);
q->actions()->addAction(QStringLiteral("alternatives"), a);
QObject::connect(a, &QAction::triggered,[=] {
if (q->containment()) {
emit q->containment()->appletAlternativesRequested(q);
@ -253,10 +253,10 @@ void AppletPrivate::askDestroy()
emit q->immutabilityChanged(q->immutability());
//no parent, but it won't leak, since it will be closed both in case of timeout
//or direct action
deleteNotification = new KNotification("plasmoidDeleted", KNotification::Persistent, 0);
deleteNotification = new KNotification(QStringLiteral("plasmoidDeleted"), KNotification::Persistent, 0);
deleteNotification->setFlags(KNotification::SkipGrouping);
deleteNotification->setComponentName("plasma_workspace");
deleteNotification->setComponentName(QStringLiteral("plasma_workspace"));
QStringList actions;
deleteNotification->setIconName(q->icon());
Plasma::Containment *asContainment = qobject_cast<Plasma::Containment *>(q);
@ -358,27 +358,27 @@ void AppletPrivate::globalShortcutChanged()
KActionCollection *AppletPrivate::defaultActions(QObject *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->setText(i18n("Widget Settings"));
configAction->setIcon(QIcon::fromTheme("configure"));
configAction->setShortcut(QKeySequence("alt+d, s"));
configAction->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
configAction->setShortcut(QKeySequence(QStringLiteral("alt+d, s")));
configAction->setData(Plasma::Types::ConfigureAction);
QAction *closeApplet = actions->add<QAction>("remove");
QAction *closeApplet = actions->add<QAction>(QStringLiteral("remove"));
closeApplet->setAutoRepeat(false);
closeApplet->setText(i18n("Remove this Widget"));
closeApplet->setIcon(QIcon::fromTheme("edit-delete"));
closeApplet->setShortcut(QKeySequence("alt+d, r"));
closeApplet->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
closeApplet->setShortcut(QKeySequence(QStringLiteral("alt+d, r")));
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->setText(i18n("Run the Associated Application"));
runAssociatedApplication->setIcon(QIcon::fromTheme("system-run"));
runAssociatedApplication->setShortcut(QKeySequence("alt+d, t"));
runAssociatedApplication->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
runAssociatedApplication->setShortcut(QKeySequence(QStringLiteral("alt+d, t")));
runAssociatedApplication->setVisible(false);
runAssociatedApplication->setEnabled(false);
runAssociatedApplication->setData(Plasma::Types::ControlAction);
@ -400,7 +400,7 @@ void AppletPrivate::updateShortcuts()
//we pull them out, then read, then put them back
QList<QString> names;
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) {
QAction *a = actions->action(name);
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;
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) {
const QString mimeType = mimeDb.mimeTypeForUrl(i.value().first()).name();
const KService::List apps = KMimeTypeTrader::self()->query(mimeType);
@ -79,7 +79,7 @@ public:
a->setIcon(QIcon::fromTheme(apps.first()->icon()));
a->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name()));
} else {
a->setIcon(QIcon::fromTheme("system-run"));
a->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
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)) {
d->applicationNames[applet] = application;
if (d->urlLists.contains(applet)) {
QAction *a = applet->actions()->action("run associated application");
QAction *a = applet->actions()->action(QStringLiteral("run associated application"));
if (a) {
a->setIcon(QIcon::fromTheme("system-run"));
a->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
a->setText(i18n("Run the Associated Application"));
}
}
@ -140,7 +140,7 @@ void AssociatedApplicationManager::setUrls(Plasma::Applet *applet, const QList<Q
{
d->urlLists[applet] = urls;
if (!d->applicationNames.contains(applet)) {
QAction *a = applet->actions()->action("run associated application");
QAction *a = applet->actions()->action(QStringLiteral("run associated application"));
if (a) {
QMimeDatabase mimeDb;
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->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name()));
} else {
a->setIcon(QIcon::fromTheme("system-run"));
a->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
a->setText(i18n("Run the Associated Application"));
}
}

View File

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

View File

@ -72,7 +72,7 @@ Plasma::ContainmentPrivate::~ContainmentPrivate()
void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containment *c)
{
actions->setConfigGroup(QLatin1String("Shortcuts-Containment"));
actions->setConfigGroup(QStringLiteral("Shortcuts-Containment"));
//adjust applet actions
QAction *appAction = qobject_cast<QAction *>(actions->action(QStringLiteral("remove")));
@ -90,10 +90,10 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
}
//add our own actions
QAction *appletBrowserAction = actions->add<QAction>(QLatin1String("add widgets"));
QAction *appletBrowserAction = actions->add<QAction>(QStringLiteral("add widgets"));
appletBrowserAction->setAutoRepeat(false);
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->setData(Plasma::Types::AddAction);
}
@ -147,13 +147,13 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Types::Constraints
//update actions
const bool unlocked = q->immutability() == Types::Mutable;
QAction *action = q->actions()->action("remove");
QAction *action = q->actions()->action(QStringLiteral("remove"));
if (action) {
action->setEnabled(unlocked);
action->setVisible(unlocked);
}
action = q->actions()->action("add widgets");
action = q->actions()->action(QStringLiteral("add widgets"));
if (action) {
action->setEnabled(unlocked);
action->setVisible(unlocked);

View File

@ -137,7 +137,7 @@ Plasma::DataEngine *DataEngineManager::loadEngine(const QString &name)
if (!engine) {
qCDebug(LOG_PLASMA) << "Can't find a dataengine named" << name;
// 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();
}

View File

@ -42,13 +42,13 @@ namespace Plasma
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);
}
QString ChangeableMainScriptPackage::mainScriptConfigKey() const
{
return QLatin1String("X-Plasma-MainScript");
return QStringLiteral("X-Plasma-MainScript");
}
void ChangeableMainScriptPackage::pathChanged(KPackage::Package *package)
@ -78,44 +78,44 @@ void GenericPackage::initPackage(KPackage::Package *package)
it.setValue("platformcontents/" + it.value());
}
platform.append("contents");
platform.append(QStringLiteral("contents"));
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("theme", "theme", i18n("Themed Images"));
package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images"));
package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images"));
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("theme", mimetypes);
package->addDirectoryDefinition("config", "config", i18n("Configuration Definitions"));
package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
mimetypes.clear();
mimetypes << "text/xml";
mimetypes << QStringLiteral("text/xml");
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 << "text/plain";
mimetypes << QStringLiteral("text/plain");
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)
{
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("mainconfigxml", "config/main.xml", i18n("Configuration XML file"));
package->addFileDefinition("configmodel", QStringLiteral("config/config.qml"), i18n("Configuration UI pages model"));
package->addFileDefinition("mainconfigxml", QStringLiteral("config/main.xml"), i18n("Configuration XML file"));
}
void PlasmoidPackage::pathChanged(KPackage::Package *package)
@ -125,8 +125,8 @@ void PlasmoidPackage::pathChanged(KPackage::Package *package)
if (!package->metadata().isValid()) {
return;
}
if (package->metadata().serviceTypes().contains("Plasma/Containment")) {
package->addFileDefinition("compactapplet", "applet/CompactApplet.qml", i18n("Custom expander for compact applets"));
if (package->metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) {
package->addFileDefinition("compactapplet", QStringLiteral("applet/CompactApplet.qml"), i18n("Custom expander for compact applets"));
} else {
package->removeDefinition("compactapplet");
}
@ -135,19 +135,19 @@ void PlasmoidPackage::pathChanged(KPackage::Package *package)
void DataEnginePackage::initPackage(KPackage::Package *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;
mimetypes << "text/plain";
mimetypes << QStringLiteral("text/plain");
package->setMimeTypes("scripts", mimetypes);
package->addDirectoryDefinition("services", "services/", i18n("Service Descriptions"));
package->addDirectoryDefinition("services", QStringLiteral("services/"), i18n("Service Descriptions"));
package->setMimeTypes("services", mimetypes);
package->addDirectoryDefinition("translations", "locale", i18n("Translations"));
package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations"));
}
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.
package->setContentsPrefixPaths(QStringList());
package->addDirectoryDefinition("dialogs", "dialogs/", i18n("Images for dialogs"));
package->addFileDefinition("dialogs/background", "dialogs/background.svg",
package->addDirectoryDefinition("dialogs", QStringLiteral("dialogs/"), i18n("Images for dialogs"));
package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svg"),
i18n("Generic dialog background"));
package->addFileDefinition("dialogs/background", "dialogs/background.svgz",
package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svgz"),
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"));
package->addFileDefinition("dialogs/shutdowndialog", "dialogs/shutdowndialog.svgz",
package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svgz"),
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->addFileDefinition("widgets/background", "widgets/background.svg",
package->addDirectoryDefinition("widgets", QStringLiteral("widgets/"), i18n("Images for widgets"));
package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svg"),
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"));
package->addFileDefinition("widgets/clock", "widgets/clock.svg",
package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svg"),
i18n("Analog clock face"));
package->addFileDefinition("widgets/clock", "widgets/clock.svgz",
package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svgz"),
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"));
package->addFileDefinition("widgets/panel-background", "widgets/panel-background.svgz",
package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svgz"),
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"));
package->addFileDefinition("widgets/plot-background", "widgets/plot-background.svgz",
package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svgz"),
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"));
package->addFileDefinition("widgets/tooltip", "widgets/tooltip.svgz",
package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svgz"),
i18n("Background image for tooltips"));
package->addDirectoryDefinition("opaque/dialogs", "opaque/dialogs/", i18n("Opaque images for dialogs"));
package->addFileDefinition("opaque/dialogs/background", "opaque/dialogs/background.svg",
package->addDirectoryDefinition("opaque/dialogs", QStringLiteral("opaque/dialogs/"), i18n("Opaque images for dialogs"));
package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svg"),
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"));
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"));
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"));
package->addDirectoryDefinition("opaque/widgets", "opaque/widgets/", i18n("Opaque images for widgets"));
package->addFileDefinition("opaque/widgets/panel-background", "opaque/widgets/panel-background.svg",
package->addDirectoryDefinition("opaque/widgets", QStringLiteral("opaque/widgets/"), i18n("Opaque images for widgets"));
package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svg"),
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"));
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"));
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"));
package->addDirectoryDefinition("locolor/dialogs", "locolor/dialogs/",
package->addDirectoryDefinition("locolor/dialogs", QStringLiteral("locolor/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"));
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"));
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"));
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"));
package->addDirectoryDefinition("locolor/widgets", "locolor/widgets/", i18n("Images for widgets"));
package->addFileDefinition("locolor/widgets/background", "locolor/widgets/background.svg",
package->addDirectoryDefinition("locolor/widgets", QStringLiteral("locolor/widgets/"), i18n("Images for widgets"));
package->addFileDefinition("locolor/widgets/background", QStringLiteral("locolor/widgets/background.svg"),
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"));
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"));
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"));
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"));
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"));
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"));
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"));
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"));
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"));
package->addFileDefinition("colors", "colors", i18n("KColorScheme configuration file"));
package->addFileDefinition("colors", QStringLiteral("colors"), i18n("KColorScheme configuration file"));
QStringList mimetypes;
mimetypes << "image/svg+xml";
mimetypes << QStringLiteral("image/svg+xml");
package->setDefaultMimeTypes(mimetypes);
}
void ContainmentActionsPackage::initPackage(KPackage::Package *package)
{
ChangeableMainScriptPackage::initPackage(package);
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions/");
package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions/"));
}
} // namespace Plasma

View File

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

View File

@ -75,19 +75,19 @@ void StorageJob::start()
//FIXME: QHASH
QVariantMap params = parameters();
QString valueGroup = params["group"].toString();
QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) {
valueGroup = "default";
valueGroup = QStringLiteral("default");
}
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));
} 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));
} 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));
} 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));
} else {
setError(true);
@ -117,7 +117,7 @@ Plasma::ServiceJob *Storage::createJob(const QString &operation, QVariantMap &pa
//Storage implementation
Storage::Storage(QObject *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
QObject *parentObject = this;
@ -136,10 +136,10 @@ Storage::Storage(QObject *parent)
}
}
m_clientName = m_clientName.replace('.', "_");
m_clientName = m_clientName.replace('-', "_");
m_clientName = m_clientName.replace(QLatin1Char('.'), QLatin1Char('_'));
m_clientName = m_clientName.replace(QLatin1Char('-'), QLatin1Char('_'));
setName("storage");
setName(QStringLiteral("storage"));
}
Storage::~Storage()

View File

@ -78,7 +78,7 @@ void StorageThread::closeDb()
void StorageThread::initializeDb(StorageJob *caller)
{
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);
QDir().mkpath(storageDir);
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();
} else if (!m_db.tables().contains(caller->clientName())) {
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()) {
qCWarning(LOG_PLASMA) << "Unable to create table for" << caller->clientName();
m_db.close();
@ -105,13 +105,13 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
}
initializeDb(caller);
QString valueGroup = params["group"].toString();
QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) {
valueGroup = "default";
valueGroup = QStringLiteral("default");
}
QSqlQuery query(m_db);
if (params.value("key").toString().isNull()) {
caller->data().insert(params.value("key").toString(), params.value("data"));
if (params.value(QStringLiteral("key")).toString().isNull()) {
caller->data().insert(params.value(QStringLiteral("key")).toString(), params.value(QStringLiteral("data")));
}
QMapIterator<QString, QVariant> it(caller->data());
@ -119,7 +119,7 @@ void StorageThread::save(QWeakPointer<StorageJob> wcaller, const QVariantMap &pa
QString ids;
while (it.hasNext()) {
it.next();
QSqlField field(":id", QVariant::String);
QSqlField field(QStringLiteral(":id"), QVariant::String);
field.setValue(it.key());
if (!ids.isEmpty()) {
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.bindValue(":valueGroup", valueGroup);
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
if (!query.exec()) {
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.bindValue(":valueGroup", valueGroup);
query.bindValue(":txt", QVariant());
query.bindValue(":int", QVariant());
query.bindValue(":float", QVariant());
query.bindValue(":binary", QVariant());
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(QStringLiteral(":txt"), QVariant());
query.bindValue(QStringLiteral(":int"), QVariant());
query.bindValue(QStringLiteral(":float"), QVariant());
query.bindValue(QStringLiteral(":binary"), QVariant());
const QString key = params.value("key").toString();
const QString key = params.value(QStringLiteral("key")).toString();
if (!key.isEmpty()) {
caller->data().insert(key, params["data"]);
caller->data().insert(key, params[QStringLiteral("data")]);
}
it.toFront();
while (it.hasNext()) {
it.next();
//qCDebug(LOG_PLASMA) << "going to insert" << valueGroup << it.key();
query.bindValue(":id", it.key());
query.bindValue(QStringLiteral(":id"), it.key());
QString field;
bool binary = false;
switch (QMetaType::Type(it.value().type())) {
case QVariant::String:
field = ":txt";
field = QStringLiteral(":txt");
break;
case QVariant::Int:
field = ":int";
field = QStringLiteral(":int");
break;
case QVariant::Double:
case QMetaType::Float:
field = ":float";
field = QStringLiteral(":float");
break;
case QVariant::ByteArray:
binary = true;
field = ":binary";
field = QStringLiteral(":binary");
break;
default:
continue;
@ -208,32 +208,32 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap
const QString clientName = caller->clientName();
initializeDb(caller);
QString valueGroup = params["group"].toString();
QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) {
valueGroup = "default";
valueGroup = QStringLiteral("default");
}
QSqlQuery query(m_db);
//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
query.prepare("update " + clientName + " set accessTime=date('now') where valueGroup=:valueGroup");
query.bindValue(":valueGroup", valueGroup);
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.exec();
query.prepare("select * from " + clientName + " where valueGroup=:valueGroup");
query.bindValue(":valueGroup", valueGroup);
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
} else {
//update modification time
query.prepare("update " + clientName + " set accessTime=date('now') where valueGroup=:valueGroup and id=:key");
query.bindValue(":valueGroup", valueGroup);
query.bindValue(":key", params["key"].toString());
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(QStringLiteral(":key"), params[QStringLiteral("key")].toString());
query.exec();
query.prepare("select * from " + clientName + " where valueGroup=:valueGroup and id=:key");
query.bindValue(":valueGroup", valueGroup);
query.bindValue(":key", params["key"].toString());
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(QStringLiteral(":key"), params[QStringLiteral("key")].toString());
}
const bool success = query.exec();
@ -242,11 +242,11 @@ void StorageThread::retrieve(QWeakPointer<StorageJob> wcaller, const QVariantMap
if (success) {
QSqlRecord rec = query.record();
const int keyColumn = rec.indexOf("id");
const int textColumn = rec.indexOf("txt");
const int intColumn = rec.indexOf("int");
const int floatColumn = rec.indexOf("float");
const int binaryColumn = rec.indexOf("binary");
const int keyColumn = rec.indexOf(QStringLiteral("id"));
const int textColumn = rec.indexOf(QStringLiteral("txt"));
const int intColumn = rec.indexOf(QStringLiteral("int"));
const int floatColumn = rec.indexOf(QStringLiteral("float"));
const int binaryColumn = rec.indexOf(QStringLiteral("binary"));
QVariantMap data;
while (query.next()) {
@ -280,20 +280,20 @@ void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariant
}
initializeDb(caller);
QString valueGroup = params["group"].toString();
QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) {
valueGroup = "default";
valueGroup = QStringLiteral("default");
}
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.bindValue(":valueGroup", valueGroup);
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
} else {
query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup and id=:key");
query.bindValue(":valueGroup", valueGroup);
query.bindValue(":key", params["key"].toString());
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
query.bindValue(QStringLiteral(":key"), params[QStringLiteral("key")].toString());
}
const bool success = query.exec();
@ -310,21 +310,21 @@ void StorageThread::expire(QWeakPointer<StorageJob> wcaller, const QVariantMap &
}
initializeDb(caller);
QString valueGroup = params["group"].toString();
QString valueGroup = params[QStringLiteral("group")].toString();
if (valueGroup.isEmpty()) {
valueGroup = "default";
valueGroup = QStringLiteral("default");
}
QSqlQuery query(m_db);
if (valueGroup.isEmpty()) {
query.prepare("delete from " + caller->clientName() + " where accessTime < :date");
QDateTime time(QDateTime::currentDateTime().addSecs(-params["age"].toUInt()));
query.bindValue(":date", time.toTime_t());
QDateTime time(QDateTime::currentDateTime().addSecs(-params[QStringLiteral("age")].toUInt()));
query.bindValue(QStringLiteral(":date"), time.toTime_t());
} else {
query.prepare("delete from " + caller->clientName() + " where valueGroup=:valueGroup and accessTime < :date");
query.bindValue(":valueGroup", valueGroup);
QDateTime time(QDateTime::currentDateTime().addSecs(-params["age"].toUInt()));
query.bindValue(":date", time.toTime_t());
query.bindValue(QStringLiteral(":valueGroup"), valueGroup);
QDateTime time(QDateTime::currentDateTime().addSecs(-params[QStringLiteral("age")].toUInt()));
query.bindValue(QStringLiteral(":date"), time.toTime_t());
}
const bool success = query.exec();

View File

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

View File

@ -99,7 +99,7 @@ ThemePrivate::ThemePrivate(QObject *parent)
#if HAVE_X11
//watch for background contrast effect property changes as well
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) {
@ -604,7 +604,7 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
void ThemePrivate::processWallpaperSettings(KConfigBase *metadata)
{
if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != DEFAULT_WALLPAPER_THEME) {
if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != QStringLiteral(DEFAULT_WALLPAPER_THEME)) {
return;
}
@ -674,7 +674,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
if (themePath.isEmpty() && themeName.isEmpty()) {
// 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()) {
return;

View File

@ -40,8 +40,8 @@ public:
Q_FOREACH(const ObjectHistory& history, m_data) {
QVariantMap map;
map["events"] = serializeEvents(history.events);
map["initial"] = history.initial;
map[QStringLiteral("events")] = serializeEvents(history.events);
map[QStringLiteral("initial")] = history.initial;
array.append(QJsonValue::fromVariant(map));
}
@ -68,8 +68,8 @@ private:
Q_ASSERT(!events.isEmpty());
foreach(const TimeEvent& ev, events) {
QVariantMap map;
map["comment"] = ev.comment;
map["time"] = ev.moment.toMSecsSinceEpoch();
map[QStringLiteral("comment")] = ev.comment;
map[QStringLiteral("time")] = ev.moment.toMSecsSinceEpoch();
ret.append(map);
}
Q_ASSERT(ret.count() == events.count());
@ -81,7 +81,7 @@ Q_GLOBAL_STATIC(TimeTrackerWriter, s_writer);
TimeTracker::TimeTracker(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);
t->setInterval(2000);
@ -135,9 +135,9 @@ void TimeTracker::propertyChanged()
}
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;
}
}

View File

@ -64,10 +64,10 @@ QStringList knownLanguages(Types::ComponentTypes types)
QStringList languages;
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"));
if (((types & Types::AppletComponent) && !componentTypes.contains(QLatin1String("Applet")))
||((types & Types::DataEngineComponent) && !componentTypes.contains(QLatin1String("DataEngine")))) {
if (((types & Types::AppletComponent) && !componentTypes.contains(QStringLiteral("Applet")))
||((types & Types::DataEngineComponent) && !componentTypes.contains(QStringLiteral("DataEngine")))) {
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);
if (plugins.count()) {
if (!plugins.isEmpty()) {
const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes"));
if (((type & Types::AppletComponent) && !componentTypes.contains(QLatin1String("Applet")))
|| ((type & Types::DataEngineComponent) && !componentTypes.contains(QLatin1String("DataEngine")))) {
if (((type & Types::AppletComponent) && !componentTypes.contains(QStringLiteral("Applet")))
|| ((type & Types::DataEngineComponent) && !componentTypes.contains(QStringLiteral("DataEngine")))) {
qCWarning(LOG_PLASMA) << "ScriptEngine" << plugins.first().name() << "does not provide Applet or DataEngine components, returning empty.";
return 0;

View File

@ -98,7 +98,7 @@ ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject
{
// TODO: nested groups?
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()) {
#ifndef NDEBUG
@ -173,11 +173,11 @@ void Service::setOperationsScheme(QIODevice *xml)
// KSharedConfig. We need a config object for the config loader even
// though we dont' actually want to use any config parts from it,
// 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);
foreach (const QString &group, loader.groupList()) {
d->operationsMap[group]["_name"] = group;
d->operationsMap[group][QStringLiteral("_name")] = group;
}
foreach (KConfigSkeletonItem *item, loader.items()) {
d->operationsMap[item->group()][item->key()] = item->property();

View File

@ -94,12 +94,12 @@ bool SharedSvgRenderer::load(
style = style.nextSiblingElement(STYLE)) {
if (style.attribute(QStringLiteral("id")) == QLatin1String("current-color-scheme")) {
QDomElement colorScheme = svg.createElement(STYLE);
colorScheme.setAttribute(QLatin1String("type"), QLatin1String("text/css"));
colorScheme.setAttribute(QLatin1String("id"), QLatin1String("current-color-scheme"));
colorScheme.setAttribute(QStringLiteral("type"), QStringLiteral("text/css"));
colorScheme.setAttribute(QStringLiteral("id"), QStringLiteral("current-color-scheme"));
defs.replaceChild(colorScheme, style);
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;
}
@ -278,7 +278,7 @@ Theme *SvgPrivate::cacheAndColorsTheme()
// use a separate cache source for unthemed svg's
if (!s_systemColorsCache) {
//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();
@ -738,7 +738,7 @@ void Svg::setScaleFactor(qreal ratio)
//not resize() because we want to do it unconditionally
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();
} else {
d->createRenderer();

View File

@ -469,7 +469,7 @@ QFont Theme::smallestFont() 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

View File

@ -53,21 +53,21 @@ int main(int argc, char **argv)
parser.addVersionOption();
parser.addHelpOption();
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() << "g" << "global", i18n("For install or remove, operates on packages installed for all users.")));
parser.addOption(QCommandLineOption(QStringList() << "t" << "type",
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() << QStringLiteral("g") << QStringLiteral("global"), i18n("For install or remove, operates on packages installed for all users.")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("t") << QStringLiteral("type"),
i18nc("theme, wallpaper, etc. are keywords, but they may be translated, as both versions "
"are recognized by the application "
"(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."),
"type", "plasmoid"));
parser.addOption(QCommandLineOption(QStringList() << "i" << "install", i18nc("Do not translate <path>", "Install the package at <path>"), "path"));
parser.addOption(QCommandLineOption(QStringList() << "s" << "show", i18nc("Do not translate <name>", "Show information of package <name>"), "name"));
parser.addOption(QCommandLineOption(QStringList() << "u" << "upgrade", i18nc("Do not translate <path>", "Upgrade the package at <path>"), "path"));
parser.addOption(QCommandLineOption(QStringList() << "l" << "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() << "r" << "remove", i18nc("Do not translate <name>", "Remove the package named <name>"), "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"));
QStringLiteral("type"), QStringLiteral("plasmoid")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("i") << QStringLiteral("install"), i18nc("Do not translate <path>", "Install the package at <path>"), QStringLiteral("path")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("show"), i18nc("Do not translate <name>", "Show information of package <name>"), QStringLiteral("name")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("u") << QStringLiteral("upgrade"), i18nc("Do not translate <path>", "Upgrade the package at <path>"), QStringLiteral("path")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("l") << QStringLiteral("list"), i18n("List installed packages")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("list-types"), i18n("List all known package types that can be installed")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("r") << QStringLiteral("remove"), i18nc("Do not translate <name>", "Remove the package named <name>"), QStringLiteral("name")));
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);

View File

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

View File

@ -146,16 +146,16 @@ QVariant ConfigModelPrivate::get(int row) const
return value;
}
value["name"] = categories.at(row)->name();
value["icon"] = categories.at(row)->icon();
value["pluginName"] = categories.at(row)->pluginName();
value[QStringLiteral("name")] = categories.at(row)->name();
value[QStringLiteral("icon")] = categories.at(row)->icon();
value[QStringLiteral("pluginName")] = categories.at(row)->pluginName();
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 {
value["source"] = categories.at(row)->source();
value[QStringLiteral("source")] = categories.at(row)->source();
}
value["visible"] = categories.at(row)->visible();
value["kcm"] = q->data(q->index(row, 0), ConfigModel::KCMRole);
value[QStringLiteral("visible")] = categories.at(row)->visible();
value[QStringLiteral("kcm")] = q->data(q->index(row, 0), ConfigModel::KCMRole);
return value;
}

View File

@ -90,7 +90,7 @@ void ConfigViewPrivate::init()
KDeclarative::KDeclarative kdeclarative;
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()) {
kdeclarative.setTranslationDomain("plasma_applet_" + rootPath);
} else {
@ -139,7 +139,7 @@ void ConfigViewPrivate::init()
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 (!configModel) {
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("configDialog", q);
q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoid"), applet.data()->property("_plasma_graphicObject").value<QObject *>());
q->engine()->rootContext()->setContextProperty(QStringLiteral("configDialog"), q);
component->completeCreate();
delete component;
}
@ -261,7 +261,7 @@ ConfigView::ConfigView(Plasma::Applet *applet, QWindow *parent)
: QQuickView(parent),
d(new ConfigViewPrivate(applet, this))
{
setIcon(QIcon::fromTheme("configure"));
setIcon(QIcon::fromTheme(QStringLiteral("configure")));
d->init();
qmlRegisterType<ConfigModel>("org.kde.plasma.configuration", 2, 0, "ConfigModel");
qmlRegisterType<ConfigCategory>("org.kde.plasma.configuration", 2, 0, "ConfigCategory");

View File

@ -215,9 +215,9 @@ void DialogPrivate::updateTheme()
DialogShadows::self()->removeWindow(q);
} else {
if (type == Dialog::Tooltip) {
frameSvgItem->setImagePath("widgets/tooltip");
frameSvgItem->setImagePath(QStringLiteral("widgets/tooltip"));
} else {
frameSvgItem->setImagePath("dialogs/background");
frameSvgItem->setImagePath(QStringLiteral("dialogs/background"));
}
KWindowEffects::enableBlurBehind(q->winId(), true, frameSvgItem->frameSvg()->mask());
@ -661,7 +661,7 @@ Dialog::Dialog(QQuickItem *parent)
setColor(QColor(Qt::transparent));
setFlags(Qt::FramelessWindowHint);
setIcon(QIcon::fromTheme("plasma"));
setIcon(QIcon::fromTheme(QStringLiteral("plasma")));
connect(this, &QWindow::xChanged, [=]() { d->slotWindowPositionChanged(); });
connect(this, &QWindow::yChanged, [=]() { d->slotWindowPositionChanged(); });
@ -998,9 +998,9 @@ void Dialog::setType(WindowType type)
d->frameSvgItem->setImagePath(QString());
} else {
if (d->type == Tooltip) {
d->frameSvgItem->setImagePath("widgets/tooltip");
d->frameSvgItem->setImagePath(QStringLiteral("widgets/tooltip"));
} 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()
{
clearPixmaps();
initPixmap("shadow-top");
initPixmap("shadow-topright");
initPixmap("shadow-right");
initPixmap("shadow-bottomright");
initPixmap("shadow-bottom");
initPixmap("shadow-bottomleft");
initPixmap("shadow-left");
initPixmap("shadow-topleft");
initPixmap(QStringLiteral("shadow-top"));
initPixmap(QStringLiteral("shadow-topright"));
initPixmap(QStringLiteral("shadow-right"));
initPixmap(QStringLiteral("shadow-bottomright"));
initPixmap(QStringLiteral("shadow-bottom"));
initPixmap(QStringLiteral("shadow-bottomleft"));
initPixmap(QStringLiteral("shadow-left"));
initPixmap(QStringLiteral("shadow-topleft"));
m_emptyCornerPix = initEmptyPixmap(QSize(1, 1));
m_emptyCornerLeftPix = initEmptyPixmap(QSize(q->elementSize("shadow-topleft").width(), 1));
m_emptyCornerTopPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-topleft").height()));
m_emptyCornerRightPix = initEmptyPixmap(QSize(q->elementSize("shadow-bottomright").width(), 1));
m_emptyCornerBottomPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-bottomright").height()));
m_emptyVerticalPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-left").height()));
m_emptyHorizontalPix = initEmptyPixmap(QSize(q->elementSize("shadow-top").width(), 1));
m_emptyCornerLeftPix = initEmptyPixmap(QSize(q->elementSize(QStringLiteral("shadow-topleft")).width(), 1));
m_emptyCornerTopPix = initEmptyPixmap(QSize(1, q->elementSize(QStringLiteral("shadow-topleft")).height()));
m_emptyCornerRightPix = initEmptyPixmap(QSize(q->elementSize(QStringLiteral("shadow-bottomright")).width(), 1));
m_emptyCornerBottomPix = initEmptyPixmap(QSize(1, q->elementSize(QStringLiteral("shadow-bottomright")).height()));
m_emptyVerticalPix = initEmptyPixmap(QSize(1, q->elementSize(QStringLiteral("shadow-left")).height()));
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;
if (enabledBorders & Plasma::FrameSvg::TopBorder) {
marginHint = q->elementSize("shadow-hint-top-margin");
marginHint = q->elementSize(QStringLiteral("shadow-hint-top-margin"));
if (marginHint.isValid()) {
top = marginHint.height();
} else {
@ -369,7 +369,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
}
if (enabledBorders & Plasma::FrameSvg::RightBorder) {
marginHint = q->elementSize("shadow-hint-right-margin");
marginHint = q->elementSize(QStringLiteral("shadow-hint-right-margin"));
if (marginHint.isValid()) {
right = marginHint.width();
} else {
@ -380,7 +380,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
}
if (enabledBorders & Plasma::FrameSvg::BottomBorder) {
marginHint = q->elementSize("shadow-hint-bottom-margin");
marginHint = q->elementSize(QStringLiteral("shadow-hint-bottom-margin"));
if (marginHint.isValid()) {
bottom = marginHint.height();
} else {
@ -391,7 +391,7 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB
}
if (enabledBorders & Plasma::FrameSvg::LeftBorder) {
marginHint = q->elementSize("shadow-hint-left-margin");
marginHint = q->elementSize(QStringLiteral("shadow-hint-left-margin"));
if (marginHint.isValid()) {
left = marginHint.width();
} else {
@ -502,7 +502,7 @@ void DialogShadows::Private::clearShadow(const QWindow *window)
bool DialogShadows::enabled() const
{
return hasElement("shadow-left");
return hasElement(QStringLiteral("shadow-left"));
}
#include "moc_dialogshadows_p.cpp"

View File

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

View File

@ -94,7 +94,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
if (PackageUrlInterceptorPrivate::s_packages.contains(pkgName)) {
package = PackageUrlInterceptorPrivate::s_packages.value(pkgName);
} else {
package = Plasma::PluginLoader::self()->loadPackage("Plasma/Applet");
package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"));
package.setPath(pkgName);
PackageUrlInterceptorPrivate::s_packages[pkgName] = package;
}
@ -149,7 +149,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
components.pop_front();
//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));

View File

@ -31,59 +31,59 @@
void LookAndFeelPackage::initPackage(Plasma::Package *package)
{
// 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
package->addFileDefinition("defaults", "defaults", i18n("Default settings for theme, etc."));
package->addFileDefinition("defaults", QStringLiteral("defaults"), i18n("Default settings for theme, etc."));
//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
package->addDirectoryDefinition("previews", "previews", i18n("Preview Images"));
package->addFileDefinition("loginmanagerpreview", "previews/loginmanager.png", i18n("Preview for the Login Manager"));
package->addFileDefinition("lockscreenpreview", "previews/lockscreen.png", i18n("Preview for the Lock Screen"));
package->addFileDefinition("userswitcherpreview", "previews/userswitcher.png", i18n("Preview for the Userswitcher"));
package->addFileDefinition("desktopswitcherpreview", "previews/desktopswitcher.png", i18n("Preview for the Virtual Desktop Switcher"));
package->addFileDefinition("splashpreview", "previews/splash.png", i18n("Preview for Splash Screen"));
package->addFileDefinition("runcommandpreview", "previews/runcommand.png", i18n("Preview for KRunner"));
package->addFileDefinition("windowdecorationpreview", "previews/windowdecoration.png", i18n("Preview for the Window Decorations"));
package->addFileDefinition("windowswitcherpreview", "previews/windowswitcher.png", i18n("Preview for Window Switcher"));
package->addDirectoryDefinition("previews", QStringLiteral("previews"), i18n("Preview Images"));
package->addFileDefinition("loginmanagerpreview", QStringLiteral("previews/loginmanager.png"), i18n("Preview for the Login Manager"));
package->addFileDefinition("lockscreenpreview", QStringLiteral("previews/lockscreen.png"), i18n("Preview for the Lock Screen"));
package->addFileDefinition("userswitcherpreview", QStringLiteral("previews/userswitcher.png"), i18n("Preview for the Userswitcher"));
package->addFileDefinition("desktopswitcherpreview", QStringLiteral("previews/desktopswitcher.png"), i18n("Preview for the Virtual Desktop Switcher"));
package->addFileDefinition("splashpreview", QStringLiteral("previews/splash.png"), i18n("Preview for Splash Screen"));
package->addFileDefinition("runcommandpreview", QStringLiteral("previews/runcommand.png"), i18n("Preview for KRunner"));
package->addFileDefinition("windowdecorationpreview", QStringLiteral("previews/windowdecoration.png"), i18n("Preview for the Window Decorations"));
package->addFileDefinition("windowswitcherpreview", QStringLiteral("previews/windowswitcher.png"), i18n("Preview for Window Switcher"));
package->addDirectoryDefinition("loginmanager", "loginmanager", i18n("Login Manager"));
package->addFileDefinition("loginmanagermainscript", "loginmanager/LoginManager.qml", i18n("Main Script for Login Manager"));
package->addDirectoryDefinition("loginmanager", QStringLiteral("loginmanager"), i18n("Login Manager"));
package->addFileDefinition("loginmanagermainscript", QStringLiteral("loginmanager/LoginManager.qml"), i18n("Main Script for Login Manager"));
package->addDirectoryDefinition("logout", "logout", i18n("Logout Dialog"));
package->addFileDefinition("logoutmainscript", "logout/Logout.qml", i18n("Main Script for Logout Dialog"));
package->addDirectoryDefinition("logout", QStringLiteral("logout"), i18n("Logout Dialog"));
package->addFileDefinition("logoutmainscript", QStringLiteral("logout/Logout.qml"), i18n("Main Script for Logout Dialog"));
package->addDirectoryDefinition("lockscreen", "lockscreen", i18n("Screenlocker"));
package->addFileDefinition("lockscreenmainscript", "lockscreen/LockScreen.qml", i18n("Main Script for Lock Screen"));
package->addDirectoryDefinition("lockscreen", QStringLiteral("lockscreen"), i18n("Screenlocker"));
package->addFileDefinition("lockscreenmainscript", QStringLiteral("lockscreen/LockScreen.qml"), i18n("Main Script for Lock Screen"));
package->addDirectoryDefinition("userswitcher", "userswitcher", i18n("UI for fast user switching"));
package->addFileDefinition("userswitchermainscript", "userswitcher/UserSwitcher.qml", i18n("Main Script for User Switcher"));
package->addDirectoryDefinition("userswitcher", QStringLiteral("userswitcher"), i18n("UI for fast user switching"));
package->addFileDefinition("userswitchermainscript", QStringLiteral("userswitcher/UserSwitcher.qml"), i18n("Main Script for User Switcher"));
package->addDirectoryDefinition("desktopswitcher", "desktopswitcher", i18n("Virtual Desktop Switcher"));
package->addFileDefinition("desktopswitchermainscript", "desktopswitcher/DesktopSwitcher.qml", i18n("Main Script for Virtual Desktop Switcher"));
package->addDirectoryDefinition("desktopswitcher", QStringLiteral("desktopswitcher"), i18n("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->addFileDefinition("osdmainscript", "osd/Osd.qml", i18n("Main Script for On-Screen Display Notifications"));
package->addDirectoryDefinition("osd", QStringLiteral("osd"), i18n("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->addFileDefinition("splashmainscript", "splash/Splash.qml", i18n("Main Script for Splash Screen"));
package->addDirectoryDefinition("splash", QStringLiteral("splash"), i18n("Splash Screen"));
package->addFileDefinition("splashmainscript", QStringLiteral("splash/Splash.qml"), i18n("Main Script for Splash Screen"));
package->addDirectoryDefinition("runcommand", "runcommand", i18n("KRunner UI"));
package->addFileDefinition("runcommandmainscript", "runcommand/RunCommand.qml", i18n("Main Script KRunner"));
package->addDirectoryDefinition("runcommand", QStringLiteral("runcommand"), i18n("KRunner UI"));
package->addFileDefinition("runcommandmainscript", QStringLiteral("runcommand/RunCommand.qml"), i18n("Main Script KRunner"));
package->addDirectoryDefinition("windowdecoration", "windowdecoration", i18n("Window Decoration"));
package->addFileDefinition("windowdecorationmainscript", "windowdecoration/WindowDecoration.qml", i18n("Main Script for Window Decoration"));
package->addDirectoryDefinition("windowdecoration", QStringLiteral("windowdecoration"), i18n("Window Decoration"));
package->addFileDefinition("windowdecorationmainscript", QStringLiteral("windowdecoration/WindowDecoration.qml"), i18n("Main Script for Window Decoration"));
package->addDirectoryDefinition("windowswitcher", "windowswitcher", i18n("Window Switcher"));
package->addFileDefinition("windowswitchermainscript", "windowswitcher/WindowSwitcher.qml", i18n("Main Script for Window Switcher"));
package->addDirectoryDefinition("windowswitcher", QStringLiteral("windowswitcher"), i18n("Window Switcher"));
package->addFileDefinition("windowswitchermainscript", QStringLiteral("windowswitcher/WindowSwitcher.qml"), i18n("Main Script for Window Switcher"));
}
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);
QStringList platform = KDeclarative::KDeclarative::runtimePlatform();
@ -94,40 +94,40 @@ void QmlWallpaperPackage::initPackage(Plasma::Package *package)
it.setValue("platformcontents/" + it.value());
}
platform.append("contents");
platform.append(QStringLiteral("contents"));
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("theme", "theme", i18n("Themed Images"));
package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images"));
package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images"));
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("theme", mimetypes);
package->addDirectoryDefinition("config", "config", i18n("Configuration Definitions"));
package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
mimetypes.clear();
mimetypes << "text/xml";
mimetypes << QStringLiteral("text/xml");
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 << "text/plain";
mimetypes << QStringLiteral("text/plain");
package->setMimeTypes("scripts", mimetypes);
package->addDirectoryDefinition("translations", "locale", i18n("Translations"));
package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations"));
}
void LayoutTemplatePackage::initPackage(Plasma::Package *package)
{
package->setServicePrefix("plasma-layout-template");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates");
package->addFileDefinition("mainscript", "layout.js", i18n("Main Script File"));
package->setServicePrefix(QStringLiteral("plasma-layout-template"));
package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates"));
package->addFileDefinition("mainscript", QStringLiteral("layout.js"), i18n("Main Script File"));
package->setRequired("mainscript", true);
}

View File

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

View File

@ -534,7 +534,7 @@ int AppletInterface::apiVersion() const
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)
@ -686,7 +686,7 @@ bool AppletInterface::event(QEvent *event)
}
bool keySequenceUsed = false;
for (auto a : actions) {
foreach (auto a, actions) {
if (a->shortcut().isEmpty()) {
continue;
@ -756,7 +756,7 @@ bool AppletInterface::eventFilter(QObject *watched, QEvent *event)
return true;
}
QAction *action = plugin->contextualActions().first();
QAction *action = plugin->contextualActions().at(0);
action->setData(e->globalPos());
action->trigger();
return true;

View File

@ -150,8 +150,8 @@ void ContainmentInterface::init()
qmlObject()->rootObject()->setProperty("parent", QVariant::fromValue(this));
//set anchors
QQmlExpression expr(qmlObject()->engine()->rootContext(), qmlObject()->rootObject(), "parent");
QQmlProperty prop(qmlObject()->rootObject(), "anchors.fill");
QQmlExpression expr(qmlObject()->engine()->rootContext(), qmlObject()->rootObject(), QStringLiteral("parent"));
QQmlProperty prop(qmlObject()->rootObject(), QStringLiteral("anchors.fill"));
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;
if (mimeData->hasFormat("text/x-plasmoidservicename")) {
QString data = mimeData->data("text/x-plasmoidservicename");
if (mimeData->hasFormat(QStringLiteral("text/x-plasmoidservicename"))) {
QString data = mimeData->data(QStringLiteral("text/x-plasmoidservicename"));
const QStringList appletNames = data.split('\n', QString::SkipEmptyParts);
foreach (const QString &appletName, appletNames) {
qDebug() << "adding" << appletName;
@ -488,8 +488,8 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y)
QObject::connect(job, SIGNAL(mimetype(KIO::Job*,QString)),
this, SLOT(mimeTypeRetrieved(KIO::Job*,QString)));
QMenu *choices = new QMenu("Content dropped");
choices->addAction(QIcon::fromTheme("process-working"), i18n("Fetching file type..."));
QMenu *choices = new QMenu(i18n("Content dropped"));
choices->addAction(QIcon::fromTheme(QStringLiteral("process-working")), i18n("Fetching file type..."));
choices->popup(window() ? window()->mapToGlobal(QPoint(x, y)) : QPoint(x, y));
m_dropMenus[job] = choices;
@ -584,7 +584,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
return;
}
KPluginInfo::List appletList = Plasma::PluginLoader::self()->listAppletInfoForUrl(tjob->url());
if (mimetype.isEmpty() && !appletList.count()) {
if (mimetype.isEmpty() && appletList.isEmpty()) {
clearDataForMimeJob(job);
qDebug() << "No applets found matching the url (" << tjob->url() << ") or the mimetype (" << mimetype << ")";
return;
@ -646,7 +646,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
actionsToApplets.insert(action, 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;
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"
// 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
choices->removeAction(choices->actions().first());
choices->removeAction(choices->actions().at(0));
QAction *choice = choices->exec();
if (choice) {
@ -737,7 +737,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
}
} else {
// 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());
}
}
@ -803,8 +803,8 @@ void ContainmentInterface::loadWallpaper()
m_wallpaperInterface->setProperty("parent", QVariant::fromValue(this));
//set anchors
QQmlExpression expr(qmlObject()->engine()->rootContext(), m_wallpaperInterface, "parent");
QQmlProperty prop(m_wallpaperInterface, "anchors.fill");
QQmlExpression expr(qmlObject()->engine()->rootContext(), m_wallpaperInterface, QStringLiteral("parent"));
QQmlProperty prop(m_wallpaperInterface, QStringLiteral("anchors.fill"));
prop.write(expr.evaluate());
m_containment->setProperty("wallpaperGraphicsObject", QVariant::fromValue(m_wallpaperInterface));
@ -834,7 +834,7 @@ QList<QObject *> ContainmentInterface::actions() const
//FIXME: giving directly a QList<QAction*> crashes
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;
//use a multimap to sort by action type
QMultiMap<int, QObject *> actions;
@ -911,7 +911,7 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
//Don't have an action list? execute as single action
//and set the event position as action data
if (plugin->contextualActions().length() == 1) {
QAction *action = plugin->contextualActions().first();
QAction *action = plugin->contextualActions().at(0);
action->setData(event->pos());
action->trigger();
event->accept();
@ -1002,16 +1002,16 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
}
if (!applet->failedToLaunch()) {
QAction *runAssociatedApplication = applet->actions()->action("run associated application");
QAction *runAssociatedApplication = applet->actions()->action(QStringLiteral("run associated application"));
if (runAssociatedApplication && runAssociatedApplication->isEnabled()) {
desktopMenu.addAction(runAssociatedApplication);
}
QAction *configureApplet = applet->actions()->action("configure");
QAction *configureApplet = applet->actions()->action(QStringLiteral("configure"));
if (configureApplet && configureApplet->isEnabled()) {
desktopMenu.addAction(configureApplet);
}
QAction *appletAlternatives = applet->actions()->action("alternatives");
QAction *appletAlternatives = applet->actions()->action(QStringLiteral("alternatives"));
if (appletAlternatives && appletAlternatives->isEnabled()) {
desktopMenu.addAction(appletAlternatives);
}
@ -1047,7 +1047,7 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
if (m_containment->immutability() == Plasma::Types::Mutable &&
(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;
if (closeApplet) {
if (!desktopMenu.isEmpty()) {
@ -1063,7 +1063,7 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
void ContainmentInterface::addContainmentActions(QMenu &desktopMenu, QEvent *event)
{
if (m_containment->corona()->immutability() != Plasma::Types::Mutable &&
!KAuthorized::authorizeKAction("plasma/containment_actions")) {
!KAuthorized::authorizeKAction(QStringLiteral("plasma/containment_actions"))) {
//qDebug() << "immutability";
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...
if ((m_containment->containmentType() != Plasma::Types::PanelContainment &&
m_containment->containmentType() != Plasma::Types::CustomPanelContainment) &&
m_containment->actions()->action("configure")) {
desktopMenu.addAction(m_containment->actions()->action("configure"));
m_containment->actions()->action(QStringLiteral("configure"))) {
desktopMenu.addAction(m_containment->actions()->action(QStringLiteral("configure")));
}
} else {
desktopMenu.addActions(actions);

View File

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

View File

@ -73,12 +73,12 @@ KPluginInfo::List WallpaperInterface::listWallpaperInfoForMimetype(const QString
{
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 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
@ -100,7 +100,7 @@ KConfigLoader *WallpaperInterface::configScheme()
{
if (!m_configLoader) {
//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();
cfg = KConfigGroup(&cfg, "Wallpaper");
@ -134,7 +134,7 @@ void WallpaperInterface::syncWallpaperPackage()
}
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);
if (!m_pkg.isValid()) {
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->rootContext()->setContextProperty("wallpaper", this);
m_qmlObject->rootContext()->setContextProperty(QStringLiteral("wallpaper"), this);
//initialize with our size to avoid as much resize events as possible
QVariantHash props;
props["width"] = width();
props["height"] = height();
props[QStringLiteral("width")] = width();
props[QStringLiteral("height")] = height();
m_qmlObject->completeInitialization(props);
}
@ -168,8 +168,8 @@ void WallpaperInterface::loadFinished()
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
//set anchors
QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent");
QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill");
QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), QStringLiteral("parent"));
QQmlProperty prop(m_qmlObject->rootObject(), QStringLiteral("anchors.fill"));
prop.write(expr.evaluate());
} else if (m_qmlObject->mainComponent()) {
@ -201,7 +201,7 @@ bool WallpaperInterface::supportsMimetype(const QString &mimetype) const
void WallpaperInterface::setUrl(const QUrl &url)
{
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->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();
}

View File

@ -36,7 +36,7 @@ int main(int argc, char **argv)
parser->addVersionOption();
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();
}

View File

@ -91,10 +91,10 @@ bool PluginTest::loadKPlugin()
{
bool ok = false;
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);
//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());
//QObject *factory = loader.instance();
if (factory) {
@ -109,7 +109,7 @@ bool PluginTest::loadKPlugin()
if (time_engine) {
qDebug() << "Successfully loaded timeengine";
time_engine->connectSource("Europe/Amsterdam", this);
time_engine->connectSource(QStringLiteral("Europe/Amsterdam"), this);
qDebug() << "SOURCE: " << time_engine->sources();
ok = true;
} else {
@ -130,8 +130,8 @@ bool PluginTest::loadFromKService(const QString &name)
DataEngine *engine = 0;
// load the engine, add it to the engines
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine",
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/DataEngine"),
constraint);
QString error;
@ -140,7 +140,7 @@ bool PluginTest::loadFromKService(const QString &name)
} else {
QVariantList allArgs;
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 (offers.first()) {
KPluginLoader plugin(*offers.first());
@ -164,8 +164,8 @@ bool PluginTest::loadFromPlasma()
foreach (const QString &e, allEngines) {
Plasma::DataEngine *engine = Plasma::PluginLoader::self()->loadDataEngine(e);
if (engine) {
engine->connectSource("Europe/Amsterdam", this);
engine->connectSource("Battery", this);
engine->connectSource(QStringLiteral("Europe/Amsterdam"), this);
engine->connectSource(QStringLiteral("Battery"), this);
engine->connectAllSources(this);
qDebug() << "SOURCE: " << engine->sources();
ok = true;
@ -219,9 +219,9 @@ bool PluginTest::loadKService(const QString &name)
qDebug() << "Load KService";
DataEngine *engine = 0;
// 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();
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine",
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/DataEngine"),
constraint);
QString error;
@ -232,7 +232,7 @@ bool PluginTest::loadKService(const QString &name)
QVariantList allArgs;
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 (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);
qDebug() << "DE";
if (engine) {
engine->connectSource("Europe/Amsterdam", this);
engine->connectSource(QStringLiteral("Europe/Amsterdam"), this);
qDebug() << "SOURCE: " << engine->sources();
//qDebug() << "DataEngine ID: " << engine->pluginInfo().name();
} else {
@ -258,7 +258,7 @@ bool PluginTest::loadKService(const QString &name)
}
QStringList result;
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;
if (!result.contains(_plugin)) {
result << _plugin;

View File

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

View File

@ -46,119 +46,119 @@ TestEngine::~TestEngine()
void TestEngine::init()
{
QString dsn("TestEngine");
QString dsn(QStringLiteral("TestEngine"));
// QVariant::Invalid
// QVariant::BitArray
setData(dsn, "QBitArray", QVariant(QBitArray(97, false)));
setData(dsn, QStringLiteral("QBitArray"), QVariant(QBitArray(97, false)));
// QVariant::Bitmap
setData(dsn, "QBitmap", QVariant(QBitmap(12, 57)));
setData(dsn, QStringLiteral("QBitmap"), QVariant(QBitmap(12, 57)));
// QVariant::Bool
setData(dsn, "bool", QVariant((bool)true));
setData(dsn, QStringLiteral("bool"), QVariant((bool)true));
// QVariant::Brush
setData(dsn, "QBrush", QVariant(QBrush(Qt::SolidPattern)));
setData(dsn, QStringLiteral("QBrush"), QVariant(QBrush(Qt::SolidPattern)));
// QVariant::ByteArray
QByteArray byteArray;
for (int i = 0; i < 256; ++i) {
byteArray.append(i);
}
setData(dsn, "QByteArray1", QVariant(byteArray));
setData(dsn, "QByteArray2", QVariant(QByteArray("KDE4")));
setData(dsn, QStringLiteral("QByteArray1"), QVariant(byteArray));
setData(dsn, QStringLiteral("QByteArray2"), QVariant(QByteArray("KDE4")));
// QVariant::Char
setData(dsn, "QChar", QVariant(QChar(0x4B)));
setData(dsn, QStringLiteral("QChar"), QVariant(QChar(0x4B)));
// QVariant::Color
setData(dsn, "QColor", QVariant(QColor("#031337")));
setData(dsn, QStringLiteral("QColor"), QVariant(QColor("#031337")));
// QVariant::Cursor
setData(dsn, "QCursor", QVariant(QCursor(Qt::ArrowCursor)));
setData(dsn, QStringLiteral("QCursor"), QVariant(QCursor(Qt::ArrowCursor)));
// QVariant::Date
setData(dsn, "QDate", QVariant(QDate(2008, 1, 11)));
setData(dsn, QStringLiteral("QDate"), QVariant(QDate(2008, 1, 11)));
// 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
setData(dsn, "double", QVariant((double)12.34));
setData(dsn, QStringLiteral("double"), QVariant((double)12.34));
// QVariant::Font
setData(dsn, "QFont", QVariant(QFont()));
setData(dsn, QStringLiteral("QFont"), QVariant(QFont()));
// QVariant::Icon
setData(dsn, "QIcon", QVariant(QIcon(QPixmap(12, 34))));
setData(dsn, QStringLiteral("QIcon"), QVariant(QIcon(QPixmap(12, 34))));
// 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
setData(dsn, "int", QVariant((int) - 4321));
setData(dsn, QStringLiteral("int"), QVariant((int) - 4321));
// QVariant::KeySequence (???)
// QVariant::Line
setData(dsn, "QLine", QVariant(QLine(12, 34, 56, 78)));
setData(dsn, QStringLiteral("QLine"), QVariant(QLine(12, 34, 56, 78)));
// 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
QList<QVariant> list;
list << QString("KDE4") << QBrush() << QPen();
setData(dsn, "QList", QVariant(list));
list << QStringLiteral("KDE4") << QBrush() << QPen();
setData(dsn, QStringLiteral("QList"), QVariant(list));
// QVariant::Locale
setData(dsn, "QLocale", QVariant(QLocale("fr_FR")));
setData(dsn, QStringLiteral("QLocale"), QVariant(QLocale(QStringLiteral("fr_FR"))));
// QVariant::LongLong
setData(dsn, "qlonglong", QVariant((qlonglong) - 4321));
setData(dsn, QStringLiteral("qlonglong"), QVariant((qlonglong) - 4321));
// QVariant::Map
QMap<QString, QVariant> map;
for (int i = 0; i < 123; ++i) {
QString key = QString("key%1").arg(i);
QString val = QString("value%1").arg(i);
QString key = QStringLiteral("key%1").arg(i);
QString val = QStringLiteral("value%1").arg(i);
map[key] = val;
}
setData(dsn, "QMap", QVariant(map));
setData(dsn, QStringLiteral("QMap"), QVariant(map));
// QVariant::Matrix
setData(dsn, "QMatrix", QVariant(QMatrix()));
setData(dsn, QStringLiteral("QMatrix"), QVariant(QMatrix()));
// QVariant::Transform
setData(dsn, "QTransform", QVariant(QTransform()));
setData(dsn, QStringLiteral("QTransform"), QVariant(QTransform()));
// QVariant::Palette
setData(dsn, "QPalette", QVariant(QPalette()));
setData(dsn, QStringLiteral("QPalette"), QVariant(QPalette()));
// QVariant::Pen
setData(dsn, "QPen", QVariant(QPen(Qt::SolidLine)));
setData(dsn, QStringLiteral("QPen"), QVariant(QPen(Qt::SolidLine)));
// QVariant::Pixmap
setData(dsn, "QPixmap", QVariant(QPixmap(12, 34)));
setData(dsn, QStringLiteral("QPixmap"), QVariant(QPixmap(12, 34)));
// 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::PointF
setData(dsn, "QPointF", QVariant(QPointF(12.34, 56.78)));
setData(dsn, QStringLiteral("QPointF"), QVariant(QPointF(12.34, 56.78)));
// QVariant::Polygon
setData(dsn, "QPolygon", QVariant(QPolygon(42)));
setData(dsn, QStringLiteral("QPolygon"), QVariant(QPolygon(42)));
// QVariant::Rect
setData(dsn, "QRect", QVariant(QRect(12, 34, 56, 78)));
setData(dsn, QStringLiteral("QRect"), QVariant(QRect(12, 34, 56, 78)));
// 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
setData(dsn, "QRegExp", QVariant(QRegExp("^KDE4$")));
setData(dsn, QStringLiteral("QRegExp"), QVariant(QRegExp("^KDE4$")));
// QVariant::Region
setData(dsn, "QRegion", QVariant(QRegion(10, 20, 30, 40)));
setData(dsn, QStringLiteral("QRegion"), QVariant(QRegion(10, 20, 30, 40)));
// QVariant::Size
setData(dsn, "QSize", QVariant(QSize(12, 34)));
setData(dsn, QStringLiteral("QSize"), QVariant(QSize(12, 34)));
// QVariant::SizeF
setData(dsn, "QSizeF", QVariant(QSizeF(12.34, 56.78)));
setData(dsn, QStringLiteral("QSizeF"), QVariant(QSizeF(12.34, 56.78)));
// QVariant::SizePolicy
setData(dsn, "QSizePolicy", QVariant(QSizePolicy()));
setData(dsn, QStringLiteral("QSizePolicy"), QVariant(QSizePolicy()));
// QVariant::String
setData(dsn, "QString", QVariant(QString("KDE4 ROCKS!")));
setData(dsn, QStringLiteral("QString"), QVariant(QStringLiteral("KDE4 ROCKS!")));
// QVariant::StringList
QStringList stringList;
stringList << "K" << "D" << "E" << "4";
setData(dsn, "QStringList", QVariant(stringList));
stringList << QStringLiteral("K") << QStringLiteral("D") << QStringLiteral("E") << QStringLiteral("4");
setData(dsn, QStringLiteral("QStringList"), QVariant(stringList));
// QVariant::TextFormat
setData(dsn, "QTextFormat", QVariant(QTextFormat()));
setData(dsn, QStringLiteral("QTextFormat"), QVariant(QTextFormat()));
// QVariant::TextLength
setData(dsn, "QTextLength", QVariant(QTextLength()));
setData(dsn, QStringLiteral("QTextLength"), QVariant(QTextLength()));
// QVariant::Time
setData(dsn, "QTime", QVariant(QTime(12, 34, 56)));
setData(dsn, QStringLiteral("QTime"), QVariant(QTime(12, 34, 56)));
// QVariant::UInt
setData(dsn, "uint", QVariant((uint)4321));
setData(dsn, QStringLiteral("uint"), QVariant((uint)4321));
// QVariant::ULongLong
setData(dsn, "qulonglong", QVariant((qulonglong)4321));
setData(dsn, QStringLiteral("qulonglong"), QVariant((qulonglong)4321));
// 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
MyUserType userType;
QVariant v;
v.setValue(userType);
setData(dsn, "UserType", v);
setData(dsn, QStringLiteral("UserType"), v);
} // init()
bool TestEngine::sourceRequestEvent(const QString &source)