From 6a50f9dcbba929feaaa1c62579fe881a3fbfe280 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 5 May 2020 00:13:32 +1000
Subject: Disable dbus for Haiku


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46c5c75..9f96b0a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,6 +202,12 @@ add_definitions(
 -DQT_NO_CAST_TO_ASCII
 )
 
+if(HAIKU)
+    add_definitions(
+      -DQT_NO_DBUS
+    )
+endif()
+
 # only with this definition will all the FOO_TEST_EXPORT macro do something
 # TODO: check if this can be moved to only those places which make use of it,
 # to reduce global compiler definitions that would trigger a recompile of
diff --git a/src/libs/main/CMakeLists.txt b/src/libs/main/CMakeLists.txt
index 5a27cca..8a7f2ea 100644
--- a/src/libs/main/CMakeLists.txt
+++ b/src/libs/main/CMakeLists.txt
@@ -51,7 +51,7 @@ set(komain_LIB_SRCS
     Calligra2Migration.cpp
 )
 
-if( Qt5DBus_FOUND )
+if( Qt5DBus_FOUND AND NOT HAIKU )
     set(komain_LIB_SRCS ${komain_LIB_SRCS}
         KoApplicationAdaptor.cpp
         KoViewAdaptor.cpp
diff --git a/src/libs/main/KoDocument.cpp b/src/libs/main/KoDocument.cpp
index 76ecad0..490f549 100644
--- a/src/libs/main/KoDocument.cpp
+++ b/src/libs/main/KoDocument.cpp
@@ -58,7 +58,9 @@
 #include <MainDebug.h>
 #include <kconfiggroup.h>
 #include <kio/job.h>
+#ifndef QT_NO_DBUS
 #include <kdirnotify.h>
+#endif
 #include <KBackup>
 
 #include <QMimeDatabase>
@@ -418,8 +420,9 @@ public:
         }
         else
         {
+#ifndef QT_NO_DBUS
             ::org::kde::KDirNotify::emitFilesAdded(QUrl::fromLocalFile(m_url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path()));
-
+#endif
             m_uploadJob = 0;
             document->setModified(false);
             emit document->completed();
diff --git a/src/workpackage/main.cpp b/src/workpackage/main.cpp
index 12af06e..03ca223 100644
--- a/src/workpackage/main.cpp
+++ b/src/workpackage/main.cpp
@@ -20,9 +20,9 @@
 
 // clazy:excludeall=qstring-arg
 #include "commandlineparser.h"
-
+#ifndef QT_NO_DBUS
 #include <KDBusService>
-
+#endif
 #include <QApplication>
 #include <QLoggingCategory>
 #include <QDir>
@@ -38,7 +38,9 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
         // service name, so reset the application name:
         app.setApplicationName("calligraplanwork");
 #endif
+#ifndef QT_NO_DBUS
     KDBusService service(KDBusService::Unique);
+#endif
     // we come here only once...
 
     /**
@@ -60,7 +62,9 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
     m.migrate();
 
     CommandLineParser cmd;
+#ifndef QT_NO_DBUS
     QObject::connect(&service, &KDBusService::activateRequested, &cmd, &CommandLineParser::handleActivateRequest);
+#endif
     cmd.handleCommandLine(QDir::current());
     return app.exec();
 }
-- 
2.26.0

