1
0
mirror of https://github.com/bpozdena/OneDriveGUI.git synced 2026-10-24 04:59:17 +03:00

Applied fix to missing icons of deleted files based on @DoneWorkin's suggestion #266

This commit is contained in:
Boris Pozdena
2026-03-14 21:03:52 +01:00
parent b94856a21b
commit 9249de041f
2 changed files with 12 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ from PySide6.QtWidgets import (
QStackedLayout,
QMessageBox,
QStyledItemDelegate,
QStyle,
QApplication,
)
@@ -75,6 +77,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.setupUi(self)
self.setWindowTitle(f"OneDriveGUI v{version}")
self.setWindowIcon(QIcon(DIR_PATH + "/resources/images/icons8-cloud-80.png"))
self.trash_icon = QApplication.style().standardIcon(QStyle.SP_TrashIcon)
if gui_settings.get("frameless_window") == "True":
self.setWindowFlags(Qt.FramelessWindowHint)
@@ -850,11 +853,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
logging.debug("Updating list item")
item_widget.set_progress(int(progress))
# item_widget.set_icon(file_path)
item_widget.set_icon(file_path)
item_widget.hide_progress_bar(transfer_complete)
if file_operation == "Deleting":
item_widget.set_label_1(f"Deleted from {parent_dir}")
item_widget.set_custom_icon(self.trash_icon)
item_widget.set_label_2(f"")
# Store timestamp and display for deleted files
if "timestamp" in data and data["timestamp"]:
@@ -923,6 +927,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if file_operation == "Deleting":
myQCustomQWidget.set_label_1(f"Deleted from {parent_dir}")
myQCustomQWidget.set_custom_icon(self.trash_icon)
myQCustomQWidget.set_label_2(f"")
# Store timestamp and display for deleted files
if "timestamp" in data and data["timestamp"]:

View File

@@ -1,7 +1,7 @@
from PySide6.QtCore import QThread, Signal, QFileInfo, Qt
from PySide6.QtWidgets import QWidget, QFileIconProvider
from PySide6.QtGui import QFontMetrics
from PySide6.QtWidgets import QWidget, QFileIconProvider, QStyle
from PySide6.QtGui import QFontMetrics, QIcon
# Imports for main window.
@@ -689,6 +689,10 @@ class TaskList(QWidget, Ui_list_item_widget):
self.toolButton.setIcon(self.icon)
def set_custom_icon(self, icon):
"""Set a custom QIcon for the toolButton."""
self.toolButton.setIcon(icon)
def set_file_name(self, file_path):
# Use font metrics to elide long filenames
font_metrics = QFontMetrics(self.ls_label_file_name.font())