+ setContextMenuPolicy(Qt::CustomContextMenu);
+
+ connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
+ this, SLOT(showContextMenu(const QPoint&)));
+ connect(this, SIGNAL(activated( const QModelIndex& )),
+ this, SLOT(startQuery( const QModelIndex& )));
+}
+
+void NickView::init() {
+ if(!model())
+ return;
+
+ for(int i = 1; i < model()->columnCount(); i++)
+ setColumnHidden(i, true);
+}
+
+void NickView::setModel(QAbstractItemModel *model) {
+ QTreeView::setModel(model);
+ init();
+}
+
+void NickView::rowsInserted(const QModelIndex &parent, int start, int end) {
+ QTreeView::rowsInserted(parent, start, end);
+ if(model()->data(parent, NetworkModel::ItemTypeRole) == NetworkModel::UserCategoryItemType && !isExpanded(parent)) {
+ QCoreApplication::postEvent(this, new ExpandAllEvent);
+ }
+}
+
+void NickView::setRootIndex(const QModelIndex &index) {
+ QAbstractItemView::setRootIndex(index);
+ if(index.isValid())
+ QCoreApplication::postEvent(this, new ExpandAllEvent);
+}
+
+QString NickView::nickFromModelIndex(const QModelIndex & index) {
+ QString nick = index.sibling(index.row(), 0).data().toString();
+ return nick;
+}
+
+BufferInfo NickView::bufferInfoFromModelIndex(const QModelIndex & index) {
+ BufferInfo bufferInfo = index.data(NetworkModel::BufferInfoRole).value<BufferInfo>();
+ return bufferInfo;