mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
53 lines
1.8 KiB
Swift
53 lines
1.8 KiB
Swift
|
/*
|
||
|
* Copyright (C) 2022 by Claudio Cambra <claudio.cambra@nextcloud.com>
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 2 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful, but
|
||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||
|
* for more details.
|
||
|
*/
|
||
|
|
||
|
import FileProvider
|
||
|
import UniformTypeIdentifiers
|
||
|
|
||
|
class FileProviderItem: NSObject, NSFileProviderItem {
|
||
|
|
||
|
// TODO: implement an initializer to create an item from your extension's backing model
|
||
|
// TODO: implement the accessors to return the values from your extension's backing model
|
||
|
|
||
|
private let identifier: NSFileProviderItemIdentifier
|
||
|
|
||
|
init(identifier: NSFileProviderItemIdentifier) {
|
||
|
self.identifier = identifier
|
||
|
}
|
||
|
|
||
|
var itemIdentifier: NSFileProviderItemIdentifier {
|
||
|
return identifier
|
||
|
}
|
||
|
|
||
|
var parentItemIdentifier: NSFileProviderItemIdentifier {
|
||
|
return .rootContainer
|
||
|
}
|
||
|
|
||
|
var capabilities: NSFileProviderItemCapabilities {
|
||
|
return [.allowsReading, .allowsWriting, .allowsRenaming, .allowsReparenting, .allowsTrashing, .allowsDeleting]
|
||
|
}
|
||
|
|
||
|
var itemVersion: NSFileProviderItemVersion {
|
||
|
NSFileProviderItemVersion(contentVersion: "a content version".data(using: .utf8)!, metadataVersion: "a metadata version".data(using: .utf8)!)
|
||
|
}
|
||
|
|
||
|
var filename: String {
|
||
|
return identifier.rawValue
|
||
|
}
|
||
|
|
||
|
var contentType: UTType {
|
||
|
return identifier == NSFileProviderItemIdentifier.rootContainer ? .folder : .plainText
|
||
|
}
|
||
|
}
|