be based also on the widget parent applet location for removing the proper borders
svn path=/trunk/KDE/kdelibs/; revision=1032273
This commit is contained in:
parent
155bfdc62a
commit
d8e084c77e
36
dialog.cpp
36
dialog.cpp
@ -107,32 +107,45 @@ void DialogPrivate::themeChanged()
|
|||||||
FrameSvg::EnabledBorders borders = FrameSvg::AllBorders;
|
FrameSvg::EnabledBorders borders = FrameSvg::AllBorders;
|
||||||
|
|
||||||
Extender *extender = qobject_cast<Extender*>(graphicsWidget);
|
Extender *extender = qobject_cast<Extender*>(graphicsWidget);
|
||||||
|
Plasma::Applet *applet = 0;
|
||||||
if (extender) {
|
if (extender) {
|
||||||
|
applet = extender->d->applet;
|
||||||
|
} else if (graphicsWidget) {
|
||||||
|
QGraphicsItem *pw = graphicsWidget;
|
||||||
|
|
||||||
|
while (pw = pw->parentItem()) {
|
||||||
|
applet = dynamic_cast<Plasma::Applet *>(pw);
|
||||||
|
if (applet) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (applet) {
|
||||||
background->getMargins(leftWidth, topHeight, rightWidth, bottomHeight);
|
background->getMargins(leftWidth, topHeight, rightWidth, bottomHeight);
|
||||||
|
|
||||||
switch (extender->d->applet->location()) {
|
switch (applet->location()) {
|
||||||
case BottomEdge:
|
case BottomEdge:
|
||||||
borders ^= FrameSvg::BottomBorder;
|
borders &= ~FrameSvg::BottomBorder;
|
||||||
leftWidth = 0;
|
leftWidth = 0;
|
||||||
rightWidth = 0;
|
rightWidth = 0;
|
||||||
bottomHeight = 0;
|
bottomHeight = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TopEdge:
|
case TopEdge:
|
||||||
borders ^= FrameSvg::TopBorder;
|
borders &= ~FrameSvg::TopBorder;
|
||||||
topHeight = 0;
|
topHeight = 0;
|
||||||
leftWidth = 0;
|
leftWidth = 0;
|
||||||
rightWidth = 0;
|
rightWidth = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LeftEdge:
|
case LeftEdge:
|
||||||
borders ^= FrameSvg::LeftBorder;
|
borders &= ~FrameSvg::LeftBorder;
|
||||||
leftWidth = 0;
|
leftWidth = 0;
|
||||||
rightWidth = 0;
|
rightWidth = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RightEdge:
|
case RightEdge:
|
||||||
borders ^= FrameSvg::RightBorder;
|
borders &= ~FrameSvg::RightBorder;
|
||||||
leftWidth = 0;
|
leftWidth = 0;
|
||||||
rightWidth = 0;
|
rightWidth = 0;
|
||||||
break;
|
break;
|
||||||
@ -140,23 +153,26 @@ void DialogPrivate::themeChanged()
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (q->isVisible()) {
|
}
|
||||||
|
|
||||||
|
if (!extender && q->isVisible()) {
|
||||||
|
//remove borders at the edge of the desktop
|
||||||
QDesktopWidget *desktop = QApplication::desktop();
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
QRect avail = desktop->availableGeometry(desktop->screenNumber(q));
|
QRect avail = desktop->availableGeometry(desktop->screenNumber(q));
|
||||||
QRect dialogGeom = q->geometry();
|
QRect dialogGeom = q->geometry();
|
||||||
|
|
||||||
if (dialogGeom.left() <= avail.left()) {
|
if (dialogGeom.left() <= avail.left()) {
|
||||||
borders ^= FrameSvg::LeftBorder;
|
borders &= ~FrameSvg::LeftBorder;
|
||||||
}
|
}
|
||||||
if (dialogGeom.top() <= avail.top()) {
|
if (dialogGeom.top() <= avail.top()) {
|
||||||
borders ^= FrameSvg::TopBorder;
|
borders &= ~FrameSvg::TopBorder;
|
||||||
}
|
}
|
||||||
//FIXME: that 2 pixels offset has probably something to do with kwin
|
//FIXME: that 2 pixels offset has probably something to do with kwin
|
||||||
if (dialogGeom.right() + 2 > avail.right()) {
|
if (dialogGeom.right() + 2 > avail.right()) {
|
||||||
borders ^= FrameSvg::RightBorder;
|
borders &= ~FrameSvg::RightBorder;
|
||||||
}
|
}
|
||||||
if (dialogGeom.bottom() + 2 > avail.bottom()) {
|
if (dialogGeom.bottom() + 2 > avail.bottom()) {
|
||||||
borders ^= FrameSvg::BottomBorder;
|
borders &= ~FrameSvg::BottomBorder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user