Skip to content

Commit

Permalink
fix #881
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Jan 27, 2023
1 parent c49f1fc commit a3510af
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ void TextBrowserViewer::loadMessages(const QList<Message>& messages, RootItem* r

auto html_messages = prepareHtmlForMessage(messages, root);

html_messages.m_html = IOFactory::readFile("aa.html");

setHtml(html_messages.m_html, html_messages.m_baseUrl);
emit loadingFinished(true);
}
Expand Down
6 changes: 6 additions & 0 deletions src/librssguard/services/abstract/serviceroot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ ServiceRoot::LabelOperation ServiceRoot::supportedLabelOperations() const {
return LabelOperation::Adding | LabelOperation::Editing | LabelOperation::Deleting;
}

QString ServiceRoot::additionalTooltip() const {
return tr("Number of feeds: %1\n"
"Number of categories: %2")
.arg(QString::number(getSubTreeFeeds().size()), QString::number(getSubTreeCategories().size()));
}

void ServiceRoot::saveAccountDataToDatabase() {
QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className());

Expand Down
1 change: 1 addition & 0 deletions src/librssguard/services/abstract/serviceroot.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ServiceRoot : public RootItem {
virtual bool supportsFeedAdding() const;
virtual bool supportsCategoryAdding() const;
virtual LabelOperation supportedLabelOperations() const;
virtual QString additionalTooltip() const;
virtual void saveAccountDataToDatabase();
virtual QVariantHash customDatabaseData() const;
virtual void setCustomDatabaseData(const QVariantHash& data);
Expand Down
45 changes: 27 additions & 18 deletions src/librssguard/services/gmail/gmailserviceroot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ RootItem* GmailServiceRoot::obtainNewTreeForSyncIn() const {
inbox->setKeepOnTop(true);

root->appendChild(inbox);
root->appendChild(new Feed(tr("Sent"), QSL(GMAIL_SYSTEM_LABEL_SENT), qApp->icons()->fromTheme(QSL("mail-sent")), root));
root->appendChild(new Feed(tr("Drafts"), QSL(GMAIL_SYSTEM_LABEL_DRAFT), qApp->icons()->fromTheme(QSL("gtk-edit")), root));
root->appendChild(new Feed(tr("Spam"), QSL(GMAIL_SYSTEM_LABEL_SPAM), qApp->icons()->fromTheme(QSL("mail-mark-junk")), root));
root
->appendChild(new Feed(tr("Sent"), QSL(GMAIL_SYSTEM_LABEL_SENT), qApp->icons()->fromTheme(QSL("mail-sent")), root));
root->appendChild(new Feed(tr("Drafts"),
QSL(GMAIL_SYSTEM_LABEL_DRAFT),
qApp->icons()->fromTheme(QSL("gtk-edit")),
root));
root->appendChild(new Feed(tr("Spam"),
QSL(GMAIL_SYSTEM_LABEL_SPAM),
qApp->icons()->fromTheme(QSL("mail-mark-junk")),
root));

return root;
}
Expand Down Expand Up @@ -84,7 +91,8 @@ void GmailServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
}

QList<Message> GmailServiceRoot::obtainNewMessages(Feed* feed,
const QHash<ServiceRoot::BagOfMessages, QStringList>& stated_messages,
const QHash<ServiceRoot::BagOfMessages, QStringList>&
stated_messages,
const QHash<QString, QStringList>& tagged_messages) {
Q_UNUSED(stated_messages)
Q_UNUSED(tagged_messages)
Expand Down Expand Up @@ -116,11 +124,12 @@ QList<QAction*> GmailServiceRoot::contextMenuMessagesList(const QList<Message>&
m_replyToMessage = messages.at(0);

if (m_actionReply == nullptr) {
m_actionReply = new QAction(qApp->icons()->fromTheme(QSL("mail-reply-sender")), tr("Reply to this e-mail message"), this);
m_actionReply =
new QAction(qApp->icons()->fromTheme(QSL("mail-reply-sender")), tr("Reply to this e-mail message"), this);
connect(m_actionReply, &QAction::triggered, this, &GmailServiceRoot::replyToEmail);
}

return { m_actionReply };
return {m_actionReply};
}
else {
return {};
Expand All @@ -131,7 +140,8 @@ QList<QAction*> GmailServiceRoot::serviceMenu() {
if (m_serviceMenu.isEmpty()) {
ServiceRoot::serviceMenu();

QAction* act_new_email = new QAction(qApp->icons()->fromTheme(QSL("mail-message-new")), tr("Write new e-mail message"), this);
QAction* act_new_email =
new QAction(qApp->icons()->fromTheme(QSL("mail-message-new")), tr("Write new e-mail message"), this);

connect(act_new_email, &QAction::triggered, this, &GmailServiceRoot::writeNewEmail);
m_serviceMenu.append(act_new_email);
Expand Down Expand Up @@ -191,12 +201,12 @@ QString GmailServiceRoot::code() const {
}

QString GmailServiceRoot::additionalTooltip() const {
return tr("Authentication status: %1\n"
"Login tokens expiration: %2").arg(network()->oauth()->isFullyLoggedIn()
? tr("logged-in")
: tr("NOT logged-in"),
network()->oauth()->tokensExpireIn().isValid() ?
network()->oauth()->tokensExpireIn().toString() : QSL("-"));
return ServiceRoot::additionalTooltip() + QSL("\n") +
tr("Authentication status: %1\n"
"Login tokens expiration: %2")
.arg(network()->oauth()->isFullyLoggedIn() ? tr("logged-in") : tr("NOT logged-in"),
network()->oauth()->tokensExpireIn().isValid() ? network()->oauth()->tokensExpireIn().toString()
: QSL("-"));
}

void GmailServiceRoot::saveAllCachedData(bool ignore_errors) {
Expand All @@ -210,8 +220,7 @@ void GmailServiceRoot::saveAllCachedData(bool ignore_errors) {
QStringList ids = i.value();

if (!ids.isEmpty()) {
if (network()->markMessagesRead(key, ids, networkProxy()) !=
QNetworkReply::NetworkError::NoError &&
if (network()->markMessagesRead(key, ids, networkProxy()) != QNetworkReply::NetworkError::NoError &&
!ignore_errors) {
addMessageStatesToCache(ids, key);
}
Expand All @@ -227,14 +236,14 @@ void GmailServiceRoot::saveAllCachedData(bool ignore_errors) {
QList<Message> messages = j.value();

if (!messages.isEmpty()) {
QStringList custom_ids; custom_ids.reserve(messages.size());
QStringList custom_ids;
custom_ids.reserve(messages.size());

for (const Message& msg : messages) {
custom_ids.append(msg.m_customId);
}

if (network()->markMessagesStarred(key, custom_ids, networkProxy()) !=
QNetworkReply::NetworkError::NoError &&
if (network()->markMessagesStarred(key, custom_ids, networkProxy()) != QNetworkReply::NetworkError::NoError &&
!ignore_errors) {
addMessageStatesToCache(messages, key);
}
Expand Down
8 changes: 5 additions & 3 deletions src/librssguard/services/reddit/redditserviceroot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ QString RedditServiceRoot::code() const {
}

QString RedditServiceRoot::additionalTooltip() const {
return tr("Authentication status: %1\n"
return ServiceRoot::additionalTooltip() + QSL("\n") +
tr("Authentication status: %1\n"
"Login tokens expiration: %2")
.arg(network()->oauth()->isFullyLoggedIn() ? tr("logged-in") : tr("NOT logged-in"),
network()->oauth()->tokensExpireIn().isValid() ? network()->oauth()->tokensExpireIn().toString() : QSL("-"));
.arg(network()->oauth()->isFullyLoggedIn() ? tr("logged-in") : tr("NOT logged-in"),
network()->oauth()->tokensExpireIn().isValid() ? network()->oauth()->tokensExpireIn().toString()
: QSL("-"));
}

void RedditServiceRoot::saveAllCachedData(bool ignore_errors) {
Expand Down
15 changes: 8 additions & 7 deletions src/librssguard/services/tt-rss/ttrssserviceroot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,15 @@ QList<Message> TtRssServiceRoot::obtainMessagesViaHeadlines(Feed* feed) {
}

QString TtRssServiceRoot::additionalTooltip() const {
return tr("Username: %1\nServer: %2\n"
return ServiceRoot::additionalTooltip() + QSL("\n") +
tr("Username: %1\nServer: %2\n"
"Last error: %3\nLast login on: %4")
.arg(m_network->username(),
m_network->url(),
NetworkFactory::networkErrorText(m_network->lastError()),
m_network->lastLoginTime().isValid()
? QLocale().toString(m_network->lastLoginTime(), QLocale::FormatType::ShortFormat)
: QSL("-"));
.arg(m_network->username(),
m_network->url(),
NetworkFactory::networkErrorText(m_network->lastError()),
m_network->lastLoginTime().isValid()
? QLocale().toString(m_network->lastLoginTime(), QLocale::FormatType::ShortFormat)
: QSL("-"));
}

TtRssNetworkFactory* TtRssServiceRoot::network() const {
Expand Down

0 comments on commit a3510af

Please sign in to comment.