diff --git a/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.cpp b/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.cpp index 2fed45f5..2298814e 100644 --- a/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.cpp +++ b/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.cpp @@ -1,137 +1,131 @@ /* Copyright (C) 2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "plugineditorgrammarcustomtoolsviewinterface.h" #include using namespace MessageComposer; class MessageComposer::PluginEditorGrammarCustomToolsViewInterfacePrivate { public: - PluginEditorGrammarCustomToolsViewInterfacePrivate() - { - } - QWidget *mParentWidget = nullptr; KPIMTextEdit::RichTextComposer *mEditor = nullptr; }; PluginEditorGrammarCustomToolsViewInterface::PluginEditorGrammarCustomToolsViewInterface(QWidget *parent) : PimCommon::CustomToolsViewInterface(parent) , d(new PluginEditorGrammarCustomToolsViewInterfacePrivate) { } -PluginEditorGrammarCustomToolsViewInterface::~PluginEditorGrammarCustomToolsViewInterface() -{ -} +PluginEditorGrammarCustomToolsViewInterface::~PluginEditorGrammarCustomToolsViewInterface() = default; void PluginEditorGrammarCustomToolsViewInterface::setParentWidget(QWidget *parent) { d->mParentWidget = parent; } QWidget *PluginEditorGrammarCustomToolsViewInterface::parentWidget() const { return d->mParentWidget; } KPIMTextEdit::RichTextComposer *PluginEditorGrammarCustomToolsViewInterface::richTextEditor() const { return d->mEditor; } void PluginEditorGrammarCustomToolsViewInterface::setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor) { 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::length() const { return mLength; } void PluginGrammarAction::setLength(int end) { mLength = 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; } QStringList PluginGrammarAction::infoUrls() const { return mInfoUrls; } void PluginGrammarAction::setInfoUrls(const QStringList &urls) { mInfoUrls = urls; } QDebug operator <<(QDebug d, const PluginGrammarAction &t) { d << "start " << t.start(); d << "length " << t.length(); d << "blockId " << t.blockId(); d << "suggestion " << t.suggestions(); d << "replacement " << t.replacement(); d << "urls " << t.infoUrls(); return d; } diff --git a/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.h b/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.h index 9b329f17..c10d3d0e 100644 --- a/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.h +++ b/messagecomposer/src/plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.h @@ -1,86 +1,88 @@ /* Copyright (C) 2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PLUGINEDITORGRAMMARCUSTOMTOOLSVIEWINTERFACE_H #define PLUGINEDITORGRAMMARCUSTOMTOOLSVIEWINTERFACE_H #include #include "messagecomposer_export.h" #include +#include + 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 length() const; void setLength(int length); Q_REQUIRED_RESULT QStringList suggestions() const; void setSuggestions(const QStringList &suggestions); Q_REQUIRED_RESULT int blockId() const; void setBlockId(int blockId); Q_REQUIRED_RESULT QStringList infoUrls() const; void setInfoUrls(const QStringList &urls); private: QStringList mSuggestions; QStringList mInfoUrls; QString mReplacement; int mStart = -1; int mLength = -1; int mBlockId = -1; }; class MESSAGECOMPOSER_EXPORT PluginEditorGrammarCustomToolsViewInterface : public PimCommon::CustomToolsViewInterface { Q_OBJECT public: explicit PluginEditorGrammarCustomToolsViewInterface(QWidget *parent = nullptr); - ~PluginEditorGrammarCustomToolsViewInterface(); + ~PluginEditorGrammarCustomToolsViewInterface() override; void setParentWidget(QWidget *parent); Q_REQUIRED_RESULT QWidget *parentWidget() const; Q_REQUIRED_RESULT KPIMTextEdit::RichTextComposer *richTextEditor() const; void setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor); Q_SIGNALS: void replaceText(const MessageComposer::PluginGrammarAction &act); private: - PluginEditorGrammarCustomToolsViewInterfacePrivate *const d; + const QScopedPointer d; }; } Q_DECLARE_METATYPE(MessageComposer::PluginGrammarAction) MESSAGECOMPOSER_EXPORT QDebug operator <<(QDebug d, const MessageComposer::PluginGrammarAction &t); #endif // PLUGINEDITORGRAMMARCUSTOMTOOLSVIEWINTERFACE_H