Commit 12e02fca authored by Laurent Montel's avatar Laurent Montel 😁

Fix enable/disable action

parent bbfbded4
......@@ -62,12 +62,19 @@ void MarkdownInterface::createAction(KActionCollection *ac)
mPopupMenuAction = new QAction(i18n("Markdown Action"), this);
QMenu *mardownMenu = new QMenu;
mardownMenu->addAction(i18n("Add Title"), this, &MarkdownInterface::addTitle);
mPopupMenuAction->setMenu(mardownMenu);
mPopupMenuAction->setEnabled(false);
mardownMenu->addAction(i18n("Add Title"), this, &MarkdownInterface::addTitle);
mardownMenu->addAction(i18n("Horizontal Rule"), this, &MarkdownInterface::addHorizontalRule);
MessageComposer::PluginActionType typePopup(mPopupMenuAction, MessageComposer::PluginActionType::PopupMenu);
addActionType(typePopup);
}
void MarkdownInterface::addHorizontalRule()
{
}
void MarkdownInterface::addTitle()
{
......@@ -113,6 +120,7 @@ void MarkdownInterface::enableDisablePluginActions(bool richText)
{
if (mAction) {
mAction->setEnabled(!richText);
mPopupMenuAction->setEnabled(!richText && mAction->isChecked());
}
}
......@@ -141,4 +149,5 @@ void MarkdownInterface::slotActivated(bool checked)
mDialog->hide();
}
mStatusBarLabel->setText(checked ? i18n("Markdown") : QString());
mPopupMenuAction->setEnabled(checked);
}
......@@ -43,6 +43,7 @@ public Q_SLOTS:
private:
void addTitle();
void addHorizontalRule();
void slotActivated(bool checked);
QAction *mAction = nullptr;
QAction *mPopupMenuAction = nullptr;
......
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