diff --git a/krusader/GUI/krstyleproxy.cpp b/krusader/GUI/krstyleproxy.cpp --- a/krusader/GUI/krstyleproxy.cpp +++ b/krusader/GUI/krstyleproxy.cpp @@ -29,27 +29,27 @@ #include #include "../krglobal.h" +#include "../Panel/krcolorcache.h" void KrStyleProxy::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { if (element == QStyle::PE_FrameFocusRect) { if (const auto *fropt = qstyleoption_cast(option)) { - QColor bg = fropt->backgroundColor; - QPen oldPen = painter->pen(); + + //get focus color from configuration options, fallback to foreground color + KrColorItemType colorItemType; + KrColorGroup cols; + KrColorCache::getColorCache().getColors(cols, colorItemType); + const QColor & focusColor = cols.focusColor(); + QPen newPen; - if (bg.isValid()) { - int h, s, v; - bg.getHsv(&h, &s, &v); - if (v >= 128) - newPen.setColor(Qt::black); - else - newPen.setColor(Qt::white); - } else { - newPen.setColor(option->palette.foreground().color()); - } + //newPen.setColor(focusColor.isValid() ? focusColor : option->palette.foreground().color()); + newPen.setColor(focusColor); newPen.setWidth(0); newPen.setStyle(Qt::DotLine); + + QPen oldPen = painter->pen(); painter->setPen(newPen); QRect focusRect = option->rect /*.adjusted(1, 1, -1, -1) */; painter->drawRect(focusRect.adjusted(0, 0, -1, -1)); //draw pen inclusive diff --git a/krusader/Konfigurator/kgcolors.cpp b/krusader/Konfigurator/kgcolors.cpp --- a/krusader/Konfigurator/kgcolors.cpp +++ b/krusader/Konfigurator/kgcolors.cpp @@ -63,7 +63,8 @@ KONFIGURATOR_CHECKBOX_PARAM generalSettings[] = // cfg_class cfg_name default text restart tooltip - {{"Colors", "KDE Default", _KDEDefaultColors, i18n("Use the default KDE colors"), false, "

" + i18n("

Use KDE's global color configuration.

KDE System Settings -> Application Appearance -> Colors

") }, + { + {"Colors", "KDE Default", _KDEDefaultColors, i18n("Use the default KDE colors"), false, "

" + i18n("

Use KDE's global color configuration.

KDE System Settings -> Application Appearance -> Colors

") }, {"Colors", "Enable Alternate Background", _AlternateBackground, i18n("Use alternate background color"), false, i18n("

The background color and the alternate background color alternates line by line.

When you don't use the KDE default colors, you can configure the alternate colors in the colors box.

") }, {"Colors", "Show Current Item Always", _ShowCurrentItemAlways, i18n("Show current item even if not focused"), false, i18n("

Shows the last cursor position in the non active list panel.

This option is only available when you don't use the KDE default colors.

") }, {"Colors", "Dim Inactive Colors", _DimInactiveColors, i18n("Dim the colors of the inactive panel"), false, i18n("

The colors of the inactive panel are calculated by a dim color and a dim factor.

") } @@ -114,10 +115,12 @@ addColorSelector("Marked Background", i18n("Selected background:"), p.color(QPalette::Active, QPalette::Highlight), "", &sameAsBckgnd, 1); ADDITIONAL_COLOR sameAsAltern = { i18n("Same as alt. background"), getColorSelector("Alternate Background")->getColor(), "Alternate Background" }; addColorSelector("Alternate Marked Background", i18n("Alternate selected background:"), getColorSelector("Marked Background")->getColor(), i18n("Same as selected background"), &sameAsAltern, 1); - addColorSelector("Current Foreground", i18n("Current foreground:"), Qt::white, i18n("Not used")); + addColorSelector("Current Foreground", i18n("Current foreground:"), Qt::darkMagenta, i18n("Not used")); ADDITIONAL_COLOR sameAsMarkedForegnd = { i18n("Same as selected foreground"), getColorSelector("Marked Foreground")->getColor(), "Marked Foreground" }; - addColorSelector("Marked Current Foreground", i18n("Selected current foreground:"), Qt::white, i18n("Not used"), &sameAsMarkedForegnd, 1); - addColorSelector("Current Background", i18n("Current background:"), Qt::white, i18n("Not used"), &sameAsBckgnd, 1); + addColorSelector("Marked Current Foreground", i18n("Selected current foreground:"), Qt::darkMagenta, i18n("Not used"), &sameAsMarkedForegnd, 1); + addColorSelector("Current Background", i18n("Current background:"), Qt::darkMagenta, i18n("Not used"), &sameAsBckgnd, 1); + ADDITIONAL_COLOR sameAsCurrentForegnd = { i18n("Same as current foreground"), getColorSelector("Current Foreground")->getColor(), "Current Foreground" }; + addColorSelector("Current Focus", i18n("Current Focus:"), Qt::darkMagenta, i18n("Not used"), &sameAsMarkedForegnd, 1); colorsGrid->addWidget(createSpacer(colorsGrp), itemList.count() - offset, 1); @@ -634,6 +637,7 @@ serializeItem(stream, "Marked Current Foreground"); serializeItem(stream, "Marked Foreground"); serializeItem(stream, "Show Current Item Always"); + serializeItem(stream, "Current Focus"); #ifdef SYNCHRONIZER_ENABLED serializeItem(stream, "Synchronizer Equals Foreground"); serializeItem(stream, "Synchronizer Equals Background"); diff --git a/krusader/Panel/PanelView/krinterdetailedview.cpp b/krusader/Panel/PanelView/krinterdetailedview.cpp --- a/krusader/Panel/PanelView/krinterdetailedview.cpp +++ b/krusader/Panel/PanelView/krinterdetailedview.cpp @@ -70,6 +70,7 @@ setSelectionMode(QAbstractItemView::NoSelection); setSelectionModel(new DummySelectionModel(_model, this)); + //setSelectionBehavior(QAbstractItemView::SelectRows); header()->installEventFilter(this); header()->setSectionResizeMode(QHeaderView::Interactive); diff --git a/krusader/Panel/krcolorcache.h b/krusader/Panel/krcolorcache.h --- a/krusader/Panel/krcolorcache.h +++ b/krusader/Panel/krcolorcache.h @@ -113,8 +113,14 @@ class KrColorGroup { public: - inline KrColorGroup() : _textColor(), _backgroundColor(), _highlightedTextColor(), - _highlightedBackgroundColor() {} + inline KrColorGroup() + : _textColor() + , _backgroundColor() + , _highlightedTextColor() + , _highlightedBackgroundColor() + , _focusColor() + { + } inline const QColor & text() const { return _textColor; @@ -128,6 +134,9 @@ inline const QColor & highlightedText() const { return _highlightedTextColor; } + inline const QColor & focusColor() const { + return _focusColor; + } inline void setText(const QColor & c) { _textColor = c; @@ -141,12 +150,16 @@ inline void setHighlightedText(const QColor & c) { _highlightedTextColor = c; } + inline void setFocusColor(const QColor & c) { + _focusColor = c; + } protected: QColor _textColor; QColor _backgroundColor; QColor _highlightedTextColor; QColor _highlightedBackgroundColor; + QColor _focusColor; }; class KrColorCache : public QObject diff --git a/krusader/Panel/krcolorcache.cpp b/krusader/Panel/krcolorcache.cpp --- a/krusader/Panel/krcolorcache.cpp +++ b/krusader/Panel/krcolorcache.cpp @@ -88,6 +88,7 @@ s_colorNames["Inactive Background"] = true; s_colorNames["Alternate Marked Background"] = true; s_colorNames["Inactive Alternate Marked Background"] = true; + s_colorNames["Current Focus"] = true; s_colorNames["Dim Target Color"] = true; s_numNames["Dim Factor"] = true; @@ -381,6 +382,7 @@ QColor getCurrentForegroundColor(bool isActive) const; QColor getCurrentBackgroundColor(bool isActive) const; QColor getCurrentMarkedForegroundColor(bool isActive) const; + QColor getFocusColor() const; QColor dimColor(QColor color, bool isBackgroundColor) const; }; @@ -440,12 +442,17 @@ foreground = getForegroundColor(isActive); } + QColor focusColor = getFocusColor(); + // set the background color result.setBackground(background); // set the foreground color result.setText(foreground); + // set the border color + result.setFocusColor(focusColor); + // now the color of a marked item QColor markedBackground = type.m_alternateBackgroundColor ? getAlternateMarkedBackgroundColor(isActive) @@ -641,6 +648,12 @@ return m_colorSettings.getColorValue(colorName); } +QColor KrColorCacheImpl::getFocusColor() const +{ + QColor color = m_colorSettings.getColorValue("Current Focus"); + return color; +} + QColor KrColorCacheImpl::dimColor(QColor color, bool /* isBackgroundColor */) const { int dimFactor = m_colorSettings.getNumValue("Dim Factor", 100); @@ -722,6 +735,7 @@ result.setText(col.text()); result.setHighlightedText(col.highlightedText()); result.setHighlight(col.highlight()); + result.setFocusColor(col.focusColor()); } bool KrColorCache::getDimSettings(QColor & dimColor, int & dimFactor)