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

0001 /*
0002    SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "quicktextplugineditor.h"
0008 #include "quicktextconfiguredialog.h"
0009 #include "quicktextplugineditorinterface.h"
0010 #include <KPluginFactory>
0011 #include <QPointer>
0012 
0013 K_PLUGIN_CLASS_WITH_JSON(QuickTextPluginEditor, "kmail_quicktextplugin.json")
0014 
0015 QuickTextPluginEditor::QuickTextPluginEditor(QObject *parent, const QList<QVariant> &)
0016     : MessageComposer::PluginEditor(parent)
0017 {
0018 }
0019 
0020 QuickTextPluginEditor::~QuickTextPluginEditor() = default;
0021 
0022 MessageComposer::PluginEditorInterface *QuickTextPluginEditor::createInterface(QObject *parent)
0023 {
0024     auto interface = new QuickTextPluginEditorInterface(parent);
0025     connect(this, &QuickTextPluginEditor::configChanged, interface, &QuickTextPluginEditorInterface::reloadConfig);
0026     return interface;
0027 }
0028 
0029 bool QuickTextPluginEditor::hasStatusBarSupport() const
0030 {
0031     return true;
0032 }
0033 
0034 bool QuickTextPluginEditor::hasConfigureDialog() const
0035 {
0036     return true;
0037 }
0038 
0039 void QuickTextPluginEditor::showConfigureDialog(QWidget *parent)
0040 {
0041     QPointer<QuickTextConfigureDialog> dlg = new QuickTextConfigureDialog(parent);
0042     if (dlg->exec()) {
0043         Q_EMIT configChanged();
0044     }
0045     delete dlg;
0046 }
0047 
0048 bool QuickTextPluginEditor::canProcessKeyEvent() const
0049 {
0050     return true;
0051 }
0052 
0053 #include "quicktextplugineditor.moc"
0054 
0055 #include "moc_quicktextplugineditor.cpp"