diff --git a/CMakeLists.txt b/CMakeLists.txt index 885cd18b8..0831dc665 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -402,10 +402,10 @@ if(${USE_QT_5}) # Load translations. if(Qt5LinguistTools_FOUND) - message(STATUS "[${APP_LOW_NAME}] Qt Linguist Tools found. Translations will get refreshed.") + message(STATUS "[${APP_LOW_NAME}] Qt Linguist Tools found. Translations will get compiled.") qt5_add_translation(APP_QM ${APP_TRANSLATIONS}) else(Qt5LinguistTools_FOUND) - message(STATUS "[${APP_LOW_NAME}] Qt Linguist Tools NOT found. No refreshing for translations.") + message(STATUS "[${APP_LOW_NAME}] Qt Linguist Tools NOT found. No compilation for translations.") endif(Qt5LinguistTools_FOUND) else(${USE_QT_5}) qt4_wrap_cpp(APP_MOC ${APP_HEADERS}) diff --git a/src/core/feedsmodelrootitem.h b/src/core/feedsmodelrootitem.h index 0f29b0b97..a71b68b72 100755 --- a/src/core/feedsmodelrootitem.h +++ b/src/core/feedsmodelrootitem.h @@ -69,11 +69,12 @@ class FeedsModelRootItem { protected: Kind m_kind; - QString m_title; int m_id; + QString m_title; + QString m_description; QIcon m_icon; QDateTime m_creationDate; - QString m_description; + QList m_childItems; FeedsModelRootItem *m_parentItem; }; diff --git a/src/core/messagesproxymodel.cpp b/src/core/messagesproxymodel.cpp index 51936c8c9..46be6e5ed 100644 --- a/src/core/messagesproxymodel.cpp +++ b/src/core/messagesproxymodel.cpp @@ -26,8 +26,8 @@ MessagesModel *MessagesProxyModel::sourceModel() { } bool MessagesProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { - // TODO: mozna pouzit QString::localeAwareCompare tady - // pro title a author. + // TODO: Maybe use QString::localeAwareCompare() here for + // title at least, but this will be probably little slower. return QSortFilterProxyModel::lessThan(left, right); } @@ -36,6 +36,7 @@ QModelIndexList MessagesProxyModel::mapListFromSource(const QModelIndexList &ind foreach (const QModelIndex &index, indexes) { if (deep) { + // Construct new source index. mapped_indexes << mapFromSource(m_sourceModel->index(index.row(), index.column())); } else { diff --git a/src/core/textfactory.cpp b/src/core/textfactory.cpp index b7a748a2e..e5288fb5a 100644 --- a/src/core/textfactory.cpp +++ b/src/core/textfactory.cpp @@ -103,6 +103,32 @@ QString TextFactory::stripTags(QString text) { } QString TextFactory::escapeHtml(const QString &html) { + static QMap escape_sequences = generetaEscapes(); + + QList keys = escape_sequences.uniqueKeys(); + QString output = html; + + foreach (const QString &key, keys) { + output.replace(key, escape_sequences.value(key)); + } + + return output; +} + +QString TextFactory::deEscapeHtrml(const QString &text) { + static QMap deescape_sequences = generateDeescapes(); + + QList keys = deescape_sequences.uniqueKeys(); + QString output = text; + + foreach (const QString &key, keys) { + output.replace(key, deescape_sequences.value(key)); + } + + return output; +} + +QMap TextFactory::generetaEscapes() { QMap sequences; sequences["<"] = '<'; @@ -114,17 +140,10 @@ QString TextFactory::escapeHtml(const QString &html) { sequences["×"] = "×"; sequences["'"] = '\''; - QList keys = sequences.uniqueKeys(); - QString output = html; - - foreach (const QString &key, keys) { - output.replace(key, sequences.value(key)); - } - - return output; + return sequences; } -QString TextFactory::deEscapeHtrml(const QString &text) { +QMap TextFactory::generateDeescapes() { QMap sequences; sequences["<"] = "<"; @@ -135,12 +154,5 @@ QString TextFactory::deEscapeHtrml(const QString &text) { sequences["×"] = "×"; sequences["\'"] = "'"; - QList keys = sequences.uniqueKeys(); - QString output = text; - - foreach (const QString &key, keys) { - output.replace(key, sequences.value(key)); - } - - return output; + return sequences; } diff --git a/src/core/textfactory.h b/src/core/textfactory.h index f79b4961c..9c5d2929b 100644 --- a/src/core/textfactory.h +++ b/src/core/textfactory.h @@ -31,6 +31,9 @@ class TextFactory { static QString escapeHtml(const QString &html); static QString deEscapeHtrml(const QString &text); + static QMap generetaEscapes(); + static QMap generateDeescapes(); + // Shortens input string according to given length limit. static QString shorten(const QString &input, int text_length_limit = TEXT_TITLE_LIMIT); }; diff --git a/src/core/webbrowsernetworkaccessmanager.cpp b/src/core/webbrowsernetworkaccessmanager.cpp index 7305dccf4..b340111d6 100644 --- a/src/core/webbrowsernetworkaccessmanager.cpp +++ b/src/core/webbrowsernetworkaccessmanager.cpp @@ -1,10 +1,24 @@ #include "core/webbrowsernetworkaccessmanager.h" +#include + WebBrowserNetworkAccessManager::WebBrowserNetworkAccessManager(QObject *parent) : BaseNetworkAccessManager(parent) { + connect(this, SIGNAL(sslErrors(QNetworkReply*,QList)), + this, SLOT(onSslErrors(QNetworkReply*,QList))); } WebBrowserNetworkAccessManager::~WebBrowserNetworkAccessManager() { qDebug("Destroying WebBrowserNetworkAccessManager instance."); } + +void WebBrowserNetworkAccessManager::onSslErrors(QNetworkReply *reply, + const QList &error) { + qDebug("SSL errors for '%s': '%s' (code %d).", + qPrintable(reply->url().toString()), + qPrintable(reply->errorString()), + (int) reply->error()); + + reply->ignoreSslErrors(error); +} diff --git a/src/core/webbrowsernetworkaccessmanager.h b/src/core/webbrowsernetworkaccessmanager.h index 9c8a9465f..7e2df08bc 100644 --- a/src/core/webbrowsernetworkaccessmanager.h +++ b/src/core/webbrowsernetworkaccessmanager.h @@ -12,6 +12,9 @@ class WebBrowserNetworkAccessManager : public BaseNetworkAccessManager { // Constructors and destructors. explicit WebBrowserNetworkAccessManager(QObject *parent = 0); virtual ~WebBrowserNetworkAccessManager(); + + protected slots: + void onSslErrors(QNetworkReply *reply, const QList &error); }; #endif // WEBBROWSERNETWORKACCESSMANAGER_H diff --git a/src/core/webpage.cpp b/src/core/webpage.cpp index 904b24bb2..c3c6fe158 100644 --- a/src/core/webpage.cpp +++ b/src/core/webpage.cpp @@ -29,7 +29,3 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, return QWebPage::acceptNavigationRequest(frame, request, type); } - -QWebPage *WebPage::createWindow(WebWindowType type) { - return QWebPage::createWindow(type); -} diff --git a/src/core/webpage.h b/src/core/webpage.h index 91bf9c51c..827ffb907 100644 --- a/src/core/webpage.h +++ b/src/core/webpage.h @@ -13,7 +13,6 @@ class WebPage : public QWebPage { virtual ~WebPage(); protected: - QWebPage *createWindow(WebWindowType type); bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type);