diff --git a/core/document.cpp b/core/document.cpp index b4b08cb59..c8ddd57a9 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -4558,6 +4558,11 @@ void Document::setHistoryClean(bool clean) d->m_undoStack->resetClean(); } +bool Document::isHistoryClean() const +{ + return d->m_undoStack->isClean(); +} + bool Document::canSaveChanges() const { if (!d->m_generator) diff --git a/core/document.h b/core/document.h index 5ca88bb4f..1e6d35c84 100644 --- a/core/document.h +++ b/core/document.h @@ -831,6 +831,8 @@ public: */ void setHistoryClean(bool clean); + bool isHistoryClean() const; + /** * Saving capabilities. Their availability varies according to the * underlying generator and/or the document type. diff --git a/part/pageview.cpp b/part/pageview.cpp index 065674e97..847e4745a 100644 --- a/part/pageview.cpp +++ b/part/pageview.cpp @@ -4778,6 +4778,11 @@ void PageView::slotSetMouseTableSelect() void PageView::slotSignature() { + if (!d->document->isHistoryClean()) { + KMessageBox::information(this, i18n("You have unsaved changes. Please save the document before signing it.")); + return; + } + d->messageWindow->display(i18n("Draw a rectangle to insert the signature field"), QString(), PageViewMessage::Info, -1); if (!d->annotator) {