Skip to content

Commit

Permalink
Provide feedback when materialised item eviction fails
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Nov 1, 2023
1 parent 7a83ad3 commit ce92854
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/gui/macOS/fileprovidermaterialiseditemsmodel_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include "fileproviderutils.h"

#include "gui/systray.h"

namespace OCC {

namespace Mac {
Expand All @@ -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);
}
}];

Expand Down

0 comments on commit ce92854

Please sign in to comment.