Tweak formatting after running clang-format

NO_CHANGELOG
This commit is contained in:
Ahmad Samir 2021-03-05 21:07:46 +02:00
parent e7e839e82b
commit 2ff586d513
27 changed files with 188 additions and 94 deletions

View File

@ -7,12 +7,14 @@
#include "coronatest.h" #include "coronatest.h"
#include <KActionCollection> #include <KActionCollection>
#include <KSycoca> #include <KSycoca>
#include <QAction> #include <QAction>
#include <QApplication> #include <QApplication>
#include <QProcess> #include <QProcess>
#include <QRandomGenerator> #include <QRandomGenerator>
#include <QSignalSpy> #include <QSignalSpy>
#include <QStandardPaths> #include <QStandardPaths>
Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint appletId, const QVariantList &args) Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint appletId, const QVariantList &args)
{ {
Q_UNUSED(args) Q_UNUSED(args)

View File

@ -161,13 +161,16 @@ class DataModel : public QAbstractItemModel
Q_PROPERTY(QObject *dataSource READ dataSource WRITE setDataSource) Q_PROPERTY(QObject *dataSource READ dataSource WRITE setDataSource)
/** /**
* It's a regular expression. Only data with keys that match this filter expression will be inserted in the model * It's a regular expression. Only data with keys that match this filter
* expression will be inserted in the model
*/ */
Q_PROPERTY(QString keyRoleFilter READ keyRoleFilter WRITE setKeyRoleFilter) Q_PROPERTY(QString keyRoleFilter READ keyRoleFilter WRITE setKeyRoleFilter)
/** /**
* it's a regular expression. If the DataSource is connected to more than one source, only inserts data from sources matching this filter expression in the * It's a regular expression. If the DataSource is connected to more than one source,
* model. If we want to have a source watch all sources beginning with say "name:", the required regexp would be sourceFilter: "name:.*" * only inserts data from sources matching this filter expression in the model. If we
* want to have a source watch all sources beginning with say "name:", the required
* regexp would be sourceFilter: "name:.*"
*/ */
Q_PROPERTY(QString sourceFilter READ sourceFilter WRITE setSourceFilter) Q_PROPERTY(QString sourceFilter READ sourceFilter WRITE setSourceFilter)

View File

@ -523,13 +523,16 @@ void FrameSvgItem::doUpdate()
} }
QString prefix = m_frameSvg->actualPrefix(); QString prefix = m_frameSvg->actualPrefix();
bool hasOverlay = !prefix.startsWith(QLatin1String("mask-")) && m_frameSvg->hasElement(prefix % QLatin1String("overlay")); bool hasOverlay = (!prefix.startsWith(QLatin1String("mask-")) //
&& m_frameSvg->hasElement(prefix % QLatin1String("overlay")));
bool hasComposeOverBorder = m_frameSvg->hasElement(prefix % QLatin1String("hint-compose-over-border")) bool hasComposeOverBorder = m_frameSvg->hasElement(prefix % QLatin1String("hint-compose-over-border"))
&& m_frameSvg->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center")); && m_frameSvg->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center"));
m_fastPath = !hasOverlay && !hasComposeOverBorder; m_fastPath = !hasOverlay && !hasComposeOverBorder;
// software rendering (at time of writing Qt5.10) doesn't seem to like our tiling/stretching in the 9-tiles. // Software rendering (at time of writing Qt5.10) doesn't seem to like our
// also when using QPainter it's arguably faster to create and cache pixmaps of the whole frame, which is what the slow path does // tiling/stretching in the 9-tiles.
// Also when using QPainter it's arguably faster to create and cache pixmaps
// of the whole frame, which is what the slow path does
if (QQuickWindow::sceneGraphBackend() == QLatin1String("software")) { if (QQuickWindow::sceneGraphBackend() == QLatin1String("software")) {
m_fastPath = false; m_fastPath = false;
} }
@ -548,7 +551,9 @@ Plasma::FrameSvg *FrameSvgItem::frameSvg() const
QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *)
{ {
if (!window() || !m_frameSvg || (!m_frameSvg->hasElementPrefix(m_frameSvg->actualPrefix()) && !m_frameSvg->hasElementPrefix(m_frameSvg->prefix()))) { if (!window() || !m_frameSvg //
|| (!m_frameSvg->hasElementPrefix(m_frameSvg->actualPrefix()) //
&& !m_frameSvg->hasElementPrefix(m_frameSvg->prefix()))) {
delete oldNode; delete oldNode;
return nullptr; return nullptr;
} }
@ -565,10 +570,10 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
QString prefix = m_frameSvg->actualPrefix(); QString prefix = m_frameSvg->actualPrefix();
oldNode = new FrameNode(prefix, m_frameSvg); oldNode = new FrameNode(prefix, m_frameSvg);
bool tileCenter = bool tileCenter = (m_frameSvg->hasElement(QStringLiteral("hint-tile-center")) //
(m_frameSvg->hasElement(QStringLiteral("hint-tile-center")) || m_frameSvg->hasElement(prefix % QLatin1String("hint-tile-center"))); || m_frameSvg->hasElement(prefix % QLatin1String("hint-tile-center")));
bool stretchBorders = bool stretchBorders = (m_frameSvg->hasElement(QStringLiteral("hint-stretch-borders")) //
(m_frameSvg->hasElement(QStringLiteral("hint-stretch-borders")) || m_frameSvg->hasElement(prefix % QLatin1String("hint-stretch-borders"))); || m_frameSvg->hasElement(prefix % QLatin1String("hint-stretch-borders")));
FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile; FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile;
FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile : FrameItemNode::Stretch; FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile : FrameItemNode::Stretch;

View File

@ -355,7 +355,9 @@ void IconItem::setSource(const QVariant &source)
} }
if (!localFile.isEmpty()) { if (!localFile.isEmpty()) {
if (sourceString.endsWith(QLatin1String(".svg")) || sourceString.endsWith(QLatin1String(".svgz")) || sourceString.endsWith(QLatin1String(".ico"))) { if (sourceString.endsWith(QLatin1String(".svg")) //
|| sourceString.endsWith(QLatin1String(".svgz")) //
|| sourceString.endsWith(QLatin1String(".ico"))) {
QIcon icon = QIcon(localFile); QIcon icon = QIcon(localFile);
m_iconItemSource.reset(new QIconSource(icon, this)); m_iconItemSource.reset(new QIconSource(icon, this));
} else { } else {

View File

@ -106,9 +106,10 @@ class ToolTip : public QQuickItem
Q_PROPERTY(bool active MEMBER m_active WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool active MEMBER m_active WRITE setActive NOTIFY activeChanged)
/** /**
* if interactive is false (default), the tooltip will automatically hide * If interactive is false (default), the tooltip will automatically hide
* itself as soon as the mouse leaves the tooltiparea, if is true, if the mouse leaves tooltiparea and goes over the tooltip itself, the tooltip won't hide, * itself as soon as the mouse leaves the tooltiparea, if is true, if the
* so it will be possible to interact with tooltip contents * mouse leaves tooltiparea and goes over the tooltip itself, the tooltip
* won't hide, so it will be possible to interact with tooltip contents.
*/ */
Q_PROPERTY(bool interactive MEMBER m_interactive WRITE setInteractive NOTIFY interactiveChanged) Q_PROPERTY(bool interactive MEMBER m_interactive WRITE setInteractive NOTIFY interactiveChanged)

View File

@ -455,8 +455,9 @@ void WindowThumbnail::resolveEGLFunctions()
} }
auto *context = window()->openglContext(); auto *context = window()->openglContext();
QList<QByteArray> extensions = QByteArray(eglQueryString(display, EGL_EXTENSIONS)).split(' '); QList<QByteArray> extensions = QByteArray(eglQueryString(display, EGL_EXTENSIONS)).split(' ');
if (extensions.contains(QByteArrayLiteral("EGL_KHR_image")) if (extensions.contains(QByteArrayLiteral("EGL_KHR_image")) //
|| (extensions.contains(QByteArrayLiteral("EGL_KHR_image_base")) && extensions.contains(QByteArrayLiteral("EGL_KHR_image_pixmap")))) { || (extensions.contains(QByteArrayLiteral("EGL_KHR_image_base")) //
&& extensions.contains(QByteArrayLiteral("EGL_KHR_image_pixmap")))) {
if (context->hasExtension(QByteArrayLiteral("GL_OES_EGL_image"))) { if (context->hasExtension(QByteArrayLiteral("GL_OES_EGL_image"))) {
qDebug() << "Have EGL texture from pixmap"; qDebug() << "Have EGL texture from pixmap";
m_eglCreateImageKHR = context->getProcAddress(QByteArrayLiteral("eglCreateImageKHR")); m_eglCreateImageKHR = context->getProcAddress(QByteArrayLiteral("eglCreateImageKHR"));
@ -793,7 +794,16 @@ bool WindowThumbnail::loadGLXTexture()
glGenTextures(1, &m_texture); glGenTextures(1, &m_texture);
const int attrs[] = {GLX_TEXTURE_FORMAT_EXT, info->textureFormat, GLX_MIPMAP_TEXTURE_EXT, false, GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, XCB_NONE}; /* clang-format off */
const int attrs[] = {
GLX_TEXTURE_FORMAT_EXT,
info->textureFormat,
GLX_MIPMAP_TEXTURE_EXT,
false,
GLX_TEXTURE_TARGET_EXT,
GLX_TEXTURE_2D_EXT,
XCB_NONE};
/* clang-format on */
m_glxPixmap = glXCreatePixmap(QX11Info::display(), info->fbConfig, m_pixmap, attrs); m_glxPixmap = glXCreatePixmap(QX11Info::display(), info->fbConfig, m_pixmap, attrs);

View File

@ -61,13 +61,15 @@ class QMenuProxy : public QObject
Q_CLASSINFO("DefaultProperty", "content") Q_CLASSINFO("DefaultProperty", "content")
/** /**
* This is a hint to the window manager that this window is a dialog or pop-up on behalf of the given window. * This is a hint to the window manager that this window is a dialog or pop-up on
* behalf of the given window.
*/ */
Q_PROPERTY(QWindow *transientParent READ transientParent WRITE setTransientParent NOTIFY transientParentChanged) Q_PROPERTY(QWindow *transientParent READ transientParent WRITE setTransientParent NOTIFY transientParentChanged)
/** /**
* the visualParent is used to position the menu. it can be an item on the scene, like a button (that will open the menu on clicked) or another menuitem (in * The visualParent is used to position the menu. it can be an item on the
* this case this will be a submenu) * scene, like a button (that will open the menu on clicked) or another menuitem
* (in this case this will be a submenu).
*/ */
Q_PROPERTY(QObject *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged()) Q_PROPERTY(QObject *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged())
Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged) Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged)

View File

@ -28,10 +28,12 @@ public:
T *operator->() const; T *operator->() const;
}; };
/* clang-format off */
#define D_PTR \ #define D_PTR \
class Private; \ class Private; \
friend class Private; \ friend class Private; \
const ::utils::d_ptr<Private> d const ::utils::d_ptr<Private> d
/* clang-format on */
} // namespace utils } // namespace utils

View File

@ -12,10 +12,8 @@
#include "config-plasma.h" #include "config-plasma.h"
#include <cmath>
#include <limits>
#include <QAbstractButton> #include <QAbstractButton>
#include <QDebug>
#include <QFile> #include <QFile>
#include <QList> #include <QList>
#include <QMessageBox> #include <QMessageBox>
@ -30,7 +28,6 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <KService> #include <KService>
#include <KWindowSystem> #include <KWindowSystem>
#include <QDebug>
#include "containment.h" #include "containment.h"
#include "corona.h" #include "corona.h"
@ -44,6 +41,9 @@
#include "private/containment_p.h" #include "private/containment_p.h"
#include "private/package_p.h" #include "private/package_p.h"
#include <cmath>
#include <limits>
namespace Plasma namespace Plasma
{ {
static KPluginMetaData appletMetadataForDirectory(const QString &path) static KPluginMetaData appletMetadataForDirectory(const QString &path)

View File

@ -787,6 +787,7 @@ private:
/** /**
* Register an applet when it is contained in a loadable module * Register an applet when it is contained in a loadable module
*/ */
/* clang-format off */
#define K_EXPORT_PLASMA_APPLET(libname, classname) \ #define K_EXPORT_PLASMA_APPLET(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \ K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
@ -794,5 +795,6 @@ private:
#define K_EXPORT_PLASMA_APPLET_WITH_JSON(libname, classname, jsonFile) \ #define K_EXPORT_PLASMA_APPLET_WITH_JSON(libname, classname, jsonFile) \
K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \ K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
/* clang-format on */
#endif // multiple inclusion guard #endif // multiple inclusion guard

View File

@ -11,12 +11,12 @@
#include "private/containmentactions_p.h" #include "private/containmentactions_p.h"
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QDebug>
#include <QMetaEnum> #include <QMetaEnum>
#include <QMouseEvent> #include <QMouseEvent>
#include <QWheelEvent> #include <QWheelEvent>
#include <KLocalizedString> #include <KLocalizedString>
#include <QDebug>
#include "version.h" #include "version.h"

View File

@ -153,9 +153,10 @@ private:
/** /**
* Register a containmentactions when it is contained in a loadable module * Register a containmentactions when it is contained in a loadable module
*/ */
/* clang-format off */
#define K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(libname, classname, jsonFile) \ #define K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(libname, classname, jsonFile) \
K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \ K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
/* clang-format on */
#endif // PLASMA_CONTAINMENTACTIONS_H #endif // PLASMA_CONTAINMENTACTIONS_H

View File

@ -10,17 +10,17 @@
#include "corona.h" #include "corona.h"
#include "private/corona_p.h" #include "private/corona_p.h"
#include <QDebug>
#include <QGuiApplication> #include <QGuiApplication>
#include <QMimeData> #include <QMimeData>
#include <QPainter> #include <QPainter>
#include <QScreen> #include <QScreen>
#include <QTimer> #include <QTimer>
#include <cmath>
#include <KLocalizedString> #include <KLocalizedString>
#include <KWindowSystem> #include <KWindowSystem>
#include <QDebug>
#include <cmath>
#include "containment.h" #include "containment.h"
#include "debug_p.h" #include "debug_p.h"
@ -180,8 +180,9 @@ QList<Plasma::Containment *> Corona::importLayout(const KConfigGroup &conf)
Containment *Corona::containmentForScreen(int screen) const Containment *Corona::containmentForScreen(int screen) const
{ {
for (Containment *containment : qAsConst(d->containments)) { for (Containment *containment : qAsConst(d->containments)) {
if (containment->screen() == screen if (containment->screen() == screen //
&& (containment->containmentType() == Plasma::Types::DesktopContainment || containment->containmentType() == Plasma::Types::CustomContainment)) { && (containment->containmentType() == Plasma::Types::DesktopContainment //
|| containment->containmentType() == Plasma::Types::CustomContainment)) {
return containment; return containment;
} }
} }
@ -199,8 +200,11 @@ Containment *Corona::containmentForScreen(int screen, const QString &activity, c
Containment *containment = nullptr; Containment *containment = nullptr;
for (Containment *cont : qAsConst(d->containments)) { for (Containment *cont : qAsConst(d->containments)) {
if (cont->lastScreen() == screen && (cont->activity().isEmpty() || cont->activity() == activity) /* clang-format off */
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment)) { if (cont->lastScreen() == screen
&& (cont->activity().isEmpty() || cont->activity() == activity)
&& (cont->containmentType() == Plasma::Types::DesktopContainment
|| cont->containmentType() == Plasma::Types::CustomContainment)) { /* clang-format on */
containment = cont; containment = cont;
} }
} }
@ -231,8 +235,9 @@ QList<Containment *> Corona::containmentsForActivity(const QString &activity)
} }
std::copy_if(d->containments.begin(), d->containments.end(), std::back_inserter(conts), [activity](Containment *cont) { std::copy_if(d->containments.begin(), d->containments.end(), std::back_inserter(conts), [activity](Containment *cont) {
return cont->activity() == activity return cont->activity() == activity //
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment); && (cont->containmentType() == Plasma::Types::DesktopContainment //
|| cont->containmentType() == Plasma::Types::CustomContainment);
}); });
return conts; return conts;
@ -247,8 +252,9 @@ QList<Containment *> Corona::containmentsForScreen(int screen)
} }
std::copy_if(d->containments.begin(), d->containments.end(), std::back_inserter(conts), [screen](Containment *cont) { std::copy_if(d->containments.begin(), d->containments.end(), std::back_inserter(conts), [screen](Containment *cont) {
return cont->lastScreen() == screen return cont->lastScreen() == screen //
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment); && (cont->containmentType() == Plasma::Types::DesktopContainment //
|| cont->containmentType() == Plasma::Types::CustomContainment);
}); });
return conts; return conts;
@ -410,7 +416,12 @@ bool Corona::isEditMode() const
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
{ {
QList<Plasma::Types::Location> freeEdges; QList<Plasma::Types::Location> freeEdges;
freeEdges << Plasma::Types::TopEdge << Plasma::Types::BottomEdge << Plasma::Types::LeftEdge << Plasma::Types::RightEdge; /* clang-format off */
freeEdges << Plasma::Types::TopEdge
<< Plasma::Types::BottomEdge
<< Plasma::Types::LeftEdge
<< Plasma::Types::RightEdge;
/* clang-format on */
const auto containments = this->containments(); const auto containments = this->containments();
for (Containment *containment : containments) { for (Containment *containment : containments) {

View File

@ -401,8 +401,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginMetaData &md, c
: q(e) : q(e)
, dataEngineDescription(md) , dataEngineDescription(md)
, refCount(-1) , refCount(-1)
, // first ref , checkSourcesTimerId(0) // first ref
checkSourcesTimerId(0)
, updateTimerId(0) , updateTimerId(0)
, minPollingInterval(-1) , minPollingInterval(-1)
, valid(false) , valid(false)

View File

@ -453,6 +453,7 @@ private:
/** /**
* Register a data engine when it is contained in a loadable module * Register a data engine when it is contained in a loadable module
*/ */
/* clang-format off */
#define K_EXPORT_PLASMA_DATAENGINE(libname, classname) \ #define K_EXPORT_PLASMA_DATAENGINE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \ K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
@ -460,5 +461,6 @@ private:
#define K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(libname, classname, jsonFile) \ #define K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(libname, classname, jsonFile) \
K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \ K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
/* clang-format on */
#endif // multiple inclusion guard #endif // multiple inclusion guard

View File

@ -437,8 +437,9 @@ QPixmap FrameSvgPrivate::alphaMask()
return maskFrame->cachedBackground; return maskFrame->cachedBackground;
} }
const bool shouldUpdate = const bool shouldUpdate = (maskFrame->enabledBorders != frame->enabledBorders //
maskFrame->enabledBorders != frame->enabledBorders || maskFrame->frameSize != frameSize(frame.data()) || maskFrame->imagePath != frame->imagePath; || maskFrame->frameSize != frameSize(frame.data()) //
|| maskFrame->imagePath != frame->imagePath);
if (shouldUpdate) { if (shouldUpdate) {
maskFrame = lookupOrCreateMaskFrame(frame, maskPrefix, maskRequestedPrefix); maskFrame = lookupOrCreateMaskFrame(frame, maskPrefix, maskRequestedPrefix);
if (!maskFrame->cachedBackground.isNull()) { if (!maskFrame->cachedBackground.isNull()) {

View File

@ -89,6 +89,8 @@ private:
/** /**
* Register a Package class when it is contained in a loadable module * Register a Package class when it is contained in a loadable module
*/ */
/* clang-format off */
#define K_EXPORT_PLASMA_PACKAGE(libname, classname) \ #define K_EXPORT_PLASMA_PACKAGE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \ K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
@ -96,6 +98,7 @@ private:
#define K_EXPORT_PLASMA_PACKAGE_WITH_JSON(classname, jsonFile) \ #define K_EXPORT_PLASMA_PACKAGE_WITH_JSON(classname, jsonFile) \
K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \ K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
/* clang-format on */
#endif // PLASMA_ENABLE_DEPRECATED_SINCE(5, 6) #endif // PLASMA_ENABLE_DEPRECATED_SINCE(5, 6)

View File

@ -89,17 +89,30 @@ QSet<QString> PluginLoaderPrivate::knownCategories()
// this is to trick the translation tools into making the correct // this is to trick the translation tools into making the correct
// strings for translation // strings for translation
QSet<QString> categories = s_customCategories; QSet<QString> categories = s_customCategories;
categories << QStringLiteral(I18N_NOOP("Accessibility")).toLower() << QStringLiteral(I18N_NOOP("Application Launchers")).toLower() /* clang-format off */
<< QStringLiteral(I18N_NOOP("Astronomy")).toLower() << QStringLiteral(I18N_NOOP("Date and Time")).toLower() categories << QStringLiteral(I18N_NOOP("Accessibility")).toLower()
<< QStringLiteral(I18N_NOOP("Development Tools")).toLower() << QStringLiteral(I18N_NOOP("Education")).toLower() << QStringLiteral(I18N_NOOP("Application Launchers")).toLower()
<< QStringLiteral(I18N_NOOP("Environment and Weather")).toLower() << QStringLiteral(I18N_NOOP("Examples")).toLower() << QStringLiteral(I18N_NOOP("Astronomy")).toLower()
<< QStringLiteral(I18N_NOOP("File System")).toLower() << QStringLiteral(I18N_NOOP("Fun and Games")).toLower() << QStringLiteral(I18N_NOOP("Date and Time")).toLower()
<< QStringLiteral(I18N_NOOP("Graphics")).toLower() << QStringLiteral(I18N_NOOP("Language")).toLower() << QStringLiteral(I18N_NOOP("Development Tools")).toLower()
<< QStringLiteral(I18N_NOOP("Mapping")).toLower() << QStringLiteral(I18N_NOOP("Miscellaneous")).toLower() << QStringLiteral(I18N_NOOP("Education")).toLower()
<< QStringLiteral(I18N_NOOP("Multimedia")).toLower() << QStringLiteral(I18N_NOOP("Online Services")).toLower() << QStringLiteral(I18N_NOOP("Environment and Weather")).toLower()
<< QStringLiteral(I18N_NOOP("Productivity")).toLower() << QStringLiteral(I18N_NOOP("System Information")).toLower() << QStringLiteral(I18N_NOOP("Examples")).toLower()
<< QStringLiteral(I18N_NOOP("Utilities")).toLower() << QStringLiteral(I18N_NOOP("Windows and Tasks")).toLower() << QStringLiteral(I18N_NOOP("File System")).toLower()
<< QStringLiteral(I18N_NOOP("Clipboard")).toLower() << QStringLiteral(I18N_NOOP("Tasks")).toLower(); << QStringLiteral(I18N_NOOP("Fun and Games")).toLower()
<< QStringLiteral(I18N_NOOP("Graphics")).toLower()
<< QStringLiteral(I18N_NOOP("Language")).toLower()
<< QStringLiteral(I18N_NOOP("Mapping")).toLower()
<< QStringLiteral(I18N_NOOP("Miscellaneous")).toLower()
<< QStringLiteral(I18N_NOOP("Multimedia")).toLower()
<< QStringLiteral(I18N_NOOP("Online Services")).toLower()
<< QStringLiteral(I18N_NOOP("Productivity")).toLower()
<< QStringLiteral(I18N_NOOP("System Information")).toLower()
<< QStringLiteral(I18N_NOOP("Utilities")).toLower()
<< QStringLiteral(I18N_NOOP("Windows and Tasks")).toLower()
<< QStringLiteral(I18N_NOOP("Clipboard")).toLower()
<< QStringLiteral(I18N_NOOP("Tasks")).toLower();
/* clang-format on */
return categories; return categories;
} }
@ -273,7 +286,8 @@ KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category
return md.value(QStringLiteral("X-KDE-PluginInfo-Category")) == category; return md.value(QStringLiteral("X-KDE-PluginInfo-Category")) == category;
}; };
auto filterParentApp = [&category, &parentApp](const KPluginMetaData &md) -> bool { auto filterParentApp = [&category, &parentApp](const KPluginMetaData &md) -> bool {
return md.value(QStringLiteral("X-KDE-ParentApp")) == parentApp && md.value(QStringLiteral("X-KDE-PluginInfo-Category")) == category; return md.value(QStringLiteral("X-KDE-ParentApp")) == parentApp //
&& md.value(QStringLiteral("X-KDE-PluginInfo-Category")) == category;
}; };
QVector<KPluginMetaData> plugins; QVector<KPluginMetaData> plugins;
if (parentApp.isEmpty()) { if (parentApp.isEmpty()) {
@ -564,7 +578,8 @@ QList<KPluginMetaData> PluginLoader::listAppletMetaDataForUrl(const QUrl &url)
auto filter = [&parentApp](const KPluginMetaData &md) -> bool { auto filter = [&parentApp](const KPluginMetaData &md) -> bool {
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
return (parentApp.isEmpty() || pa == parentApp) && !KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty(); return (parentApp.isEmpty() || pa == parentApp) //
&& !KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty();
}; };
const QList<KPluginMetaData> allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter); const QList<KPluginMetaData> allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
@ -597,7 +612,8 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
const QStringList excluded = group.readEntry("ExcludeCategories", QStringList()); const QStringList excluded = group.readEntry("ExcludeCategories", QStringList());
auto filter = [&parentApp, &excluded, visibleOnly](const KPluginMetaData &md) -> bool { auto filter = [&parentApp, &excluded, visibleOnly](const KPluginMetaData &md) -> bool {
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
return (parentApp.isEmpty() || pa == parentApp) && (excluded.isEmpty() || excluded.contains(md.value(QStringLiteral("X-KDE-PluginInfo-Category")))) return (parentApp.isEmpty() || pa == parentApp) //
&& (excluded.isEmpty() || excluded.contains(md.value(QStringLiteral("X-KDE-PluginInfo-Category")))) //
&& (!visibleOnly || !md.isHidden()); && (!visibleOnly || !md.isHidden());
}; };
const QList<KPluginMetaData> allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter); const QList<KPluginMetaData> allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);

View File

@ -265,7 +265,8 @@ void AppletPrivate::askDestroy()
deleteNotification->setTitle(i18n("Widget Removed")); deleteNotification->setTitle(i18n("Widget Removed"));
deleteNotification->setText(i18n("The widget \"%1\" has been removed.", q->title().toHtmlEscaped())); deleteNotification->setText(i18n("The widget \"%1\" has been removed.", q->title().toHtmlEscaped()));
} else if (asContainment } else if (asContainment
&& (asContainment->containmentType() == Types::PanelContainment || asContainment->containmentType() == Types::CustomPanelContainment)) { && (asContainment->containmentType() == Types::PanelContainment //
|| asContainment->containmentType() == Types::CustomPanelContainment)) {
deleteNotification->setTitle(i18n("Panel Removed")); deleteNotification->setTitle(i18n("Panel Removed"));
deleteNotification->setText(i18n("A panel has been removed.")); deleteNotification->setText(i18n("A panel has been removed."));
// This will never happen with our current shell, but could with a custom one // This will never happen with our current shell, but could with a custom one

View File

@ -30,8 +30,7 @@ ContainmentPrivate::ContainmentPrivate(Containment *c)
, formFactor(Types::Planar) , formFactor(Types::Planar)
, location(Types::Floating) , location(Types::Floating)
, lastScreen(-1) , lastScreen(-1)
, // never had a screen , type(Plasma::Types::NoContainmentType) // never had a screen
type(Plasma::Types::NoContainmentType)
, uiReady(false) , uiReady(false)
, appletsUiReady(false) , appletsUiReady(false)
{ {

View File

@ -198,7 +198,8 @@ bool ThemePrivate::useCache()
const auto files = cacheDir.entryInfoList(); const auto files = cacheDir.entryInfoList();
for (const QFileInfo &file : files) { for (const QFileInfo &file : files) {
if (currentCacheFileName.isEmpty() || !file.absoluteFilePath().endsWith(currentCacheFileName)) { if (currentCacheFileName.isEmpty() //
|| !file.absoluteFilePath().endsWith(currentCacheFileName)) {
QFile::remove(file.absoluteFilePath()); QFile::remove(file.absoluteFilePath());
} }
} }
@ -384,6 +385,7 @@ const QString ThemePrivate::processStyleSheet(const QString &css, Plasma::Svg::S
if (css.isEmpty()) { if (css.isEmpty()) {
stylesheet = cachedDefaultStyleSheet; stylesheet = cachedDefaultStyleSheet;
if (stylesheet.isEmpty()) { if (stylesheet.isEmpty()) {
/* clang-format off */
stylesheet = QStringLiteral( stylesheet = QStringLiteral(
"\n\ "\n\
body {\n\ body {\n\
@ -396,6 +398,7 @@ const QString ThemePrivate::processStyleSheet(const QString &css, Plasma::Svg::S
a:visited { color: %visitedlink; }\n\ a:visited { color: %visitedlink; }\n\
a:hover { color: %hoveredlink; text-decoration: none; }\n\ a:hover { color: %hoveredlink; text-decoration: none; }\n\
"); ");
/* clang-format on */
stylesheet = cachedDefaultStyleSheet = processStyleSheet(stylesheet, status); stylesheet = cachedDefaultStyleSheet = processStyleSheet(stylesheet, status);
} }

View File

@ -109,9 +109,15 @@ void AppletQuickItemPrivate::connectLayoutAttached(QObject *item)
const auto lstChildren = item->children(); const auto lstChildren = item->children();
for (QObject *child : lstChildren) { for (QObject *child : lstChildren) {
// find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight // find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight
if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && child->property("preferredWidth").isValid() /* clang-format off */
&& child->property("preferredHeight").isValid() && child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() if (child->property("minimumWidth").isValid()
&& child->property("fillWidth").isValid() && child->property("fillHeight").isValid()) { && child->property("minimumHeight").isValid()
&& child->property("preferredWidth").isValid()
&& child->property("preferredHeight").isValid()
&& child->property("maximumWidth").isValid()
&& child->property("maximumHeight").isValid()
&& child->property("fillWidth").isValid()
&& child->property("fillHeight").isValid()) { /* clang-format on */
layout = child; layout = child;
break; break;
} }
@ -148,9 +154,15 @@ void AppletQuickItemPrivate::connectLayoutAttached(QObject *item)
const auto children = q->children(); const auto children = q->children();
for (QObject *child : children) { for (QObject *child : children) {
// find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight // find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight
if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && child->property("preferredWidth").isValid() /* clang-format off */
&& child->property("preferredHeight").isValid() && child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() if (child->property("minimumWidth").isValid()
&& child->property("fillWidth").isValid() && child->property("fillHeight").isValid()) { && child->property("minimumHeight").isValid()
&& child->property("preferredWidth").isValid()
&& child->property("preferredHeight").isValid()
&& child->property("maximumWidth").isValid()
&& child->property("maximumHeight").isValid()
&& child->property("fillWidth").isValid()
&& child->property("fillHeight").isValid()) { /* clang-format on */
ownLayout = child; ownLayout = child;
break; break;
} }

View File

@ -106,7 +106,8 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
const QUrl url = QUrl(plainPath); const QUrl url = QUrl(plainPath);
const QString newPath = url.path(); const QString newPath = url.path();
// search it in a resource or as a file on disk // search it in a resource or as a file on disk
if (!(plainPath.contains(QLatin1String("qrc")) && QFile::exists(QLatin1Char(':') + newPath)) && !QFile::exists(newPath)) { if (!(plainPath.contains(QLatin1String("qrc")) && QFile::exists(QLatin1Char(':') + newPath)) //
&& !QFile::exists(newPath)) {
return d->selector->select(path); return d->selector->select(path);
} }
qWarning() << "Warning: all files used by qml by the plasmoid should be in ui/. The file in the path" << plainPath << "was expected at" << path; qWarning() << "Warning: all files used by qml by the plasmoid should be in ui/. The file in the path" << plainPath << "was expected at" << path;

View File

@ -60,8 +60,13 @@ public:
// failed by type, let's try by extension // failed by type, let's try by extension
const QString &extension = fileName.mid(fileName.lastIndexOf(QLatin1Char('.')) + 1).toLower(); const QString &extension = fileName.mid(fileName.lastIndexOf(QLatin1Char('.')) + 1).toLower();
if (extension == QLatin1String("svg") || extension == QStringLiteral("svgz") || extension == QLatin1String("png") || extension == QStringLiteral("gif") /* clang-format off */
|| extension == QLatin1String("jpg") || extension == QStringLiteral("jpeg")) { if (extension == QLatin1String("svg")
|| extension == QStringLiteral("svgz")
|| extension == QLatin1String("png")
|| extension == QStringLiteral("gif")
|| extension == QLatin1String("jpg")
|| extension == QStringLiteral("jpeg")) { /* clang-format on */
return QByteArray("images"); return QByteArray("images");
// FIXME: are those necessary? are they *always* caught by type? // FIXME: are those necessary? are they *always* caught by type?
} else if (extension == QLatin1String("js")) { } else if (extension == QLatin1String("js")) {

View File

@ -105,8 +105,14 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
// if both compactRepresentationItem and fullRepresentationItem exist, // if both compactRepresentationItem and fullRepresentationItem exist,
// the applet is in a popup // the applet is in a popup
if (expanded) { if (expanded) {
if (compactRepresentationItem() && fullRepresentationItem() && fullRepresentationItem()->window() && compactRepresentationItem()->window() /* clang-format off */
&& fullRepresentationItem()->window() != compactRepresentationItem()->window() && fullRepresentationItem()->parentItem()) { if (compactRepresentationItem()
&& fullRepresentationItem()
&& fullRepresentationItem()->window()
&& compactRepresentationItem()->window()
&& fullRepresentationItem()->window() != compactRepresentationItem()->window()
&& fullRepresentationItem()->parentItem()) {
/* clang-format on */
fullRepresentationItem()->parentItem()->installEventFilter(this); fullRepresentationItem()->parentItem()->installEventFilter(this);
} else if (fullRepresentationItem() && fullRepresentationItem()->parentItem()) { } else if (fullRepresentationItem() && fullRepresentationItem()->parentItem()) {
fullRepresentationItem()->parentItem()->removeEventFilter(this); fullRepresentationItem()->parentItem()->removeEventFilter(this);

View File

@ -1083,7 +1083,8 @@ void ContainmentInterface::addAppletActions(QMenu *desktopMenu, Plasma::Applet *
void ContainmentInterface::addContainmentActions(QMenu *desktopMenu, QEvent *event) void ContainmentInterface::addContainmentActions(QMenu *desktopMenu, QEvent *event)
{ {
if (m_containment->corona()->immutability() != Plasma::Types::Mutable && !KAuthorized::authorizeAction(QStringLiteral("plasma/containment_actions"))) { if (m_containment->corona()->immutability() != Plasma::Types::Mutable //
&& !KAuthorized::authorizeAction(QStringLiteral("plasma/containment_actions"))) {
// qDebug() << "immutability"; // qDebug() << "immutability";
return; return;
} }
@ -1111,8 +1112,10 @@ void ContainmentInterface::addContainmentActions(QMenu *desktopMenu, QEvent *eve
if (actions.isEmpty()) { if (actions.isEmpty()) {
// it probably didn't bother implementing the function. give the user a chance to set // it probably didn't bother implementing the function. give the user a chance to set
// a better plugin. note that if the user sets no-plugin this won't happen... // a better plugin. note that if the user sets no-plugin this won't happen...
if ((m_containment->containmentType() != Plasma::Types::PanelContainment && m_containment->containmentType() != Plasma::Types::CustomPanelContainment) /* clang-format off */
&& m_containment->actions()->action(QStringLiteral("configure"))) { if ((m_containment->containmentType() != Plasma::Types::PanelContainment
&& m_containment->containmentType() != Plasma::Types::CustomPanelContainment)
&& m_containment->actions()->action(QStringLiteral("configure"))) { /* clang-format on */
desktopMenu->addAction(m_containment->actions()->action(QStringLiteral("configure"))); desktopMenu->addAction(m_containment->actions()->action(QStringLiteral("configure")));
} }
} else { } else {

View File

@ -150,7 +150,9 @@ void WallpaperInterface::syncWallpaperPackage()
void WallpaperInterface::loadFinished() void WallpaperInterface::loadFinished()
{ {
if (m_qmlObject->mainComponent() && m_qmlObject->rootObject() && !m_qmlObject->mainComponent()->isError()) { if (m_qmlObject->mainComponent() //
&& m_qmlObject->rootObject() //
&& !m_qmlObject->mainComponent()->isError()) {
m_qmlObject->rootObject()->setProperty("z", -1000); m_qmlObject->rootObject()->setProperty("z", -1000);
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this)); m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));