]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinfileitemdelegate.cpp
Coding style update for pointer comparison
[dolphin.git] / src / views / dolphinfileitemdelegate.cpp
index 64a19582a36db63bea4a799043a19b15a73b600c..ce0411005e4e51cad745dc2ea1995a5a7b78eacb 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2008 by Peter Penz <peter.penz@gmx.at>                  *
+ *   Copyright (C) 2008 by Peter Penz <peter.penz19@gmail.com>             *
  *                                                                         *
  *   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  *
 #include "dolphinfileitemdelegate.h"
 
 #include "dolphinmodel.h"
-#include <kfileitem.h>
-#include <kicon.h>
-#include <kiconloader.h>
-#include <kstringhandler.h>
+#include <KColorScheme>
+#include <KFileItem>
+#include <KIcon>
+#include <KIconLoader>
+#include <KStringHandler>
 
 #include <QAbstractItemModel>
 #include <QAbstractProxyModel>
@@ -58,6 +59,15 @@ 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;
+        const QColor textColor = KColorScheme(QPalette::Active).foreground(KColorScheme::InactiveText).color();
+        palette.setColor(QPalette::Text, textColor);
+        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.
@@ -119,11 +129,12 @@ void DolphinFileItemDelegate::adjustOptionTextColor(QStyleOptionViewItemV4& opti
     // as tint colors and are mixed with the current set text color. The tint colors
     // have been optimized for the base colors of the corresponding Oxygen emblems.
     switch (state) {
-    case KVersionControlPlugin::UpdateRequiredVersion:  tintColor = Qt::yellow; break;
-    case KVersionControlPlugin::LocallyModifiedVersion: tintColor = Qt::green; break;
-    case KVersionControlPlugin::AddedVersion:           tintColor = Qt::darkGreen; break;
-    case KVersionControlPlugin::RemovedVersion:         tintColor = Qt::darkRed; break;
-    case KVersionControlPlugin::ConflictingVersion:     tintColor = Qt::red; break;
+    case KVersionControlPlugin::UpdateRequiredVersion:          tintColor = Qt::yellow; break;
+    case KVersionControlPlugin::LocallyModifiedUnstagedVersion: tintColor = Qt::darkRed; break;
+    case KVersionControlPlugin::LocallyModifiedVersion:         tintColor = Qt::green; break;
+    case KVersionControlPlugin::AddedVersion:                   tintColor = Qt::darkGreen; break;
+    case KVersionControlPlugin::RemovedVersion:                 tintColor = Qt::darkRed; break;
+    case KVersionControlPlugin::ConflictingVersion:             tintColor = Qt::red; break;
     case KVersionControlPlugin::UnversionedVersion:
     case KVersionControlPlugin::NormalVersion:
     default:
@@ -143,7 +154,7 @@ void DolphinFileItemDelegate::adjustOptionTextColor(QStyleOptionViewItemV4& opti
 
 QPixmap DolphinFileItemDelegate::emblemForState(KVersionControlPlugin::VersionState state, const QSize& size) const
 {
-    Q_ASSERT(state <= KVersionControlPlugin::ConflictingVersion);
+    Q_ASSERT(state <= KVersionControlPlugin::LocallyModifiedUnstagedVersion);
     if (m_cachedSize != size) {
         m_cachedSize = size;
 
@@ -160,7 +171,7 @@ QPixmap DolphinFileItemDelegate::emblemForState(KVersionControlPlugin::VersionSt
         }
 
         const QSize emblemSize(emblemHeight, emblemHeight);
-        for (int i = KVersionControlPlugin::NormalVersion; i <= KVersionControlPlugin::ConflictingVersion; ++i) {
+        for (int i = KVersionControlPlugin::NormalVersion; i <= KVersionControlPlugin::LocallyModifiedUnstagedVersion; ++i) {
             QString iconName;
             switch (i) {
             case KVersionControlPlugin::NormalVersion: