Commit 6325a4fe authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid
Browse files

Make sure you have no unsaved changes before saving

parent a5df71a7
...@@ -4558,6 +4558,11 @@ void Document::setHistoryClean(bool clean) ...@@ -4558,6 +4558,11 @@ void Document::setHistoryClean(bool clean)
d->m_undoStack->resetClean(); d->m_undoStack->resetClean();
} }
bool Document::isHistoryClean() const
{
return d->m_undoStack->isClean();
}
bool Document::canSaveChanges() const bool Document::canSaveChanges() const
{ {
if (!d->m_generator) if (!d->m_generator)
......
...@@ -831,6 +831,8 @@ public: ...@@ -831,6 +831,8 @@ public:
*/ */
void setHistoryClean(bool clean); void setHistoryClean(bool clean);
bool isHistoryClean() const;
/** /**
* Saving capabilities. Their availability varies according to the * Saving capabilities. Their availability varies according to the
* underlying generator and/or the document type. * underlying generator and/or the document type.
......
...@@ -4778,6 +4778,11 @@ void PageView::slotSetMouseTableSelect() ...@@ -4778,6 +4778,11 @@ void PageView::slotSetMouseTableSelect()
void PageView::slotSignature() 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); d->messageWindow->display(i18n("Draw a rectangle to insert the signature field"), QString(), PageViewMessage::Info, -1);
if (!d->annotator) { if (!d->annotator) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment