diff --git a/part/pageview.h b/part/pageview.h index 29faa26a1..6ea741a76 100644 --- a/part/pageview.h +++ b/part/pageview.h @@ -143,7 +143,7 @@ Q_SIGNALS: void escPressed(); void fitWindowToPage(const QSize pageViewPortSize, const QSize pageSize); void triggerSearch(const QString &text); - void requestOpenFile(const QString &filePath); + void requestOpenFile(const QString &filePath, int pageNumber); protected: bool event(QEvent *event) override; diff --git a/part/pageviewannotator.cpp b/part/pageviewannotator.cpp index b9a0d10c1..575be6b29 100644 --- a/part/pageviewannotator.cpp +++ b/part/pageviewannotator.cpp @@ -1049,7 +1049,7 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E if (!newFilePath.isEmpty()) { const bool success = static_cast(m_engine)->sign(newFilePath); if (success) { - emit requestOpenFile(newFilePath); + emit requestOpenFile(newFilePath, m_lockedItem->pageNumber() + 1); } else { KMessageBox::error(m_pageView, i18nc("%1 is a file path", "Could not sign. Invalid certificate password or could not write to '%1'", newFilePath)); } diff --git a/part/pageviewannotator.h b/part/pageviewannotator.h index e19c31131..eff1f4e67 100644 --- a/part/pageviewannotator.h +++ b/part/pageviewannotator.h @@ -139,7 +139,7 @@ public Q_SLOTS: Q_SIGNALS: void toolSelected(); - void requestOpenFile(const QString &filePath); + void requestOpenFile(const QString &filePath, int pageNumber); private: void reparseBuiltinToolsConfig(); diff --git a/part/part.cpp b/part/part.cpp index f99c74724..9c75f5674 100644 --- a/part/part.cpp +++ b/part/part.cpp @@ -503,10 +503,12 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList &args) connect(m_miniBar, &MiniBar::forwardKeyPressEvent, m_pageView, &PageView::externalKeyPressEvent); connect(m_pageView.data(), &PageView::escPressed, m_findBar, &FindBar::resetSearch); connect(m_pageNumberTool, &MiniBar::forwardKeyPressEvent, m_pageView, &PageView::externalKeyPressEvent); - connect(m_pageView.data(), &PageView::requestOpenFile, this, [this](const QString &filePath) { + connect(m_pageView.data(), &PageView::requestOpenFile, this, [this](const QString &filePath, int pageNumber) { // We cheat a bit here reusing the urlsDropped signal, but at the end the output is the same, we want to open some files // urlsDropped should have just had a different name - Q_EMIT urlsDropped({QUrl::fromLocalFile(filePath)}); + QUrl u = QUrl::fromLocalFile(filePath); + u.setFragment(QStringLiteral("page=%1").arg(pageNumber)); + Q_EMIT urlsDropped({u}); }); connect(m_reviewsWidget.data(), &Reviews::openAnnotationWindow, m_pageView.data(), &PageView::openAnnotationWindow);