Jelajahi Sumber

Fix save for document with name

Diadlo 8 tahun lalu
induk
melakukan
b80ce65df2
1 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 7 2
      source/fb2main.cpp

+ 7 - 2
source/fb2main.cpp

@@ -105,7 +105,9 @@ void FbMainWindow::fileNew()
 void FbMainWindow::fileOpen()
 void FbMainWindow::fileOpen()
 {
 {
     QString filename = QFileDialog::getOpenFileName(this, tr("Open file"), QString(), "Fiction book files (*.fb2)");
     QString filename = QFileDialog::getOpenFileName(this, tr("Open file"), QString(), "Fiction book files (*.fb2)");
-    if (filename.isEmpty()) return;
+    if (filename.isEmpty()) {
+        return;
+    }
 
 
     FbMainWindow * existing = findFbMainWindow(filename);
     FbMainWindow * existing = findFbMainWindow(filename);
     if (existing) {
     if (existing) {
@@ -118,6 +120,7 @@ void FbMainWindow::fileOpen()
     if (isUntitled && !isWindowModified()) {
     if (isUntitled && !isWindowModified()) {
         mainDock->load(filename);
         mainDock->load(filename);
         setCurrentFile(filename);
         setCurrentFile(filename);
+        isUntitled = false;
     } else {
     } else {
         FbMainWindow * other = new FbMainWindow(filename, FB2);
         FbMainWindow * other = new FbMainWindow(filename, FB2);
         other->mainDock->load(filename);
         other->mainDock->load(filename);
@@ -129,7 +132,9 @@ void FbMainWindow::fileOpen()
 bool FbMainWindow::fileSave()
 bool FbMainWindow::fileSave()
 {
 {
     if (isUntitled) {
     if (isUntitled) {
-        return fileSaveAs();
+        bool success = fileSaveAs();
+        isUntitled = success;
+        return success;
     } else {
     } else {
         return saveFile(curFile);
         return saveFile(curFile);
     }
     }