]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinfileitemdelegate.cpp
Take care to not reset the preview-settings if they have not been changed.
[dolphin.git] / src / views / dolphinfileitemdelegate.cpp
index 6b706c88b2c2ebb46694a5f26858dbbd64153f89..64a19582a36db63bea4a799043a19b15a73b600c 100644 (file)
@@ -23,6 +23,7 @@
 #include <kfileitem.h>
 #include <kicon.h>
 #include <kiconloader.h>
+#include <kstringhandler.h>
 
 #include <QAbstractItemModel>
 #include <QAbstractProxyModel>
@@ -82,7 +83,7 @@ void DolphinFileItemDelegate::paint(QPainter* painter,
 int DolphinFileItemDelegate::nameColumnWidth(const QString& name, const QStyleOptionViewItem& option)
 {
     QFontMetrics fontMetrics(option.font);
-    int width = option.decorationSize.width() + fontMetrics.width(name) + 16;
+    int width = option.decorationSize.width() + fontMetrics.width(KStringHandler::preProcessWrap(name)) + 16;
 
     const int defaultWidth = option.rect.width();
     if ((defaultWidth > 0) && (defaultWidth < width)) {
@@ -162,14 +163,32 @@ QPixmap DolphinFileItemDelegate::emblemForState(KVersionControlPlugin::VersionSt
         for (int i = KVersionControlPlugin::NormalVersion; i <= KVersionControlPlugin::ConflictingVersion; ++i) {
             QString iconName;
             switch (i) {
-            case KVersionControlPlugin::NormalVersion:          iconName = "vcs-normal"; break;
-            case KVersionControlPlugin::UpdateRequiredVersion:  iconName = "vcs-update-required"; break;
-            case KVersionControlPlugin::LocallyModifiedVersion: iconName = "vcs-locally-modified"; break;
-            case KVersionControlPlugin::AddedVersion:           iconName = "vcs-added"; break;
-            case KVersionControlPlugin::RemovedVersion:         iconName = "vcs-removed"; break;
-            case KVersionControlPlugin::ConflictingVersion:     iconName = "vcs-conflicting"; break;
+            case KVersionControlPlugin::NormalVersion:
+                iconName = "vcs-normal";
+                break;
+            case KVersionControlPlugin::UpdateRequiredVersion:
+                iconName = "vcs-update-required";
+                break;
+            case KVersionControlPlugin::LocallyModifiedVersion:
+                iconName = "vcs-locally-modified";
+                break;
+            case KVersionControlPlugin::LocallyModifiedUnstagedVersion:
+                iconName = "vcs-locally-modified-unstaged";
+                break;
+            case KVersionControlPlugin::AddedVersion:
+                iconName = "vcs-added";
+                break;
+            case KVersionControlPlugin::RemovedVersion:
+                iconName = "vcs-removed";
+                break;
+            case KVersionControlPlugin::ConflictingVersion:
+                iconName = "vcs-conflicting";
+                break;
             case KVersionControlPlugin::UnversionedVersion:
-            default:                                            Q_ASSERT(false); break;
+                break;
+            default:
+                Q_ASSERT(false);
+                break;
             }
 
             m_cachedEmblems[i] = KIcon(iconName).pixmap(emblemSize);