diff main/main.cpp @ 82:d82e332cb178

* Fix #1491849 strange behaviour on Cancel during query on new file load
author Chris Cannam
date Fri, 05 Jan 2007 12:59:51 +0000
parents c1318aac18d2
children 0d2fb43b5ee5
line wrap: on
line diff
--- a/main/main.cpp	Fri Jan 05 12:37:14 2007 +0000
+++ b/main/main.cpp	Fri Jan 05 12:59:51 2007 +0000
@@ -150,7 +150,7 @@
 
     for (QStringList::iterator i = args.begin(); i != args.end(); ++i) {
 
-        bool success = false;
+        MainWindow::FileOpenStatus status = MainWindow::FileOpenSucceeded;
 
         if (i == args.begin()) continue;
         if (i->startsWith('-')) continue;
@@ -159,25 +159,25 @@
 
         if (path.endsWith("sv")) {
             if (!haveSession) {
-                success = gui.openSessionFile(path);
-                if (success) {
+                status = gui.openSessionFile(path);
+                if (status == MainWindow::FileOpenSucceeded) {
                     haveSession = true;
                     haveMainModel = true;
                 }
             } else {
                 std::cerr << "WARNING: Ignoring additional session file argument \"" << path.toStdString() << "\"" << std::endl;
-                success = true;
+                status = MainWindow::FileOpenSucceeded;
             }
         }
-        if (!success) {
+        if (status != MainWindow::FileOpenSucceeded) {
             if (!haveMainModel) {
-                success = gui.openSomeFile(path, MainWindow::ReplaceMainModel);
-                if (success) haveMainModel = true;
+                status = gui.openSomeFile(path, MainWindow::ReplaceMainModel);
+                if (status == MainWindow::FileOpenSucceeded) haveMainModel = true;
             } else {
-                success = gui.openSomeFile(path, MainWindow::CreateAdditionalModel);
+                status = gui.openSomeFile(path, MainWindow::CreateAdditionalModel);
             }
         }
-        if (!success) {
+        if (status == MainWindow::FileOpenFailed) {
 	    QMessageBox::critical
                 (&gui, QMessageBox::tr("Failed to open file"),
                  QMessageBox::tr("File \"%1\" could not be opened").arg(path));