X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/09e4bd3ed4f1283ef3b6df3bb55c1001978a1b34..747a86573feb65e2ffe57cdae7dedf6ad272e789:/src/views/dolphinfileitemdelegate.cpp diff --git a/src/views/dolphinfileitemdelegate.cpp b/src/views/dolphinfileitemdelegate.cpp index 3e537ffeb..4d66c73f1 100644 --- a/src/views/dolphinfileitemdelegate.cpp +++ b/src/views/dolphinfileitemdelegate.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Peter Penz * + * Copyright (C) 2008 by Peter Penz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -20,10 +20,12 @@ #include "dolphinfileitemdelegate.h" #include "dolphinmodel.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -36,9 +38,11 @@ DolphinFileItemDelegate::DolphinFileItemDelegate(QObject* parent) : KFileItemDelegate(parent), m_hasMinimizedNameColumn(false), m_cachedSize(), - m_cachedEmblems() + m_cachedEmblems(), + m_cachedInactiveTextColorDirty(true) { setJobTransfersVisible(true); + connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SLOT(handleDisplayPaletteChange())); } DolphinFileItemDelegate::~DolphinFileItemDelegate() @@ -58,6 +62,18 @@ void DolphinFileItemDelegate::paint(QPainter* painter, adjustOptionWidth(opt, proxyModel, dolphinModel, index); } + if (!isNameColumn) { + // Use the inactive text color for all columns except the name column. This indicates for the user that + // hovering other columns does not change the actions context. + QPalette palette = opt.palette; + if (m_cachedInactiveTextColorDirty) { + m_cachedInactiveTextColor = KColorScheme(QPalette::Active).foreground(KColorScheme::InactiveText).color(); + m_cachedInactiveTextColorDirty = false; + } + palette.setColor(QPalette::Text, m_cachedInactiveTextColor); + opt.palette = palette; + } + if (dolphinModel->hasVersionData() && isNameColumn) { // The currently shown items are under revision control. Show the current revision // state by adding an emblem and changing the text tintColor. @@ -92,6 +108,11 @@ int DolphinFileItemDelegate::nameColumnWidth(const QString& name, const QStyleOp return width; } +void DolphinFileItemDelegate::handleDisplayPaletteChange() +{ + m_cachedInactiveTextColorDirty = true; +} + void DolphinFileItemDelegate::adjustOptionWidth(QStyleOptionViewItemV4& option, const QAbstractProxyModel* proxyModel, const DolphinModel* dolphinModel, @@ -120,9 +141,9 @@ void DolphinFileItemDelegate::adjustOptionTextColor(QStyleOptionViewItemV4& opti // have been optimized for the base colors of the corresponding Oxygen emblems. switch (state) { case KVersionControlPlugin::UpdateRequiredVersion: tintColor = Qt::yellow; break; - case KVersionControlPlugin::LocallyModifiedUnstagedVersion: tintColor = Qt::darkRed; break; + case KVersionControlPlugin::LocallyModifiedUnstagedVersion: tintColor = Qt::darkGreen; break; case KVersionControlPlugin::LocallyModifiedVersion: tintColor = Qt::green; break; - case KVersionControlPlugin::AddedVersion: tintColor = Qt::darkGreen; break; + case KVersionControlPlugin::AddedVersion: tintColor = Qt::green; break; case KVersionControlPlugin::RemovedVersion: tintColor = Qt::darkRed; break; case KVersionControlPlugin::ConflictingVersion: tintColor = Qt::red; break; case KVersionControlPlugin::UnversionedVersion: