diff multichoicedialog.cpp @ 74:10eb97683aa9

* Show branch names even for changes with children, if those children are on a different branch * Pick up remote repo path from local repo via hg paths * Some work towards breaking down files into various groups based on status * Add /usr/local/bin to path for hg (temporary hack I hope)
author Chris Cannam
date Fri, 19 Nov 2010 14:54:19 +0000
parents 121cb1032717
children aaeabc920ca8
line wrap: on
line diff
--- a/multichoicedialog.cpp	Thu Nov 18 18:08:18 2010 +0000
+++ b/multichoicedialog.cpp	Fri Nov 19 14:54:19 2010 +0000
@@ -52,20 +52,24 @@
     f.setPointSize(f.pointSize() * 0.9);
     m_descriptionLabel->setFont(f);
 
-    m_urlLabel = new QLabel(tr("URL:"));
+    m_urlLabel = new QLabel(tr("&URL:"));
     outer->addWidget(m_urlLabel, 3, 0);
 
     m_urlCombo = new QComboBox();
     m_urlCombo->setEditable(true);
+    m_urlLabel->setBuddy(m_urlCombo);
     connect(m_urlCombo, SIGNAL(editTextChanged(const QString &)),
             this, SLOT(urlChanged(const QString &)));
     outer->addWidget(m_urlCombo, 3, 1, 1, 2);
 
-    m_fileLabel = new QLabel(tr("File:"));
+    m_fileLabel = new QLabel(tr("&File:"));
     outer->addWidget(m_fileLabel, 4, 0);
 
     m_fileCombo = new QComboBox();
     m_fileCombo->setEditable(true);
+    m_fileLabel->setBuddy(m_fileCombo);
+    connect(m_fileCombo, SIGNAL(editTextChanged(const QString &)),
+            this, SLOT(fileChanged(const QString &)));
     outer->addWidget(m_fileCombo, 4, 1);
     outer->setColumnStretch(1, 20);
 
@@ -78,7 +82,10 @@
     connect(bbox, SIGNAL(accepted()), this, SLOT(accept()));
     connect(bbox, SIGNAL(rejected()), this, SLOT(reject()));
     outer->addWidget(bbox, 5, 0, 1, 3);
-    
+
+    m_okButton = bbox->button(QDialogButtonBox::Ok);
+    m_okButton->setEnabled(false);
+
     setMinimumWidth(480);
 }
 
@@ -215,6 +222,17 @@
 }
 
 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;
@@ -263,7 +281,7 @@
         break;
 
     case FileArg:
-        m_fileLabel->setText(tr("File:"));
+        m_fileLabel->setText(tr("&File:"));
         m_fileLabel->show();
         m_fileCombo->show();
         m_fileCombo->addItems(rf->getRecent());
@@ -271,7 +289,7 @@
         break;
 
     case DirectoryArg:
-        m_fileLabel->setText(tr("Folder:"));
+        m_fileLabel->setText(tr("&Folder:"));
         m_fileLabel->show();
         m_fileCombo->show();
         m_fileCombo->addItems(rf->getRecent());
@@ -287,7 +305,7 @@
         m_urlLabel->show();
         m_urlCombo->show();
         m_urlCombo->addItems(rf->getRecent());
-        m_fileLabel->setText(tr("Folder:"));
+        m_fileLabel->setText(tr("&Folder:"));
         m_fileLabel->show();
         m_fileCombo->show();
         m_fileCombo->lineEdit()->setText(QDir::homePath());