From c5a7c48b85b808a7f4b9ced1de1f0597a2855410 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Mon, 13 Jul 2009 13:31:59 +0200
Subject: [PATCH] Allow editing of color scheme name

---
 .../texteditor/editcolorschemedialog.cpp      |  9 ++
 .../texteditor/editcolorschemedialog.h        |  2 +
 .../texteditor/editcolorschemedialog.ui       | 85 +++++++++++++------
 3 files changed, 69 insertions(+), 27 deletions(-)

diff --git a/src/plugins/texteditor/editcolorschemedialog.cpp b/src/plugins/texteditor/editcolorschemedialog.cpp
index 0fc58ea21c3..f05e09e5421 100644
--- a/src/plugins/texteditor/editcolorschemedialog.cpp
+++ b/src/plugins/texteditor/editcolorschemedialog.cpp
@@ -32,6 +32,7 @@
 
 #include <QtGui/QColorDialog>
 
+using namespace TextEditor;
 using namespace TextEditor::Internal;
 
 static inline QString colorButtonStyleSheet(const QColor &bgColor)
@@ -57,6 +58,8 @@ EditColorSchemeDialog::EditColorSchemeDialog(const FormatDescriptions &fd,
 {
     m_ui->setupUi(this);
 
+    m_ui->nameEdit->setText(scheme.name());
+
     foreach (const FormatDescription &d, fd)
         m_ui->itemListWidget->addItem(d.trName());
 
@@ -76,6 +79,12 @@ EditColorSchemeDialog::~EditColorSchemeDialog()
     delete m_ui;
 }
 
+void EditColorSchemeDialog::accept()
+{
+    m_scheme.setName(m_ui->nameEdit->text());
+    QDialog::accept();
+}
+
 void EditColorSchemeDialog::itemChanged()
 {
     QListWidgetItem *item = m_ui->itemListWidget->currentItem();
diff --git a/src/plugins/texteditor/editcolorschemedialog.h b/src/plugins/texteditor/editcolorschemedialog.h
index d727b2eb15d..386826fd49c 100644
--- a/src/plugins/texteditor/editcolorschemedialog.h
+++ b/src/plugins/texteditor/editcolorschemedialog.h
@@ -56,6 +56,8 @@ public:
     ColorScheme colorScheme() const
     { return m_scheme; }
 
+    void accept();
+
 private slots:
     void itemChanged();
     void changeForeColor();
diff --git a/src/plugins/texteditor/editcolorschemedialog.ui b/src/plugins/texteditor/editcolorschemedialog.ui
index 4810a5c8d36..2f2872092cb 100644
--- a/src/plugins/texteditor/editcolorschemedialog.ui
+++ b/src/plugins/texteditor/editcolorschemedialog.ui
@@ -6,14 +6,30 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>462</width>
-    <height>416</height>
+    <width>494</width>
+    <height>571</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Edit Color Scheme</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Name</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QLineEdit" name="nameEdit"/>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
    <item>
     <widget class="QGroupBox" name="groupBox_2">
      <property name="sizePolicy">
@@ -143,29 +159,34 @@
     </widget>
    </item>
    <item>
-    <widget class="QLabel" name="label_3">
-     <property name="text">
-      <string>Preview:</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QTextEdit" name="previewTextEdit">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>16777215</width>
-       <height>100</height>
-      </size>
-     </property>
-     <property name="readOnly">
-      <bool>true</bool>
+    <widget class="QGroupBox" name="groupBox_3">
+     <property name="title">
+      <string>Preview</string>
      </property>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <widget class="QTextEdit" name="previewTextEdit">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>16777215</width>
+          <height>100</height>
+         </size>
+        </property>
+        <property name="focusPolicy">
+         <enum>Qt::NoFocus</enum>
+        </property>
+        <property name="readOnly">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
     </widget>
    </item>
    <item>
@@ -175,8 +196,8 @@
      </property>
      <property name="sizeHint" stdset="0">
       <size>
-       <width>20</width>
-       <height>10</height>
+       <width>17</width>
+       <height>13</height>
       </size>
      </property>
     </spacer>
@@ -193,6 +214,16 @@
    </item>
   </layout>
  </widget>
+ <tabstops>
+  <tabstop>nameEdit</tabstop>
+  <tabstop>itemListWidget</tabstop>
+  <tabstop>foregroundToolButton</tabstop>
+  <tabstop>backgroundToolButton</tabstop>
+  <tabstop>eraseBackgroundToolButton</tabstop>
+  <tabstop>boldCheckBox</tabstop>
+  <tabstop>italicCheckBox</tabstop>
+  <tabstop>buttonBox</tabstop>
+ </tabstops>
  <resources/>
  <connections>
   <connection>
-- 
GitLab