┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphinfileitemlistwidget.cpp26
-rw-r--r--src/views/dolphinfileitemlistwidget.h3
2 files changed, 8 insertions, 21 deletions
diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp
index a3fac7b2e..d39d58cd0 100644
--- a/src/views/dolphinfileitemlistwidget.cpp
+++ b/src/views/dolphinfileitemlistwidget.cpp
@@ -34,16 +34,14 @@ DolphinFileItemListWidget::~DolphinFileItemListWidget()
{
}
-void DolphinFileItemListWidget::dataChanged(const QHash<QByteArray, QVariant>& current, const QSet<QByteArray>& roles)
+void DolphinFileItemListWidget::refreshCache()
{
- KFileItemListWidget::dataChanged(current, roles);
-
QColor color;
- QPixmap overlay;
- if (roles.contains("version")) {
+ const QHash<QByteArray, QVariant> values = data();
+ if (values.contains("version")) {
// The item is under version control. Apply the text color corresponding
// to its version state.
- const KVersionControlPlugin::VersionState version = static_cast<KVersionControlPlugin::VersionState>(current.value("version").toInt());
+ const KVersionControlPlugin::VersionState version = static_cast<KVersionControlPlugin::VersionState>(values.value("version").toInt());
const QColor textColor = styleOption().palette.text().color();
QColor tintColor = textColor;
@@ -68,22 +66,12 @@ void DolphinFileItemListWidget::dataChanged(const QHash<QByteArray, QVariant>& c
(tintColor.blue() + textColor.blue()) / 2,
(tintColor.alpha() + textColor.alpha()) / 2);
- overlay = overlayForState(version, styleOption().iconSize);
+ setOverlay(overlayForState(version, styleOption().iconSize));
+ } else if (!overlay().isNull()) {
+ setOverlay(QPixmap());
}
setTextColor(color);
- setOverlay(overlay);
-}
-
-void DolphinFileItemListWidget::styleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous)
-{
- KFileItemListWidget::styleOptionChanged(current, previous);
-
- if (!overlay().isNull() && current.iconSize != previous.iconSize) {
- const KVersionControlPlugin::VersionState version = static_cast<KVersionControlPlugin::VersionState>(data().value("version").toInt());
- const QPixmap newOverlay = overlayForState(version, current.iconSize);
- setOverlay(newOverlay);
- }
}
QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin::VersionState version, int size)
diff --git a/src/views/dolphinfileitemlistwidget.h b/src/views/dolphinfileitemlistwidget.h
index b08b96428..8435b5c18 100644
--- a/src/views/dolphinfileitemlistwidget.h
+++ b/src/views/dolphinfileitemlistwidget.h
@@ -40,8 +40,7 @@ public:
virtual ~DolphinFileItemListWidget();
protected:
- virtual void dataChanged(const QHash<QByteArray, QVariant>& current, const QSet<QByteArray>& roles = QSet<QByteArray>());
- virtual void styleOptionChanged(const KItemListStyleOption& current, const KItemListStyleOption& previous);
+ virtual void refreshCache();
private:
static QPixmap overlayForState(KVersionControlPlugin::VersionState state, int size);