# HG changeset patch
# User Chris Cannam
# Date 1313592797 -3600
# Node ID a582c6417004c63bbea82c295893480f3bd45b37
# Parent c6ea3eb006359c3c1be188f17df578ae44e80ba2
Some textual updates; include final URL path element in default for local file on clone
diff -r c6ea3eb00635 -r a582c6417004 src/mainwindow.cpp
--- a/src/mainwindow.cpp Tue Aug 16 17:13:35 2011 +0100
+++ b/src/mainwindow.cpp Wed Aug 17 15:53:17 2011 +0100
@@ -2063,7 +2063,7 @@
(this,
tr("Failed to run Mercurial"),
tr("Failed to run Mercurial"),
- tr("The Mercurial program either could not be found or failed to run.
Check that the Mercurial program path is correct in %1.").arg(setstr),
+ tr("The Mercurial program either could not be found or failed to run.
Check that the Mercurial program path is correct in %1.").arg(setstr),
output);
settings(SettingsDialog::PathsTab);
return;
@@ -2166,7 +2166,9 @@
(this,
tr("Command failed"),
tr("Command failed"),
- tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.
See “More Details” for the command output."),
+ (output == "" ?
+ tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.") :
+ tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.
See “More Details” for the command output.")),
output);
}
diff -r c6ea3eb00635 -r a582c6417004 src/multichoicedialog.cpp
--- a/src/multichoicedialog.cpp Tue Aug 16 17:13:35 2011 +0100
+++ b/src/multichoicedialog.cpp Wed Aug 17 15:53:17 2011 +0100
@@ -171,11 +171,15 @@
QDir home(QDir::home());
QDir dflt;
+ dflt = QDir(home.filePath(tr("Documents")));
+ DEBUG << "testing " << dflt << endl;
+ if (dflt.exists()) return dflt.canonicalPath();
+
dflt = QDir(home.filePath(tr("My Documents")));
DEBUG << "testing " << dflt << endl;
if (dflt.exists()) return dflt.canonicalPath();
- dflt = QDir(home.filePath(tr("Documents")));
+ dflt = QDir(home.filePath(tr("Desktop")));
DEBUG << "testing " << dflt << endl;
if (dflt.exists()) return dflt.canonicalPath();
@@ -218,6 +222,7 @@
MultiChoiceDialog::urlChanged(const QString &s)
{
updateOkButton();
+ updateFileComboFromURL();
}
void
@@ -227,16 +232,11 @@
}
void
-MultiChoiceDialog::updateOkButton()
+MultiChoiceDialog::updateFileComboFromURL()
{
-/* This doesn't work well
if (m_argTypes[m_currentChoice] != UrlToDirectoryArg) {
return;
}
- QDir dirPath(m_fileCombo->currentText());
- if (!dirPath.exists()) {
- if (!dirPath.cdUp()) return;
- }
QString url = m_urlCombo->currentText();
if (QRegExp("^\\w+://").indexIn(url) < 0) {
return;
@@ -246,8 +246,23 @@
if (urlDirName == "" || urlDirName == url) {
return;
}
- m_fileCombo->lineEdit()->setText(dirPath.filePath(urlDirName));
-*/
+ QString dirPath = m_fileCombo->currentText();
+ QString defaultPath = getDefaultPath();
+ if (dirPath == defaultPath) {
+ dirPath += QDir::separator() + urlDirName;
+ } else if (dirPath == defaultPath + QDir::separator()) {
+ dirPath += urlDirName;
+ } else {
+ QDir d(dirPath);
+ d.cdUp();
+ dirPath = d.filePath(urlDirName);
+ }
+ m_fileCombo->lineEdit()->setText(dirPath);
+}
+
+void
+MultiChoiceDialog::updateOkButton()
+{
if (m_argTypes[m_currentChoice] == UrlToDirectoryArg) {
m_okButton->setEnabled(getArgument() != "" &&
getAdditionalArgument() != "");
@@ -289,15 +304,17 @@
m_descriptionLabel->setText(m_descriptions[id]);
- m_fileLabel->hide();
- m_fileCombo->hide();
m_browseButton->hide();
+
m_urlLabel->hide();
+ m_urlCombo->clear();
m_urlCombo->hide();
+ m_fileLabel->hide();
+ m_fileCombo->clear();
+ m_fileCombo->hide();
+
QSharedPointer rf = m_recentFiles[id];
- m_fileCombo->clear();
- m_urlCombo->clear();
switch (m_argTypes[id]) {
@@ -334,6 +351,7 @@
m_fileLabel->show();
m_fileCombo->show();
m_fileCombo->lineEdit()->setText(getDefaultPath());
+ updateFileComboFromURL();
m_browseButton->show();
break;
}
diff -r c6ea3eb00635 -r a582c6417004 src/multichoicedialog.h
--- a/src/multichoicedialog.h Tue Aug 16 17:13:35 2011 +0100
+++ b/src/multichoicedialog.h Wed Aug 17 15:53:17 2011 +0100
@@ -65,6 +65,7 @@
void browse();
private:
+ void updateFileComboFromURL();
void updateOkButton();
QMap m_texts;