File indexing completed on 2025-01-05 04:49:29
0001 /* 0002 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "sharetextplugineditorinterface.h" 0008 #include "sharetexteditorplugin_debug.h" 0009 #include "sharetextpurposemenuwidget.h" 0010 #include <KActionCollection> 0011 #include <KActionMenu> 0012 #include <KLocalizedString> 0013 #include <PimCommon/KActionMenuChangeCase> 0014 #include <TextCustomEditor/RichTextEditor> 0015 0016 #include <QAction> 0017 #include <QMenu> 0018 0019 ShareTextPluginEditorInterface::ShareTextPluginEditorInterface(QObject *parent) 0020 : MessageComposer::PluginEditorInterface(parent) 0021 { 0022 setNeedSelectedText(false); 0023 } 0024 0025 ShareTextPluginEditorInterface::~ShareTextPluginEditorInterface() = default; 0026 0027 void ShareTextPluginEditorInterface::createAction(KActionCollection *ac) 0028 { 0029 auto purposeMenu = new SharetextPurposeMenuWidget(parentWidget(), this); 0030 connect(purposeMenu, &SharetextPurposeMenuWidget::shareError, this, &ShareTextPluginEditorInterface::errorMessage); 0031 connect(purposeMenu, &SharetextPurposeMenuWidget::shareSuccess, this, &ShareTextPluginEditorInterface::successMessage); 0032 0033 auto shareAction = new KActionMenu(i18n("Share Mail Text..."), this); 0034 shareAction->setMenu(purposeMenu->menu()); 0035 shareAction->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); 0036 shareAction->setPopupMode(QToolButton::InstantPopup); 0037 ac->addAction(QStringLiteral("share_text_menu"), shareAction); 0038 purposeMenu->setEditorWidget(this); 0039 MessageComposer::PluginActionType type(shareAction, MessageComposer::PluginActionType::File); 0040 setActionType(type); 0041 } 0042 0043 void ShareTextPluginEditorInterface::exec() 0044 { 0045 // Nothing 0046 } 0047 0048 #include "moc_sharetextplugineditorinterface.cpp"