23#include <tqbuttongroup.h>
24#include <tqpushbutton.h>
30#include "pickfileradio.moc"
34 : RadioButton(text, parent, name),
43 mButton->setEnabled( false);
44 connect(mButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotPickFile()));
46 mEdit->setEnabled( false);
47 connect(mGroup, TQ_SIGNAL(buttonSet( int)), TQ_SLOT(slotSelectionChanged( int)));
51 : RadioButton(text, parent, name),
66 mButton->setEnabled( false);
67 connect(mButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotPickFile()));
69 mEdit->setEnabled( false);
70 connect(mGroup, TQ_SIGNAL(buttonSet( int)), TQ_SLOT(slotSelectionChanged( int)));
76 RadioButton::setReadOnly(ro);
80 mEdit->setReadOnly(ro);
95 return mEdit ? mEdit->text() : mFile;
105 RadioButton::setEnabled(enable);
106 enable = enable && mGroup->selected() == this;
109 if (!pickFileIfNone())
112 mButton->setEnabled(enable);
114 mEdit->setEnabled(enable);
120void PickFileRadio::slotSelectionChanged( int id)
122 if ( id == mLastId || mRevertId)
124 int radioId = mGroup->id( this);
125 if (mLastId == radioId)
127 mButton->setEnabled( false);
129 mEdit->setEnabled( false);
131 else if ( id == radioId)
133 if (!pickFileIfNone())
135 mButton->setEnabled( true);
137 mEdit->setEnabled( true);
145bool PickFileRadio::pickFileIfNone()
148 mFile = mEdit->text();
149 if (!mFile.isEmpty())
152 return !mFile.isEmpty();
158void PickFileRadio::slotPickFile()
162 mEdit->setText(mFile);
168 TQTimer::singleShot(0, this, TQ_SLOT(setLastId()));
175void PickFileRadio::setLastId()
180 mGroup->setButton(mLastId);
void init(TQPushButton *button, LineEdit *edit=0) Initialises the widget.
PickFileRadio(TQPushButton *button, LineEdit *edit, const TQString &text, TQButtonGroup *parent, const char *name=0) Constructor.
virtual void setEnabled(bool) Enables or disables the radio button, and adjusts the enabled state of the associated browse button a...
void setFile(const TQString &file) Notifies the widget of the currently selected file name.
virtual TQString pickFile()=0 Chooses a file, for example by displaying a file selection dialogue.
virtual void setReadOnly(bool readOnly) Sets whether the radio button and associated widgets are read-only for the user.
TQString file() const Returns the currently selected file name.
|