changeset 340:bb189827f6d1

Disable "Show All Files" when there's no repo; refuse to run Hg commands without working dir; increase first-start window size a bit
author Chris Cannam
date Tue, 15 Mar 2011 12:00:31 +0000
parents 8b244f3b3111
children 1fc2e0269ae0 3824e8bb91eb
files filestatuswidget.cpp hgrunner.cpp mainwindow.cpp
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/filestatuswidget.cpp	Tue Mar 15 11:45:53 2011 +0000
+++ b/filestatuswidget.cpp	Tue Mar 15 12:00:31 2011 +0000
@@ -157,6 +157,7 @@
     layout->addItem(new QSpacerItem(8, 8), ++row, 0);
 
     m_showAllFiles = new QCheckBox(tr("Show all files"), this);
+    m_showAllFiles->setEnabled(false);
     layout->addWidget(m_showAllFiles, ++row, 0, Qt::AlignLeft);
     connect(m_showAllFiles, SIGNAL(toggled(bool)),
             this, SIGNAL(showAllChanged(bool)));
@@ -365,6 +366,9 @@
                 << endl;
         delete m_dateReference;
         m_dateReference = 0;
+        m_showAllFiles->setEnabled(false);
+    } else {
+        m_showAllFiles->setEnabled(true);
     }
 }
 
--- a/hgrunner.cpp	Tue Mar 15 11:45:53 2011 +0000
+++ b/hgrunner.cpp	Tue Mar 15 12:00:31 2011 +0000
@@ -381,6 +381,12 @@
     bool interactive = false;
     QStringList params = action.params;
 
+    if (action.workingDir.isEmpty()) {
+        // We require a working directory, never just operate in pwd
+        emit commandFailed(action, "EasyMercurial: No working directory supplied, will not run Mercurial command without one");
+        return;
+    }
+
     QSettings settings;
     settings.beginGroup("General");
 
@@ -443,9 +449,7 @@
     connect(m_proc, SIGNAL(readyReadStandardError()),
             this, SLOT(dataReadyStderr()));
 
-    if (!action.workingDir.isEmpty()) {
-        m_proc->setWorkingDirectory(action.workingDir);
-    }
+    m_proc->setWorkingDirectory(action.workingDir);
 
     if (interactive) {
         openTerminal();
--- a/mainwindow.cpp	Tue Mar 15 11:45:53 2011 +0000
+++ b/mainwindow.cpp	Tue Mar 15 12:00:31 2011 +0000
@@ -2254,7 +2254,8 @@
     DEBUG << "MainWindow::enableDisableActions" << endl;
 
     QString dirname = QDir(m_workFolderPath).dirName();
-    if (dirname != "") {
+
+    if (m_workFolderPath != "") { // dirname of "" is ".", so test path instead
         setWindowTitle(tr("EasyMercurial: %1").arg(dirname));
     } else {
         setWindowTitle(tr("EasyMercurial"));
@@ -2598,7 +2599,7 @@
     }
 
     QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
-    QSize size = settings.value("size", QSize(400, 400)).toSize();
+    QSize size = settings.value("size", QSize(550, 550)).toSize();
     m_firstStart = settings.value("firststart", QVariant(true)).toBool();
 
     resize(size);