* optional names for tools
* respond to immutability constraint updates, in particular hide the add widgets toolbox button svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=745246
This commit is contained in:
parent
5c257fce5a
commit
198544318a
@ -145,9 +145,16 @@ void Containment::saveConstraints(KConfigGroup* group) const
|
|||||||
|
|
||||||
void Containment::containmentConstraintsUpdated(Plasma::Constraints constraints)
|
void Containment::containmentConstraintsUpdated(Plasma::Constraints constraints)
|
||||||
{
|
{
|
||||||
if (d->toolbox && constraints & Plasma::ScreenConstraint) {
|
//kDebug() << "got containmentConstraintsUpdated" << constraints << (QObject*)d->toolbox;
|
||||||
|
if (d->toolbox) {
|
||||||
|
if (constraints & Plasma::ScreenConstraint) {
|
||||||
d->toolbox->setPos(geometry().width() - d->toolbox->boundingRect().width(), 0);
|
d->toolbox->setPos(geometry().width() - d->toolbox->boundingRect().width(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (constraints & Plasma::ImmutableConstraint) {
|
||||||
|
d->toolbox->enableTool("addwidgets", !isImmutable());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Containment::Type Containment::containmentType() const
|
Containment::Type Containment::containmentType() const
|
||||||
@ -163,7 +170,7 @@ void Containment::setContainmentType(Containment::Type type)
|
|||||||
if (!d->toolbox) {
|
if (!d->toolbox) {
|
||||||
Plasma::PushButton *tool = new Plasma::PushButton(i18n("Add Widgets"));
|
Plasma::PushButton *tool = new Plasma::PushButton(i18n("Add Widgets"));
|
||||||
tool->resize(tool->sizeHint());
|
tool->resize(tool->sizeHint());
|
||||||
addToolBoxTool(tool);
|
addToolBoxTool(tool, "addwidgets");
|
||||||
connect(tool, SIGNAL(clicked()), this, SIGNAL(showAddWidgets()));
|
connect(tool, SIGNAL(clicked()), this, SIGNAL(showAddWidgets()));
|
||||||
|
|
||||||
tool = new Plasma::PushButton(i18n("Zoom In"));
|
tool = new Plasma::PushButton(i18n("Zoom In"));
|
||||||
@ -681,14 +688,14 @@ void Containment::emitLaunchActivated()
|
|||||||
emit launchActivated();
|
emit launchActivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Containment::addToolBoxTool(QGraphicsItem *tool)
|
void Containment::addToolBoxTool(QGraphicsItem *tool, const QString& toolName)
|
||||||
{
|
{
|
||||||
if (!d->toolbox) {
|
if (!d->toolbox) {
|
||||||
d->toolbox = new DesktopToolbox(this);
|
d->toolbox = new DesktopToolbox(this);
|
||||||
d->toolbox->setPos(geometry().width() - d->toolbox->boundingRect().width(), 0);
|
d->toolbox->setPos(geometry().width() - d->toolbox->boundingRect().width(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->toolbox->addTool(tool);
|
d->toolbox->addTool(tool, toolName);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
@ -217,7 +217,7 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
* Adds an item to the toolbox. The toolbox takes over ownership of the item.
|
* Adds an item to the toolbox. The toolbox takes over ownership of the item.
|
||||||
* TODO: add remove and accessor methods
|
* TODO: add remove and accessor methods
|
||||||
*/
|
*/
|
||||||
void addToolBoxTool(QGraphicsItem *tool);
|
void addToolBoxTool(QGraphicsItem *tool, const QString &toolname = QString());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
Loading…
Reference in New Issue
Block a user