From d927aac63a0c24f766a8d99805804f28f42ca4e7 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Aug 2018 22:00:43 +1000
Subject: Fix for Qt5 build


diff --git a/zlibrary/ui/src/qt4/application/LineEditParameter.cpp b/zlibrary/ui/src/qt4/application/LineEditParameter.cpp
index dfcbc0b..bd2689e 100644
--- a/zlibrary/ui/src/qt4/application/LineEditParameter.cpp
+++ b/zlibrary/ui/src/qt4/application/LineEditParameter.cpp
@@ -17,9 +17,9 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QBoxLayout>
-#include <QtGui/QLineEdit>
-#include <QtGui/QToolBar>
+#include <QtWidgets/QBoxLayout>
+#include <QtWidgets/QLineEdit>
+#include <QtWidgets/QToolBar>
 #include <QtGui/QKeyEvent>
 
 #include "ZLQtApplicationWindow.h"
diff --git a/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.cpp b/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.cpp
index 6241514..e0b143b 100644
--- a/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.cpp
+++ b/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.cpp
@@ -17,17 +17,17 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
 #include <QtGui/QPixmap>
 #include <QtGui/QImage>
 #include <QtGui/QIcon>
-#include <QtGui/QToolBar>
-#include <QtGui/QMenuBar>
-#include <QtGui/QMenu>
-#include <QtGui/QToolButton>
-#include <QtGui/QLayout>
+#include <QtWidgets/QToolBar>
+#include <QtWidgets/QMenuBar>
+#include <QtWidgets/QMenu>
+#include <QtWidgets/QToolButton>
+#include <QtWidgets/QLayout>
 #include <QtGui/QWheelEvent>
-#include <QtGui/QDockWidget>
+#include <QtWidgets/QDockWidget>
 #include <QtCore/QObjectList>
 
 #include <ZLibrary.h>
diff --git a/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.h b/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.h
index 3b4fd3a..42ff2c8 100644
--- a/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.h
+++ b/zlibrary/ui/src/qt4/application/ZLQtApplicationWindow.h
@@ -22,8 +22,8 @@
 
 #include <map>
 
-#include <QtGui/QMainWindow>
-#include <QtGui/QAction>
+#include <QtWidgets/QMainWindow>
+#include <QtWidgets/QAction>
 #include <QtGui/QCursor>
 
 class QDockWidget;
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.cpp
index 24eb897..c17e86c 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.cpp
@@ -17,8 +17,8 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QApplication>
-#include <QtGui/QPushButton>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QPushButton>
 
 #include <ZLDialogManager.h>
 
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.h b/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.h
index 068039d..811cec8 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.h
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtDialog.h
@@ -20,8 +20,8 @@
 #ifndef __ZLQTDIALOG_H__
 #define __ZLQTDIALOG_H__
 
-#include <QtGui/QDialog>
-#include <QtGui/QLayout>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QLayout>
 
 #include <ZLDialog.h>
 
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtDialogContent.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtDialogContent.cpp
index e8ff422..352c350 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtDialogContent.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtDialogContent.cpp
@@ -17,10 +17,10 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QApplication>
-#include <QtGui/QDesktopWidget>
-#include <QtGui/QWidget>
-#include <QtGui/QLayout>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QDesktopWidget>
+#include <QtWidgets/QWidget>
+#include <QtWidgets/QLayout>
 
 #include "ZLQtDialogContent.h"
 #include "ZLQtOptionView.h"
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtDialogManager.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtDialogManager.cpp
index d5eb4d4..2fc769b 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtDialogManager.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtDialogManager.cpp
@@ -17,11 +17,11 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
-#include <QtGui/QFileDialog>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QMessageBox>
+#include <QtWidgets/QFileDialog>
 #include <QtGui/QClipboard>
-#include <QtGui/QDesktopWidget>
+#include <QtWidgets/QDesktopWidget>
 
 #include "ZLQtDialogManager.h"
 #include "ZLQtDialog.h"
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtOpenFileDialog.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtOpenFileDialog.cpp
index ec9e73c..a50a40d 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtOpenFileDialog.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtOpenFileDialog.cpp
@@ -17,7 +17,7 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QFileDialog>
+#include <QtWidgets/QFileDialog>
 
 #include "ZLQtOpenFileDialog.h"
 
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtOptionView.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtOptionView.cpp
index 48a1b8f..90d50fb 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtOptionView.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtOptionView.cpp
@@ -19,16 +19,16 @@
 
 #include <cctype>
 
-#include <QtGui/QCheckBox>
-#include <QtGui/QComboBox>
-#include <QtGui/QLabel>
-#include <QtGui/QGroupBox>
-#include <QtGui/QRadioButton>
-#include <QtGui/QPushButton>
-#include <QtGui/QSpinBox>
-#include <QtGui/QLineEdit>
-#include <QtGui/QSlider>
-#include <QtGui/QLayout>
+#include <QtWidgets/QCheckBox>
+#include <QtWidgets/QComboBox>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QGroupBox>
+#include <QtWidgets/QRadioButton>
+#include <QtWidgets/QPushButton>
+#include <QtWidgets/QSpinBox>
+#include <QtWidgets/QLineEdit>
+#include <QtWidgets/QSlider>
+#include <QtWidgets/QLayout>
 
 #include <ZLStringUtil.h>
 #include <ZLDialogManager.h>
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.cpp
index f6c36fb..7fe855a 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.cpp
@@ -17,11 +17,11 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QApplication>
-#include <QtGui/QDesktopWidget>
-#include <QtGui/QLayout>
-#include <QtGui/QPushButton>
-#include <QtGui/QButtonGroup>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QDesktopWidget>
+#include <QtWidgets/QLayout>
+#include <QtWidgets/QPushButton>
+#include <QtWidgets/QButtonGroup>
 #include <QtGui/QResizeEvent>
 
 #include <ZLDialogManager.h>
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.h b/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.h
index e38b62a..ad26fba 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.h
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtOptionsDialog.h
@@ -20,9 +20,9 @@
 #ifndef __ZLQTOPTIONSDIALOG_H__
 #define __ZLQTOPTIONSDIALOG_H__
 
-#include <QtGui/QWidget>
-#include <QtGui/QTabWidget>
-#include <QtGui/QDialog>
+#include <QtWidgets/QWidget>
+#include <QtWidgets/QTabWidget>
+#include <QtWidgets/QDialog>
 
 #include "../../../../core/src/desktop/dialogs/ZLDesktopOptionsDialog.h"
 
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.cpp
index 98e469e..5a1d574 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.cpp
@@ -19,11 +19,11 @@
 
 #include <unistd.h>
 
-#include <QtGui/QApplication>
-#include <QtGui/QDesktopWidget>
-#include <QtGui/QWidget>
-#include <QtGui/QLabel>
-#include <QtGui/QLayout>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QDesktopWidget>
+#include <QtWidgets/QWidget>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QLayout>
 #include <QtCore/QThreadPool>
 
 #include "../dialogs/ZLQtDialogManager.h"
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.h b/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.h
index df6c73b..837bce5 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.h
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtProgressDialog.h
@@ -22,11 +22,11 @@
 
 #include <string>
 
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
 #include <QtGui/QCursor>
-#include <QtGui/QDialog>
-#include <QtGui/QProgressBar>
-#include <QtGui/QLabel>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QProgressBar>
+#include <QtWidgets/QLabel>
 #include <QtCore/QRunnable>
 
 #include <ZLProgressDialog.h>
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.cpp b/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.cpp
index 65530be..d1750e6 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.cpp
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.cpp
@@ -19,12 +19,12 @@
 
 #include <algorithm>
 
-#include <QtGui/QSplitter>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QScrollBar>
 #include <QtGui/QResizeEvent>
 #include <QtCore/QDebug>
+#include <QtWidgets/QSplitter>
+#include <QtWidgets/QVBoxLayout>
+#include <QtWidgets/QHBoxLayout>
+#include <QtWidgets/QScrollBar>
 
 #include <ZLFile.h>
 #include <ZLibrary.h>
diff --git a/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.h b/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.h
index 9cf7c47..03f1223 100644
--- a/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.h
+++ b/zlibrary/ui/src/qt4/dialogs/ZLQtTreeDialog.h
@@ -24,12 +24,12 @@
 #include <QtCore/QSet>
 #include <QtCore/QMap>
 
-#include <QtGui/QDialog>
-#include <QtGui/QScrollArea>
-#include <QtGui/QPushButton>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QWidget>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QScrollArea>
+#include <QtWidgets/QPushButton>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QLineEdit>
+#include <QtWidgets/QWidget>
 
 #include <ZLTreeDialog.h>
 
diff --git a/zlibrary/ui/src/qt4/filesystem/ZLQtFSManager.cpp b/zlibrary/ui/src/qt4/filesystem/ZLQtFSManager.cpp
index 50a9f09..cf70b7a 100644
--- a/zlibrary/ui/src/qt4/filesystem/ZLQtFSManager.cpp
+++ b/zlibrary/ui/src/qt4/filesystem/ZLQtFSManager.cpp
@@ -48,4 +48,5 @@ void ZLQtFSManager::normalizeRealPath(std::string &path) const {
 		static const std::string replacement = (const char*)QDir::homePath().toUtf8();
 	  path = replacement + path.substr(1);
 	}
+	ZLUnixFSManager::normalizeRealPath(path);
 }
diff --git a/zlibrary/ui/src/qt4/library/ZLQApplication.h b/zlibrary/ui/src/qt4/library/ZLQApplication.h
index c08c536..a714fa9 100644
--- a/zlibrary/ui/src/qt4/library/ZLQApplication.h
+++ b/zlibrary/ui/src/qt4/library/ZLQApplication.h
@@ -20,7 +20,7 @@
 #ifndef __ZLQAPPLICATION_H__
 #define __ZLQAPPLICATION_H__
 
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
 
 class ZLQApplication : public QApplication {
 
diff --git a/zlibrary/ui/src/qt4/library/ZLibrary.cpp b/zlibrary/ui/src/qt4/library/ZLibrary.cpp
index 9648e95..a544031 100644
--- a/zlibrary/ui/src/qt4/library/ZLibrary.cpp
+++ b/zlibrary/ui/src/qt4/library/ZLibrary.cpp
@@ -19,7 +19,7 @@
 
 #include <QtCore/QTextCodec>
 #include <QtCore/QFile>
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
 #include <QtGui/QFileOpenEvent>
 
 #include <ZLApplication.h>
@@ -72,7 +72,7 @@ bool ZLQApplication::event(QEvent *e) {
 void ZLQtLibraryImplementation::init(int &argc, char **&argv) {
 	new ZLQApplication(argc, argv);
 
-	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf-8"));
+	QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf-8"));
 
 	ZLibrary::parseArguments(argc, argv);
 
diff --git a/zlibrary/ui/src/qt4/network/ZLQtNetworkManager.cpp b/zlibrary/ui/src/qt4/network/ZLQtNetworkManager.cpp
index 47067d3..119a5ee 100644
--- a/zlibrary/ui/src/qt4/network/ZLQtNetworkManager.cpp
+++ b/zlibrary/ui/src/qt4/network/ZLQtNetworkManager.cpp
@@ -24,7 +24,9 @@
 #include <QtCore/QDir>
 #include <QtCore/QList>
 #include <QtCore/QTimer>
+#include <QtCore/QUrlQuery>
 
+#include <QtNetwork/QNetworkCookie>
 #include <QtNetwork/QNetworkRequest>
 #include <QtNetwork/QNetworkReply>
 #include <QtNetwork/QNetworkProxy>
@@ -149,12 +151,12 @@ void ZLQtNetworkManager::prepareReply(ZLQtNetworkReplyScope &scope, QNetworkRequ
 	QNetworkReply *reply = NULL;
 	if (!scope.request->postParameters().empty()) {
 		QByteArray data;
-		QUrl tmp;
+		QUrlQuery tmp;
 		typedef std::pair<std::string, std::string> string_pair;
 		foreach (const string_pair &pair, scope.request->postParameters()) {
 			tmp.addQueryItem(QString::fromStdString(pair.first), QString::fromStdString(pair.second));
 		}
-		data = tmp.encodedQuery();
+		data = tmp.query(QUrl::FullyEncoded).toUtf8(); //encodedQuery();
 		reply = const_cast<QNetworkAccessManager&>(myManager).post(networkRequest, data);
 	} else {
 		reply = const_cast<QNetworkAccessManager&>(myManager).get(networkRequest);
diff --git a/zlibrary/ui/src/qt4/tree/QtWaitingSpinner.h b/zlibrary/ui/src/qt4/tree/QtWaitingSpinner.h
index cdaef01..a259c65 100644
--- a/zlibrary/ui/src/qt4/tree/QtWaitingSpinner.h
+++ b/zlibrary/ui/src/qt4/tree/QtWaitingSpinner.h
@@ -3,7 +3,7 @@
 
 #include <QtCore/QTimer>
 
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
 #include <QtGui/QColor>
 
 class QtWaitingSpinner : public QWidget {
diff --git a/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.cpp b/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.cpp
index a3e5b35..ab41684 100644
--- a/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.cpp
+++ b/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.cpp
@@ -17,14 +17,14 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QHBoxLayout>
 #include <QtGui/QPixmap>
 #include <QtGui/QPalette>
 #include <QtGui/QPainter>
 #include <QtGui/QPaintEvent>
-#include <QtGui/QScrollBar>
 #include <QtCore/QTimer>
+#include <QtWidgets/QVBoxLayout>
+#include <QtWidgets/QHBoxLayout>
+#include <QtWidgets/QScrollBar>
 
 #include <QtCore/QDebug>
 
diff --git a/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.h b/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.h
index 4f09cfc..51f1545 100644
--- a/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.h
+++ b/zlibrary/ui/src/qt4/tree/ZLQtItemsListWidget.h
@@ -20,12 +20,12 @@
 #ifndef __ZLQTITEMSLISTWIDGET_H__
 #define __ZLQTITEMSLISTWIDGET_H__
 
-#include <QtGui/QWidget>
-#include <QtGui/QFrame>
-#include <QtGui/QPushButton>
-#include <QtGui/QLabel>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QScrollArea>
+#include <QtWidgets/QWidget>
+#include <QtWidgets/QFrame>
+#include <QtWidgets/QPushButton>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QVBoxLayout>
+#include <QtWidgets/QScrollArea>
 
 #include <ZLTreeTitledNode.h>
 
diff --git a/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.cpp b/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.cpp
index 472f05f..b9809c8 100644
--- a/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.cpp
+++ b/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.cpp
@@ -17,10 +17,10 @@
  * 02110-1301, USA.
  */
 
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QScrollBar>
-#include <QtGui/QGraphicsDropShadowEffect>
+#include <QtWidgets/QVBoxLayout>
+#include <QtWidgets/QHBoxLayout>
+#include <QtWidgets/QScrollBar>
+#include <QtWidgets/QGraphicsDropShadowEffect>
 
 #include <QtCore/QDebug>
 
diff --git a/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.h b/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.h
index 1b8ebcc..6f3b4e3 100644
--- a/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.h
+++ b/zlibrary/ui/src/qt4/tree/ZLQtPreviewWidget.h
@@ -20,11 +20,11 @@
 #ifndef __ZLQTPREVIEWWIDGET_H__
 #define __ZLQTPREVIEWWIDGET_H__
 
-#include <QtGui/QWidget>
-#include <QtGui/QPushButton>
-#include <QtGui/QLabel>
-#include <QtGui/QScrollArea>
-#include <QtGui/QVBoxLayout>
+#include <QtWidgets/QWidget>
+#include <QtWidgets/QPushButton>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QScrollArea>
+#include <QtWidgets/QVBoxLayout>
 #include <QtCore/QSet>
 
 #include <ZLTreePageNode.h>
diff --git a/zlibrary/ui/src/qt4/tree/ZLQtSearchField.cpp b/zlibrary/ui/src/qt4/tree/ZLQtSearchField.cpp
index 1cddaf9..2b65cc1 100644
--- a/zlibrary/ui/src/qt4/tree/ZLQtSearchField.cpp
+++ b/zlibrary/ui/src/qt4/tree/ZLQtSearchField.cpp
@@ -18,9 +18,9 @@
  */
 
 #include <QtCore/QDebug>
-#include <QtGui/QStyle>
-#include <QtGui/QCompleter>
-#include <QtGui/QStringListModel>
+#include <QtCore/QStringListModel>
+#include <QtWidgets/QStyle>
+#include <QtWidgets/QCompleter>
 
 #include <ZLibrary.h>
 #include <ZLFile.h>
diff --git a/zlibrary/ui/src/qt4/tree/ZLQtSearchField.h b/zlibrary/ui/src/qt4/tree/ZLQtSearchField.h
index f6e174c..c360965 100644
--- a/zlibrary/ui/src/qt4/tree/ZLQtSearchField.h
+++ b/zlibrary/ui/src/qt4/tree/ZLQtSearchField.h
@@ -21,8 +21,8 @@
 #define __ZLQTSEARCHFIELD_H__
 
 #include <QtCore/QSet>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QLineEdit>
 
 #include "QtWaitingSpinner.h"
 #include "ZLQtItemsListWidget.h"
diff --git a/zlibrary/ui/src/qt4/view/ZLQtViewWidget.cpp b/zlibrary/ui/src/qt4/view/ZLQtViewWidget.cpp
index 4f5d196..615050c 100644
--- a/zlibrary/ui/src/qt4/view/ZLQtViewWidget.cpp
+++ b/zlibrary/ui/src/qt4/view/ZLQtViewWidget.cpp
@@ -19,8 +19,8 @@
 
 #include <algorithm>
 
-#include <QtGui/QLayout>
-#include <QtGui/QScrollBar>
+#include <QtWidgets/QLayout>
+#include <QtWidgets/QScrollBar>
 #include <QtGui/QPainter>
 #include <QtGui/QPixmap>
 #include <QtGui/QMouseEvent>
@@ -185,11 +185,11 @@ void ZLQtViewWidget::repaint()	{
 
 void ZLQtViewWidget::setScrollbarEnabled(ZLView::Direction direction, bool enabled) {
 	if (direction == ZLView::VERTICAL) {
-		myRightScrollBar->setShown(enabled && myShowScrollBarAtRight);
-		myLeftScrollBar->setShown(enabled && !myShowScrollBarAtRight);
+		myRightScrollBar->setVisible(enabled && myShowScrollBarAtRight);
+		myLeftScrollBar->setVisible(enabled && !myShowScrollBarAtRight);
 	} else {
-		myBottomScrollBar->setShown(enabled && myShowScrollBarAtBottom);
-		myTopScrollBar->setShown(enabled && !myShowScrollBarAtBottom);
+		myBottomScrollBar->setVisible(enabled && myShowScrollBarAtBottom);
+		myTopScrollBar->setVisible(enabled && !myShowScrollBarAtBottom);
 	}
 }
 
diff --git a/zlibrary/ui/src/qt4/view/ZLQtViewWidget.h b/zlibrary/ui/src/qt4/view/ZLQtViewWidget.h
index 6fabf00..ccec1e3 100644
--- a/zlibrary/ui/src/qt4/view/ZLQtViewWidget.h
+++ b/zlibrary/ui/src/qt4/view/ZLQtViewWidget.h
@@ -20,7 +20,7 @@
 #ifndef __ZLQTVIEWWIDGET_H__
 #define __ZLQTVIEWWIDGET_H__
 
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
 
 #include "../../../../core/src/view/ZLViewWidget.h"
 #include <ZLApplication.h>
-- 
2.16.4


From eaeac091f6038d52f816fae1dfc3e4bbf78f8898 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Aug 2018 22:02:18 +1000
Subject: Fix narrowing conversion


diff --git a/fbreader/src/formats/doc/OleStorage.cpp b/fbreader/src/formats/doc/OleStorage.cpp
index 016f9fd..a7ab81a 100644
--- a/fbreader/src/formats/doc/OleStorage.cpp
+++ b/fbreader/src/formats/doc/OleStorage.cpp
@@ -59,7 +59,7 @@ bool OleStorage::init(shared_ptr<ZLInputStream> stream, std::size_t streamSize)
 		clear();
 		return false;
 	}
-	static const char OLE_SIGN[] = {0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0};
+	static const char OLE_SIGN[] = {(char)0xD0, (char)0xCF, (char)0x11, (char)0xE0, (char)0xA1, (char)0xB1, (char)0x1A, (char)0xE1, 0};
 	if (std::strncmp(oleBuf, OLE_SIGN, 8) != 0) {
 		clear();
 		return false;
-- 
2.16.4


From 18799b374ec31bbd42ef8431dd83544897f2b76d Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Aug 2018 22:04:48 +1000
Subject: Add haiku platform support


diff --git a/fbreader/data/default/external.haiku.xml b/fbreader/data/default/external.haiku.xml
new file mode 120000
index 0000000..bf36177
--- /dev/null
+++ b/fbreader/data/default/external.haiku.xml
@@ -0,0 +1 @@
+external.desktop.xml
\ No newline at end of file
diff --git a/fbreader/data/default/keymap.haiku.xml b/fbreader/data/default/keymap.haiku.xml
new file mode 100644
index 0000000..b795bd8
--- /dev/null
+++ b/fbreader/data/default/keymap.haiku.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<keymap>
+	<binding key="&lt;L&gt;" action="showLibrary"/>
+	<binding key="&lt;W&gt;" action="showNetLibrary"/>
+	<binding key="&lt;O&gt;" action="preferences"/>
+	<binding key="&lt;LeftArrow&gt;" action="undo"/>
+	<binding key="&lt;RightArrow&gt;" action="redo"/>
+	<binding key="&lt;C&gt;" action="toc"/>
+	<binding key="&lt;Ctrl&gt;+&lt;F&gt;" action="search"/>
+	<binding key="&lt;F&gt;" action="search"/>
+	<binding key="&lt;P&gt;" action="findPrevious"/>
+	<binding key="&lt;F3&gt;" action="findNext"/>
+	<binding key="&lt;N&gt;" action="findNext"/>
+	<binding key="&lt;PageDown&gt;" action="pageForward"/>
+	<binding key="&lt;PageUp&gt;" action="pageBackward"/>
+	<binding key="&lt;DownArrow&gt;" action="lineForward"/>
+	<binding key="&lt;UpArrow&gt;" action="lineBackward"/>
+	<binding key="&lt;MouseScrollDown&gt;" action="mouseScrollForward"/>
+	<binding key="&lt;MouseScrollUp&gt;" action="mouseScrollBackward"/>
+	<binding key="&lt;Ctrl&gt;+&lt;Home&gt;" action="gotoHome"/>
+	<binding key="&lt;Home&gt;" action="gotoSectionStart"/>
+	<binding key="&lt;End&gt;" action="gotoSectionEnd"/>
+	<binding key="&lt;Esc&gt;" action="cancel"/>
+	<binding key="&lt;=&gt;" action="increaseFont"/>
+	<binding key="&lt;-&gt;" action="decreaseFont"/>
+	<binding key="&lt;D&gt;" action="toggleIndicator"/>
+	<binding key="&lt;Return&gt;" action="toggleFullscreen"/>
+	<binding key="&lt;A&gt;" action="addBook"/>
+	<binding key="&lt;I&gt;" action="bookInfo"/>
+	<binding key="&lt;R&gt;" action="rotate"/>
+	<binding key="&lt;Ctrl&gt;+&lt;DownArrow&gt;" action="nextTOCSection"/>
+	<binding key="&lt;Ctrl&gt;+&lt;UpArrow&gt;" action="previousTOCSection"/>
+	<binding key="&lt;Ctrl&gt;+&lt;C&gt;" action="copyToClipboard"/>
+	<binding key="&lt;G&gt;" action="gotoPageNumber"/>
+	<binding key="&lt;Z&gt;" action="debugNL"/>
+</keymap>
diff --git a/fbreader/data/icons/application/haiku.png b/fbreader/data/icons/application/haiku.png
new file mode 120000
index 0000000..b463b00
--- /dev/null
+++ b/fbreader/data/icons/application/haiku.png
@@ -0,0 +1 @@
+48x48.png
\ No newline at end of file
diff --git a/fbreader/data/icons/booktree/haiku b/fbreader/data/icons/booktree/haiku
new file mode 120000
index 0000000..5524476
--- /dev/null
+++ b/fbreader/data/icons/booktree/haiku
@@ -0,0 +1 @@
+22x22-transparent-png
\ No newline at end of file
diff --git a/fbreader/data/icons/filetree/haiku b/fbreader/data/icons/filetree/haiku
new file mode 120000
index 0000000..5524476
--- /dev/null
+++ b/fbreader/data/icons/filetree/haiku
@@ -0,0 +1 @@
+22x22-transparent-png
\ No newline at end of file
diff --git a/fbreader/data/icons/toolbar/haiku b/fbreader/data/icons/toolbar/haiku
new file mode 120000
index 0000000..a98d612
--- /dev/null
+++ b/fbreader/data/icons/toolbar/haiku
@@ -0,0 +1 @@
+32x32-transparent-png
\ No newline at end of file
diff --git a/fbreader/haiku/Makefile b/fbreader/haiku/Makefile
new file mode 100644
index 0000000..ebb2f06
--- /dev/null
+++ b/fbreader/haiku/Makefile
@@ -0,0 +1,9 @@
+ROOTDIR = $(CURDIR)/../..
+include $(ROOTDIR)/makefiles/config.mk
+
+install:
+	@install -m 0644 ../data/default/config.desktop.xml $(DESTDIR)$(SHAREDIR)/FBReader/default/config.xml
+	@install -m 0644 ../data/default/keymap.desktop.xml $(DESTDIR)$(SHAREDIR)/FBReader/default/keymap.xml
+	@install -m 0644 ../data/default/styles.desktop.xml $(DESTDIR)$(SHAREDIR)/FBReader/default/styles.xml
+	@install -d $(DESTDIR)$(IMAGEDIR)
+clean:
diff --git a/makefiles/arch/haiku.mk b/makefiles/arch/haiku.mk
new file mode 100644
index 0000000..5ba1b69
--- /dev/null
+++ b/makefiles/arch/haiku.mk
@@ -0,0 +1,21 @@
+include $(ROOTDIR)/makefiles/arch/unix.mk
+
+INSTALLDIR = ${INSTALLDIR}
+IMAGEDIR = $(INSTALLDIR)/pixmaps
+APPIMAGEDIR = $(INSTALLDIR)/pixmaps/%APPLICATION_NAME%
+
+ZLSHARED = no
+CC = gcc
+AR = ar rsu
+LD = g++
+
+CFLAGS = -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W -fPIC
+LDFLAGS =
+EXTERNAL_INCLUDE = $(shell pkg-config --cflags fribidi)
+
+MOC = moc
+QTINCLUDE = $(shell pkg-config --cflags Qt5Gui Qt5Widgets Qt5Network)
+UILIBS = $(shell pkg-config --libs Qt5Gui Qt5Widgets Qt5Network)
+
+RM = rm -rvf
+RM_QUIET = rm -rf
diff --git a/zlibrary/ui/data/keynames.haiku-qt4.xml b/zlibrary/ui/data/keynames.haiku-qt4.xml
new file mode 100644
index 0000000..813443b
--- /dev/null
+++ b/zlibrary/ui/data/keynames.haiku-qt4.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<keynames>
+	<key code="0x01000000" name="&lt;Esc&gt;"/>
+	<key code="0x1B" name="&lt;Esc&gt;"/>
+	<key code="0x01000001" name="&lt;Tab&gt;"/>
+	<key code="0x01000002" name="&lt;BackTab&gt;"/>
+	<key code="0x01000003" name="&lt;BackSpace&gt;"/>
+	<key code="0x01000004" name="&lt;Return&gt;"/>
+	<key code="0xD" name="&lt;Return&gt;"/>
+	<key code="0x01000005" name="&lt;Enter&gt;"/>
+	<key code="0x01000006" name="&lt;Insert&gt;"/>
+	<key code="0x01000007" name="&lt;Delete&gt;"/>
+	<key code="0x01000008" name="&lt;Pause&gt;"/>
+	<key code="0x01000009" name="&lt;Print&gt;"/>
+	<key code="0x0100000a" name="&lt;SysReq&gt;"/>
+	<key code="0x0100000b" name="&lt;Clear&gt;"/>
+	<key code="0x01000010" name="&lt;Home&gt;"/>
+	<key code="0x01000011" name="&lt;End&gt;"/>
+	<key code="0x01000012" name="&lt;LeftArrow&gt;"/>
+	<key code="0x01000013" name="&lt;UpArrow&gt;"/>
+	<key code="0x01000014" name="&lt;RightArrow&gt;"/>
+	<key code="0x01000015" name="&lt;DownArrow&gt;"/>
+	<key code="0x01000016" name="&lt;PageUp&gt;"/>
+	<key code="0x01000017" name="&lt;PageDown&gt;"/>
+	<key code="0x01000030" name="&lt;F1&gt;"/>
+	<key code="0x01000031" name="&lt;F2&gt;"/>
+	<key code="0x01000032" name="&lt;F3&gt;"/>
+	<key code="0x01000033" name="&lt;F4&gt;"/>
+	<key code="0x01000034" name="&lt;F5&gt;"/>
+	<key code="0x01000035" name="&lt;F6&gt;"/>
+	<key code="0x01000036" name="&lt;F7&gt;"/>
+	<key code="0x01000037" name="&lt;F8&gt;"/>
+	<key code="0x01000038" name="&lt;F9&gt;"/>
+	<key code="0x01000039" name="&lt;F10&gt;"/>
+	<key code="0x0100003a" name="&lt;F11&gt;"/>
+	<key code="0x0100003b" name="&lt;F12&gt;"/>
+	<key code="0x0100003c" name="&lt;F13&gt;"/>
+	<key code="0x20" name="&lt;Space&gt;"/>
+	<key code="0x01000024" name="&lt;CapsLock&gt;"/>
+	<key code="0x01000025" name="&lt;NumLock&gt;"/>
+	<key code="0x01000026" name="&lt;ScrollLock&gt;"/>
+	<key code="0x01000020" name="&lt;Shift&gt;"/>
+	<key code="0x01000021" name="&lt;Ctrl&gt;"/>
+	<key code="0x01000023" name="&lt;Alt&gt;"/>
+	<key code="0x01000053" name="&lt;Win&gt;"/>
+	<key code="0x30" name="&lt;0&gt;"/>
+	<key code="0x31" name="&lt;1&gt;"/>
+	<key code="0x32" name="&lt;2&gt;"/>
+	<key code="0x33" name="&lt;3&gt;"/>
+	<key code="0x34" name="&lt;4&gt;"/>
+	<key code="0x35" name="&lt;5&gt;"/>
+	<key code="0x36" name="&lt;6&gt;"/>
+	<key code="0x37" name="&lt;7&gt;"/>
+	<key code="0x38" name="&lt;8&gt;"/>
+	<key code="0x39" name="&lt;9&gt;"/>
+	<key code="0x41" name="&lt;A&gt;"/>
+	<key code="0x42" name="&lt;B&gt;"/>
+	<key code="0x43" name="&lt;C&gt;"/>
+	<key code="0x44" name="&lt;D&gt;"/>
+	<key code="0x45" name="&lt;E&gt;"/>
+	<key code="0x46" name="&lt;F&gt;"/>
+	<key code="0x47" name="&lt;G&gt;"/>
+	<key code="0x48" name="&lt;H&gt;"/>
+	<key code="0x49" name="&lt;I&gt;"/>
+	<key code="0x4A" name="&lt;J&gt;"/>
+	<key code="0x4B" name="&lt;K&gt;"/>
+	<key code="0x4C" name="&lt;L&gt;"/>
+	<key code="0x4D" name="&lt;M&gt;"/>
+	<key code="0x4E" name="&lt;N&gt;"/>
+	<key code="0x4F" name="&lt;O&gt;"/>
+	<key code="0x50" name="&lt;P&gt;"/>
+	<key code="0x51" name="&lt;Q&gt;"/>
+	<key code="0x52" name="&lt;R&gt;"/>
+	<key code="0x53" name="&lt;S&gt;"/>
+	<key code="0x54" name="&lt;T&gt;"/>
+	<key code="0x55" name="&lt;U&gt;"/>
+	<key code="0x56" name="&lt;V&gt;"/>
+	<key code="0x57" name="&lt;W&gt;"/>
+	<key code="0x58" name="&lt;X&gt;"/>
+	<key code="0x59" name="&lt;Y&gt;"/>
+	<key code="0x5A" name="&lt;Z&gt;"/>
+	<modifier code="0x08000000" name="&lt;Alt&gt;"/>
+	<modifier code="0x04000000" name="&lt;Ctrl&gt;"/>
+</keynames>
diff --git a/zlibrary/ui/data/style.haiku.qss b/zlibrary/ui/data/style.haiku.qss
new file mode 100644
index 0000000..db53d4d
--- /dev/null
+++ b/zlibrary/ui/data/style.haiku.qss
@@ -0,0 +1,14 @@
+/*QLineEdit:focus#search-field { 
+	border-style: solid;
+	border-width: 2px; 
+	border-radius: 12px; 
+	border-color: #6F9FCF;
+}
+
+QLineEdit#search-field { 
+	border-style: solid; 
+	border-width: 1px; 
+	border-radius: 12px; 
+	border-color: #8D8D8D;
+}*/
+
-- 
2.16.4


From 0c8a4744485c0d96ad487a18ae566479571eca3c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Aug 2018 22:05:17 +1000
Subject: Fix haiku build


diff --git a/fbreader/Makefile b/fbreader/Makefile
index 0d5ac7b..7a2bbb9 100644
--- a/fbreader/Makefile
+++ b/fbreader/Makefile
@@ -22,7 +22,7 @@ all: .resources
 		fi; \
 	done;
 	@echo -n 'Linking $(TARGET) ...'
-	@$(LD) $(LDFLAGS) -o $(TARGET) `find src -name *.o` $(TEXT_LIBS) $(CORE_LIBS) $(ZLUI_LIB) -lsqlite3
+	@$(LD) $(LDFLAGS) -o $(TARGET) `find src -name *.o` $(TEXT_LIBS) $(CORE_LIBS) $(ZLUI_LIB) -lsqlite3 -liconv
 	@echo ' OK'
 
 FBSHAREDIR = $(DESTDIR)$(SHAREDIR)/FBReader
diff --git a/fbreader/scripts/install_help.sh b/fbreader/scripts/install_help.sh
index 00fdf3e..f95e359 100755
--- a/fbreader/scripts/install_help.sh
+++ b/fbreader/scripts/install_help.sh
@@ -6,7 +6,7 @@ if [ $# != 2 ]; then
 fi;
 
 case "$1" in
-	desktop|openzaurus_640x480|pdaxrom|pepperpad3|zaurus_640x480|macosx)
+	desktop|openzaurus_640x480|pdaxrom|pepperpad3|zaurus_640x480|macosx|haiku)
 		platform=desktop;
 		;;
 	maemo)
diff --git a/makefiles/target.mk b/makefiles/target.mk
index 2f4d572..f26afa4 100644
--- a/makefiles/target.mk
+++ b/makefiles/target.mk
@@ -1,4 +1,4 @@
-TARGET_ARCH = desktop
+TARGET_ARCH = haiku
 UI_TYPE = qt4
 #TARGET_STATUS = debug
 #ZLSHARED = no
diff --git a/zlibrary/core/Makefile b/zlibrary/core/Makefile
index 55c9401..ef41c2c 100644
--- a/zlibrary/core/Makefile
+++ b/zlibrary/core/Makefile
@@ -23,7 +23,7 @@ SUBDIRS_ALL = src/library src/typeId src/util src/constants src/logger src/files
 
 SUBDIRS = src/library src/typeId src/util src/constants src/logger src/filesystem src/filesystem/zip src/filesystem/bzip2 src/filesystem/tar src/dialogs src/optionEntries src/application src/view src/encoding src/options src/message src/resources src/time src/xml src/xml/expat src/image src/language src/unix/time src/runnable src/network src/network/requests src/blockTreeView src/tree
 
-ifeq "<$(TARGET_ARCH)>" "$(findstring <$(TARGET_ARCH)>, <desktop> <pepperpad3> <macosx> <bb10>)"
+ifeq "<$(TARGET_ARCH)>" "$(findstring <$(TARGET_ARCH)>, <desktop> <haiku> <pepperpad3> <macosx> <bb10>)"
   SUBDIRS += src/desktop/application src/desktop/dialogs
 endif
 
@@ -50,7 +50,7 @@ $(TARGET): .objects
 	@echo -n 'Creating $@ ...'
 	@$(RM_QUIET) $(TARGET)
 ifeq "$(ZLSHARED)" "yes"
-	@$(LD) $(LDFLAGS) -shared -Wl,-soname,$(TARGET_SONAME) -o $(TARGET) -lc $(patsubst %, %/*.o, $(SUBDIRS)) $(XML_LIBS) $(ARCHIVER_LIBS)
+	@$(LD) $(LDFLAGS) -shared -Wl,-soname,$(TARGET_SONAME) -o $(TARGET) $(patsubst %, %/*.o, $(SUBDIRS)) $(XML_LIBS) $(ARCHIVER_LIBS) -liconv
 #@$(LD) $(LDFLAGS) -dynamiclib -dylinker_install_name $(TARGET_SONAME) -o $(TARGET) -lc $(patsubst %, %/*.o, $(SUBDIRS)) $(XML_LIBS) $(ARCHIVER_LIBS) $(ZLUI_LIB) -ldl -liconv
 	@ln -sf $(TARGET) $(TARGET_SONAME)
 	@ln -sf $(TARGET) $(TARGET_SHORTNAME)
-- 
2.16.4


From 049bab374cfc58497045ef99269ccc1debbf5a9c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Aug 2018 23:34:22 +1000
Subject: Fix segfault when book reopened


diff --git a/fbreader/src/fbreader/FBReader.cpp b/fbreader/src/fbreader/FBReader.cpp
index f4825b0..e1c1b04 100644
--- a/fbreader/src/fbreader/FBReader.cpp
+++ b/fbreader/src/fbreader/FBReader.cpp
@@ -298,7 +298,6 @@ void FBReader::openBookInternal(shared_ptr<Book> book) {
 		bookTextView.setModel(0, 0);
 		bookTextView.setContentsModel(0);
 		contentsView.setModel(0);
-		myModel.reset();
 		myModel = new BookModel(book);
 		ZLTextHyphenator::Instance().load(book->language());
 		bookTextView.setModel(myModel->bookTextModel(), book);
-- 
2.16.4


From 81ffeee04b9a3bc1deb9e9b9ebaf8f96f15a7227 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Aug 2018 23:35:03 +1000
Subject: Set haiku settings folder


diff --git a/makefiles/arch/haiku.mk b/makefiles/arch/haiku.mk
index 5ba1b69..07bc1ef 100644
--- a/makefiles/arch/haiku.mk
+++ b/makefiles/arch/haiku.mk
@@ -9,7 +9,7 @@ CC = gcc
 AR = ar rsu
 LD = g++
 
-CFLAGS = -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W -fPIC
+CFLAGS = -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W -fPIC -DXMLCONFIGHOMEDIR=\"~/config/settings/\"
 LDFLAGS =
 EXTERNAL_INCLUDE = $(shell pkg-config --cflags fribidi)
 
-- 
2.16.4


From b2c1bad38306fa7f9f8dcd6c4b9d421853ef058d Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 22 Aug 2018 10:10:28 +1000
Subject: Add toolbar configuration for haiku


diff --git a/fbreader/data/default/config.haiku.xml b/fbreader/data/default/config.haiku.xml
new file mode 100644
index 0000000..670a4eb
--- /dev/null
+++ b/fbreader/data/default/config.haiku.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config>
+	<group name="Style">
+		<option name="Base:fontFamily" value="Georgia"/>
+		<option name="Base:fontSize" value="16"/>
+	</group>
+  <group name="Scrollings">
+    <option name="Delay" value="0"/>
+  </group>
+  <group name="Options">
+    <option name="LeftMargin" value="50"/>
+    <option name="RightMargin" value="50"/>
+    <option name="KeyDelay" value="0"/>
+    <option name="BookPath" value="~/Books:~/FBooks"/>
+    <option name="DownloadDirectory" value="~/Books"/>
+  </group>
+</config>
diff --git a/fbreader/data/default/external.haiku.xml b/fbreader/data/default/external.haiku.xml
deleted file mode 120000
index bf36177..0000000
--- a/fbreader/data/default/external.haiku.xml
+++ /dev/null
@@ -1 +0,0 @@
-external.desktop.xml
\ No newline at end of file
diff --git a/fbreader/data/default/external.haiku.xml b/fbreader/data/default/external.haiku.xml
new file mode 100644
index 0000000..770b1a3
--- /dev/null
+++ b/fbreader/data/default/external.haiku.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ExternalPrograms>
+	<section name="Web Browser">
+		<program name="%browser" protocol="execute">
+			<action name="openLink" command="%command"/>
+				<option name="command" defaultValue="open %1 &amp;"/>
+		</program>
+	</section>
+</ExternalPrograms>
diff --git a/fbreader/data/default/toolbar.haiku.xml b/fbreader/data/default/toolbar.haiku.xml
new file mode 100644
index 0000000..b46d251
--- /dev/null
+++ b/fbreader/data/default/toolbar.haiku.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<toolbar>
+	<button id="showReading"/>
+	<separator/>
+	<toggleButton id="byAuthor" group="booksOrder" default="yes"/>
+	<toggleButton id="byTag" group="booksOrder"/>
+	<separator/>
+	<menuButton id="showLibrary"/>
+	<button id="addBook"/>
+	<button id="showNetworkLibrary"/>
+	<separator/>
+	<button id="advancedSearchOnNetwork"/>
+	<textField id="searchOnNetwork" parameterId="networkSearchPattern" maxWidth="25"/>
+	<separator/>
+	<button id="gotoHome"/>
+	<button id="undo"/>
+	<button id="redo"/>
+	<textField id="gotoPageNumberWithParameter" parameterId="pageIndex" maxWidth="5" symbols="digits"/>
+	<separator/>
+	<button id="toc"/>
+	<separator/>
+	<button id="search"/>
+	<button id="findPrevious"/>
+	<button id="findNext"/>
+	<separator/>
+	<menuButton id="preferences"/>
+	<separator/>
+	<button id="rotate"/>
+	<separator/>
+	<button id="showHelp"/>
+</toolbar>
diff --git a/fbreader/scripts/install_toolbar_and_menu.sh b/fbreader/scripts/install_toolbar_and_menu.sh
index e2ea909..fa5693c 100755
--- a/fbreader/scripts/install_toolbar_and_menu.sh
+++ b/fbreader/scripts/install_toolbar_and_menu.sh
@@ -13,6 +13,9 @@ case "$1" in
 	macosx)
 		toolbar_file=data/default/toolbar.macosx.xml
 		;;
+	haiku)
+		toolbar_file=data/default/toolbar.haiku.xml
+		;;
 	maemo)
 		case "$2" in
 			maemo5)
-- 
2.16.4

