[graphics/okular] /: Patch: Let form and sign interface to respect the OSD setting

Nate Graham null at kde.org
Fri Apr 23 04:44:46 BST 2021


Git commit 1855f9e4b1ea3e364eee9d521658f35dedded4d9 by Nate Graham, on behalf of shenleban tongying.
Committed on 23/04/2021 at 03:44.
Pushed by ngraham into branch 'master'.

Patch: Let form and sign interface to respect the OSD setting

M  +2    -1    autotests/parttest.cpp
M  +3    -0    conf/okular.kcfg
M  +7    -0    doc/index.docbook
M  +11   -5    part/dlggeneral.cpp
M  +2    -2    part/pageview.cpp
M  +4    -4    part/part.cpp

https://invent.kde.org/graphics/okular/commit/1855f9e4b1ea3e364eee9d521658f35dedded4d9

diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp
index 2722a265a..7c0639b99 100644
--- a/autotests/parttest.cpp
+++ b/autotests/parttest.cpp
@@ -775,8 +775,9 @@ void PartTest::testeRectSelectionStartingOnLinks()
     Okular::Part part(nullptr, nullptr, dummyArgs);
     QVERIFY(openDocument(&part, QStringLiteral(KDESRCDIR "data/pdf_with_links.pdf")));
     // hide info messages as they interfere with selection area
+    Okular::Settings::self()->setShowEmbeddedContentMessages(false);
     Okular::Settings::self()->setShowOSD(false);
-    ;
+
     part.widget()->show();
     QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
 
diff --git a/conf/okular.kcfg b/conf/okular.kcfg
index af46cbec0..873b231e9 100644
--- a/conf/okular.kcfg
+++ b/conf/okular.kcfg
@@ -178,6 +178,9 @@
     <default>true</default>
   </entry>
   <entry key="ShowOSD" type="Bool" >
+    <default>true</default>
+  </entry>
+  <entry key="ShowEmbeddedContentMessages" type="Bool" >
    <default>true</default>
   </entry>
   <entry key="DisplayDocumentTitle" type="Bool" >
diff --git a/doc/index.docbook b/doc/index.docbook
index 4427daa0a..d6cf13307 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -2554,6 +2554,13 @@ Context menu actions like Rename Bookmarks etc.)
 							load, &etc;</para>
 					</listitem>
 				</varlistentry>
+				<varlistentry>
+					<term><guilabel>Notify about embedded files, forms, or signatures</guilabel></term>
+					<listitem>
+						<para>Whether to show informative panels about embedded files, forms
+							or signatures &etc;</para>
+					</listitem>
+				</varlistentry>
 				<varlistentry>
 					<term><guilabel>Display document title in titlebar if available</guilabel></term>
 					<listitem>
diff --git a/part/dlggeneral.cpp b/part/dlggeneral.cpp
index 7da63be71..3652b0744 100644
--- a/part/dlggeneral.cpp
+++ b/part/dlggeneral.cpp
@@ -50,11 +50,17 @@ DlgGeneral::DlgGeneral(QWidget *parent, Okular::EmbedMode embedMode)
         layout->addRow(QString(), scrollThumbnails);
     }
 
-    // Checkbox: show hints and info messages
-    QCheckBox *showHints = new QCheckBox(this);
-    showHints->setText(i18nc("@option:check Config dialog, general page", "Show hints and info messages"));
-    showHints->setObjectName(QStringLiteral("kcfg_ShowOSD"));
-    layout->addRow(QString(), showHints);
+    // Checkbox: Show welcoming messages (the balloons or OSD)
+    QCheckBox *showOSD = new QCheckBox(this);
+    showOSD->setText(i18nc("@option:check Config dialog, general page", "Show hints and info messages"));
+    showOSD->setObjectName(QStringLiteral("kcfg_ShowOSD"));
+    layout->addRow(QString(), showOSD);
+
+    // Checkbox: Notify about embedded files, forms, or signatures
+    QCheckBox *showEmbeddedContentMessages = new QCheckBox(this);
+    showEmbeddedContentMessages->setText(i18nc("@option:check Config dialog, general page", "Notify about embedded files, forms, or signatures"));
+    showEmbeddedContentMessages->setObjectName(QStringLiteral("kcfg_ShowEmbeddedContentMessages"));
+    layout->addRow(QString(), showEmbeddedContentMessages);
 
     if (embedMode != Okular::ViewerWidgetMode) {
         // Checkbox: display document title in titlebar
diff --git a/part/pageview.cpp b/part/pageview.cpp
index 7815936ee..c6a0e5806 100644
--- a/part/pageview.cpp
+++ b/part/pageview.cpp
@@ -1253,8 +1253,8 @@ void PageView::notifySetup(const QVector<Okular::Page *> &pageSet, int setupFlag
                               // be done and the old document would still be shown
     }
 
-    // OSD to display pages
-    if (documentChanged && pageSet.count() > 0 && Okular::Settings::showOSD())
+    // OSD (Message balloons) to display pages
+    if (documentChanged && pageSet.count() > 0)
         d->messageWindow->display(i18np(" Loaded a one-page document.", " Loaded a %1-page document.", pageSet.count()), QString(), PageViewMessage::Info, 4000);
 
     updateActionState(haspages, hasformwidgets);
diff --git a/part/part.cpp b/part/part.cpp
index 18aafadfa..47584c96d 100644
--- a/part/part.cpp
+++ b/part/part.cpp
@@ -1531,18 +1531,18 @@ bool Part::openFile()
     bool hasEmbeddedFiles = ok && m_document->embeddedFiles() && m_document->embeddedFiles()->count() > 0;
     if (m_showEmbeddedFiles)
         m_showEmbeddedFiles->setEnabled(hasEmbeddedFiles);
-    m_topMessage->setVisible(hasEmbeddedFiles && Okular::Settings::showOSD());
+    m_topMessage->setVisible(hasEmbeddedFiles && Okular::Settings::showEmbeddedContentMessages());
     m_migrationMessage->setVisible(m_document->isDocdataMigrationNeeded());
 
     // Warn the user that XFA forms are not supported yet (NOTE: poppler generator only)
-    if (ok && m_document->metaData(QStringLiteral("HasUnsupportedXfaForm")).toBool() == true) {
+    if (ok && Okular::Settings::showEmbeddedContentMessages() && m_document->metaData(QStringLiteral("HasUnsupportedXfaForm")).toBool() == true) {
         m_formsMessage->setText(i18n("This document has XFA forms, which are currently <b>unsupported</b>."));
         m_formsMessage->setIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
         m_formsMessage->setMessageType(KMessageWidget::Warning);
         m_formsMessage->setVisible(true);
     }
     // m_pageView->toggleFormsAction() may be null on dummy mode
-    else if (ok && m_pageView->toggleFormsAction() && m_pageView->toggleFormsAction()->isEnabled()) {
+    else if (ok && Okular::Settings::showEmbeddedContentMessages() && m_pageView->toggleFormsAction() && m_pageView->toggleFormsAction()->isEnabled()) {
         m_formsMessage->setText(i18n("This document has forms. Click on the button to interact with them, or use View -> Show Forms."));
         m_formsMessage->setMessageType(KMessageWidget::Information);
         m_formsMessage->setVisible(true);
@@ -1561,7 +1561,7 @@ bool Part::openFile()
             }
         }
 
-        if (isDigitallySigned) {
+        if (isDigitallySigned && Okular::Settings::showEmbeddedContentMessages()) {
             if (m_embedMode == PrintPreviewMode) {
                 m_signatureMessage->setText(i18n("All editing and interactive features for this document are disabled. Please save a copy and reopen to edit this document."));
             } else {


More information about the kde-doc-english mailing list