Committing my local state. Mostly still invisible part on the not yet enabled network...
[quassel.git] / src / client / treemodel.h
index da1f5fd..f7159fd 100644 (file)
@@ -44,6 +44,11 @@ public:
   void removeChild(int column, int row);
   void removeChild(int row);
 
+  void removeChildById(int column, const quint64 &id);
+  void removeChildById(const quint64 &id);
+  
+  void removeAllChilds();
+
   virtual quint64 id() const;
 
   AbstractTreeItem *child(int column, int row) const;
@@ -58,6 +63,7 @@ public:
   virtual int columnCount() const = 0;
 
   virtual QVariant data(int column, int role) const = 0;
+  virtual bool setData(int column, const QVariant &value, int role) = 0;
 
   virtual Qt::ItemFlags flags() const;
   virtual void setFlags(Qt::ItemFlags);
@@ -69,7 +75,9 @@ public:
 signals:
   void dataChanged(int column = -1);
   void newChild(AbstractTreeItem *);
-  void childDestroyed(int row);
+
+  void beginRemoveChilds(int firstRow, int lastRow);
+  void endRemoveChilds();
                                       
 private slots:
   void childDestroyed();
@@ -77,7 +85,6 @@ private slots:
 private:
   QHash<int, QList<AbstractTreeItem *> > _childItems;
   QHash<int, QHash<quint64, AbstractTreeItem *> > _childHash; // uint to be compatible to qHash functions FIXME test this
-  AbstractTreeItem *_parentItem;
   Qt::ItemFlags _flags;
 
   int defaultColumn() const;
@@ -93,7 +100,10 @@ class SimpleTreeItem : public AbstractTreeItem {
 public:
   SimpleTreeItem(const QList<QVariant> &data, AbstractTreeItem *parent = 0);
   virtual ~SimpleTreeItem();
+
   virtual QVariant data(int column, int role) const;
+  virtual bool setData(int column, const QVariant &value, int role);
+
   virtual int columnCount() const;
 
 private:
@@ -113,6 +123,8 @@ public:
   virtual ~PropertyMapItem();
   
   virtual QVariant data(int column, int role) const;
+  virtual bool setData(int column, const QVariant &value, int role);
+
   virtual int columnCount() const;
   
   void appendProperty(const QString &property);
@@ -132,7 +144,9 @@ public:
   TreeModel(const QList<QVariant> &, QObject *parent = 0);
   virtual ~TreeModel();
 
-  QVariant data(const QModelIndex &index, int role) const;
+  virtual QVariant data(const QModelIndex &index, int role) const;
+  virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+
   virtual Qt::ItemFlags flags(const QModelIndex &index) const;
   QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
   
@@ -150,8 +164,10 @@ public:
 private slots:
   void itemDataChanged(int column = -1);
   void newChild(AbstractTreeItem *child);
-  void childDestroyed(int row);
 
+  void beginRemoveChilds(int firstRow, int lastRow);
+  void endRemoveChilds();
+  
 protected:
   void appendChild(AbstractTreeItem *parent, AbstractTreeItem *child);