Commit f143b323 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Only show the Stamps warning when adding stamps to PDF files

parent 76e26fd1
Pipeline #74290 passed with stage
in 9 minutes and 30 seconds
......@@ -1458,6 +1458,8 @@ QVariant PDFGenerator::metaData(const QString &key, const QVariant &option) cons
} else {
return i18n("Using Poppler %1\n\nBuilt against Poppler %2", Poppler::Version::string(), POPPLER_VERSION);
}
} else if (key == QLatin1String("ShowStampsWarning")) {
return QStringLiteral("yes");
}
return QVariant();
}
......
......@@ -100,7 +100,6 @@ public:
void slotToolBarVisibilityChanged(bool checked);
bool isQuickToolAction(QAction *aTool);
bool isQuickToolStamp(int toolId);
void ephemeralStampWarning();
AnnotationActionHandler *q;
......@@ -465,7 +464,7 @@ void AnnotationActionHandlerPrivate::selectTool(int toolId)
void AnnotationActionHandlerPrivate::slotStampToolSelected(const QString &stamp)
{
ephemeralStampWarning();
emit q->ephemeralStampWarning();
selectedBuiltinTool = PageViewAnnotator::STAMP_TOOL_ID;
annotator->selectStampTool(stamp); // triggers a reparsing thus calling parseTool
}
......@@ -473,7 +472,7 @@ void AnnotationActionHandlerPrivate::slotStampToolSelected(const QString &stamp)
void AnnotationActionHandlerPrivate::slotQuickToolSelected(int favToolId)
{
if (isQuickToolStamp(favToolId)) {
ephemeralStampWarning();
emit q->ephemeralStampWarning();
}
annotator->selectQuickTool(favToolId);
selectedBuiltinTool = -1;
......@@ -531,11 +530,6 @@ bool AnnotationActionHandlerPrivate::isQuickToolStamp(int toolId)
return annotType == QStringLiteral("stamp");
}
void AnnotationActionHandlerPrivate::ephemeralStampWarning()
{
KMessageBox::information(nullptr, i18nc("@info", "Stamps inserted in PDF documents are not visible in PDF readers other than Okular"), i18nc("@title:window", "Experimental feature"), QStringLiteral("stampAnnotationWarning"));
}
AnnotationActionHandler::AnnotationActionHandler(PageViewAnnotator *parent, KActionCollection *ac)
: QObject(parent)
, d(new AnnotationActionHandlerPrivate(this))
......
......@@ -42,6 +42,9 @@ public:
void setTextToolsEnabled(bool on);
void deselectAllAnnotationActions();
signals:
void ephemeralStampWarning();
private:
class AnnotationActionHandlerPrivate *d;
};
......
......@@ -1469,6 +1469,12 @@ void PageViewAnnotator::setupActions(KActionCollection *ac)
{
if (!m_actionHandler) {
m_actionHandler = new AnnotationActionHandler(this, ac);
connect(m_actionHandler, &AnnotationActionHandler::ephemeralStampWarning, this, [this] {
if (m_document->metaData(QStringLiteral("ShowStampsWarning")).toString() == QLatin1String("yes")) {
KMessageBox::information(
nullptr, i18nc("@info", "Stamps inserted in PDF documents are not visible in PDF readers other than Okular"), i18nc("@title:window", "Experimental feature"), QStringLiteral("stampAnnotationWarning"));
}
});
}
}
......
Supports Markdown
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