mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-02 14:14:10 +00:00
Support SaveAs action
If a new enough (unreleases as of now) poppler is available BUGS: 451010
This commit is contained in:
parent
1d64fea660
commit
1aa175cf3f
|
@ -293,7 +293,8 @@ public:
|
|||
Find = 10, ///< Open find dialog
|
||||
GoToPage = 11, ///< Goto page
|
||||
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:
|
||||
emit requestPrint();
|
||||
break;
|
||||
case DocumentAction::SaveAs:
|
||||
emit requestSaveAs();
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
|
@ -1133,6 +1133,13 @@ Q_SIGNALS:
|
|||
*/
|
||||
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
|
||||
* application quit operation.
|
||||
|
|
|
@ -66,6 +66,15 @@ int main()
|
|||
}
|
||||
" 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(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake
|
||||
${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 */
|
||||
#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;
|
||||
case Poppler::LinkAction::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;
|
||||
|
|
|
@ -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, &Document::close, this, &Part::close);
|
||||
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) {
|
||||
setModified(!clean);
|
||||
setWindowTitleFromDocument();
|
||||
|
|
Loading…
Reference in a new issue