fixed bufferswitches when using different buffer views
authorMarcus Eggenberger <egs@quassel-irc.org>
Fri, 18 Apr 2008 10:37:25 +0000 (10:37 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Fri, 18 Apr 2008 10:37:25 +0000 (10:37 +0000)
src/client/buffermodel.cpp
src/client/buffermodel.h
src/uisupport/bufferview.h

index 3dfdc6d..c487e0f 100644 (file)
@@ -30,6 +30,10 @@ BufferModel::BufferModel(NetworkModel *parent)
     _selectionModelSynchronizer(this)
 {
   setSourceModel(parent);
+  if(QCoreApplication::instance()->arguments().contains("--debugbufferswitches")) {
+    connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
+           this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &)));
+  }
 }
 
 bool BufferModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const {
@@ -65,9 +69,6 @@ void BufferModel::setCurrentIndex(const QModelIndex &newCurrent) {
 }
 
 void BufferModel::debug_currentChanged(QModelIndex current, QModelIndex previous) {
-  qDebug() << "New current:" << current << "(previous:" << previous << ")";
-}
-
-void BufferModel::debug_selectionChanged(QItemSelection current , QItemSelection previous) {
-  qDebug() << "new selection:" << current << "(previoius:" << previous << ")";
+  Q_UNUSED(previous);
+  qDebug() << "Switched current Buffer: " << current << current.data().toString() << "Buffer:" << current.data(NetworkModel::BufferIdRole).value<BufferId>();
 }
index 3126f73..7bd3fc9 100644 (file)
@@ -50,7 +50,6 @@ public:
 
 private slots:
   void debug_currentChanged(QModelIndex current, QModelIndex previous);
-  void debug_selectionChanged(QItemSelection current , QItemSelection previous);
     
 private:
   SelectionModelSynchronizer _selectionModelSynchronizer;
index 0f1b502..b766f99 100644 (file)
@@ -45,7 +45,7 @@ public:
 
   void setConfig(BufferViewConfig *config);
   inline BufferViewConfig *config() { return _config; }
-
+                                                              
 public slots:
   void setRootIndexForNetworkId(const NetworkId &networkId);
   
@@ -58,6 +58,7 @@ protected:
   virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
   virtual void wheelEvent(QWheelEvent *);
   virtual QSize sizeHint() const;
+  virtual void focusInEvent(QFocusEvent *event) { QAbstractScrollArea::focusInEvent(event); }
 
 private slots:
   void joinChannel(const QModelIndex &index);