Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configuration interface for macOS File Provider virtual files #6351

Merged
merged 144 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
35659bb
Add mac-specific virtual files settings section
claucambra May 17, 2023
e547ae2
Add basic, start FileProviderSettings page
claucambra May 17, 2023
8643acf
Add a start fileprovidersettingscontroller
claucambra May 17, 2023
a6f15ea
Set up QML file provider settings within the FileProviderSettingsCont…
claucambra May 18, 2023
40389a2
Use file provider settings controller in settings dialog
claucambra May 18, 2023
dae1643
Add basic fitting styling for FileProviderSettings component
claucambra May 31, 2023
4b8338c
Expose QML engine in systray
claucambra May 31, 2023
346a076
Simplify widget creation of file provider settings UI
claucambra May 31, 2023
58e6385
Make settings page use other internal QML components, correct palette
claucambra May 31, 2023
f158e27
Resize settings object to root view
claucambra May 31, 2023
5af363a
Wrap normal folder settings in tab widget
claucambra Aug 17, 2023
c57a582
Make sure qtabwidget in account settings is unnoticeable when file pr…
claucambra Aug 23, 2023
d4fb1e7
Move disguising of tab widget into separate method
claucambra Aug 23, 2023
174d3ec
Remove Virtual files section of settings, move this instead to indivi…
claucambra Aug 23, 2023
8070dbd
Implement basic layout for file provider configuration UI
claucambra Aug 29, 2023
f607bfa
Make file provider settings controller implementation an Objective-C+…
claucambra Sep 4, 2023
2863415
Add access to FileProviderSettingsController in FileProviderSettings …
claucambra Sep 4, 2023
7e4d643
Add starter FileProviderSettings objective c class
claucambra Sep 4, 2023
27c803a
Add MacImplementation private class to interface with obj-c settings API
claucambra Sep 4, 2023
d80962b
Instantiate internal MacImplementation in file provider settings cont…
claucambra Sep 4, 2023
0e02a64
Lazily load settings view widget
claucambra Sep 4, 2023
20f89c6
Make the fp settings controller static
claucambra Sep 4, 2023
94ce3da
Treat FileProviderSettingsController::settingsViewWidget as a factory…
claucambra Sep 4, 2023
c69bb43
Make it possible to check whether an account has vfs enabled or not
claucambra Sep 4, 2023
9a880f4
Implement modification of file provider enabled for account
claucambra Sep 5, 2023
ac608a6
Use default constructor for FileProviderSettingsController::MacImplem…
claucambra Sep 5, 2023
3c26e25
Notify when enabled file provider vfs accounts change
claucambra Sep 5, 2023
ba3baa4
Expose account user id with host to QML
claucambra Sep 5, 2023
a57cb3d
Register file provider settings controller as singleton in qml engine
claucambra Sep 5, 2023
e9451e9
Set account as property of settings view root object rather than cont…
claucambra Sep 5, 2023
556bce2
Move fp settings controller out of ui folder
claucambra Sep 5, 2023
42b72f9
Use [[nodiscard]] for MacImplementation methods
claucambra Sep 6, 2023
5f059a2
Add method to enable file provider vfs for all accounts
claucambra Sep 6, 2023
f5b80e9
Run initial check on creation of FileProviderSettingsController
claucambra Sep 6, 2023
58262a8
Ensure account is file provider vfs enablement is correctly set in NS…
claucambra Sep 6, 2023
0c40cef
Init widely-used variables in MacImplementation at declaration, fix n…
claucambra Sep 6, 2023
1db59fe
Remove ConfigFile().macFileProviderModuleEnabled() config flag
claucambra Sep 6, 2023
ee6c081
Enable file provider domains per the settings in the file provider do…
claucambra Sep 6, 2023
15525bc
Separate file provider domain updating into separate slot
claucambra Sep 6, 2023
e4aeb5b
Update file provider domain enablement status upon settings change
claucambra Sep 6, 2023
5aa7138
Do not bother trying to add a fp domain if we know it is active
claucambra Sep 6, 2023
97c963d
Remove fp domain id from registered domains when removal is confirmed
claucambra Sep 6, 2023
b83f0a5
Add starter fileproviderstorageuseenumerationobserver
claucambra Sep 14, 2023
435e25d
Define ompletion block for fileproviderstorageuseenumerationobserver
claucambra Sep 14, 2023
8fdc69b
Calculate total storage use from enumerator for materialised files in…
claucambra Sep 14, 2023
2105596
Fetch materialised files storage usage per account on creation of Fil…
claucambra Sep 14, 2023
18ed46e
Expose local storage usage for account in gigabytes to QML
claucambra Sep 14, 2023
9105a45
Use NSUInteger directly when calculationg usage in FileProviderStorag…
claucambra Sep 25, 2023
22a521d
Hold a strong reference to UsageEnumerationFinishedHandler
claucambra Sep 25, 2023
4e8eab6
Handle edge cases with materialised files enumeration and improve log…
claucambra Sep 25, 2023
7d229b5
Move GB with decimal number calculation to function
claucambra Sep 26, 2023
f68965a
Fetch and store user info for accounts in file provider settings cont…
claucambra Sep 26, 2023
679177e
Add property to file provider settings controller displaying remote f…
claucambra Sep 27, 2023
02b47b4
Fix positioning fo elements in FileProviderSettings UI
claucambra Sep 27, 2023
0b8a231
Leave usage as a property of materialised files enumerator
claucambra Sep 28, 2023
c3490db
Keep track of materialised files in storageuseenumerationobserver
claucambra Sep 28, 2023
fec9902
Store materialised file metadata in file provider settings controller
claucambra Sep 28, 2023
57d1dc8
Add a Qt-based data class for file provider items
claucambra Sep 28, 2023
a34a390
Add a convenience function to convert from nsnamecomponents to qstring
claucambra Sep 28, 2023
e3a0dab
Add convenience function to convert extendedAttributes to QHash
claucambra Sep 28, 2023
134eae6
Add static convenience method to FileProviderItemMetadata to convert …
claucambra Sep 28, 2023
389e663
Add method to get qtified file provider item metadata for account in …
claucambra Sep 28, 2023
269fb03
Add starter FileProviderMaterialisedItemsModel
claucambra Oct 10, 2023
726503f
Add custom equality check to FileProviderItemMetadata
claucambra Oct 10, 2023
f90f86d
Set FileProviderItemMetadata vector in materialised items model
claucambra Oct 10, 2023
85b3a13
Emit signal when materialised items for an account change
claucambra Oct 10, 2023
c1a5e78
Add method to generate materialised item models in settings controller
claucambra Oct 11, 2023
2ce4e91
Add method to generate eviction of materialised item windows in setti…
claucambra Oct 11, 2023
af98e48
Add starter FileProviderEvictionDialog component
claucambra Oct 11, 2023
d51c2a4
Add a general actions grid to the settings qml component to enable us…
claucambra Oct 11, 2023
89bb008
Add additional roles to FileProviderMaterialisedItemsModel
claucambra Oct 11, 2023
bfaba67
Add rolenames for FileProviderMaterialisedItemsModel
claucambra Oct 17, 2023
f254714
Ensure correct index is set on hidden tab widget
claucambra Oct 30, 2023
ad2baea
Keep track of item metadata's parent domain identifier
claucambra Oct 31, 2023
e03edc1
Add method to get user visible path for an item metadata
claucambra Oct 31, 2023
beb889c
Get and set userVisiblePath at item metadata construction time
claucambra Oct 31, 2023
f060f0c
Add UserVisiblePathRole to FileProviderMaterialisedItemsModel
claucambra Oct 31, 2023
371257a
Add a user-understandable file type string to itemmetadata
claucambra Oct 31, 2023
b3c7575
Add file type role to FileProviderMaterialisedItemsModel
claucambra Oct 31, 2023
da20e7e
Add basic FileProviderFileDelegate UI component
claucambra Oct 31, 2023
0b961e9
Add method to evict an item in FileProviderMaterialisedItemsModel
claucambra Oct 31, 2023
c763a9a
Expose items' domain identifier in FileProviderMaterialisedItemsModel
claucambra Oct 31, 2023
d905f13
Enable use of "Delete" button in FileProviderFileDelegate to evict item
claucambra Oct 31, 2023
64e1166
Fix layout for FileProviderFileDelegate
claucambra Oct 31, 2023
ba2bef2
Add fileproviderutils namespace
claucambra Nov 1, 2023
b47665e
Add convenience function to FileProviderUtils to get manager for a gi…
claucambra Nov 1, 2023
44a6f46
Separate domain finding into separate function in FileProviderUtils
claucambra Nov 1, 2023
b23e6bc
Use FileProviderUtils function to get manager for domain id in FilePr…
claucambra Nov 1, 2023
84d8561
Use FileProviderUtils function to get manager from domain id in FileP…
claucambra Nov 1, 2023
643d30a
Fix retain crash when calling managerForDomain
claucambra Nov 1, 2023
f22bf9e
Display file sizes as nicely formatted string in file provider file d…
claucambra Nov 1, 2023
5c3cd69
Improve visuals of file delegate details UI
claucambra Nov 1, 2023
a204f11
Have backup for 0 value in itemmetadata documentsize in materialised …
claucambra Nov 1, 2023
cfbdf3a
Provide feedback when materialised item eviction fails
claucambra Nov 1, 2023
b9cf135
Update the materialised items model post-file eviction
claucambra Nov 1, 2023
0ddd22d
Add function to retrieve log entries in File provider Logger extension
claucambra Nov 1, 2023
1dcfee4
Add function to File Provider Logger extension to create debug logs file
claucambra Nov 1, 2023
0a5df3b
Add public convenience static method to get domainIdentifier from a g…
claucambra Nov 14, 2023
292ff9b
Add convenience method in FileProvider to send a message to a given f…
claucambra Nov 14, 2023
24dda9b
Add createFileProvider slot to FileProviderSettingsController
claucambra Nov 14, 2023
9733c11
Add button to create debug archive
claucambra Nov 14, 2023
70521e9
Implement creating debug archive in client communication service
claucambra Jan 2, 2024
b2e5659
Replace old and now broken socket based debug archive command with co…
claucambra Jan 2, 2024
571b1ca
Directly provide text file path to logger for debug archive creation
claucambra Jan 2, 2024
9946495
Replace handling of debug archive creation in clientcommunicationserv…
claucambra Jan 3, 2024
62bbf6a
Create debug archive on client side
claucambra Jan 3, 2024
6a0f76d
Mark MacImplementation constructor for FileProviderSettingsController…
claucambra Jan 3, 2024
fd95ab7
Directly generate file provider item metadatas and cache
claucambra Jan 3, 2024
3b179cc
Remove unused usage property from enumeration observer
claucambra Jan 3, 2024
1d01f67
Always perform fallback document size discovery in fileprovideritemme…
claucambra Jan 3, 2024
f1c7811
Add method to signal file provider domain via file provider settings …
claucambra Jan 9, 2024
369c1d7
Add UI button to signal file provider domain
claucambra Jan 9, 2024
7a9a17a
Add starter FileProviderDomainSyncStatus
claucambra Jan 9, 2024
62c85de
Define basic FileProviderDomainSyncStatus private implementation
claucambra Jan 9, 2024
fe6d03a
Add q pointer to MacImplementation for FileProviderDomainSyncStatus
claucambra Jan 9, 2024
6fa969d
Add a starter ProgressObserver Objective-C class
claucambra Jan 9, 2024
e314fd0
Acquire upload/download progress in domain sync status
claucambra Jan 9, 2024
13b0244
Add ProgressKVOChangeHandler property to ProgressObserver
claucambra Jan 9, 2024
d387eb9
Add observing for important properties of nsprogress in progresshandler
claucambra Jan 9, 2024
f881c1d
Add main properties to FileProviderDomainSyncStatus
claucambra Jan 9, 2024
6d9c445
Update properties via ProgressObserver on FileProviderDomainSyncStatus
claucambra Jan 9, 2024
78732bf
Fix parameter name shadowing in fraction completed methods of domain …
claucambra Jan 9, 2024
21a317c
Fix unique ptr compile issue in domain sync status
claucambra Jan 9, 2024
9774ac6
Make mac implementation of file provider settings controller a QObject
claucambra Jan 9, 2024
9ca418c
Setup domain sync statuses in settings controller
claucambra Jan 9, 2024
36001ae
Add method to acquire domain sync status in settings controller
claucambra Jan 9, 2024
f8ebbe8
Fix crash on state change in file provider domain sync status
claucambra Jan 10, 2024
9e235f9
Enable use of domain sync status class in QML
claucambra Jan 14, 2024
3060ff6
Add current sync status UI to file provider settings view
claucambra Jan 14, 2024
2f752a6
Only load file provider settings items if domain is enabled
claucambra Jan 14, 2024
b9ae82c
Extract sync status layout to separate file
claucambra Jan 14, 2024
ed12541
Extract File Provider storage settings to separate file
claucambra Jan 14, 2024
034822f
Fix grid layout for sync status of file provider
claucambra Jan 14, 2024
7b99a06
Add separator to dynamically loaded fp settings
claucambra Jan 14, 2024
7d8778d
Bolden sync state text for fp
claucambra Jan 14, 2024
a469d44
Provide correct sync state icon in file provider domain sync status
claucambra Jan 15, 2024
472bba8
Add useful font sizes to Style.qml
claucambra Jan 15, 2024
918e411
Use font sizes in Style.qml in FileProviderSettings
claucambra Jan 15, 2024
1f70c85
Adjust alignment and sizing of file provider sync status icon
claucambra Jan 15, 2024
81d4aa7
Use NCProgressBar for file provider sync status
claucambra Jan 15, 2024
a428256
Limit gigabyte sizing string to two decimal figures in file provider …
claucambra Jan 15, 2024
b4e1338
Ensure [[nodiscard]] in new file provider classes
claucambra Jan 16, 2024
28cfd8f
Mark MacImplementation for FileProviderSettings destructor as override
claucambra Jan 16, 2024
92a1d80
Temporarily remove eviction dialog button until eviction works on ext…
claucambra Feb 19, 2024
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
7 changes: 6 additions & 1 deletion resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<file>src/gui/filedetails/FileDetailsView.qml</file>
<file>src/gui/filedetails/FileDetailsWindow.qml</file>
<file>src/gui/filedetails/FileTag.qml</file>
<file>src/gui/filedetails/NCInputDateField.qml</file>
<file>src/gui/filedetails/NCInputTextEdit.qml</file>
<file>src/gui/filedetails/NCInputTextField.qml</file>
<file>src/gui/filedetails/NCTabButton.qml</file>
Expand Down Expand Up @@ -61,6 +62,10 @@
<file>src/gui/ResolveConflictsDialog.qml</file>
<file>src/gui/ConflictDelegate.qml</file>
<file>src/gui/ConflictItemFileInfo.qml</file>
<file>src/gui/filedetails/NCInputDateField.qml</file>
<file>src/gui/macOS/ui/FileProviderSettings.qml</file>
<file>src/gui/macOS/ui/FileProviderFileDelegate.qml</file>
<file>src/gui/macOS/ui/FileProviderEvictionDialog.qml</file>
<file>src/gui/macOS/ui/FileProviderSyncStatus.qml</file>
<file>src/gui/macOS/ui/FileProviderStorageInfo.qml</file>
</qresource>
</RCC>
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,27 @@ extension Logger {
static let localFileOps = Logger(subsystem: subsystem, category: "localfileoperations")
static let ncFilesDatabase = Logger(subsystem: subsystem, category: "nextcloudfilesdatabase")
static let materialisedFileHandling = Logger(
subsystem: subsystem, category: "materialisedfilehandling")
subsystem: subsystem, category: "materialisedfilehandling"
)
static let logger = Logger(subsystem: subsystem, category: "logger")

@available(macOSApplicationExtension 12.0, *)
static func logEntries(interval: TimeInterval = -3600) -> (Array<String>?, Error?) {
do {
let logStore = try OSLogStore(scope: .currentProcessIdentifier)
let timeDate = Date().addingTimeInterval(interval)
let logPosition = logStore.position(date: timeDate)
let entries = try logStore.getEntries(at: logPosition)

return (entries
.compactMap { $0 as? OSLogEntryLog }
.filter { $0.subsystem == Logger.subsystem }
.map { $0.composedMessage }, nil)

} catch let error {
Logger.logger.error("Could not acquire os log store: \(error)");
return (nil, error)
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
serverUrl:(NSString *)serverUrl
password:(NSString *)password;
- (void)removeAccountConfig;
- (void)createDebugLogStringWithCompletionHandler:(void(^)(NSString *debugLogString, NSError *error))completionHandler;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,21 @@ class ClientCommunicationService: NSObject, NSFileProviderServiceSource, NSXPCLi
func removeAccountConfig() {
self.fpExtension.removeAccountConfig()
}

func createDebugLogString(completionHandler: ((String?, Error?) -> Void)!) {
if #available(macOSApplicationExtension 12.0, *) {
let (logs, error) = Logger.logEntries()
guard error == nil else {
Logger.logger.error("Cannot create debug archive, received error: \(error, privacy: .public)")
completionHandler(nil, error)
return
}
guard let logs = logs else {
Logger.logger.error("Canot create debug archive with nil logs.")
completionHandler(nil, nil)
return
}
completionHandler(logs.joined(separator: "\n"), nil)
}
}
}
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ set_package_properties(Qt5Concurrent PROPERTIES
TYPE REQUIRED
)

find_package(Qt5QuickWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt5QuickWidgets PROPERTIES
DESCRIPTION "Qt5 QuickWidgets component."
TYPE REQUIRED
)

find_package(Qt5WebEngineWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(NOT BUILD_WITH_WEBENGINE)
set_package_properties(Qt5WebEngineWidgets PROPERTIES
Expand Down
21 changes: 19 additions & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(gui)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 QuickWidgets Xml Network)
find_package(KF5Archive REQUIRED)

if(QUICK_COMPILER)
Expand Down Expand Up @@ -293,15 +293,31 @@ IF( APPLE )
macOS/fileprovider_mac.mm
macOS/fileproviderdomainmanager.h
macOS/fileproviderdomainmanager_mac.mm
macOS/fileproviderdomainsyncstatus.h
macOS/fileproviderdomainsyncstatus_mac.mm
macOS/fileprovideritemmetadata.h
macOS/fileprovideritemmetadata.cpp
macOS/fileprovideritemmetadata_mac.mm
macOS/fileprovidermaterialiseditemsmodel.h
macOS/fileprovidermaterialiseditemsmodel.cpp
macOS/fileprovidermaterialiseditemsmodel_mac.mm
macOS/fileprovidersettingscontroller.h
macOS/fileprovidersettingscontroller_mac.mm
macOS/fileprovidersocketcontroller.h
macOS/fileprovidersocketcontroller.cpp
macOS/fileprovidersocketserver.h
macOS/fileprovidersocketserver.cpp
macOS/fileprovidersocketserver_mac.mm
macOS/fileproviderstorageuseenumerationobserver.h
macOS/fileproviderstorageuseenumerationobserver.m
macOS/fileproviderutils.h
macOS/fileproviderutils_mac.mm
macOS/fileproviderxpc.h
macOS/fileproviderxpc_mac.mm
macOS/fileproviderxpc_mac_utils.h
macOS/fileproviderxpc_mac_utils.mm)
macOS/fileproviderxpc_mac_utils.mm
macOS/progressobserver.h
macOS/progressobserver.m)
endif()

if(SPARKLE_FOUND AND BUILD_UPDATER)
Expand Down Expand Up @@ -543,6 +559,7 @@ target_link_libraries(nextcloudCore
Qt5::Qml
Qt5::Quick
Qt5::QuickControls2
Qt5::QuickWidgets
KF5::Archive
)

Expand Down
30 changes: 30 additions & 0 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
#include <QJsonDocument>
#include <QToolTip>

#ifdef BUILD_FILE_PROVIDER_MODULE
#include "macOS/fileprovider.h"
#endif

#include "account.h"

namespace {
Expand Down Expand Up @@ -193,6 +197,24 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
#endif
new ToolTipUpdater(_ui->_folderList);

#if defined(BUILD_FILE_PROVIDER_MODULE)
if (Mac::FileProvider::fileProviderAvailable()) {
const auto fileProviderTab = _ui->fileProviderTab;
const auto fpSettingsLayout = new QVBoxLayout(fileProviderTab);
const auto fpAccountUserIdAtHost = _accountState->account()->userIdAtHostWithPort();
const auto fpSettingsController = Mac::FileProviderSettingsController::instance();
const auto fpSettingsWidget = fpSettingsController->settingsViewWidget(fpAccountUserIdAtHost, fileProviderTab);
fpSettingsLayout->setMargin(0);
fpSettingsLayout->addWidget(fpSettingsWidget);
fileProviderTab->setLayout(fpSettingsLayout);
} else {
disguiseTabWidget();
}
#else
disguiseTabWidget();
_ui->tabWidget->setCurrentIndex(0);
#endif

const auto mouseCursorChanger = new MouseCursorChanger(this);
mouseCursorChanger->folderList = _ui->_folderList;
mouseCursorChanger->model = _model;
Expand Down Expand Up @@ -1688,6 +1710,14 @@ void AccountSettings::initializeE2eEncryptionSettingsMessage()
connect(actionEnableE2e, &QAction::triggered, this, &AccountSettings::slotE2eEncryptionGenerateKeys);
}

void AccountSettings::disguiseTabWidget() const
{
// Ensure all elements of the tab widget are hidden.
// Document mode lets the child view take up the whole view.
_ui->tabWidget->setDocumentMode(true);
_ui->tabWidget->tabBar()->hide();
}

} // namespace OCC

#include "accountsettings.moc"
6 changes: 6 additions & 0 deletions src/gui/accountsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include "owncloudgui.h"
#include "folderstatusmodel.h"

#ifdef BUILD_FILE_PROVIDER_MODULE
#include "macOS/fileprovidersettingscontroller.h"
#endif

class QModelIndex;
class QNetworkReply;
class QListWidgetItem;
Expand Down Expand Up @@ -137,6 +141,8 @@ private slots:
/// Returns the alias of the selected folder, empty string if none
[[nodiscard]] QString selectedFolderAlias() const;

void disguiseTabWidget() const;

Ui::AccountSettings *_ui;

FolderStatusModel *_model;
Expand Down
Loading
Loading