+ return false;
+}
+
+bool ChatScene::isScrollingAllowed() const {
+ if(_isSelecting)
+ return false;
+
+ // TODO: Handle clicks and single-item selections too
+
+ return true;
+}
+
+/******** MOUSE HANDLING **************************************************************************/
+
+void ChatScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
+ QPointF pos = event->scenePos();
+ QMenu menu;
+
+ // zoom actions and similar
+ chatView()->addActionsToMenu(&menu, pos);
+ menu.addSeparator();
+
+ if(isPosOverSelection(pos))
+ menu.addAction(SmallIcon("edit-copy"), tr("Copy Selection"),
+ this, SLOT(selectionToClipboard()),
+ QKeySequence::Copy);
+
+ // item-specific options (select link etc)
+ ChatItem *item = chatItemAt(pos);
+ if(item)
+ item->addActionsToMenu(&menu, item->mapFromScene(pos));
+ else
+ // 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());
+
+}
+
+void ChatScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
+ if(event->buttons() == Qt::LeftButton) {
+ if(!_clickHandled && (event->scenePos() - _clickPos).toPoint().manhattanLength() >= QApplication::startDragDistance()) {
+ if(_clickTimer.isActive())
+ _clickTimer.stop();
+ if(_clickMode == SingleClick && isPosOverSelection(_clickPos))
+ initiateDrag(event->widget());
+ else {
+ _clickMode = DragStartClick;
+ handleClick(Qt::LeftButton, _clickPos);
+ }
+ _clickMode = NoClick;
+ }
+ if(_isSelecting) {
+ updateSelection(event->scenePos());
+ emit mouseMoveWhileSelecting(event->scenePos());
+ event->accept();
+ } else if(_clickHandled && _clickMode < DoubleClick)
+ QGraphicsScene::mouseMoveEvent(event);
+ } else
+ QGraphicsScene::mouseMoveEvent(event);