From a138352d1c8c6ca490aa9cd0a09208d463a5b33f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 27 Feb 2024 15:24:51 +0200 Subject: [PATCH] Puzzle app. Open new window only if current already has been used. --- src/app/puzzle/vpmainwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 1f2b19bb1..872d4501b 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -3552,12 +3552,20 @@ void VPMainWindow::on_actionOpen_triggered() const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr, VAbstractApplication::VApp()->NativeFileDialog()); + if (mPath.isEmpty()) + { + return; + } - if (not mPath.isEmpty()) + if (curFile.isEmpty() && !this->isWindowModified()) + { + VPApplication::VApp()->MainWindow()->LoadFile(mPath); + } + else { VPApplication::VApp()->NewMainWindow()->LoadFile(mPath); - VPApplication::VApp()->PuzzleSettings()->SetPathManualLayouts(QFileInfo(mPath).absolutePath()); } + VPApplication::VApp()->PuzzleSettings()->SetPathManualLayouts(QFileInfo(mPath).absolutePath()); } //---------------------------------------------------------------------------------------------------------------------