kalarm

specialactions.h
1 /*
2  * specialactions.h - widget to specify special alarm actions
3  * Program: kalarm
4  * Copyright © 2004,2005 by David Jarvie <software@astrojar.org.uk>
5  *
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.
10  *
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.
15  *
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.
19  */
20 
21 #ifndef SPECIALACTIONS_H
22 #define SPECIALACTIONS_H
23 
24 #include <kdialogbase.h>
25 #include <tqwidget.h>
26 #include <tqpushbutton.h>
27 
28 class KLineEdit;
29 
30 
31 class SpecialActionsButton : public TQPushButton
32 {
33  TQ_OBJECT
34 
35  public:
36  SpecialActionsButton(const TQString& caption, TQWidget* parent = 0, const char* name = 0);
37  void setActions(const TQString& pre, const TQString& post);
38  const TQString& preAction() const { return mPreAction; }
39  const TQString& postAction() const { return mPostAction; }
40  virtual void setReadOnly(bool ro) { mReadOnly = ro; }
41  virtual bool isReadOnly() const { return mReadOnly; }
42 
43  signals:
44  void selected();
45 
46  protected slots:
47  void slotButtonPressed();
48 
49  private:
50  TQString mPreAction;
51  TQString mPostAction;
52  bool mReadOnly;
53 };
54 
55 
56 // Pre- and post-alarm actions widget
57 class SpecialActions : public TQWidget
58 {
59  TQ_OBJECT
60 
61  public:
62  SpecialActions(TQWidget* parent = 0, const char* name = 0);
63  void setActions(const TQString& pre, const TQString& post);
64  TQString preAction() const;
65  TQString postAction() const;
66  void setReadOnly(bool);
67  bool isReadOnly() const { return mReadOnly; }
68 
69  private:
70  KLineEdit* mPreAction;
71  KLineEdit* mPostAction;
72  bool mReadOnly;
73 };
74 
75 
76 // Pre- and post-alarm actions dialogue displayed by the push button
77 class SpecialActionsDlg : public KDialogBase
78 {
79  TQ_OBJECT
80 
81  public:
82  SpecialActionsDlg(const TQString& preAction, const TQString& postAction,
83  const TQString& caption, TQWidget* parent = 0, const char* name = 0);
84  TQString preAction() const { return mActions->preAction(); }
85  TQString postAction() const { return mActions->postAction(); }
86  void setReadOnly(bool ro) { mActions->setReadOnly(ro); }
87  bool isReadOnly() const { return mActions->isReadOnly(); }
88 
89  protected:
90  virtual void resizeEvent(TQResizeEvent*);
91 
92  protected slots:
93  virtual void slotOk();
94 
95  private:
96  SpecialActions* mActions;
97 };
98 
99 #endif // SPECIALACTIONS_H