Nextcloud client: Add recipe for 3.11.1 (#10045)

* Nextcloud client: Add recipe for 3.11.1
This commit is contained in:
m199
2024-02-04 16:33:58 +01:00
committed by GitHub
parent 7cc8d1b4db
commit 0476464d25
3 changed files with 859 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "@APP_NAME@",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";
resource vector_icon {
$"6E63696602020006023D43AABDB7473DB7473D43AA4CF88A4CBEBC000082C9FF"
$"1CAFFF05FF050606FF07CC5740CC5740CC57C6B4BFBFCC57C6B4CC57B8CBCC57"
$"B32840B328C6B4B328B8CBBFBFB328B8CBB328C6B4B328CC5740CC57B8CBCC57"
$"40400606FF07C736BE74C736BE74C7F1BE74C882BFBFC882BF05C882C07AC736"
$"C10BC7F1C10BC67CC10BC5EBBFBFC5EBC07AC5EBBF05C736BE74C67CBE74C736"
$"BE74BE740606FF03B848BE74B848BE74B903BE74B994BFBFB994BF05B994C07A"
$"B848C10BB903C10BB78EC10BB6FDBFBFB6FDC07AB6FDBF05B848BE74B78EBE74"
$"B848BE74B8480606FF07BFC4BCC3BFC4BCC3C16CBCC3C2C0BFBFC2C0BE17C2C0"
$"C168BFC4C2BCC16CC2BCBE1BC2BCBCC8BFBFBCC8C168BCC8BE17BFC4BCC3BE1B"
$"BCC3BFC4BCC3BCC3020EBFC4BAECBFC4BAECBD91BAECBB20BE6EBBB4BC69BAA0"
$"3AB848BC9CB989BC9CB68FBC9CB525BFBFB525BE06B525C178B848C2E3B68FC2"
$"E3B989C2E3BB20C111BAA0C223BBB4C316BFC4C493BD91C493C1F2C493C464C1"
$"1CC3CDC31BC4E7C228C736C2E3C5FAC2E3C8EFC2E3CA5ABFBFCA5AC178CA5ABE"
$"06C736BC9CC8EFBC9CC5FABC9CC464BE63C4E7BD57C3CDBC63BFC4BAECC1F2BA"
$"ECBFC4BAECBFC4BAECBFC4BAECBFC4BAEC020A000100000A01040102030400"
};

View File

@@ -0,0 +1,163 @@
SUMMARY="A syncing client for Nextcloud"
DESCRIPTION="This Nextcloud client is a tool to synchronize files with a Nextcloud server."
HOMEPAGE="https://nextcloud.com"
COPYRIGHT="Nextcloud GmbH"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/nextcloud/desktop/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="9f60a6707d31e82357780dff11168ede88d1f859481a22f2d04c827e656f3fba"
SOURCE_DIR="desktop-$portVersion"
PATCHES="nextcloud_client-$portVersion.patchset"
ADDITIONAL_FILES="nextcloud_client.rdef.in"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
GLOBAL_WRITABLE_FILES="
settings/Nextcloud/sync-exclude.lst keep-old
"
PROVIDES="
nextcloud_client$secondaryArchSuffix = $portVersion
cmd:nextcloud$secondaryArchSuffix = $portVersion
cmd:nextcloudcmd$secondaryArchSuffix = $portVersion
lib:libnextcloud_csync$secondaryArchSuffix = $libVersionCompat
lib:libnextcloudsync$secondaryArchSuffix = $libVersionCompat
lib:nextcloudsync_vfs_suffix$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcmocka$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libkf5archive$secondaryArchSuffix
lib:libQt5Concurrent$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5DBus$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libqt5keychain$secondaryArchSuffix
lib:libqt5Network$secondaryArchSuffix
lib:libQT5Qml$secondaryArchSuffix
lib:libQt5QmlModels$secondaryArchSuffix
lib:libQt5Quick$secondaryArchSuffix
lib:libQt5QuickControls2$secondaryArchSuffix
lib:libQt5Sql$secondaryArchSuffix
lib:libQt5Svg$secondaryArchSuffix
lib:libqt5Test$secondaryArchSuffix
lib:libQt5WebEngine$secondaryArchSuffix
lib:libQt5WebEngineWidgets$secondaryArchSuffix
lib:libQt5WebSockets$secondaryArchSuffix
lib:libQt5Widgets$secondaryArchSuffix
lib:libQt5Xml$secondaryArchSuffix
lib:libsqlite3$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
#optional
lib:libQt5WebChannel$secondaryArchSuffix
lib:libQt5Positioning$secondaryArchSuffix
lib:libQt5WebEngineCore$secondaryArchSuffix
lib:libQt5PrintSupport$secondaryArchSuffix
"
PROVIDES_devel="
nextcloud_client${secondaryArchSuffix}_devel = $portVersion
devel:libnextcloud_csync$secondaryArchSuffix = $libVersionCompat
devel:libnextcloudsync$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
nextcloud_client$secondaryArchSuffix == $portVersion base
devel:libQt5Gui$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
extra_cmake_modules$secondaryArchSuffix
devel:libcmocka$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libkf5archive$secondaryArchSuffix
devel:libQt5Concurrent$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libQt5DBus$secondaryArchSuffix
devel:libQt5Gui$secondaryArchSuffix
devel:libqt5keychain$secondaryArchSuffix
devel:libqt5Network$secondaryArchSuffix
devel:libQT5Qml$secondaryArchSuffix
devel:libQt5QmlModels$secondaryArchSuffix
devel:libQt5Quick$secondaryArchSuffix
devel:libQt5QuickControls2$secondaryArchSuffix
devel:libQt5Sql$secondaryArchSuffix
devel:libQt5Svg$secondaryArchSuffix
devel:libqt5Test$secondaryArchSuffix
devel:libQt5WebEngine$secondaryArchSuffix
devel:libQt5WebEngineWidgets$secondaryArchSuffix
devel:libQt5WebSockets$secondaryArchSuffix
devel:libQt5Widgets$secondaryArchSuffix
devel:libQt5Xml$secondaryArchSuffix
devel:libsqlite3$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libz$secondaryArchSuffix
#optional
devel:libQt5Core$secondaryArchSuffix
devel:libQt5WebChannel$secondaryArchSuffix
devel:libQt5Positioning$secondaryArchSuffix
devel:libQt5WebEngineCore$secondaryArchSuffix
devel:libQt5PrintSupport$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:g++$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:linguist$secondaryArchSuffix >= 5
cmd:rsvg_convert
"
BUILD()
{
cmake -Bbuild -S. $cmakeDirArgs \
-DCMAKE_INSTALL_BINDIR=$commandBinDir \
-DINCLUDE_INSTALL_DIR=$includeDir \
-DSYSCONF_INSTALL_DIR=$settingsDir \
-DCMAKE_BUILD_TYPE=Release -Wno-dev
make -Cbuild $jobArgs
}
INSTALL()
{
make -Cbuild install
# don't mess with shared_mime_info files
rm -rf $dataDir/mime/{aliases,generic-icons,globs,globs2,icons,magic}
rm -rf $dataDir/mime/{mime.cache,subclasses,treemagic,types,version,XMLnamespaces}
# cleanup (not needed)
rm -rf $dataDir/{applications/icons}
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
local APP_NAME="Nextcloud Desktop Client"
local LONG_INFO="$SUMMARY"
local APP_SIGNATURE="application/x-vnd.nextcloud"
sed \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
-e "s|@APP_NAME@|$APP_NAME|" \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
$portDir/additional-files/nextcloud_client.rdef.in > nextcloud_client.rdef
addResourcesToBinaries nextcloud_client.rdef $commandBinDir/nextcloud
addAppDeskbarSymlink $commandBinDir/nextcloud Nextcloud
prepareInstalledDevelLibs \
libnextcloud_csync \
libnextcloudsync
packageEntries devel \
$developDir
}

View File

@@ -0,0 +1,665 @@
From f6737becbfd3904461ed60eb7fcb9a047b47e094 Mon Sep 17 00:00:00 2001
From: Daniel Weber <weberd@outlook.de>
Date: Sat, 3 Feb 2024 23:59:04 +0100
Subject: Adapt Patch to 3.11.1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d65f50..dc3b84a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -206,7 +206,7 @@ if(BUILD_CLIENT)
find_package(Sparkle)
endif()
- if(UNIX AND NOT APPLE)
+ if(UNIX AND NOT APPLE AND NOT HAIKU)
find_package(Inotify REQUIRED)
endif()
find_package(Sphinx)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bf3ff9a..c7cdeaa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -68,7 +68,7 @@ if(NOT TOKEN_AUTH_ONLY)
endif()
# TODO: Mingw64 7.3 might also need to be excluded here as it seems to not automatically link libssp
-if(NOT MSVC)
+if(NOT MSVC AND NOT HAIKU)
if(NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "^(alpha|parisc|hppa)") AND NOT CMAKE_CROSSCOMPILING)
if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector --param=ssp-buffer-size=4")
diff --git a/src/common/common.cmake b/src/common/common.cmake
index 1265427..028aeac 100644
--- a/src/common/common.cmake
+++ b/src/common/common.cmake
@@ -25,7 +25,11 @@ elseif(APPLE)
list(APPEND common_SOURCES
${CMAKE_CURRENT_LIST_DIR}/utility_mac.mm
)
-elseif(UNIX AND NOT APPLE)
+elseif(HAIKU)
+ list(APPEND common_SOURCES
+ ${CMAKE_CURRENT_LIST_DIR}/utility_haiku.cpp
+ )
+elseif(UNIX AND NOT APPLE AND NOT HAIKU)
list(APPEND common_SOURCES
${CMAKE_CURRENT_LIST_DIR}/utility_unix.cpp
)
diff --git a/src/common/utility.cpp b/src/common/utility.cpp
index e4eff93..2c06960 100644
--- a/src/common/utility.cpp
+++ b/src/common/utility.cpp
@@ -45,6 +45,12 @@
#include <unistd.h>
#endif
+#ifdef Q_OS_HAIKU
+#include <sys/statvfs.h>
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
#include <cmath>
#include <cstdarg>
#include <cstring>
@@ -153,6 +159,8 @@ static QLatin1String platform()
return QLatin1String("DragonFlyBSD");
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_FREEBSD_KERNEL)
return QLatin1String("FreeBSD");
+#elif defined(Q_OS_HAIKU)
+ return QLatin1String("Haiku");
#elif defined(Q_OS_NETBSD)
return QLatin1String("NetBSD");
#elif defined(Q_OS_OPENBSD)
@@ -186,7 +194,7 @@ QByteArray Utility::friendlyUserAgentString()
qint64 Utility::freeDiskSpace(const QString &path)
{
-#if defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) || defined(Q_OS_FREEBSD_KERNEL) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD)
+#if defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) || defined(Q_OS_FREEBSD_KERNEL) || defined(Q_OS_HAIKU) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD)
struct statvfs stat;
if (statvfs(path.toLocal8Bit().data(), &stat) == 0) {
return (qint64)stat.f_bavail * stat.f_frsize;
diff --git a/src/common/utility.h b/src/common/utility.h
index bd62a5d..f021849 100644
--- a/src/common/utility.h
+++ b/src/common/utility.h
@@ -134,6 +134,7 @@ namespace Utility {
inline bool isUnix();
inline bool isLinux(); // use with care
inline bool isBSD(); // use with care, does not match OS X
+ inline bool isHaiku();
OCSYNC_EXPORT QString platformName();
// crash helper for --debug
@@ -341,5 +342,14 @@ inline bool Utility::isBSD()
#endif
}
+inline bool Utility::isHaiku()
+{
+#if defined(Q_OS_HAIKU)
+ return true;
+#else
+ return false;
+#endif
+}
+
}
#endif // UTILITY_H
diff --git a/src/common/utility_haiku.cpp b/src/common/utility_haiku.cpp
new file mode 100644
index 0000000..fa876e4
--- /dev/null
+++ b/src/common/utility_haiku.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
+ * Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "utility.h"
+#include "config.h"
+
+#include <QCoreApplication>
+#include <QDir>
+#include <QFile>
+#include <QStandardPaths>
+#include <QtGlobal>
+#include <QProcess>
+#include <QString>
+#include <QTextStream>
+
+#include <FindDirectory.h>
+#include <Path.h>
+
+namespace OCC {
+
+void Utility::setupFavLink(const QString &folder)
+{
+ Q_UNUSED(folder);
+ // Haiku doesn't really have that concept of bookmarks on folders
+}
+
+void Utility::removeFavLink(const QString &folder)
+{
+ Q_UNUSED(folder);
+ // Haiku doesn't really have that concept of bookmarks on folders
+}
+
+// returns the autostart directory the Haiku way
+// should probably use launch_daemon service directly though
+// instead of the old way
+static QString getUserAutostartDir()
+{
+ BPath path;
+ find_directory(B_USER_SETTINGS_DIRECTORY, &path);
+ QString config = QString::fromUtf8(path.Path());
+ config += QLatin1String("/boot/launch/");
+ return config;
+}
+
+bool Utility::hasSystemLaunchOnStartup(const QString &appName)
+{
+ Q_UNUSED(appName)
+ return false;
+}
+
+bool Utility::hasLaunchOnStartup(const QString &appName)
+{
+ QString startupFileLocation = getUserAutostartDir() + appName;
+ return QFile::exists(startupFileLocation);
+}
+
+void Utility::setLaunchOnStartup(const QString &appName, const QString &guiName, bool enable)
+{
+ const auto userAutoStartPath = getUserAutostartDir();
+ QString startupFileLocation = userAutoStartPath + appName;
+ if (enable) {
+ if (!QDir().exists(userAutoStartPath) && !QDir().mkpath(userAutoStartPath)) {
+ qCWarning(lcUtility) << "Could not create autostart folder" << userAutoStartPath;
+ return;
+ }
+ if (!QFile::link(QCoreApplication::applicationFilePath(), startupFileLocation)) {
+ qCWarning(lcUtility) << "Could not write autostart symlink" << startupFileLocation;
+ return;
+ }
+ } else {
+ if (!QFile::remove(startupFileLocation)) {
+ qCWarning(lcUtility) << "Could not remove autostart symlink";
+ }
+ }
+}
+
+bool Utility::hasDarkSystray()
+{
+ return true;
+}
+
+QString Utility::getCurrentUserName()
+{
+ return {};
+}
+
+void Utility::registerUriHandlerForLocalEditing()
+{
+ const auto appImagePath = qEnvironmentVariable("APPIMAGE");
+ const auto runningInsideAppImage = !appImagePath.isNull() && QFile::exists(appImagePath);
+
+ if (!runningInsideAppImage) {
+ // only register x-scheme-handler if running inside appImage
+ return;
+ }
+
+ // mirall.desktop.in must have an x-scheme-handler mime type specified
+ const QString desktopFileName = QLatin1String(LINUX_APPLICATION_ID) + QLatin1String(".desktop");
+ QProcess process;
+ const QStringList args = {
+ QLatin1String("default"),
+ desktopFileName,
+ QStringLiteral("x-scheme-handler/%1").arg(QStringLiteral(APPLICATION_URI_HANDLER_SCHEME))
+ };
+ process.start(QStringLiteral("xdg-mime"), args, QIODevice::ReadOnly);
+ process.waitForFinished();
+}
+
+} // namespace OCC
diff --git a/src/csync/CMakeLists.txt b/src/csync/CMakeLists.txt
index 382eab2..455e820 100644
--- a/src/csync/CMakeLists.txt
+++ b/src/csync/CMakeLists.txt
@@ -72,7 +72,7 @@ generate_export_header(nextcloud_csync
target_link_libraries(nextcloud_csync
PUBLIC
${CSYNC_REQUIRED_LIBRARIES}
- Qt5::Core Qt5::Concurrent
+ Qt5::Core Qt5::Concurrent be
)
if(ZLIB_FOUND)
diff --git a/src/csync/std/c_private.h b/src/csync/std/c_private.h
index 8307859..0ddcaa8 100644
--- a/src/csync/std/c_private.h
+++ b/src/csync/std/c_private.h
@@ -85,7 +85,7 @@ using csync_stat_t = struct stat;
#endif
#ifndef HAVE_LSTAT
-#define lstat _stat
+#define lstat stat
#endif
/* tchar definitions for clean win32 filenames */
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 1968683..e81b1fe 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -311,7 +311,7 @@ IF( APPLE )
endif()
ENDIF()
-IF( NOT WIN32 AND NOT APPLE )
+IF( NOT WIN32 AND NOT APPLE AND NOT HAIKU )
set(client_SRCS ${client_SRCS} folderwatcher_linux.cpp)
ENDIF()
IF( WIN32 )
@@ -320,6 +320,9 @@ ENDIF()
IF( APPLE )
list(APPEND client_SRCS folderwatcher_mac.cpp)
ENDIF()
+IF( APPLE )
+list(APPEND client_SRCS folderwatcher_haiku.cpp)
+ENDIF()
set(3rdparty_SRC
../3rdparty/QProgressIndicator/QProgressIndicator.h
@@ -537,6 +540,7 @@ target_link_libraries(nextcloudCore
Qt5::Quick
Qt5::QuickControls2
KF5::Archive
+ be
)
add_subdirectory(socketapi)
diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp
index 0743646..5d01a95 100644
--- a/src/gui/folderwatcher.cpp
+++ b/src/gui/folderwatcher.cpp
@@ -23,6 +23,8 @@
#include "folderwatcher_win.h"
#elif defined(Q_OS_MAC)
#include "folderwatcher_mac.h"
+#elif defined(Q_OS_HAIKU)
+#include "folderwatcher_haiku.h"
#elif defined(Q_OS_UNIX)
#include "folderwatcher_linux.h"
#endif
@@ -128,6 +130,10 @@ void FolderWatcher::startNotificatonTest(const QString &path)
return;
#endif
+#ifdef Q_OS_HAIKU
+ return;
+#endif
+
Q_ASSERT(_testNotificationPath.isEmpty());
_testNotificationPath = path;
diff --git a/src/gui/folderwatcher_haiku.cpp b/src/gui/folderwatcher_haiku.cpp
new file mode 100644
index 0000000..21e6fe4
--- /dev/null
+++ b/src/gui/folderwatcher_haiku.cpp
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) by François Revol <revol@free.fr>
+ *
+ * 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.
+ */
+#include "config.h"
+
+#include "folder.h"
+#include "folderwatcher.h"
+#include "folderwatcher_haiku.h"
+
+
+#include <cerrno>
+#include <QObject>
+#include <QStringList>
+
+#include <Application.h>
+#include <Path.h>
+#include <String.h>
+#include <private/storage/PathMonitor.h>
+
+
+
+namespace OCC {
+
+
+void WatcherHandler::MessageReceived(BMessage* message)
+{
+ qCDebug(lcFolderWatcher) << "WatcherHandler::MessageReceived()" << message->what;
+ if (message->what != B_PATH_MONITOR) {
+ BHandler::MessageReceived(message);
+ return;
+ }
+
+ int32 opcode;
+ if (message->FindInt32("opcode", &opcode) != B_OK)
+ return;
+
+ const char *path = NULL;
+ if (message->FindString("path", &path) != B_OK)
+ return;
+
+ // get the filename
+ // sometimes we have it in the message, but not always
+ BPath p(path);
+ BString fileName(p.Leaf());
+ if (fileName.StartsWith("._sync_")
+ || fileName.StartsWith(".csync_journal.db")
+ || fileName.StartsWith(".nextloudsync.log")
+ || fileName.StartsWith(".sync_")) {
+ return;
+ }
+
+ int32 fields;
+ QStringList paths;
+
+ switch (opcode) {
+ case B_ENTRY_MOVED:
+ {
+ const char *from = NULL;
+ if (message->FindString("from path", &from) != B_OK)
+ return;
+ QString qFrom = QString::fromUtf8(from);
+ paths.append(qFrom);
+ break;
+ }
+ case B_ENTRY_CREATED:
+ case B_ENTRY_REMOVED:
+ break;
+ case B_STAT_CHANGED:
+ if (message->FindInt32("fields", &fields) != B_OK)
+ return;
+ // we're only interested in mtime
+ // and content change... which should always change mtime though
+ // just to be sure, check size changes as well
+ if (fields & (B_STAT_MODIFICATION_TIME | B_STAT_SIZE))
+ break;
+ return;
+ case B_ATTR_CHANGED:
+ // TODO: it is just unacceptable to not handle xattrs on Haiku!
+ // but it must be done properly,
+ // cf. http://dcevents.dublincore.org/IntConf/dc-2011/paper/view/53
+ default:
+ // discard
+ return;
+ }
+
+ //message->PrintToStream();
+
+ QString qPath = QString::fromUtf8(path);
+ paths.append(qPath);
+ emit changed(paths);
+}
+
+
+FolderWatcherPrivate::FolderWatcherPrivate(FolderWatcher *p, const QString &path)
+ : _parent(p)
+ , _folder(path)
+ , _handler(new WatcherHandler)
+{
+ this->startWatching();
+}
+
+FolderWatcherPrivate::~FolderWatcherPrivate()
+{
+ BPrivate::BPathMonitor::StopWatching(BMessenger(_handler));
+ be_app->Lock();
+ be_app->RemoveHandler(_handler);
+ be_app->Unlock();
+ delete _handler;
+}
+
+void FolderWatcherPrivate::startWatching()
+{
+ qCDebug(lcFolderWatcher) << "FolderWatcherPrivate::startWatching()" << _folder;
+
+ // it needs to be attached to a BLooper, which be_app happens to be.
+ be_app->Lock();
+ be_app->AddHandler(_handler);
+ be_app->Unlock();
+
+ connect(_handler, SIGNAL(changed(const QStringList &)),
+ _parent, SLOT(changeDetected(const QStringList &)));
+ connect(_handler, SIGNAL(lostChanges()),
+ _parent, SIGNAL(lostChanges()));
+
+ BMessenger messenger(_handler);
+ uint32 flags = B_WATCH_RECURSIVELY | B_WATCH_NAME | B_WATCH_STAT;
+ status_t err;
+ err = BPrivate::BPathMonitor::StartWatching(_folder.toUtf8().constData(), flags, messenger);
+ if (err != B_OK)
+ qCWarning(lcFolderWatcher) << "BPathMonitor::StartWatching failed: " << strerror(err);
+}
+
+
+} // ns mirall
diff --git a/src/gui/folderwatcher_haiku.h b/src/gui/folderwatcher_haiku.h
new file mode 100644
index 0000000..6bf7091
--- /dev/null
+++ b/src/gui/folderwatcher_haiku.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) by François Revol <revol@free.fr>
+ *
+ * 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.
+*/
+
+#define FOLDERWATCHER_HAIKU_H
+
+#include <QObject>
+#include <QString>
+
+#include <Handler.h>
+
+namespace OCC {
+
+/**
+ * @brief The WatcherHandler class
+ * @ingroup gui
+ */
+class WatcherHandler : public QObject, public BHandler {
+ Q_OBJECT
+public:
+ WatcherHandler() : QObject(), BHandler("FolderWatcher") {}
+ virtual ~WatcherHandler() {}
+ virtual void MessageReceived(BMessage* message);
+
+signals:
+ void changed(const QStringList &paths);
+ void lostChanges();
+
+private:
+ QString _path;
+};
+
+/**
+ * @brief Haiku API implementation of FolderWatcher
+ * @ingroup gui
+ */
+class FolderWatcherPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ FolderWatcherPrivate(FolderWatcher *p, const QString &path);
+ ~FolderWatcherPrivate();
+
+ void addPath(const QString &) {}
+ void removePath(const QString &) {}
+
+ void startWatching();
+
+ /// On Haiku the watcher is ready when the ctor finished.
+ bool _ready = 1;
+
+private:
+ FolderWatcher *_parent;
+
+ QString _folder;
+
+ WatcherHandler *_handler;
+};
+}
diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp
index 1df11cf..a5cf142 100644
--- a/src/gui/socketapi/socketapi.cpp
+++ b/src/gui/socketapi/socketapi.cpp
@@ -265,7 +265,7 @@ SocketApi::SocketApi(QObject *parent)
_system(QStringLiteral("pluginkit"), { QStringLiteral("-e"), QStringLiteral("use"), QStringLiteral("-i"), QStringLiteral(APPLICATION_REV_DOMAIN ".FinderSyncExt") });
#endif
- } else if (Utility::isLinux() || Utility::isBSD()) {
+ } else if (Utility::isLinux() || Utility::isBSD() || Utility::isHaiku()) {
QString runtimeDir;
runtimeDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
socketPath = runtimeDir + "/" + Theme::instance()->appName() + "/socket";
diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml
index 75380d5..3d8fdc7 100644
--- a/src/gui/tray/Window.qml
+++ b/src/gui/tray/Window.qml
@@ -80,7 +80,7 @@ ApplicationWindow {
}
background: Rectangle {
- radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius
+ // radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius
border.width: Style.trayWindowBorderWidth
border.color: palette.dark
color: palette.window
@@ -132,7 +132,7 @@ ApplicationWindow {
}
}
- OpacityMask {
+/* OpacityMask {
anchors.fill: parent
anchors.margins: Style.trayWindowBorderWidth
source: ShaderEffectSource {
@@ -145,7 +145,7 @@ ApplicationWindow {
radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius
}
}
-
+*/
Drawer {
id: userStatusDrawer
width: parent.width
diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp
index 7c58c7b..ff638e5 100644
--- a/src/libsync/filesystem.cpp
+++ b/src/libsync/filesystem.cpp
@@ -20,6 +20,7 @@
#include <QDir>
#include <QDirIterator>
#include <QCoreApplication>
+#include <sys/time.h>
#include "csync.h"
#include "vio/csync_vio_local.h"
@@ -74,7 +75,7 @@ bool FileSystem::setModTime(const QString &filename, time_t modTime)
struct timeval times[2];
times[0].tv_sec = times[1].tv_sec = modTime;
times[0].tv_usec = times[1].tv_usec = 0;
- int rc = c_utimes(filename, times);
+ int rc = -1; // c_utimes(filename, times);
if (rc != 0) {
qCWarning(lcFileSystem) << "Error setting mtime for" << filename
<< "failed: rc" << rc << ", errno:" << errno;
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 44396f2..63681d2 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -93,7 +93,7 @@ else()
nextcloud_build_test(E2eFileTransfer)
endif()
-if( UNIX AND NOT APPLE )
+if( UNIX AND NOT APPLE AND NOT HAIKU )
nextcloud_add_test(InotifyWatcher)
endif(UNIX AND NOT APPLE)
diff --git a/test/testfolderwatcher.cpp b/test/testfolderwatcher.cpp
index d57358d..ccf19b6 100644
--- a/test/testfolderwatcher.cpp
+++ b/test/testfolderwatcher.cpp
@@ -264,7 +264,7 @@ private slots:
}
};
-#ifdef Q_OS_MAC
+#ifdef Q_OS_HAIKU
QTEST_MAIN(TestFolderWatcher)
#else
QTEST_GUILESS_MAIN(TestFolderWatcher)
--
2.42.1
From b27e014efb1059381077ba6960dc3bc2ed38cd44 Mon Sep 17 00:00:00 2001
From: Daniel Weber <daniel.weber@vivaldi.net>
Date: Sun, 4 Feb 2024 00:09:35 +0100
Subject: Haiku not Apple
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index e81b1fe..5a01b92 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -320,7 +320,7 @@ ENDIF()
IF( APPLE )
list(APPEND client_SRCS folderwatcher_mac.cpp)
ENDIF()
-IF( APPLE )
+IF( HAIKU )
list(APPEND client_SRCS folderwatcher_haiku.cpp)
ENDIF()
--
2.42.1