2 * specialactions.h - widget to specify special alarm actions
4 * Copyright © 2004-2010,2012 by David Jarvie <djarvie@kde.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef SPECIALACTIONS_H
22 #define SPECIALACTIONS_H
24 #include <kalarmcal/kaevent.h>
27 #include <QPushButton>
29 using namespace KAlarmCal
;
36 class SpecialActionsButton
: public QPushButton
40 explicit SpecialActionsButton(bool enableCheckboxes
, QWidget
* parent
= Q_NULLPTR
);
41 void setActions(const QString
& pre
, const QString
& post
, KAEvent::ExtraActionOptions
);
42 const QString
& preAction() const { return mPreAction
; }
43 const QString
& postAction() const { return mPostAction
; }
44 KAEvent::ExtraActionOptions
options() const { return mOptions
; }
45 virtual void setReadOnly(bool ro
) { mReadOnly
= ro
; }
46 virtual bool isReadOnly() const { return mReadOnly
; }
49 /** Signal emitted whenever the widget has been changed. */
53 void slotButtonPressed();
58 KAEvent::ExtraActionOptions mOptions
;
59 bool mEnableCheckboxes
;
64 // Pre- and post-alarm actions widget
65 class SpecialActions
: public QWidget
69 explicit SpecialActions(bool enableCheckboxes
, QWidget
* parent
= Q_NULLPTR
);
70 void setActions(const QString
& pre
, const QString
& post
, KAEvent::ExtraActionOptions
);
71 QString
preAction() const;
72 QString
postAction() const;
73 KAEvent::ExtraActionOptions
options() const;
74 void setReadOnly(bool);
75 bool isReadOnly() const { return mReadOnly
; }
78 void slotPreActionChanged(const QString
& text
);
81 QLineEdit
* mPreAction
;
82 QLineEdit
* mPostAction
;
83 CheckBox
* mCancelOnError
;
84 CheckBox
* mDontShowError
;
85 CheckBox
* mExecOnDeferral
;
86 bool mEnableCheckboxes
; // enable checkboxes even if mPreAction is blank
91 // Pre- and post-alarm actions dialog displayed by the push button
92 class SpecialActionsDlg
: public QDialog
96 SpecialActionsDlg(const QString
& preAction
, const QString
& postAction
,
97 KAEvent::ExtraActionOptions
, bool enableCheckboxes
,
98 QWidget
* parent
= Q_NULLPTR
);
99 QString
preAction() const { return mActions
->preAction(); }
100 QString
postAction() const { return mActions
->postAction(); }
101 KAEvent::ExtraActionOptions
options() const { return mActions
->options(); }
102 void setReadOnly(bool ro
) { mActions
->setReadOnly(ro
); }
103 bool isReadOnly() const { return mActions
->isReadOnly(); }
106 void resizeEvent(QResizeEvent
*) Q_DECL_OVERRIDE
;
109 virtual void slotOk();
112 SpecialActions
* mActions
;
115 #endif // SPECIALACTIONS_H