23#include <kurlrequester.h>
25#include <tqpushbutton.h>
26#include <tqlineedit.h>
28#include <tqfiledialog.h>
33PUrlEdit::PUrlEdit(Mode mode,
MultiProperty* property, TQWidget* parent,
const char* 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, TQ_SIGNAL(textChanged(
const TQString&)),
this, TQ_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, TQ_SIGNAL(clicked()),
this,TQ_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, TQ_SIGNAL(textChanged(
const TQString&)),
this, TQ_SLOT(updateProperty(
const TQString&)));
66 m_edit->setURL(
value.toString());
67 connect(m_edit, TQ_SIGNAL(textChanged(
const TQString&)),
this, TQ_SLOT(updateProperty(
const TQString&)));
69 m_edit->setText(
value.toString());
75void PUrlEdit::updateProperty(
const TQString &val)
77 emit propertyChanged(m_property, TQVariant(val));
80void 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"
Holds a list of properties with the same name and type.
virtual TQVariant value() const
virtual void setValue(const TQVariant &value, bool emitChange)
Sets the value shown in the editor widget.
Namespace which contain property editing classes.