File indexing completed on 2024-04-28 05:11:38

0001 /*
0002     SPDX-FileCopyrightText: 2005 Till Adam <adam@kde.org>
0003     SPDX-FileCopyrightText: 2009 Allen Winter <winter@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "ui_template_management_dialog_base.h"
0011 
0012 #include <QDialog>
0013 namespace IncidenceEditorNG
0014 {
0015 class TemplateManagementDialog : public QDialog
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit TemplateManagementDialog(QWidget *parent, const QStringList &templates, const QString &incidenceType);
0020 
0021 Q_SIGNALS:
0022     /* Emitted whenever the user hits apply, indicating that the currently
0023        selected template should be loaded into to the incidence editor which
0024        triggered this.
0025     */
0026     void loadTemplate(const QString &templateName);
0027 
0028     /* Emitted whenever the user wants to add the current incidence as a
0029        template with the given name.
0030     */
0031     void saveTemplate(const QString &templateName);
0032 
0033     /* Emitted when the dialog changed the list of templates. Calling code
0034        can the replace the list that was handed in with the one this signal
0035        transports.
0036     */
0037     void templatesChanged(const QStringList &templates);
0038 
0039 protected Q_SLOTS:
0040     void slotItemSelected();
0041     void slotAddTemplate();
0042     void slotRemoveTemplate();
0043     void slotApplyTemplate();
0044     void slotOk();
0045 
0046 private:
0047     void slotHelp();
0048     void updateButtons();
0049     Ui::TemplateManagementDialog_base m_base;
0050     QStringList m_templates;
0051     QString m_type;
0052     QString m_newTemplate;
0053     bool m_changed = false;
0054 };
0055 }