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 06eb3f0c authored by Laurent Montel's avatar Laurent Montel 😁

Improve api

parent 42d2b9fa
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.10.48")
set(PIM_VERSION "5.10.49")
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......
......@@ -64,3 +64,67 @@ void PluginEditorGrammarCustomToolsViewInterface::setRichTextEditor(KPIMTextEdit
{
d->mEditor = richTextEditor;
}
PluginGrammarAction::PluginGrammarAction()
{
}
QString PluginGrammarAction::replacement() const
{
return mReplacement;
}
void PluginGrammarAction::setReplacement(const QString &replacement)
{
mReplacement = replacement;
}
int PluginGrammarAction::start() const
{
return mStart;
}
void PluginGrammarAction::setStart(int start)
{
mStart = start;
}
int PluginGrammarAction::end() const
{
return mEnd;
}
void PluginGrammarAction::setEnd(int end)
{
mEnd = end;
}
QStringList PluginGrammarAction::suggestions() const
{
return mSuggestions;
}
void PluginGrammarAction::setSuggestions(const QStringList &suggestions)
{
mSuggestions = suggestions;
}
int PluginGrammarAction::blockId() const
{
return mBlockId;
}
void PluginGrammarAction::setBlockId(int blockId)
{
mBlockId = blockId;
}
QDebug operator <<(QDebug d, const PluginGrammarAction &t)
{
d << "start " << t.start();
d << "end " << t.end();
d << "blockId " << t.blockId();
d << "suggestion " << t.suggestions();
d << "replacement " << t.replacement();
return d;
}
......@@ -22,11 +22,41 @@
#include <PimCommon/CustomToolsViewInterface>
#include "messagecomposer_export.h"
#include <QDebug>
namespace KPIMTextEdit {
class RichTextComposer;
}
namespace MessageComposer {
class PluginEditorGrammarCustomToolsViewInterfacePrivate;
class MESSAGECOMPOSER_EXPORT PluginGrammarAction
{
public:
PluginGrammarAction();
Q_REQUIRED_RESULT QString replacement() const;
void setReplacement(const QString &replacement);
Q_REQUIRED_RESULT int start() const;
void setStart(int start);
Q_REQUIRED_RESULT int end() const;
void setEnd(int end);
Q_REQUIRED_RESULT QStringList suggestions() const;
void setSuggestions(const QStringList &suggestions);
Q_REQUIRED_RESULT int blockId() const;
void setBlockId(int blockId);
private:
QStringList mSuggestions;
QString mReplacement;
int mStart = -1;
int mEnd = -1;
int mBlockId = -1;
};
class MESSAGECOMPOSER_EXPORT PluginEditorGrammarCustomToolsViewInterface : public PimCommon::CustomToolsViewInterface
{
Q_OBJECT
......@@ -40,8 +70,14 @@ public:
Q_REQUIRED_RESULT KPIMTextEdit::RichTextComposer *richTextEditor() const;
void setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor);
Q_SIGNALS:
void replaceText(const MessageComposer::PluginGrammarAction &act);
private:
PluginEditorGrammarCustomToolsViewInterfacePrivate *const d;
};
}
Q_DECLARE_METATYPE(MessageComposer::PluginGrammarAction)
MESSAGECOMPOSER_EXPORT QDebug operator <<(QDebug d, const MessageComposer::PluginGrammarAction &t);
#endif // PLUGINEDITORGRAMMARCUSTOMTOOLSVIEWINTERFACE_H
......@@ -20,6 +20,7 @@
#include "plugineditorgrammarmanager.h"
#include <PimCommon/CustomToolsPlugin>
#include "messagecomposer_debug.h"
#include "plugineditorgrammarcustomtoolsviewinterface.h"
#include <QFileInfo>
#include <QSet>
#include <KPluginLoader>
......@@ -165,6 +166,7 @@ PluginEditorGrammarManager::PluginEditorGrammarManager(QObject *parent)
: QObject(parent)
, d(new MessageComposer::PluginEditorGrammarManagerPrivate(this))
{
qRegisterMetaType<MessageComposer::PluginGrammarAction>();
}
PluginEditorGrammarManager::~PluginEditorGrammarManager()
......
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