23 #include <kurlrequester.h> 25 #include <tqpushbutton.h> 26 #include <tqlineedit.h> 28 #include <tqfiledialog.h> 33 PUrlEdit::PUrlEdit(Mode mode, MultiProperty* property, TQWidget* parent,
const char* name)
34 :PropertyWidget(property, parent, name)
36 TQHBoxLayout *l =
new TQHBoxLayout(
this, 0, 0);
38 m_edit =
new KURLRequester(
this);
40 m_edit->setMode((KFile::Mode)mode);
41 connect(m_edit, TQT_SIGNAL(textChanged(
const TQString&)),
this, TQT_SLOT(updateProperty(
const TQString&)));
43 m_edit =
new KLineEdit(
this);
44 m_select =
new TQPushButton(
"...",
this);
46 l->addWidget(m_select);
48 connect( m_select, TQT_SIGNAL(clicked()),
this,TQT_SLOT(select()));
50 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
56 return TQVariant(m_edit->url());
58 return TQVariant(m_url);
65 disconnect(m_edit, TQT_SIGNAL(textChanged(
const TQString&)),
this, TQT_SLOT(updateProperty(
const TQString&)));
66 m_edit->setURL(value.toString());
67 connect(m_edit, TQT_SIGNAL(textChanged(
const TQString&)),
this, TQT_SLOT(updateProperty(
const TQString&)));
69 m_edit->setText(value.toString());
75 void PUrlEdit::updateProperty(
const TQString &val)
80 void PUrlEdit::select()
83 TQString path = m_url;
84 if( m_mode == Directory )
85 m_url = TQFileDialog::getExistingDirectory( m_url,
this);
87 m_url = TQFileDialog::getOpenFileName(m_url, TQString(),
this);
88 updateProperty(m_url);
89 m_edit->setText(m_url);
96 #include "purledit.moc" Namespace which contain property editing classes.
virtual TQVariant value() const
virtual void setValue(const TQVariant &value, bool emitChange)
Sets the value shown in the editor widget.
virtual TQVariant value() const