File indexing completed on 2025-01-05 04:49:45

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "viewerplugintranslator.h"
0008 #include "viewerplugintranslatorinterface.h"
0009 #include <KActionCollection>
0010 #include <KPluginFactory>
0011 #include <TextTranslator/TranslatorConfigureDialog>
0012 
0013 using namespace MessageViewer;
0014 K_PLUGIN_CLASS_WITH_JSON(ViewerPluginTranslator, "messageviewer_translatorplugin.json")
0015 
0016 ViewerPluginTranslator::ViewerPluginTranslator(QObject *parent, const QList<QVariant> &)
0017     : MessageViewer::ViewerPlugin(parent)
0018 {
0019 }
0020 
0021 ViewerPluginInterface *ViewerPluginTranslator::createView(QWidget *parent, KActionCollection *ac)
0022 {
0023     MessageViewer::ViewerPluginInterface *view = new MessageViewer::ViewerPluginTranslatorInterface(ac, parent);
0024     return view;
0025 }
0026 
0027 QString ViewerPluginTranslator::viewerPluginName() const
0028 {
0029     return QStringLiteral("translator");
0030 }
0031 
0032 void MessageViewer::ViewerPluginTranslator::showConfigureDialog(QWidget *parent)
0033 {
0034     TextTranslator::TranslatorConfigureDialog dialog(parent);
0035     dialog.exec();
0036 }
0037 
0038 bool MessageViewer::ViewerPluginTranslator::hasConfigureDialog() const
0039 {
0040     return true;
0041 }
0042 
0043 #include "viewerplugintranslator.moc"
0044 
0045 #include "moc_viewerplugintranslator.cpp"