diff main/MainWindow.cpp @ 103:99d44871334b

* better recollection of last opened remote location; remember to offer to save session if modified when opening a new remote location
author Chris Cannam
date Fri, 16 Feb 2007 16:57:15 +0000
parents 32b386dac447
children efc8b5da414a
line wrap: on
line diff
--- a/main/MainWindow.cpp	Fri Feb 16 13:00:17 2007 +0000
+++ b/main/MainWindow.cpp	Fri Feb 16 16:57:15 2007 +0000
@@ -2570,12 +2570,21 @@
 void
 MainWindow::openLocation()
 {
+    QSettings settings;
+    settings.beginGroup("MainWindow");
+    QString lastLocation = settings.value("lastremote", "").toString();
+
     bool ok = false;
     QString text = QInputDialog::getText
         (this, tr("Open Location"),
          tr("Please enter the URL of the location to open:"),
-         QLineEdit::Normal, "", &ok);
-    if (!ok || text.isEmpty()) return;
+         QLineEdit::Normal, lastLocation, &ok);
+
+    if (!ok) return;
+
+    settings.setValue("lastremote", text);
+
+    if (text.isEmpty()) return;
 
     if (openURL(QUrl(text)) == FileOpenFailed) {
         QMessageBox::critical(this, tr("Failed to open location"),
@@ -2606,7 +2615,7 @@
 
     if (path.endsWith("sv")) {
 
-        if (!checkSaveModified()) return ;
+        if (!checkSaveModified()) return;
 
         if (openSessionFile(path) == FileOpenFailed) {
             QMessageBox::critical(this, tr("Failed to open file"),
@@ -2703,6 +2712,8 @@
         return FileOpenFailed;
     }
 
+    if (!checkSaveModified()) return FileOpenCancelled;
+
     QString error;
     closeSession();
     createDocument();