[utilities/krusader] krusader: Configurable colors to rename line

Davide Gianforte null at kde.org
Wed Jun 3 07:13:06 BST 2020


Git commit 1afe484b6931ce8239a0031e3fbaa4dfd05ca8a6 by Davide Gianforte.
Committed on 03/06/2020 at 06:13.
Pushed by gengisdave into branch 'master'.

Configurable colors to rename line

Add to Konfigurator two options to set foreground and background colors to be
applied to the rename field.

BUG: 301034
BUG: 414968
FIXED: [ 301034 ] Rename input field doesn't respect text[NORMAL] when GTK theme is used
FIXED: [ 414968 ] Using provided custom colour package Midnight Commander, renaming files is difficult, as line colours are very pale.
ADDED: In Konfigurator, two options are added to set foreground and background colors to the rename field.
GUI: Two new options ("Rename background" and "Rename foreground") are seen by users.

M  +2    -0    krusader/Konfigurator/kgcolors.cpp
M  +15   -0    krusader/Panel/PanelView/krviewitemdelegate.cpp
M  +2    -0    krusader/Panel/krcolorcache.cpp

https://invent.kde.org/utilities/krusader/commit/1afe484b6931ce8239a0031e3fbaa4dfd05ca8a6

diff --git a/krusader/Konfigurator/kgcolors.cpp b/krusader/Konfigurator/kgcolors.cpp
index 7ca1dbea..71d6c1f1 100644
--- a/krusader/Konfigurator/kgcolors.cpp
+++ b/krusader/Konfigurator/kgcolors.cpp
@@ -118,6 +118,8 @@ KgColors::KgColors(bool first, QWidget* parent) :
     ADDITIONAL_COLOR sameAsMarkedForegnd = { i18n("Same as selected foreground"), getColorSelector("Marked Foreground")->getColor(), "Marked Foreground" };
     addColorSelector("Marked Current Foreground",         i18n("Selected current foreground:"),          Qt::white,                                    i18n("Not used"), &sameAsMarkedForegnd, 1);
     addColorSelector("Current Background",         i18n("Current background:"),          Qt::white, i18n("Not used"), &sameAsBckgnd, 1);
+    addColorSelector("Rename Foreground",         i18n("Rename foreground:"),          getColorSelector("Foreground")->getColor(), i18n("Same as foreground"));
+    addColorSelector("Rename Background",         i18n("Rename background:"),          getColorSelector("Background")->getColor(), i18n("Same as background"));
 
     colorsGrid->addWidget(createSpacer(colorsGrp), itemList.count() - offset, 1);
 
diff --git a/krusader/Panel/PanelView/krviewitemdelegate.cpp b/krusader/Panel/PanelView/krviewitemdelegate.cpp
index 38273f1e..ae8c0076 100644
--- a/krusader/Panel/PanelView/krviewitemdelegate.cpp
+++ b/krusader/Panel/PanelView/krviewitemdelegate.cpp
@@ -23,6 +23,7 @@
 #include "krviewproperties.h"
 #include "../krglobal.h"
 #include "../listpanel.h"
+#include "../krcolorcache.h"
 
 // QtGui
 #include <QKeyEvent>
@@ -72,6 +73,20 @@ void KrViewItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index
             lineEdit->deselect();
             lineEdit->setSelection(0, nameWithoutExt.length());
         }
+
+        KrColorSettings colorSettings;
+
+        if (!colorSettings.getBoolValue("KDE Default")) {
+            QPalette renamePalette = lineEdit->palette();
+
+            if (!colorSettings.getColorTextValue("Rename Foreground").isEmpty())
+                renamePalette.setColor(QPalette::Text, colorSettings.getColorValue("Rename Foreground"));
+
+            if (!colorSettings.getColorTextValue("Rename Background").isEmpty())
+                renamePalette.setColor(QPalette::Base, colorSettings.getColorValue("Rename Background"));
+
+            lineEdit->setPalette(renamePalette);
+        }
     }
 }
 
diff --git a/krusader/Panel/krcolorcache.cpp b/krusader/Panel/krcolorcache.cpp
index 40f09232..3e1ee431 100644
--- a/krusader/Panel/krcolorcache.cpp
+++ b/krusader/Panel/krcolorcache.cpp
@@ -64,6 +64,7 @@ void KrColorSettingNames::initialize()
         return;
     s_colorNames["Foreground"] = true;
     s_colorNames["Inactive Foreground"] = true;
+    s_colorNames["Rename Foreground"] = true;
     s_colorNames["Directory Foreground"] = true;
     s_colorNames["Inactive Directory Foreground"] = true;
     s_colorNames["Executable Foreground"] = true;
@@ -86,6 +87,7 @@ void KrColorSettingNames::initialize()
     s_colorNames["Inactive Alternate Background"] = true;
     s_colorNames["Background"] = true;
     s_colorNames["Inactive Background"] = true;
+    s_colorNames["Rename Background"] = true;
     s_colorNames["Alternate Marked Background"] = true;
     s_colorNames["Inactive Alternate Marked Background"] = true;
     s_colorNames["Dim Target Color"] = true;


More information about the kde-doc-english mailing list