Files
haikuports/kde-frameworks/kio/patches/kio-6.7.0.patchset
2024-10-29 18:17:29 +01:00

260 lines
8.1 KiB
Plaintext

From 542b8c450c0e6059808f8b5535d0d398fe561849 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Sun, 31 Oct 2021 13:15:08 +0300
Subject: Fix build on Haiku
diff --git a/autotests/jobtest.cpp b/autotests/jobtest.cpp
index 124e827..183c897 100644
--- a/autotests/jobtest.cpp
+++ b/autotests/jobtest.cpp
@@ -1977,7 +1977,7 @@ void JobTest::statTimeResolution()
QFile dest_file(filePath);
QVERIFY(dest_file.open(QIODevice::ReadOnly));
-#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_HAIKU)
// with nano secs precision
struct timespec ut[2];
ut[0].tv_sec = early70sTime;
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 3d67b34..89d8440 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -214,6 +214,10 @@ if (TARGET KF6::AuthCore)
target_link_libraries(KF6KIOCore PRIVATE KF6::AuthCore) #SlaveBase uses KAuth::Action
endif()
+if (HAIKU)
+ target_link_libraries(KF6KIOCore PRIVATE network)
+endif ()
+
if(ACL_FOUND)
target_link_libraries(KF6KIOCore PRIVATE ${ACL_LIBS})
endif()
diff --git a/src/gui/previewjob.cpp b/src/gui/previewjob.cpp
index d4da3e4..fe48479 100644
--- a/src/gui/previewjob.cpp
+++ b/src/gui/previewjob.cpp
@@ -14,7 +14,7 @@
#include "standardthumbnailjob_p.h"
#include "statjob.h"
-#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU)
#define WITH_SHM 1
#else
#define WITH_SHM 0
diff --git a/src/kioworkers/file/CMakeLists.txt b/src/kioworkers/file/CMakeLists.txt
index a8a393a..93c6fea 100644
--- a/src/kioworkers/file/CMakeLists.txt
+++ b/src/kioworkers/file/CMakeLists.txt
@@ -35,6 +35,10 @@ if(UNIX)
target_link_libraries(kio_file Qt6::Network KF6::AuthCore)
endif()
+if (HAIKU)
+ target_link_libraries(kio_file gnu network)
+endif ()
+
if(ACL_FOUND)
target_link_libraries(kio_file ${ACL_LIBS})
endif()
diff --git a/src/kioworkers/file/file_unix.cpp b/src/kioworkers/file/file_unix.cpp
index 56808dc..c8ecd79 100644
--- a/src/kioworkers/file/file_unix.cpp
+++ b/src/kioworkers/file/file_unix.cpp
@@ -69,6 +69,11 @@
#include <sys/extattr.h>
#endif
+#ifdef __HAIKU__
+#undef HAVE_DIRENT_D_TYPE
+#undef HAVE_SYS_XATTR_H
+#endif
+
using namespace KIO;
/* 512 kB */
@@ -789,7 +794,7 @@ WorkerResult FileProtocol::copy(const QUrl &srcUrl, const QUrl &destUrl, int _mo
// copy access and modification time
if (!wasKilled()) {
-#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_HAIKU)
// with nano secs precision
struct timespec ut[2];
ut[0] = buffSrc.st_atim;
diff --git a/src/kioworkers/file/kauth/CMakeLists.txt b/src/kioworkers/file/kauth/CMakeLists.txt
index 8d8c0ed..aa164e1 100644
--- a/src/kioworkers/file/kauth/CMakeLists.txt
+++ b/src/kioworkers/file/kauth/CMakeLists.txt
@@ -1,6 +1,10 @@
add_executable(file_helper filehelper.cpp fdsender.cpp)
target_link_libraries(file_helper Qt6::Network KF6::AuthCore KF6::I18n KF6::KIOCore)
+if (HAIKU)
+ target_link_libraries(file_helper network)
+endif ()
+
#install(TARGETS file_helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
#kauth_install_helper_files(file_helper org.kde.kio.file root)
#kauth_install_actions(org.kde.kio.file file.actions)
--
2.45.2
From 1b71ba3d2d5fb880136447fc78adef6a51a36893 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 17 May 2022 21:28:27 +1000
Subject: Add OpenWith handler for Haiku
diff --git a/src/gui/openurljob.cpp b/src/gui/openurljob.cpp
index 551bdac..b15f826 100644
--- a/src/gui/openurljob.cpp
+++ b/src/gui/openurljob.cpp
@@ -160,7 +160,7 @@ void KIO::OpenUrlJob::start()
emitResult();
};
-#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
+#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) || defined(Q_OS_HAIKU)
if (d->m_externalBrowserEnabled) {
// For Windows and MacOS, the mimetypes handling is different, so use QDesktopServices
qtOpenUrl();
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index bc91f9e..1268d6b 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -137,6 +137,10 @@ if(ACL_FOUND)
target_link_libraries(KF6KIOWidgets PRIVATE ${ACL_LIBS})
endif()
+if(HAIKU)
+ target_link_libraries(KF6KIOWidgets PRIVATE be tracker)
+endif()
+
# Headers not prefixed with KIO/
ecm_generate_headers(KIOWidgets_HEADERS
HEADER_NAMES
diff --git a/src/widgets/widgetsopenwithhandler.cpp b/src/widgets/widgetsopenwithhandler.cpp
index 8133c2e..f8c853a 100644
--- a/src/widgets/widgetsopenwithhandler.cpp
+++ b/src/widgets/widgetsopenwithhandler.cpp
@@ -20,6 +20,10 @@
#include "widgetsopenwithhandler_win.cpp" // displayNativeOpenWithDialog
#endif
+#ifdef Q_OS_HAIKU
+#include "widgetsopenwithhandler_haiku.cpp"
+#endif
+
KIO::WidgetsOpenWithHandler::WidgetsOpenWithHandler(QObject *parent)
: KIO::OpenWithHandlerInterface(parent)
{
@@ -48,7 +52,7 @@ void KIO::WidgetsOpenWithHandler::promptUserForApplication(KJob *job, const QLis
parentWidget = qApp->activeWindow();
}
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_HAIKU)
KConfigGroup cfgGroup(KSharedConfig::openConfig(), QStringLiteral("KOpenWithDialog Settings"));
if (cfgGroup.readEntry("Native", true)) {
// Implemented in applicationlauncherjob_win.cpp
diff --git a/src/widgets/widgetsopenwithhandler_haiku.cpp b/src/widgets/widgetsopenwithhandler_haiku.cpp
new file mode 100644
index 0000000..9614b87
--- /dev/null
+++ b/src/widgets/widgetsopenwithhandler_haiku.cpp
@@ -0,0 +1,38 @@
+/*
+ This file is part of the KDE libraries
+ SPDX-FileCopyrightText: 2022 Gerasim Troeglazov <3dEyes@gmail.com>
+
+ SPDX-License-Identifier: LGPL-2.0-or-later
+*/
+
+#include <QDir>
+#include <QWidget>
+
+#include <InterfaceKit.h>
+#include <StorageKit.h>
+#include <SupportKit.h>
+#include <MimeType.h>
+#include <Roster.h>
+
+static bool displayNativeOpenWithDialog(const QList<QUrl> &lst, QWidget *window)
+{
+ BMessenger trackerMessenger("application/x-vnd.Be-TRAK");
+ if (trackerMessenger.IsValid()) {
+ BMessage openCommand(B_REFS_RECEIVED);
+ for (const QUrl &url : lst) {
+ if (!url.isLocalFile())
+ return false;
+ QString filepath = QDir::toNativeSeparators(url.toLocalFile());
+ BEntry fileEntry(filepath.toUtf8().data());
+ entry_ref fileRef;
+ if (fileEntry.GetRef(&fileRef) == B_OK) {
+ update_mime_info(filepath.toUtf8().data(), false, true, false);
+ openCommand.AddRef("refs", &fileRef);
+ }
+ }
+ openCommand.AddInt32("launchUsingSelector", 0);
+ if (trackerMessenger.SendMessage(&openCommand) == B_OK)
+ return true;
+ }
+ return false;
+}
--
2.45.2
From 1e8892f0562913b1403163961a05b706cb64fc2d Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 25 Feb 2024 23:14:26 +1000
Subject: Fix build
diff --git a/src/kioworkers/file/file_unix.cpp b/src/kioworkers/file/file_unix.cpp
index c8ecd79..e773c37 100644
--- a/src/kioworkers/file/file_unix.cpp
+++ b/src/kioworkers/file/file_unix.cpp
@@ -72,6 +72,9 @@
#ifdef __HAIKU__
#undef HAVE_DIRENT_D_TYPE
#undef HAVE_SYS_XATTR_H
+#define HAVE_SYS_XATTR_H 0
+#undef HAVE_SYS_EXTATTR_H
+#define HAVE_SYS_EXTATTR_H 0
#endif
using namespace KIO;
--
2.45.2
From 2dc82096ef875c9cc1ccee51a73183dc7a3bdec1 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 10 Mar 2024 15:28:06 +1000
Subject: Disable threads kio_file support for now. It's totally broken on
OpenBSD and Haiku (https://bugs.kde.org/show_bug.cgi?id=463796)
diff --git a/src/core/worker.cpp b/src/core/worker.cpp
index 24d06bb..2b726a5 100644
--- a/src/core/worker.cpp
+++ b/src/core/worker.cpp
@@ -355,7 +355,7 @@ Worker *Worker::createWorker(const QString &protocol, const QUrl &url, int &erro
const auto useThreads = []() {
return qgetenv("KIO_ENABLE_WORKER_THREADS") != "0";
};
- static bool bUseThreads = useThreads();
+ static bool bUseThreads = false;
// Threads have performance benefits, but degrade robustness
// (a worker crashing kills the app). So let's only enable the feature for kio_file, for now.
--
2.45.2