Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ since 0.4.1, and this project adheres to [Semantic Versioning](https://semver.or
- Update the theme correctly on dark/light mode changes
([#1238](https://github.com/freedomofpress/dangerzone/issues/1238))
- Update Linux .desktop file with missing MIME types for HWP and ODF formats ([#646](https://github.com/freedomofpress/dangerzone/issues/646))
- Elide long filenames in the filename label to prevent UI elements from being pushed off-screen ([#143](https://github.com/freedomofpress/dangerzone/issues/143))

### Added

Expand Down
7 changes: 6 additions & 1 deletion dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1667,9 +1667,14 @@ def __init__(
self.dangerous_doc_label.setAlignment(
QtCore.Qt.AlignVCenter | QtCore.Qt.AlignLeft
)
self.dangerous_doc_label.setText(os.path.basename(self.document.input_filename))
doc_name = os.path.basename(self.document.input_filename)
self.dangerous_doc_label.setToolTip(doc_name)
self.dangerous_doc_label.setMinimumWidth(200)
self.dangerous_doc_label.setMaximumWidth(200)
# Elide text with '...' when the filename is too long for the label width
metrics = self.dangerous_doc_label.fontMetrics()
elided = metrics.elidedText(doc_name, QtCore.Qt.ElideMiddle, 200)
self.dangerous_doc_label.setText(elided)

# Conversion status images
self.img_status_unconverted = self.load_status_image("status_unconverted.png")
Expand Down
Loading