Commit 330d40f4 authored by Martin Flöser's avatar Martin Flöser

Fix no cast to/from ASCII intrduced issues

* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
parent d45d900d
......@@ -122,7 +122,7 @@ inline
QString Activities::nullUuid()
{
// cloned from kactivities/src/lib/core/consumer.cpp
return QString("00000000-0000-0000-0000-000000000000");
return QStringLiteral("00000000-0000-0000-0000-000000000000");
}
}
......
......@@ -1361,18 +1361,18 @@ void Client::killProcess(bool ask, xcb_timestamp_t timestamp)
if (!ask) {
if (!clientMachine()->isLocal()) {
QStringList lst;
lst << clientMachine()->hostName() << "kill" << QString::number(pid);
QProcess::startDetached("xon", lst);
lst << QString::fromUtf8(clientMachine()->hostName()) << QStringLiteral("kill") << QString::number(pid);
QProcess::startDetached(QStringLiteral("xon"), lst);
} else
::kill(pid, SIGTERM);
} else {
QString hostname = clientMachine()->isLocal() ? "localhost" : clientMachine()->hostName();
QProcess::startDetached(KStandardDirs::findExe("kwin_killer_helper"),
QStringList() << "--pid" << QByteArray().setNum(unsigned(pid)) << "--hostname" << hostname
<< "--windowname" << caption()
<< "--applicationname" << resourceClass()
<< "--wid" << QString::number(window())
<< "--timestamp" << QString::number(timestamp),
QString hostname = clientMachine()->isLocal() ? QStringLiteral("localhost") : QString::fromUtf8(clientMachine()->hostName());
QProcess::startDetached(KStandardDirs::findExe(QStringLiteral("kwin_killer_helper")),
QStringList() << QStringLiteral("--pid") << QString::number(unsigned(pid)) << QStringLiteral("--hostname") << hostname
<< QStringLiteral("--windowname") << caption()
<< QStringLiteral("--applicationname") << QString::fromUtf8(resourceClass())
<< QStringLiteral("--wid") << QString::number(window())
<< QStringLiteral("--timestamp") << QString::number(timestamp),
QString(), &m_killHelperPID);
}
}
......@@ -1501,9 +1501,9 @@ void Client::setOnActivity(const QString &activity, bool enable)
void Client::setOnActivities(QStringList newActivitiesList)
{
#ifdef KWIN_BUILD_ACTIVITIES
QString joinedActivitiesList = newActivitiesList.join(",");
QString joinedActivitiesList = newActivitiesList.join(QStringLiteral(","));
joinedActivitiesList = rules()->checkActivity(joinedActivitiesList, false);
newActivitiesList = joinedActivitiesList.split(',', QString::SkipEmptyParts);
newActivitiesList = joinedActivitiesList.split(QStringLiteral(","), QString::SkipEmptyParts);
QStringList allActivities = Activities::self()->all();
if ( newActivitiesList.isEmpty() ||
......@@ -1739,7 +1739,7 @@ void Client::setCaption(const QString& _s, bool force)
QString s(_s);
for (int i = 0; i < s.length(); ++i)
if (!s[i].isPrint())
s[i] = QChar(' ');
s[i] = QChar(u' ');
cap_normal = s;
#ifdef KWIN_BUILD_SCRIPTING
if (options->condensedTitle()) {
......@@ -1747,21 +1747,21 @@ void Client::setCaption(const QString& _s, bool force)
static QScriptProgram stripTitle;
static QScriptValue script;
if (stripTitle.isNull()) {
const QString scriptFile = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/stripTitle.js");
const QString scriptFile = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/stripTitle.js"));
if (!scriptFile.isEmpty()) {
QFile f(scriptFile);
if (f.open(QIODevice::ReadOnly|QIODevice::Text)) {
f.reset();
stripTitle = QScriptProgram(QString::fromLocal8Bit(f.readAll()), "stripTitle.js");
stripTitle = QScriptProgram(QString::fromLocal8Bit(f.readAll()), QStringLiteral("stripTitle.js"));
f.close();
}
}
if (stripTitle.isNull())
stripTitle = QScriptProgram("(function(title, wm_name, wm_class){ return title ; })", "stripTitle.js");
stripTitle = QScriptProgram(QStringLiteral("(function(title, wm_name, wm_class){ return title ; })"), QStringLiteral("stripTitle.js"));
script = engine.evaluate(stripTitle);
}
QScriptValueList args;
args << _s << QString(resourceName()) << QString(resourceClass());
args << _s << QString::fromUtf8(resourceName()) << QString::fromUtf8(resourceClass());
s = script.call(QScriptValue(), args).toString();
}
#endif
......@@ -1775,17 +1775,17 @@ void Client::setCaption(const QString& _s, bool force)
QString machine_suffix;
if (!options->condensedTitle()) { // machine doesn't qualify for "clean"
if (clientMachine()->hostName() != ClientMachine::localhost() && !clientMachine()->isLocal())
machine_suffix = QString(" <@") + clientMachine()->hostName() + '>' + LRM;
machine_suffix = QStringLiteral(" <@") + QString::fromUtf8(clientMachine()->hostName()) + QStringLiteral(">") + LRM;
}
QString shortcut_suffix = !shortcut().isEmpty() ? (" {" + shortcut().toString() + '}') : QString();
QString shortcut_suffix = !shortcut().isEmpty() ? (QStringLiteral(" {") + shortcut().toString() + QStringLiteral("}")) : QString();
cap_suffix = machine_suffix + shortcut_suffix;
if ((!isSpecialWindow() || isToolbar()) && workspace()->findClient(FetchNameInternalPredicate(this))) {
int i = 2;
do {
cap_suffix = machine_suffix + " <" + QString::number(i) + '>' + LRM;
cap_suffix = machine_suffix + QStringLiteral(" <") + QString::number(i) + QStringLiteral(">") + LRM;
i++;
} while (workspace()->findClient(FetchNameInternalPredicate(this)));
info->setVisibleName(caption().toUtf8());
info->setVisibleName(caption().toUtf8().constData());
reset_name = false;
}
if ((was_suffix && cap_suffix.isEmpty()) || reset_name) {
......@@ -1794,7 +1794,7 @@ void Client::setCaption(const QString& _s, bool force)
info->setVisibleIconName("");
} else if (!cap_suffix.isEmpty() && !cap_iconic.isEmpty())
// Keep the same suffix in iconic name if it's set
info->setVisibleIconName(QString(cap_iconic + cap_suffix).toUtf8());
info->setVisibleIconName(QString(cap_iconic + cap_suffix).toUtf8().constData());
emit captionChanged();
}
......@@ -1816,7 +1816,7 @@ void Client::fetchIconicName()
cap_iconic = s;
if (!cap_suffix.isEmpty()) {
if (!cap_iconic.isEmpty()) // Keep the same suffix in iconic name if it's set
info->setVisibleIconName(QString(s + cap_suffix).toUtf8());
info->setVisibleIconName(QString(s + cap_suffix).toUtf8().constData());
else if (was_set)
info->setVisibleIconName("");
}
......@@ -2347,7 +2347,7 @@ QPixmap* kwin_get_menu_pix_hack()
{
static QPixmap p;
if (p.isNull())
p = SmallIcon("bx2");
p = SmallIcon(QStringLiteral("bx2"));
return &p;
}
......@@ -2357,7 +2357,7 @@ void Client::checkActivities()
QStringList newActivitiesList;
QByteArray prop = getStringProperty(window(), atoms->activities);
activitiesDefined = !prop.isEmpty();
if (prop == Activities::nullUuid()) {
if (QString::fromUtf8(prop) == Activities::nullUuid()) {
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
if (!activityList.isEmpty()) {
activityList.clear();
......@@ -2374,7 +2374,7 @@ void Client::checkActivities()
return;
}
newActivitiesList = QString(prop).split(',');
newActivitiesList = QString::fromUtf8(prop).split(QStringLiteral(","));
if (newActivitiesList == activityList)
return; //expected change, it's ok.
......
......@@ -98,8 +98,8 @@ void GetAddrInfo::resolve()
// TODO: C++11 nullptr
const char* nullPtr = NULL;
m_watcher->setFuture(QtConcurrent::run(getaddrinfo, m_hostName, nullPtr, m_addressHints, &m_address));
m_ownAddressWatcher->setFuture(QtConcurrent::run(getaddrinfo, getHostName(), nullPtr, m_addressHints, &m_ownAddress));
m_watcher->setFuture(QtConcurrent::run(getaddrinfo, m_hostName.constData(), nullPtr, m_addressHints, &m_address));
m_ownAddressWatcher->setFuture(QtConcurrent::run(getaddrinfo, getHostName().constData(), nullPtr, m_addressHints, &m_ownAddress));
}
void GetAddrInfo::slotResolved()
......
......@@ -93,8 +93,8 @@ Compositor::Compositor(QObject* workspace)
qRegisterMetaType<Compositor::SuspendReason>("Compositor::SuspendReason");
new CompositingAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/Compositor", this);
dbus.registerService("org.kde.kwin.Compositing");
dbus.registerObject(QStringLiteral("/Compositor"), this);
dbus.registerService(QStringLiteral("org.kde.kwin.Compositing"));
connect(&unredirectTimer, SIGNAL(timeout()), SLOT(delayedCheckUnredirect()));
connect(&compositeResetTimer, SIGNAL(timeout()), SLOT(restart()));
connect(workspace, SIGNAL(configChanged()), SLOT(slotConfigChanged()));
......@@ -183,7 +183,7 @@ void Compositor::slotCompositingOptionsInitialized()
// Some broken drivers crash on glXQuery() so to prevent constant KWin crashes:
KSharedConfigPtr unsafeConfigPtr = KGlobal::config();
KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing");
const QString openGLIsUnsafe = "OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : "");
const QString openGLIsUnsafe = QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString());
if (unsafeConfig.readEntry(openGLIsUnsafe, false))
kWarning(1212) << "KWin has detected that your OpenGL library is unsafe to use";
else {
......@@ -431,13 +431,13 @@ void Compositor::toggleCompositing()
if (m_suspended) {
// when disabled show a shortcut how the user can get back compositing
QString shortcut, message;
if (KAction* action = qobject_cast<KAction*>(Workspace::self()->actionCollection()->action("Suspend Compositing")))
if (KAction* action = qobject_cast<KAction*>(Workspace::self()->actionCollection()->action(QStringLiteral("Suspend Compositing"))))
shortcut = action->globalShortcut().primary().toString(QKeySequence::NativeText);
if (!shortcut.isEmpty()) {
// display notification only if there is the shortcut
message = i18n("Desktop effects have been suspended by another application.<br/>"
"You can resume using the '%1' shortcut.", shortcut);
KNotification::event("compositingsuspendeddbus", message);
KNotification::event(QStringLiteral("compositingsuspendeddbus"), message);
}
}
}
......@@ -780,22 +780,22 @@ bool Compositor::isOpenGLBroken() const
QString Compositor::compositingType() const
{
if (!hasScene()) {
return "none";
return QStringLiteral("none");
}
switch (m_scene->compositingType()) {
case XRenderCompositing:
return "xrender";
return QStringLiteral("xrender");
case OpenGL1Compositing:
return "gl1";
return QStringLiteral("gl1");
case OpenGL2Compositing:
#ifdef KWIN_HAVE_OPENGLES
return "gles";
return QStringLiteral("gles");
#else
return "gl2";
return QStringLiteral("gl2");
#endif
case NoCompositing:
default:
return "none";
return QStringLiteral("none");
}
}
......
......@@ -52,7 +52,7 @@ CompositingPrefs::~CompositingPrefs()
bool CompositingPrefs::openGlIsBroken()
{
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
return KConfigGroup(KGlobal::config(), "Compositing").readEntry(unsafeKey, false);
}
......@@ -60,8 +60,8 @@ bool CompositingPrefs::compositingPossible()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == QStringLiteral("OpenGL") &&
gl_workaround_group.readEntry(unsafeKey, false))
return false;
......@@ -90,8 +90,8 @@ QString CompositingPrefs::compositingNotPossibleReason()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == QStringLiteral("OpenGL") &&
gl_workaround_group.readEntry(unsafeKey, false))
return i18n("<b>OpenGL compositing (the default) has crashed KWin in the past.</b><br>"
"This was most likely due to a driver bug."
......@@ -149,7 +149,7 @@ void CompositingPrefs::detect()
// environment variable.
// Direct rendering is preferred, since not all OpenGL extensions are
// available with indirect rendering.
const QString opengl_test = KStandardDirs::findExe("kwin_opengl_test");
const QString opengl_test = KStandardDirs::findExe(QStringLiteral("kwin_opengl_test"));
if (QProcess::execute(opengl_test) != 0) {
mEnableDirectRendering = false;
setenv("LIBGL_ALWAYS_INDIRECT", "1", true);
......
......@@ -46,15 +46,15 @@ DBusInterface::DBusInterface(QObject *parent)
(void) new KWinAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/KWin", this);
if (!dbus.registerService("org.kde.KWin")) {
QDBusServiceWatcher *dog = new QDBusServiceWatcher("org.kde.KWin", dbus, QDBusServiceWatcher::WatchForUnregistration, this);
dbus.registerObject(QStringLiteral("/KWin"), this);
if (!dbus.registerService(QStringLiteral("org.kde.KWin"))) {
QDBusServiceWatcher *dog = new QDBusServiceWatcher(QStringLiteral("org.kde.KWin"), dbus, QDBusServiceWatcher::WatchForUnregistration, this);
connect (dog, SIGNAL(serviceUnregistered(QString)), SLOT(becomeKWinService(QString)));
}
connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SIGNAL(compositingToggled(bool)));
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig",
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
Workspace::self(), SLOT(slotReloadConfig()));
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reinitCompositing",
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reinitCompositing"),
Compositor::self(), SLOT(slotReinitialize()));
}
......@@ -62,16 +62,16 @@ void DBusInterface::becomeKWinService(const QString &service)
{
// TODO: this watchdog exists to make really safe that we at some point get the service
// but it's probably no longer needed since we explicitly unregister the service with the deconstructor
if (service == "org.kde.KWin" && QDBusConnection::sessionBus().registerService("org.kde.KWin") && sender()) {
if (service == QStringLiteral("org.kde.KWin") && QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin")) && sender()) {
sender()->deleteLater(); // bye doggy :'(
}
}
DBusInterface::~DBusInterface()
{
QDBusConnection::sessionBus().unregisterService("org.kde.KWin"); // this is the long standing legal service
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.KWin")); // this is the long standing legal service
// KApplication automatically also grabs org.kde.kwin, so it's often been used externally - ensure to free it as well
QDBusConnection::sessionBus().unregisterService("org.kde.kwin");
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.kwin"));
}
void DBusInterface::circulateDesktopApplications()
......
......@@ -38,12 +38,12 @@ DecorationPlugin::DecorationPlugin(QObject *parent)
, KDecorationPlugins(KGlobal::config())
, m_disabled(false)
{
defaultPlugin = "kwin3_oxygen";
defaultPlugin = QStringLiteral("kwin3_oxygen");
#ifndef KWIN_BUILD_OXYGEN
defaultPlugin = "kwin3_aurorae";
defaultPlugin = QStringLiteral("kwin3_aurorae");
#endif
#ifdef KWIN_BUILD_DECORATIONS
loadPlugin(""); // load the plugin specified in cfg file
loadPlugin(QString()); // load the plugin specified in cfg file
#else
setDisabled(true);
#endif
......@@ -157,30 +157,30 @@ void DecorationPlugin::resetCompositing()
QString DecorationPlugin::supportInformation()
{
if (m_disabled) {
return "Decoration Plugin disabled\n";
return QStringLiteral("Decoration Plugin disabled\n");
}
QString support;
support.append("Current Plugin: ");
support.append(QStringLiteral("Current Plugin: "));
support.append(currentPlugin());
support.append('\n');
support.append(QStringLiteral("\n"));
support.append("Shadows: ");
support.append(hasShadows() ? "yes\n" : "no\n");
support.append(QStringLiteral("Shadows: "));
support.append(hasShadows() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Alpha: ");
support.append(hasAlpha() ? "yes\n" : "no\n");
support.append(QStringLiteral("Alpha: "));
support.append(hasAlpha() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Announces Alpha: ");
support.append(supportsAnnounceAlpha() ? "yes\n" : "no\n");
support.append(QStringLiteral("Announces Alpha: "));
support.append(supportsAnnounceAlpha() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Tabbing: ");
support.append(supportsTabbing() ? "yes\n" : "no\n");
support.append(QStringLiteral("Tabbing: "));
support.append(supportsTabbing() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Frame Overlap: ");
support.append(supportsFrameOverlap() ? "yes\n" : "no\n");
support.append(QStringLiteral("Frame Overlap: "));
support.append(supportsFrameOverlap() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Blur Behind: ");
support.append(supportsBlurBehind() ? "yes\n" : "no\n");
support.append(QStringLiteral("Blur Behind: "));
support.append(supportsBlurBehind() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
// TODO: Qt5 - read support information from Factory
return support;
}
......
......@@ -76,7 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
static const QString SCREEN_LOCKER_SERVICE_NAME = QString("org.freedesktop.ScreenSaver");
static const QString SCREEN_LOCKER_SERVICE_NAME = QStringLiteral("org.freedesktop.ScreenSaver");
ScreenLockerWatcher::ScreenLockerWatcher(QObject *parent)
: QObject(parent)
......@@ -220,8 +220,8 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
{
new EffectsAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/Effects", this);
dbus.registerService("org.kde.kwin.Effects");
dbus.registerObject(QStringLiteral("/Effects"), this);
dbus.registerService(QStringLiteral("org.kde.kwin.Effects"));
// init is important, otherwise causes crashes when quads are build before the first painting pass start
m_currentBuildQuadsIterator = m_activeEffects.end();
......@@ -303,7 +303,7 @@ void EffectsHandlerImpl::reconfigure()
// perform querying for the services in a thread
QFutureWatcher<KService::List> *watcher = new QFutureWatcher<KService::List>(this);
connect(watcher, SIGNAL(finished()), this, SLOT(slotEffectsQueried()));
watcher->setFuture(QtConcurrent::run(KServiceTypeTrader::self(), &KServiceTypeTrader::query, QString("KWin/Effect"), QString()));
watcher->setFuture(QtConcurrent::run(KServiceTypeTrader::self(), &KServiceTypeTrader::query, QStringLiteral("KWin/Effect"), QString()));
}
void EffectsHandlerImpl::slotEffectsQueried()
......@@ -735,7 +735,7 @@ void EffectsHandlerImpl::stopMouseInterception(Effect *effect)
void* EffectsHandlerImpl::getProxy(QString name)
{
// All effects start with "kwin4_effect_", prepend it to the name
name.prepend("kwin4_effect_");
name.prepend(QStringLiteral("kwin4_effect_"));
for (QVector< EffectPair >::iterator it = loaded_effects.begin(); it != loaded_effects.end(); ++it)
if ((*it).first == name)
......@@ -1276,11 +1276,11 @@ KLibrary* EffectsHandlerImpl::findEffectLibrary(KService* service)
{
QString libname = service->library();
#ifdef KWIN_HAVE_OPENGLES
if (libname.startsWith(QLatin1String("kwin4_effect_"))) {
libname.replace("kwin4_effect_", "kwin4_effect_gles_");
if (libname.startsWith(QStringLiteral("kwin4_effect_"))) {
libname.replace(QStringLiteral("kwin4_effect_"), QStringLiteral("kwin4_effect_gles_"));
}
#endif
libname.replace("kwin", KWIN_NAME);
libname.replace(QStringLiteral("kwin"), QStringLiteral(KWIN_NAME));
KLibrary* library = new KLibrary(libname);
if (!library) {
kError(1212) << "couldn't open library for effect '" <<
......@@ -1310,7 +1310,7 @@ QStringList EffectsHandlerImpl::loadedEffects() const
QStringList EffectsHandlerImpl::listOfEffects() const
{
KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect");
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/Effect"));
QStringList listOfModules;
// First unload necessary effects
foreach (const KService::Ptr & service, offers) {
......@@ -1339,15 +1339,15 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
kDebug(1212) << "Trying to load " << name;
QString internalname = name.toLower();
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(internalname);
KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect", constraint);
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(internalname);
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/Effect"), constraint);
if (offers.isEmpty()) {
kError(1212) << "Couldn't find effect " << name << endl;
return false;
}
KService::Ptr service = offers.first();
if (service->property("X-Plasma-API").toString() == "javascript") {
if (service->property(QStringLiteral("X-Plasma-API")).toString() == QStringLiteral("javascript")) {
// this is a scripted effect - use different loader
return loadScriptedEffect(name, service.data());
}
......@@ -1357,8 +1357,8 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
return false;
}
QString version_symbol = "effect_version_" + name;
KLibrary::void_function_ptr version_func = library->resolveFunction(version_symbol.toAscii());
QString version_symbol = QStringLiteral("effect_version_") + name;
KLibrary::void_function_ptr version_func = library->resolveFunction(version_symbol.toAscii().constData());
if (version_func == NULL) {
kWarning(1212) << "Effect " << name << " does not provide required API version, ignoring.";
delete library;
......@@ -1376,13 +1376,13 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
return false;
}
const QString enabledByDefault_symbol = "effect_enabledbydefault_" + name;
const QString enabledByDefault_symbol = QStringLiteral("effect_enabledbydefault_") + name;
KLibrary::void_function_ptr enabledByDefault_func = library->resolveFunction(enabledByDefault_symbol.toAscii().data());
const QString supported_symbol = "effect_supported_" + name;
const QString supported_symbol = QStringLiteral("effect_supported_") + name;
KLibrary::void_function_ptr supported_func = library->resolveFunction(supported_symbol.toAscii().data());
const QString create_symbol = "effect_create_" + name;
const QString create_symbol = QStringLiteral("effect_create_") + name;
KLibrary::void_function_ptr create_func = library->resolveFunction(create_symbol.toAscii().data());
if (supported_func) {
......@@ -1428,7 +1428,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
Effect* e = create();
effect_order.insert(service->property("X-KDE-Ordering").toInt(), EffectPair(name, e));
effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, e));
effectsChanged();
effect_libraries[ name ] = library;
......@@ -1439,12 +1439,12 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi
{
#ifdef KWIN_BUILD_SCRIPTING
const KDesktopFile df("services", service->entryPath());
const QString scriptName = df.desktopGroup().readEntry<QString>("X-Plasma-MainScript", "");
const QString scriptName = df.desktopGroup().readEntry<QString>(QStringLiteral("X-Plasma-MainScript"), QString());
if (scriptName.isEmpty()) {
kDebug(1212) << "X-Plasma-MainScript not set";
return false;
}
const QString scriptFile = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/effects/" + name + "/contents/" + scriptName);
const QString scriptFile = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/effects/") + name + QStringLiteral("/contents/") + scriptName);
if (scriptFile.isNull()) {
kDebug(1212) << "Could not locate the effect script";
return false;
......@@ -1454,7 +1454,7 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi
kDebug(1212) << "Could not initialize scripted effect: " << name;
return false;
}
effect_order.insert(service->property("X-KDE-Ordering").toInt(), EffectPair(name, effect));
effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, effect));
effectsChanged();
return true;
#else
......@@ -1578,14 +1578,14 @@ QString EffectsHandlerImpl::supportInformation(const QString &name) const
}
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
if ((*it).first == name) {
QString support((*it).first + ":\n");
QString support((*it).first + QStringLiteral(":\n"));
const QMetaObject *metaOptions = (*it).second->metaObject();
for (int i=0; i<metaOptions->propertyCount(); ++i) {
const QMetaProperty property = metaOptions->property(i);
if (QLatin1String(property.name()) == "objectName") {
if (QLatin1String(property.name()) == QLatin1String("objectName")) {
continue;
}
support.append(QLatin1String(property.name()) % ": " % (*it).second->property(property.name()).toString() % '\n');
support.append(QString::fromUtf8(property.name()) + QStringLiteral(": ") + (*it).second->property(property.name()).toString() + QStringLiteral("\n"));
}
return support;
}
......@@ -1601,7 +1601,7 @@ bool EffectsHandlerImpl::isScreenLocked() const
QString EffectsHandlerImpl::debug(const QString& name, const QString& parameter) const
{
QString internalName = name.startsWith("kwin4_effect_") ? name : "kwin4_effect_" + name;
QString internalName = name.startsWith(QStringLiteral("kwin4_effect_")) ? name : QStringLiteral("kwin4_effect_") + name;
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
if ((*it).first == internalName) {
return it->second->debug(parameter);
......@@ -1849,12 +1849,12 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint
, m_theme(new Plasma::Theme(this))
{
if (m_style == EffectFrameStyled) {
m_frame.setImagePath("widgets/background");
m_frame.setImagePath(QStringLiteral("widgets/background"));
m_frame.setCacheAllRenderedFrames(true);
connect(m_theme, SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
}
m_selection.setImagePath("widgets/viewitem");
m_selection.setElementPrefix("hover");
m_selection.setImagePath(QStringLiteral("widgets/viewitem"));
m_selection.setElementPrefix(QStringLiteral("hover"));
m_selection.setCacheAllRenderedFrames(true);
m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders);
......
......@@ -45,7 +45,7 @@ void BlurEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("blur");
EffectsHandler::sendReloadMessage(QStringLiteral("blur"));
}
} // namespace KWin
......
......@@ -362,7 +362,7 @@ void ARBBlurShader::reset()
bool ARBBlurShader::supported()
{
if (!hasGLExtension("GL_ARB_fragment_program"))
if (!hasGLExtension(QStringLiteral("GL_ARB_fragment_program")))
return false;
(void) glGetError(); // Clear the error state
......