Added the ability to close widgets though the right mouse button menu.

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=670621
This commit is contained in:
Aaron Eisenberg 2007-06-02 07:30:16 +00:00
parent 0f57b68841
commit 59641c640e

View File

@ -180,6 +180,8 @@ void Corona::addPlasmoid(const QString& name)
addItem(applet); addItem(applet);
//applet->constraintsUpdated(); //applet->constraintsUpdated();
d->applets << applet; d->applets << applet;
connect(applet, SIGNAL(destroyed(QObject)),
this, SLOT(appletDestroyed(QObject*)));
} else { } else {
kDebug() << "Plasmoid " << name << " could not be loaded." << endl; kDebug() << "Plasmoid " << name << " could not be loaded." << endl;
} }
@ -272,6 +274,10 @@ void Corona::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent)
connect(configureApplet, SIGNAL(triggered(bool)), connect(configureApplet, SIGNAL(triggered(bool)),
applet, SLOT(configureDialog())); //This isn't implemented in Applet yet... applet, SLOT(configureDialog())); //This isn't implemented in Applet yet...
desktopMenu.addAction(configureApplet); desktopMenu.addAction(configureApplet);
QAction* closeApplet = new QAction(i18n("Close Applet"), this);
connect(closeApplet, SIGNAL(triggered(bool)),
applet, SLOT(deleteLater()));
desktopMenu.addAction(closeApplet);
} }
desktopMenu.exec(point.toPoint()); desktopMenu.exec(point.toPoint());
contextMenuEvent->accept(); contextMenuEvent->accept();