diff --git a/dangerzone/gui/main_window.py b/dangerzone/gui/main_window.py index 7bccf57..e292ff0 100644 --- a/dangerzone/gui/main_window.py +++ b/dangerzone/gui/main_window.py @@ -4,6 +4,7 @@ import platform import tempfile import typing from multiprocessing.pool import ThreadPool +from pathlib import Path from typing import List, Optional # FIXME: See https://github.com/freedomofpress/dangerzone/issues/320 for more details. @@ -60,6 +61,13 @@ about updates.

HAMBURGER_MENU_SIZE = 30 +WARNING_MESSAGE = """\ +

Warning: Ubuntu Focal systems and their derivatives will +stop being supported in subsequent Dangerzone releases. We encourage you to upgrade to a +more recent version of your operating system in order to get security updates.

+""" + + def load_svg_image(filename: str, width: int, height: int) -> QtGui.QPixmap: """Load an SVG image from a filename. @@ -579,6 +587,17 @@ class ContentWidget(QtWidgets.QWidget): self.dangerzone = dangerzone self.conversion_started = False + self.warning_label = None + if platform.system() == "Linux": + # Add the warning message only for ubuntu focal + os_release_path = Path("/etc/os-release") + if os_release_path.exists(): + os_release = os_release_path.read_text() + if "Ubuntu 20.04" in os_release or "focal" in os_release: + self.warning_label = QtWidgets.QLabel(WARNING_MESSAGE) + self.warning_label.setWordWrap(True) + self.warning_label.setProperty("style", "warning") + # Doc selection widget self.doc_selection_widget = DocSelectionWidget(self.dangerzone) self.doc_selection_widget.documents_selected.connect(self.documents_selected) @@ -604,6 +623,8 @@ class ContentWidget(QtWidgets.QWidget): # Layout layout = QtWidgets.QVBoxLayout() + if self.warning_label: + layout.addWidget(self.warning_label) # Add warning at the top layout.addWidget(self.settings_widget, stretch=1) layout.addWidget(self.documents_list, stretch=1) layout.addWidget(self.doc_selection_wrapper, stretch=1) diff --git a/share/dangerzone.css b/share/dangerzone.css index 38bf32b..4436a25 100644 --- a/share/dangerzone.css +++ b/share/dangerzone.css @@ -55,4 +55,20 @@ QTextEdit[style="traceback"] { background-color: #ffffff; color: #000000; padding: 10px; -} \ No newline at end of file +} + +QLabel[style="warning"] { + background-color: #FFF3CD; + color: #856404; + border: 1px solid #FFEEBA; + border-radius: 4px; + padding: 10px; + margin: 10px; +} + + +MainWindow[OSColorMode="dark"] QLabel[style="warning"] { + background-color: #332D00; + color: #FFD970; + border-color: #665A00; +}