22 #include <tqpushbutton.h> 23 #include <kbuttonbox.h> 24 #include <tdelocale.h> 25 #include <kstdguiitem.h> 26 #include <tdeversion.h> 28 #include "addenvvardlg.h" 31 AddEnvvarDialog::AddEnvvarDialog(TQWidget *parent,
const char *name)
32 : TQDialog(parent, name, true)
34 setCaption(i18n(
"Add Environment Variable"));
36 TQLabel *varname_label =
new TQLabel(i18n(
"&Name:"),
this);
37 varname_edit =
new KLineEdit(
this);
38 varname_edit->setFocus();
39 varname_label->setBuddy(varname_edit);
41 connect( varname_edit, TQT_SIGNAL( textChanged (
const TQString & ) ),
this, TQT_SLOT( slotTextChanged() ) );
42 TQLabel *value_label =
new TQLabel(i18n(
"&Value:"),
this);
43 value_edit =
new KLineEdit(
this);
44 value_label->setBuddy(value_edit);
45 TQFontMetrics fm(value_edit->fontMetrics());
46 value_edit->setMinimumWidth(fm.width(
'X')*35);
47 connect( value_edit, TQT_SIGNAL( textChanged (
const TQString & ) ),
this, TQT_SLOT( slotTextChanged() ) );
50 TQVBoxLayout *layout =
new TQVBoxLayout(
this, 10);
52 TQGridLayout *grid =
new TQGridLayout(2, 2);
53 layout->addLayout(grid);
54 grid->addWidget(varname_label, 0, 0);
55 grid->addWidget(varname_edit, 0, 1);
56 grid->addWidget(value_label, 1, 0);
57 grid->addWidget(value_edit, 1, 1);
59 TQFrame *frame =
new TQFrame(
this);
60 frame->setFrameStyle(TQFrame::HLine | TQFrame::Sunken);
61 layout->addWidget(frame, 0);
63 KButtonBox *buttonbox =
new KButtonBox(
this);
64 buttonbox->addStretch();
65 m_pOk = buttonbox->addButton( KStdGuiItem::ok());
66 TQPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
67 m_pOk->setDefault(
true);
68 connect( m_pOk, TQT_SIGNAL(clicked()),
this, TQT_SLOT(accept()) );
69 connect( cancel, TQT_SIGNAL(clicked()),
this, TQT_SLOT(reject()) );
71 layout->addWidget(buttonbox, 0);
76 AddEnvvarDialog::~AddEnvvarDialog()
79 void AddEnvvarDialog::slotTextChanged()
81 m_pOk->setEnabled( !varname_edit->text().isEmpty() && !value_edit->text().isEmpty() );
84 #include "addenvvardlg.moc"