X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferview.cpp;h=8ed210f59ca50e70c74456357907fbbb1167c5c0;hp=8c26056b1115486dff15ba56e038337c1982d23a;hb=2bcb925e42921b124efd19d1978ff19f44a09113;hpb=d69da0b56103c347107fb490008b5c6b0d59e3df diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index 8c26056b..8ed210f5 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -26,6 +26,8 @@ #include "uisettings.h" +#include "global.h" + /***************************************** * The TreeView showing the Buffers *****************************************/ @@ -55,7 +57,13 @@ void BufferView::init() { setSortingEnabled(true); sortByColumn(0, Qt::AscendingOrder); +#ifndef Q_WS_QWS + // this is a workaround to not join channels automatically... we need a saner way to navigate for qtopia anyway though, + // such as mark first, activate at second click... connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex))); +#else + connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(joinChannel(QModelIndex))); // Qtopia uses single click for activation +#endif } void BufferView::setFilteredModel(QAbstractItemModel *model, BufferViewFilter::Modes mode, QList nets) { @@ -115,9 +123,10 @@ void BufferView::keyPressEvent(QKeyEvent *event) { // ensure that newly inserted network nodes are expanded per default void BufferView::rowsInserted(const QModelIndex & parent, int start, int end) { QTreeView::rowsInserted(parent, start, end); - if(model()->rowCount(parent) == 1 && parent.data(NetworkModel::ItemTypeRole) == NetworkModel::NetworkItemType && parent.data(NetworkModel::ItemActiveRole) == true) { + if(model()->rowCount(parent) == 1 && parent.data(NetworkModel::ItemTypeRole) == NetworkModel::NetworkItemType + && parent.data(NetworkModel::ItemActiveRole) == true) { // without updating the parent the expand will have no effect... Qt Bug? - update(parent); + update(parent); expand(parent); } } @@ -136,12 +145,11 @@ void BufferView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bott continue; bool isActive = networkIdx.data(NetworkModel::ItemActiveRole).toBool(); - if(isExpanded(networkIdx) != isActive) - setExpanded(networkIdx, isActive); + if(isExpanded(networkIdx) != isActive) setExpanded(networkIdx, isActive); } } - + void BufferView::toggleHeader(bool checked) { QAction *action = qobject_cast(sender()); header()->setSectionHidden((action->property("column")).toInt(), !checked); @@ -227,16 +235,20 @@ void BufferView::showContextMenu(const QPoint &pos) { network->requestDisconnect(); } else if(result == joinChannelAction) { + // FIXME no QInputDialog in Qtopia +#ifndef Q_WS_QWS bool ok; QString channelName = QInputDialog::getText(this, tr("Join Channel"), tr("Input channel name:"),QLineEdit::Normal, QDir::home().dirName(), &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)); } } +#endif } else if(result == joinBufferAction) { Client::instance()->userInput(bufferInfo, QString("/JOIN %1").arg(channelname)); @@ -287,6 +299,8 @@ void BufferView::wheelEvent(QWheelEvent* event) { QSize BufferView::sizeHint() const { + return QSize(120, 50); + if(!model()) return QTreeView::sizeHint();