Commit 8943cb2a authored by Laurent Montel's avatar Laurent Montel 😁

Move code to templatescommandmenu

parent 8d06d446
This diff is collapsed.
......@@ -20,8 +20,10 @@
#ifndef TEMPLATESCOMMANDMENU_H
#define TEMPLATESCOMMANDMENU_H
#include <QMap>
#include <QObject>
#include "templateparser_private_export.h"
class KActionMenu;
namespace TemplateParser {
class TEMPLATEPARSER_TESTS_EXPORT TemplatesCommandMenu : public QObject
{
......@@ -29,6 +31,94 @@ class TEMPLATEPARSER_TESTS_EXPORT TemplatesCommandMenu : public QObject
public:
explicit TemplatesCommandMenu(QObject *parent = nullptr);
~TemplatesCommandMenu();
//TODO: apidox for all these enums
enum Command {
CDnl = 1,
CRem,
CInsert,
CSystem,
CQuotePipe,
CQuote,
CQHeaders,
CHeaders,
CTextPipe,
CMsgPipe,
CBodyPipe,
CClearPipe,
CText,
CToAddr,
CToName,
CFromAddr,
CFromName,
CFullSubject,
CMsgId,
COHeader,
CHeader,
COToAddr,
COToName,
COFromAddr,
COFromName,
COFullSubject,
COMsgId,
CDateEn,
CDateShort,
CDate,
CDow,
CTimeLongEn,
CTimeLong,
CTime,
CODateEn,
CODateShort,
CODate,
CODow,
COTimeLongEn,
COTimeLong,
COTime,
CBlank,
CNop,
CClear,
CDebug,
CDebugOff,
CToFName,
CToLName,
CFromFName,
CFromLName,
COToFName,
COToLName,
COFromFName,
COFromLName,
CCursor,
CCCAddr,
CCCName,
CCCFName,
CCCLName,
COCCAddr,
COCCName,
COCCFName,
COCCLName,
COAddresseesAddr,
CSignature,
CQuotePlain,
CQuoteHtml,
CDictionaryLanguage,
CLanguage
};
Q_SIGNALS:
void insertCommand(TemplatesCommandMenu::Command cmd);
void insertCommand(const QString &cmd, int adjustCursor = 0);
public Q_SLOTS:
void slotInsertCommand(TemplatesCommandMenu::Command cmd);
protected:
KActionMenu *mMenu = nullptr;
private:
void fillMenu();
void fillMenuFromActionMap(const QMap<QString, TemplatesCommandMenu::Command> &map, KActionMenu *menu);
};
}
......
......@@ -414,6 +414,15 @@ TemplatesInsertCommandPushButton::TemplatesInsertCommandPushButton(QWidget *pare
fillMenu();
setMenu(mMenu->menu());
setToolTip(
i18nc("@info:tooltip",
"Select a command to insert into the template"));
setWhatsThis(
i18nc("@info:whatsthis",
"Traverse this menu to find a command to insert into the current template "
"being edited. The command will be inserted at the cursor location, "
"so you want to move your cursor to the desired insertion point first."));
}
TemplatesInsertCommandPushButton::~TemplatesInsertCommandPushButton()
......@@ -426,14 +435,6 @@ void TemplatesInsertCommandPushButton::fillMenu()
mMenu = new KActionMenu(i18n("Insert Command"), this);
setToolTip(
i18nc("@info:tooltip",
"Select a command to insert into the template"));
setWhatsThis(
i18nc("@info:whatsthis",
"Traverse this menu to find a command to insert into the current template "
"being edited. The command will be inserted at the cursor location, "
"so you want to move your cursor to the desired insertion point first."));
// ******************************************************
KActionMenu *menu = new KActionMenu(i18n("Original Message"), mMenu);
......
......@@ -31,7 +31,6 @@ public:
explicit TemplatesInsertCommandPushButton(QWidget *parent, const QString &name = QString());
~TemplatesInsertCommandPushButton();
public:
//TODO: apidox for all these enums
enum Command {
CDnl = 1,
......
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