Little fixes.

This commit is contained in:
Martin Rotter 2014-02-23 16:18:37 +01:00
parent 4fd368c23a
commit b0596c092e
3 changed files with 18 additions and 22 deletions

View File

@ -81,7 +81,8 @@ QPair<FeedsModelStandardFeed*, QNetworkReply::NetworkError> FeedsModelStandardFe
if (encoding_rexp.indexIn(feed_contents) != -1 &&
!(xml_schema_encoding = encoding_rexp.cap(0)).isEmpty()) {
// Some "encoding" attribute was found.
// Some "encoding" attribute was found get the encoding
// out of it.
encoding_rexp.setPattern("[^\"]\\S+[^\"]");
encoding_rexp.indexIn(xml_schema_encoding, 9);
xml_schema_encoding = encoding_rexp.cap(0);
@ -107,10 +108,18 @@ QPair<FeedsModelStandardFeed*, QNetworkReply::NetworkError> FeedsModelStandardFe
// Feed XML was obtained, guess it now.
QDomDocument xml_document;
QString error_msg;
int error_line, error_column;
if (!xml_document.setContent(xml_contents_encoded)) {
qDebug("XML of feed '%s' is not valid and cannot be loaded.",
qPrintable(url));
if (!xml_document.setContent(xml_contents_encoded,
&error_msg,
&error_line,
&error_column)) {
qDebug("XML of feed '%s' is not valid and cannot be loaded. Error: '%s' "
"(line %d, column %d).",
qPrintable(url),
qPrintable(error_msg),
error_line, error_column);
result.second = QNetworkReply::UnknownContentError;
@ -368,17 +377,6 @@ void FeedsModelStandardFeed::updateMessages(const QList<Message> &messages) {
query_select.finish();
// TODO: potreba opravit nacitani URL
// pro http://forum.tea-earth.net/feed.php
// a taky vyresit problem v situaci
// kdy nastane situace ze message_id == -1
// tedy zprava s danym nazvem, autorem, url a casem
// neexistuje, ale existuje ta sama starsi s
// datem ktery se neziskalo z kanalu ale vygenerovalo
// a ja tam ted vkladam tu samou zpravu s opet novym
// vygenerovanym datem, takze se ty zpravy duplikujou a
// duplikujou
if (datetime_stamps.size() == 0 ||
(message.m_createdFromFeed &&
!datetime_stamps.contains(message.m_created.toMSecsSinceEpoch()))) {

View File

@ -28,10 +28,6 @@ class TextFactory {
// NOTE: On Windows UTC is known to be broken.
static QDateTime parseDateTime(qint64 milis_from_epoch);
// TODO: ocekovat stripovani tagu a escapovani
// http://harmattan-dev.nokia.com/docs/library/html/qt4/qtextdocumentfragment.html
// mozna by to bylo lepsi, meotda ::fromHtml
// Strips "<....>" (HTML, XML) tags from given text.
static QString stripTags(QString text);

View File

@ -59,7 +59,9 @@ void FormUpdate::checkForUpdates() {
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok,
tr("New release available."),
tr("This is new version which can be\ndownloaded and installed."));
// TODO: Display "update" button.
// TODO: Display "update" button if
// URL of file for current platform
// is available.
#else
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok,
tr("New release available."),
@ -68,8 +70,8 @@ void FormUpdate::checkForUpdates() {
}
else {
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Warning,
tr("No new releases available."),
tr("This release is not newer than\ncurrently installed one.."));
tr("No new release available."),
tr("This release is not newer than\ncurrently installed one."));
}
}
}