Fixing Issues with the NetworkModel. Though the performance still
[quassel.git] / src / client / treemodel.h
index ee776c0..a8c8a99 100644 (file)
@@ -32,7 +32,7 @@
  *****************************************/
 class AbstractTreeItem : public QObject {
   Q_OBJECT
-  Q_PROPERTY(uint id READ id)
+  Q_PROPERTY(quint64 id READ id)
 
 public:
   AbstractTreeItem(AbstractTreeItem *parent = 0);
@@ -43,14 +43,15 @@ public:
   
   void removeChild(int column, int row);
   void removeChild(int row);
+  void removeAllChilds();
 
   virtual quint64 id() const;
 
   AbstractTreeItem *child(int column, int row) const;
   AbstractTreeItem *child(int row) const;
   
-  AbstractTreeItem *childById(int column, const uint &id) const;
-  AbstractTreeItem *childById(const uint &id) const;
+  AbstractTreeItem *childById(int column, const quint64 &id) const;
+  AbstractTreeItem *childById(const quint64 &id) const;
 
   int childCount(int column) const;
   int childCount() const;
@@ -69,15 +70,18 @@ public:
 signals:
   void dataChanged(int column = -1);
   void newChild(AbstractTreeItem *);
-  void childDestroyed(int row);
+  void childRemoved(int row);
+  void childsRemoved(int firstRow, int lastRow);
+
+  void beginRemoveChilds(int firstRow, int lastRow);
+  void endRemoveChilds();
                                       
 private slots:
   void childDestroyed();
 
 private:
   QHash<int, QList<AbstractTreeItem *> > _childItems;
-  QHash<int, QHash<quint64, AbstractTreeItem *> > _childHash; // uint to be compatible to qHash functions
-  AbstractTreeItem *_parentItem;
+  QHash<int, QHash<quint64, AbstractTreeItem *> > _childHash; // uint to be compatible to qHash functions FIXME test this
   Qt::ItemFlags _flags;
 
   int defaultColumn() const;
@@ -137,7 +141,7 @@ public:
   QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
   
   QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
-  QModelIndex indexById(uint id, const QModelIndex &parent = QModelIndex()) const;
+  QModelIndex indexById(quint64 id, const QModelIndex &parent = QModelIndex()) const;
   QModelIndex indexByItem(AbstractTreeItem *item) const;
 
   QModelIndex parent(const QModelIndex &index) const;
@@ -150,7 +154,12 @@ public:
 private slots:
   void itemDataChanged(int column = -1);
   void newChild(AbstractTreeItem *child);
-  void childDestroyed(int row);
+
+  void beginRemoveChilds(int firstRow, int lastRow);
+  void endRemoveChilds();
+  
+  void childRemoved(int row);
+  void childsRemoved(int firstRow, int lastRow);
 
 protected:
   void appendChild(AbstractTreeItem *parent, AbstractTreeItem *child);