kalarm

specialactions.h

00001 /*
00002  *  specialactions.h  -  widget to specify special alarm actions
00003  *  Program:  kalarm
00004  *  Copyright (C) 2004 by David Jarvie <software@astrojar.org.uk>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef SPECIALACTIONS_H
00022 #define SPECIALACTIONS_H
00023 
00024 #include <kdialogbase.h>
00025 #include <qgroupbox.h>
00026 #include <qpushbutton.h>
00027 
00028 class KLineEdit;
00029 
00030 
00031 class SpecialActionsButton : public QPushButton
00032 {
00033         Q_OBJECT
00034     public:
00035         SpecialActionsButton(const QString& caption, QWidget* parent = 0, const char* name = 0);
00036         void           setActions(const QString& pre, const QString& post);
00037         const QString& preAction() const      { return mPreAction; }
00038         const QString& postAction() const     { return mPostAction; }
00039         virtual void   setReadOnly(bool ro)   { mReadOnly = ro; }
00040         virtual bool   isReadOnly() const     { return mReadOnly; }
00041 
00042     signals:
00043         void           selected();
00044 
00045     protected slots:
00046         void           slotButtonPressed();
00047 
00048     private:
00049         QString  mPreAction;
00050         QString  mPostAction;
00051         bool     mReadOnly;
00052 };
00053 
00054 
00055 // Pre- and post-alarm actions widget
00056 class SpecialActions : public QGroupBox
00057 {
00058         Q_OBJECT
00059     public:
00060         SpecialActions(QWidget* parent = 0, const char* name = 0);
00061         SpecialActions(const QString& frameLabel, QWidget* parent = 0, const char* name = 0);
00062         void         setActions(const QString& pre, const QString& post);
00063         QString      preAction() const;
00064         QString      postAction() const;
00065         void         setReadOnly(bool);
00066         bool         isReadOnly() const    { return mReadOnly; }
00067 
00068     private:
00069         void         init(const QString& frameLabel);
00070         KLineEdit*   mPreAction;
00071         KLineEdit*   mPostAction;
00072         bool         mReadOnly;
00073 };
00074 
00075 
00076 // Pre- and post-alarm actions dialogue displayed by the push button
00077 class SpecialActionsDlg : public KDialogBase
00078 {
00079         Q_OBJECT
00080     public:
00081         SpecialActionsDlg(const QString& preAction, const QString& postAction,
00082                           const QString& caption, QWidget* parent = 0, const char* name = 0);
00083         QString      preAction() const     { return mActions->preAction(); }
00084         QString      postAction() const    { return mActions->postAction(); }
00085         void         setReadOnly(bool ro)  { mActions->setReadOnly(ro); }
00086         bool         isReadOnly() const    { return mActions->isReadOnly(); }
00087 
00088     protected:
00089         virtual void resizeEvent(QResizeEvent*);
00090 
00091     protected slots:
00092         virtual void slotOk();
00093 
00094     private:
00095         SpecialActions* mActions;
00096 };
00097 
00098 #endif // SPECIALACTIONS_H
KDE Home | KDE Accessibility Home | Description of Access Keys