buildtools/autotools/addprefixdlg.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
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"
This file is part of the documentation for KDevelop Version 3.0.4.