From 20b096ebfa9d7b188c044ca166e62ce354355c63 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Wed, 30 Oct 2019 11:01:35 +0000
Subject: Add Haiku to the platforms


diff --git a/pdfium/core/fxcrt/include/fx_system.h b/pdfium/core/fxcrt/include/fx_system.h
index f4fc2e8..5c9aa84 100644
--- a/pdfium/core/fxcrt/include/fx_system.h
+++ b/pdfium/core/fxcrt/include/fx_system.h
@@ -23,6 +23,7 @@
 #define _FX_LINUX_DESKTOP_ 4
 #define _FX_MACOSX_ 7
 #define _FX_ANDROID_ 12
+#define _FX_HAIKU_ 16
 
 // _FXM_PLATFORM_ values;
 #define _FXM_PLATFORM_WINDOWS_ 1  // _FX_WIN32_DESKTOP_ or _FX_WIN64_DESKTOP_.
@@ -46,6 +47,9 @@
 #elif defined(__APPLE__)
 #define _FX_OS_ _FX_MACOSX_
 #define _FXM_PLATFORM_ _FXM_PLATFORM_APPLE_
+#elif defined(__HAIKU__)
+#define _FX_OS_ _FX_HAIKU_
+#define _FXM_PLATFORM_ _FXM_PLATFORM_LINUX_
 #endif
 #endif  // _FX_OS_
 
-- 
2.26.0


From 54c5a2dc0271c7d4f701ea2d8eb92d88c504f00d Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Wed, 30 Oct 2019 11:02:46 +0000
Subject: Haiku doesn't have d_type


diff --git a/pdfium/core/fxcrt/fx_basic_util.cpp b/pdfium/core/fxcrt/fx_basic_util.cpp
index abd84a8..65c0551 100644
--- a/pdfium/core/fxcrt/fx_basic_util.cpp
+++ b/pdfium/core/fxcrt/fx_basic_util.cpp
@@ -199,7 +199,9 @@ FX_BOOL FX_GetNextFile(void* handle,
     return FALSE;
   }
   filename = de->d_name;
+#ifndef __HAIKU__
   bFolder = de->d_type == DT_DIR;
+#endif
   return TRUE;
 #endif
 }
@@ -229,7 +231,9 @@ FX_BOOL FX_GetNextFile(void* handle,
     return FALSE;
   }
   filename = CFX_WideString::FromLocal(de->d_name);
+#ifndef __HAIKU__
   bFolder = de->d_type == DT_DIR;
+#endif
   return TRUE;
 #endif
 }
-- 
2.26.0


From 535065a5be47f49e629089f5b29b3fbe1cda099d Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Wed, 15 Jan 2020 16:00:47 +0000
Subject: Fix utilities.path


diff --git a/texmaker.pro b/texmaker.pro
index 399cc71..ed807de 100644
--- a/texmaker.pro
+++ b/texmaker.pro
@@ -1043,6 +1043,9 @@ OBJECTS_DIR = .obj
 isEmpty( PREFIX ) {
     PREFIX=/usr
 }
+isEmpty( UTILITIESDIR ) {
+	UTILITIESDIR=/usr/share/texmaker
+}
 isEmpty( DESKTOPDIR ) {
     DESKTOPDIR=/usr/share/applications
 }
@@ -1064,7 +1067,7 @@ DEFINES += AUTHORIZE_LINUX_QSTYLES
 
 
 target.path = $${PREFIX}/bin
-utilities.path = $${PREFIX}/share/texmaker
+utilities.path = $${UTILITIESDIR}
 desktop.path = $${DESKTOPDIR}
 icon.path = $${ICONDIR}
 #not for openSUSE :
-- 
2.26.0


From 61eea6acf5fe03a551fcf8555a5ee74865fce3c9 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 May 2020 13:58:59 +1000
Subject: Don't set fusion style for Haiku


diff --git a/texmaker.cpp b/texmaker.cpp
index 9c1f58b..ce93af5 100644
--- a/texmaker.cpp
+++ b/texmaker.cpp
@@ -4754,6 +4754,9 @@ QString kdesession= ::getenv("KDE_FULL_SESSION");
 QString kdeversion= ::getenv("KDE_SESSION_VERSION");
 if (!kdesession.isEmpty()) desktop_env=2;
 if (!kdeversion.isEmpty()) desktop_env=3;
+#ifdef __HAIKU__
+desktop_env=4;
+#endif
 
 //desktop_env=1;
 latex_command=config->value("Tools/Latex","latex -interaction=nonstopmode %.tex").toString();
@@ -4788,6 +4791,14 @@ switch (desktop_env)
 		viewps_command=config->value("Tools/Ps","okular %.ps").toString();
 		viewpdf_command=config->value("Tools/Pdf","okular %.pdf").toString();
 		}break;
+#ifdef __HAIKU__
+	case 4:
+		{
+		viewdvi_command=config->value("Tools/Dvi","open %.dvi").toString();
+		viewps_command=config->value("Tools/Ps","open %.ps").toString();
+		viewpdf_command=config->value("Tools/Pdf","open %.pdf").toString();
+		}break;
+#endif
 	}
 
 
@@ -4816,8 +4827,9 @@ else if (styles.contains("Breeze")) qApp->setStyle(QLatin1String("breeze"));
 else qApp->setStyle(QLatin1String("fusion"));    
 }
 else if (styles.contains("Breeze")) qApp->setStyle(QLatin1String("breeze"));
-else qApp->setStyle(QLatin1String("fusion"));
+else if (desktop_env != 4)qApp->setStyle(QLatin1String("fusion"));
 #else
+
 qApp->setStyle(QLatin1String("fusion"));
 #endif
 // QApplication::setPalette(QApplication::style()->standardPalette());
-- 
2.26.0


From 1fc9fe77fce6d4063d3caf73b12906572914fa30 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 May 2020 15:55:03 +1000
Subject: Fix paths


diff --git a/configdialog.cpp b/configdialog.cpp
index 28a7a60..7b932f6 100644
--- a/configdialog.cpp
+++ b/configdialog.cpp
@@ -18,7 +18,7 @@
 #include <QDir>
 #include <QTableWidgetItem>
 #include <QDebug>
-
+#include <QStandardPaths>
 #include "geticon.h"
 
 ConfigDialog::ConfigDialog(QWidget* parent): QDialog( parent)
@@ -216,7 +216,7 @@ void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previou
 //pageditor
 void ConfigDialog::browseAspell()
 {
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_HAIKU)
 
 #ifdef USB_VERSION
 QDir spelldir(QCoreApplication::applicationDirPath());
@@ -235,6 +235,9 @@ QDir spelldir(QCoreApplication::applicationDirPath() + "/../Resources");
 #if defined(Q_OS_WIN32)
 QDir spelldir(QCoreApplication::applicationDirPath());
 #endif
+#if defined(Q_OS_HAIKU)
+QDir spelldir(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "hunspell", QStandardPaths::LocateDirectory));
+#endif
 QString location=QFileDialog::getOpenFileName(this,tr("Browse dictionary"),spelldir.absolutePath(),"Dictionary (*.dic)",0,QFileDialog::DontResolveSymlinks);
 if ( !location.isEmpty() ) 
 	{
@@ -248,6 +251,8 @@ void ConfigDialog::browseSvn()
 {
 #if defined(Q_OS_WIN32)
 QString svndir=qgetenv("PROGRAMFILES");
+#elif defined(Q_OS_HAIKU)
+QString svndir="/bin";
 #else
 QString svndir="/usr/bin";
 #endif
diff --git a/texmaker.cpp b/texmaker.cpp
index ce93af5..5dac4e9 100644
--- a/texmaker.cpp
+++ b/texmaker.cpp
@@ -501,7 +501,7 @@ errorIndex=-1;
 translationList.clear();
 translationList.append(QString("en"));
 
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_HAIKU)
 #ifdef USB_VERSION
 QDir transdir(QCoreApplication::applicationDirPath());
 #else
@@ -515,6 +515,9 @@ QDir transdir(QCoreApplication::applicationDirPath() + "/../Resources");
 #if defined(Q_OS_WIN32)
 QDir transdir(QCoreApplication::applicationDirPath());
 #endif
+#if defined(Q_OS_HAIKU)
+QDir transdir(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "texmaker", QStandardPaths::LocateDirectory));
+#endif
 foreach (QFileInfo qmFileInfo, transdir.entryInfoList(QStringList("texmaker_*.qm"),QDir::Files | QDir::Readable, QDir::Name | QDir::IgnoreCase)) 
     {
     QString transName = qmFileInfo.completeBaseName();
diff --git a/texmakerapp.cpp b/texmakerapp.cpp
index 45ab1ba..18b9106 100644
--- a/texmakerapp.cpp
+++ b/texmakerapp.cpp
@@ -46,7 +46,7 @@ foreach (QTranslator* tr, translatorsList)
 translatorsList.clear();
 QTranslator* appTranslator=new QTranslator(this);
 QTranslator* basicTranslator=new QTranslator(this);
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_HAIKU)
 #ifdef USB_VERSION
 QString transdir=QCoreApplication::applicationDirPath();
 #else
@@ -59,6 +59,9 @@ QString transdir=QCoreApplication::applicationDirPath() + "/../Resources";
 #if defined(Q_OS_WIN32)
 QString transdir=QCoreApplication::applicationDirPath();
 #endif
+#if defined(Q_OS_HAIKU)
+QString transdir(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "texmaker", QStandardPaths::LocateDirectory));
+#endif
 if ( locale.length() < 2 ) locale = "en";
 if (appTranslator->load(QString("texmaker_")+locale,transdir)) 	
     {
-- 
2.26.0

