Fixing a client crash that could be triggered under certain preconditions if a ircUse...
[quassel.git] / src / uisupport / bufferview.cpp
index d2893a8..936c063 100644 (file)
@@ -79,6 +79,8 @@ BufferView::BufferView(QWidget *parent)
   _hideQuitAction.setEnabled(false);
   _hideModeAction.setEnabled(false);
 
+  showChannelList.setIcon(QIcon(":/16x16/actions/oxygen/16x16/actions/format-list-unordered.png"));
+
   connect(this, SIGNAL(collapsed(const QModelIndex &)), this, SLOT(on_collapse(const QModelIndex &)));
   connect(this, SIGNAL(expanded(const QModelIndex &)), this, SLOT(on_expand(const QModelIndex &)));
 
@@ -322,7 +324,7 @@ void BufferView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bott
     return;
 
   for(int i = topLeft.row(); i <= bottomRight.row(); i++) {
-    QModelIndex networkIdx = topLeft.sibling(topLeft.row(), 0);
+    QModelIndex networkIdx = topLeft.sibling(i, 0);
     if(model()->rowCount(networkIdx) == 0)
       continue;
 
@@ -401,6 +403,8 @@ QMenu *BufferView::createHideEventsSubMenu(QMenu &menu) {
 
 void BufferView::contextMenuEvent(QContextMenuEvent *event) {
   QModelIndex index = indexAt(event->pos());
+  if(!index.isValid())
+    index = rootIndex();
   if(!index.isValid())
     return;
 
@@ -427,8 +431,8 @@ void BufferView::contextMenuEvent(QContextMenuEvent *event) {
     _disconnectNetAction.setIcon(connectionStateIcon);
     _connectNetAction.setIcon(connectionStateIcon);
     addItemToMenu(showChannelList, contextMenu, index, ActiveState);
-    addItemToMenu(_disconnectNetAction, contextMenu, index, ActiveState);
-    addItemToMenu(_connectNetAction, contextMenu, index, InactiveState);
+    addItemToMenu(_disconnectNetAction, contextMenu, network->connectionState() != Network::Disconnected);
+    addItemToMenu(_connectNetAction, contextMenu, network->connectionState() == Network::Disconnected);
     addSeparatorToMenu(contextMenu, index, ActiveState);
     addItemToMenu(_joinChannelAction, contextMenu, index, ActiveState);
     break;