+void NickView::setModel(QAbstractItemModel *model) {
+ QTreeView::setModel(model);
+ init();
+}
+
+void NickView::rowsInserted(const QModelIndex &index, int start, int end) {
+ QTreeView::rowsInserted(index, start, end);
+ expandAll(); // FIXME We need to do this more intelligently. Maybe a pimped TreeView?
+}
+
+void NickView::showContextMenu(const QPoint & pos ) {
+ QModelIndex index = indexAt(pos);
+ QString username = index.sibling(index.row(), 0).data().toString();
+ BufferInfo bufferInfo = index.data(NetworkModel::BufferInfoRole).value<BufferInfo>();
+
+ QMenu nickContextMenu(this);
+ nickContextMenu.addAction(tr("context menu for %1").arg(username));
+ nickContextMenu.addSeparator();
+
+ QAction *whoisAction = nickContextMenu.addAction(tr("WHOIS"));
+ QAction *result = nickContextMenu.exec(QCursor::pos());
+
+ if (result == whoisAction ) {
+ Client::userInput(bufferInfo, "/WHOIS "+username);
+ }
+}