Commit 44a28c5e authored by Jonathan Marten's avatar Jonathan Marten
Browse files

webarchiver: Disable the "Create" button if no valid source URL

parent 1c38a978
......@@ -109,9 +109,6 @@ ArchiveDialog::ArchiveDialog(const QUrl &url, QWidget *parent)
Q_ASSERT(m_cancelButton!=nullptr);
connect(m_cancelButton, &QAbstractButton::clicked, this, &QWidget::close);
// TODO: verify user entries, enable/disable button
//enableButtonOk(false);
QWidget *w = new QWidget(this); // main widget
QVBoxLayout *vbl = new QVBoxLayout(w); // main vertical layout
KConfigSkeletonItem *ski; // config for creating widgets
......@@ -121,6 +118,8 @@ ArchiveDialog::ArchiveDialog(const QUrl &url, QWidget *parent)
m_pageUrlReq = new KUrlRequester(url, this);
m_pageUrlReq->setToolTip(i18n("The URL of the page that is to be archived"));
slotSourceUrlChanged(m_pageUrlReq->text());
connect(m_pageUrlReq, &KUrlRequester::textChanged, this, &ArchiveDialog::slotSourceUrlChanged);
fl->addRow(i18n("Source &URL:"), m_pageUrlReq);
fl->addRow(QString(), new QWidget(this));
......@@ -252,6 +251,12 @@ void ArchiveDialog::cleanup()
}
void ArchiveDialog::slotSourceUrlChanged(const QString &text)
{
m_archiveButton->setEnabled(QUrl::fromUserInput(text).isValid());
}
void ArchiveDialog::slotArchiveTypeChanged(int idx)
{
const QString saveType = m_typeCombo->itemData(idx).toString();
......
......@@ -58,6 +58,7 @@ protected:
protected slots:
void slotArchiveTypeChanged(int idx);
void slotSourceUrlChanged(const QString &text);
void slotMessageLinkActivated(const QString &link);
private slots:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment