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 <KActionCollection>
#include <KSycoca>
#include <QAction>
#include <QApplication>
#include <QProcess>
#include <QRandomGenerator>
#include <QSignalSpy>
#include <QStandardPaths>
Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint appletId, const QVariantList &args)
{
Q_UNUSED(args)

View File

@ -161,13 +161,16 @@ class DataModel : public QAbstractItemModel
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)
/**
* 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
* model. If we want to have a source watch all sources beginning with say "name:", the required regexp would be sourceFilter: "name:.*"
* 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 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)

View File

@ -523,13 +523,16 @@ void FrameSvgItem::doUpdate()
}
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"))
&& m_frameSvg->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center"));
m_fastPath = !hasOverlay && !hasComposeOverBorder;
// software rendering (at time of writing Qt5.10) doesn't seem to like our 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
// Software rendering (at time of writing Qt5.10) doesn't seem to like our
// 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")) {
m_fastPath = false;
}
@ -548,7 +551,9 @@ Plasma::FrameSvg *FrameSvgItem::frameSvg() const
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;
return nullptr;
}
@ -565,10 +570,10 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
QString prefix = m_frameSvg->actualPrefix();
oldNode = new FrameNode(prefix, m_frameSvg);
bool tileCenter =
(m_frameSvg->hasElement(QStringLiteral("hint-tile-center")) || m_frameSvg->hasElement(prefix % QLatin1String("hint-tile-center")));
bool stretchBorders =
(m_frameSvg->hasElement(QStringLiteral("hint-stretch-borders")) || m_frameSvg->hasElement(prefix % QLatin1String("hint-stretch-borders")));
bool tileCenter = (m_frameSvg->hasElement(QStringLiteral("hint-tile-center")) //
|| m_frameSvg->hasElement(prefix % QLatin1String("hint-tile-center")));
bool stretchBorders = (m_frameSvg->hasElement(QStringLiteral("hint-stretch-borders")) //
|| m_frameSvg->hasElement(prefix % QLatin1String("hint-stretch-borders")));
FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile;
FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile : FrameItemNode::Stretch;

View File

@ -355,7 +355,9 @@ void IconItem::setSource(const QVariant &source)
}
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);
m_iconItemSource.reset(new QIconSource(icon, this));
} else {

View File

@ -106,9 +106,10 @@ class ToolTip : public QQuickItem
Q_PROPERTY(bool active MEMBER m_active WRITE setActive NOTIFY activeChanged)
/**
* 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,
* so it will be possible to interact with tooltip contents
* 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, so it will be possible to interact with tooltip contents.
*/
Q_PROPERTY(bool interactive MEMBER m_interactive WRITE setInteractive NOTIFY interactiveChanged)

View File

@ -455,8 +455,9 @@ void WindowThumbnail::resolveEGLFunctions()
}
auto *context = window()->openglContext();
QList<QByteArray> extensions = QByteArray(eglQueryString(display, EGL_EXTENSIONS)).split(' ');
if (extensions.contains(QByteArrayLiteral("EGL_KHR_image"))
|| (extensions.contains(QByteArrayLiteral("EGL_KHR_image_base")) && extensions.contains(QByteArrayLiteral("EGL_KHR_image_pixmap")))) {
if (extensions.contains(QByteArrayLiteral("EGL_KHR_image")) //
|| (extensions.contains(QByteArrayLiteral("EGL_KHR_image_base")) //
&& extensions.contains(QByteArrayLiteral("EGL_KHR_image_pixmap")))) {
if (context->hasExtension(QByteArrayLiteral("GL_OES_EGL_image"))) {
qDebug() << "Have EGL texture from pixmap";
m_eglCreateImageKHR = context->getProcAddress(QByteArrayLiteral("eglCreateImageKHR"));
@ -793,7 +794,16 @@ bool WindowThumbnail::loadGLXTexture()
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);

View File

@ -61,13 +61,15 @@ class QMenuProxy : public QObject
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)
/**
* 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
* this case this will be a submenu)
* 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 this case this will be a submenu).
*/
Q_PROPERTY(QObject *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged())
Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,17 +10,17 @@
#include "corona.h"
#include "private/corona_p.h"
#include <QDebug>
#include <QGuiApplication>
#include <QMimeData>
#include <QPainter>
#include <QScreen>
#include <QTimer>
#include <cmath>
#include <KLocalizedString>
#include <KWindowSystem>
#include <QDebug>
#include <cmath>
#include "containment.h"
#include "debug_p.h"
@ -180,8 +180,9 @@ QList<Plasma::Containment *> Corona::importLayout(const KConfigGroup &conf)
Containment *Corona::containmentForScreen(int screen) const
{
for (Containment *containment : qAsConst(d->containments)) {
if (containment->screen() == screen
&& (containment->containmentType() == Plasma::Types::DesktopContainment || containment->containmentType() == Plasma::Types::CustomContainment)) {
if (containment->screen() == screen //
&& (containment->containmentType() == Plasma::Types::DesktopContainment //
|| containment->containmentType() == Plasma::Types::CustomContainment)) {
return containment;
}
}
@ -199,8 +200,11 @@ Containment *Corona::containmentForScreen(int screen, const QString &activity, c
Containment *containment = nullptr;
for (Containment *cont : qAsConst(d->containments)) {
if (cont->lastScreen() == screen && (cont->activity().isEmpty() || cont->activity() == activity)
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment)) {
/* clang-format off */
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;
}
}
@ -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) {
return cont->activity() == activity
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment);
return cont->activity() == activity //
&& (cont->containmentType() == Plasma::Types::DesktopContainment //
|| cont->containmentType() == Plasma::Types::CustomContainment);
});
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) {
return cont->lastScreen() == screen
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment);
return cont->lastScreen() == screen //
&& (cont->containmentType() == Plasma::Types::DesktopContainment //
|| cont->containmentType() == Plasma::Types::CustomContainment);
});
return conts;
@ -410,7 +416,12 @@ bool Corona::isEditMode() const
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
{
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();
for (Containment *containment : containments) {

View File

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

View File

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

View File

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

View File

@ -89,13 +89,16 @@ private:
/**
* Register a Package class when it is contained in a loadable module
*/
#define K_EXPORT_PLASMA_PACKAGE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
/* clang-format off */
#define K_EXPORT_PLASMA_PACKAGE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
#define K_EXPORT_PLASMA_PACKAGE_WITH_JSON(classname, jsonFile) \
K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \
#define K_EXPORT_PLASMA_PACKAGE_WITH_JSON(classname, jsonFile) \
K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
/* clang-format on */
#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
// strings for translation
QSet<QString> categories = s_customCategories;
categories << QStringLiteral(I18N_NOOP("Accessibility")).toLower() << QStringLiteral(I18N_NOOP("Application Launchers")).toLower()
<< QStringLiteral(I18N_NOOP("Astronomy")).toLower() << QStringLiteral(I18N_NOOP("Date and Time")).toLower()
<< QStringLiteral(I18N_NOOP("Development Tools")).toLower() << QStringLiteral(I18N_NOOP("Education")).toLower()
<< QStringLiteral(I18N_NOOP("Environment and Weather")).toLower() << QStringLiteral(I18N_NOOP("Examples")).toLower()
<< QStringLiteral(I18N_NOOP("File System")).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 off */
categories << QStringLiteral(I18N_NOOP("Accessibility")).toLower()
<< QStringLiteral(I18N_NOOP("Application Launchers")).toLower()
<< QStringLiteral(I18N_NOOP("Astronomy")).toLower()
<< QStringLiteral(I18N_NOOP("Date and Time")).toLower()
<< QStringLiteral(I18N_NOOP("Development Tools")).toLower()
<< QStringLiteral(I18N_NOOP("Education")).toLower()
<< QStringLiteral(I18N_NOOP("Environment and Weather")).toLower()
<< QStringLiteral(I18N_NOOP("Examples")).toLower()
<< QStringLiteral(I18N_NOOP("File System")).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;
}
@ -273,7 +286,8 @@ KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category
return md.value(QStringLiteral("X-KDE-PluginInfo-Category")) == category;
};
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;
if (parentApp.isEmpty()) {
@ -564,7 +578,8 @@ QList<KPluginMetaData> PluginLoader::listAppletMetaDataForUrl(const QUrl &url)
auto filter = [&parentApp](const KPluginMetaData &md) -> bool {
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);
@ -597,7 +612,8 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
const QStringList excluded = group.readEntry("ExcludeCategories", QStringList());
auto filter = [&parentApp, &excluded, visibleOnly](const KPluginMetaData &md) -> bool {
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());
};
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->setText(i18n("The widget \"%1\" has been removed.", q->title().toHtmlEscaped()));
} 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->setText(i18n("A panel has been removed."));
// 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)
, location(Types::Floating)
, lastScreen(-1)
, // never had a screen
type(Plasma::Types::NoContainmentType)
, type(Plasma::Types::NoContainmentType) // never had a screen
, uiReady(false)
, appletsUiReady(false)
{

View File

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

View File

@ -109,9 +109,15 @@ void AppletQuickItemPrivate::connectLayoutAttached(QObject *item)
const auto lstChildren = item->children();
for (QObject *child : lstChildren) {
// 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()
&& child->property("preferredHeight").isValid() && child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid()
&& child->property("fillWidth").isValid() && child->property("fillHeight").isValid()) {
/* clang-format off */
if (child->property("minimumWidth").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;
break;
}
@ -148,9 +154,15 @@ void AppletQuickItemPrivate::connectLayoutAttached(QObject *item)
const auto children = q->children();
for (QObject *child : children) {
// 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()
&& child->property("preferredHeight").isValid() && child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid()
&& child->property("fillWidth").isValid() && child->property("fillHeight").isValid()) {
/* clang-format off */
if (child->property("minimumWidth").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;
break;
}

View File

@ -106,7 +106,8 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
const QUrl url = QUrl(plainPath);
const QString newPath = url.path();
// 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);
}
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
const QString &extension = fileName.mid(fileName.lastIndexOf(QLatin1Char('.')) + 1).toLower();
if (extension == QLatin1String("svg") || extension == QStringLiteral("svgz") || extension == QLatin1String("png") || extension == QStringLiteral("gif")
|| extension == QLatin1String("jpg") || extension == QStringLiteral("jpeg")) {
/* clang-format off */
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");
// FIXME: are those necessary? are they *always* caught by type?
} else if (extension == QLatin1String("js")) {

View File

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

View File

@ -1083,7 +1083,8 @@ void ContainmentInterface::addAppletActions(QMenu *desktopMenu, Plasma::Applet *
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";
return;
}
@ -1111,8 +1112,10 @@ void ContainmentInterface::addContainmentActions(QMenu *desktopMenu, QEvent *eve
if (actions.isEmpty()) {
// 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...
if ((m_containment->containmentType() != Plasma::Types::PanelContainment && m_containment->containmentType() != Plasma::Types::CustomPanelContainment)
&& m_containment->actions()->action(QStringLiteral("configure"))) {
/* clang-format off */
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")));
}
} else {

View File

@ -150,7 +150,9 @@ void WallpaperInterface::syncWallpaperPackage()
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("parent", QVariant::fromValue(this));