lib/project/addenvvardlg.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#include <qlabel.h>
00021
#include <qlayout.h>
00022
#include <qpushbutton.h>
00023
#include <kbuttonbox.h>
00024
#include <klocale.h>
00025
#include <kstdguiitem.h>
00026
#include "addenvvardlg.h"
00027
00028
00029 AddEnvvarDialog::AddEnvvarDialog(
QWidget *parent,
const char *name)
00030 :
QDialog(parent, name, true)
00031 {
00032 setCaption(i18n(
"Add Environment Variable"));
00033
00034
QLabel *varname_label =
new QLabel(i18n(
"&Name:"),
this);
00035
varname_edit =
new QLineEdit(
this);
00036
varname_edit->setFocus();
00037 varname_label->setBuddy(
varname_edit);
00038
00039 connect(
varname_edit, SIGNAL( textChanged (
const QString & ) ),
this, SLOT(
slotTextChanged() ) );
00040 QLabel *value_label =
new QLabel(i18n(
"&Value:"),
this);
00041
value_edit =
new QLineEdit(
this);
00042 value_label->setBuddy(
value_edit);
00043
QFontMetrics fm(
value_edit->fontMetrics());
00044
value_edit->setMinimumWidth(fm.width(
'X')*35);
00045 connect(
value_edit, SIGNAL( textChanged (
const QString & ) ),
this, SLOT(
slotTextChanged() ) );
00046
00047
00048
QVBoxLayout *layout =
new QVBoxLayout(
this, 10);
00049
00050
QGridLayout *grid =
new QGridLayout(2, 2);
00051 layout->addLayout(grid);
00052 grid->addWidget(varname_label, 0, 0);
00053 grid->addWidget(
varname_edit, 0, 1);
00054 grid->addWidget(value_label, 1, 0);
00055 grid->addWidget(
value_edit, 1, 1);
00056
00057
QFrame *frame =
new QFrame(
this);
00058 frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
00059 layout->addWidget(frame, 0);
00060
00061
KButtonBox *buttonbox =
new KButtonBox(
this);
00062 buttonbox->
addStretch();
00063
m_pOk = buttonbox->
addButton( KStdGuiItem::ok().
text());
00064
QPushButton *cancel = buttonbox->
addButton(KStdGuiItem::cancel().
text());
00065
m_pOk->setDefault(
true);
00066 connect(
m_pOk, SIGNAL(clicked()),
this, SLOT(accept()) );
00067 connect( cancel, SIGNAL(clicked()),
this, SLOT(reject()) );
00068 buttonbox->
layout();
00069 layout->addWidget(buttonbox, 0);
00070
slotTextChanged();
00071 }
00072
00073
00074 AddEnvvarDialog::~AddEnvvarDialog()
00075 {}
00076
00077 void AddEnvvarDialog::slotTextChanged()
00078 {
00079
m_pOk->setEnabled( !
varname_edit->text().isEmpty() && !
value_edit->text().isEmpty() );
00080 }
00081
00082
#include "addenvvardlg.moc"
This file is part of the documentation for KDevelop Version 3.0.4.