allow adding separators to the context menu

This commit is contained in:
Aaron Seigo 2011-10-27 16:43:55 +02:00
parent 486fbf6f82
commit 1e2e094fdd
2 changed files with 16 additions and 0 deletions

View File

@ -248,6 +248,21 @@ QRectF AppletInterface::rect() const
return applet()->contentsRect();
}
void AppletInterface::setActionSeparator(const QString &name)
{
Plasma::Applet *a = applet();
QAction *action = a->action(name);
if (!action) {
action->setSeparator(true);
} else {
action = new QAction(this);
action->setSeparator(true);
a->addAction(name, action);
m_actions.append(name);
}
}
void AppletInterface::setAction(const QString &name, const QString &text, const QString &icon, const QString &shortcut)
{
Plasma::Applet *a = applet();

View File

@ -256,6 +256,7 @@ enum IntervalAlignment {
Q_INVOKABLE QSizeF size() const;
Q_INVOKABLE QRectF rect() const;
Q_INVOKABLE void setActionSeparator(const QString &name);
Q_INVOKABLE void setAction(const QString &name, const QString &text,
const QString &icon = QString(), const QString &shortcut = QString());