KDevelop API Documentation

lib/project/addenvvardlg.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Bernd Gehrmann <bernd@kdevelop.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 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"
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:08 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003