File indexing completed on 2024-12-29 04:54:50

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <PimCommon/TemplateListWidget>
0010 
0011 namespace PimCommon
0012 {
0013 class TemplateManager;
0014 }
0015 
0016 namespace KSieveUi
0017 {
0018 class SieveTemplateListWidget : public PimCommon::TemplateListWidget
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit SieveTemplateListWidget(const QString &configName, QWidget *parent = nullptr);
0023     ~SieveTemplateListWidget() override;
0024 
0025     [[nodiscard]] QList<PimCommon::defaultTemplate> defaultTemplates() override;
0026     [[nodiscard]] bool addNewTemplate(QString &templateName, QString &templateScript) override;
0027     [[nodiscard]] bool modifyTemplate(QString &templateName, QString &templateScript, bool defaultTemplate) override;
0028     void setSieveCapabilities(const QStringList &capabilities);
0029 
0030 protected:
0031     QMimeData *mimeData(const QList<QListWidgetItem *> &items) const override;
0032 
0033 private:
0034     QStringList mCapabilities;
0035     PimCommon::TemplateManager *mTemplateManager = nullptr;
0036 };
0037 
0038 class SieveTemplateWidget : public QWidget
0039 {
0040     Q_OBJECT
0041 public:
0042     explicit SieveTemplateWidget(const QString &title, QWidget *parent = nullptr);
0043     ~SieveTemplateWidget() override;
0044 
0045     void setSieveCapabilities(const QStringList &capabilities);
0046 Q_SIGNALS:
0047     void insertTemplate(const QString &);
0048 
0049 private:
0050     SieveTemplateListWidget *mListTemplate = nullptr;
0051 };
0052 }