Add return to source icon the the plasma theme, and use this in extender items.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=870089
This commit is contained in:
parent
e88e2faa63
commit
51e03dc5e3
@ -27,6 +27,8 @@
|
||||
#include "containment.h"
|
||||
#include "corona.h"
|
||||
#include "extenderitem.h"
|
||||
#include "popupapplet.h"
|
||||
#include "svg.h"
|
||||
#include "widgets/label.h"
|
||||
|
||||
#include "private/applet_p.h"
|
||||
@ -130,7 +132,6 @@ ExtenderItem *Extender::item(const QString &name) const
|
||||
|
||||
void Extender::saveState()
|
||||
{
|
||||
kDebug() << "saving state";
|
||||
foreach (ExtenderItem *item, attachedItems()) {
|
||||
item->config().writeEntry("extenderItemPosition", item->geometry().y());
|
||||
}
|
||||
@ -145,7 +146,6 @@ QVariant Extender::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
return QGraphicsWidget::itemChange(change, value);
|
||||
}
|
||||
|
||||
|
||||
void Extender::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||
{
|
||||
QGraphicsWidget::resizeEvent(event);
|
||||
@ -265,7 +265,6 @@ ExtenderPrivate::~ExtenderPrivate()
|
||||
void ExtenderPrivate::addExtenderItem(ExtenderItem *item, const QPointF &pos)
|
||||
{
|
||||
attachedExtenderItems.append(item);
|
||||
item->action("returntosource")->setVisible(item->isDetached());
|
||||
q->itemAddedEvent(item, pos);
|
||||
q->itemHoverLeaveEvent(item);
|
||||
emit q->itemAttached(item);
|
||||
|
@ -152,6 +152,17 @@ class ExtenderItemPrivate
|
||||
}
|
||||
}
|
||||
|
||||
if (q->isDetached() && sourceApplet) {
|
||||
Icon *returnToSource = new Icon(q);
|
||||
returnToSource->setSvg("widgets/configuration-icons", "return-to-source");
|
||||
QSizeF iconSize = returnToSource->sizeFromIconSize(iconHeight);
|
||||
returnToSource->setMinimumSize(iconSize);
|
||||
returnToSource->setMaximumSize(iconSize);
|
||||
|
||||
toolboxLayout->addItem(returnToSource);
|
||||
QObject::connect(returnToSource, SIGNAL(clicked()), q, SLOT(moveBackToSource()));
|
||||
}
|
||||
|
||||
toolboxLayout->updateGeometry();
|
||||
|
||||
//position the toolbox correctly.
|
||||
@ -249,7 +260,7 @@ class ExtenderItemPrivate
|
||||
PanelSvg *background;
|
||||
|
||||
Icon *collapseIcon;
|
||||
QAction *returnAction;
|
||||
|
||||
QMap<QString, QAction*> actions;
|
||||
|
||||
QString title;
|
||||
@ -328,8 +339,6 @@ ExtenderItem::ExtenderItem(Extender *hostExtender, uint extenderItemId)
|
||||
d->toolbox->setLayout(d->toolboxLayout);
|
||||
|
||||
//allow the theme to set the size of the icon.
|
||||
//TODO: discuss with others to determine details of the theming implementation. I don't really
|
||||
//like this approach, but it works...
|
||||
QSizeF iconSize = d->dragger->elementSize("hint-preferred-icon-size");
|
||||
|
||||
//create the collapse/applet icon.
|
||||
@ -340,14 +349,6 @@ ExtenderItem::ExtenderItem(Extender *hostExtender, uint extenderItemId)
|
||||
d->collapseIcon->size().height()/2 + d->bgTop);
|
||||
connect(d->collapseIcon, SIGNAL(clicked()), this, SLOT(toggleCollapse()));
|
||||
|
||||
//Add the return to source action.
|
||||
d->returnAction = new QAction(this);
|
||||
d->returnAction->setIcon(KIcon("returntosource"));
|
||||
d->returnAction->setEnabled(true);
|
||||
d->returnAction->setVisible(true);
|
||||
connect(d->returnAction, SIGNAL(triggered()), this, SLOT(moveBackToSource()));
|
||||
addAction("returntosource", d->returnAction);
|
||||
|
||||
//set the extender we want to move to.
|
||||
setExtender(hostExtender);
|
||||
|
||||
@ -463,6 +464,9 @@ void ExtenderItem::setExtender(Extender *extender, const QPointF &pos)
|
||||
delete d->expirationTimer;
|
||||
d->expirationTimer = 0;
|
||||
}
|
||||
|
||||
//we might have to enable or disable the returnToSource button.
|
||||
d->updateToolBox();
|
||||
}
|
||||
|
||||
Extender *ExtenderItem::extender() const
|
||||
|
@ -35,6 +35,7 @@ class Applet;
|
||||
class Extender;
|
||||
class ExtenderItem;
|
||||
class Label;
|
||||
class Svg;
|
||||
|
||||
class ExtenderPrivate
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user