KDevelop API Documentation

buildtools/autotools/addprefixdlg.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2001 by Bernd Gehrmann * 00003 * bernd@kdevelop.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 00012 #include "addprefixdlg.h" 00013 00014 #include <qlabel.h> 00015 #include <qlayout.h> 00016 #include <qpushbutton.h> 00017 #include <kbuttonbox.h> 00018 #include <kfiledialog.h> 00019 #include <klocale.h> 00020 #include <kstdguiitem.h> 00021 00022 AddPrefixDialog::AddPrefixDialog( const QString& nameEdit, const QString& pathEdit, 00023 QWidget *parent, const char *name) 00024 : QDialog(parent, name, true) 00025 { 00026 setCaption(i18n("Add Prefix")); 00027 00028 QLabel *name_label = new QLabel(i18n("&Name:"), this); 00029 name_edit = new QLineEdit(nameEdit, this); 00030 name_edit->setFocus(); 00031 name_label->setBuddy(name_edit); 00032 connect( name_edit, SIGNAL( textChanged ( const QString & ) ), SLOT( slotPrefixChanged() ) ); 00033 00034 QLabel *path_label = new QLabel(i18n("&Path:"), this); 00035 path_edit = new QLineEdit(pathEdit, this); 00036 path_label->setBuddy(path_edit); 00037 QFontMetrics fm(path_edit->fontMetrics()); 00038 path_edit->setMinimumWidth(fm.width('X')*35); 00039 connect( path_edit, SIGNAL( textChanged ( const QString & ) ), SLOT( slotPrefixChanged() ) ); 00040 00041 QVBoxLayout *layout = new QVBoxLayout(this, 10); 00042 00043 QGridLayout *grid = new QGridLayout(2, 2); 00044 layout->addLayout(grid); 00045 grid->addWidget(name_label, 0, 0); 00046 grid->addWidget(name_edit, 0, 1); 00047 grid->addWidget(path_label, 1, 0); 00048 grid->addWidget(path_edit, 1, 1); 00049 00050 QFrame *frame = new QFrame(this); 00051 frame->setFrameStyle(QFrame::HLine | QFrame::Sunken); 00052 layout->addWidget(frame, 0); 00053 00054 KButtonBox *buttonbox = new KButtonBox(this); 00055 buttonbox->addStretch(); 00056 m_pOk = buttonbox->addButton(KStdGuiItem::ok().text()); 00057 QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel().text()); 00058 m_pOk->setDefault(true); 00059 connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) ); 00060 connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); 00061 buttonbox->layout(); 00062 layout->addWidget(buttonbox, 0); 00063 slotPrefixChanged(); 00064 } 00065 00066 00067 AddPrefixDialog::~AddPrefixDialog() 00068 {} 00069 00070 void AddPrefixDialog::slotPrefixChanged() 00071 { 00072 m_pOk->setEnabled( !name_edit->text().isEmpty() && !path_edit->text().isEmpty() ); 00073 } 00074 00075 #include "addprefixdlg.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 Tue Oct 19 08:01:35 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003