specialactions.h
00001 /* 00002 * specialactions.h - widget to specify special alarm actions 00003 * Program: kalarm 00004 * Copyright © 2004,2005 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 <tqwidget.h> 00026 #include <tqpushbutton.h> 00027 00028 class KLineEdit; 00029 00030 00031 class SpecialActionsButton : public TQPushButton 00032 { 00033 Q_OBJECT 00034 TQ_OBJECT 00035 public: 00036 SpecialActionsButton(const TQString& caption, TQWidget* parent = 0, const char* name = 0); 00037 void setActions(const TQString& pre, const TQString& post); 00038 const TQString& preAction() const { return mPreAction; } 00039 const TQString& postAction() const { return mPostAction; } 00040 virtual void setReadOnly(bool ro) { mReadOnly = ro; } 00041 virtual bool isReadOnly() const { return mReadOnly; } 00042 00043 signals: 00044 void selected(); 00045 00046 protected slots: 00047 void slotButtonPressed(); 00048 00049 private: 00050 TQString mPreAction; 00051 TQString mPostAction; 00052 bool mReadOnly; 00053 }; 00054 00055 00056 // Pre- and post-alarm actions widget 00057 class SpecialActions : public TQWidget 00058 { 00059 Q_OBJECT 00060 TQ_OBJECT 00061 public: 00062 SpecialActions(TQWidget* parent = 0, const char* name = 0); 00063 void setActions(const TQString& pre, const TQString& post); 00064 TQString preAction() const; 00065 TQString postAction() const; 00066 void setReadOnly(bool); 00067 bool isReadOnly() const { return mReadOnly; } 00068 00069 private: 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 TQ_OBJECT 00081 public: 00082 SpecialActionsDlg(const TQString& preAction, const TQString& postAction, 00083 const TQString& caption, TQWidget* parent = 0, const char* name = 0); 00084 TQString preAction() const { return mActions->preAction(); } 00085 TQString postAction() const { return mActions->postAction(); } 00086 void setReadOnly(bool ro) { mActions->setReadOnly(ro); } 00087 bool isReadOnly() const { return mActions->isReadOnly(); } 00088 00089 protected: 00090 virtual void resizeEvent(TQResizeEvent*); 00091 00092 protected slots: 00093 virtual void slotOk(); 00094 00095 private: 00096 SpecialActions* mActions; 00097 }; 00098 00099 #endif // SPECIALACTIONS_H