activate the lock widgets toolbox button
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=781768
This commit is contained in:
parent
6fc81a860f
commit
bb3b40349a
@ -80,6 +80,8 @@ public:
|
|||||||
return toolbox;
|
return toolbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setLockToolText();
|
||||||
|
|
||||||
Containment *q;
|
Containment *q;
|
||||||
FormFactor formFactor;
|
FormFactor formFactor;
|
||||||
Location location;
|
Location location;
|
||||||
@ -90,6 +92,22 @@ public:
|
|||||||
Containment::Type type;
|
Containment::Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void Containment::Private::setLockToolText()
|
||||||
|
{
|
||||||
|
if (toolbox) {
|
||||||
|
Icon *icon = dynamic_cast<Plasma::Icon*>(toolbox->tool("lockWidgets"));
|
||||||
|
if (icon) {
|
||||||
|
// we know it's an icon becase we made it
|
||||||
|
icon->setText(q->isImmutable() ? i18n("Unlock Widgets") :
|
||||||
|
i18n("Lock Widgets"));
|
||||||
|
QSizeF iconSize = icon->sizeFromIconSize(22);
|
||||||
|
icon->setMinimumSize(iconSize);
|
||||||
|
icon->setMaximumSize(iconSize);
|
||||||
|
icon->resize(icon->sizeHint());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Containment::StyleOption::StyleOption()
|
Containment::StyleOption::StyleOption()
|
||||||
: QStyleOptionGraphicsItem(),
|
: QStyleOptionGraphicsItem(),
|
||||||
desktop(-1)
|
desktop(-1)
|
||||||
@ -177,6 +195,8 @@ void Containment::containmentConstraintsUpdated(Plasma::Constraints constraints)
|
|||||||
{
|
{
|
||||||
//kDebug() << "got containmentConstraintsUpdated" << constraints << (QObject*)d->toolbox;
|
//kDebug() << "got containmentConstraintsUpdated" << constraints << (QObject*)d->toolbox;
|
||||||
if (constraints & Plasma::ImmutableConstraint) {
|
if (constraints & Plasma::ImmutableConstraint) {
|
||||||
|
d->setLockToolText();
|
||||||
|
|
||||||
// tell the applets too
|
// tell the applets too
|
||||||
foreach (Applet *a, d->applets) {
|
foreach (Applet *a, d->applets) {
|
||||||
a->constraintsUpdated(ImmutableConstraint);
|
a->constraintsUpdated(ImmutableConstraint);
|
||||||
@ -209,10 +229,12 @@ void Containment::setContainmentType(Containment::Type type)
|
|||||||
Plasma::Widget *zoomOutTool = addToolBoxTool("zoomOut", "zoom-out", i18n("Zoom Out"));
|
Plasma::Widget *zoomOutTool = addToolBoxTool("zoomOut", "zoom-out", i18n("Zoom Out"));
|
||||||
connect(zoomOutTool, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
|
connect(zoomOutTool, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
|
||||||
|
|
||||||
//FIXME how do we access the widget later to change it between lock and unlock?
|
if (!isKioskImmutable()) {
|
||||||
//FIXME only show if user's allowed to toggle
|
Plasma::Widget *lockTool = addToolBoxTool("lockWidgets", "object-locked",
|
||||||
//Plasma::Widget *lockTool = addToolBoxTool("lockWidgets", "object-locked", i18n("Lock Widgets"));
|
isImmutable() ? i18n("Unlock Widgets") :
|
||||||
//connect(lockTool, SIGNAL(clicked()), this, SLOT(toggleDesktopImmutability()));
|
i18n("Lock Widgets"));
|
||||||
|
connect(lockTool, SIGNAL(clicked()), this, SLOT(toggleDesktopImmutability()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete d->toolbox;
|
delete d->toolbox;
|
||||||
@ -430,6 +452,8 @@ void Containment::toggleDesktopImmutability()
|
|||||||
} else {
|
} else {
|
||||||
setImmutable(!isImmutable());
|
setImmutable(!isImmutable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->setLockToolText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Containment::clearApplets()
|
void Containment::clearApplets()
|
||||||
|
Loading…
Reference in New Issue
Block a user