libkdenetwork Library API Documentation

kscoringeditor.h

00001 /*
00002     kscoringeditor.h
00003 
00004     Copyright (c) 2001 Mathias Waack
00005 
00006     Author: Mathias Waack <mathias@atoll-net.de>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012     You should have received a copy of the GNU General Public License
00013     along with this program; if not, write to the Free Software Foundation,
00014     Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, US
00015 */
00016 
00017 #ifndef SCOREEDITWIDGET_H
00018 #define SCOREEDITWIDGET_H
00019 
00020 #include <qmap.h>
00021 #include <kdialogbase.h>
00022 #include <qtable.h>
00023 #include <qframe.h>
00024 
00025 #include "kwidgetlister.h"
00026 
00027 class KComboBox;
00028 class KLineEdit;
00029 class KIntSpinBox;
00030 class KListBox;
00031 class QFrame;
00032 class QLabel;
00033 class QListBoxItem;
00034 class QPushButton;
00035 class QCheckBox;
00036 class QRadioButton;
00037 
00038 class KScoringRule;
00039 class KScoringExpression;
00040 class KScoringManager;
00041 class ActionBase;
00042 class KScoringEditor;
00043 class ScoreEditWidget;
00044 class KColorCombo;
00045 
00049 class SingleConditionWidget : public QFrame
00050 {
00051   Q_OBJECT
00052   friend class ConditionEditWidget;
00053 public:
00054   SingleConditionWidget(KScoringManager *,QWidget *p =0, const char *n =0);
00055   ~SingleConditionWidget();
00056   void setCondition(KScoringExpression*);
00057   KScoringExpression *createCondition() const;
00058   void clear();
00059 private:
00061   QCheckBox *neg;
00063   KComboBox *headers;
00065   KComboBox *matches;
00067   KLineEdit *expr;
00068 
00069   KScoringManager *manager;
00070 };
00071 
00074 class ConditionEditWidget: public KWidgetLister
00075 {
00076   Q_OBJECT
00077 public:
00078   ConditionEditWidget(KScoringManager *,QWidget *p =0, const char *n =0);
00079   ~ConditionEditWidget();
00080   QWidget* createWidget(QWidget*);
00081   void updateRule(KScoringRule*);
00082   void clearWidget(QWidget*);
00083 public slots:
00084   void slotEditRule(KScoringRule*);
00085 private:
00086   KScoringManager *manager;
00087 };
00088 
00092 class SingleActionWidget : public QWidget
00093 {
00094   Q_OBJECT
00095   friend class ActionEditWidget;
00096 public:
00097   SingleActionWidget(KScoringManager *m,QWidget *p =0, const char *n =0);
00098   ~SingleActionWidget();
00099   void setAction(ActionBase*);
00100   ActionBase *createAction() const;
00101   void clear();
00102 private:
00104   KComboBox *types;
00106   QWidgetStack *stack;
00108   KLineEdit *notifyEditor;
00110   KIntSpinBox *scoreEditor;
00112   KColorCombo *colorEditor;
00114   QLabel *dummyLabel;
00115 
00116   KScoringManager *manager;
00117 };
00118 
00121 class ActionEditWidget : public KWidgetLister
00122 {
00123   Q_OBJECT
00124 public:
00125   ActionEditWidget(KScoringManager *m,QWidget *p =0, const char *n =0);
00126   ~ActionEditWidget();
00127   QWidget* createWidget(QWidget *parent);
00128   void updateRule(KScoringRule*);
00129   void clearWidget(QWidget *);
00130 public slots:
00131   void slotEditRule(KScoringRule *);
00132 private:
00133   KScoringManager *manager;
00134 };
00135 
00138 class RuleEditWidget : public QWidget
00139 {
00140   Q_OBJECT
00141 public:
00142   RuleEditWidget(KScoringManager *m,QWidget *p =0, const char *n =0);
00143   ~RuleEditWidget();
00144 public slots:
00145   void setDirty();
00146   void slotEditRule(const QString&);
00147   void updateRule(KScoringRule*);
00148   void updateRule();
00149 signals:
00150   void shrink();
00151 protected slots:
00152   void slotAddGroup();
00153   void slotShrink();
00154 private:
00155   void clearContents();
00156 
00157   bool dirty;
00159   KLineEdit *ruleNameEdit;
00161   KLineEdit *groupsEdit;
00163   KComboBox *groupsBox;
00165   QCheckBox *expireCheck;
00167   QLabel *expireLabel;
00169   KIntSpinBox *expireEdit;
00171   QRadioButton *linkModeOr, *linkModeAnd;
00173   ActionEditWidget *actionEditor;
00175   ConditionEditWidget *condEditor;
00176 
00177   KScoringManager *manager;
00178 
00179   // the old name of the current rule
00180   QString oldRuleName;
00181 };
00182 
00186 class RuleListWidget : public QWidget
00187 {
00188   Q_OBJECT
00189 public:
00190   RuleListWidget(KScoringManager *m, bool =false, QWidget *p =0, const char *n =0);
00191   ~RuleListWidget();
00192   QString currentRule() const { return ruleList->currentText(); }
00193 protected:
00194   void updateButton();
00195 
00196 signals:
00197   void ruleSelected(const QString&);
00198   void ruleEdited(const QString&);
00199   void leavingRule();
00200 public slots:
00201   void slotRuleSelected(const QString&);
00202   void slotRuleSelected(QListBoxItem *);
00203   void slotRuleSelected(int);
00204   void updateRuleList();
00205   void updateRuleList(const KScoringRule*);
00206   void slotRuleNameChanged(const QString&,const QString&);
00207 protected slots:
00208   void slotGroupFilter(const QString&);
00209   void slotEditRule(QListBoxItem*);
00210   void slotEditRule(const QString&);
00211   void slotEditRule();
00212   void slotDelRule();
00213   void slotNewRule();
00214   void slotCopyRule();
00215 private:
00217   KListBox *ruleList;
00219   QString group;
00221   bool alone;
00222 
00223   KScoringManager *manager;
00224 
00225   QPushButton *editRule;
00226   QPushButton *newRule;
00227   QPushButton *delRule;
00228   QPushButton *copyRule;
00229 };
00230 
00231 class KScoringEditor : public KDialogBase
00232 {
00233   Q_OBJECT
00234 public:
00235   ~KScoringEditor();
00236   void setRule(KScoringRule*);
00237   static KScoringEditor *createEditor(KScoringManager* m, QWidget *parent=0, const char *name=0);
00238   static KScoringEditor *editor() { return scoreEditor; }
00239   void setDirty();
00240 protected:
00241   KScoringEditor(KScoringManager* m, QWidget *parent=0, const char *name=0);
00242 private:
00244   RuleEditWidget* ruleEditor;
00246   RuleListWidget *ruleLister;
00247 protected slots:
00248   void slotShrink();
00249   void slotDoShrink();
00250   void slotApply();
00251   void slotOk();
00252   void slotCancel();
00253   void slotFinished();
00254 private:
00255   KScoringManager *manager;
00256   ScoreEditWidget *edit;
00258   static KScoringEditor *scoreEditor;
00259 };
00260 
00261 class KScoringEditorWidgetDialog : public KDialogBase
00262 {
00263   Q_OBJECT
00264 public:
00265   KScoringEditorWidgetDialog(KScoringManager *m, const QString& rName, QWidget *parent=0, const char *name=0);
00266 protected slots:
00267   void slotApply();
00268   void slotOk();
00269   void slotShrink();
00270   void slotDoShrink();
00271 private:
00272   RuleEditWidget *ruleEditor;
00273   KScoringManager *manager;
00274   QString ruleName;
00275 };
00276 
00277 class KScoringEditorWidget : public QWidget
00278 {
00279   Q_OBJECT
00280 public:
00281   KScoringEditorWidget(KScoringManager *m,QWidget *p =0, const char *n =0);
00282   ~KScoringEditorWidget();
00283 protected slots:
00284   void slotRuleEdited(const QString&);
00285 private:
00286   RuleListWidget *ruleLister;
00287   KScoringManager *manager;
00288 };
00289 
00290 
00291 #endif // SCOREEDITWIDGET_H
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 4 14:39:11 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003