X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fbufferview.cpp;h=c57737f243d6d6065c69a7669b2f74c4934ff9e1;hb=8a618fb4514d83a76cec8e7cd1319b935366a616;hp=b5460db2024fc3755f032cf12916a9059ff141c3;hpb=c0ca17fde48836a5d2e7ea9ceaaabcdd7225d9b8;p=quassel.git diff --git a/src/qtui/bufferview.cpp b/src/qtui/bufferview.cpp index b5460db2..c57737f2 100644 --- a/src/qtui/bufferview.cpp +++ b/src/qtui/bufferview.cpp @@ -18,7 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "client.h" #include "bufferview.h" +#include "buffertreemodel.h" /***************************************** * The TreeView showing the Buffers @@ -46,15 +48,13 @@ void BufferView::init() { connect(selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), model(), SLOT(changeCurrent(const QModelIndex &, const QModelIndex &))); - connect(this, SIGNAL(doubleClicked(const QModelIndex &)), - model(), SLOT(doubleClickReceived(const QModelIndex &))); - connect(model(), SIGNAL(selectionChanged(const QModelIndex &)), this, SLOT(select(const QModelIndex &))); connect(this, SIGNAL(selectionChanged(const QModelIndex &, QItemSelectionModel::SelectionFlags)), selectionModel(), SLOT(select(const QModelIndex &, QItemSelectionModel::SelectionFlags))); + connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex))); } void BufferView::setFilteredModel(QAbstractItemModel *model, BufferViewFilter::Modes mode, QStringList nets) { @@ -83,6 +83,15 @@ void BufferView::dropEvent(QDropEvent *event) { QTreeView::dropEvent(event); } +void BufferView::joinChannel(const QModelIndex &index) { + Buffer::Type bufferType = (Buffer::Type)index.data(BufferTreeModel::BufferTypeRole).toInt(); + + if(bufferType != Buffer::ChannelBuffer) + return; + + Client::fakeInput(index.data(BufferTreeModel::BufferUidRole).toUInt(), QString("/JOIN %1").arg(index.sibling(index.row(), 0).data().toString())); +} + void BufferView::keyPressEvent(QKeyEvent *event) { if(event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete) { event->accept();