fix #881
This commit is contained in:
parent
c49f1fc1e6
commit
a3510afd4d
@ -290,6 +290,8 @@ void TextBrowserViewer::loadMessages(const QList<Message>& messages, RootItem* r
|
|||||||
|
|
||||||
auto html_messages = prepareHtmlForMessage(messages, root);
|
auto html_messages = prepareHtmlForMessage(messages, root);
|
||||||
|
|
||||||
|
html_messages.m_html = IOFactory::readFile("aa.html");
|
||||||
|
|
||||||
setHtml(html_messages.m_html, html_messages.m_baseUrl);
|
setHtml(html_messages.m_html, html_messages.m_baseUrl);
|
||||||
emit loadingFinished(true);
|
emit loadingFinished(true);
|
||||||
}
|
}
|
||||||
|
@ -294,6 +294,12 @@ ServiceRoot::LabelOperation ServiceRoot::supportedLabelOperations() const {
|
|||||||
return LabelOperation::Adding | LabelOperation::Editing | LabelOperation::Deleting;
|
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() {
|
void ServiceRoot::saveAccountDataToDatabase() {
|
||||||
QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className());
|
QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className());
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ class ServiceRoot : public RootItem {
|
|||||||
virtual bool supportsFeedAdding() const;
|
virtual bool supportsFeedAdding() const;
|
||||||
virtual bool supportsCategoryAdding() const;
|
virtual bool supportsCategoryAdding() const;
|
||||||
virtual LabelOperation supportedLabelOperations() const;
|
virtual LabelOperation supportedLabelOperations() const;
|
||||||
|
virtual QString additionalTooltip() const;
|
||||||
virtual void saveAccountDataToDatabase();
|
virtual void saveAccountDataToDatabase();
|
||||||
virtual QVariantHash customDatabaseData() const;
|
virtual QVariantHash customDatabaseData() const;
|
||||||
virtual void setCustomDatabaseData(const QVariantHash& data);
|
virtual void setCustomDatabaseData(const QVariantHash& data);
|
||||||
|
@ -48,9 +48,16 @@ RootItem* GmailServiceRoot::obtainNewTreeForSyncIn() const {
|
|||||||
inbox->setKeepOnTop(true);
|
inbox->setKeepOnTop(true);
|
||||||
|
|
||||||
root->appendChild(inbox);
|
root->appendChild(inbox);
|
||||||
root->appendChild(new Feed(tr("Sent"), QSL(GMAIL_SYSTEM_LABEL_SENT), qApp->icons()->fromTheme(QSL("mail-sent")), root));
|
root
|
||||||
root->appendChild(new Feed(tr("Drafts"), QSL(GMAIL_SYSTEM_LABEL_DRAFT), qApp->icons()->fromTheme(QSL("gtk-edit")), root));
|
->appendChild(new Feed(tr("Sent"), QSL(GMAIL_SYSTEM_LABEL_SENT), qApp->icons()->fromTheme(QSL("mail-sent")), 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("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;
|
return root;
|
||||||
}
|
}
|
||||||
@ -84,7 +91,8 @@ void GmailServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> GmailServiceRoot::obtainNewMessages(Feed* feed,
|
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) {
|
const QHash<QString, QStringList>& tagged_messages) {
|
||||||
Q_UNUSED(stated_messages)
|
Q_UNUSED(stated_messages)
|
||||||
Q_UNUSED(tagged_messages)
|
Q_UNUSED(tagged_messages)
|
||||||
@ -116,11 +124,12 @@ QList<QAction*> GmailServiceRoot::contextMenuMessagesList(const QList<Message>&
|
|||||||
m_replyToMessage = messages.at(0);
|
m_replyToMessage = messages.at(0);
|
||||||
|
|
||||||
if (m_actionReply == nullptr) {
|
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);
|
connect(m_actionReply, &QAction::triggered, this, &GmailServiceRoot::replyToEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { m_actionReply };
|
return {m_actionReply};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return {};
|
return {};
|
||||||
@ -131,7 +140,8 @@ QList<QAction*> GmailServiceRoot::serviceMenu() {
|
|||||||
if (m_serviceMenu.isEmpty()) {
|
if (m_serviceMenu.isEmpty()) {
|
||||||
ServiceRoot::serviceMenu();
|
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);
|
connect(act_new_email, &QAction::triggered, this, &GmailServiceRoot::writeNewEmail);
|
||||||
m_serviceMenu.append(act_new_email);
|
m_serviceMenu.append(act_new_email);
|
||||||
@ -191,12 +201,12 @@ QString GmailServiceRoot::code() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString GmailServiceRoot::additionalTooltip() const {
|
QString GmailServiceRoot::additionalTooltip() const {
|
||||||
return tr("Authentication status: %1\n"
|
return ServiceRoot::additionalTooltip() + QSL("\n") +
|
||||||
"Login tokens expiration: %2").arg(network()->oauth()->isFullyLoggedIn()
|
tr("Authentication status: %1\n"
|
||||||
? tr("logged-in")
|
"Login tokens expiration: %2")
|
||||||
: tr("NOT logged-in"),
|
.arg(network()->oauth()->isFullyLoggedIn() ? tr("logged-in") : tr("NOT logged-in"),
|
||||||
network()->oauth()->tokensExpireIn().isValid() ?
|
network()->oauth()->tokensExpireIn().isValid() ? network()->oauth()->tokensExpireIn().toString()
|
||||||
network()->oauth()->tokensExpireIn().toString() : QSL("-"));
|
: QSL("-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GmailServiceRoot::saveAllCachedData(bool ignore_errors) {
|
void GmailServiceRoot::saveAllCachedData(bool ignore_errors) {
|
||||||
@ -210,8 +220,7 @@ void GmailServiceRoot::saveAllCachedData(bool ignore_errors) {
|
|||||||
QStringList ids = i.value();
|
QStringList ids = i.value();
|
||||||
|
|
||||||
if (!ids.isEmpty()) {
|
if (!ids.isEmpty()) {
|
||||||
if (network()->markMessagesRead(key, ids, networkProxy()) !=
|
if (network()->markMessagesRead(key, ids, networkProxy()) != QNetworkReply::NetworkError::NoError &&
|
||||||
QNetworkReply::NetworkError::NoError &&
|
|
||||||
!ignore_errors) {
|
!ignore_errors) {
|
||||||
addMessageStatesToCache(ids, key);
|
addMessageStatesToCache(ids, key);
|
||||||
}
|
}
|
||||||
@ -227,14 +236,14 @@ void GmailServiceRoot::saveAllCachedData(bool ignore_errors) {
|
|||||||
QList<Message> messages = j.value();
|
QList<Message> messages = j.value();
|
||||||
|
|
||||||
if (!messages.isEmpty()) {
|
if (!messages.isEmpty()) {
|
||||||
QStringList custom_ids; custom_ids.reserve(messages.size());
|
QStringList custom_ids;
|
||||||
|
custom_ids.reserve(messages.size());
|
||||||
|
|
||||||
for (const Message& msg : messages) {
|
for (const Message& msg : messages) {
|
||||||
custom_ids.append(msg.m_customId);
|
custom_ids.append(msg.m_customId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network()->markMessagesStarred(key, custom_ids, networkProxy()) !=
|
if (network()->markMessagesStarred(key, custom_ids, networkProxy()) != QNetworkReply::NetworkError::NoError &&
|
||||||
QNetworkReply::NetworkError::NoError &&
|
|
||||||
!ignore_errors) {
|
!ignore_errors) {
|
||||||
addMessageStatesToCache(messages, key);
|
addMessageStatesToCache(messages, key);
|
||||||
}
|
}
|
||||||
|
@ -123,10 +123,12 @@ QString RedditServiceRoot::code() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString RedditServiceRoot::additionalTooltip() 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")
|
"Login tokens expiration: %2")
|
||||||
.arg(network()->oauth()->isFullyLoggedIn() ? tr("logged-in") : tr("NOT logged-in"),
|
.arg(network()->oauth()->isFullyLoggedIn() ? tr("logged-in") : tr("NOT logged-in"),
|
||||||
network()->oauth()->tokensExpireIn().isValid() ? network()->oauth()->tokensExpireIn().toString() : QSL("-"));
|
network()->oauth()->tokensExpireIn().isValid() ? network()->oauth()->tokensExpireIn().toString()
|
||||||
|
: QSL("-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RedditServiceRoot::saveAllCachedData(bool ignore_errors) {
|
void RedditServiceRoot::saveAllCachedData(bool ignore_errors) {
|
||||||
|
@ -363,14 +363,15 @@ QList<Message> TtRssServiceRoot::obtainMessagesViaHeadlines(Feed* feed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString TtRssServiceRoot::additionalTooltip() const {
|
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")
|
"Last error: %3\nLast login on: %4")
|
||||||
.arg(m_network->username(),
|
.arg(m_network->username(),
|
||||||
m_network->url(),
|
m_network->url(),
|
||||||
NetworkFactory::networkErrorText(m_network->lastError()),
|
NetworkFactory::networkErrorText(m_network->lastError()),
|
||||||
m_network->lastLoginTime().isValid()
|
m_network->lastLoginTime().isValid()
|
||||||
? QLocale().toString(m_network->lastLoginTime(), QLocale::FormatType::ShortFormat)
|
? QLocale().toString(m_network->lastLoginTime(), QLocale::FormatType::ShortFormat)
|
||||||
: QSL("-"));
|
: QSL("-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TtRssNetworkFactory* TtRssServiceRoot::network() const {
|
TtRssNetworkFactory* TtRssServiceRoot::network() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user