diff --git a/src/plugins/TabManager/tabmanagerdelegate.cpp b/src/plugins/TabManager/tabmanagerdelegate.cpp index 4b8c61333..0bca7cd39 100644 --- a/src/plugins/TabManager/tabmanagerdelegate.cpp +++ b/src/plugins/TabManager/tabmanagerdelegate.cpp @@ -38,10 +38,11 @@ void TabManagerDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op const QStyle* style = w ? w->style() : QApplication::style(); const Qt::LayoutDirection direction = w ? w->layoutDirection() : QApplication::layoutDirection(); const bool isActiveOrCaption = index.data(TabItem::ActiveOrCaptionRole).toBool(); + const bool isSavedTab = index.data(TabItem::SavedRole).toBool(); const QPalette::ColorRole colorRole = opt.state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text; - QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; + QPalette::ColorGroup cg = (opt.state & QStyle::State_Enabled) && !isSavedTab ? QPalette::Normal : QPalette::Disabled; if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) { cg = QPalette::Inactive; } @@ -122,7 +123,9 @@ void TabManagerDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op painter->drawRect(textRect.adjusted(0, 0, -1, -1)); } - if (isActiveOrCaption) + if (isSavedTab) + opt.font.setItalic(true); + else if (isActiveOrCaption) opt.font.setBold(true); painter->setFont(opt.font); diff --git a/src/plugins/TabManager/tabmanagerwidget.cpp b/src/plugins/TabManager/tabmanagerwidget.cpp index 90ac0387c..61f51beaf 100644 --- a/src/plugins/TabManager/tabmanagerwidget.cpp +++ b/src/plugins/TabManager/tabmanagerwidget.cpp @@ -751,6 +751,11 @@ void TabItem::setWebTab(WebTab* webTab) { m_webTab = webTab; + if (m_webTab->isRestored()) + setIsActiveOrCaption(m_webTab->isCurrentTab()); + else + setIsSavedTab(true); + connect(m_webTab->webView()->page(), SIGNAL(audioMutedChanged(bool)), this, SLOT(updateIcon())); connect(m_webTab->webView()->page(), SIGNAL(loadFinished(bool)), this, SLOT(updateIcon())); connect(m_webTab->webView()->page(), SIGNAL(loadStarted()), this, SLOT(updateIcon())); @@ -778,9 +783,15 @@ void TabItem::updateIcon() else { setIcon(0, QIcon(":tabmanager/data/tab-pinned.png")); } + + if (m_webTab->isRestored()) + setIsActiveOrCaption(m_webTab->isCurrentTab()); + else + setIsSavedTab(true); } else { setIcon(0, QIcon(":tabmanager/data/tab-loading.png")); + setIsActiveOrCaption(m_webTab->isCurrentTab()); } } @@ -793,4 +804,11 @@ void TabItem::setTitle(const QString &title) void TabItem::setIsActiveOrCaption(bool yes) { setData(0, ActiveOrCaptionRole, yes ? QVariant(true) : QVariant()); + + setIsSavedTab(false); +} + +void TabItem::setIsSavedTab(bool yes) +{ + setData(0, SavedRole, yes ? QVariant(true) : QVariant()); } diff --git a/src/plugins/TabManager/tabmanagerwidget.h b/src/plugins/TabManager/tabmanagerwidget.h index 47c95c8f3..fba2a96e9 100644 --- a/src/plugins/TabManager/tabmanagerwidget.h +++ b/src/plugins/TabManager/tabmanagerwidget.h @@ -103,7 +103,8 @@ class TabItem : public QObject, public QTreeWidgetItem public: enum StateRole { - ActiveOrCaptionRole = Qt::UserRole + 1 + ActiveOrCaptionRole = Qt::UserRole + 1, + SavedRole = Qt::UserRole + 2 }; TabItem(QTreeWidget* treeWidget, QTreeWidgetItem* parent = 0, bool addToTree = true); @@ -118,6 +119,7 @@ public slots: void updateIcon(); void setTitle(const QString& title); void setIsActiveOrCaption(bool yes); + void setIsSavedTab(bool yes); private: QTreeWidget* m_treeWidget;