add MenuBar toggle to ChatScene context menu
[quassel.git] / src / qtui / chatscene.cpp
index af50281..f3bbdd7 100644 (file)
 #include <QDrag>
 #include <QGraphicsSceneMouseEvent>
 #include <QMenu>
+#include <QMenuBar>
 #include <QPersistentModelIndex>
 
+#ifdef HAVE_KDE
+#  include <KMenuBar>
+#else
+#  include <QMenuBar>
+#endif
+
 #ifdef HAVE_WEBKIT
 #  include <QWebView>
 #endif
@@ -170,7 +177,6 @@ void ChatScene::rowsInserted(const QModelIndex &index, int start, int end) {
   qreal width = _sceneRect.width();
   bool atBottom = (start == _lines.count());
   bool atTop = !atBottom && (start == 0);
-  bool moveTop = false;
 
   if(start < _lines.count()) {
     y = _lines.value(start)->y();
@@ -599,6 +605,9 @@ void ChatScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
     // no item -> default scene actions
     GraphicalUi::contextMenuActionProvider()->addActions(&menu, filter(), BufferId());
 
+  if (QtUi::mainWindow()->menuBar()->isHidden())
+    menu.addAction(QtUi::actionCollection("General")->action("ToggleMenuBar"));
+
   menu.exec(event->screenPos());
 
 }
@@ -844,7 +853,6 @@ void ChatScene::updateSceneRect(qreal width) {
     ChatLine *firstLine = _lines.at(_firstLineRow);
     ChatLine *lastLine = _lines.last();
     updateSceneRect(QRectF(0, firstLine->pos().y(), width, lastLine->pos().y() + lastLine->height() - firstLine->pos().y()));
-    qDebug() << idString() << "top:" << sceneRect().y() << "height:" << sceneRect().height();
   } else {
     // empty scene rect
     updateSceneRect(QRectF(0, 0, width, 0));