X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fbufferview.cpp;h=b0e365f69daf49f5aef02ce64b85874344340a2f;hb=b15d188c72ddbfab83884377b682db1ec24ba530;hp=de493bf37cb47cbbf9845f8530f63b235b8c8f76;hpb=058523b5b53cfcc0291747065ad1a1390e3b3f03;p=quassel.git diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index de493bf3..b0e365f6 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); } } @@ -288,6 +287,7 @@ void BufferView::layoutChanged() { } void BufferView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { + qDebug() << "dataChanged()"; QTreeView::dataChanged(topLeft, bottomRight); // determine how many items have been changed and if any of them is a networkitem @@ -399,8 +399,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 +459,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;