Added some logging stuff.
This commit is contained in:
parent
10da7c59f9
commit
9fee3af759
@ -73,6 +73,8 @@ QNetworkReply::NetworkError TtRssNetworkFactory::lastError() const {
|
||||
|
||||
TtRssLoginResponse TtRssNetworkFactory::login() {
|
||||
if (!m_sessionId.isEmpty()) {
|
||||
qDebug("TT-RSS: Session ID is not empty before login, logging out first.");
|
||||
|
||||
logout();
|
||||
}
|
||||
|
||||
@ -90,6 +92,9 @@ TtRssLoginResponse TtRssNetworkFactory::login() {
|
||||
m_sessionId = login_response.sessionId();
|
||||
m_lastLoginTime = QDateTime::currentDateTime();
|
||||
}
|
||||
else {
|
||||
qWarning("TT-RSS: Login failed with error %d.", network_reply.first);
|
||||
}
|
||||
|
||||
m_lastError = network_reply.first;
|
||||
return login_response;
|
||||
@ -111,10 +116,15 @@ TtRssResponse TtRssNetworkFactory::logout() {
|
||||
if (m_lastError == QNetworkReply::NoError) {
|
||||
m_sessionId.clear();
|
||||
}
|
||||
else {
|
||||
qWarning("TT-RSS: Logout failed with error %d.", network_reply.first);
|
||||
}
|
||||
|
||||
return TtRssResponse(QString::fromUtf8(result_raw));
|
||||
}
|
||||
else {
|
||||
qWarning("TT-RSS: Cannot logout because session ID is empty.");
|
||||
|
||||
m_lastError = QNetworkReply::NoError;
|
||||
return TtRssResponse();
|
||||
}
|
||||
@ -141,6 +151,10 @@ TtRssGetFeedsCategoriesResponse TtRssNetworkFactory::getFeedsCategories() {
|
||||
result = TtRssGetFeedsCategoriesResponse(QString::fromUtf8(result_raw));
|
||||
}
|
||||
|
||||
if (network_reply.first != QNetworkReply::NoError) {
|
||||
qWarning("TT-RSS: getFeedTree failed with error %d.", network_reply.first);
|
||||
}
|
||||
|
||||
m_lastError = network_reply.first;
|
||||
return result;
|
||||
}
|
||||
@ -174,6 +188,10 @@ TtRssGetHeadlinesResponse TtRssNetworkFactory::getHeadlines(int feed_id, int lim
|
||||
result = TtRssGetHeadlinesResponse(QString::fromUtf8(result_raw));
|
||||
}
|
||||
|
||||
if (network_reply.first != QNetworkReply::NoError) {
|
||||
qWarning("TT-RSS: getHeadlines failed with error %d.", network_reply.first);
|
||||
}
|
||||
|
||||
m_lastError = network_reply.first;
|
||||
return result;
|
||||
}
|
||||
@ -203,6 +221,10 @@ TtRssUpdateArticleResponse TtRssNetworkFactory::updateArticles(const QStringList
|
||||
result = TtRssUpdateArticleResponse(QString::fromUtf8(result_raw));
|
||||
}
|
||||
|
||||
if (network_reply.first != QNetworkReply::NoError) {
|
||||
qWarning("TT-RSS: updateArticle failed with error %d.", network_reply.first);
|
||||
}
|
||||
|
||||
m_lastError = network_reply.first;
|
||||
return result;
|
||||
}
|
||||
@ -272,7 +294,6 @@ bool TtRssResponse::isNotLoggedIn() const {
|
||||
return status() == API_STATUS_ERR && hasError() && error() == NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
|
||||
TtRssLoginResponse::TtRssLoginResponse(const QString &raw_content) : TtRssResponse(raw_content) {
|
||||
}
|
||||
|
||||
@ -329,6 +350,8 @@ RootItem *TtRssGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons, QS
|
||||
// Chop the "api/" from the end of the address.
|
||||
base_address.chop(4);
|
||||
|
||||
qDebug("TT-RSS: Chopped base address to '%s' to get feed icons.", qPrintable(base_address));
|
||||
|
||||
if (status() == API_STATUS_OK) {
|
||||
// We have data, construct object tree according to data.
|
||||
QList<QVariant> items_to_process = m_rawContent["content"].toMap()["categories"].toMap()["items"].toList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user