diff --git a/Pdf4QtViewer/pdfprogramcontroller.cpp b/Pdf4QtViewer/pdfprogramcontroller.cpp index 4ab304c..d0d7656 100644 --- a/Pdf4QtViewer/pdfprogramcontroller.cpp +++ b/Pdf4QtViewer/pdfprogramcontroller.cpp @@ -1900,6 +1900,17 @@ void PDFProgramController::onDocumentReadingFinished() QMessageBox::warning(m_mainWindow, QApplication::applicationDisplayName(), requirementResult.message); } + QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName()); + + settings.beginGroup("LastOpenedDocumentPages"); + QVariant lastOpenedPage = settings.value(m_fileInfo.absoluteFilePath, QVariant()); + settings.endGroup(); + + if (lastOpenedPage.isValid()) + { + m_pdfWidget->getDrawWidgetProxy()->goToPage(lastOpenedPage.toInt()); + } + m_mainWindowInterface->setStatusBarMessage(tr("Document '%1' was successfully loaded!").arg(m_fileInfo.fileName), 4000); break; } @@ -2036,6 +2047,20 @@ void PDFProgramController::setDocument(pdf::PDFModifiedDocument document, bool i void PDFProgramController::closeDocument() { + if (m_pdfDocument && !m_fileInfo.absoluteFilePath.isEmpty()) + { + std::vector pages = m_pdfWidget->getDrawWidget()->getCurrentPages(); + + if (!pages.empty()) + { + QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName()); + + settings.beginGroup("LastOpenedDocumentPages"); + settings.setValue(m_fileInfo.absoluteFilePath, pages.front()); + settings.endGroup(); + } + } + m_signatures.clear(); setDocument(pdf::PDFModifiedDocument(), true); m_pdfDocument.reset(); diff --git a/RELEASES.txt b/RELEASES.txt index b33d00e..a68d0bf 100644 --- a/RELEASES.txt +++ b/RELEASES.txt @@ -1,6 +1,7 @@ CURRENT: - Issue #137: Redaction - Cannot convert '#000000' to color value - Issue #134: Add search bar for actions + - Issue #133: Rectangle selector when choosing the page of the PDF - Issue #129: Cannot compile with lcms 2.16 - Issue #128: Create list of markup annotations - Issue #126: Remove include from main headers