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
This commit is contained in:
Marco Martin 2008-05-01 20:09:24 +00:00
parent 5939dfc87c
commit 0f1809e9f4
2 changed files with 15 additions and 2 deletions

View File

@ -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) {

View File

@ -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