diff --git a/resources/binaries b/resources/binaries index 572da127b..2392b936c 160000 --- a/resources/binaries +++ b/resources/binaries @@ -1 +1 @@ -Subproject commit 572da127bb14842bba6f84e6315a5ecefb44ed07 +Subproject commit 2392b936c08eac92a6a34361a916a739f53836d0 diff --git a/src/gui/messagepreviewer.cpp b/src/gui/messagepreviewer.cpp index 4bb10399d..040af2ed0 100644 --- a/src/gui/messagepreviewer.cpp +++ b/src/gui/messagepreviewer.cpp @@ -26,6 +26,7 @@ #include #include #include +#include MessagePreviewer::MessagePreviewer(QWidget *parent) : QWidget(parent), @@ -74,6 +75,13 @@ MessagePreviewer::MessagePreviewer(QWidget *parent) : QWidget(parent), &QAction::triggered, this, &MessagePreviewer::switchMessageImportance); + connect(m_ui->m_txtMessage, + static_cast(&QTextBrowser::highlighted), + [=](const QString &text) { + Q_UNUSED(text) + + QToolTip::showText(QCursor::pos(), tr("Click this link to download it or open it with external browser."), this); + }); m_actionSwitchImportance->setCheckable(true); @@ -92,6 +100,10 @@ void MessagePreviewer::reloadFontSettings() { SETTING(Messages::PreviewerFontStandard)).toString()); m_ui->m_txtMessage->setFont(fon); + + fon.setPointSize(fon.pointSize() + 5); + + m_ui->m_lblTitle->setFont(fon); } void MessagePreviewer::clear() { diff --git a/src/services/abstract/serviceroot.cpp b/src/services/abstract/serviceroot.cpp index 887bea27d..2d6109328 100755 --- a/src/services/abstract/serviceroot.cpp +++ b/src/services/abstract/serviceroot.cpp @@ -297,6 +297,65 @@ void ServiceRoot::requestItemRemoval(RootItem *item) { emit itemRemovalRequested(item); } +void ServiceRoot::syncIn() { + QIcon original_icon = icon(); + + setIcon(qApp->icons()->fromTheme(QSL("item-sync"))); + itemChanged(QList() << this); + + RootItem *new_tree = obtainNewTreeForSyncIn(); + + if (new_tree != NULL) { + // Purge old data from SQL and clean all model items. + requestItemExpandStateSave(this); + removeOldFeedTree(false); + cleanAllItems(); + + // Model is clean, now store new tree into DB and + // set primary IDs of the items. + storeNewFeedTree(new_tree); + + // We have new feed, some feeds were maybe removed, + // so remove left over messages. + removeLeftOverMessages(); + + foreach (RootItem *top_level_item, new_tree->childItems()) { + top_level_item->setParent(NULL); + requestItemReassignment(top_level_item, this); + } + + updateCounts(true); + + new_tree->clearChildren(); + new_tree->deleteLater(); + + QList all_items = getSubTree(); + + itemChanged(all_items); + requestReloadMessageList(true); + + // Now we must refresh expand states. + QList items_to_expand; + + foreach (RootItem *item, all_items) { + if (qApp->settings()->value(GROUP(CategoriesExpandStates), item->hashCode(), item->childCount() > 0).toBool()) { + items_to_expand.append(item); + } + } + + items_to_expand.append(this); + + requestItemExpand(items_to_expand, true); + } + + setIcon(original_icon); + itemChanged(QList() << this); +} + +RootItem *ServiceRoot::obtainNewTreeForSyncIn() const { + return NULL; +} + QStringList ServiceRoot::customIDSOfMessagesForItem(RootItem *item) { if (item->getParentServiceRoot() != this) { // Not item from this account. diff --git a/src/services/abstract/serviceroot.h b/src/services/abstract/serviceroot.h index 145b2a870..8eb7604b6 100755 --- a/src/services/abstract/serviceroot.h +++ b/src/services/abstract/serviceroot.h @@ -164,8 +164,13 @@ class ServiceRoot : public RootItem { public slots: virtual void addNewFeed(const QString &url = QString()) = 0; virtual void addNewCategory() = 0; + virtual void syncIn(); protected: + // This method should obtain new tree of feed/messages/etc to perform + // sync in. + virtual RootItem *obtainNewTreeForSyncIn() const; + // Removes all messages/categories/feeds which are // associated with this account. void removeOldFeedTree(bool including_messages); diff --git a/src/services/owncloud/owncloudserviceroot.cpp b/src/services/owncloud/owncloudserviceroot.cpp index dcff7749b..ed6b790c6 100755 --- a/src/services/owncloud/owncloudserviceroot.cpp +++ b/src/services/owncloud/owncloudserviceroot.cpp @@ -245,59 +245,15 @@ void OwnCloudServiceRoot::addNewFeed(const QString &url) { void OwnCloudServiceRoot::addNewCategory() { } -void OwnCloudServiceRoot::syncIn() { - QIcon original_icon = icon(); - - setIcon(qApp->icons()->fromTheme(QSL("item-sync"))); - itemChanged(QList() << this); - +RootItem *OwnCloudServiceRoot::obtainNewTreeForSyncIn() const { OwnCloudGetFeedsCategoriesResponse feed_cats_response = m_network->feedsCategories(); if (m_network->lastError() == QNetworkReply::NoError) { - RootItem *new_tree = feed_cats_response.feedsCategories(true); - - // Purge old data from SQL and clean all model items. - requestItemExpandStateSave(this); - removeOldFeedTree(false); - cleanAllItems(); - - // Model is clean, now store new tree into DB and - // set primary IDs of the items. - storeNewFeedTree(new_tree); - - // We have new feed, some feeds were maybe removed, - // so remove left over messages. - removeLeftOverMessages(); - - foreach (RootItem *top_level_item, new_tree->childItems()) { - top_level_item->setParent(NULL); - requestItemReassignment(top_level_item, this); - } - - updateCounts(true); - - new_tree->clearChildren(); - new_tree->deleteLater(); - - QList all_items = getSubTree(); - - itemChanged(all_items); - requestReloadMessageList(true); - - // Now we must refresh expand states. - QList items_to_expand; - - foreach (RootItem *item, all_items) { - if (qApp->settings()->value(GROUP(CategoriesExpandStates), item->hashCode(), item->childCount() > 0).toBool()) { - items_to_expand.append(item); - } - } - - requestItemExpand(items_to_expand, true); + return feed_cats_response.feedsCategories(true); + } + else { + return NULL; } - - setIcon(original_icon); - itemChanged(QList() << this); } void OwnCloudServiceRoot::loadFromDatabase() { diff --git a/src/services/owncloud/owncloudserviceroot.h b/src/services/owncloud/owncloudserviceroot.h index 54d7634e0..d6b9efce8 100755 --- a/src/services/owncloud/owncloudserviceroot.h +++ b/src/services/owncloud/owncloudserviceroot.h @@ -55,9 +55,9 @@ class OwnCloudServiceRoot : public ServiceRoot { void addNewFeed(const QString &url); void addNewCategory(); - void syncIn(); - private: + RootItem *obtainNewTreeForSyncIn() const; + void loadFromDatabase(); OwnCloudRecycleBin *m_recycleBin; diff --git a/src/services/tt-rss/ttrssserviceroot.cpp b/src/services/tt-rss/ttrssserviceroot.cpp index 7aa1f88b5..da5476d65 100755 --- a/src/services/tt-rss/ttrssserviceroot.cpp +++ b/src/services/tt-rss/ttrssserviceroot.cpp @@ -353,57 +353,13 @@ void TtRssServiceRoot::updateTitle() { setTitle(m_network->username() + QL1S("@") + host); } -void TtRssServiceRoot::syncIn() { - QIcon original_icon = icon(); - - setIcon(qApp->icons()->fromTheme(QSL("item-sync"))); - itemChanged(QList() << this); - +RootItem *TtRssServiceRoot::obtainNewTreeForSyncIn() const { TtRssGetFeedsCategoriesResponse feed_cats_response = m_network->getFeedsCategories(); if (m_network->lastError() == QNetworkReply::NoError) { - RootItem *new_tree = feed_cats_response.feedsCategories(true, m_network->url()); - - // Purge old data from SQL and clean all model items. - requestItemExpandStateSave(this); - removeOldFeedTree(false); - cleanAllItems(); - - // Model is clean, now store new tree into DB and - // set primary IDs of the items. - storeNewFeedTree(new_tree); - - // We have new feed, some feeds were maybe removed, - // so remove left over messages. - removeLeftOverMessages(); - - foreach (RootItem *top_level_item, new_tree->childItems()) { - top_level_item->setParent(NULL); - requestItemReassignment(top_level_item, this); - } - - updateCounts(true); - - new_tree->clearChildren(); - new_tree->deleteLater(); - - QList all_items = getSubTree(); - - itemChanged(all_items); - requestReloadMessageList(true); - - // Now we must refresh expand states. - QList items_to_expand; - - foreach (RootItem *item, all_items) { - if (qApp->settings()->value(GROUP(CategoriesExpandStates), item->hashCode(), item->childCount() > 0).toBool()) { - items_to_expand.append(item); - } - } - - requestItemExpand(items_to_expand, true); + return feed_cats_response.feedsCategories(true, m_network->url()); + } + else { + return NULL; } - - setIcon(original_icon); - itemChanged(QList() << this); } diff --git a/src/services/tt-rss/ttrssserviceroot.h b/src/services/tt-rss/ttrssserviceroot.h index 9848225fa..e5d148648 100755 --- a/src/services/tt-rss/ttrssserviceroot.h +++ b/src/services/tt-rss/ttrssserviceroot.h @@ -61,9 +61,10 @@ class TtRssServiceRoot : public ServiceRoot { public slots: void addNewFeed(const QString &url = QString()); void addNewCategory(); - void syncIn(); private: + RootItem *obtainNewTreeForSyncIn() const; + void loadFromDatabase(); TtRssRecycleBin *m_recycleBin;