Commit 5b08f70b authored by Laurent Montel's avatar Laurent Montel 😁

Use nullptr/explicit/QStringLiteral

parent e99778b9
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcmaccess\")
set(kcm_access_PART_SRCS kcmaccess.cpp )
ki18n_wrap_ui(kcm_access_PART_SRCS
......
......@@ -53,8 +53,8 @@ ActivitiesTab::ActivitiesTab(QWidget *parent)
d->viewActivities = createView(this);
d->viewActivities->rootContext()->setContextProperty(
"kactivitiesExtras", d->extraActivitiesInterface);
setViewSource(d->viewActivities, "/qml/activitiesTab/main.qml");
QStringLiteral("kactivitiesExtras"), d->extraActivitiesInterface);
setViewSource(d->viewActivities, QStringLiteral("/qml/activitiesTab/main.qml"));
}
ActivitiesTab::~ActivitiesTab()
......
......@@ -31,7 +31,7 @@
class ActivitiesTab : public QWidget {
Q_OBJECT
public:
ActivitiesTab(QWidget *parent);
explicit ActivitiesTab(QWidget *parent);
~ActivitiesTab();
public Q_SLOTS:
......
......@@ -57,7 +57,7 @@ BlacklistedApplicationsModel::BlacklistedApplicationsModel(QObject *parent)
: QAbstractListModel(parent)
{
d->enabled = false;
d->pluginConfig = KSharedConfig::openConfig("kactivitymanagerd-pluginsrc");
d->pluginConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerd-pluginsrc"));
}
BlacklistedApplicationsModel::~BlacklistedApplicationsModel()
......@@ -90,7 +90,7 @@ void BlacklistedApplicationsModel::load()
= QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QStringLiteral("/kactivitymanagerd/resources/database");
d->database = QSqlDatabase::addDatabase("QSQLITE", "plugins_sqlite_db_resources");
d->database = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), QStringLiteral("plugins_sqlite_db_resources"));
d->database.setDatabaseName(path);
if (!d->database.open()) {
......@@ -98,7 +98,7 @@ void BlacklistedApplicationsModel::load()
return;
}
auto query = d->database.exec("SELECT DISTINCT(initiatingAgent) FROM ResourceScoreCache ORDER BY initiatingAgent");
auto query = d->database.exec(QStringLiteral("SELECT DISTINCT(initiatingAgent) FROM ResourceScoreCache ORDER BY initiatingAgent"));
if (d->applications.length() > 0) {
beginRemoveRows(QModelIndex(), 0, d->applications.length() - 1);
......@@ -123,7 +123,7 @@ void BlacklistedApplicationsModel::load()
auto applications = (blockedApplications + allowedApplications).toList();
if (applications.length() > 0) {
qSort(applications);
std::sort(applications.begin(), applications.end());
beginInsertRows(QModelIndex(), 0, applications.length() - 1);
......@@ -215,7 +215,7 @@ QVariant BlacklistedApplicationsModel::data(const QModelIndex &modelIndex, int r
return application.title;
case Qt::DecorationRole:
return application.icon.isEmpty() ? "application-x-executable" : application.icon;
return application.icon.isEmpty() ? QStringLiteral("application-x-executable") : application.icon;
case BlockedApplicationRole:
return application.blocked;
......
......@@ -34,8 +34,8 @@ class BlacklistedApplicationsModel : public QAbstractListModel {
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
public:
BlacklistedApplicationsModel(QObject *parent = nullptr);
~BlacklistedApplicationsModel();
explicit BlacklistedApplicationsModel(QObject *parent = nullptr);
~BlacklistedApplicationsModel() override;
enum Roles {
ApplicationIdRole = Qt::UserRole + 1,
......
......@@ -55,7 +55,7 @@ public:
{
if (!activityActions.contains(activity)) {
auto action = activitiesActionCollection->addAction(
"switch-to-activity-" + activity);
QStringLiteral("switch-to-activity-") + activity);
activityActions[activity] = action;
action->setProperty("isConfigurationAction", true);
......@@ -86,7 +86,7 @@ void ExtraActivitiesInterface::setIsPrivate(const QString &activity,
bool isPrivate, QJSValue callback)
{
auto result = d->features->SetValue(
"org.kde.ActivityManager.Resources.Scoring/isOTR/" + activity,
QStringLiteral("org.kde.ActivityManager.Resources.Scoring/isOTR/") + activity,
QDBusVariant(isPrivate));
auto *watcher = new QDBusPendingCallWatcher(result, this);
......@@ -104,7 +104,7 @@ void ExtraActivitiesInterface::getIsPrivate(const QString &activity,
QJSValue callback)
{
auto result = d->features->GetValue(
"org.kde.ActivityManager.Resources.Scoring/isOTR/" + activity);
QStringLiteral("org.kde.ActivityManager.Resources.Scoring/isOTR/") + activity);
auto *watcher = new QDBusPendingCallWatcher(result, this);
......
......@@ -32,7 +32,7 @@ class ExtraActivitiesInterface : public QObject {
Q_OBJECT
public:
ExtraActivitiesInterface(QObject *parent = nullptr);
explicit ExtraActivitiesInterface(QObject *parent = nullptr);
~ExtraActivitiesInterface();
public Q_SLOTS:
......
......@@ -35,7 +35,7 @@ class MainConfigurationWidget : public KCModule {
Q_OBJECT
public:
MainConfigurationWidget(QWidget *parent, QVariantList args);
~MainConfigurationWidget();
~MainConfigurationWidget() override;
public Q_SLOTS:
void defaults() override;
......
......@@ -65,8 +65,8 @@ PrivacyTab::PrivacyTab(QWidget *parent)
{
d->setupUi(this);
d->mainConfig = KSharedConfig::openConfig("kactivitymanagerdrc");
d->pluginConfig = KSharedConfig::openConfig("kactivitymanagerd-pluginsrc");
d->mainConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerdrc"));
d->pluginConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerd-pluginsrc"));
// Keep history initialization
......@@ -101,9 +101,9 @@ PrivacyTab::PrivacyTab(QWidget *parent)
d->viewBlacklistedApplications
= createView(d->viewBlacklistedApplicationsContainer);
d->viewBlacklistedApplications->rootContext()->setContextProperty(
"applicationModel", d->blacklistedApplicationsModel);
QStringLiteral("applicationModel"), d->blacklistedApplicationsModel);
setViewSource(d->viewBlacklistedApplications,
"/qml/privacyTab/BlacklistApplicationView.qml");
QStringLiteral("/qml/privacyTab/BlacklistApplicationView.qml"));
// React to changes
......@@ -146,8 +146,8 @@ void PrivacyTab::load()
const auto statisticsConfig
= d->pluginConfig->group(SQLITE_PLUGIN_CONFIG_KEY);
const auto whatToRemember = (WhatToRemember)statisticsConfig.readEntry(
"what-to-remember", (int)AllApplications);
const auto whatToRemember = static_cast<WhatToRemember>(statisticsConfig.readEntry(
"what-to-remember", static_cast<int>(AllApplications)));
d->radioRememberAllApplications->setChecked(whatToRemember == AllApplications);
d->radioRememberSpecificApplications->setChecked(whatToRemember == SpecificApplications);
......@@ -170,7 +170,7 @@ void PrivacyTab::save()
d->radioDontRememberApplications->isChecked() ? NoApplications :
/* otherwise */ AllApplications;
statisticsConfig.writeEntry("what-to-remember", (int)whatToRemember);
statisticsConfig.writeEntry("what-to-remember", static_cast<int>(whatToRemember));
statisticsConfig.writeEntry("keep-history-for", d->spinKeepHistory->value());
statisticsConfig.writeEntry("blocked-by-default", d->checkBlacklistAllNotOnList->isChecked());
......@@ -189,27 +189,27 @@ void PrivacyTab::forget(int count, const QString &what)
KAMD_DBUS_DECL_INTERFACE(rankingsservice, Resources/Scoring,
ResourcesScoring);
rankingsservice.asyncCall("DeleteRecentStats", QString(), count, what);
rankingsservice.asyncCall(QStringLiteral("DeleteRecentStats"), QString(), count, what);
}
void PrivacyTab::forgetLastHour()
{
forget(1, "h");
forget(1, QStringLiteral("h"));
}
void PrivacyTab::forgetTwoHours()
{
forget(2, "h");
forget(2, QStringLiteral("h"));
}
void PrivacyTab::forgetDay()
{
forget(1, "d");
forget(1, QStringLiteral("d"));
}
void PrivacyTab::forgetAll()
{
forget(0, "everything");
forget(0, QStringLiteral("everything"));
}
void PrivacyTab::spinKeepHistoryValueChanged(int value)
......
......@@ -31,7 +31,7 @@
class PrivacyTab : public QWidget {
Q_OBJECT
public:
PrivacyTab(QWidget *parent);
explicit PrivacyTab(QWidget *parent);
~PrivacyTab();
public Q_SLOTS:
......
......@@ -58,17 +58,17 @@ SwitchingTab::SwitchingTab(QWidget *parent)
{
d->setupUi(this);
d->mainConfig = KSharedConfig::openConfig("kactivitymanagerdrc");
d->mainConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerdrc"));
// Shortcut config. The shortcut belongs to the component "plasmashell"!
d->mainActionCollection = new KActionCollection(this, QStringLiteral("plasmashell"));
d->mainActionCollection->setComponentDisplayName(i18n("Activity switching"));
d->mainActionCollection->setConfigGlobal(true);
d->createAction("next activity",
d->createAction(QStringLiteral("next activity"),
i18nc("@action", "Walk through activities"),
{ Qt::META + Qt::Key_Tab });
d->createAction("previous activity",
d->createAction(QStringLiteral("previous activity"),
i18nc("@action", "Walk through activities (Reverse)"),
{ Qt::META + Qt::SHIFT + Qt::Key_Tab } );
......
......@@ -33,7 +33,7 @@ class QKeySequence;
class SwitchingTab : public QWidget {
Q_OBJECT
public:
SwitchingTab(QWidget *parent);
explicit SwitchingTab(QWidget *parent);
~SwitchingTab();
public Q_SLOTS:
......
# vim:set softtabstop=3 shiftwidth=3 tabstop=3 expandtab:
project (kactivities-settings)
find_package (ECM 0.0.8 REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
find_package (Qt5 REQUIRED NO_MODULE COMPONENTS Sql Gui Widgets Qml Quick Sql QuickWidgets)
find_package (KF5GlobalAccel ${KF5_DEP_VERSION} CONFIG REQUIRED)
# find_package (KF5DBusAddons ${KF5_DEP_VERSION} CONFIG REQUIRED)
find_package (KF5I18n ${KF5_DEP_VERSION} CONFIG REQUIRED)
find_package (KF5WidgetsAddons ${KF5_DEP_VERSION} CONFIG REQUIRED)
find_package (KF5Config ${KF5_DEP_VERSION} CONFIG REQUIRED)
# find_package (KF5CoreAddons ${KF5_DEP_VERSION} CONFIG REQUIRED)
# find_package (KF5KIO ${KF5_DEP_VERSION} CONFIG REQUIRED)
set (
kactivities_KCM_imports_LIB_SRCS
......
......@@ -69,5 +69,5 @@ void ActivitySettings::deleteActivity(const QString &id)
void ActivitySettings::configureActivities()
{
QProcess::startDetached("kcmshell5", { "activities" });
QProcess::startDetached(QStringLiteral("kcmshell5"), { QStringLiteral("activities") });
}
......@@ -53,12 +53,12 @@ class Dialog::Private {
public:
Private(Dialog *parent)
: q(parent)
, activityName("activityName")
, activityDescription("activityDescription")
, activityIcon("activityIcon")
, activityWallpaper("activityWallpaper")
, activityName(QStringLiteral("activityName"))
, activityDescription(QStringLiteral("activityDescription"))
, activityIcon(QStringLiteral("activityIcon"))
, activityWallpaper(QStringLiteral("activityWallpaper"))
, activityIsPrivate(true)
, activityShortcut("activityShortcut")
, activityShortcut(QStringLiteral("activityShortcut"))
, features(new KAMD_DBUS_CLASS_INTERFACE(Features, Features, q))
{
}
......@@ -81,9 +81,9 @@ public:
view->setClearColor(QGuiApplication::palette().window().color());
view->rootContext()->setContextProperty("dialog", q);
view->rootContext()->setContextProperty(QStringLiteral("dialog"), q);
if (setViewSource(view, "/qml/activityDialog/" + file)) {
if (setViewSource(view, QStringLiteral("/qml/activityDialog/") + file)) {
tabs->addTab(view, title);
auto root = view->rootObject();
......@@ -92,7 +92,7 @@ public:
} else {
message->setText(i18n("Error loading the QML files. Check your installation.\nMissing %1",
QStringLiteral(KAMD_KCM_DATADIR) + "/qml/activityDialog/" + file));
QStringLiteral(KAMD_KCM_DATADIR) + QStringLiteral("/qml/activityDialog/") + file));
message->setVisible(true);
}
......@@ -126,7 +126,7 @@ public:
void Dialog::showDialog(const QString &id)
{
static Dialog *dialog = 0;
static Dialog *dialog = nullptr;
// If we use the regular singleton here (static value instead of static ptr),
// we will crash on exit because of Qt...
......@@ -155,8 +155,8 @@ Dialog::Dialog(QObject *parent)
// Tabs
d->tabs = new QTabWidget(this);
d->layout->addWidget(d->tabs);
d->tabGeneral = d->createTab(i18n("General"), "GeneralTab.qml");
d->tabOther = d->createTab(i18n("Other"), "OtherTab.qml");
d->tabGeneral = d->createTab(i18n("General"), QStringLiteral("GeneralTab.qml"));
d->tabOther = d->createTab(i18n("Other"), QStringLiteral("OtherTab.qml"));
// Buttons
d->buttons = new QDialogButtonBox(
......@@ -199,12 +199,12 @@ void Dialog::init(const QString &activityId)
// finding the key shortcut
const auto shortcuts = KGlobalAccel::self()->globalShortcut(
QStringLiteral("ActivityManager"), "switch-to-activity-" + activityId);
QStringLiteral("ActivityManager"), QStringLiteral("switch-to-activity-") + activityId);
setActivityShortcut(shortcuts.isEmpty() ? QKeySequence() : shortcuts.first());
// is private?
auto result = d->features->GetValue(
"org.kde.ActivityManager.Resources.Scoring/isOTR/" + activityId);
QStringLiteral("org.kde.ActivityManager.Resources.Scoring/isOTR/") + activityId);
auto watcher = new QDBusPendingCallWatcher(result, this);
......@@ -293,13 +293,13 @@ void Dialog::saveChanges(const QString &activityId)
// setting the key shortcut
QAction action(nullptr);
action.setProperty("isConfigurationAction", true);
action.setProperty("componentName", "ActivityManager");
action.setObjectName("switch-to-activity-" + activityId);
action.setProperty("componentName", QStringLiteral("ActivityManager"));
action.setObjectName(QStringLiteral("switch-to-activity-") + activityId);
KGlobalAccel::self()->removeAllShortcuts(&action);
KGlobalAccel::self()->setGlobalShortcut(&action, activityShortcut());
// is private?
d->features->SetValue("org.kde.ActivityManager.Resources.Scoring/isOTR/"
d->features->SetValue(QStringLiteral("org.kde.ActivityManager.Resources.Scoring/isOTR/")
+ activityId,
QDBusVariant(activityIsPrivate()));
......
......@@ -30,7 +30,7 @@ class Dialog: public QDialog {
Q_OBJECT
public:
~Dialog();
~Dialog() override;
static void showDialog(const QString &activityId = QString());
......
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcm_autostart\")
set(kcm_autostart_PART_SRCS
autostartitem.cpp
addscriptdialog.cpp
......
......@@ -76,16 +76,16 @@ bool AddScriptDialog::doBasicSanityCheck()
QFileInfo file(path);
if ( ! file.isAbsolute() ) {
KMessageBox::sorry( 0, i18n("\"%1\" is not an absolute path.", path) );
KMessageBox::sorry( nullptr, i18n("\"%1\" is not an absolute path.", path) );
return false;
} else if ( ! file.exists() ) {
KMessageBox::sorry( 0, i18n("\"%1\" does not exist.", path) );
KMessageBox::sorry( nullptr, i18n("\"%1\" does not exist.", path) );
return false;
} else if ( !file.isFile() ) {
KMessageBox::sorry( 0, i18n("\"%1\" is not a file.", path) );
KMessageBox::sorry( nullptr, i18n("\"%1\" is not a file.", path) );
return false;
} else if ( ! file.isReadable() ) {
KMessageBox::sorry( 0, i18n("\"%1\" is not readable.", path) );
KMessageBox::sorry( nullptr, i18n("\"%1\" is not readable.", path) );
return false;
}
......
......@@ -34,8 +34,8 @@ class AddScriptDialog : public QDialog
Q_OBJECT
public:
explicit AddScriptDialog(QWidget* parent=0);
~AddScriptDialog();
explicit AddScriptDialog(QWidget* parent=nullptr);
~AddScriptDialog() override;
// Returns the Url of the script to be imported
QUrl importUrl() const;
bool symLink() const;
......
......@@ -28,7 +28,7 @@ class AdvancedDialog : public QDialog
Q_OBJECT
public:
AdvancedDialog(QWidget* parent, bool status);
explicit AdvancedDialog(QWidget* parent, bool status);
~AdvancedDialog();
bool onlyInKde() const;
......
......@@ -293,7 +293,7 @@ void Autostart::slotAddProgram()
if ( service->desktopEntryName().isEmpty() || service->entryPath().isEmpty()) {
// Build custom desktop file (e.g. when the user entered an executable
// name in the OpenWithDialog).
desktopPath = m_desktopPath + service->name() + ".desktop";
desktopPath = m_desktopPath + service->name() + QStringLiteral(".desktop");
desktopTemplate = QUrl::fromLocalFile( desktopPath );
KConfig kc(desktopTemplate.path(), KConfig::SimpleConfig);
KConfigGroup kcg = kc.group("Desktop Entry");
......@@ -313,10 +313,10 @@ void Autostart::slotAddProgram()
else
{
// Use existing desktop file and use same file name to enable overrides.
desktopPath = m_desktopPath + service->desktopEntryName() + ".desktop";
desktopPath = m_desktopPath + service->desktopEntryName() + QStringLiteral(".desktop");
desktopTemplate = QUrl::fromLocalFile( QStandardPaths::locate(QStandardPaths::ApplicationsLocation, service->entryPath()) );
KPropertiesDialog dlg( QUrl::fromLocalFile(service->entryPath()), QUrl::fromLocalFile(m_desktopPath), service->desktopEntryName() + ".desktop", this );
KPropertiesDialog dlg( QUrl::fromLocalFile(service->entryPath()), QUrl::fromLocalFile(m_desktopPath), service->desktopEntryName() + QStringLiteral(".desktop"), this );
if ( dlg.exec() != QDialog::Accepted )
return;
}
......@@ -396,14 +396,14 @@ bool Autostart::slotEditCMD( const KFileItem &item)
void Autostart::slotEditCMD()
{
if ( widget->listCMD->currentItem() == 0 )
if ( widget->listCMD->currentItem() == nullptr )
return;
slotEditCMD( (AutoStartItem*)widget->listCMD->currentItem() );
}
void Autostart::slotAdvanced()
{
if ( widget->listCMD->currentItem() == 0 )
if ( widget->listCMD->currentItem() == nullptr )
return;
DesktopStartItem *entry = static_cast<DesktopStartItem *>( widget->listCMD->currentItem() );
......
......@@ -37,8 +37,8 @@ class Autostart: public KCModule
Q_OBJECT
public:
Autostart( QWidget* parent, const QVariantList& );
~Autostart();
explicit Autostart( QWidget* parent, const QVariantList& );
~Autostart() override;
enum COL_TYPE { COL_NAME = 0, COL_COMMAND=1, COL_STATUS=2,COL_RUN=3 };
void load() override;
void save() override;
......
......@@ -52,7 +52,7 @@ K_EXPORT_PLUGIN( KolorFactory("kcmcolors") )
KColorCm::KColorCm(QWidget *parent, const QVariantList &)
: KCModule( parent ),
m_dontLoadSelectedScheme(false),
m_previousSchemeItem(0)
m_previousSchemeItem(nullptr)
{
KAboutData* about = new KAboutData(
QStringLiteral("kcmcolors"), i18n("Colors"), QStringLiteral("1.0"), QString(),
......@@ -158,7 +158,7 @@ void KColorCm::loadScheme(QListWidgetItem *currentItem, QListWidgetItem *previou
return;
}
if (currentItem != NULL)
if (currentItem != nullptr)
{
// load it
const QString name = currentItem->text();
......@@ -209,7 +209,7 @@ void KColorCm::loadScheme(QListWidgetItem *currentItem, QListWidgetItem *previou
void KColorCm::on_schemeRemoveButton_clicked()
{
if (schemeList->currentItem() != NULL)
if (schemeList->currentItem() != nullptr)
{
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"color-schemes/" + schemeList->currentItem()->data(Qt::UserRole).toString() +
......@@ -258,22 +258,22 @@ void KColorCm::on_schemeImportButton_clicked()
int increment = 0;
QString newName = name;
QString testpath = "";
QString testpath;
do
{
if (increment) {
newName = name + QString::number(increment);
}
testpath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"color-schemes/" + newName + ".colors");
QStringLiteral("color-schemes/") + newName + QStringLiteral(".colors"));
increment++;
} while (!testpath.isEmpty());
QString newpath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ "/color-schemes/";
+ QStringLiteral("/color-schemes/");
QDir dir;
dir.mkpath(newpath);
newpath += newName + ".colors";
newpath += newName + QStringLiteral(".colors");
QFile::copy(url.toLocalFile(), newpath);
// Update name
......@@ -468,26 +468,26 @@ void KColorCm::updateConfig(KSharedConfigPtr config)
groupOut.writeEntry("ColorScheme", m_currentColorScheme);
QStringList colorItemList;
colorItemList << "BackgroundNormal"
<< "BackgroundAlternate"
<< "ForegroundNormal"
<< "ForegroundInactive"
<< "ForegroundActive"
<< "ForegroundLink"
<< "ForegroundVisited"
<< "ForegroundNegative"
<< "ForegroundNeutral"
<< "ForegroundPositive"
<< "DecorationFocus"
<< "DecorationHover";
colorItemList << QStringLiteral("BackgroundNormal")
<< QStringLiteral("BackgroundAlternate")
<< QStringLiteral("ForegroundNormal")
<< QStringLiteral("ForegroundInactive")
<< QStringLiteral("ForegroundActive")
<< QStringLiteral("ForegroundLink")
<< QStringLiteral("ForegroundVisited")
<< QStringLiteral("ForegroundNegative")
<< QStringLiteral("ForegroundNeutral")
<< QStringLiteral("ForegroundPositive")
<< QStringLiteral("DecorationFocus")
<< QStringLiteral("DecorationHover");
QStringList colorSetGroupList;
colorSetGroupList << "Colors:View"
<< "Colors:Window"
<< "Colors:Button"
<< "Colors:Selection"
<< "Colors:Tooltip"
<< "Colors:Complementary";
colorSetGroupList << QStringLiteral("Colors:View")
<< QStringLiteral("Colors:Window")
<< QStringLiteral("Colors:Button")
<< QStringLiteral("Colors:Selection")
<< QStringLiteral("Colors:Tooltip")
<< QStringLiteral("Colors:Complementary");
QList <KColorScheme> colorSchemes;
......@@ -519,12 +519,12 @@ void KColorCm::updateConfig(KSharedConfigPtr config)
KConfigGroup groupWMOut(m_config, "WM");
QStringList colorItemListWM;
colorItemListWM << "activeBackground"
<< "activeForeground"
<< "inactiveBackground"
<< "inactiveForeground"
<< "activeBlend"
<< "inactiveBlend";
colorItemListWM << QStringLiteral("activeBackground")
<< QStringLiteral("activeForeground")
<< QStringLiteral("inactiveBackground")
<< QStringLiteral("inactiveForeground")
<< QStringLiteral("activeBlend")
<< QStringLiteral("inactiveBlend");
QVector<QColor> defaultWMColors;
defaultWMColors << QColor(71,80,87)
......@@ -542,18 +542,18 @@ void KColorCm::updateConfig(KSharedConfigPtr config)
}
QStringList groupNameList;
groupNameList << "ColorEffects:Inactive" << "ColorEffects:Disabled";
groupNameList << QStringLiteral("ColorEffects:Inactive") << QStringLiteral("ColorEffects:Disabled");
QStringList effectList;
effectList << "Enable"
<< "ChangeSelectionColor"
<< "IntensityEffect"
<< "IntensityAmount"
<< "ColorEffect"
<< "ColorAmount"
<< "Color"
<< "ContrastEffect"
<< "ContrastAmount";
effectList << QStringLiteral("Enable")
<< QStringLiteral("ChangeSelectionColor")
<< QStringLiteral("IntensityEffect")
<< QStringLiteral("IntensityAmount")
<< QStringLiteral("ColorEffect")
<< QStringLiteral("ColorAmount")
<< QStringLiteral("Color")
<< QStringLiteral("ContrastEffect")
<< QStringLiteral("ContrastAmount");
for (const QString &groupName : groupNameList)
{
......
......@@ -103,7 +103,7 @@ void SchemeEditorDialog::on_schemeKnsUploadButton_clicked()
// find path
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"color-schemes/" + m_schemeName + ".colors");
QStringLiteral("color-schemes/") + m_schemeName + QStringLiteral(".colors"));
if (path.isEmpty() ) // if the color scheme file wasn't found
{
qDebug() << "path for color scheme " << m_schemeName << " couldn't be found";
......@@ -173,7 +173,7 @@ void SchemeEditorDialog::saveScheme()
}
QString filename = name;
filename.remove('\''); // So Foo's does not become FooS
filename.remove(QLatin1Char('\'')); // So Foo's does not become FooS
QRegExp fixer(QStringLiteral("[\\W,.-]+(.?)"));
int offset;
while ((offset = fixer.indexIn(filename)) >= 0)
......@@ -182,7 +182,7 @@ void SchemeEditorDialog::saveScheme()
// check if that name is already in the list
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"color-schemes/" + filename + ".colors");
QStringLiteral("color-schemes/") + filename + QStringLiteral(".colors"));
QFile file(path);
const int permissions = file.permissions();
......
......@@ -23,7 +23,7 @@
#include <QDebug>
#include <KConfigGroup>
SchemeEditorEffects::SchemeEditorEffects(KSharedConfigPtr config, QPalette::ColorGroup palette, QWidget *parent)
SchemeEditorEffects::SchemeEditorEffects(const KSharedConfigPtr &config, QPalette::ColorGroup palette, QWidget *parent)
: QWidget( parent )
, m_palette(palette)
, m_config(config)
......@@ -138,14 +138,14 @@ void SchemeEditorEffects::updateFromEffectsPage()
return;
}
QString groupName = "";
QString groupName<