uisupport: Forcefully disable horizontal scrollbar in BufferView
[quassel.git] / src / uisupport / bufferview.cpp
index 700e7a9..7d7490f 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2016 by the Quassel Project                        *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -73,6 +73,8 @@ void BufferView::init()
 
     header()->hide(); // nobody seems to use this anyway
 
+    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
     // breaks with Qt 4.8
     if (QString("4.8.0") > qVersion()) // FIXME breaks with Qt versions >= 4.10!
         setAnimated(true);
@@ -89,14 +91,13 @@ void BufferView::init()
     setSortingEnabled(true);
     sortByColumn(0, Qt::AscendingOrder);
 
-    // activated() fails on X11 and Qtopia at least
-#if defined Q_WS_QWS || defined Q_WS_X11
-    disconnect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(joinChannel(QModelIndex)));
-    connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(joinChannel(QModelIndex)));
-#else
+#if defined Q_OS_MACOS || defined Q_OS_WIN
     // afaik this is better on Mac and Windows
     disconnect(this, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex)));
     connect(this, SIGNAL(activated(QModelIndex)), SLOT(joinChannel(QModelIndex)));
+#else
+    disconnect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(joinChannel(QModelIndex)));
+    connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(joinChannel(QModelIndex)));
 #endif
 }
 
@@ -710,6 +711,14 @@ BufferViewDock::BufferViewDock(BufferViewConfig *config, QWidget *parent)
     QDockWidget::setWidget(_widget);
 }
 
+void BufferViewDock::setLocked(bool locked) {
+    if (locked) {
+        setFeatures(0);
+    }
+    else {
+        setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
+    }
+}
 
 void BufferViewDock::updateTitle()
 {