rework the toolbox creation, containment type setting and isContainment setting code to make it resilient against when and where those properties are set
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=828636
This commit is contained in:
parent
6230340508
commit
762be363ec
10
applet.cpp
10
applet.cpp
@ -72,6 +72,7 @@
|
||||
#include "plasma/svg.h"
|
||||
#include "plasma/panelsvg.h"
|
||||
#include "plasma/theme.h"
|
||||
#include "plasma/toolbox_p.h"
|
||||
#include "plasma/view.h"
|
||||
#include "plasma/widgets/label.h"
|
||||
#include "plasma/widgets/pushbutton.h"
|
||||
@ -1497,8 +1498,13 @@ void Applet::setIsContainment(bool isContainment)
|
||||
|
||||
Containment *c = qobject_cast<Containment*>(this);
|
||||
if (c) {
|
||||
// set up the toolbox
|
||||
c->setContainmentType(c->containmentType());
|
||||
if (isContainment) {
|
||||
// set up the toolbox
|
||||
c->d->createToolBox();
|
||||
} else {
|
||||
delete c->d->toolBox;
|
||||
c->d->toolBox = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,16 +316,8 @@ void Containment::setContainmentType(Containment::Type type)
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == DesktopContainment) {
|
||||
if (!d->toolBox) {
|
||||
d->createToolBox();
|
||||
}
|
||||
} else if (type == PanelContainment) {
|
||||
if (!d->toolBox) {
|
||||
d->createToolBox();
|
||||
d->toolBox->setSize(22);
|
||||
d->toolBox->setIconSize(QSize(16, 16));
|
||||
}
|
||||
if ((type == DesktopContainment || type == PanelContainment)) {
|
||||
d->createToolBox();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1086,6 +1078,11 @@ ToolBox* ContainmentPrivate::createToolBox()
|
||||
switch (type) {
|
||||
case Containment::PanelContainment:
|
||||
toolBox = new PanelToolBox(q);
|
||||
toolBox->setSize(22);
|
||||
toolBox->setIconSize(QSize(16, 16));
|
||||
if (q->immutability() != Mutable) {
|
||||
toolBox->hide();
|
||||
}
|
||||
break;
|
||||
case Containment::DesktopContainment:
|
||||
toolBox = new DesktopToolBox(q);
|
||||
@ -1097,10 +1094,6 @@ ToolBox* ContainmentPrivate::createToolBox()
|
||||
if (toolBox) {
|
||||
QObject::connect(toolBox, SIGNAL(toggled()), q, SIGNAL(toolBoxToggled()));
|
||||
positionToolBox();
|
||||
|
||||
if (type == Containment::PanelContainment && q->immutability() != Mutable) {
|
||||
toolBox->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user