Logo Search packages:      
Sourcecode: katalog version File versions  Download package

QString Katalog::readInfo ( QStringList &  path  )  const

Returns the Meta Info of the specified file

Definition at line 221 of file katalog.cpp.

References findNode(), and sourceURL().

{
  QDomNode node = findNode(path);
  QDomDocument doc;
  
  if(!node.isNull() && node.nodeName().compare(ROOT) == 0 )
  {
    QDomElement metaEl = doc.createElement(META);
    QDomElement groupEl = doc.createElement(GROUP);
    groupEl.setAttribute("name", "Katalog");
    QDomElement itemEl1 = doc.createElement(ITEM);
    itemEl1.setAttribute("key", i18n("Total Catalogs"));
    itemEl1.setAttribute("int_value", totalCatalogs() );
    groupEl.appendChild(itemEl1);
    QDomElement itemEl2 = doc.createElement(ITEM);
    itemEl2.setAttribute("key", i18n("Total Items"));
    itemEl2.setAttribute("int_value", totalItems());
    groupEl.appendChild(itemEl2);
    metaEl.appendChild(groupEl);
    doc.appendChild(metaEl);
    return doc.toString(2);
  }
  
  if(!node.isNull() && node.nodeName().compare(CATALOG) == 0 )
  {
    QDomElement metaEl = doc.createElement(META);
    QDomElement groupEl = doc.createElement(GROUP);
    groupEl.setAttribute("name", "Katalog");
    QDomElement itemEl1 = doc.createElement(ITEM);
    itemEl1.setAttribute("key", i18n("Total Items"));
    itemEl1.setAttribute("int_value", itemsInNode(node));
    groupEl.appendChild(itemEl1);
    QDomElement itemEl2 = doc.createElement(ITEM);
    itemEl2.setAttribute("key", i18n("Original Medium"));
    itemEl2.setAttribute("string_value", sourceURL(path).prettyURL());
    groupEl.appendChild(itemEl2);
    metaEl.appendChild(groupEl);
    doc.appendChild(metaEl);
    return doc.toString(2);
  }
  
  QDomNode metaNode = node.firstChild();
  QDomElement groupElI = doc.createElement(GROUP);
  
  if(!node.isNull() && node.nodeName().compare(ITEM) == 0 )
  {
    groupElI.setAttribute("name", "Katalog");
    QDomElement itemEl = doc.createElement(ITEM);
    itemEl.setAttribute("key", i18n("Mimetype"));
    itemEl.setAttribute("string_value", node.toElement().attribute("mimetype") );
    groupElI.appendChild(itemEl);    
  }
  
  if(!metaNode.isNull() && metaNode.nodeName().compare(META) == 0 )
  {
    if(groupElI.hasChildNodes())
      metaNode.appendChild(groupElI);
    doc.appendChild(metaNode);
    return doc.toString(2);
  }
  return "";
}


Generated by  Doxygen 1.6.0   Back to index