X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferview.cpp;h=74552696193a4484130caf09470385ba7fcc8d9f;hp=aa349f62ea5dddafa69248aeca8cb9dc5fc7ca6d;hb=a35e9270e608bfbc5b21ba47d49b3139f06b13e9;hpb=73696998505c35c02bd019f78e9f502cbc36da5b diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index aa349f62..74552696 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -86,6 +86,7 @@ BufferView::BufferView(QWidget *parent) { connect(this, SIGNAL(collapsed(const QModelIndex &)), SLOT(on_collapse(const QModelIndex &))); connect(this, SIGNAL(expanded(const QModelIndex &)), SLOT(on_expand(const QModelIndex &))); + connect(this, SIGNAL(clicked(const QModelIndex &)), SLOT(on_clicked(const QModelIndex &))); setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -354,6 +355,11 @@ void BufferView::on_configChanged() { return; } +void BufferView::on_clicked(const QModelIndex &index) { + Q_UNUSED(index); + setFocus(Qt::MouseFocusReason); +} + void BufferView::on_collapse(const QModelIndex &index) { storeExpandedState(index.data(NetworkModel::NetworkIdRole).value(), false); } @@ -411,7 +417,12 @@ void BufferView::contextMenuEvent(QContextMenuEvent *event) { } void BufferView::addActionsToMenu(QMenu *contextMenu, const QModelIndex &index) { - Client::mainUi()->actionProvider()->addActions(contextMenu, index, this, "menuActionTriggered", (bool)config()); + QModelIndexList indexList = selectedIndexes(); + // make sure the item we clicked on is first + indexList.removeAll(index); + indexList.prepend(index); + + Client::mainUi()->actionProvider()->addActions(contextMenu, indexList, this, "menuActionTriggered", (bool)config()); } void BufferView::addFilterActions(QMenu *contextMenu, const QModelIndex &index) {