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