diff --git a/applets/systemtray/container/CMakeLists.txt b/applets/systemtray/container/CMakeLists.txt index 1adf18638..8fea13eca 100644 --- a/applets/systemtray/container/CMakeLists.txt +++ b/applets/systemtray/container/CMakeLists.txt @@ -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 diff --git a/applets/systemtray/dbusserviceobserver.cpp b/applets/systemtray/dbusserviceobserver.cpp index 3ae2ad5a8..24707b462 100644 --- a/applets/systemtray/dbusserviceobserver.cpp +++ b/applets/systemtray/dbusserviceobserver.cpp @@ -17,7 +17,7 @@ #include #include -DBusServiceObserver::DBusServiceObserver(QPointer settings, QObject *parent) +DBusServiceObserver::DBusServiceObserver(const QPointer &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); } diff --git a/applets/systemtray/dbusserviceobserver.h b/applets/systemtray/dbusserviceobserver.h index cbe404154..de0079a1b 100644 --- a/applets/systemtray/dbusserviceobserver.h +++ b/applets/systemtray/dbusserviceobserver.h @@ -24,7 +24,7 @@ class DBusServiceObserver : public QObject { Q_OBJECT public: - explicit DBusServiceObserver(QPointer settings, QObject *parent = nullptr); + explicit DBusServiceObserver(const QPointer &settings, QObject *parent = nullptr); void registerPlugin(const KPluginMetaData &pluginMetaData); void unregisterPlugin(const QString &pluginId); diff --git a/applets/systemtray/plasmoidregistry.cpp b/applets/systemtray/plasmoidregistry.cpp index b509d7ca6..cd23b9c63 100644 --- a/applets/systemtray/plasmoidregistry.cpp +++ b/applets/systemtray/plasmoidregistry.cpp @@ -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; } diff --git a/applets/systemtray/systemtraymodel.cpp b/applets/systemtray/systemtraymodel.cpp index 4869f5357..cbfde5205 100644 --- a/applets/systemtray/systemtraymodel.cpp +++ b/applets/systemtray/systemtraymodel.cpp @@ -88,7 +88,7 @@ static QString plasmoidCategoryForMetadata(const KPluginMetaData &metadata) return category; } -PlasmoidModel::PlasmoidModel(QPointer settings, QPointer plasmoidRegistry, QObject *parent) +PlasmoidModel::PlasmoidModel(const QPointer &settings, const QPointer &plasmoidRegistry, QObject *parent) : BaseModel(settings, parent) , m_plasmoidRegistry(plasmoidRegistry) { @@ -97,7 +97,7 @@ PlasmoidModel::PlasmoidModel(QPointer settings, QPointersystemTrayApplets(); 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); diff --git a/applets/systemtray/systemtraymodel.h b/applets/systemtray/systemtraymodel.h index a3054a4af..1722e43df 100644 --- a/applets/systemtray/systemtraymodel.h +++ b/applets/systemtray/systemtraymodel.h @@ -73,7 +73,7 @@ public: HasApplet, }; - explicit PlasmoidModel(QPointer settings, QPointer plasmoidRegistry, QObject *parent = nullptr); + explicit PlasmoidModel(const QPointer &settings, const QPointer &plasmoidRegistry, QObject *parent = nullptr); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; diff --git a/components/sessionsprivate/sessionsmodel.cpp b/components/sessionsprivate/sessionsmodel.cpp index 4a221cec5..2143b0e80 100644 --- a/components/sessionsprivate/sessionsmodel.cpp +++ b/components/sessionsprivate/sessionsmodel.cpp @@ -40,12 +40,12 @@ SessionsModel::SessionsModel(QObject *parent) bool SessionsModel::canSwitchUser() const { - return const_cast(this)->m_displayManager.isSwitchable() && KAuthorized::authorizeAction(QLatin1String("switch_user")); + return const_cast(this)->m_displayManager.isSwitchable() && KAuthorized::authorizeAction(QStringLiteral("switch_user")); } bool SessionsModel::canStartNewSession() const { - return const_cast(this)->m_displayManager.numReserve() > 0 && KAuthorized::authorizeAction(QLatin1String("start_new_session")); + return const_cast(this)->m_displayManager.numReserve() > 0 && KAuthorized::authorizeAction(QStringLiteral("start_new_session")); } bool SessionsModel::shouldLock() const diff --git a/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels.cpp b/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels.cpp index 0ec4109ce..a8797204b 100644 --- a/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels.cpp +++ b/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels.cpp @@ -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(); diff --git a/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels_p.h b/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels_p.h index ff922caf6..55c70873d 100644 --- a/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels_p.h +++ b/components/shellprivate/widgetexplorer/kcategorizeditemsviewmodels_p.h @@ -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); diff --git a/components/shellprivate/widgetexplorer/openwidgetassistant.cpp b/components/shellprivate/widgetexplorer/openwidgetassistant.cpp index 7534dded9..422938208 100644 --- a/components/shellprivate/widgetexplorer/openwidgetassistant.cpp +++ b/components/shellprivate/widgetexplorer/openwidgetassistant.cpp @@ -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?"; diff --git a/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp b/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp index 73baa8b79..ca3a83650 100644 --- a/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp +++ b/components/shellprivate/widgetexplorer/plasmaappletitemmodel.cpp @@ -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; } diff --git a/components/shellprivate/widgetexplorer/widgetexplorer.cpp b/components/shellprivate/widgetexplorer/widgetexplorer.cpp index 6c1485bfd..1d481b8f8 100644 --- a/components/shellprivate/widgetexplorer/widgetexplorer.cpp +++ b/components/shellprivate/widgetexplorer/widgetexplorer.cpp @@ -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(); diff --git a/containmentactions/applauncher/launch.cpp b/containmentactions/applauncher/launch.cpp index 88880351a..43f1cd477 100644 --- a/containmentactions/applauncher/launch.cpp +++ b/containmentactions/applauncher/launch.cpp @@ -34,7 +34,7 @@ QList 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) { diff --git a/containmentactions/applauncher/launch.h b/containmentactions/applauncher/launch.h index c1e505f71..8c70ac14f 100644 --- a/containmentactions/applauncher/launch.h +++ b/containmentactions/applauncher/launch.h @@ -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; diff --git a/containmentactions/contextmenu/menu.cpp b/containmentactions/contextmenu/menu.cpp index 6af47b99e..1207dd2b3 100644 --- a/containmentactions/contextmenu/menu.cpp +++ b/containmentactions/contextmenu/menu.cpp @@ -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)) { } diff --git a/containmentactions/contextmenu/menu.h b/containmentactions/contextmenu/menu.h index 7296b458f..2e89ef2bc 100644 --- a/containmentactions/contextmenu/menu.h +++ b/containmentactions/contextmenu/menu.h @@ -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 m_actions; QStringList m_actionOrder; - QButtonGroup *m_buttons; - SessionManagement *m_session; + QButtonGroup *m_buttons = nullptr; + SessionManagement *const m_session; }; diff --git a/containmentactions/paste/paste.cpp b/containmentactions/paste/paste.cpp index 16f5ecc3e..71f22a5d3 100644 --- a/containmentactions/paste/paste.cpp +++ b/containmentactions/paste/paste.cpp @@ -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); } diff --git a/containmentactions/paste/paste.h b/containmentactions/paste/paste.h index 53a23bf94..7f8d99af8 100644 --- a/containmentactions/paste/paste.h +++ b/containmentactions/paste/paste.h @@ -22,5 +22,5 @@ private Q_SLOTS: void doPaste(); private: - QAction *m_action; + QAction *const m_action; }; diff --git a/containmentactions/switchdesktop/desktop.h b/containmentactions/switchdesktop/desktop.h index c97956b86..17cc34ed8 100644 --- a/containmentactions/switchdesktop/desktop.h +++ b/containmentactions/switchdesktop/desktop.h @@ -33,5 +33,5 @@ private Q_SLOTS: private: QHash m_actions; - TaskManager::VirtualDesktopInfo *m_virtualDesktopInfo; + TaskManager::VirtualDesktopInfo *const m_virtualDesktopInfo; }; diff --git a/containmentactions/switchwindow/switch.h b/containmentactions/switchwindow/switch.h index fa41cc49d..17cf1eca3 100644 --- a/containmentactions/switchwindow/switch.h +++ b/containmentactions/switchwindow/switch.h @@ -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; diff --git a/dataengines/devicenotifications/devicenotificationsengine.h b/dataengines/devicenotifications/devicenotificationsengine.h index dee5f8296..4f7a048c4 100644 --- a/dataengines/devicenotifications/devicenotificationsengine.h +++ b/dataengines/devicenotifications/devicenotificationsengine.h @@ -27,5 +27,5 @@ private Q_SLOTS: void clearNotification(const QString &udi); private: - KSolidNotify *m_solidNotify; + KSolidNotify *const m_solidNotify; }; diff --git a/kcms/colors/colorsapplicator.cpp b/kcms/colors/colorsapplicator.cpp index db4730694..79ea76e08 100644 --- a/kcms/colors/colorsapplicator.cpp +++ b/kcms/colors/colorsapplicator.cpp @@ -68,7 +68,7 @@ void applyScheme(const QString &colorSchemePath, KConfig *configOutput, KConfig: QStringLiteral("DecorationFocus"), QStringLiteral("DecorationHover")}; - for (auto item : colorSetGroupList) { + for (const auto &item : colorSetGroupList) { configOutput->deleteGroup(item); // Not all color schemes have header colors; in this case we don't want diff --git a/kcms/desktoptheme/kcm.cpp b/kcms/desktoptheme/kcm.cpp index 8d2f3daf6..63e4e0f7a 100644 --- a/kcms/desktoptheme/kcm.cpp +++ b/kcms/desktoptheme/kcm.cpp @@ -44,8 +44,12 @@ KCMDesktopTheme::KCMDesktopTheme(QObject *parent, const KPluginMetaData &data, c , m_haveThemeExplorerInstalled(false) { qmlRegisterAnonymousType("org.kde.private.kcms.desktoptheme", 1); - qmlRegisterUncreatableType("org.kde.private.kcms.desktoptheme", 1, 0, "ThemesModel", "Cannot create ThemesModel"); - qmlRegisterUncreatableType("org.kde.private.kcms.desktoptheme", 1, 0, "FilterProxyModel", "Cannot create FilterProxyModel"); + qmlRegisterUncreatableType("org.kde.private.kcms.desktoptheme", 1, 0, "ThemesModel", QStringLiteral("Cannot create ThemesModel")); + qmlRegisterUncreatableType("org.kde.private.kcms.desktoptheme", + 1, + 0, + "FilterProxyModel", + QStringLiteral("Cannot create FilterProxyModel")); setButtons(Apply | Default | Help); diff --git a/kcms/desktoptheme/themesmodel.cpp b/kcms/desktoptheme/themesmodel.cpp index 6f0ecf4e3..e4d946257 100644 --- a/kcms/desktoptheme/themesmodel.cpp +++ b/kcms/desktoptheme/themesmodel.cpp @@ -184,7 +184,7 @@ void ThemesModel::load() }); if (!hasPluginName) { // Plasma Theme creates a KColorScheme out of the "color" file and falls back to system colors if there is none - const QString colorsPath = themeRoot + QLatin1String("/colors"); + const QString colorsPath = themeRoot + QStringLiteral("/colors"); const bool followsSystemColors = !QFileInfo::exists(colorsPath); ColorType type = FollowsColorTheme; if (!followsSystemColors) { diff --git a/kcms/nightcolor/kcm.h b/kcms/nightcolor/kcm.h index 817c863a3..0e5d5f939 100644 --- a/kcms/nightcolor/kcm.h +++ b/kcms/nightcolor/kcm.h @@ -25,7 +25,7 @@ public: NightColorSettings *nightColorSettings() const; private: - NightColorData *m_data; + NightColorData *const m_data; }; } diff --git a/kcms/notifications/kcm.h b/kcms/notifications/kcm.h index 9009c3c81..f4ef936f9 100644 --- a/kcms/notifications/kcm.h +++ b/kcms/notifications/kcm.h @@ -100,10 +100,10 @@ private: bool isDefaults() const override; void createConnections(NotificationManager::BehaviorSettings *settings, const QModelIndex &index); - SourcesModel *m_sourcesModel; - FilterProxyModel *m_filteredModel; + SourcesModel *const m_sourcesModel; + FilterProxyModel *const m_filteredModel; - NotificationsData *m_data; + NotificationsData *const m_data; QAction *m_toggleDoNotDisturbAction; QKeySequence m_toggleDoNotDisturbShortcut; diff --git a/kcms/style/gtkpage.cpp b/kcms/style/gtkpage.cpp index 10c02fa22..134cc39e3 100644 --- a/kcms/style/gtkpage.cpp +++ b/kcms/style/gtkpage.cpp @@ -71,7 +71,7 @@ void GtkPage::installGtkThemeFromFile(const QUrl &fileUrl) const KArchiveDirectory *themeDirectory = static_cast(possibleThemeDirectory); QStringList archiveSubitems = themeDirectory->entries(); - if (!archiveSubitems.contains(QStringLiteral("gtk-2.0")) && archiveSubitems.indexOf(QRegularExpression("gtk-3.*")) == -1) { + if (!archiveSubitems.contains(QStringLiteral("gtk-2.0")) && archiveSubitems.indexOf(QRegularExpression(QStringLiteral("gtk-3.*"))) == -1) { showError(); return; } diff --git a/shell/tests/screenpooltest.cpp b/shell/tests/screenpooltest.cpp index f6c541cec..c76dcf356 100644 --- a/shell/tests/screenpooltest.cpp +++ b/shell/tests/screenpooltest.cpp @@ -70,7 +70,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QApplication app(argc, argv); - ScreenPoolTester screenPoolTester(); + ScreenPoolTester screenPoolTester; return app.exec(); }