Commit 7877a4aa authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Update enable ok button

parent 9af6695a
Pipeline #136962 passed with stage
in 26 minutes and 3 seconds
......@@ -6,6 +6,7 @@
#include "openurlwithconfigurecreatedialog.h"
#include <KLocalizedString>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
OpenUrlWithConfigureCreateDialog::OpenUrlWithConfigureCreateDialog(QWidget *parent)
......@@ -25,6 +26,11 @@ OpenUrlWithConfigureCreateDialog::OpenUrlWithConfigureCreateDialog(QWidget *pare
connect(buttonBox, &QDialogButtonBox::accepted, this, &OpenUrlWithConfigureCreateDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &OpenUrlWithConfigureCreateDialog::reject);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setEnabled(false);
connect(mOpenUrlWithCreateWidget, &OpenUrlWithConfigureCreateWidget::updateOkButton, this, [okButton](bool enabled) {
okButton->setEnabled(enabled);
});
}
OpenUrlWithConfigureCreateDialog::~OpenUrlWithConfigureCreateDialog()
......
......@@ -55,8 +55,8 @@ OpenUrlWithConfigureCreateWidget::OpenUrlWithConfigureCreateWidget(QWidget *pare
mExecutable->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly);
mExecutable->lineEdit()->setClearButtonEnabled(true);
mainLayout->addRow(i18n("Executable:"), mExecutable);
// connect(mName, &QLineEdit::textChanged, this, &ViewerPluginExternalEditWidget::slotInfoChanged);
// connect(mExecutable->lineEdit(), &QLineEdit::textChanged, this, &ViewerPluginExternalEditWidget::slotInfoChanged);
connect(mServerName, &QLineEdit::textChanged, this, &OpenUrlWithConfigureCreateWidget::slotInfoChanged);
connect(mExecutable->lineEdit(), &QLineEdit::textChanged, this, &OpenUrlWithConfigureCreateWidget::slotInfoChanged);
}
OpenUrlWithConfigureCreateWidget::~OpenUrlWithConfigureCreateWidget()
......@@ -90,3 +90,8 @@ bool OpenUrlWithConfigureCreateWidget::OpenUrlWithInfo::isValid() const
{
return !url.trimmed().isEmpty() && !command.trimmed().isEmpty();
}
void OpenUrlWithConfigureCreateWidget::slotInfoChanged()
{
Q_EMIT updateOkButton(!mServerName->text().trimmed().isEmpty() && !mExecutable->text().trimmed().isEmpty());
}
......@@ -25,8 +25,12 @@ public:
Q_REQUIRED_RESULT OpenUrlWithInfo info() const;
void setInfo(const OpenUrlWithInfo &i);
Q_SIGNALS:
void updateOkButton(bool enabled);
private:
void slotLinkClicked(const QString &link);
void slotInfoChanged();
QString mCommandWhatsThis;
QLineEdit *const mServerName;
QLineEdit *const mCommandLine;
......
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