From 7317abc82caa3aceab44b75a93173c71e7f94359 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 4 May 2020 15:43:23 +1000
Subject: Fix build for Haiku


diff --git a/CMakeLists.txt b/CMakeLists.txt
index deca38e..10d3b43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -347,6 +347,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/filters/sheets/CMakeLists.txt b/filters/sheets/CMakeLists.txt
index e84a1f3..90e708a 100644
--- a/filters/sheets/CMakeLists.txt
+++ b/filters/sheets/CMakeLists.txt
@@ -21,8 +21,9 @@ if(SHOULD_BUILD_FILTER_QUATTROPRO_TO_SHEETS)
 endif()
 
 add_subdirectory( html )
+if(NOT HAIKU)
 add_subdirectory( latex )
-
+endif()
 add_subdirectory( excel )
 
 if(SHOULD_BUILD_FILTER_XLSX_TO_ODS)
diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
index 52f2c12..89907b0 100644
--- a/libs/CMakeLists.txt
+++ b/libs/CMakeLists.txt
@@ -21,7 +21,7 @@ if (SHOULD_BUILD_LIB_KOMAIN)
     add_subdirectory( main )
 endif ()
 
-if (SHOULD_BUILD_FEATURE_SCRIPTING)
+if (SHOULD_BUILD_FEATURE_SCRIPTING AND NOT HAIKU)
     add_subdirectory( kross )
 endif ()
 
diff --git a/libs/main/CMakeLists.txt b/libs/main/CMakeLists.txt
index 9aaa9b1..82b4d0e 100644
--- a/libs/main/CMakeLists.txt
+++ b/libs/main/CMakeLists.txt
@@ -71,7 +71,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/libs/main/KoDocument.cpp b/libs/main/KoDocument.cpp
index 66d9618..a43497a 100644
--- a/libs/main/KoDocument.cpp
+++ b/libs/main/KoDocument.cpp
@@ -57,7 +57,9 @@
 #include <MainDebug.h>
 #include <kconfiggroup.h>
 #include <kio/job.h>
+#ifndef QT_NO_DBUS
 #include <kdirnotify.h>
+#endif
 #include <KBackup>
 
 #include <QMimeDatabase>
@@ -415,8 +417,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/libs/widgets/KoPageLayoutWidget.cpp b/libs/widgets/KoPageLayoutWidget.cpp
index a3816f9..7b2c2fc 100644
--- a/libs/widgets/KoPageLayoutWidget.cpp
+++ b/libs/widgets/KoPageLayoutWidget.cpp
@@ -19,6 +19,8 @@
 
 #include "KoPageLayoutWidget.h"
 
+#include <QButtonGroup>
+
 #include <ui_KoPageLayoutWidget.h>
 
 #include <KoUnit.h>
diff --git a/sheets/CMakeLists.txt b/sheets/CMakeLists.txt
index 87a8e6f..372a228 100644
--- a/sheets/CMakeLists.txt
+++ b/sheets/CMakeLists.txt
@@ -149,7 +149,7 @@ set (functions_DIR_SRCS
     functions/helper.cpp
     )
 
-if(Qt5DBus_FOUND)
+if(Qt5DBus_FOUND AND NOT HAIKU)
 set (interfaces_DIR_SRCS
     interfaces/MapAdaptor.cpp
     interfaces/SheetAdaptor.cpp
@@ -244,7 +244,7 @@ set (calligrasheetscommon_LIB_SRCS
     ${ui_DIR_SRCS}
     )
 
-if(Qt5DBus_FOUND)
+if(Qt5DBus_FOUND AND NOT HAIKU)
 set (calligrasheetscommon_LIB_SRCS
     ${calligrasheetscommon_LIB_SRCS}
     ${interfaces_DIR_SRCS}
diff --git a/sheets/plugins/CMakeLists.txt b/sheets/plugins/CMakeLists.txt
index b18b166..c576b92 100644
--- a/sheets/plugins/CMakeLists.txt
+++ b/sheets/plugins/CMakeLists.txt
@@ -1,5 +1,5 @@
 add_subdirectory( calendar )
 add_subdirectory( solver )
-if (SHOULD_BUILD_FEATURE_SCRIPTING)
+if (SHOULD_BUILD_FEATURE_SCRIPTING AND NOT HAIKU)
   add_subdirectory( scripting )
 endif ()
diff --git a/sheets/plugins/calendar/CalendarToolWidget.cpp b/sheets/plugins/calendar/CalendarToolWidget.cpp
index 0c5eeb6..5611383 100644
--- a/sheets/plugins/calendar/CalendarToolWidget.cpp
+++ b/sheets/plugins/calendar/CalendarToolWidget.cpp
@@ -29,6 +29,7 @@
 
 #include <kdatepicker.h>
 
+#include <QDate>
 #include <QPushButton>
 #include <QDate>
 
diff --git a/stage/part/CMakeLists.txt b/stage/part/CMakeLists.txt
index 264d2fc..1eaff01 100644
--- a/stage/part/CMakeLists.txt
+++ b/stage/part/CMakeLists.txt
@@ -135,7 +135,7 @@ set( calligrastageprivate_LIB_SRCS
      tools/KPrPlaceholderToolFactory.cpp
    )
 
-if(Qt5DBus_FOUND)
+if(Qt5DBus_FOUND AND NOT HAIKU)
 set( calligrastageprivate_LIB_SRCS
      ${calligrastageprivate_LIB_SRCS}
      KPrViewAdaptor.cpp
diff --git a/stage/part/KPrPresentationTool.cpp b/stage/part/KPrPresentationTool.cpp
index 3007f91..9a42e4f 100644
--- a/stage/part/KPrPresentationTool.cpp
+++ b/stage/part/KPrPresentationTool.cpp
@@ -24,6 +24,7 @@
 
 #include "KPrPresentationTool.h"
 
+#include <QFrame>
 #include <QWidget>
 #include <QVBoxLayout>
 #include <QPainter>
-- 
2.28.0


From 2a3dcdabc66733e3b1e0d46120fe6b6f00f0cc0c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 29 Dec 2020 22:44:06 +1000
Subject: Disable doctools for Haiku


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10d3b43..23b6370 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1158,6 +1158,6 @@ find_package(KF5I18n CONFIG REQUIRED)
 ki18n_install(po)
 
   find_package(KF5DocTools CONFIG)
-  if(KF5DocTools_FOUND)
+  if(KF5DocTools_FOUND AND NOT HAIKU)
     kdoctools_install(po)
   endif()
-- 
2.28.0

