fix #810
This commit is contained in:
parent
1efefade23
commit
5d605f7365
3 changed files with 19 additions and 15 deletions
|
@ -81,8 +81,8 @@ void TabWidget::showDownloadManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::checkTabBarVisibility() {
|
void TabWidget::checkTabBarVisibility() {
|
||||||
const bool should_be_visible = count() > 1 ||
|
const bool should_be_visible =
|
||||||
!qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool();
|
count() > 1 || !qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool();
|
||||||
|
|
||||||
if (should_be_visible) {
|
if (should_be_visible) {
|
||||||
setCornerWidget(m_btnMainMenu, Qt::Corner::TopLeftCorner);
|
setCornerWidget(m_btnMainMenu, Qt::Corner::TopLeftCorner);
|
||||||
|
@ -123,8 +123,14 @@ void TabWidget::createConnections() {
|
||||||
connect(tabBar(), &TabBar::tabCloseRequested, this, &TabWidget::closeTab);
|
connect(tabBar(), &TabBar::tabCloseRequested, this, &TabWidget::closeTab);
|
||||||
connect(tabBar(), &TabBar::tabMoved, this, &TabWidget::fixContentsAfterMove);
|
connect(tabBar(), &TabBar::tabMoved, this, &TabWidget::fixContentsAfterMove);
|
||||||
|
|
||||||
connect(feedMessageViewer()->messagesView(), &MessagesView::openMessagesInNewspaperView, this, &TabWidget::addNewspaperView);
|
connect(feedMessageViewer()->messagesView(),
|
||||||
connect(feedMessageViewer()->feedsView(), &FeedsView::openMessagesInNewspaperView, this, &TabWidget::addNewspaperView);
|
&MessagesView::openMessagesInNewspaperView,
|
||||||
|
this,
|
||||||
|
&TabWidget::addNewspaperView);
|
||||||
|
connect(feedMessageViewer()->feedsView(),
|
||||||
|
&FeedsView::openMessagesInNewspaperView,
|
||||||
|
this,
|
||||||
|
&TabWidget::addNewspaperView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::initializeTabs() {
|
void TabWidget::initializeTabs() {
|
||||||
|
@ -195,14 +201,12 @@ void TabWidget::closeCurrentTab() {
|
||||||
|
|
||||||
int TabWidget::addNewspaperView(RootItem* root, const QList<Message>& messages) {
|
int TabWidget::addNewspaperView(RootItem* root, const QList<Message>& messages) {
|
||||||
WebBrowser* browser = new WebBrowser(nullptr, this);
|
WebBrowser* browser = new WebBrowser(nullptr, this);
|
||||||
|
|
||||||
int index = addTab(browser,
|
int index = addTab(browser,
|
||||||
qApp->icons()->fromTheme(QSL("format-justify-fill")),
|
qApp->icons()->fromTheme(QSL("format-justify-fill")),
|
||||||
tr("Newspaper view"),
|
tr("Newspaper view"),
|
||||||
TabBar::TabType::Closable);
|
TabBar::TabType::Closable);
|
||||||
|
|
||||||
// NOTE: Do not bring "newspaper" tabs to front anymore.
|
|
||||||
//setCurrentIndex(index);
|
|
||||||
|
|
||||||
QTimer::singleShot(300, browser, [browser, root, messages]() {
|
QTimer::singleShot(300, browser, [browser, root, messages]() {
|
||||||
browser->loadMessages(messages, root);
|
browser->loadMessages(messages, root);
|
||||||
});
|
});
|
||||||
|
@ -232,14 +236,16 @@ int TabWidget::addBrowser(bool move_after_current, bool make_active, WebBrowser*
|
||||||
|
|
||||||
if (move_after_current) {
|
if (move_after_current) {
|
||||||
// Insert web browser after current tab.
|
// Insert web browser after current tab.
|
||||||
final_index = insertTab(currentIndex() + 1, browser, qApp->icons()->fromTheme(QSL("text-html")),
|
final_index = insertTab(currentIndex() + 1,
|
||||||
browser_tab_name, TabBar::TabType::Closable);
|
browser,
|
||||||
|
qApp->icons()->fromTheme(QSL("text-html")),
|
||||||
|
browser_tab_name,
|
||||||
|
TabBar::TabType::Closable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Add new browser as the last tab.
|
// Add new browser as the last tab.
|
||||||
final_index = addTab(browser, qApp->icons()->fromTheme(QSL("text-html")),
|
final_index =
|
||||||
browser_tab_name,
|
addTab(browser, qApp->icons()->fromTheme(QSL("text-html")), browser_tab_name, TabBar::TabType::Closable);
|
||||||
TabBar::TabType::Closable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make connections.
|
// Make connections.
|
||||||
|
|
|
@ -152,8 +152,6 @@ void WebBrowser::loadMessages(const QList<Message>& messages, RootItem* root) {
|
||||||
if (!m_root.isNull()) {
|
if (!m_root.isNull()) {
|
||||||
m_searchWidget->hide();
|
m_searchWidget->hide();
|
||||||
m_webView->loadMessages(messages, root);
|
m_webView->loadMessages(messages, root);
|
||||||
|
|
||||||
show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ int TextFactory::stringWidth(const QString& string, const QFontMetrics& metrics)
|
||||||
bool TextFactory::couldBeHtml(const QString& string) {
|
bool TextFactory::couldBeHtml(const QString& string) {
|
||||||
const QString sstring = string.simplified();
|
const QString sstring = string.simplified();
|
||||||
|
|
||||||
return sstring.startsWith(QL1S("<!")) || Qt::mightBeRichText(sstring);
|
return sstring.startsWith(QL1S("<!")) || sstring.startsWith(QL1S("<figure")) || Qt::mightBeRichText(sstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime TextFactory::parseDateTime(const QString& date_time) {
|
QDateTime TextFactory::parseDateTime(const QString& date_time) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue