Commit 734f3084 authored by Laurent Montel's avatar Laurent Montel
Browse files

Fix some clazy warnings

parent 111200bf
Pipeline #149759 passed with stage
in 11 minutes and 31 seconds
......@@ -3,6 +3,7 @@ plasma_install_package(package org.kde.plasma.systemtray)
set(systemtraycontainer_SRCS
systemtraycontainer.cpp
systemtraycontainer.h
)
ecm_qt_declare_logging_category(systemtraycontainer_SRCS HEADER debug.h
......
......@@ -17,7 +17,7 @@
#include <QDBusPendingReply>
#include <QDBusServiceWatcher>
DBusServiceObserver::DBusServiceObserver(QPointer<SystemTraySettings> settings, QObject *parent)
DBusServiceObserver::DBusServiceObserver(const QPointer<SystemTraySettings> &settings, QObject *parent)
: QObject(parent)
, m_settings(settings)
, m_sessionServiceWatcher(new QDBusServiceWatcher(this))
......@@ -64,7 +64,7 @@ void DBusServiceObserver::registerPlugin(const KPluginMetaData &pluginMetaData)
rx.setPatternSyntax(QRegExp::Wildcard);
m_dbusActivatableTasks[pluginMetaData.pluginId()] = rx;
const QString watchedService = QString(dbusactivation).replace(".*", "*");
const QString watchedService = QString(dbusactivation).replace(QLatin1String(".*"), QLatin1String("*"));
m_sessionServiceWatcher->addWatchedService(watchedService);
m_systemServiceWatcher->addWatchedService(watchedService);
}
......@@ -74,7 +74,7 @@ void DBusServiceObserver::unregisterPlugin(const QString &pluginId)
{
if (m_dbusActivatableTasks.contains(pluginId)) {
QRegExp rx = m_dbusActivatableTasks.take(pluginId);
const QString watchedService = rx.pattern().replace(".*", "*");
const QString watchedService = rx.pattern().replace(QLatin1String(".*"), QLatin1String("*"));
m_sessionServiceWatcher->removeWatchedService(watchedService);
m_systemServiceWatcher->removeWatchedService(watchedService);
}
......
......@@ -24,7 +24,7 @@ class DBusServiceObserver : public QObject
{
Q_OBJECT
public:
explicit DBusServiceObserver(QPointer<SystemTraySettings> settings, QObject *parent = nullptr);
explicit DBusServiceObserver(const QPointer<SystemTraySettings> &settings, QObject *parent = nullptr);
void registerPlugin(const KPluginMetaData &pluginMetaData);
void unregisterPlugin(const QString &pluginId);
......
......@@ -111,7 +111,7 @@ void PlasmoidRegistry::packageUninstalled(const QString &pluginId)
void PlasmoidRegistry::registerPlugin(const KPluginMetaData &pluginMetaData)
{
if (!pluginMetaData.isValid() || pluginMetaData.value(QStringLiteral("X-Plasma-NotificationArea")) != "true") {
if (!pluginMetaData.isValid() || pluginMetaData.value(QStringLiteral("X-Plasma-NotificationArea")) != QLatin1String("true")) {
return;
}
......
......@@ -88,7 +88,7 @@ static QString plasmoidCategoryForMetadata(const KPluginMetaData &metadata)
return category;
}
PlasmoidModel::PlasmoidModel(QPointer<SystemTraySettings> settings, QPointer<PlasmoidRegistry> plasmoidRegistry, QObject *parent)
PlasmoidModel::PlasmoidModel(const QPointer<SystemTraySettings> &settings, const QPointer<PlasmoidRegistry> &plasmoidRegistry, QObject *parent)
: BaseModel(settings, parent)
, m_plasmoidRegistry(plasmoidRegistry)
{
......@@ -97,7 +97,7 @@ PlasmoidModel::PlasmoidModel(QPointer<SystemTraySettings> settings, QPointer<Pla
const auto appletMetaDataList = m_plasmoidRegistry->systemTrayApplets();
for (const auto &info : appletMetaDataList) {
if (!info.isValid() || info.value(QStringLiteral("X-Plasma-NotificationArea")) != "true") {
if (!info.isValid() || info.value(QStringLiteral("X-Plasma-NotificationArea")) != QLatin1String("true")) {
continue;
}
appendRow(info);
......
......@@ -73,7 +73,7 @@ public:
HasApplet,
};
explicit PlasmoidModel(QPointer<SystemTraySettings> settings, QPointer<PlasmoidRegistry> plasmoidRegistry, QObject *parent = nullptr);
explicit PlasmoidModel(const QPointer<SystemTraySettings> &settings, const QPointer<PlasmoidRegistry> &plasmoidRegistry, QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
......
......@@ -40,12 +40,12 @@ SessionsModel::SessionsModel(QObject *parent)
bool SessionsModel::canSwitchUser() const
{
return const_cast<SessionsModel *>(this)->m_displayManager.isSwitchable() && KAuthorized::authorizeAction(QLatin1String("switch_user"));
return const_cast<SessionsModel *>(this)->m_displayManager.isSwitchable() && KAuthorized::authorizeAction(QStringLiteral("switch_user"));
}
bool SessionsModel::canStartNewSession() const
{
return const_cast<SessionsModel *>(this)->m_displayManager.numReserve() > 0 && KAuthorized::authorizeAction(QLatin1String("start_new_session"));
return const_cast<SessionsModel *>(this)->m_displayManager.numReserve() > 0 && KAuthorized::authorizeAction(QStringLiteral("start_new_session"));
}
bool SessionsModel::shouldLock() const
......
......@@ -200,7 +200,7 @@ void DefaultItemFilterProxyModel::setFilter(const Filter &filter)
Q_EMIT filterChanged();
}
void DefaultItemFilterProxyModel::setFilterType(const QString type)
void DefaultItemFilterProxyModel::setFilterType(const QString &type)
{
m_filter.first = type;
invalidateFilter();
......@@ -212,7 +212,7 @@ QString DefaultItemFilterProxyModel::filterType() const
return m_filter.first;
}
void DefaultItemFilterProxyModel::setFilterQuery(const QVariant query)
void DefaultItemFilterProxyModel::setFilterQuery(const QVariant &query)
{
m_filter.second = query;
invalidateFilter();
......
......@@ -130,10 +130,10 @@ public:
void setSearchTerm(const QString &pattern);
QString searchTerm() const;
void setFilterType(const QString type);
void setFilterType(const QString &type);
QString filterType() const;
void setFilterQuery(const QVariant query);
void setFilterQuery(const QVariant &query);
QVariant filterQuery() const;
void setFilter(const Filter &filter);
......
......@@ -24,9 +24,8 @@ namespace Plasma
OpenWidgetAssistant::OpenWidgetAssistant(QWidget *parent)
: KAssistantDialog(parent)
, m_fileWidget(nullptr)
, m_filePageWidget(nullptr)
, m_filePageWidget(new QWidget(this))
{
m_filePageWidget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(m_filePageWidget);
m_fileWidget = new KFileWidget(QUrl(), m_filePageWidget);
......@@ -37,8 +36,7 @@ OpenWidgetAssistant::OpenWidgetAssistant(QWidget *parent)
layout->addWidget(m_fileWidget);
m_fileWidget->setFilter(QString());
QStringList mimes;
mimes << QStringLiteral("application/x-plasma");
const QStringList mimes{QStringLiteral("application/x-plasma")};
m_fileWidget->setMimeFilter(mimes);
m_filePage = new KPageWidgetItem(m_filePageWidget, i18n("Select Plasmoid File"));
......@@ -55,7 +53,7 @@ void OpenWidgetAssistant::slotHelpClicked()
void OpenWidgetAssistant::finished()
{
m_fileWidget->accept(); // how interesting .. accept() must be called before the state is set
QString packageFilePath = m_fileWidget->selectedFile();
const QString packageFilePath = m_fileWidget->selectedFile();
if (packageFilePath.isEmpty()) {
// TODO: user visible error handling
qDebug() << "hm. no file path?";
......
......@@ -133,7 +133,7 @@ bool PlasmaAppletItem::matches(const QString &pattern) const
keywords << &name << m_info.value(QStringLiteral("Keywords"), QString()).splitRef(QLatin1Char(';'), Qt::SkipEmptyParts);
}
for (const auto &keyword : keywords) {
for (const auto &keyword : std::as_const(keywords)) {
if (keyword.startsWith(pattern, Qt::CaseInsensitive)) {
return true;
}
......
......@@ -132,7 +132,7 @@ void WidgetExplorerPrivate::initFilters()
if (!plugin.isValid()) {
continue;
}
if (plugin.rawData().value("NoDisplay").toBool() || plugin.category() == QLatin1String("Containments") || plugin.category().isEmpty()) {
if (plugin.rawData().value(QStringLiteral("NoDisplay")).toBool() || plugin.category() == QLatin1String("Containments") || plugin.category().isEmpty()) {
// we don't want to show the hidden category
continue;
}
......@@ -453,7 +453,7 @@ void WidgetExplorer::immutabilityChanged(Plasma::Types::ImmutabilityType type)
void WidgetExplorer::downloadWidgets()
{
if (!d->newStuffDialog) {
d->newStuffDialog = new KNS3::QtQuickDialogWrapper(QLatin1String("plasmoids.knsrc"));
d->newStuffDialog = new KNS3::QtQuickDialogWrapper(QStringLiteral("plasmoids.knsrc"));
}
d->newStuffDialog->open();
......
......@@ -34,7 +34,7 @@ QList<QAction *> AppLauncher::contextualActions()
return m_actions;
}
void AppLauncher::makeMenu(QMenu *menu, const KServiceGroup::Ptr group)
void AppLauncher::makeMenu(QMenu *menu, const KServiceGroup::Ptr &group)
{
const auto entries = group->entries(true, true, true);
for (const KSycocaEntry::Ptr &p : entries) {
......
......@@ -35,7 +35,7 @@ public:
void save(KConfigGroup &config) override;
protected:
void makeMenu(QMenu *menu, const KServiceGroup::Ptr group);
void makeMenu(QMenu *menu, const KServiceGroup::Ptr &group);
private:
KServiceGroup::Ptr m_group;
......
......@@ -29,14 +29,6 @@
ContextMenu::ContextMenu(QObject *parent, const QVariantList &args)
: Plasma::ContainmentActions(parent, args)
, m_runCommandAction(nullptr)
, m_lockScreenAction(nullptr)
, m_logoutAction(nullptr)
, m_configureDisplaysAction(nullptr)
, m_separator1(nullptr)
, m_separator2(nullptr)
, m_separator3(nullptr)
, m_buttons(nullptr)
, m_session(new SessionManagement(this))
{
}
......
......@@ -33,17 +33,17 @@ public Q_SLOTS:
void configureDisplays();
private:
QAction *m_runCommandAction;
QAction *m_lockScreenAction;
QAction *m_logoutAction;
QAction *m_configureDisplaysAction;
QAction *m_separator1;
QAction *m_separator2;
QAction *m_separator3;
QAction *m_runCommandAction = nullptr;
QAction *m_lockScreenAction = nullptr;
QAction *m_logoutAction = nullptr;
QAction *m_configureDisplaysAction = nullptr;
QAction *m_separator1 = nullptr;
QAction *m_separator2 = nullptr;
QAction *m_separator3 = nullptr;
// action name and whether it is enabled or not
QHash<QString, bool> m_actions;
QStringList m_actionOrder;
QButtonGroup *m_buttons;
SessionManagement *m_session;
QButtonGroup *m_buttons = nullptr;
SessionManagement *const m_session;
};
......@@ -18,8 +18,8 @@
Paste::Paste(QObject *parent, const QVariantList &args)
: Plasma::ContainmentActions(parent, args)
, m_action(new QAction(this))
{
m_action = new QAction(this);
QObject::connect(m_action, &QAction::triggered, this, &Paste::doPaste);
}
......
......@@ -22,5 +22,5 @@ private Q_SLOTS:
void doPaste();
private:
QAction *m_action;
QAction *const m_action;
};
......@@ -33,5 +33,5 @@ private Q_SLOTS:
private:
QHash<int, QAction *> m_actions;
TaskManager::VirtualDesktopInfo *m_virtualDesktopInfo;
TaskManager::VirtualDesktopInfo *const m_virtualDesktopInfo;
};
......@@ -23,7 +23,7 @@ class SwitchWindow : public Plasma::ContainmentActions
{
Q_OBJECT
public:
SwitchWindow(QObject *parent, const QVariantList &args);
explicit SwitchWindow(QObject *parent, const QVariantList &args);
~SwitchWindow() override;
void restore(const KConfigGroup &config) override;
......@@ -53,7 +53,7 @@ private:
Ui::Config m_ui;
MenuMode m_mode;
TaskManager::VirtualDesktopInfo *m_virtualDesktopInfo;
TaskManager::VirtualDesktopInfo *const m_virtualDesktopInfo;
static TaskManager::ActivityInfo *s_activityInfo;
static TaskManager::TasksModel *s_tasksModel;
......
Supports Markdown
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