27 #include <QtGui/QLabel>
28 #include <QtGui/QGridLayout>
35 class KLinkDialogPrivate
46 KLinkDialog::KLinkDialog(
QWidget *parent)
47 :
KDialog(parent), d(new KLinkDialogPrivate)
49 setCaption(
i18n(
"Manage Link"));
56 QGridLayout *layout =
new QGridLayout(entries);
58 d->textLabel =
new QLabel(
i18n(
"Link Text:"),
this);
60 d->textLineEdit->setClearButtonShown(
true);
61 d->linkUrlLabel =
new QLabel(
i18n(
"Link URL:"),
this);
63 d->linkUrlLineEdit->setClearButtonShown(
true);
65 layout->addWidget(d->textLabel, 0, 0);
66 layout->addWidget(d->textLineEdit, 0, 1);
67 layout->addWidget(d->linkUrlLabel, 1, 0);
68 layout->addWidget(d->linkUrlLineEdit, 1, 1);
70 setMainWidget(entries);
73 restoreDialogSize(group);
75 d->textLineEdit->setFocus();
76 enableButtonOk(
false );
77 connect(d->textLineEdit, SIGNAL(textChanged(
QString)),
this, SLOT(slotTextChanged(
QString)));
80 KLinkDialog::~KLinkDialog()
83 saveDialogSize(group);
87 void KLinkDialog::slotTextChanged(
const QString &text)
89 enableButtonOk( !text.isEmpty());
92 void KLinkDialog::setLinkText(
const QString &linkText)
94 d->textLineEdit->setText(linkText);
95 if (!linkText.trimmed().isEmpty())
96 d->linkUrlLineEdit->setFocus();
99 void KLinkDialog::setLinkUrl(
const QString &linkUrl)
101 d->linkUrlLineEdit->setText(linkUrl);
105 QString KLinkDialog::linkText()
const
107 return d->textLineEdit->text().trimmed();
110 QString KLinkDialog::linkUrl()
const
112 return d->linkUrlLineEdit->text();
QString i18n(const char *text)
A dialog base class with standard buttons and predefined layouts.
KSharedConfigPtr config()
An enhanced QLineEdit widget for inputting text.
KLineEdit(const QString &string, QWidget *parent=0)
Constructs a KLineEdit object with a default text, a parent, and a name.