All pastes #1524049 Raw Edit

Anonymous

public text v1 · immutable
#1524049 ·published 2009-08-10 16:27 UTC
rendered paste body
Index: mythtv/libs/libmythui/mythuibuttontree.cpp
===================================================================
--- mythtv/libs/libmythui/mythuibuttontree.cpp	(revision 21194)
+++ mythtv/libs/libmythui/mythuibuttontree.cpp	(working copy)
@@ -282,6 +282,27 @@
     return false;
 }
 
+void MythUIButtonTree::RemoveItem(MythUIButtonListItem *item, bool deleteNode)
+{
+    if (!item || !m_rootNode)
+        return;
+
+    if (deleteNode)
+    {
+        MythGenericTree *node = qVariantValue<MythGenericTree*>
+                                                            (item->GetData());
+        if (node)
+            m_rootNode->removeNode(node);
+    }
+
+    m_activeList->RemoveItem(item);
+}
+
+void MythUIButtonTree::RemoveCurrentItem(bool deleteNode)
+{
+    RemoveItem(GetItemCurrent());
+}
+
 void MythUIButtonTree::SetActive(bool active)
 {
     m_active = active;
Index: mythtv/libs/libmythui/mythuibuttontree.h
===================================================================
--- mythtv/libs/libmythui/mythuibuttontree.h	(revision 21194)
+++ mythtv/libs/libmythui/mythuibuttontree.h	(working copy)
@@ -32,6 +32,8 @@
     void SetActive(bool active);
 
     MythUIButtonListItem* GetItemCurrent(void) const;
+    void RemoveItem(MythUIButtonListItem *item, bool deleteNode = true);
+    void RemoveCurrentItem(bool deleteNode = true);
 
   public slots:
     void handleSelect(MythUIButtonListItem* item);