]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix wrong text color in places and in folders panel.
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Mon, 13 Aug 2012 16:40:43 +0000 (18:40 +0200)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Mon, 13 Aug 2012 16:40:43 +0000 (18:40 +0200)
FIXED-IN: 4.9.1
REVIEW: 105832
BUG: 303133

src/CMakeLists.txt
src/kitemviews/kstandarditemlistwidget.cpp
src/kitemviews/kstandarditemlistwidget.h
src/panels/folders/foldersitemlistwidget.cpp [new file with mode: 0644]
src/panels/folders/foldersitemlistwidget.h [new file with mode: 0644]
src/panels/folders/folderspanel.cpp
src/panels/places/placesitemlistwidget.cpp
src/panels/places/placesitemlistwidget.h

index 5c1a6dad58cb579ee85731d4bfa0ebe9a6a1bea4..afc190f8324785b910d49a360bb4e79b2b11543f 100644 (file)
@@ -165,6 +165,7 @@ set(dolphin_SRCS
     panels/places/placesitemmodel.cpp
     panels/places/placesitemsignalhandler.cpp
     panels/panel.cpp
+    panels/folders/foldersitemlistwidget.cpp
     panels/folders/treeviewcontextmenu.cpp
     panels/folders/folderspanel.cpp
     search/dolphinfacetswidget.cpp
index 5b0a0b7412314f164207c98713153df86009c03d..d41b9161bf4f5e7a9ce3fe38c3e3c3a82ed492df 100644 (file)
@@ -464,6 +464,11 @@ QFont KStandardItemListWidget::customizedFont(const QFont& baseFont) const
     return baseFont;
 }
 
+QPalette::ColorRole KStandardItemListWidget::normalTextColorPalette() const
+{
+    return QPalette::Text;
+}
+
 void KStandardItemListWidget::setTextColor(const QColor& color)
 {
     if (color != m_customTextColor) {
@@ -480,7 +485,7 @@ QColor KStandardItemListWidget::textColor() const
     }
 
     const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive;
-    const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : QPalette::Text;
+    const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : normalTextColorPalette();
     return styleOption().palette.brush(group, role).color();
 }
 
@@ -1037,7 +1042,7 @@ void KStandardItemListWidget::updateIconsLayoutTextCache()
                 const QString elidedText = m_customizedFontMetrics.elidedText(text, Qt::ElideRight, maxWidth);
                 textInfo->staticText.setText(elidedText);
                 requiredWidth = m_customizedFontMetrics.width(elidedText);
-            } else if (role == "rating") { 
+            } else if (role == "rating") {
                // Use the width of the rating pixmap, because the rating text is empty.
                 requiredWidth = m_rating.width();
             }
index 222d7b5f491b271482281fd1d01a25d45532aab7..f559f3d223527e6511b1a66a973a17185bca8cf9 100644 (file)
@@ -120,6 +120,8 @@ protected:
      */
     virtual QFont customizedFont(const QFont& baseFont) const;
 
+    virtual QPalette::ColorRole normalTextColorPalette() const;
+
     void setTextColor(const QColor& color);
     QColor textColor() const;
 
diff --git a/src/panels/folders/foldersitemlistwidget.cpp b/src/panels/folders/foldersitemlistwidget.cpp
new file mode 100644 (file)
index 0000000..5130592
--- /dev/null
@@ -0,0 +1,36 @@
+/***************************************************************************
+ *  Copyright (C) 2012 by Emmanuel Pescosta <emmanuelpescosta099@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  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
+ ***************************************************************************/
+
+#include "foldersitemlistwidget.h"
+
+FoldersItemListWidget::FoldersItemListWidget(KItemListWidgetInformant* informant, QGraphicsItem* parent) :
+    KFileItemListWidget(informant, parent)
+{
+}
+
+FoldersItemListWidget::~FoldersItemListWidget()
+{
+}
+
+QPalette::ColorRole FoldersItemListWidget::normalTextColorPalette() const
+{
+    return QPalette::WindowText;
+}
+
+#include "foldersitemlistwidget.moc"
diff --git a/src/panels/folders/foldersitemlistwidget.h b/src/panels/folders/foldersitemlistwidget.h
new file mode 100644 (file)
index 0000000..fa7b143
--- /dev/null
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *  Copyright (C) 2012 by Emmanuel Pescosta <emmanuelpescosta099@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  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
+ ***************************************************************************/
+
+#ifndef FOLDERSITEMLISTWIDGET_H
+#define FOLDERSITEMLISTWIDGET_H
+
+#include <kitemviews/kfileitemlistwidget.h>
+
+/**
+ * @brief Extends KFileItemListWidget to use the right text color.
+*/
+class FoldersItemListWidget : public KFileItemListWidget
+{
+    Q_OBJECT
+
+public:
+    FoldersItemListWidget(KItemListWidgetInformant* informant, QGraphicsItem* parent);
+    virtual ~FoldersItemListWidget();
+
+protected:
+    virtual QPalette::ColorRole normalTextColorPalette() const;
+};
+
+#endif
+
+
index 78e437a418f32f3dfb9fd572f0e0f2736195bd87..0760200b63098ebad8be35d39dc657bf7e1bf9f2 100644 (file)
@@ -22,6 +22,7 @@
 #include "dolphin_folderspanelsettings.h"
 #include "dolphin_generalsettings.h"
 #include "treeviewcontextmenu.h"
+#include "foldersitemlistwidget.h"
 
 #include <kitemviews/kitemlistselectionmanager.h>
 #include <kitemviews/kfileitemlistview.h>
@@ -120,6 +121,7 @@ void FoldersPanel::showEvent(QShowEvent* event)
         // This assures that no performance and memory overhead is given when the folders panel is not
         // used at all and stays invisible.
         KFileItemListView* view  = new KFileItemListView();
+        view->setWidgetCreator(new KItemListWidgetCreator<FoldersItemListWidget>());
         view->setSupportsItemExpanding(true);
         // Set the opacity to 0 initially. The opacity will be increased after the loading of the initial tree
         // has been finished in slotLoadingCompleted(). This prevents an unnecessary animation-mess when
index 24c2b3f11ff924ccc23d41933782529f1047c193..00f0fdab060a7c3b60855b0df8f77a83855ccdaa 100644 (file)
@@ -35,4 +35,9 @@ bool PlacesItemListWidget::isHidden() const
     return data().value("isHidden").toBool();
 }
 
+QPalette::ColorRole PlacesItemListWidget::normalTextColorPalette() const
+{
+    return QPalette::WindowText;
+}
+
 #include "placesitemlistwidget.moc"
index d7a4f3dddde42a8c8f7706937cc05f5402b2436d..93cd8f468c19ef30285da4950604e267ab814b81 100644 (file)
@@ -24,7 +24,7 @@
 
 /**
  * @brief Extends KStandardItemListWidget to interpret the hidden
- *        property of the PlacesModel.
+ *        property of the PlacesModel and use the right text color.
 */
 class PlacesItemListWidget : public KStandardItemListWidget
 {
@@ -36,6 +36,7 @@ public:
 
 protected:
     virtual bool isHidden() const;
+    virtual QPalette::ColorRole normalTextColorPalette() const;
 };
 
 #endif