Open the signed document on the page with the new signature

It's still not perfect because it probably won't show the signature
since signatures "usually" go to the bottom of the page and we're only
focusing on that page, which means the beginning which depending on zoom
settings may very well not include the signature, but at least it's
closer
remotes/origin/work/aacid/okular_focus_actions
Albert Astals Cid 5 years ago committed by Albert Astals Cid
parent 8bdc851688
commit ff5f4cbc45
  1. 2
      part/pageview.h
  2. 2
      part/pageviewannotator.cpp
  3. 2
      part/pageviewannotator.h
  4. 6
      part/part.cpp

@ -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;

@ -1049,7 +1049,7 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E
if (!newFilePath.isEmpty()) {
const bool success = static_cast<PickPointEngineSignature *>(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));
}

@ -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();

@ -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);

Loading…
Cancel
Save