+++ /dev/null
-/*\r
- * This file is part of family-shop-mgr.\r
- *\r
- * family-shop-mgr is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * family-shop-mgr is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with family-shop-mgr. If not, see <http://www.gnu.org/licenses/>.\r
- *\r
- * Author: Unai IRIGOYEN\r
- * Date: 12/07/2009\r
- *\r
- */\r
-\r
-#include <QtXml>\r
-\r
-#include "ShoppingTreeItem.h"\r
-\r
-\r
-ShoppingTreeItem::ShoppingTreeItem(QDomNode &node, int row, ShoppingTreeItem *parent)\r
-{\r
- domNode = node;\r
- rowNumber = row;\r
- parentItem = parent;\r
-}\r
-\r
-/*******************************************************************/\r
-ShoppingTreeItem::~ShoppingTreeItem()\r
-{\r
- QHash<int,ShoppingTreeItem*>::iterator it;\r
- for (it = childItems.begin(); it != childItems.end(); ++it)\r
- delete it.value();\r
-}\r
-\r
-/*******************************************************************/\r
-QDomNode ShoppingTreeItem::node() const\r
-{\r
- return domNode;\r
-}\r
-\r
-/*******************************************************************/\r
-ShoppingTreeItem *ShoppingTreeItem::parent()\r
-{\r
- return parentItem;\r
-}\r
-\r
-/*******************************************************************/\r
-ShoppingTreeItem *ShoppingTreeItem::child(int i)\r
-{\r
- if (childItems.contains(i))\r
- return childItems[i];\r
-\r
- QDomNodeList childNodesList = domNode.childNodes();\r
- QList<QDomNode> childElementsList;\r
- QDomNode childNode;\r
- for(int j = 0; !(childNode = childNodesList.at(j)).isNull(); j++)\r
- {\r
- if(childNode.isElement())\r
- {\r
- if(childNode.toElement().nodeName() == "category" ||\r
- childNode.toElement().nodeName() == "item")\r
- childElementsList.append(childNode);\r
- }\r
- }\r
- if (i >= 0 && i < childElementsList.count()) {\r
- childNode = childElementsList.at(i);\r
- ShoppingTreeItem *childItem = new ShoppingTreeItem(childNode, i, this);\r
- childItems[i] = childItem;\r
- return childItem;\r
- }\r
- return 0;\r
-}\r
-\r
-/*******************************************************************/\r
-int ShoppingTreeItem::row()\r
-{\r
- return rowNumber;\r
-}\r