Commit fb392377 authored by Laurent Montel's avatar Laurent Montel 😁

Use QStringLiteral and co

parent 15f22bb0
......@@ -108,11 +108,11 @@ QString parseStarPattern(const QString &pattern, const QString &joker,
// Just skip the current character
isEscaped = false;
} else if (*currentPosition == '\\') {
} else if (*currentPosition == QLatin1Char('\\')) {
// Skip two characters
isEscaped = true;
} else if (*currentPosition == '*') {
} else if (*currentPosition == QLatin1Char('*')) {
// Replacing the star with the sql like joker - %
resultPattern.append(escape(stringFromIterators(
currentStart, currentPosition)) + joker);
......
......@@ -57,7 +57,7 @@ Activities::Private::KDE4ConfigurationTransitionChecker::KDE4ConfigurationTransi
// configuration file to the new location.
const QString newConfigLocation
= QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)
+ '/' + ACTIVITY_MANAGER_CONFIG_FILE_NAME;
+ QLatin1Char('/') + ACTIVITY_MANAGER_CONFIG_FILE_NAME;
if (QFile(newConfigLocation).exists()) {
return;
......@@ -69,7 +69,7 @@ Activities::Private::KDE4ConfigurationTransitionChecker::KDE4ConfigurationTransi
return;
}
QString oldConfigFile(migration.locateLocal("config", "activitymanagerrc"));
QString oldConfigFile(migration.locateLocal("config", QStringLiteral("activitymanagerrc")));
if (!oldConfigFile.isEmpty()) {
QFile(oldConfigFile).copy(newConfigLocation);
}
......@@ -120,7 +120,7 @@ Activities::Private::Private(Activities *parent)
// Is this our first start?
if (activities.isEmpty()) {
// We need to add this only after the service has been properly started
KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "Activities");
KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("Activities"));
//NOTE: config key still singular for retrocompatibility
const QStringList names = cg.readEntry("defaultActivityName", QStringList{i18n("Default")});
......@@ -475,7 +475,7 @@ QString Activities::AddActivity(const QString &name)
{
// We do not care about authorization if this is the first start
if (!d->activities.isEmpty() &&
!KAuthorized::authorize("plasma-desktop/add_activities")) {
!KAuthorized::authorize(QStringLiteral("plasma-desktop/add_activities"))) {
return QString();
}
......@@ -484,7 +484,7 @@ QString Activities::AddActivity(const QString &name)
void Activities::RemoveActivity(const QString &activity)
{
if (!KAuthorized::authorize("plasma-desktop/add_activities")) {
if (!KAuthorized::authorize(QStringLiteral("plasma-desktop/add_activities"))) {
return;
}
......
......@@ -111,11 +111,11 @@ public:
const auto pluginName = plugin.pluginId();
qCDebug(KAMD_LOG_APPLICATION) << "Plugin Name is " << pluginName << plugin.fileName();
if (pluginName == "org.kde.ActivityManager.ResourceScoring") {
if (pluginName == QLatin1String("org.kde.ActivityManager.ResourceScoring")) {
// SQLite plugin is necessary for the proper workspace behaviour
return true;
} else {
return config.readEntry(pluginName + "Enabled", plugin.isEnabledByDefault());
return config.readEntry(pluginName + QStringLiteral("Enabled"), plugin.isEnabledByDefault());
}
}
......@@ -156,7 +156,7 @@ void Application::init()
QMetaObject::invokeMethod(this, "loadPlugins", Qt::QueuedConnection);
QDBusConnection::sessionBus().registerObject("/ActivityManager", this,
QDBusConnection::sessionBus().registerObject(QStringLiteral("/ActivityManager"), this,
QDBusConnection::ExportAllSlots);
}
......@@ -296,8 +296,8 @@ namespace {
template <typename Return>
Return callOnRunningService(const QString &method)
{
static QDBusInterface remote(KAMD_DBUS_SERVICE, "/ActivityManager",
"org.kde.ActivityManager.Application");
static QDBusInterface remote(KAMD_DBUS_SERVICE, QStringLiteral("/ActivityManager"),
QStringLiteral("org.kde.ActivityManager.Application"));
QDBusReply<Return> reply = remote.call(method);
return (Return)reply;
......@@ -305,7 +305,7 @@ namespace {
QString runningServiceVersion()
{
return callOnRunningService<QString>("serviceVersion");
return callOnRunningService<QString>(QStringLiteral("serviceVersion"));
}
bool isServiceRunning()
......@@ -339,7 +339,7 @@ int main(int argc, char **argv)
if (arguments.size() == 0) {
QCoreApplication::exit(EXIT_FAILURE);
} else if (arguments.size() != 1 && (arguments.size() != 2 || arguments[1] == "--help")) {
} else if (arguments.size() != 1 && (arguments.size() != 2 || arguments[1] == QLatin1String("--help"))) {
QTextStream(stdout)
<< "start\tStarts the service\n"
......@@ -350,7 +350,7 @@ int main(int argc, char **argv)
QCoreApplication::exit(EXIT_SUCCESS);
} else if (arguments.size() == 1 || arguments[1] == "start") {
} else if (arguments.size() == 1 || arguments[1] == QLatin1String("start")) {
// Checking whether the service is already running
if (isServiceRunning()) {
......@@ -376,25 +376,25 @@ int main(int argc, char **argv)
// Starting the dameon
QProcess::startDetached(
KAMD_FULL_BIN_DIR "/kactivitymanagerd",
QStringList{"start-daemon"}
QLatin1String(KAMD_FULL_BIN_DIR "/kactivitymanagerd"),
QStringList{QStringLiteral("start-daemon")}
);
return application.exec();
} else if (arguments[1] == "stop") {
} else if (arguments[1] == QLatin1String("stop")) {
if (!isServiceRunning()) {
QTextStream(stdout) << "Service not running\n";
QCoreApplication::exit(EXIT_SUCCESS);
}
callOnRunningService<void>("quit");
callOnRunningService<void>(QStringLiteral("quit"));
QTextStream(stdout) << "Service stopped\n";
return EXIT_SUCCESS;
} else if (arguments[1] == "status") {
} else if (arguments[1] == QLatin1String("status")) {
// Checking whether the service is already running
if (isServiceRunning()) {
......@@ -407,7 +407,7 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
} else if (arguments[1] == "start-daemon") {
} else if (arguments[1] == QLatin1String("start-daemon")) {
// Really starting the activity manager
KDBusService service(KDBusService::Unique);
......
......@@ -70,7 +70,7 @@ private:
};
Config::Config(QObject *parent)
: Module("config", parent)
: Module(QStringLiteral("config"), parent)
, d(this)
{
}
......
......@@ -43,7 +43,7 @@ RunApplicationPlugin::RunApplicationPlugin(QObject *parent, const QVariantList &
{
Q_UNUSED(args);
setName("org.kde.ActivityManager.RunApplication");
setName(QStringLiteral("org.kde.ActivityManager.RunApplication"=);
}
RunApplicationPlugin::~RunApplicationPlugin()
......@@ -54,7 +54,7 @@ bool RunApplicationPlugin::init(QHash<QString, QObject *> &modules)
{
Plugin::init(modules);
m_activitiesService = modules["activities"];
m_activitiesService = modules[QStringLiteral("activities")];
connect(m_activitiesService, SIGNAL(CurrentActivityChanged(QString)),
this, SLOT(currentActivityChanged(QString)));
......@@ -62,7 +62,7 @@ bool RunApplicationPlugin::init(QHash<QString, QObject *> &modules)
this, SLOT(activityStateChanged(QString, int)));
const auto currentActivity = Plugin::retrieve<QString>(
m_activitiesService, "CurrentActivity", "QString");
m_activitiesService, QStringLiteral("CurrentActivity"), QStringLiteral("QString"));
currentActivityChanged(currentActivity);
......@@ -72,7 +72,7 @@ bool RunApplicationPlugin::init(QHash<QString, QObject *> &modules)
QString RunApplicationPlugin::activityDirectory(const QString &activity) const
{
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QStringLiteral("/kactivitymanagerd/activities/") + activity + '/';
+ QStringLiteral("/kactivitymanagerd/activities/") + activity + QLatin1Char('/');
}
void RunApplicationPlugin::currentActivityChanged(const QString &activity)
......@@ -82,12 +82,12 @@ void RunApplicationPlugin::currentActivityChanged(const QString &activity)
}
if (!m_currentActivity.isEmpty()) {
executeIn(activityDirectory(activity) + "deactivated");
executeIn(activityDirectory(activity) + QStringLiteral("deactivated"));
}
m_currentActivity = activity;
executeIn(activityDirectory(activity) + "activated");
executeIn(activityDirectory(activity) + QStringLiteral("activated"));
if (!m_previousActivities.contains(activity)) {
// This is the first time we have switched
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment