]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/gui/urlinputdialog.cpp
"Open" button is disabled not when no URL was entered.
[toast/confclerk.git] / src / gui / urlinputdialog.cpp
index 20f138e2b5c0ae7b36c60c3ffcc610be8c2240a2..c413d150cbada3d121de4c305b0b121bc2545126 100644 (file)
@@ -28,10 +28,12 @@ UrlInputDialog::UrlInputDialog(QWidget* parent)
     setupUi(this);
 
     QPushButton* openFile = buttons->addButton("Open File...", QDialogButtonBox::ActionRole);
+    textChanged(urlEntry->text());
 
     connect(openFile, SIGNAL(clicked()), SLOT(openFileClicked()));
     connect(buttons, SIGNAL(accepted()), SLOT(acceptClicked()));
     connect(buttons, SIGNAL(rejected()), SLOT(rejectClicked()));
+    connect(urlEntry, SIGNAL(textChanged(QString)), SLOT(textChanged(QString)));
 }
 
 void UrlInputDialog::openFileClicked()
@@ -46,6 +48,11 @@ void UrlInputDialog::openFileClicked()
     }
 }
 
+void UrlInputDialog::textChanged(const QString& text)
+{
+    buttons->button(QDialogButtonBox::StandardButton::Open)->setEnabled(!text.isEmpty());
+}
+
 void UrlInputDialog::acceptClicked()
 {
     saved_result = urlEntry->text();