From 80ab55d9679d928d997aa6680437b893efc6fc9c Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Tue, 2 Nov 2021 19:42:47 +1000 Subject: Fix for Haiku diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c1bcb2..2821df2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -422,7 +422,7 @@ endif() if(NOT WIN32) add_subdirectory(settings/contextmenu/servicemenuinstaller) - install( FILES settings/contextmenu/servicemenu.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR} ) + install( FILES settings/contextmenu/servicemenu.knsrc DESTINATION ${KDE_INSTALL_DATADIR}/knsrcfiles ) endif() ########### install files ############### diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index eec2d4c..f069efe 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -87,7 +87,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) : m_messageWidget->setCloseButtonVisible(true); m_messageWidget->hide(); -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU) if (getuid() == 0) { // We must be logged in as the root user; show a big scary warning diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.cpp b/src/kitemviews/private/kdirectorycontentscounterworker.cpp index 73799e7..c63db41 100644 --- a/src/kitemviews/private/kdirectorycontentscounterworker.cpp +++ b/src/kitemviews/private/kdirectorycontentscounterworker.cpp @@ -39,6 +39,10 @@ KDirectoryContentsCounterWorker::CountResult walkDir(const QString &dirPath, QT_STATBUF buf; while ((dirEntry = QT_READDIR(dir))) { +#ifdef Q_OS_HAIKU + struct stat sp; + stat(dirEntry->d_name, &sp); +#endif if (dirEntry->d_name[0] == '.') { if (dirEntry->d_name[1] == '\0' || !countHiddenFiles) { // Skip "." or hidden files @@ -53,10 +57,16 @@ KDirectoryContentsCounterWorker::CountResult walkDir(const QString &dirPath, // If only directories are counted, consider an unknown file type and links also // as directory instead of trying to do an expensive stat() // (see bugs 292642 and 299997). +#ifdef Q_OS_HAIKU + const bool countEntry = !countDirectoriesOnly || + S_ISDIR(sp.st_mode) || + S_ISLNK(sp.st_mode); +#else const bool countEntry = !countDirectoriesOnly || dirEntry->d_type == DT_DIR || dirEntry->d_type == DT_LNK || dirEntry->d_type == DT_UNKNOWN; +#endif if (countEntry) { ++count; } @@ -65,8 +75,11 @@ KDirectoryContentsCounterWorker::CountResult walkDir(const QString &dirPath, bool linkFound = false; QString nameBuf = QStringLiteral("%1/%2").arg(dirPath, dirEntry->d_name); - +#ifdef Q_OS_HAIKU + if (S_ISDIR(sp.st_mode) || S_ISLNK(sp.st_mode)) { +#else if (dirEntry->d_type == DT_REG || dirEntry->d_type == DT_LNK) { +#endif if (QT_STAT(nameBuf.toLocal8Bit(), &buf) == 0) { if (S_ISDIR(buf.st_mode)) { // was a dir link, recurse @@ -75,7 +88,11 @@ KDirectoryContentsCounterWorker::CountResult walkDir(const QString &dirPath, size += buf.st_size; } } +#ifdef Q_OS_HAIKU + if (S_ISDIR(sp.st_mode) || linkFound) { +#else if (dirEntry->d_type == DT_DIR || linkFound) { +#endif // recursion for dirs and dir links size += walkDir(nameBuf, countHiddenFiles, countDirectoriesOnly, dirEntry, allowedRecursiveLevel - 1).size; } -- 2.30.2 From ebbb23ee8605a5c8460245de0e61f39ce2d6ced7 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 18 May 2022 22:33:30 +1000 Subject: Autostart for dbus and kwallet diff --git a/src/main.cpp b/src/main.cpp index 7a2d42e..273441b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,6 +36,11 @@ #ifndef Q_OS_WIN #include #endif +#ifdef Q_OS_HAIKU +#include +#include +#include +#endif #include int main(int argc, char **argv) @@ -191,6 +196,21 @@ int main(int argc, char **argv) mainWindow->show(); +#ifdef Q_OS_HAIKU + if (getenv("DBUS_SESSION_BUS_PID") == NULL) { + QProcess dbusProcess; + QString exec = "/bin/dbus-launch"; + QStringList params; + dbusProcess.start(exec, params); + dbusProcess.waitForFinished(); + QString output(dbusProcess.readAllStandardOutput()); + + QStringList list = output.split("\n", Qt::SkipEmptyParts); + for (int i = 0; i < list.count(); i++) + putenv(list.at(i).toLatin1().data()); + } +#endif + // Allow starting Dolphin on a system that is not running DBus: KDBusService::StartupOptions serviceOptions = KDBusService::Multiple; if (!QDBusConnection::sessionBus().isConnected()) { @@ -199,6 +219,11 @@ int main(int argc, char **argv) KDBusService dolphinDBusService(serviceOptions); DBusInterface interface; +#ifdef Q_OS_HAIKU + QProcess kwalletProcess; + kwalletProcess.start("/bin/kwalletd5", QStringList()); +#endif + if (!app.isSessionRestored()) { KConfigGui::setSessionConfig(QStringLiteral("dolphin"), QStringLiteral("dolphin")); } @@ -236,6 +261,12 @@ int main(int argc, char **argv) auto feedbackProvider = DolphinFeedbackProvider::instance(); Q_UNUSED(feedbackProvider) #endif - +#ifdef Q_OS_HAIKU + int status=app.exec(); + kwalletProcess.kill(); + system("kill -3 $DBUS_SESSION_BUS_PID"); + return status; +#else return app.exec(); // krazy:exclude=crash; +#endif } -- 2.30.2