* Show the plasmoid name on the contextual menu.

* Applet => Plasmoid, still in the contextual menu

svn path=/trunk/KDE/kdebase/workspace/lib/plasma/; revision=671913
This commit is contained in:
Riccardo Iaconelli 2007-06-05 19:31:48 +00:00
parent 9d778637b5
commit fddaf2dcf2
3 changed files with 18 additions and 6 deletions

View File

@ -142,6 +142,11 @@ void Applet::constraintsUpdated()
kDebug() << "Applet::constraintsUpdate(): constraints are FormFactor: " << formFactor() << ", Location: " << location() << endl; kDebug() << "Applet::constraintsUpdate(): constraints are FormFactor: " << formFactor() << ", Location: " << location() << endl;
} }
QString Applet::name()
{
return d->appletDescription->name();
}
FormFactor Applet::formFactor() const FormFactor Applet::formFactor() const
{ {
if (!scene()) { if (!scene()) {

View File

@ -166,6 +166,13 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup
**/ **/
static Applet* loadApplet(const KPluginInfo* info, uint appletId = 0); static Applet* loadApplet(const KPluginInfo* info, uint appletId = 0);
/**
* Returns the user-visible name for the applet, as specified in the
* .desktop file.
* @return the user-visible name for the applet.
**/
QString name();
Q_SIGNALS: Q_SIGNALS:
/** /**
* Emit this signal when your applet needs to take (or lose) keyboard * Emit this signal when your applet needs to take (or lose) keyboard

View File

@ -257,7 +257,6 @@ void Corona::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent)
} }
} }
*/ */
contextMenuEvent->accept(); contextMenuEvent->accept();
Applet* applet = qgraphicsitem_cast<Applet*>(itemAt(point)); Applet* applet = qgraphicsitem_cast<Applet*>(itemAt(point));
KMenu desktopMenu; KMenu desktopMenu;
@ -268,17 +267,18 @@ void Corona::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent)
desktopMenu.addAction("menu"); desktopMenu.addAction("menu");
desktopMenu.addAction(d->engineExplorerAction); desktopMenu.addAction(d->engineExplorerAction);
} else { } else {
//desktopMenu.setTitle( applet->name() ); //This isn't implemented in Applet yet... desktopMenu.addTitle(applet->name());
// desktopMenu.setTitle(applet->name());
desktopMenu.addAction("Widget"); desktopMenu.addAction("Widget");
desktopMenu.addAction("settings"); desktopMenu.addAction("settings");
desktopMenu.addAction("like"); // desktopMenu.addAction("like");
desktopMenu.addAction("opacity"); // desktopMenu.addAction("opacity");
desktopMenu.addSeparator(); desktopMenu.addSeparator();
QAction* configureApplet = new QAction(i18n("Configure Applet..."), this); QAction* configureApplet = new QAction(i18n("Configure Plasmoid..."), this);
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); QAction* closeApplet = new QAction(i18n("Close Plasmoid"), this);
connect(closeApplet, SIGNAL(triggered(bool)), connect(closeApplet, SIGNAL(triggered(bool)),
applet, SLOT(deleteLater())); applet, SLOT(deleteLater()));
desktopMenu.addAction(closeApplet); desktopMenu.addAction(closeApplet);