File indexing completed on 2025-01-05 04:38:27

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "sharetextinterface.h"
0008 #include "purposemenuwidget.h"
0009 
0010 #include <QMenu>
0011 
0012 ShareTextInterface::ShareTextInterface(QObject *parent)
0013     : PluginTextInterface(parent)
0014     , mPurposeMenuWidget(new PurposeMenuWidget(this))
0015 {
0016     connect(mPurposeMenuWidget, &PurposeMenuWidget::errorMessage, this, &ShareTextInterface::errorMessage);
0017     connect(mPurposeMenuWidget, &PurposeMenuWidget::successMessage, this, &ShareTextInterface::successMessage);
0018 }
0019 
0020 ShareTextInterface::~ShareTextInterface() = default;
0021 
0022 void ShareTextInterface::addAction(QMenu *menu)
0023 {
0024     menu->addSeparator();
0025     menu->addMenu(mPurposeMenuWidget->menu());
0026 }
0027 
0028 void ShareTextInterface::setSelectedText(const QString &str)
0029 {
0030     mPurposeMenuWidget->setSelectedText(str);
0031 }
0032 
0033 #include "moc_sharetextinterface.cpp"