kalarm

pickfileradio.h

Go to the documentation of this file.
00001 /*
00002  *  pickfileradio.h  -  radio button with an associated file picker
00003  *  Program:  kalarm
00004  *  Copyright (C) 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 PICKFILERADIO_H
00022 #define PICKFILERADIO_H
00023 
00026 #include "radiobutton.h"
00027 
00028 class QPushButton;
00029 class LineEdit;
00030 
00050 class PickFileRadio : public RadioButton
00051 {
00052         Q_OBJECT
00053     public:
00061         PickFileRadio(QPushButton* button, LineEdit* edit, const QString& text, QButtonGroup* parent, const char* name = 0);
00068         PickFileRadio(const QString& text, QButtonGroup* parent, const char* name = 0);
00073         void            init(QPushButton* button, LineEdit* edit = 0);
00078         virtual void    setReadOnly(bool readOnly);
00084         virtual QString pickFile() = 0;
00090         void            setFile(const QString& file);
00092         QString         file() const;
00094         LineEdit*       fileEdit() const    { return mEdit; }
00096         QPushButton*    pushButton() const  { return mButton; }
00097 
00098     public slots:
00102         virtual void    setEnabled(bool);
00103 
00104     private slots:
00105         void          slotSelectionChanged(int id);
00106         void          slotPickFile();
00107         void          setLastId();
00108 
00109     private:
00110         bool          pickFileIfNone();
00111 
00112         QButtonGroup* mGroup;     // button group which radio button is in
00113         LineEdit*     mEdit;      // file name edit box, or null if none
00114         QPushButton*  mButton;    // push button to pick a file
00115         QString       mFile;      // saved file name (if mEdit is null)
00116         int           mLastId;    // previous radio button selected
00117         bool          mRevertId;  // true to revert to the previous radio button selection
00118 };
00119 
00120 #endif // PICKFILERADIO_H
KDE Home | KDE Accessibility Home | Description of Access Keys