Add signals that incicate an application launch. DashBoardView can

connect and hide itself then, for example.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=737051
This commit is contained in:
Andre Duffeck 2007-11-15 11:06:33 +00:00
parent 7a333aee4c
commit 174096635e
5 changed files with 28 additions and 4 deletions

View File

@ -201,6 +201,8 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (event->button()==Qt::LeftButton && m_pressedButton==releasedAtButton) { if (event->button()==Qt::LeftButton && m_pressedButton==releasedAtButton) {
if (m_pressedButton==ConfigureButton) { if (m_pressedButton==ConfigureButton) {
//FIXME: Remove this call once the configuration management change was done
m_containment->emitLaunchActivated();
m_applet->showConfigurationInterface(); m_applet->showConfigurationInterface();
} else if (m_pressedButton==RemoveButton) { } else if (m_pressedButton==RemoveButton) {
Phase::self()->animateItem(m_applet, Phase::Disappear); Phase::self()->animateItem(m_applet, Phase::Disappear);

View File

@ -289,7 +289,7 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, ui
//the applet needs to be given constraints before it can set its geometry //the applet needs to be given constraints before it can set its geometry
applet->updateConstraints(Plasma::AllConstraints); applet->updateConstraints(Plasma::AllConstraints);
//kDebug() << "adding applet" << applet->name() << "with a default geometry of" << appletGeometry << appletGeometry.isValid(); //kDebug() << "adding applet" << applet->name() << "with a default geometry of" << appletGeometry << appletGeometry.isValid();
if (appletGeometry.isValid()) { if (appletGeometry.isValid()) {
applet->setGeometry(appletGeometry); applet->setGeometry(appletGeometry);
} else if (appletGeometry.x() != -1 && appletGeometry.y() != -1) { } else if (appletGeometry.x() != -1 && appletGeometry.y() != -1) {
@ -543,6 +543,12 @@ void Containment::handleDisappeared(AppletHandle *handle)
handle->deleteLater(); handle->deleteLater();
} }
void Containment::emitLaunchActivated()
{
kDebug();
emit launchActivated();
}
} }
#include "containment.moc" #include "containment.moc"

View File

@ -195,12 +195,22 @@ class PLASMA_EXPORT Containment : public Applet
*/ */
void initConstraints(KConfigGroup* group); void initConstraints(KConfigGroup* group);
/**
* Emits the launchActivated() signal
*/
void emitLaunchActivated();
Q_SIGNALS: Q_SIGNALS:
/** /**
* This signal is emitted when a new applet is created by the containment * This signal is emitted when a new applet is created by the containment
*/ */
void appletAdded(Plasma::Applet* applet); void appletAdded(Plasma::Applet* applet);
/**
* This signal indicates, that a application launch was triggered
*/
void launchActivated();
public Q_SLOTS: public Q_SLOTS:
/** /**
* Informs the Corona as to what position it is in. This is informational * Informs the Corona as to what position it is in. This is informational

View File

@ -305,9 +305,7 @@ Containment* Corona::addContainment(const QString& name, const QVariantList& arg
if (pluginName.isEmpty()) { if (pluginName.isEmpty()) {
// default to the desktop containment // default to the desktop containment
pluginName = "desktop"; pluginName = "desktop";
} } else if (pluginName != "null") {
if (pluginName != "null") {
applet = Applet::loadApplet(pluginName, id, args); applet = Applet::loadApplet(pluginName, id, args);
containment = dynamic_cast<Containment*>(applet); containment = dynamic_cast<Containment*>(applet);
} }
@ -334,6 +332,8 @@ Containment* Corona::addContainment(const QString& name, const QVariantList& arg
d->containments.append(containment); d->containments.append(containment);
connect(containment, SIGNAL(destroyed(QObject*)), connect(containment, SIGNAL(destroyed(QObject*)),
this, SLOT(containmentDestroyed(QObject*))); this, SLOT(containmentDestroyed(QObject*)));
connect(containment, SIGNAL(launchActivated()),
SIGNAL(launchActivated()));
return containment; return containment;
} }

View File

@ -154,6 +154,12 @@ public Q_SLOTS:
*/ */
void setImmutable(bool immutable_); void setImmutable(bool immutable_);
Q_SIGNALS:
/**
* This signal indicates, that a application launch was triggered
*/
void launchActivated();
protected: protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent* event); void dragEnterEvent(QGraphicsSceneDragDropEvent* event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent* event); void dragLeaveEvent(QGraphicsSceneDragDropEvent* event);