Example #1
0
void BookmarkWidget::deleteItem(QTreeWidgetItem* item)
{
    if(!item)
    {
        QList<QTreeWidgetItem*> list = bTreeWidget->selectedItems();
        if(list.isEmpty()) return;
        item = list.at(0);
        if(!item) return;
    }
    int type = item->data(TITLE_COLUMN, Qt::UserRole).toInt();
    QString caption = item->text(TITLE_COLUMN);
    QString uuid = item->text(UUID_COLUMN);
    //if(verifyDelete(caption, type) == QMessageBox::Cancel) return;

    item->setHidden(true);
    QDomDocument doc;
    QDomElement elt = findElementbyUUID(doc, uuid, type);
    if(elt.isNull()) return;
    elt.setAttribute("isHidden", QString("True"));
    saveDOMToFile(doc);

    QString bookmarkFolder = mw()->VTKA()->mProjectPath;
    bookmarkFolder.append(QDir::separator() + QString("BookMark"));
    emit removeNavigationItem(bookmarkFolder, caption, uuid);
}
Example #2
0
QStringList QgsWFSProvider::insertedFeatureIds( const QDomDocument& serverResponse ) const
{
  QStringList ids;
  if ( serverResponse.isNull() )
  {
    return ids;
  }

  QDomElement rootElem = serverResponse.documentElement();
  if ( rootElem.isNull() )
  {
    return ids;
  }

  QDomNodeList insertResultList = rootElem.elementsByTagNameNS( QgsWFSConstants::WFS_NAMESPACE, "InsertResult" );
  for ( int i = 0; i < insertResultList.size(); ++i )
  {
    QDomNodeList featureIdList = insertResultList.at( i ).toElement().elementsByTagNameNS( QgsWFSConstants::OGC_NAMESPACE, "FeatureId" );
    for ( int j = 0; j < featureIdList.size(); ++j )
    {
      QString fidString = featureIdList.at( j ).toElement().attribute( "fid" );
      if ( !fidString.isEmpty() )
      {
        ids << fidString;
      }
    }
  }
  return ids;
}
Example #3
0
QTreeWidgetItem * QgsCustomizationDialog::createTreeItemWidgets()
{
  QgsDebugMsg( "Entered" );

  QDomDocument myDoc( "QgsWidgets" );
  QFile myFile( QgsApplication::pkgDataPath() +  "/resources/customization.xml" );
  if ( !myFile.open( QIODevice::ReadOnly ) )
  {
    return NULL;
  }
  if ( !myDoc.setContent( &myFile ) )
  {
    myFile.close();
    return NULL;
  }
  myFile.close();

  QDomElement myRoot = myDoc.documentElement();
  if ( myRoot.tagName() != "qgiswidgets" )
  {
    return NULL;
  }
  QTreeWidgetItem *myItem = readWidgetsXmlNode( myRoot );
  // Do not translate "Widgets", currently it is also used as path
  myItem->setData( 0, Qt::DisplayRole, "Widgets" );

  return myItem;
}
Example #4
0
void AbstractItem::readPenBrush(const QDomElement &docItem)
{
	QString brushStyle = docItem.attribute("fill-style", "");
	if (brushStyle == "solid") {
		mBrush.setStyle(Qt::SolidPattern);
	} else if (brushStyle == "none") {
		mBrush.setStyle(Qt::NoBrush);
	}

	mBrush.setColor(QColor(docItem.attribute("fill", "")));
	mPen.setColor(QColor(docItem.attribute("stroke", "")));
	mPen.setWidth((docItem.attribute("stroke-width", "")).toDouble());

	QString penStyle = docItem.attribute("stroke-style", "");
	if (penStyle == "solid") {
		mPen.setStyle(Qt::SolidLine);
	} else if (penStyle == "dot") {
		mPen.setStyle(Qt::DotLine);
	} else if (penStyle == "dash") {
		mPen.setStyle(Qt::DashLine);
	} else if (penStyle == "dashdot") {
		mPen.setStyle(Qt::DashDotLine);
	} else if (penStyle == "dashdotdot") {
		mPen.setStyle(Qt::DashDotDotLine);
	} else if (penStyle == "none") {
		mPen.setStyle(Qt::NoPen);
	}

	emit penChanged(mPen);
}
Example #5
0
QString Ui3Reader::getDatabaseInfo(const QDomElement& e, const QString& tag)
{
    QDomElement n;
    QDomElement n1;
    int child = 0;
    // database info is a stringlist stored in this order
    if (tag == QLatin1String("connection"))
        child = 0;
    else if (tag == QLatin1String("table"))
        child = 1;
    else if (tag == QLatin1String("field"))
        child = 2;
    else
        return QString();
    n = getObjectProperty(e, QLatin1String("database"));
    if (n.firstChild().toElement().tagName() == QLatin1String("stringlist")) {
        // find correct stringlist entry
        QDomElement n1 = n.firstChild().firstChild().toElement();
        for (int i = 0; i < child && !n1.isNull(); ++i)
            n1 = n1.nextSibling().toElement();
        if (n1.isNull())
            return QString();
        return n1.firstChild().toText().data();
    }
    return QString();
}
Example #6
0
void MyXML::loadXML()
{
    QFile file(saveFileName);
    if (!file.open(QIODevice::ReadOnly | QFile::Text)) {
        file.remove();
        creatXML();
        return;
    }
    QString errorStr;
    int errorLine;
    int errorColumn;

    if (!doc.setContent(&file, false, &errorStr, &errorLine, &errorColumn)) {
        file.close();
        file.remove();
        doc.clear();
        creatXML();
        return;
    }
    file.close();
    QDomElement root = doc.documentElement();
    if (root.tagName() != "FileManager") {
       file.remove();
       doc.clear();
       creatXML();
    }
}
Example #7
0
QgsServerProjectParser::QgsServerProjectParser( QDomDocument* xmlDoc, const QString& filePath )
    : mXMLDoc( xmlDoc )
    , mProjectPath( filePath )
{
    //accelerate the search for layers, groups and the creation of annotation items
    if ( mXMLDoc )
    {
        QDomNodeList layerNodeList = mXMLDoc->elementsByTagName( "maplayer" );
        QDomElement currentElement;
        int nNodes = layerNodeList.size();
        for ( int i = 0; i < nNodes; ++i )
        {
            currentElement = layerNodeList.at( i ).toElement();
            mProjectLayerElements.push_back( currentElement );
            mProjectLayerElementsByName.insert( layerName( currentElement ), currentElement );
            mProjectLayerElementsById.insert( layerId( currentElement ), currentElement );
        }

        QDomElement legendElement = mXMLDoc->documentElement().firstChildElement( "legend" );
        if ( !legendElement.isNull() )
        {
            QDomNodeList groupNodeList = legendElement.elementsByTagName( "legendgroup" );
            for ( int i = 0; i < groupNodeList.size(); ++i )
            {
                mLegendGroupElements.push_back( groupNodeList.at( i ).toElement() );
            }
        }

        mRestrictedLayers = findRestrictedLayers();
        mUseLayerIDs = findUseLayerIDs();
    }
}
void addTextTag(QDomDocument& doc, QDomElement& holder,
                QString tagName, QString tagText) {
    QDomElement tag = doc.createElement(tagName);
    QDomText textNode = doc.createTextNode(tagText);
    tag.appendChild(textNode);
    holder.appendChild(tag);
}
Example #9
0
bool ProjectHandler::parseHeader(const QDomElement &root)
{
    QDomElement el;

    QDomNode child=root.firstChild();
    int width=0,height=0,depth=0;
    while(!child.isNull())
    {
        el=child.toElement();
        if(el.tagName()=="name")
            project->name=el.text();
        else if(el.tagName()=="width")
            width=el.text().toUInt();
        else if(el.tagName()=="height")
            height=el.text().toUInt();
        else if(el.tagName()=="depth")
            depth=el.text().toUInt();

        child=child.nextSibling();
    }

    if(width>0 && width<=project->map.maxWidth() && height>0 && height<=project->map.maxHeight() && depth>0 && depth<=project->map.maxDepth())
        project->map.setup(width,height,depth);
    else
        return false;
    return true;
}
void FavouriteManagerPrivate::save()
{
    QDomDocument document;
    QDomElement rootElement = document.createElement("favourites");

    QListIterator<QPair<QString, Station> > iterator
            = QListIterator<QPair<QString, Station> >(data);
    while (iterator.hasNext()) {
        QPair<QString, Station> entry = iterator.next();
        QDomElement element = XmlConversionHelper::toXml(entry.second, &document);
        element.setAttribute(BACKEND_ATTRIBUTE, entry.first);
        rootElement.appendChild(element);
    }
    document.appendChild(rootElement);

    QDir favouriteDir = QDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
    if (!favouriteDir.exists()) {
        QDir::root().mkpath(favouriteDir.absolutePath());
    }


    QFile file (favouriteDir.absoluteFilePath(fileName));
    if (!file.open(QIODevice::WriteOnly)) {
        return;
    }

    QTextStream stream(&file);
    document.save(stream, 2);
    file.close();
}
Example #11
0
QDomElement MainWindow2::createDomElement(QDomDocument& doc)
{
    QDomElement tag = doc.createElement("editor");

    QDomElement tag1 = doc.createElement("currentLayer");
    tag1.setAttribute("value", editor->m_nCurrentLayerIndex);
    tag.appendChild(tag1);
    QDomElement tag2 = doc.createElement("currentFrame");
    tag2.setAttribute("value", editor->m_nCurrentFrameIndex);
    tag.appendChild(tag2);
    QDomElement tag2a = doc.createElement("currentFps");
    tag2a.setAttribute("value", editor->fps);
    tag.appendChild(tag2a);
    QDomElement tag3 = doc.createElement("currentView");

    QMatrix myView = m_pScribbleArea->getMyView();
    tag3.setAttribute("m11", myView.m11());
    tag3.setAttribute("m12", myView.m12());
    tag3.setAttribute("m21", myView.m21());
    tag3.setAttribute("m22", myView.m22());
    tag3.setAttribute("dx", myView.dx());
    tag3.setAttribute("dy", myView.dy());
    tag.appendChild(tag3);

    return tag;
}
void FavouriteManagerPrivate::load()
{
    QDir favouriteDir = QDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
    if (!favouriteDir.exists(fileName)) {
        return;
    }

    QFile file (favouriteDir.absoluteFilePath(fileName));
    if (!file.open(QIODevice::ReadOnly)) {
        return;
    }

    QDomDocument document;
    document.setContent(&file);
    file.close();

    QDomElement element = document.documentElement().firstChildElement();

    while (!element.isNull()) {
        Station station = XmlConversionHelper::fromXmlToStation(element);
        QString backend = element.attribute(BACKEND_ATTRIBUTE);

        data.append(QPair<QString, Station>(backend, station));

        element = element.nextSiblingElement();
    }
}
Example #13
0
void BookmarkWidget::displayItemInfo(QTreeWidgetItem* item)
{
    if(!item) {
        QList<QTreeWidgetItem *> selected = bTreeWidget->selectedItems();
        if(selected.isEmpty()) return;
        item = selected.at(0);
        if(!item) return;
    }

    int type = item->data(TITLE_COLUMN, Qt::UserRole).toInt();
    QString uuid = item->text(UUID_COLUMN);

    QDomDocument doc;
    QDomElement elt = findElementbyUUID(doc, uuid, type);

    if(elt.isNull()) return;

    infoDialog = new QDialog();
    setupInfoDialogUI(elt);

    if(type == BOOKMARK)
        infoDialog->setWindowTitle(tr("Bookmark Info"));
    else if(type == FOLDER)
        infoDialog->setWindowTitle(tr("Folder Info"));
    infoDialog->setLayout(grid);
    infoDialog->exec();

    delete infoDialog;
}
Example #14
0
void BookmarkWidget::deleteItemPermanently(const QString xmlPath, QTreeWidgetItem* item)
{
    if(!item) {
        QList<QTreeWidgetItem*> list = bTreeWidget->selectedItems();
        if(list.isEmpty()) return;
        item = list.at(0);
        if(!item) return;
    }
    // DT: don't move this!
    QString uuid = item->text(UUID_COLUMN);

    QDomDocument doc;
    QDomElement elt = findElementbyUUID(doc, uuid, BOOKMARK, xmlPath);

    QList<QTreeWidgetItem *> items = bTreeWidget->findItems(uuid, Qt::MatchExactly, UUID_COLUMN);
    item = items.at(0);
    delete item;

    if(elt.isNull()) return;

    QDomNode parent = elt.parentNode();
    parent.removeChild(elt);
    saveDOMToFile(doc, xmlPath);
    //refreshBookmarkList();
}
Example #15
0
void LevelLoader::loadLine(QDomElement lineNode)
{
    // Reading the line number
    QDomAttr attribute = lineNode.attributeNode(QStringLiteral("Number"));
    QDomElement attributeNode = lineNode.firstChildElement(QStringLiteral("Number"));
    if (!attribute.isNull()) {
        m_lineNumber = attribute.value().toInt();
    } else if (!attributeNode.isNull()) {
        m_lineNumber = attributeNode.text().toInt();
    } else {
        // Standard line numbering: load next line
        m_lineNumber++;
    }

    // Reading the brick information
    attribute = lineNode.attributeNode(QStringLiteral("Bricks"));
    attributeNode = lineNode.firstChildElement(QStringLiteral("Bricks"));
    QString line;
    if (!attribute.isNull()) {
        line = attribute.value();
    } else if (!attributeNode.isNull()) {
        line = attributeNode.text();
    } else {
        line = lineNode.text();
    }

    if (line.size() > WIDTH) {
        qCritical() << "Invalid levelset " << m_levelname << ": too many bricks in line "
                    << m_lineNumber << endl;
    }

    emit newLine(line, m_lineNumber);
}
Example #16
0
void Text::read(const QDomElement& de)
      {
      for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
            if (!readProperties(e))
                  domError(e);
            }
      }
QgsRasterRenderer *QgsSingleBandGrayRenderer::create( const QDomElement &elem, QgsRasterInterface *input )
{
  if ( elem.isNull() )
  {
    return nullptr;
  }

  int grayBand = elem.attribute( QStringLiteral( "grayBand" ), QStringLiteral( "-1" ) ).toInt();
  QgsSingleBandGrayRenderer *r = new QgsSingleBandGrayRenderer( input, grayBand );
  r->readXml( elem );

  if ( elem.attribute( QStringLiteral( "gradient" ) ) == QLatin1String( "WhiteToBlack" ) )
  {
    r->setGradient( WhiteToBlack );  // BlackToWhite is default
  }

  QDomElement contrastEnhancementElem = elem.firstChildElement( QStringLiteral( "contrastEnhancement" ) );
  if ( !contrastEnhancementElem.isNull() )
  {
    QgsContrastEnhancement *ce = new QgsContrastEnhancement( ( Qgis::DataType )(
          input->dataType( grayBand ) ) );
    ce->readXml( contrastEnhancementElem );
    r->setContrastEnhancement( ce );
  }
  return r;
}
Example #18
0
QDomElement QgsNullSymbolRenderer::save( QDomDocument &doc, const QgsReadWriteContext &context )
{
  Q_UNUSED( context );
  QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
  rendererElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "nullSymbol" ) );
  return rendererElem;
}
Example #19
0
ConstraintTypes::PlaylistLength::PlaylistLength( QDomElement& xmlelem, ConstraintNode* p )
        : Constraint( p )
        , m_length( 30 )
        , m_comparison( CompareNumEquals )
        , m_strictness( 1.0 )
{
    QDomAttr a;

    a = xmlelem.attributeNode( "length" );
    if ( !a.isNull() ) {
        m_length = a.value().toInt();
        /* after 2.3.2, what was the PlaylistLength constraint became the
         * PlaylistDuration constraint, so this works around the instance when
         * a user loads an XML file generated with the old code -- sth*/
        if ( m_length > 1000 )
            m_length /= 240000;
    }

    a = xmlelem.attributeNode( "comparison" );
    if ( !a.isNull() )
        m_comparison = a.value().toInt();

    a = xmlelem.attributeNode( "strictness" );
    if ( !a.isNull() )
        m_strictness = a.value().toDouble();
}
Example #20
0
void schedulexmldata::deleteonescheduledata(QString tmpscheduledate, QString tmpid)
{
    QFile file("/home/user/.scheduledata.xml");
    if(!file.open(QIODevice::ReadOnly))  return;
    QDomDocument doc;
    if(!doc.setContent(&file)){
        file.close();
        return;
    }
    file.close();

    QDomElement root = doc.documentElement();
    QDomNode n = root.firstChild();
    while(!n.isNull()){
        if(tmpscheduledate == n.toElement().attribute(QString("scheduledateattr"))){
            QDomNodeList schedulelist = n.toElement().elementsByTagName(QString("schedule"));
            for(int m=0; m<schedulelist.count(); m++){
                if(schedulelist.at(m).toElement().attribute(QString("id")) == tmpid){
                    qDebug() << n.toElement().tagName();
                    n.toElement().removeChild(schedulelist.at(m));
                }
            }
        }
        n = n.nextSibling();
    }

    if( !file.open(QIODevice::WriteOnly | QIODevice::Truncate)) return;
    QTextStream out(&file);
    doc.save(out, 4);
    file.close();
}
Example #21
0
void AbstractItem::setXandY(QDomElement& dom, const QRectF &rect)
{
	dom.setAttribute("y1", rect.top());
	dom.setAttribute("x1", rect.left());
	dom.setAttribute("y2", rect.bottom());
	dom.setAttribute("x2", rect.right());
}
Example #22
0
 void GwtField::xml(const GwtValue &value, QDomElement &parent) const {
     std::stringstream stream;
     print(value, stream, GwtPrintStyle::XmlFieldValue);
     auto doc = parent.ownerDocument();
     auto text = doc.createTextNode(stream.str().c_str());
     parent.appendChild(text);
 }
Example #23
0
/*! Extracts an object name from \a e. It's stored in the 'name'
 property.
 */
QString Ui3Reader::getObjectName(const QDomElement& e)
{
    QDomElement n = getObjectProperty(e, QLatin1String("name"));
    if (n.firstChild().toElement().tagName() == QLatin1String("cstring"))
        return n.firstChild().toElement().firstChild().toText().data();
    return QString();
}
Example #24
0
void QgsMapSettings::readXml( QDomNode &node )
{
  // set destination CRS
  QgsCoordinateReferenceSystem srs;
  QDomNode srsNode = node.namedItem( QStringLiteral( "destinationsrs" ) );
  if ( !srsNode.isNull() )
  {
    srs.readXml( srsNode );
  }
  setDestinationCrs( srs );

  // set extent
  QDomNode extentNode = node.namedItem( QStringLiteral( "extent" ) );
  QgsRectangle aoi = QgsXmlUtils::readRectangle( extentNode.toElement() );
  setExtent( aoi );

  // set rotation
  QDomNode rotationNode = node.namedItem( QStringLiteral( "rotation" ) );
  QString rotationVal = rotationNode.toElement().text();
  if ( ! rotationVal.isEmpty() )
  {
    double rot = rotationVal.toDouble();
    setRotation( rot );
  }

  //render map tile
  QDomElement renderMapTileElem = node.firstChildElement( QStringLiteral( "rendermaptile" ) );
  if ( !renderMapTileElem.isNull() )
  {
    setFlag( QgsMapSettings::RenderMapTile, renderMapTileElem.text() == QLatin1String( "1" ) );
  }
}
Example #25
0
bool QgsWFSProvider::transactionSuccess( const QDomDocument& serverResponse ) const
{
  if ( serverResponse.isNull() )
  {
    return false;
  }

  QDomElement documentElem = serverResponse.documentElement();
  if ( documentElem.isNull() )
  {
    return false;
  }

  QDomNodeList transactionResultList = documentElem.elementsByTagNameNS( QgsWFSConstants::WFS_NAMESPACE, "TransactionResult" );
  if ( transactionResultList.size() < 1 )
  {
    return false;
  }

  QDomNodeList statusList = transactionResultList.at( 0 ).toElement().elementsByTagNameNS( QgsWFSConstants::WFS_NAMESPACE, "Status" );
  if ( statusList.size() < 1 )
  {
    return false;
  }

  if ( statusList.at( 0 ).firstChildElement().localName() == "SUCCESS" )
  {
    return true;
  }
  else
  {
    return false;
  }
}
Example #26
0
void QgsMapSettings::writeXml( QDomNode &node, QDomDocument &doc )
{
  // units
  node.appendChild( QgsXmlUtils::writeMapUnits( mapUnits(), doc ) );

  // Write current view extents
  node.appendChild( QgsXmlUtils::writeRectangle( extent(), doc ) );

  // Write current view rotation
  QDomElement rotNode = doc.createElement( QStringLiteral( "rotation" ) );
  rotNode.appendChild(
    doc.createTextNode( qgsDoubleToString( rotation() ) )
  );
  node.appendChild( rotNode );

  // destination CRS
  if ( mDestCRS.isValid() )
  {
    QDomElement srsNode = doc.createElement( QStringLiteral( "destinationsrs" ) );
    node.appendChild( srsNode );
    mDestCRS.writeXml( srsNode, doc );
  }

  //render map tile
  QDomElement renderMapTileElem = doc.createElement( QStringLiteral( "rendermaptile" ) );
  QDomText renderMapTileText = doc.createTextNode( testFlag( QgsMapSettings::RenderMapTile ) ? "1" : "0" );
  renderMapTileElem.appendChild( renderMapTileText );
  node.appendChild( renderMapTileElem );
}
void QgsRendererRangeV2::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
{
  if ( !mSymbol.data() || props.value( "attribute", "" ).isEmpty() )
    return;

  QString attrName = props[ "attribute" ];

  QDomElement ruleElem = doc.createElement( "se:Rule" );
  element.appendChild( ruleElem );

  QDomElement nameElem = doc.createElement( "se:Name" );
  nameElem.appendChild( doc.createTextNode( mLabel ) );
  ruleElem.appendChild( nameElem );

  QDomElement descrElem = doc.createElement( "se:Description" );
  QDomElement titleElem = doc.createElement( "se:Title" );
  QString descrStr = QString( "range: %1 - %2" ).arg( mLowerValue ).arg( mUpperValue );
  titleElem.appendChild( doc.createTextNode( !mLabel.isEmpty() ? mLabel : descrStr ) );
  descrElem.appendChild( titleElem );
  ruleElem.appendChild( descrElem );

  // create the ogc:Filter for the range
  QString filterFunc = QString( "%1 > %2 AND %1 <= %3" )
                       .arg( attrName.replace( "\"", "\"\"" ) )
                       .arg( mLowerValue ).arg( mUpperValue );
  QgsSymbolLayerV2Utils::createFunctionElement( doc, ruleElem, filterFunc );

  mSymbol->toSld( doc, ruleElem, props );
}
QVariant parseXmlRpcStruct( const QDomElement &e, QString &err )
{
    #ifdef DEBUG_XMLRPC
    qDebug() << "parseXmlRpcStruct():" << e.tagName();
    #endif

    QVariantMap r;
    QDomElement t= e;
    while ( !t.isNull() )
        {
            if ( t.tagName() != "member" )
                {
                    err= "no member tag in struct, tag " + e.tagName();
                    return r;
                }

            QDomElement s= t.firstChild().toElement();
            if ( s.tagName() != "name" )
                {
                    err= "no name tag in member struct, tag " + s.tagName();
                    return r;
                }

            /* set map value */
            r[s.firstChild().toText().data()]= parseXmlRpcValue( s.nextSibling().toElement(), err );
            if ( !err.isEmpty() )
                return r;
            t= t.nextSibling().toElement();
        }

    return r;
}
/************************************************
 For each <Menu> element, build a pool of desktop entries by collecting entries found
 in each <AppDir> for the menu element. If two entries have the same desktop-file id,
 the entry for the earlier (closer to the top of the file) <AppDir> must be discarded.

 Next, add to the pool the entries for any <AppDir>s specified by ancestor <Menu>
 elements. If a parent menu has a duplicate entry (same desktop-file id), the entry
 for the child menu has priority.
 ************************************************/
void XdgMenuApplinkProcessor::fillAppFileInfoList()
{
    // Build a pool by collecting entries found in <AppDir>
    {
        MutableDomElementIterator i(mElement, QLatin1String("AppDir"));
        i.toBack();
        while(i.hasPrevious())
        {
            QDomElement e = i.previous();
            findDesktopFiles(e.text(), QString());
            mElement.removeChild(e);
        }
    }

    // Add the entries for ancestor <Menu> ................
    if (mParent)
    {
        XdgMenuAppFileInfoHashIterator i(mParent->mAppFileInfoHash);
        while(i.hasNext())
        {
            i.next();
            //if (!mAppFileInfoHash.contains(i.key()))
                mAppFileInfoHash.insert(i.key(), i.value());
        }
    }
}
Example #30
0
bool DataManager::removeVideo(QString dateTime) {
    QDomNode node = m_resultDataDomDocument.firstChildElement().firstChild();
    while( !node.isNull())
    {
        if( node.isElement())
        {
            QDomElement element = node.toElement();
            QString dateInXML = element.attribute("DateTime");
            if (dateInXML.compare(dateTime)==0)
            {
              m_resultDataDomDocument.firstChildElement().removeChild(node);
              if(!m_resultDataFile.open(QIODevice::WriteOnly | QIODevice::Text))
              {
                  qDebug() <<  "Failed to open result data file for item deletion";
                  return false;
              }
              else
              {
                  QTextStream stream(&m_resultDataFile);
                  stream.setCodec("UTF-8");
                  stream << m_resultDataDomDocument.toString();
                  m_resultDataFile.close();
              }
              break;
            }
        }
        node = node.nextSibling();
    }
    return true;
}