From a31497e5c3979dcbe76dd3df98db191506f6f26e Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Thu, 28 Nov 2013 01:27:03 -0700
Subject: Add Haiku support


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ec6023..1acfb25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -148,7 +148,7 @@ if(WITH_TESTS)
 endif(WITH_TESTS)
 
 set(QT_REQUIRED_MODULES QtCore QtGui QtTest)
-if(UNIX AND NOT APPLE)
+if(UNIX AND NOT APPLE AND NOT HAIKU)
   set(QT_REQUIRED_MODULES ${QT_REQUIRED_MODULES} QtDBus)
 endif()
 
diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt
index 06b6a52..930a0cd 100644
--- a/share/CMakeLists.txt
+++ b/share/CMakeLists.txt
@@ -17,11 +17,11 @@ file(GLOB DATABASE_ICONS icons/database/*.png)
 
 install(FILES ${DATABASE_ICONS} DESTINATION ${DATA_INSTALL_DIR}/icons/database)
 
-if(UNIX AND NOT APPLE)
+if(UNIX AND NOT APPLE AND NOT HAIKU)
     install(DIRECTORY icons/application/ DESTINATION share/icons/hicolor
             FILES_MATCHING PATTERN "keepassx.png" PATTERN "keepassx.svgz")
     install(FILES linux/keepassx.desktop DESTINATION share/applications)
-endif(UNIX AND NOT APPLE)
+endif(UNIX AND NOT APPLE AND NOT HAIKU)
 
 if(APPLE)
   install(FILES macosx/keepassx.icns DESTINATION ${DATA_INSTALL_DIR})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 176ecb3..4facf63 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -216,7 +216,7 @@ target_link_libraries(${PROGNAME}
                       ${GCRYPT_LIBRARIES}
                       ${ZLIB_LIBRARIES})
 
-if(UNIX AND NOT APPLE)
+if(UNIX AND NOT APPLE AND NOT HAIKU)
   target_link_libraries(${PROGNAME} ${QT_QTDBUS_LIBRARY})
 endif()
 
diff --git a/src/config-keepassx.h.cmake b/src/config-keepassx.h.cmake
index 479a5f6..0841d21 100644
--- a/src/config-keepassx.h.cmake
+++ b/src/config-keepassx.h.cmake
@@ -9,6 +9,8 @@
 
 #define KEEPASSX_PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"
 
+#define KEEPASSX_DATA_DIR "${DATA_INSTALL_DIR}"
+
 #cmakedefine HAVE_PR_SET_DUMPABLE 1
 #cmakedefine HAVE_RLIMIT_CORE 1
 #cmakedefine HAVE_PT_DENY_ATTACH 1
diff --git a/src/core/FilePath.cpp b/src/core/FilePath.cpp
index dd300ec..968269f 100644
--- a/src/core/FilePath.cpp
+++ b/src/core/FilePath.cpp
@@ -137,6 +137,10 @@ FilePath::FilePath()
     else if (testSetDir(QCoreApplication::applicationDirPath() + "/share")) {
     }
 #endif
+#ifdef KEEPASSX_DATA_DIR
+    else if (testSetDir(QString(KEEPASSX_DATA_DIR))) {
+    }
+#endif
 
     if (m_dataPath.isEmpty()) {
         qWarning("FilePath::DataPath: can't find data dir");
diff --git a/src/gui/Clipboard.cpp b/src/gui/Clipboard.cpp
index eb77d2b..958eacb 100644
--- a/src/gui/Clipboard.cpp
+++ b/src/gui/Clipboard.cpp
@@ -21,7 +21,7 @@
 #include <QClipboard>
 #include <QTimer>
 
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_HAIKU)
 #include <QDBusConnection>
 #include <QDBusMessage>
 #endif
@@ -70,7 +70,7 @@ void Clipboard::clearClipboard()
         clipboard->clear(QClipboard::Selection);
     }
 
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_HAIKU)
     QDBusMessage message = QDBusMessage::createMethodCall("org.kde.klipper", "/klipper", "", "clearClipboardHistory");
     QDBusConnection::sessionBus().send(message);
 #endif
-- 
1.8.3.4

