Ticket #1891: newsengine_replacehtml.diff

File newsengine_replacehtml.diff, 2.8 KB (added by skamithi, 18 years ago)
  • mythflix/mythflix/newsengine.cpp

     
    243243        title    = itemNode.namedItem(QString::fromLatin1("title")).toElement().text().simplifyWhiteSpace();
    244244        QDomNode descNode = itemNode.namedItem(QString::fromLatin1("description"));
    245245        if (!descNode.isNull())
     246        {
    246247            description = descNode.toElement().text().simplifyWhiteSpace();
     248            ReplaceHtmlChar(description);
     249        }           
    247250        else
    248251            description = QString::null;
    249252        QDomNode linkNode = itemNode.namedItem(QString::fromLatin1("link"));
     
    274277    }
    275278}
    276279
     280void NewsSite::ReplaceHtmlChar(QString &s)
     281{
     282    s.replace("&", "&");
     283    s.replace("&lt;", "<");
     284    s.replace("&gt;", ">");
     285    s.replace("&quot;", "\"");
     286    s.replace("&apos;", "\'");
     287    s.replace("&#8230;",QChar(8230));
     288    s.replace("&#233;",QChar(233));
     289}
     290
  • mythflix/mythflix/newsengine.h

     
    108108    NewsArticle::List m_articleList;
    109109    QUrlOperator*     m_urlOp;
    110110
     111    void ReplaceHtmlChar( QString &s);
     112
    111113signals:
    112114
    113115    void finished(NewsSite* item);
  • mythnews/mythnews/newsengine.cpp

     
    243243        title    = itemNode.namedItem(QString::fromLatin1("title")).toElement().text().simplifyWhiteSpace();
    244244        QDomNode descNode = itemNode.namedItem(QString::fromLatin1("description"));
    245245        if (!descNode.isNull())
     246        {
    246247            description = descNode.toElement().text().simplifyWhiteSpace();
     248            ReplaceHtmlChar(description);
     249        }           
    247250        else
    248251            description = QString::null;
    249252        QDomNode linkNode = itemNode.namedItem(QString::fromLatin1("link"));
     
    274277    }
    275278}
    276279
     280void NewsSite::ReplaceHtmlChar(QString &s)
     281{
     282    s.replace("&amp;", "&");
     283    s.replace("&lt;", "<");
     284    s.replace("&gt;", ">");
     285    s.replace("&quot;", "\"");
     286    s.replace("&apos;", "\'");
     287    s.replace("&#8230;",QChar(8230));
     288    s.replace("&#233;",QChar(233));
     289}
     290
  • mythnews/mythnews/newsengine.h

     
    108108    NewsArticle::List m_articleList;
    109109    QUrlOperator*     m_urlOp;
    110110
     111    void ReplaceHtmlChar( QString &s);
     112
    111113signals:
    112114
    113115    void finished(NewsSite* item);