* add setToolBoxOpen

* show/hide -> open/close

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=801128
This commit is contained in:
Aaron J. Seigo 2008-04-25 18:49:27 +00:00
parent a915bf7e6b
commit f50fad8cb9
2 changed files with 25 additions and 9 deletions

View File

@ -865,7 +865,7 @@ void Containment::enableToolBoxTool(const QString &toolname, bool enable)
} }
} }
bool Containment::isToolboxToolEnabled(const QString &toolname) const bool Containment::isToolBoxToolEnabled(const QString &toolname) const
{ {
if (d->toolBox) { if (d->toolBox) {
return d->toolBox->isToolEnabled(toolname); return d->toolBox->isToolEnabled(toolname);
@ -873,14 +873,23 @@ bool Containment::isToolboxToolEnabled(const QString &toolname) const
return false; return false;
} }
void Containment::showToolbox() void Containment::setToolBoxOpen(bool open)
{
if (open) {
openToolBox();
} else {
closeToolBox();
}
}
void Containment::openToolBox()
{ {
if (d->toolBox) { if (d->toolBox) {
d->toolBox->showToolbox(); d->toolBox->showToolbox();
} }
} }
void Containment::hideToolbox() void Containment::closeToolBox()
{ {
if (d->toolBox) { if (d->toolBox) {
d->toolBox->hideToolbox(); d->toolBox->hideToolbox();

View File

@ -235,7 +235,7 @@ class PLASMA_EXPORT Containment : public Applet
void loadContainment(KConfigGroup* group); void loadContainment(KConfigGroup* group);
/** /**
* Constructs a toolbox item and adds it to the toolbox. The toolbox takes over ownership of the item. Returns the constructed tool. * Constructs a ToolBox item and adds it to the toolbox. The toolbox takes over ownership of the item. Returns the constructed tool.
* *
* @param toolName the name of the tool * @param toolName the name of the tool
* @param iconName the name of the icon * @param iconName the name of the icon
@ -256,17 +256,24 @@ class PLASMA_EXPORT Containment : public Applet
/** /**
* Returns whether or not a given toolbox tool is enabled * Returns whether or not a given toolbox tool is enabled
*/ */
bool isToolboxToolEnabled(const QString &toolName) const; bool isToolBoxToolEnabled(const QString &toolName) const;
/** /**
* Open the Plasma toolbox * Sets the open or closed state of the Containment's toolbox
*
* @arg open true to open the ToolBox, false to close it
*/ */
void showToolbox(); void setToolBoxOpen(bool open);
/** /**
* Close the Plasma toolbox * Open the Containment's toolbox
*/ */
void hideToolbox(); void openToolBox();
/**
* Closes Containment's toolbox
*/
void closeToolBox();
Q_SIGNALS: Q_SIGNALS:
/** /**