@@ -265,26 +265,25 @@ def init_ui(self):
265265 self .file_view .verticalScrollBar ().valueChanged .connect (self .update_visible_thumbnails )
266266 self .file_view .setFocus ()
267267
268- def apply_cache_overlay (self , pixmap : QPixmap ) -> QPixmap :
268+ def apply_icon_overlay (self , pixmap : QPixmap , icon_enum : Any , color : str = "#999999" , is_filled : bool = False ) -> QPixmap :
269269 result = QPixmap (pixmap )
270270 painter = QPainter (result )
271271 painter .setRenderHint (QPainter .Antialiasing )
272272
273- # Get the checkmark icon - use a nice green
274- check_icon = get_icon (FilledIcon .CIRCLE_CHECK , color = "#999999" )
273+ overlay_icon = get_icon (icon_enum , color = color , is_filled = is_filled )
275274 overlay_size = pixmap .width () // 4
276- check_pixmap = check_icon .pixmap (QSize (overlay_size , overlay_size ))
275+ overlay_pixmap = overlay_icon .pixmap (QSize (overlay_size , overlay_size ))
277276
278277 # Position in lower right corner
279278 x = pixmap .width () - overlay_size - 4
280279 y = pixmap .height () - overlay_size - 4
281280
282- # Draw a white circular background to make the green checkmark stand out
281+ # Draw a white circular background
283282 painter .setBrush (Qt .white )
284283 painter .setPen (Qt .NoPen )
285284 painter .drawEllipse (x + 2 , y + 2 , overlay_size - 4 , overlay_size - 4 )
286285
287- painter .drawPixmap (x , y , check_pixmap )
286+ painter .drawPixmap (x , y , overlay_pixmap )
288287 painter .end ()
289288 return result
290289
@@ -406,8 +405,11 @@ def populate_files(self, items: List[Dict[str, Any]]):
406405 pixmap = get_mime_icon (mime ).pixmap (self .file_view .iconSize ())
407406
408407 cache_path = gcache .get_cache_path_for_file (item )
409- if cache_path and cache_path .exists ():
410- pixmap = self .apply_cache_overlay (pixmap )
408+ if cache_path :
409+ if cache_path .exists ():
410+ pixmap = self .apply_icon_overlay (pixmap , FilledIcon .CIRCLE_CHECK )
411+ elif item .get ('mimeType' ) not in ('application/vnd.google-apps.folder' , 'application/vnd.google-apps.shortcut' ):
412+ pixmap = self .apply_icon_overlay (pixmap , OutlineIcon .EXTERNAL_LINK )
411413
412414 list_item .setIcon (QIcon (pixmap ))
413415
@@ -466,8 +468,11 @@ def on_thumbnail_loaded(self, file_id: str, img: QImage):
466468 if item .listWidget () == self .file_view :
467469 file_data = item .data (Qt .UserRole )
468470 cache_path = gcache .get_cache_path_for_file (file_data )
469- if cache_path and cache_path .exists ():
470- pixmap = self .apply_cache_overlay (pixmap )
471+ if cache_path :
472+ if cache_path .exists ():
473+ pixmap = self .apply_icon_overlay (pixmap , FilledIcon .CIRCLE_CHECK )
474+ elif file_data .get ('mimeType' ) not in ('application/vnd.google-apps.folder' , 'application/vnd.google-apps.shortcut' ):
475+ pixmap = self .apply_icon_overlay (pixmap , OutlineIcon .EXTERNAL_LINK )
471476 item .setIcon (QIcon (pixmap ))
472477
473478 def on_item_activated (self , item : QListWidgetItem ):
0 commit comments