{
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);
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<NetworkId>(), false);
}
}
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) {