From 0f1809e9f4ead6fa1c73fd838552bc24a7971880 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 1 May 2008 20:09:24 +0000 Subject: [PATCH] new function bool hasElementPrefix(prefix) that checks if the given element prefix exists for the loaded svg and build fix woops svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=803066 --- panelsvg.cpp | 10 ++++++++-- panelsvg.h | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/panelsvg.cpp b/panelsvg.cpp index 2a351ff76..fd43cfff5 100644 --- a/panelsvg.cpp +++ b/panelsvg.cpp @@ -153,6 +153,13 @@ void PanelSvg::setElementPrefix(Plasma::Location location) d->location = location; } +bool PanelSvg::hasElementPrefix(const QString & prefix) const +{ + //for now it simply checks if a center element exists, + //because it could make sense for certain themes to not have all the elements + return hasElement(prefix + "-center"); +} + void PanelSvg::setElementPrefix(const QString & prefix) { const QString oldPrefix(d->prefix); @@ -364,8 +371,7 @@ void PanelSvg::Private::generateBackground(PanelData *panel) } p.drawTiledPixmap(QRect(panel->leftWidth, panel->topHeight, - contentWidth, contentHeight), - prefix + "center"), center); + contentWidth, contentHeight), center); } } else { if (contentHeight > 0 && contentWidth > 0) { diff --git a/panelsvg.h b/panelsvg.h index 8b70812c0..2d37867ea 100644 --- a/panelsvg.h +++ b/panelsvg.h @@ -133,6 +133,13 @@ class PLASMA_EXPORT PanelSvg : public Svg */ void setElementPrefix(const QString & prefix); + /** + * @return true if the svg has the necessary elements with the given prefix + * to draw a panel + * @arg prefix the given prefix we want to check if drawable + */ + bool hasElementPrefix(const QString & prefix) const; + /** * Returns the prefix for SVG elements of the PanelSvg * @return the prefix