Commit 0b6588c4 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

General code clean-up

- Less implicit cast from ASCII
- Use Q_SIGNALS/Q_SLOTS in header files
- Remove a redundant cmake var
parent 43e46707
......@@ -109,7 +109,7 @@ public:
QLocale locale;
QVector<QString> dicts;
const auto bcp = locale.bcp47Name();
const QString dictName = "ibus/dicts/emoji-" + QString(bcp).replace(QLatin1Char('-'), QLatin1Char('_')) + ".dict";
const QString dictName = QLatin1String{"ibus/dicts/emoji-"} + QString(bcp).replace(QLatin1Char('-'), QLatin1Char('_')) + QLatin1String{".dict"};
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, dictName);
if (!path.isEmpty()) {
dicts << path;
......@@ -117,7 +117,7 @@ public:
const auto idxSpecific = bcp.indexOf(QLatin1Char('-'));
if (idxSpecific > 0) {
const QString genericDictName = "ibus/dicts/emoji-" + bcp.leftRef(idxSpecific) + ".dict";
const QString genericDictName = QLatin1String{"ibus/dicts/emoji-"} + bcp.leftRef(idxSpecific) + QLatin1String{".dict"};
const QString genericPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, genericDictName);
if (!genericPath.isEmpty()) {
......@@ -126,8 +126,7 @@ public:
}
if (dicts.isEmpty()) {
const QString genericDictName = "ibus/dicts/emoji-en.dict";
const QString genericPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, genericDictName);
const QString genericPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("ibus/dicts/emoji-en.dict"));
if (!genericPath.isEmpty()) {
dicts << genericPath;
......@@ -154,7 +153,7 @@ public:
}
const QString emoji = QString::fromUtf8(ibus_emoji_data_get_emoji(data));
const QString description = ibus_emoji_data_get_description(data);
const QString description = QString::fromUtf8(ibus_emoji_data_get_description(data));
if (description == QString::fromUtf8("↑↑↑") || description.isEmpty() || processedEmoji.contains(emoji)) {
continue;
}
......
......@@ -189,7 +189,7 @@ App::App(int &argc, char *argv[])
initIconMap(m_iconMap);
m_watcher->setConnection(QDBusConnection::sessionBus());
m_watcher->addWatchedService("org.kde.impanel");
m_watcher->addWatchedService(QStringLiteral("org.kde.impanel"));
init();
}
......
......@@ -367,8 +367,8 @@ static void impanel_get_default_engine(IBusPanelImpanel *impanel, char ***pengin
QList<QByteArray> engineList;
impanel->xkbLayoutManager->getLayout();
QStringList layouts = impanel->xkbLayoutManager->defaultLayout().split(',');
QStringList variants = impanel->xkbLayoutManager->defaultVariant().split(',');
QStringList layouts = impanel->xkbLayoutManager->defaultLayout().split(QLatin1Char{','});
QStringList variants = impanel->xkbLayoutManager->defaultVariant().split(QLatin1Char{','});
for (int i = 0; i < layouts.size(); i++) {
QString variant;
......@@ -393,8 +393,8 @@ static void impanel_get_default_engine(IBusPanelImpanel *impanel, char ***pengin
locale = "C";
}
QStringList localeList = QString(locale).split('.');
QString lang = localeList.size() > 0 ? localeList[0] : "";
QStringList localeList = QString::fromLocal8Bit(locale).split(QLatin1Char{'.'});
const QString lang = localeList.size() > 0 ? localeList.at(0) : QString{};
bool added = false;
for (GList *engine = g_list_first(engines); engine != nullptr; engine = g_list_next(engine)) {
......@@ -411,8 +411,8 @@ static void impanel_get_default_engine(IBusPanelImpanel *impanel, char ***pengin
}
if (!added) {
localeList = QString(lang).split('_');
QString lang = localeList.size() > 0 ? localeList[0] : "";
localeList = QString(lang).split(QLatin1Char{'_'});
QString _lang = localeList.size() > 0 ? localeList.at(0) : QString{};
for (GList *engine = g_list_first(engines); engine != nullptr; engine = g_list_next(engine)) {
IBusEngineDesc *desc = IBUS_ENGINE_DESC(engine->data);
......@@ -421,7 +421,7 @@ static void impanel_get_default_engine(IBusPanelImpanel *impanel, char ***pengin
continue;
}
if (QLatin1String(ibus_engine_desc_get_language(desc)) == lang && ibus_engine_desc_get_rank(desc) > 0) {
if (QLatin1String(ibus_engine_desc_get_language(desc)) == _lang && ibus_engine_desc_get_rank(desc) > 0) {
engineList << name;
}
}
......
......@@ -44,7 +44,7 @@ void XkbLayoutManager::setLatinLayouts(const gchar **variants, gsize length)
void XkbLayoutManager::getLayout()
{
QProcess process;
process.start(XKB_COMMAND, QStringList(XKB_QUERY_ARG));
process.start(QString::fromLatin1(XKB_COMMAND), QStringList(QString::fromLatin1(XKB_QUERY_ARG)));
process.waitForFinished();
QByteArray output = process.readAllStandardOutput();
QList<QByteArray> lines = output.split('\n');
......@@ -76,63 +76,65 @@ void XkbLayoutManager::setLayout(IBusEngineDesc *desc)
QString variant = QString::fromUtf8(cvariant ? cvariant : "");
QString option = QString::fromUtf8(coption ? coption : "");
if (layout == "default" && (variant == "default" || variant == "") && (option == "default" || option == "")) {
if (layout == QLatin1String{"default"}
&& (variant.isEmpty() || variant == QLatin1String{"default"})
&& (option.isEmpty() && option == QLatin1String{"default"})) {
return;
}
bool need_us_layout = false;
if (variant != "eng") {
if (variant != QLatin1String{"eng"}) {
need_us_layout = m_latinLayouts.contains(layout);
}
if (!need_us_layout && variant != "") {
need_us_layout = m_latinLayouts.contains(QString("%1(%2)").arg(layout, variant));
if (!variant.isEmpty() && !need_us_layout) {
need_us_layout = m_latinLayouts.contains(QLatin1String("%1(%2)").arg(layout, variant));
}
if (m_defaultLayout == "") {
if (m_defaultLayout.isEmpty()) {
getLayout();
}
if (layout == "default" || layout == "") {
if (layout.isEmpty() || layout == QLatin1String{"default"}) {
layout = m_defaultLayout;
variant = m_defaultVariant;
}
if (layout == "") {
if (layout.isEmpty()) {
g_warning("Could not get the correct layout");
return;
}
if (option == "default" || option == "") {
if (option.isEmpty() || option == QLatin1String{"default"}) {
option = m_defaultOption;
} else {
if (!(m_defaultOption.split(",").contains(option))) {
option = QString("%1,%2").arg(m_defaultOption, option);
if (!(m_defaultOption.split(QLatin1Char{','}).contains(option))) {
option = QLatin1String("%1,%2").arg(m_defaultOption, option);
} else {
option = m_defaultOption;
}
}
if (need_us_layout) {
layout += ",us";
if (variant != "") {
variant += ",";
layout += QLatin1String{",us"};
if (!variant.isEmpty()) {
variant += QLatin1Char{','};
}
}
QStringList args;
args << XKB_LAYOUT_ARG;
args << QString::fromLatin1(XKB_LAYOUT_ARG);
args << layout;
if (variant != "" && variant != "default") {
args << "-variant";
if (!variant.isEmpty() && variant != QLatin1String("default")) {
args << QStringLiteral("-variant");
args << variant;
}
if (option != "" && option != "default") {
if (!option.isEmpty() && option != QLatin1String("default")) {
/*TODO: Need to get the session XKB options */
args << "-option";
args << QStringLiteral("-option");
args << option;
}
int exit_status = QProcess::execute(XKB_COMMAND, args);
int exit_status = QProcess::execute(QString::fromLatin1(XKB_COMMAND), args);
if (exit_status != 0) {
g_warning("Execute setxkbmap failed.");
......@@ -149,8 +151,8 @@ void XkbLayoutManager::runXmodmap()
QDir home = QDir::home();
for (size_t i = 0; i < sizeof(XMODMAP_KNOWN_FILES) / sizeof(XMODMAP_KNOWN_FILES[0]); i++) {
if (home.exists(XMODMAP_KNOWN_FILES[i])) {
QProcess::startDetached(XMODMAP_COMMAND, QStringList(home.filePath(XMODMAP_KNOWN_FILES[i])));
if (home.exists(QString::fromLatin1(XMODMAP_KNOWN_FILES[i]))) {
QProcess::startDetached(QString::fromLatin1(XMODMAP_COMMAND), QStringList{home.filePath(QString::fromLatin1(XMODMAP_KNOWN_FILES[i]))});
break;
}
}
......
......@@ -47,30 +47,35 @@ public Q_SLOTS:
// Check if applet is still there.
connect(m_watcher, &QDBusServiceWatcher::serviceUnregistered, this, &IBusPanelLauncher::serviceUnregistered);
connect(m_watcher, &QDBusServiceWatcher::serviceRegistered, this, &IBusPanelLauncher::serviceRegistered);
m_watcher->addWatchedService("org.kde.impanel");
m_watcher->addWatchedService("org.freedesktop.IBus");
m_watcher->addWatchedService(QStringLiteral("org.kde.impanel"));
m_watcher->addWatchedService(QStringLiteral("org.freedesktop.IBus"));
// check if panel is already created
QDBusConnection::sessionBus().connect("org.kde.impanel", "/org/kde/impanel", "org.kde.impanel2", "PanelRegistered", this, SLOT(quit()));
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.impanel")) {
QDBusConnection::sessionBus().connect(QStringLiteral("org.kde.impanel"),
QStringLiteral("/org/kde/impanel"),
QStringLiteral("org.kde.impanel2"),
QStringLiteral("PanelRegistered"),
this,
SLOT(quit()));
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.impanel"))) {
quit();
return;
}
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.freedesktop.IBus")) {
serviceRegistered("org.freedesktop.IBus");
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.IBus"))) {
serviceRegistered(QStringLiteral("org.freedesktop.IBus"));
}
}
void serviceRegistered(const QString &service)
{
if (service == "org.freedesktop.IBus") {
if (service == QLatin1String{"org.freedesktop.IBus"}) {
launchIBusPanel();
}
}
void serviceUnregistered(const QString &service)
{
if (service == "org.kde.impanel") {
if (service == QLatin1String{"org.kde.impanel"}) {
quit();
}
}
......
......@@ -141,7 +141,7 @@ void Kimpanel::updateLookupTableFull(const KimpanelLookupTable &lookupTable, int
void Kimpanel::updateProperty(const KimpanelProperty &property)
{
for (auto &prop : m_props) {
if (prop.toMap()["key"] == property.key) {
if (prop.toMap()[QStringLiteral("key")] == property.key) {
prop = property.toMap();
emit propertiesChanged();
break;
......
......@@ -60,7 +60,7 @@ public:
Q_INVOKABLE void configure();
Q_INVOKABLE void exit();
signals:
Q_SIGNALS:
void auxTextChanged();
void preeditTextChanged();
void lookupTableChanged();
......@@ -68,7 +68,7 @@ signals:
void propertiesChanged();
void menuTriggered(const QVariantList &props);
private slots:
private Q_SLOTS:
void updatePreeditText(const QString &text, const QList<TextAttribute> &attrList);
void updateAux(const QString &text, const QList<TextAttribute> &attrList);
void updatePreeditCaret(int pos);
......
......@@ -63,7 +63,7 @@ public:
QHash<QString, QString> unityMappingRules() const;
signals:
Q_SIGNALS:
void countChanged(const QString &uri, int count);
void countVisibleChanged(const QString &uri, bool countVisible);
void progressChanged(const QString &uri, int progress);
......@@ -73,7 +73,7 @@ signals:
void reloadRequested(const QString &uri);
void launcherRemoved(const QString &uri);
private slots:
private Q_SLOTS:
void update(const QString &uri, const QMap<QString, QVariant> &properties);
private:
......
......@@ -54,7 +54,7 @@ public:
bool progressVisible() const;
bool urgent() const;
signals:
Q_SIGNALS:
void launcherUrlChanged(const QUrl &launcherUrl);
void countChanged(int count);
......
......@@ -67,7 +67,7 @@ QString KdePlatformDependent::getAccessToken(const QUrl & /*baseUrl*/) const
QString idToken;
Accounts::Manager *accountsManager = KAccounts::accountsManager();
if (accountsManager) {
static const QString serviceType{"opendesktop-rating"};
static const QString serviceType{QStringLiteral("opendesktop-rating")};
Accounts::AccountIdList accountIds = accountsManager->accountList(serviceType);
// TODO Present the user with a choice in case there's more than one, but for now just pick the first successful one
// loop through the accounts, and attempt to get them
......@@ -81,8 +81,8 @@ QString KdePlatformDependent::getAccessToken(const QUrl & /*baseUrl*/) const
connect(job, &KJob::finished, [&completed, &accessToken, &idToken](KJob *kjob) {
GetCredentialsJob *job = qobject_cast<GetCredentialsJob *>(kjob);
QVariantMap credentialsData = job->credentialsData();
accessToken = credentialsData["AccessToken"].toString();
idToken = credentialsData["IdToken"].toString();
accessToken = credentialsData[QStringLiteral("AccessToken")].toString();
idToken = credentialsData[QStringLiteral("IdToken")].toString();
// As this can be useful for more heavy duty debugging purposes, leaving this in so it doesn't have to be rewritten
// if (!accessToken.isEmpty()) {
// qCDebug(ATTICA_PLUGIN_LOG) << "Credentials data was retrieved";
......@@ -122,7 +122,7 @@ QString KdePlatformDependent::getAccessToken(const QUrl & /*baseUrl*/) const
QUrl baseUrlFromRequest(const QNetworkRequest &request)
{
const QUrl url{request.url()};
QString baseUrl = QString("%1://%2").arg(url.scheme()).arg(url.host());
QString baseUrl = QLatin1String("%1://%2").arg(url.scheme(), url.host());
int port = url.port();
if (port != -1) {
baseUrl.append(QString::number(port));
......
/* config-workspace.h. Generated by cmake from config-workspace.h.cmake */
#cmakedefine HAVE_QIMAGEBLITZ
/* Define if you have DPMS support */
#cmakedefine HAVE_DPMS 1
......
......@@ -41,7 +41,7 @@ void FolderModelTest::createTestFolder(const QString &path)
QDir dir(m_folderDir->path());
dir.mkdir(path);
dir.cd(path);
dir.mkdir("firstDir");
dir.mkdir(QStringLiteral("firstDir"));
QFile f;
for (int i = 1; i < 10; i++) {
f.setFileName(QStringLiteral("%1/file%2.txt").arg(dir.path(), QString::number(i)));
......@@ -109,8 +109,8 @@ void FolderModelTest::tst_listingFolderNotFirst()
void FolderModelTest::tst_filterListing()
{
// a little bit weird API, as both pattern and mimetype needs to be set
m_folderModel->setFilterPattern("*.txt");
m_folderModel->setFilterMimeTypes({"all/all"});
m_folderModel->setFilterPattern(QStringLiteral("*.txt"));
m_folderModel->setFilterMimeTypes(QStringList{QStringLiteral("all/all")});
m_folderModel->setFilterMode(FolderModel::FilterShowMatches);
const auto count = m_folderModel->rowCount();
QCOMPARE(count, 9);
......@@ -326,12 +326,12 @@ void FolderModelTest::tst_multiScreen()
// create a new item, it appears on the first screen
QDir dir(m_folderDir->path());
dir.cd(desktop);
dir.mkdir("secondDir");
dir.cd("secondDir");
dir.mkdir(QStringLiteral("secondDir"));
dir.cd(QStringLiteral("secondDir"));
s.wait(1000);
QCOMPARE(m_folderModel->rowCount(), count);
QCOMPARE(secondFolderModel.rowCount(), 1);
QCOMPARE(screenMapper->screenForItem(stringToUrl("file://" + dir.path())), 0);
QCOMPARE(screenMapper->screenForItem(stringToUrl(QLatin1String("file://") + dir.path())), 0);
}
void FolderModelTest::tst_multiScreenDifferenPath()
......@@ -357,14 +357,14 @@ void FolderModelTest::tst_multiScreenDifferenPath()
// create a new item, it appears on the first screen
QDir dir(m_folderDir->path());
dir.cd(desktop);
dir.mkdir("secondDir");
dir.mkdir(QStringLiteral("secondDir"));
s.wait(1000);
QCOMPARE(m_folderModel->rowCount(), count + 1);
QCOMPARE(secondFolderModel.rowCount(), count2);
// create a new item, it appears on the second screen
dir.cd(m_folderDir->path() + QDir::separator() + desktop2);
dir.mkdir("secondDir2");
dir.mkdir(QStringLiteral("secondDir2"));
s.wait(1000);
QCOMPARE(m_folderModel->rowCount(), count + 1);
QCOMPARE(secondFolderModel.rowCount(), count2 + 1);
......
......@@ -40,7 +40,7 @@ void PositionerTest::initTestCase()
QDir dir(m_folderDir->path());
dir.mkdir(desktop);
dir.cd(desktop);
dir.mkdir("firstDir");
dir.mkdir(QStringLiteral("firstDir"));
QFile f;
for (int i = 1; i < 10; i++) {
f.setFileName(QStringLiteral("%1/file%2.txt").arg(dir.path(), QString::number(i)));
......
......@@ -77,7 +77,7 @@ void ScreenMapperTest::tst_addMapping()
const auto path = ScreenMapper::stringToUrl(QStringLiteral("desktop:/"));
addScreens(path);
QSignalSpy s(m_screenMapper, &ScreenMapper::screenMappingChanged);
QString file("desktop:/foo%1.txt");
QString file(QStringLiteral("desktop:/foo%1.txt"));
for (int i = 0; i < 3; i++) {
const QUrl url = ScreenMapper::stringToUrl(file.arg(i));
......@@ -91,7 +91,7 @@ void ScreenMapperTest::tst_addRemoveScreenWithItems()
{
const auto path = ScreenMapper::stringToUrl(QStringLiteral("desktop:/"));
addScreens(path);
QString file("desktop:/foo%1.txt");
QString file(QStringLiteral("desktop:/foo%1.txt"));
for (int i = 0; i < 3; i++) {
const QUrl url = ScreenMapper::stringToUrl(file.arg(i));
......
......@@ -1040,6 +1040,25 @@ static bool isDropBetweenSharedViews(const QList<QUrl> &urls, const QUrl &folder
return true;
}
static const char *s_ark_dndextract_service = "application/x-kde-ark-dndextract-service";
static const char *s_ark_dndextract_path = "application/x-kde-ark-dndextract-path";
static QString arkDbusServiceName(const QMimeData *mimeData)
{
return QString::fromUtf8(mimeData->data(QString::fromLatin1(s_ark_dndextract_service)));
}
static QString arkDbusPath(const QMimeData *mimeData)
{
return QString::fromUtf8(mimeData->data(QString::fromLatin1(s_ark_dndextract_path)));
}
static bool isMimeDataArkDnd(const QMimeData *mimeData)
{
return mimeData->hasFormat(QString::fromLatin1(s_ark_dndextract_service)) //
&& mimeData->hasFormat(QString::fromLatin1(s_ark_dndextract_path));
}
void FolderModel::drop(QQuickItem *target, QObject *dropEvent, int row, bool showMenuManually)
{
QMimeData *mimeData = qobject_cast<QMimeData *>(dropEvent->property("mimeData").value<QObject *>());
......@@ -1122,13 +1141,9 @@ void FolderModel::drop(QQuickItem *target, QObject *dropEvent, int row, bool sho
return;
}
if (mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-service"))
&& mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-path"))) {
const QString remoteDBusClient = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-service"));
const QString remoteDBusPath = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-path"));
QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient,
remoteDBusPath,
if (isMimeDataArkDnd(mimeData)) {
QDBusMessage message = QDBusMessage::createMethodCall(arkDbusServiceName(mimeData),
arkDbusPath(mimeData),
QStringLiteral("org.kde.ark.DndExtract"),
QStringLiteral("extractSelectedFilesTo"));
message.setArguments({dropTargetUrl.toDisplayString(QUrl::PreferLocalFile)});
......@@ -1238,13 +1253,9 @@ void FolderModel::dropCwd(QObject *dropEvent)
return;
}
if (mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-service"))
&& mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-path"))) {
const QString remoteDBusClient = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-service"));
const QString remoteDBusPath = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-path"));
QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient,
remoteDBusPath,
if (isMimeDataArkDnd(mimeData)) {
QDBusMessage message = QDBusMessage::createMethodCall(arkDbusServiceName(mimeData),
arkDbusPath(mimeData),
QStringLiteral("org.kde.ark.DndExtract"),
QStringLiteral("extractSelectedFilesTo"));
message.setArguments(QVariantList() << m_dirModel->dirLister()->url().adjusted(QUrl::PreferLocalFile).toString());
......
......@@ -39,7 +39,7 @@
#include <KWindowSystem>
#include <QX11Info>
#define PLASMACONFIG "plasma-org.kde.plasma.desktop-appletsrc"
static const char *s_plasma_config = "plasma-org.kde.plasma.desktop-appletsrc";
namespace
{
......@@ -48,11 +48,11 @@ class BackgroundCache : public QObject
public:
BackgroundCache()
: initialized(false)
, plasmaConfig(KSharedConfig::openConfig(PLASMACONFIG))
, plasmaConfig(KSharedConfig::openConfig(QString::fromLatin1(s_plasma_config)))
{
using namespace std::placeholders;
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + PLASMACONFIG;
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char{'/'} + QLatin1String{s_plasma_config};
KDirWatch::self()->addFile(configFile);
......@@ -62,7 +62,7 @@ public:
void settingsFileChanged(const QString &file)
{
if (!file.endsWith(PLASMACONFIG)) {
if (!file.endsWith(QLatin1String{s_plasma_config})) {
return;
}
......@@ -146,7 +146,7 @@ public:
// << "last screen is" << lastScreen
// ;
if (processed && newForActivity[activity][0] != '#')
if (processed && newForActivity[activity][0] != QLatin1Char{'#'})
continue;
// Marking the current activity as processed
......@@ -233,7 +233,7 @@ SortedActivitiesModel::SortedActivitiesModel(const QVector<KActivities::Info::St
KWindowInfo info(window, NET::WMVisibleName, NET::WM2Activities);
const QStringList activities = info.activities();
if (activities.isEmpty() || activities.contains("00000000-0000-0000-0000-000000000000"))
if (activities.isEmpty() || activities.contains(QLatin1String{"00000000-0000-0000-0000-000000000000"}))
continue;
for (const auto &activity : activities) {
......@@ -275,7 +275,7 @@ uint SortedActivitiesModel::lastUsedTime(const QString &activity) const
return ~(uint)0;
} else {
KConfig config("kactivitymanagerd-switcher", KConfig::SimpleConfig);
KConfig config(QStringLiteral("kactivitymanagerd-switcher"), KConfig::SimpleConfig);
KConfigGroup times(&config, "LastUsed");
return times.readEntry(activity, (uint)0);
......@@ -444,7 +444,7 @@ void SortedActivitiesModel::onWindowAdded(WId window)
KWindowInfo info(window, NET::Properties(), NET::WM2Activities);
const QStringList activities = info.activities();
if (activities.isEmpty() || activities.contains("00000000-0000-0000-0000-000000000000"))
if (activities.isEmpty() || activities.contains(QLatin1String{"00000000-0000-0000-0000-000000000000"}))
return;
for (const auto &activity : activities) {
......
......@@ -49,8 +49,8 @@
#include <X11/keysym.h>
#include <X11/keysymdef.h>
#define ACTION_NAME_NEXT_ACTIVITY "next activity"
#define ACTION_NAME_PREVIOUS_ACTIVITY "previous activity"
static const char *s_action_name_next_activity = "next activity";
static const char *s_action_name_previous_activity = "previous activity";
namespace
{
......@@ -251,9 +251,9 @@ SwitcherBackend::SwitcherBackend(QObject *parent)
, m_runningActivitiesModel(new SortedActivitiesModel({KActivities::Info::Running, KActivities::Info::Stopping}, this))
, m_stoppedActivitiesModel(new SortedActivitiesModel({KActivities::Info::Stopped, KActivities::Info::Starting}, this))
{
registerShortcut(ACTION_NAME_NEXT_ACTIVITY, i18n("Walk through activities"), Qt::META | Qt::Key_Tab, &SwitcherBackend::keybdSwitchToNextActivity);
registerShortcut(QString::fromLatin1(s_action_name_next_activity), i18n("Walk through activities"), Qt::META | Qt::Key_Tab, &SwitcherBackend::keybdSwitchToNextActivity);
registerShortcut(ACTION_NAME_PREVIOUS_ACTIVITY,
registerShortcut(QString::fromLatin1(s_action_name_previous_activity),
i18n("Walk through activities (Reverse)"),
Qt::META | Qt::SHIFT | Qt::Key_Tab,
&SwitcherBackend::keybdSwitchToPreviousActivity);
......@@ -280,7 +280,7 @@ SwitcherBackend::~SwitcherBackend()
QObject *SwitcherBackend::instance(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(scriptEngine)
engine->addImageProvider("wallpaperthumbnail", new ThumbnailImageProvider());
engine->addImageProvider(QStringLiteral("wallpaperthumbnail"), new ThumbnailImageProvider());
return new SwitcherBackend();
}
......@@ -289,7 +289,7 @@ void SwitcherBackend::keybdSwitchToNextActivity()