changeset 553:9c8147c9f245

Fix #354, Remote repo URL should be cleared when starting a new local project
author Chris Cannam
date Fri, 17 Feb 2012 10:58:41 +0000
parents 7663c1c19d47
children 930462068dcc 95877ad67d3e
files src/mainwindow.cpp src/multichoicedialog.cpp src/multichoicedialog.h
diffstat 3 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Thu Feb 16 14:30:46 2012 +0000
+++ b/src/mainwindow.cpp	Fri Feb 17 10:58:41 2012 +0000
@@ -282,6 +282,8 @@
         path = s.value("default").toString();
     }
 
+    std::cerr << "hgQueryPaths: setting m_remoteRepoPath to " << m_remoteRepoPath << " from file " << hgrc.absoluteFilePath() << std::endl;
+    
     m_remoteRepoPath = path;
 
     // We have to do this here, because commandCompleted won't be called
@@ -1484,7 +1486,8 @@
     d->addChoice("remote",
                  tr("<qt><center><img src=\":images/browser-64.png\"><br>Remote repository</center></qt>"),
                  explanation,
-                 MultiChoiceDialog::UrlArg);
+                 MultiChoiceDialog::UrlArg,
+                 true); // default empty
 
     if (d->exec() == QDialog::Accepted) {
 
@@ -3083,10 +3086,8 @@
 
     QSettings settings;
 
-    m_remoteRepoPath = settings.value("remoterepopath", "").toString();
     m_workFolderPath = settings.value("workfolderpath", "").toString();
-    if (!workFolder.exists(m_workFolderPath))
-    {
+    if (!workFolder.exists(m_workFolderPath)) {
         m_workFolderPath = "";
     }
 
--- a/src/multichoicedialog.cpp	Thu Feb 16 14:30:46 2012 +0000
+++ b/src/multichoicedialog.cpp	Fri Feb 17 10:58:41 2012 +0000
@@ -136,13 +136,15 @@
 
 void
 MultiChoiceDialog::addChoice(QString id, QString text,
-                             QString description, ArgType arg)
+                             QString description, ArgType arg,
+                             bool defaultEmpty)
 {
     bool first = (m_texts.empty());
 
     m_texts[id] = text;
     m_descriptions[id] = description;
     m_argTypes[id] = arg;
+    m_defaultEmpty[id] = defaultEmpty;
     
     if (arg != NoArg) {
         m_recentFiles[id] = QSharedPointer<RecentFiles>
@@ -326,6 +328,7 @@
         m_fileLabel->show();
         m_fileCombo->show();
         m_fileCombo->addItems(rf->getRecent());
+        if (m_defaultEmpty[id]) m_fileCombo->lineEdit()->setText("");
         m_browseButton->show();
         break;
 
@@ -334,6 +337,7 @@
         m_fileLabel->show();
         m_fileCombo->show();
         m_fileCombo->addItems(rf->getRecent());
+        if (m_defaultEmpty[id]) m_fileCombo->lineEdit()->setText("");
         m_browseButton->show();
         break;
 
@@ -341,12 +345,14 @@
         m_urlLabel->show();
         m_urlCombo->show();
         m_urlCombo->addItems(rf->getRecent());
+        if (m_defaultEmpty[id]) m_urlCombo->lineEdit()->setText("");
         break;
 
     case UrlToDirectoryArg:
         m_urlLabel->show();
         m_urlCombo->show();
         m_urlCombo->addItems(rf->getRecent());
+        if (m_defaultEmpty[id]) m_urlCombo->lineEdit()->setText("");
         m_fileLabel->setText(tr("&Folder:"));
         m_fileLabel->show();
         m_fileCombo->show();
--- a/src/multichoicedialog.h	Thu Feb 16 14:30:46 2012 +0000
+++ b/src/multichoicedialog.h	Fri Feb 17 10:58:41 2012 +0000
@@ -48,7 +48,8 @@
     };
 
     void addChoice(QString identifier, QString text,
-                   QString description, ArgType arg);
+                   QString description, ArgType arg,
+                   bool defaultEmpty = false);
 
     void setCurrentChoice(QString);
     QString getCurrentChoice();
@@ -71,6 +72,7 @@
     QMap<QString, QString> m_texts;
     QMap<QString, QString> m_descriptions;
     QMap<QString, ArgType> m_argTypes;
+    QMap<QString, bool> m_defaultEmpty;
     QMap<QString, QSharedPointer<RecentFiles> > m_recentFiles;
 
     QString m_currentChoice;