#include "buffersyncer.h"
#include "client.h"
#include "iconloader.h"
-#include "mappedselectionmodel.h"
#include "network.h"
#include "networkmodel.h"
#include "networkmodelactionprovider.h"
{
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);
collapse(networkIdx);
}
- // update selection to current one
- MappedSelectionModel *mappedSelectionModel = qobject_cast<MappedSelectionModel *>(selectionModel());
- if(!config() || !mappedSelectionModel)
- return;
+ if(config()) {
+ // update selection to current one
+ Client::bufferModel()->synchronizeView(this);
+ }
- mappedSelectionModel->mappedSetCurrentIndex(Client::bufferModel()->standardSelectionModel()->currentIndex(), QItemSelectionModel::Current);
- mappedSelectionModel->mappedSelect(Client::bufferModel()->standardSelectionModel()->selection(), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
+ return;
+}
+
+void BufferView::on_clicked(const QModelIndex &index) {
+ Q_UNUSED(index);
+ setFocus(Qt::MouseFocusReason);
}
void BufferView::on_collapse(const QModelIndex &index) {
}
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) {