Enable multi-selection in nick list
[quassel.git] / src / uisupport / nickview.cpp
index ad13a2f..bfdaf1e 100644 (file)
@@ -47,10 +47,11 @@ NickView::NickView(QWidget *parent)
   sortByColumn(0, Qt::AscendingOrder);
 
   setContextMenuPolicy(Qt::CustomContextMenu);
+  setSelectionMode(QAbstractItemView::ExtendedSelection);
 
   connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(showContextMenu(const QPoint&)));
 
-#if defined Q_WS_QWS or defined Q_WS_X11
+#if defined Q_WS_QWS || defined Q_WS_X11
   connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(startQuery(QModelIndex)));
 #else
   // afaik this is better on Mac and Windows
@@ -89,8 +90,13 @@ void NickView::showContextMenu(const QPoint & pos ) {
   if(index.data(NetworkModel::ItemTypeRole) != NetworkModel::IrcUserItemType)
     return;
 
+  QModelIndexList indexList = selectedIndexes();
+  // make sure the item we clicked on is first
+  indexList.removeAll(index);
+  indexList.prepend(index);
+
   QMenu contextMenu(this);
-  Client::mainUi()->actionProvider()->addActions(&contextMenu, index);
+  Client::mainUi()->actionProvider()->addActions(&contextMenu, indexList);
   contextMenu.exec(QCursor::pos());
 }