Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b5a337d4 authored by Laurent Montel's avatar Laurent Montel 😁

Update menu

parent af4a9869
......@@ -78,7 +78,7 @@ set(LIBKLEO_LIB_VERSION "5.7.80")
set(AKONADI_LIB_VERSION "5.7.80")
set(INCIDENCEEDITOR_LIB_VERSION "5.7.80")
set(KTNEF_LIB_VERSION "5.7.80")
set(MESSAGELIB_LIB_VERSION "5.7.85")
set(MESSAGELIB_LIB_VERSION "5.7.86")
set(AKONADICALENDAR_LIB_VERSION "5.7.80")
set(CALENDAR_UTILS_VERSION "5.7.80")
set(KPIMTEXTEDIT_LIB_VERSION "5.7.80")
......
......@@ -40,17 +40,17 @@ void InsertTemplateCommandPluginEditorInterface::createAction(KActionCollection
{
mCommandAction = new TemplateParser::TemplatesInsertCommandAction(this);
mCommandAction->setType(TemplateParser::TemplatesCommandMenu::CurrentMessage);
QToolButton *toolButton = new QToolButton;
mToolButton = new QToolButton;
mToolButton->setMenu(mCommandAction->menu());
toolButton->setText(i18n("Insert Template Command..."));
toolButton->setPopupMode(QToolButton::MenuButtonPopup);
mCommandAction->setDefaultWidget(toolButton);
mToolButton->setText(i18n("Insert Template Command..."));
mToolButton->setPopupMode(QToolButton::MenuButtonPopup);
mCommandAction->setDefaultWidget(mToolButton);
ac->addAction(QStringLiteral("insert_template_command"), mCommandAction);
connect(mCommandAction, &TemplateParser::TemplatesInsertCommandAction::triggered, this, &InsertTemplateCommandPluginEditorInterface::slotOpenMenu);
connect(mCommandAction, &TemplateParser::TemplatesInsertCommandAction::insertCommand, this, &InsertTemplateCommandPluginEditorInterface::slotInsertCommand);
MessageComposer::PluginActionType type(mCommandAction, MessageComposer::PluginActionType::ToolBar);
setActionType(type);
toolButton->setMenu(mCommandAction->menu());
}
void InsertTemplateCommandPluginEditorInterface::slotOpenMenu()
......@@ -82,3 +82,14 @@ bool InsertTemplateCommandPluginEditorInterface::reformatText()
//TODO we need to reformat text and change text.
return false;
}
void InsertTemplateCommandPluginEditorInterface::setMessage(const KMime::Message::Ptr &msg)
{
MessageComposer::PluginEditorConvertTextInterface::setMessage(msg);
TemplateParser::TemplatesCommandMenu::MenuTypes type;
type |= TemplateParser::TemplatesCommandMenu::ReplyForwardMessage;
type |= TemplateParser::TemplatesCommandMenu::CurrentMessage;
mCommandAction->setType(type);
mToolButton->setMenu(mCommandAction->menu());
}
......@@ -21,6 +21,7 @@
#define INSERTTEMPLATECOMMANDPLUGINEDITORINTERFACE_H
#include <MessageComposer/PluginEditorConvertTextInterface>
class QToolButton;
namespace TemplateParser {
class TemplatesInsertCommandAction;
}
......@@ -34,7 +35,7 @@ public:
void createAction(KActionCollection *ac) override;
bool convertTextToFormat(MessageComposer::TextPart *textPart) override;
bool reformatText() override;
void setMessage(const KMime::Message::Ptr &) override;
private:
void slotInsertCommand(const QString &cmd, int adjustCursor);
......@@ -43,7 +44,7 @@ private:
QString mCommand;
int mAdjustCursor = 0;
TemplateParser::TemplatesInsertCommandAction *mCommandAction = nullptr;
QToolButton *mToolButton = nullptr;
};
#endif
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