Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qfilesystemengine_mac.mm
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qplatformdefs.h"
6
#
include
"qfilesystemengine_p.h"
7
#
include
"qfile.h"
8
#
include
"qurl.h"
9
10
#
include
<
QtCore
/
private
/
qcore_mac_p
.
h
>
11
#
include
<
CoreFoundation
/
CoreFoundation
.
h
>
12
13
QT_BEGIN_NAMESPACE
14
15
/*
16
This implementation does not enable the "put back" option in Finder
17
for the trashed object. The only way to get this is to use Finder automation,
18
which would query the user for permission to access Finder using a modal,
19
blocking dialog - which we definitely can't have in a console application.
20
21
Using Finder would also play the trash sound, which we don't want either in
22
such a core API; applications that want that can play the sound themselves.
23
*/
24
//static
25
bool
QFileSystemEngine::supportsMoveFileToTrash()
26
{
27
return
true
;
28
}
29
30
//static
31
bool
QFileSystemEngine::moveFileToTrash(
const
QFileSystemEntry &source,
32
QFileSystemEntry &newLocation, QSystemError &error)
33
{
34
QMacAutoReleasePool pool;
35
36
QFileInfo info(source.filePath());
37
NSString *filepath = info.filePath().toNSString();
38
NSURL *fileurl = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
39
NSURL *resultingUrl = nil;
40
NSError *nserror = nil;
41
NSFileManager *fm = [NSFileManager defaultManager];
42
if
([fm trashItemAtURL:fileurl resultingItemURL:&resultingUrl error:&nserror] != YES) {
43
error = QSystemError(nserror.code, QSystemError::NativeError);
44
return
false
;
45
}
46
newLocation = QFileSystemEntry(QUrl::fromNSURL(resultingUrl).path());
47
return
true
;
48
}
49
50
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
corelib
io
qfilesystemengine_mac.mm
Generated on
for Qt by
1.18.0