From ce928548aab51384e748b621c9fd1dad68d4acf8 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 1 Nov 2023 17:30:43 +0800 Subject: [PATCH] Provide feedback when materialised item eviction fails Signed-off-by: Claudio Cambra --- .../fileprovidermaterialiseditemsmodel_mac.mm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gui/macOS/fileprovidermaterialiseditemsmodel_mac.mm b/src/gui/macOS/fileprovidermaterialiseditemsmodel_mac.mm index 6d2201b85bfa..b24f3833ffaf 100644 --- a/src/gui/macOS/fileprovidermaterialiseditemsmodel_mac.mm +++ b/src/gui/macOS/fileprovidermaterialiseditemsmodel_mac.mm @@ -20,6 +20,8 @@ #include "fileproviderutils.h" +#include "gui/systray.h" + namespace OCC { namespace Mac { @@ -30,15 +32,23 @@ { NSFileProviderManager * const manager = FileProviderUtils::managerForDomainIdentifier(domainIdentifier); if (manager == nil) { - qCWarning(lcMacImplFileProviderMaterialisedItemsModelMac) << "Received null manager for domain" << domainIdentifier - << "cannot evict item" << identifier; + qCWarning(lcMacImplFileProviderMaterialisedItemsModelMac) << "Received null manager for domain" + << domainIdentifier + << "cannot evict item" + << identifier; + Systray::instance()->showMessage(tr("Error"), + tr("An internal error occurred. Please try again later."), + QSystemTrayIcon::Warning); return; } [manager evictItemWithIdentifier:identifier.toNSString() completionHandler:^(NSError *error) { if (error != nil) { - qCWarning(lcMacImplFileProviderMaterialisedItemsModelMac) << "Error evicting item due to error:" - << error.localizedDescription; + const auto errorDesc = QString::fromNSString(error.localizedDescription); + qCWarning(lcMacImplFileProviderMaterialisedItemsModelMac) << "Error evicting item:" << errorDesc; + Systray::instance()->showMessage(tr("Error"), + tr("An error occurred while trying to delete the local copy of this item: %1").arg(errorDesc), + QSystemTrayIcon::Warning); } }];