Support SaveAs action

If a new enough (unreleases as of now) poppler is available

BUGS: 451010
remotes/origin/work/fhek/foreground_background_text
Albert Astals Cid 4 years ago
parent 1d64fea660
commit 1aa175cf3f
  1. 3
      core/action.h
  2. 3
      core/document.cpp
  3. 7
      core/document.h
  4. 9
      generators/poppler/CMakeLists.txt
  5. 3
      generators/poppler/config-okular-poppler.h.cmake
  6. 4
      generators/poppler/generator_pdf.cpp
  7. 1
      part/part.cpp

@ -293,7 +293,8 @@ public:
Find = 10, ///< Open find dialog Find = 10, ///< Open find dialog
GoToPage = 11, ///< Goto page GoToPage = 11, ///< Goto page
Close = 12, ///< Close document Close = 12, ///< Close document
Print = 13 ///< Print the document @since 22.04 Print = 13, ///< Print the document @since 22.04
SaveAs = 14 ///< SaveAs the document @since 22.04
}; };
/** /**

@ -4018,6 +4018,9 @@ void Document::processAction(const Action *action)
case DocumentAction::Print: case DocumentAction::Print:
emit requestPrint(); emit requestPrint();
break; break;
case DocumentAction::SaveAs:
emit requestSaveAs();
break;
} }
} break; } break;

@ -1133,6 +1133,13 @@ Q_SIGNALS:
*/ */
void requestPrint(); void requestPrint();
/**
* This signal is emitted whenever an action requests a
* document save as operation.
* @since 22.04
*/
void requestSaveAs();
/** /**
* This signal is emitted whenever an action requests an * This signal is emitted whenever an action requests an
* application quit operation. * application quit operation.

@ -66,6 +66,15 @@ int main()
} }
" HAVE_POPPLER_22_02) " HAVE_POPPLER_22_02)
check_cxx_source_compiles("
#include <poppler-qt5.h>
#include <poppler-form.h>
int main()
{
(void)Poppler::LinkAction::SaveAs;
}
" HAVE_POPPLER_22_04)
configure_file( configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h ${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h

@ -15,3 +15,6 @@
/* Defined if we have the 22.02 version of the Poppler library or later */ /* Defined if we have the 22.02 version of the Poppler library or later */
#cmakedefine HAVE_POPPLER_22_02 1 #cmakedefine HAVE_POPPLER_22_02 1
/* Defined if we have the 22.04 version of the Poppler library or later */
#cmakedefine HAVE_POPPLER_22_04 1

@ -367,6 +367,10 @@ static Okular::DocumentAction::DocumentActionType popplerToOkular(Poppler::LinkA
return Okular::DocumentAction::Close; return Okular::DocumentAction::Close;
case Poppler::LinkAction::Print: case Poppler::LinkAction::Print:
return Okular::DocumentAction::Print; return Okular::DocumentAction::Print;
#ifdef HAVE_POPPLER_22_04
case Poppler::LinkAction::SaveAs:
return Okular::DocumentAction::SaveAs;
#endif
} }
qWarning() << "Unsupported Poppler::LinkAction::ActionType" << pat; qWarning() << "Unsupported Poppler::LinkAction::ActionType" << pat;

@ -360,6 +360,7 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList &args)
connect(m_document->bookmarkManager(), &BookmarkManager::openUrl, this, &Part::openUrlFromBookmarks); connect(m_document->bookmarkManager(), &BookmarkManager::openUrl, this, &Part::openUrlFromBookmarks);
connect(m_document, &Document::close, this, &Part::close); connect(m_document, &Document::close, this, &Part::close);
connect(m_document, &Document::requestPrint, this, &Part::slotPrint); connect(m_document, &Document::requestPrint, this, &Part::slotPrint);
connect(m_document, &Document::requestSaveAs, this, [this] { slotSaveFileAs(); });
connect(m_document, &Document::undoHistoryCleanChanged, this, [this](bool clean) { connect(m_document, &Document::undoHistoryCleanChanged, this, [this](bool clean) {
setModified(!clean); setModified(!clean);
setWindowTitleFromDocument(); setWindowTitleFromDocument();

Loading…
Cancel
Save