23 #include <tqbuttongroup.h>
24 #include <tqpushbutton.h>
30 #include "pickfileradio.moc"
34 : RadioButton(text, parent, name),
43 mButton->setEnabled(
false);
44 connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile()));
46 mEdit->setEnabled(
false);
47 connect(mGroup, TQT_SIGNAL(buttonSet(
int)), TQT_SLOT(slotSelectionChanged(
int)));
51 : RadioButton(text, parent, name),
66 mButton->setEnabled(
false);
67 connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile()));
69 mEdit->setEnabled(
false);
70 connect(mGroup, TQT_SIGNAL(buttonSet(
int)), TQT_SLOT(slotSelectionChanged(
int)));
80 mEdit->setReadOnly(ro);
95 return mEdit ? mEdit->text() : mFile;
106 enable = enable && mGroup->selected() ==
this;
109 if (!pickFileIfNone())
112 mButton->setEnabled(enable);
114 mEdit->setEnabled(enable);
120 void 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);
145 bool PickFileRadio::pickFileIfNone()
148 mFile = mEdit->text();
149 if (!mFile.isEmpty())
152 return !mFile.isEmpty();
158 void PickFileRadio::slotPickFile()
162 mEdit->setText(mFile);
168 TQTimer::singleShot(0,
this, TQT_SLOT(setLastId()));
175 void PickFileRadio::setLastId()
180 mGroup->setButton(mLastId);