File indexing completed on 2024-04-28 05:11:29
0001 /* 0002 SPDX-FileCopyrightText: 2010 Bertjan Broeksema <broeksema@kde.org> 0003 SPDX-FileCopyrightText: 2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <KCalendarCore/Incidence> 0011 0012 #include <QDialog> 0013 0014 namespace Ui 0015 { 0016 class AlarmDialog; 0017 } 0018 0019 namespace IncidenceEditorNG 0020 { 0021 class AlarmDialog : public QDialog 0022 { 0023 Q_OBJECT 0024 public: 0025 enum Unit { Minutes, Hours, Days }; 0026 0027 enum When { BeforeStart = 0, AfterStart, BeforeEnd, AfterEnd }; 0028 0029 public: 0030 /** 0031 Constructs a new alarm dialog. 0032 @p incidenceType will influence i18n strings, that will be different for to-dos. 0033 */ 0034 explicit AlarmDialog(KCalendarCore::Incidence::IncidenceType incidenceType, QWidget *parent = nullptr); 0035 ~AlarmDialog() override; 0036 void load(const KCalendarCore::Alarm::Ptr &alarm); 0037 void save(const KCalendarCore::Alarm::Ptr &alarm) const; 0038 void setAllowBeginReminders(bool allow); 0039 void setAllowEndReminders(bool allow); 0040 void setOffset(int offset); 0041 void setUnit(Unit unit); 0042 void setWhen(When when); 0043 0044 private: 0045 void fillCombo(); 0046 0047 private: 0048 Ui::AlarmDialog *const mUi; 0049 const KCalendarCore::Incidence::IncidenceType mIncidenceType; 0050 bool mAllowBeginReminders = true; 0051 bool mAllowEndReminders = true; 0052 }; 0053 }