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
6 changes: 5 additions & 1 deletion src/gui/editlocallymanager.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: GPL-2.0-or-later
Expand Down Expand Up @@ -96,12 +96,16 @@
const QString &relPath,
const QString &token)
{
#ifndef BUILD_FILE_PROVIDER_MODULE
// Show the loading dialog but don't show the filename until we have
// verified the token
// verified the token. File Provider handles nc:// without a progress dialog.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a misleading comment which must be removed. The file provider extension does not handle anything at all and the main app is not the file provider. The main app has the custom URL scheme registered locally (an extension cannot do that) and is invoked for handling.

Systray::instance()->createEditFileLocallyLoadingDialog({});
#endif

const auto finishedHandler = [this, token] {
#ifndef BUILD_FILE_PROVIDER_MODULE
Systray::instance()->destroyEditFileLocallyLoadingDialog();
#endif
_verificationJobs.remove(token);
};
const auto errorEditLocally = [finishedHandler] {
Expand Down
5 changes: 0 additions & 5 deletions src/gui/macOS/fileprovidereditlocallyjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "editlocallymanager.h"
#include "networkjobs.h"
#include "systray.h"

using namespace Qt::StringLiterals;

Expand Down Expand Up @@ -43,9 +42,6 @@ void FileProviderEditLocallyJob::start()
return;
}

const auto filename = relPathSplit.last();
Systray::instance()->createEditFileLocallyLoadingDialog(filename);

qCDebug(lcFileProviderEditLocallyJob) << "Getting file ocId for" << _relPath;

const auto idJob = new PropfindJob(_accountState->account(), _relPath, this);
Expand All @@ -62,7 +58,6 @@ void FileProviderEditLocallyJob::start()
void FileProviderEditLocallyJob::showError(const QString &message,
const QString &informativeText)
{
Systray::instance()->destroyEditFileLocallyLoadingDialog();
EditLocallyManager::showError(message, informativeText);
Q_EMIT error(message, informativeText);
}
Expand Down
15 changes: 8 additions & 7 deletions src/gui/macOS/fileprovidereditlocallyjob_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#include "fileprovidereditlocallyjob.h"

#include <QLoggingCategory>
#include <QTimer>

#include "account.h"
#include "accountstate.h"
#include "editlocallymanager.h"
#include "systray.h"

#include "macOS/fileprovider.h"
#include "macOS/fileproviderdomainmanager.h"
Expand Down Expand Up @@ -55,10 +55,6 @@
[manager getUserVisibleURLForItemIdentifier:nsOcId
completionHandler:^(NSURL *const url, NSError *const error) {

dispatch_async(dispatch_get_main_queue(), ^{
Systray::instance()->destroyEditFileLocallyLoadingDialog();
});

if (error != nil) {
const auto errorMessage = QString::fromNSString(error.localizedDescription);
qCWarning(lcFileProviderEditLocallyMacJob) << "Error getting user visible URL for item:" << errorMessage;
Expand All @@ -67,9 +63,14 @@
});
} else if (url != nil) {
const auto itemLocalPath = QString::fromNSString(url.path);
qCDebug(lcFileProviderEditLocallyMacJob) << "Got user visible URL for item:" << itemLocalPath;
[NSWorkspace.sharedWorkspace openURL:url];
qCDebug(lcFileProviderEditLocallyMacJob) << "Revealing file provider item in Finder:" << itemLocalPath;

dispatch_async(dispatch_get_main_queue(), ^{
QTimer::singleShot(0, [itemLocalPath] {
qCDebug(lcFileProviderEditLocallyMacJob) << "Activating Finder for file provider item:" << itemLocalPath;
const auto urlToReveal = [NSURL fileURLWithPath:itemLocalPath.toNSString()];
[NSWorkspace.sharedWorkspace activateFileViewerSelectingURLs:@[urlToReveal]];
});
emit finished();
});
} else {
Expand Down
Loading