changeset 346:98cf46fb74c1

Merge
author Chris Cannam
date Wed, 16 Mar 2011 10:27:44 +0000
parents ccc55539e066 (diff) 5bf78b23eb10 (current diff)
children 987a094047c9
files mainwindow.cpp
diffstat 5 files changed, 41 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/filestatuswidget.cpp	Wed Mar 16 10:26:56 2011 +0000
+++ b/filestatuswidget.cpp	Wed Mar 16 10:27:44 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	Wed Mar 16 10:26:56 2011 +0000
+++ b/hgrunner.cpp	Wed Mar 16 10:27:44 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	Wed Mar 16 10:26:56 2011 +0000
+++ b/mainwindow.cpp	Wed Mar 16 10:27:44 2011 +0000
@@ -1042,6 +1042,7 @@
 {
     StartupDialog *dlg = new StartupDialog(this);
     if (dlg->exec()) m_firstStart = false;
+    else exit(0);
 }
 
 void MainWindow::open()
@@ -2254,7 +2255,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"));
@@ -2444,7 +2446,11 @@
     m_settingsAct = new QAction(QIcon(":/images/settings.png"), tr("Settings..."), this);
     m_settingsAct -> setStatusTip(tr("View and change application settings"));
 
+#ifdef Q_OS_WIN32
+    m_exitAct = new QAction(QIcon(":/images/exit.png"), tr("Exit"), this);
+#else 
     m_exitAct = new QAction(QIcon(":/images/exit.png"), tr("Quit"), this);
+#endif
     m_exitAct->setShortcuts(QKeySequence::Quit);
     m_exitAct->setStatusTip(tr("Quit EasyMercurial"));
 
@@ -2598,7 +2604,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);
--- a/multichoicedialog.cpp	Wed Mar 16 10:26:56 2011 +0000
+++ b/multichoicedialog.cpp	Wed Mar 16 10:27:44 2011 +0000
@@ -165,17 +165,31 @@
     }
 }
 
+QString
+MultiChoiceDialog::getDefaultPath() const
+{
+    QDir home(QDir::home());
+    QDir dflt;
+
+    dflt = QDir(home.filePath(tr("My Documents")));
+    DEBUG << "testing " << dflt << endl;
+    if (dflt.exists()) return dflt.canonicalPath();
+
+    dflt = QDir(home.filePath(tr("Documents")));
+    DEBUG << "testing " << dflt << endl;
+    if (dflt.exists()) return dflt.canonicalPath();
+
+    DEBUG << "all failed, returning " << home << endl;
+    return home.canonicalPath();
+}
+
 void
 MultiChoiceDialog::browse()
 {
     QString origin = getArgument();
 
     if (origin == "") {
-#ifdef Q_OS_WIN32
-        origin = "c:";
-#else
-        origin = QDir::homePath();
-#endif
+        origin = getDefaultPath();
     }
 
     QString path = origin;
@@ -319,7 +333,7 @@
         m_fileLabel->setText(tr("&Folder:"));
         m_fileLabel->show();
         m_fileCombo->show();
-        m_fileCombo->lineEdit()->setText(QDir::homePath());
+        m_fileCombo->lineEdit()->setText(getDefaultPath());
         m_browseButton->show();
         break;
     }
--- a/multichoicedialog.h	Wed Mar 16 10:26:56 2011 +0000
+++ b/multichoicedialog.h	Wed Mar 16 10:27:44 2011 +0000
@@ -83,6 +83,8 @@
     QLabel *m_urlLabel;
     QComboBox *m_urlCombo;
     QAbstractButton *m_okButton;
+
+    QString getDefaultPath() const;
 };
 
 #endif // MULTICHOICEDIALOG_H