open toolbox when the dashboard view starts (to show the

user a way how to "Hide Dashboard" again)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=764361
This commit is contained in:
Stephan Binner 2008-01-21 15:10:19 +00:00
parent 6d362861e0
commit 404b0b74d1
4 changed files with 41 additions and 2 deletions

View File

@ -858,6 +858,16 @@ bool Containment::isToolboxToolEnabled(const QString &toolname) const
return d->createToolbox()->isToolEnabled(toolname);
}
void Containment::showToolbox()
{
d->createToolbox()->showToolbox();
}
void Containment::hideToolbox()
{
d->createToolbox()->hideToolbox();
}
} // Plasma namespace
#include "containment.moc"

View File

@ -248,6 +248,16 @@ class PLASMA_EXPORT Containment : public Applet
*/
void containmentConstraintsUpdated(Plasma::Constraints constraints);
/**
* Open the Plasma toolbox
*/
void showToolbox();
/**
* Close the Plasma toolbox
*/
void hideToolbox();
Q_SIGNALS:
/**
* This signal is emitted when a new applet is created by the containment

View File

@ -158,6 +158,15 @@ void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
QGraphicsItem::hoverEnterEvent(event);
return;
}
showToolbox();
QGraphicsItem::hoverEnterEvent(event);
}
void DesktopToolbox::showToolbox()
{
if (m_showing) {
return;
}
int maxwidth = 0;
foreach (QGraphicsItem* tool, QGraphicsItem::children()) {
@ -198,7 +207,6 @@ void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
// TODO: 10 and 200 shouldn't be hardcoded here. There needs to be a way to
// match whatever the time is that moveItem() takes. Same in hoverLeaveEvent().
m_animId = phase->customAnimation(10, 240, Plasma::Phase::EaseInCurve, this, "animate");
QGraphicsItem::hoverEnterEvent(event);
}
void DesktopToolbox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
@ -208,6 +216,15 @@ void DesktopToolbox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
QGraphicsItem::hoverLeaveEvent(event);
return;
}
hideToolbox();
QGraphicsItem::hoverLeaveEvent(event);
}
void DesktopToolbox::hideToolbox()
{
if (!m_showing) {
return;
}
int x = m_size*2;
int y = 0;
@ -231,7 +248,6 @@ void DesktopToolbox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
if (m_toolBacker) {
m_toolBacker->hide();
}
QGraphicsItem::hoverLeaveEvent(event);
}
void DesktopToolbox::animate(qreal progress)

View File

@ -47,6 +47,9 @@ public:
bool isToolEnabled(const QString &tool) const;
QGraphicsItem* tool(const QString &tool) const;
void showToolbox();
void hideToolbox();
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);