Commit e8e56192 authored by Alexander Semke's avatar Alexander Semke
Browse files

Added an action to the context menu of the command entry to show the

documentation("help") for the currently active keyword.
parent 0aaff70f
......@@ -349,11 +349,15 @@ void CommandEntry::populateMenu(QMenu* menu, QPointF pos)
menu->addAction(i18n("Hide Results"), this, &CommandEntry::collapseResults);
if (!command().simplified().isEmpty())
menu->addAction(QIcon::fromTheme(QLatin1String("help-whatsthis")), i18n("Show Help"), this, &CommandEntry::showHelp);
if (m_isExecutionEnabled)
menu->addAction(i18n("Exclude from Execution"), this, &CommandEntry::excludeFromExecution);
menu->addAction(i18n("Add to Execution"), this, &CommandEntry::addToExecution);
......@@ -1553,6 +1557,25 @@ qreal CommandEntry::promptItemWidth()
return m_promptItem->width();
* called when the "Get Help" action is triggered in the context menu.
* requests the worksheet to show the current keyword in the documentation panel.
* the current keyword is either the currenly selected text or the text under
* the cursor if there is no selection.
void CommandEntry::showHelp()
QString keyword;
const QTextCursor& cursor = m_commandItem->textCursor();
if (cursor.hasSelection())
keyword = cursor.selectedText();
keyword = cursor.block().text();
if (!keyword.simplified().isEmpty())
emit worksheet()->requestDocumentation(keyword);
void CommandEntry::excludeFromExecution()
m_isExecutionEnabled = false;
......@@ -165,6 +165,7 @@ class CommandEntry : public WorksheetEntry
void setMidPrompt();
void setHidePrompt();
void showHelp();
static const double VerticalSpacing;
......@@ -427,6 +427,7 @@ void WorksheetEntry::populateMenu(QMenu* menu, QPointF pos)
if (!worksheet()->isRunning() && wantToEvaluate())
menu->addAction(QIcon::fromTheme(QLatin1String("media-playback-start")), i18n("Evaluate Entry"), this, SLOT(evaluate()), 0);
menu->addAction(QIcon::fromTheme(QLatin1String("edit-delete")), i18n("Remove Entry"), this, SLOT(startRemoving()), 0);
worksheet()->populateMenu(menu, mapToScene(pos));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment