[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim-addons] /: Add share text plugin
From: Laurent Montel <null () kde ! org>
Date: 2018-09-28 20:37:15
Message-ID: E1g5zVj-0001NG-BU () code ! kde ! org
[Download RAW message or body]
Git commit d54fe19d6a7e40c5ff4c21e534ee25bde9110057 by Laurent Montel.
Committed on 28/09/2018 at 20:37.
Pushed by mlaurent into branch 'master'.
Add share text plugin
M +1 -0 kdepim-addons.categories
M +1 -0 kmail/editorplugins/CMakeLists.txt
A +19 -0 kmail/editorplugins/sharetext/CMakeLists.txt
A +16 -0 kmail/editorplugins/sharetext/autotests/CMakeLists.txt
A +43 -0 kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.cpp \
[License: GPL (v2+)] A +34 -0 \
kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.h \
[License: GPL (v2+)] A +43 -0 \
kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.cpp [License: \
GPL (v2+)] A +35 -0 \
kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.h [License: GPL \
(v2+)] A +13 -0 kmail/editorplugins/sharetext/kmail_sharetexteditorplugin.json
A +47 -0 kmail/editorplugins/sharetext/sharetextplugineditor.cpp [License: \
GPL (v2+)] A +39 -0 kmail/editorplugins/sharetext/sharetextplugineditor.h \
[License: GPL (v2+)] A +60 -0 \
kmail/editorplugins/sharetext/sharetextplugineditorinterface.cpp [License: GPL \
(v2+)] A +36 -0 kmail/editorplugins/sharetext/sharetextplugineditorinterface.h \
[License: GPL (v2+)] A +44 -0 \
kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp [License: LGPL \
(v2+)] A +38 -0 kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h \
[License: LGPL (v2+)]
https://commits.kde.org/kdepim-addons/d54fe19d6a7e40c5ff4c21e534ee25bde9110057
diff --git a/kdepim-addons.categories b/kdepim-addons.categories
index 44943f5f..5e5878de 100644
--- a/kdepim-addons.categories
+++ b/kdepim-addons.categories
@@ -38,3 +38,4 @@ org.kde.pim.importwizard.nylasmailplugin kdepim-addons \
(importwizard nylasmail p org.kde.pim.importwizard.operaplugin kdepim-addons \
(importwizard opera plugin) IDENTIFIER [OPERAPLUGIN_LOG] \
org.kde.pim.kmail_markdownplugin kdepim-addons (kmail markdonw plugin) IDENTIFIER \
[KMAIL_EDITOR_MARKDOWN_PLUGIN_LOG] org.kde.pim.mailtransport_sendmail kdepim-addons \
(kmailtransport sendmail plugin) IDENTIFIER [MAILTRANSPORT_PLUGIN_LOG] \
+org.kde.pim.kmail_sharetexteditorplugin kdepim-addons (share text editor plugin) \
IDENTIFIER [KMAIL_EDITOR_SHARETEXT_PLUGIN_LOG]
diff --git a/kmail/editorplugins/CMakeLists.txt b/kmail/editorplugins/CMakeLists.txt
index aab0eb45..d8b065a1 100644
--- a/kmail/editorplugins/CMakeLists.txt
+++ b/kmail/editorplugins/CMakeLists.txt
@@ -6,3 +6,4 @@ add_subdirectory(nonbreakingspace)
add_subdirectory(autocorrection)
add_subdirectory(insertemail)
add_subdirectory(insertshorturl)
+add_subdirectory(sharetext)
diff --git a/kmail/editorplugins/sharetext/CMakeLists.txt \
b/kmail/editorplugins/sharetext/CMakeLists.txt new file mode 100644
index 00000000..2d96f39b
--- /dev/null
+++ b/kmail/editorplugins/sharetext/CMakeLists.txt
@@ -0,0 +1,19 @@
+set(kmail_sharetexteditorplugin_SRCS
+ sharetextplugineditor.cpp
+ sharetextplugineditorinterface.cpp
+ sharetextpurposemenuwidget.cpp
+)
+
+ecm_qt_declare_logging_category(kmail_sharetexteditorplugin_SRCS HEADER \
sharetexteditorplugin_debug.h IDENTIFIER KMAIL_EDITOR_SHARETEXT_PLUGIN_LOG \
CATEGORY_NAME org.kde.pim.kmail_sharetexteditorplugin) +
+kcoreaddons_add_plugin(kmail_sharetexteditorplugin JSON \
kmail_sharetexteditorplugin.json SOURCES + ${kmail_sharetexteditorplugin_SRCS} \
INSTALL_NAMESPACE kmail) +
+target_link_libraries(kmail_sharetexteditorplugin
+ KF5::IconThemes KF5::MessageComposer KF5::XmlGui KF5::I18n
+)
+
+if(BUILD_TESTING)
+ add_subdirectory(autotests)
+endif()
+
diff --git a/kmail/editorplugins/sharetext/autotests/CMakeLists.txt \
b/kmail/editorplugins/sharetext/autotests/CMakeLists.txt new file mode 100644
index 00000000..9b63f8f3
--- /dev/null
+++ b/kmail/editorplugins/sharetext/autotests/CMakeLists.txt
@@ -0,0 +1,16 @@
+set(sharetextplugineditor_common_SRCS)
+ecm_qt_declare_logging_category(sharetextplugineditor_common_SRCS HEADER \
sharetexteditorplugin_debug.h IDENTIFIER KMAIL_EDITOR_CHANGECASE_PLUGIN_LOG \
CATEGORY_NAME org.kde.pim.kmail_sharetexteditorplugin) +
+macro(add_kmail_editorplugin_unittest _source _additional)
+ set( _test ${_source} ${_additional} ${sharetextplugineditor_common_SRCS})
+ get_filename_component(_name ${_source} NAME_WE)
+ add_executable( ${_name} ${_test} )
+ add_test(NAME ${_name} COMMAND ${_name} )
+
+ ecm_mark_as_test(kmail_editorplugin-${_name})
+ target_link_libraries( ${_name} Qt5::Test KF5::XmlGui KF5::IconThemes \
KF5::MessageComposer KF5::I18n KF5::PimTextEdit) +endmacro ()
+
+add_kmail_editorplugin_unittest(sharetextplugineditortest.cpp \
"../sharetextplugineditor.cpp;../sharetextplugineditorinterface.cpp;../sharetextpurposemenuwidget.cpp")
+
+add_kmail_editorplugin_unittest(sharetextplugineditorinterfacetest.cpp \
"../sharetextplugineditorinterface.cpp;../sharetextpurposemenuwidget.cpp")
diff --git a/kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.cpp \
b/kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.cpp new \
file mode 100644 index 00000000..22e347bc
--- /dev/null
+++ b/kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.cpp
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2016-2018 Montel Laurent <montel@kde.org>
+
+ 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 "sharetextplugineditorinterfacetest.h"
+#include "../sharetextplugineditorinterface.h"
+#include <KActionCollection>
+#include <QTest>
+
+ShareTextPluginEditorInterfaceTest::ShareTextPluginEditorInterfaceTest(QObject \
*parent) + : QObject(parent)
+{
+}
+
+ShareTextPluginEditorInterfaceTest::~ShareTextPluginEditorInterfaceTest()
+{
+}
+
+void ShareTextPluginEditorInterfaceTest::shouldHaveDefaultValues()
+{
+ ShareTextPluginEditorInterface interface(nullptr);
+ interface.createAction(new KActionCollection(this));
+ MessageComposer::PluginActionType type = interface.actionType();
+ QVERIFY(type.action());
+ QCOMPARE(type.type(), MessageComposer::PluginActionType::Edit);
+}
+
+QTEST_MAIN(ShareTextPluginEditorInterfaceTest)
diff --git a/kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.h \
b/kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.h new \
file mode 100644 index 00000000..7ab4b6e3
--- /dev/null
+++ b/kmail/editorplugins/sharetext/autotests/sharetextplugineditorinterfacetest.h
@@ -0,0 +1,34 @@
+/*
+ Copyright (C) 2016-2018 Montel Laurent <montel@kde.org>
+
+ 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 ShareTextPLUGINEDITORINTERFACETEST_H
+#define ShareTextPLUGINEDITORINTERFACETEST_H
+
+#include <QObject>
+
+class ShareTextPluginEditorInterfaceTest : public QObject
+{
+ Q_OBJECT
+public:
+ explicit ShareTextPluginEditorInterfaceTest(QObject *parent = nullptr);
+ ~ShareTextPluginEditorInterfaceTest();
+private Q_SLOTS:
+ void shouldHaveDefaultValues();
+};
+
+#endif
diff --git a/kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.cpp \
b/kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.cpp new file mode \
100644 index 00000000..88cec88d
--- /dev/null
+++ b/kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.cpp
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2018 Montel Laurent <montel@kde.org>
+
+ 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 "sharetextplugineditortest.h"
+#include "../sharetextplugineditor.h"
+#include <KActionCollection>
+#include <QTest>
+
+ShareTextPluginEditorTest::ShareTextPluginEditorTest(QObject *parent)
+ : QObject(parent)
+{
+}
+
+ShareTextPluginEditorTest::~ShareTextPluginEditorTest()
+{
+}
+
+void ShareTextPluginEditorTest::shouldHaveDefaultValue()
+{
+ ShareTextPluginEditor plugin;
+ QVERIFY(plugin.createInterface(new KActionCollection(this)));
+ QVERIFY(!plugin.hasPopupMenuSupport());
+ QVERIFY(!plugin.hasConfigureDialog());
+ QVERIFY(!plugin.hasToolBarSupport());
+}
+
+QTEST_MAIN(ShareTextPluginEditorTest)
diff --git a/kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.h \
b/kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.h new file mode \
100644 index 00000000..49c1133e
--- /dev/null
+++ b/kmail/editorplugins/sharetext/autotests/sharetextplugineditortest.h
@@ -0,0 +1,35 @@
+/*
+ Copyright (C) 2018 Montel Laurent <montel@kde.org>
+
+ 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 ShareTextPLUGINEDITORTEST_H
+#define ShareTextPLUGINEDITORTEST_H
+
+#include <QObject>
+
+class ShareTextPluginEditorTest : public QObject
+{
+ Q_OBJECT
+public:
+ explicit ShareTextPluginEditorTest(QObject *parent = nullptr);
+ ~ShareTextPluginEditorTest();
+private Q_SLOTS:
+ void shouldHaveDefaultValue();
+};
+
+#endif
diff --git a/kmail/editorplugins/sharetext/kmail_sharetexteditorplugin.json \
b/kmail/editorplugins/sharetext/kmail_sharetexteditorplugin.json new file mode 100644
index 00000000..fe02c39a
--- /dev/null
+++ b/kmail/editorplugins/sharetext/kmail_sharetexteditorplugin.json
@@ -0,0 +1,13 @@
+{
+ "KPlugin": {
+ "Description": "This plugin allows you to change the case of the selected \
text.", + "EnabledByDefault": "false",
+ "Id": "kmailsharetext",
+ "Name": "Share Text",
+ "ServiceTypes": [
+ "KMailEditor/Plugin"
+ ],
+ "Version": "1.0"
+ },
+ "X-KDE-KMailEditor-Order": "1"
+}
diff --git a/kmail/editorplugins/sharetext/sharetextplugineditor.cpp \
b/kmail/editorplugins/sharetext/sharetextplugineditor.cpp new file mode 100644
index 00000000..e4eef55f
--- /dev/null
+++ b/kmail/editorplugins/sharetext/sharetextplugineditor.cpp
@@ -0,0 +1,47 @@
+/*
+ Copyright (C) 2018 Montel Laurent <montel@kde.org>
+
+ 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 "sharetextplugineditor.h"
+#include "sharetextplugineditorinterface.h"
+#include <kpluginfactory.h>
+
+K_PLUGIN_CLASS_WITH_JSON(ShareTextPluginEditor, "kmail_sharetexteditorplugin.json")
+
+ShareTextPluginEditor::ShareTextPluginEditor(QObject *parent, const QList<QVariant> \
&) + : MessageComposer::PluginEditor(parent)
+{
+}
+
+ShareTextPluginEditor::~ShareTextPluginEditor()
+{
+}
+
+bool ShareTextPluginEditor::hasPopupMenuSupport() const
+{
+ return false;
+}
+
+MessageComposer::PluginEditorInterface \
*ShareTextPluginEditor::createInterface(KActionCollection *ac, QObject *parent) +{
+ ShareTextPluginEditorInterface *interface = new \
ShareTextPluginEditorInterface(parent); + interface->createAction(ac);
+ return interface;
+}
+
+#include "sharetextplugineditor.moc"
diff --git a/kmail/editorplugins/sharetext/sharetextplugineditor.h \
b/kmail/editorplugins/sharetext/sharetextplugineditor.h new file mode 100644
index 00000000..8097b25a
--- /dev/null
+++ b/kmail/editorplugins/sharetext/sharetextplugineditor.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2018 Montel Laurent <montel@kde.org>
+
+ 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 SHARETEXTPLUGINEDITOR_H
+#define SHARETEXTPLUGINEDITOR_H
+
+#include <messagecomposer/plugineditor.h>
+
+#include <messagecomposer/plugineditorinterface.h>
+#include <QVariant>
+
+class ShareTextPluginEditor : public MessageComposer::PluginEditor
+{
+ Q_OBJECT
+public:
+ explicit ShareTextPluginEditor(QObject *parent = nullptr, const QList<QVariant> \
& = QList<QVariant>()); + ~ShareTextPluginEditor() override;
+
+ MessageComposer::PluginEditorInterface *createInterface(KActionCollection *ac, \
QObject *parent = nullptr) override; + bool hasPopupMenuSupport() const override;
+};
+
+#endif
diff --git a/kmail/editorplugins/sharetext/sharetextplugineditorinterface.cpp \
b/kmail/editorplugins/sharetext/sharetextplugineditorinterface.cpp new file mode \
100644 index 00000000..f7f853ca
--- /dev/null
+++ b/kmail/editorplugins/sharetext/sharetextplugineditorinterface.cpp
@@ -0,0 +1,60 @@
+/*
+ Copyright (C) 2018 Montel Laurent <montel@kde.org>
+
+ 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 "sharetextplugineditorinterface.h"
+#include "sharetexteditorplugin_debug.h"
+#include "sharetextpurposemenuwidget.h"
+#include <KPIMTextEdit/EditorUtil>
+#include <KPIMTextEdit/RichTextEditor>
+#include <KActionCollection>
+#include <KActionMenuChangeCase>
+#include <KLocalizedString>
+#include <QAction>
+
+ShareTextPluginEditorInterface::ShareTextPluginEditorInterface(QObject *parent)
+ : MessageComposer::PluginEditorInterface(parent)
+{
+ setNeedSelectedText(false);
+}
+
+ShareTextPluginEditorInterface::~ShareTextPluginEditorInterface()
+{
+}
+
+void ShareTextPluginEditorInterface::createAction(KActionCollection *ac)
+{
+ SharetextPurposeMenuWidget *purposeMenu = new \
SharetextPurposeMenuWidget(parentWidget(), this); + if (purposeMenu->menu()) {
+ QAction *shareAction = new QAction(i18n("Share..."), this);
+ shareAction->setMenu(purposeMenu->menu());
+ shareAction->setIcon(QIcon::fromTheme(QStringLiteral("document-share")));
+ ac->addAction(QStringLiteral("share_text_menu"), shareAction);
+ purposeMenu->setEditorWidget(this);
+ MessageComposer::PluginActionType type(shareAction, \
MessageComposer::PluginActionType::Edit); + setActionType(type);
+ } else {
+ delete purposeMenu;
+ }
+}
+
+void ShareTextPluginEditorInterface::exec()
+{
+ //Nothing
+}
+
diff --git a/kmail/editorplugins/sharetext/sharetextplugineditorinterface.h \
b/kmail/editorplugins/sharetext/sharetextplugineditorinterface.h new file mode 100644
index 00000000..785468e5
--- /dev/null
+++ b/kmail/editorplugins/sharetext/sharetextplugineditorinterface.h
@@ -0,0 +1,36 @@
+/*
+ Copyright (C) 2018 Montel Laurent <montel@kde.org>
+
+ 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 SHARETEXTPLUGINEDITORINTERFACE_H
+#define SHARETEXTPLUGINEDITORINTERFACE_H
+
+#include <messagecomposer/plugineditorinterface.h>
+
+class ShareTextPluginEditorInterface : public MessageComposer::PluginEditorInterface
+{
+ Q_OBJECT
+public:
+ explicit ShareTextPluginEditorInterface(QObject *parent = nullptr);
+ ~ShareTextPluginEditorInterface() override;
+
+ void createAction(KActionCollection *ac) override;
+ void exec() override;
+};
+
+#endif
diff --git a/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp \
b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp new file mode 100644
index 00000000..4884c374
--- /dev/null
+++ b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.cpp
@@ -0,0 +1,44 @@
+/*
+ Copyright (C) 2018 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#include "sharetextpurposemenuwidget.h"
+#include "sharetextplugineditorinterface.h"
+#include <KPIMTextEdit/RichTextEditor>
+#include <QDebug>
+SharetextPurposeMenuWidget::SharetextPurposeMenuWidget(QWidget *parentWidget, \
QObject *parent) + : PimCommon::PurposeMenuWidget(parentWidget, parent)
+{
+
+}
+
+SharetextPurposeMenuWidget::~SharetextPurposeMenuWidget()
+{
+}
+
+QByteArray SharetextPurposeMenuWidget::text()
+{
+ if (mInterface) {
+ return mInterface->richTextEditor()->toPlainText().toUtf8();
+ }
+ return {};
+}
+
+void SharetextPurposeMenuWidget::setEditorWidget(ShareTextPluginEditorInterface \
*interface) +{
+ mInterface = interface;
+}
diff --git a/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h \
b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h new file mode 100644
index 00000000..49280a95
--- /dev/null
+++ b/kmail/editorplugins/sharetext/sharetextpurposemenuwidget.h
@@ -0,0 +1,38 @@
+/*
+ Copyright (C) 2018 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SHARETEXTPURPOSEMENUWIDGET_H
+#define SHARETEXTPURPOSEMENUWIDGET_H
+
+#include <PimCommon/PurposeMenuWidget>
+class ShareTextPluginEditorInterface;
+class SharetextPurposeMenuWidget : public PimCommon::PurposeMenuWidget
+{
+ Q_OBJECT
+public:
+ explicit SharetextPurposeMenuWidget(QWidget *parentWidget, QObject *parent = \
nullptr); + ~SharetextPurposeMenuWidget() override;
+
+ QByteArray text() override;
+ void setEditorWidget(ShareTextPluginEditorInterface *interface);
+private:
+ ShareTextPluginEditorInterface *mInterface = nullptr;
+};
+
+#endif // SHARETEXTPURPOSEMENUWIDGET_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic