diff hgrunner.cpp @ 176:a6ec8d0bdd34

* Add option whether to use extension or not, and show path for it in settings
author Chris Cannam
date Thu, 16 Dec 2010 18:00:12 +0000
parents 6def8bf3be44
children bb89bcd8986b
line wrap: on
line diff
--- a/hgrunner.cpp	Thu Dec 16 17:32:25 2010 +0000
+++ b/hgrunner.cpp	Thu Dec 16 18:00:12 2010 +0000
@@ -64,12 +64,20 @@
 
 void HgRunner::findExtension()
 {
+    QSettings settings;
+    settings.beginGroup("Locations");
+    m_extensionPath = settings.value("extensionpath", "").toString();
+    if (m_extensionPath != "") return;
     m_extensionPath = findInPath("easyhg.py", m_myDirPath, false);
     if (m_extensionPath == "easyhg.py") {
         if (!unbundleExtension()) {
-            m_extensionPath = "";
+            // might have failed because the file already existed
+            if (!QFile(m_extensionPath).exists()) {
+                m_extensionPath = "";
+            }
         }
     }
+    settings.setValue("extensionpath", m_extensionPath);
 }   
 
 bool HgRunner::unbundleExtension()
@@ -338,8 +346,13 @@
         if (action.mayBeInteractive()) {
             params.push_front("ui.interactive=true");
             params.push_front("--config");
-            params.push_front(QString("extensions.easyhg=%1").arg(m_extensionPath));
-            params.push_front("--config");
+
+            QSettings settings;
+            settings.beginGroup("General");
+            if (settings.value("useextension", true).toBool()) {
+                params.push_front(QString("extensions.easyhg=%1").arg(m_extensionPath));
+                params.push_front("--config");
+            }
             interactive = true;
         }