libtdepim

kscoringeditor.h
1 /*
2  kscoringeditor.h
3 
4  Copyright (c) 2001 Mathias Waack
5  Copyright (C) 2005 by Volker Krause <volker.krause@rwth-aachen.de>
6 
7  Author: Mathias Waack <mathias@atoll-net.de>
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software Foundation,
15  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
16 */
17 
18 #ifndef SCOREEDITWIDGET_H
19 #define SCOREEDITWIDGET_H
20 
21 #include <tqmap.h>
22 #include <kdialogbase.h>
23 #include <tqtable.h>
24 #include <tqframe.h>
25 
26 #include "kwidgetlister.h"
27 
28 #include <tdemacros.h>
29 
30 class KComboBox;
31 class KLineEdit;
32 class KIntSpinBox;
33 class TDEListBox;
34 class TQFrame;
35 class TQLabel;
36 class TQListBoxItem;
37 class TQPushButton;
38 class TQCheckBox;
39 class TQRadioButton;
40 
41 class KScoringRule;
42 class KScoringExpression;
43 class KScoringManager;
44 class ActionBase;
45 class KScoringEditor;
46 class ScoreEditWidget;
47 class KColorCombo;
48 
52 class TDE_EXPORT SingleConditionWidget : public TQFrame
53 {
54  TQ_OBJECT
55 
56  friend class ConditionEditWidget;
57 public:
58  SingleConditionWidget(KScoringManager *,TQWidget *p =0, const char *n =0);
60  void setCondition(KScoringExpression*);
61  KScoringExpression *createCondition() const;
62  void clear();
63 
64 protected slots:
65  void toggleRegExpButton( int );
66  void showRegExpDialog();
67 
68 private:
70  TQCheckBox *neg;
72  KComboBox *headers;
74  KComboBox *matches;
76  KLineEdit *expr;
78  TQPushButton *regExpButton;
79 
80  KScoringManager *manager;
81 };
82 
86 {
87  TQ_OBJECT
88 
89 public:
90  ConditionEditWidget(KScoringManager *,TQWidget *p =0, const char *n =0);
92  TQWidget* createWidget(TQWidget*);
93  void updateRule(KScoringRule*);
94  void clearWidget(TQWidget*);
95 public slots:
96  void slotEditRule(KScoringRule*);
97 private:
98  KScoringManager *manager;
99 };
100 
104 class SingleActionWidget : public TQWidget
105 {
106  TQ_OBJECT
107 
108  friend class ActionEditWidget;
109 public:
110  SingleActionWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
112  void setAction(ActionBase*);
113  ActionBase *createAction() const;
114  void clear();
115 private:
117  KComboBox *types;
119  TQWidgetStack *stack;
121  KLineEdit *notifyEditor;
123  KIntSpinBox *scoreEditor;
125  KColorCombo *colorEditor;
127  TQLabel *dummyLabel;
128 
129  KScoringManager *manager;
130 };
131 
134 class TDE_EXPORT ActionEditWidget : public KWidgetLister
135 {
136  TQ_OBJECT
137 
138 public:
139  ActionEditWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
140  ~ActionEditWidget();
141  TQWidget* createWidget(TQWidget *parent);
142  void updateRule(KScoringRule*);
143  void clearWidget(TQWidget *);
144 public slots:
145  void slotEditRule(KScoringRule *);
146 private:
147  KScoringManager *manager;
148 };
149 
152 class RuleEditWidget : public TQWidget
153 {
154  TQ_OBJECT
155 
156 public:
157  RuleEditWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
158  ~RuleEditWidget();
159 public slots:
160  void setDirty();
161  void slotEditRule(const TQString&);
162  void updateRule(KScoringRule*);
163  void updateRule();
164 signals:
165  void shrink();
166 protected slots:
167  void slotAddGroup();
168  void slotShrink();
169 private slots:
170  void slotExpireEditChanged(int value);
171 private:
172  void clearContents();
173 
174  bool dirty;
176  KLineEdit *ruleNameEdit;
178  KLineEdit *groupsEdit;
180  KComboBox *groupsBox;
182  TQCheckBox *expireCheck;
184  TQLabel *expireLabel;
186  KIntSpinBox *expireEdit;
188  TQRadioButton *linkModeOr, *linkModeAnd;
190  ActionEditWidget *actionEditor;
192  ConditionEditWidget *condEditor;
193 
194  KScoringManager *manager;
195 
196  // the old name of the current rule
197  TQString oldRuleName;
198 };
199 
203 class TDE_EXPORT RuleListWidget : public TQWidget
204 {
205  TQ_OBJECT
206 
207 public:
208  RuleListWidget(KScoringManager *m, bool =false, TQWidget *p =0, const char *n =0);
209  ~RuleListWidget();
210  TQString currentRule() const { return ruleList->currentText(); }
211 protected:
212  void updateButton();
213 
214 signals:
215  void ruleSelected(const TQString&);
216  void ruleEdited(const TQString&);
217  void leavingRule();
218 public slots:
219  void slotRuleSelected(const TQString&);
220  void slotRuleSelected(TQListBoxItem *);
221  void slotRuleSelected(int);
222  void updateRuleList();
223  void updateRuleList(const KScoringRule*);
224  void slotRuleNameChanged(const TQString&,const TQString&);
225 protected slots:
226  void slotGroupFilter(const TQString&);
227  void slotEditRule(TQListBoxItem*);
228  void slotEditRule(const TQString&);
229  void slotEditRule();
230  void slotDelRule();
231  void slotNewRule();
232  void slotCopyRule();
233  void slotRuleUp();
234  void slotRuleDown();
235 
236 private:
238  TDEListBox *ruleList;
240  TQString group;
242  bool alone;
243 
244  KScoringManager *manager;
245 
246  TQPushButton *editRule;
247  TQPushButton *newRule;
248  TQPushButton *delRule;
249  TQPushButton *copyRule;
250  TQPushButton *mRuleUp;
251  TQPushButton *mRuleDown;
252 };
253 
254 class TDE_EXPORT KScoringEditor : public KDialogBase
255 {
256  TQ_OBJECT
257 
258 public:
259  ~KScoringEditor();
260  void setRule(KScoringRule*);
261  static KScoringEditor *createEditor(KScoringManager* m, TQWidget *parent=0, const char *name=0);
262  static KScoringEditor *editor() { return scoreEditor; }
263  void setDirty();
264 protected:
265  KScoringEditor(KScoringManager* m, TQWidget *parent=0, const char *name=0);
266 private:
268  RuleEditWidget* ruleEditor;
270  RuleListWidget *ruleLister;
271 protected slots:
272  void slotShrink();
273  void slotDoShrink();
274  void slotApply();
275  void slotOk();
276  void slotCancel();
277  void slotFinished();
278 private:
279  KScoringManager *manager;
280  ScoreEditWidget *edit;
282  static KScoringEditor *scoreEditor;
283 };
284 
285 class KScoringEditorWidgetDialog : public KDialogBase
286 {
287  TQ_OBJECT
288 
289 public:
290  KScoringEditorWidgetDialog(KScoringManager *m, const TQString& rName, TQWidget *parent=0, const char *name=0);
291 protected slots:
292  void slotApply();
293  void slotOk();
294  void slotShrink();
295  void slotDoShrink();
296 private:
297  RuleEditWidget *ruleEditor;
298  KScoringManager *manager;
299  TQString ruleName;
300 };
301 
302 class TDE_EXPORT KScoringEditorWidget : public TQWidget
303 {
304  TQ_OBJECT
305 
306 public:
307  KScoringEditorWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
308  ~KScoringEditorWidget();
309 protected slots:
310  void slotRuleEdited(const TQString&);
311 private:
312  RuleListWidget *ruleLister;
313  KScoringManager *manager;
314 };
315 
316 
317 #endif // SCOREEDITWIDGET_H
Base class for other Action classes.
Definition: kscoring.h:84
this widget implements the action editor
this widget implements the conditions editor
TQWidget * createWidget(TQWidget *)
Because QT 2.x does not support signals/slots in template classes, we are forced to emulate this by f...
void clearWidget(TQWidget *)
Called to clear a given widget.
Widget that manages a list of other widgets (incl.
Definition: kwidgetlister.h:66
This widget implements the rule editor.
This widget shows a list of rules with buttons for copy, delete aso.
this widget implements an editor for one action.
this widget implements an editor for one condition.