X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fbufferview.cpp;h=c84f31897a482c74823a33ab73916a74c4ad19b3;hb=6c9aab4e16880ee24738a48ea95f9d3bf09caa0f;hp=de493bf37cb47cbbf9845f8530f63b235b8c8f76;hpb=536ef19e7f9487db60ae3a99494d8b2870b13cff;p=quassel.git diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index de493bf3..c84f3189 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -48,6 +48,7 @@ // to be on the safe side: call QTreeView's method aswell BufferView::BufferView(QWidget *parent) : QTreeView(parent), + showChannelList(tr("Show Channel List"), this), _connectNetAction(tr("Connect"), this), _disconnectNetAction(tr("Disconnect"), this), _joinChannelAction(tr("Join Channel"), this), @@ -270,11 +271,9 @@ void BufferView::layoutChanged() { QModelIndex networkIdx; for(int row = 0; row < model()->rowCount(); row++) { networkIdx = model()->index(row, 0); - update(networkIdx); if(model()->rowCount(networkIdx) > 0 && model()->data(networkIdx, NetworkModel::ItemActiveRole) == true) { + update(networkIdx); expand(networkIdx); - } else { - collapse(networkIdx); } } @@ -399,8 +398,10 @@ void BufferView::contextMenuEvent(QContextMenuEvent *event) { switch(itemType) { case NetworkModel::NetworkItemType: + showChannelList.setData(index.data(NetworkModel::NetworkIdRole)); _disconnectNetAction.setIcon(connectionStateIcon); _connectNetAction.setIcon(connectionStateIcon); + addItemToMenu(showChannelList, contextMenu, index, ActiveState); addItemToMenu(_disconnectNetAction, contextMenu, index, ActiveState); addItemToMenu(_connectNetAction, contextMenu, index, InactiveState); addSeparatorToMenu(contextMenu, index, ActiveState); @@ -457,10 +458,11 @@ void BufferView::contextMenuEvent(QContextMenuEvent *event) { bool ok; QString channelName = QInputDialog::getText(this, tr("Join Channel"), tr("Input channel name:"), QLineEdit::Normal, QString(), &ok); if(ok && !channelName.isEmpty()) { - BufferInfo bufferInfo = index.child(0,0).data(NetworkModel::BufferInfoRole).value(); - if(bufferInfo.isValid()) { - Client::instance()->userInput(bufferInfo, QString("/J %1").arg(channelName)); - } + Client::instance()->userInput(BufferInfo::fakeStatusBuffer(index.data(NetworkModel::NetworkIdRole).value()), QString("/J %1").arg(channelName)); +// BufferInfo bufferInfo = index.child(0,0).data(NetworkModel::BufferInfoRole).value(); +// if(bufferInfo.isValid()) { +// Client::instance()->userInput(bufferInfo, QString("/J %1").arg(channelName)); +// } } #endif return;