diff multichoicedialog.cpp @ 199:f16fe0db11f3

* Add "Show All Files" toggle to show ignored and clean files * Clear selection when Esc is pressed * Don't delete and recreate the filesystem watcher on stat, just update it
author Chris Cannam
date Mon, 03 Jan 2011 22:02:08 +0000
parents 01580704de3e
children 3d4291d4226c
line wrap: on
line diff
--- a/multichoicedialog.cpp	Mon Jan 03 14:31:22 2011 +0000
+++ b/multichoicedialog.cpp	Mon Jan 03 22:02:08 2011 +0000
@@ -84,7 +84,7 @@
     outer->addWidget(bbox, 5, 0, 1, 3);
 
     m_okButton = bbox->button(QDialogButtonBox::Ok);
-    m_okButton->setEnabled(false);
+    updateOkButton();
 
     setMinimumWidth(480);
 }
@@ -203,6 +203,18 @@
 void
 MultiChoiceDialog::urlChanged(const QString &s)
 {
+    updateOkButton();
+}
+
+void
+MultiChoiceDialog::fileChanged(const QString &s)
+{
+    updateOkButton();
+}
+
+void
+MultiChoiceDialog::updateOkButton()
+{
 /* This doesn't work well
     if (m_argTypes[m_currentChoice] != UrlToDirectoryArg) {
         return;
@@ -231,17 +243,6 @@
 }
 
 void
-MultiChoiceDialog::fileChanged(const QString &s)
-{
-    if (m_argTypes[m_currentChoice] == UrlToDirectoryArg) {
-        m_okButton->setEnabled(getArgument() != "" &&
-                               getAdditionalArgument() != "");
-    } else {
-        m_okButton->setEnabled(getArgument() != "");
-    }
-}
-
-void
 MultiChoiceDialog::choiceChanged()
 {
     DEBUG << "choiceChanged" << endl;
@@ -323,6 +324,7 @@
         break;
     }
 
+    updateOkButton();
     adjustSize();
 }