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
qhaikuservices.cpp
Go to the documentation of this file.
1
// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com>
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
"qhaikuservices.h"
5
6
#
include
<
QFile
>
7
#
include
<
QMimeDatabase
>
8
#
include
<
QString
>
9
#
include
<
QUrl
>
10
11
#
include
<
Roster
.
h
>
12
13
QT_BEGIN_NAMESPACE
14
15
bool
QHaikuServices::openUrl(
const
QUrl &url)
16
{
17
const
QMimeDatabase mimeDatabase;
18
19
const
QMimeType mimeType = mimeDatabase.mimeTypeForUrl(url);
20
if
(!mimeType.isValid())
21
return
false
;
22
23
const
QByteArray mimeTypeName = mimeType.name().toLatin1();
24
QByteArray urlData = url.toString().toLocal8Bit();
25
char
*rawUrlData = urlData.data();
26
27
if
(be_roster->Launch(mimeTypeName.constData(), 1, &rawUrlData) != B_OK)
28
return
false
;
29
30
return
true
;
31
}
32
33
bool
QHaikuServices::openDocument(
const
QUrl &url)
34
{
35
const
QByteArray localPath = QFile::encodeName(url.toLocalFile());
36
37
entry_ref ref;
38
if
(get_ref_for_path(localPath.constData(), &ref) != B_OK)
39
return
false
;
40
41
if
(be_roster->Launch(&ref) != B_OK)
42
return
false
;
43
44
return
true
;
45
}
46
47
QByteArray QHaikuServices::desktopEnvironment()
const
48
{
49
return
QByteArray(
"Haiku"
);
50
}
51
52
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
plugins
platforms
haiku
qhaikuservices.cpp
Generated on
for Qt by
1.18.0