2 * This file is part of family-shop-mgr.
\r
4 * family-shop-mgr is free software: you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation, either version 3 of the License, or
\r
7 * (at your option) any later version.
\r
9 * family-shop-mgr is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License
\r
15 * along with family-shop-mgr. If not, see <http://www.gnu.org/licenses/>.
\r
17 * Author: Unai IRIGOYEN
\r
24 #include "ShoppingTreeItem.h"
\r
27 DomItem::DomItem(QDomNode &node, int row, DomItem *parent)
\r
31 parentItem = parent;
\r
34 /*******************************************************************/
\r
37 QHash<int,DomItem*>::iterator it;
\r
38 for (it = childItems.begin(); it != childItems.end(); ++it)
\r
42 /*******************************************************************/
\r
43 QDomNode DomItem::node() const
\r
48 /*******************************************************************/
\r
49 DomItem *DomItem::parent()
\r
54 /*******************************************************************/
\r
55 DomItem *DomItem::child(int i)
\r
57 if (childItems.contains(i))
\r
58 return childItems[i];
\r
60 QDomNodeList childNodesList = domNode.childNodes();
\r
61 QList<QDomNode> childElementsList;
\r
63 for(int j = 0; !(childNode = childNodesList.at(j)).isNull(); j++)
\r
65 if(childNode.isElement())
\r
67 if(childNode.toElement().nodeName() == "category" ||
\r
68 childNode.toElement().nodeName() == "item")
\r
69 childElementsList.append(childNode);
\r
72 if (i >= 0 && i < childElementsList.count()) {
\r
73 childNode = childElementsList.at(i);
\r
74 DomItem *childItem = new DomItem(childNode, i, this);
\r
75 childItems[i] = childItem;
\r
81 /*******************************************************************/
\r