View Issue Details

IDProjectCategoryView StatusLast Update
0017917ScribusText Frames / Story Editorpublic2026-08-09 13:45
Reporterqirat Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Summary0017917: [PATCH] 3_Notes Styles Editor: add ability to rename an existing notes style
Description[Patch 3 of 3]

AI found this and suggested it must be 3rd in the sequence.

The style name field was previously editable only while creating a new notes style, with no way to rename an existing one. Adds a dedicated Rename button that unlocks the field for the currently selected style; also fixes validateNSet() being called without the style's pre-rename name, which caused a false "provide same numbering style as set X" rejection on every rename attempt (the validation was comparing the style's already-updated new name against its own not-yet-renamed entry in the document's list). Requires patch B (uses the Add/Cancel button infrastructure it introduces).
TagsNo tags attached.
Attached Files
notesstyleseditor_C_rename_feature.patch (6,236 bytes)   
Index: scribus/ui/notesstyleseditor.ui
===================================================================
--- scribus/ui/notesstyleseditor.ui	(revision 27767)
+++ scribus/ui/notesstyleseditor.ui	(working copy)
@@ -67,6 +67,28 @@
       </widget>
      </item>
      <item>
+      <widget class="QPushButton" name="RenameButton">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip">
+        <string>Rename the current notes style</string>
+       </property>
+       <property name="text">
+        <string/>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>14</width>
+         <height>14</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item>
       <widget class="QPushButton" name="NewButton">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -130,7 +152,7 @@
      <item>
       <widget class="QLineEdit" name="NewNameEdit">
        <property name="toolTip">
-        <string>Name for the new notes style</string>
+        <string>Name of the notes style</string>
        </property>
       </widget>
      </item>
@@ -338,14 +360,14 @@
           </property>
           <property name="minimumSize">
            <size>
-            <width>70</width>
-            <height>28</height>
+            <width>50</width>
+            <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
-            <width>70</width>
-            <height>28</height>
+            <width>50</width>
+            <height>30</height>
            </size>
           </property>
           <property name="toolTip">
@@ -376,13 +398,13 @@
           </property>
           <property name="minimumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>0</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>16777215</height>
            </size>
           </property>
@@ -411,13 +433,13 @@
           </property>
           <property name="minimumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>0</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>16777215</height>
            </size>
           </property>
@@ -576,7 +598,7 @@
      <item>
       <widget class="QGroupBox" name="groupFrame">
        <property name="title">
-        <string>Frame &amp;Behavior</string>
+        <string>Frame &amp;Behaviour</string>
        </property>
        <layout class="QGridLayout" name="gridLayout_frame">
         <item row="0" column="0">
Index: scribus/ui/notesstyleseditor.cpp
===================================================================
--- scribus/ui/notesstyleseditor.cpp	(revision 27767)
+++ scribus/ui/notesstyleseditor.cpp	(working copy)
@@ -58,6 +58,7 @@
 	ApplyButton->setIcon(im.loadIcon("alert-ok"));
 	AddStyleButton->setIcon(im.loadIcon("alert-ok"));
 	CancelButton->setIcon(im.loadIcon("alert-error"));
+	RenameButton->setIcon(im.loadIcon("paragraph-style-edit"));
 
 	charStyleComboLabel->setPixmap(im.loadPixmap("character-style"));
 	paraStyleComboLabel->setPixmap(im.loadPixmap("paragraph-style"));
@@ -205,8 +206,12 @@
 	setBlockSignals(true);
 	NSlistBox->setCurrentIndex(NSlistBox->findText(NS->name()));
 	NewNameEdit->setText(NS->name());
-	//the style name is only editable while creating a new notes style
+	//the style name is only editable while creating a new notes style,
+	//or after Rename is pressed for an existing one; unlike paragraph/character
+	//styles, the "default" notes style isn't special-cased elsewhere in the
+	//document engine, so renaming it is allowed
 	NewNameEdit->setEnabled(m_addNewNsMode);
+	RenameButton->setEnabled(!m_addNewNsMode);
 	FootRadio->setChecked(!NS->isEndNotes());
 	EndRadio->setEnabled(true);
 	EndRadio->setChecked(NS->isEndNotes());
@@ -268,7 +273,11 @@
 		NotesStyle n = m_changesMap.value(nsName);
 
 		//validate settings
-		if (!m_Doc->validateNSet(n))
+		//pass the style's current (pre-rename) name so validateNSet can
+		//correctly recognise this entry as itself when it's being renamed,
+		//instead of comparing its new settings against its own old entry
+		//and reporting a false "duplicate numbering style" conflict
+		if (!m_Doc->validateNSet(n, nsName))
 		{
 			NSlistBox->setCurrentIndex(NSlistBox->findText(n.name()));
 			break;
@@ -444,6 +453,15 @@
 	markChanged();
 }
 
+void NotesStylesEditor::on_RenameButton_clicked()
+{
+	//unlock the style name field so the current notes style can be renamed;
+	//it re-locks itself the next time setNotesStyle() runs (style switch or save)
+	NewNameEdit->setEnabled(true);
+	NewNameEdit->setFocus();
+	NewNameEdit->selectAll();
+}
+
 void NotesStylesEditor::on_FootRadio_toggled(bool checked)
 {
 	bool wasSignalsBlocked = signalsBlocked();
Index: scribus/ui/notesstyleseditor.h
===================================================================
--- scribus/ui/notesstyleseditor.h	(revision 27767)
+++ scribus/ui/notesstyleseditor.h	(working copy)
@@ -31,9 +31,9 @@
 	void readNotesStyle(const QString& nsName);
 	void changeNotesStyle();
 	void setBlockSignals(bool block);
-	bool isDefaultNotesStyle(const QString& nsName) const;
 	void setupIcons();
 	void markChanged();
+	bool isDefaultNotesStyle(const QString& nsName) const;
 
 public slots:
 	void setDoc(ScribusDoc *doc);
@@ -47,6 +47,7 @@
 	void on_DeleteButton_clicked();
 	void on_AddStyleButton_clicked();
 	void on_CancelButton_clicked();
+	void on_RenameButton_clicked();
 	void on_NewNameEdit_textChanged(const QString &arg1);
 	void on_FootRadio_toggled(bool checked);
 	void on_EndRadio_toggled(bool checked);
PatchNo

Activities

qirat

2026-08-09 13:44

reporter   ~0054187

Here are the changes with patch C v1.9:
    • validateNSet() false-rejection-on-rename bug fix retained
    • Scope narrowed to just the Rename-existing-style capability (add/draft logic moved to Patch B)
    • 0000075:0000060% smaller, same functionality, cleaner patch boundary

Also, the order remains the same (Patch A, B, C). Only Patch B and C changed (posed), A remains unchanged.
notesstyleseditor_C_rename_feature_v1.9.patch (7,167 bytes)   
Index: scribus/ui/notesstyleseditor.ui
===================================================================
--- scribus/ui/notesstyleseditor.ui	(revision 27767)
+++ scribus/ui/notesstyleseditor.ui	(working copy)
@@ -83,6 +83,28 @@
       </widget>
      </item>
      <item>
+      <widget class="QPushButton" name="RenameButton">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip">
+        <string>Rename the current notes style</string>
+       </property>
+       <property name="text">
+        <string/>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>14</width>
+         <height>14</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item>
       <widget class="QPushButton" name="NewButton">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -143,7 +165,7 @@
         </sizepolicy>
        </property>
        <property name="toolTip">
-        <string>Name for the new notes style</string>
+        <string>Name of the notes style</string>
        </property>
       </widget>
      </item>
@@ -281,14 +303,14 @@
           </property>
           <property name="minimumSize">
            <size>
-            <width>70</width>
-            <height>28</height>
+            <width>50</width>
+            <height>30</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
-            <width>70</width>
-            <height>28</height>
+            <width>50</width>
+            <height>30</height>
            </size>
           </property>
           <property name="toolTip">
@@ -313,13 +335,13 @@
           </property>
           <property name="minimumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>0</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>16777215</height>
            </size>
           </property>
@@ -342,13 +364,13 @@
           </property>
           <property name="minimumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>0</height>
            </size>
           </property>
           <property name="maximumSize">
            <size>
-            <width>70</width>
+            <width>50</width>
             <height>16777215</height>
            </size>
           </property>
@@ -554,7 +576,7 @@
      <item>
       <widget class="QGroupBox" name="groupFrame">
        <property name="title">
-        <string>Frame &amp;Behavior</string>
+        <string>Frame &amp;Behaviour</string>
        </property>
        <layout class="QGridLayout" name="gridLayout_frame">
         <property name="horizontalSpacing">
Index: scribus/ui/notesstyleseditor.cpp
===================================================================
--- scribus/ui/notesstyleseditor.cpp	(revision 27767)
+++ scribus/ui/notesstyleseditor.cpp	(working copy)
@@ -56,6 +56,7 @@
 	DeleteButton->setIcon(im.loadIcon("delete"));
 	ApplyButton->setIcon(im.loadIcon("alert-ok"));
 	OKButton->setIcon(im.loadIcon("close"));
+	RenameButton->setIcon(im.loadIcon("paragraph-style-edit"));
 
 	charStyleComboLabel->setPixmap(im.loadPixmap("character-style"));
 	paraStyleComboLabel->setPixmap(im.loadPixmap("paragraph-style"));
@@ -279,10 +280,15 @@
 	NSlistBox->setCurrentIndex(NSlistBox->findText(NS->name()));
 	NewNameEdit->setText(NS->name());
 	//the style name is only editable for a not-yet-saved draft (auto-
-	//unlocked, since it has no real name to protect yet); unlike
-	//paragraph/character styles, the "default" notes style isn't
-	//special-cased elsewhere in the document engine
-	NewNameEdit->setEnabled(isDraftNotesStyle(NS->name()));
+	//unlocked, since it has no real name to protect yet) or after Rename
+	//is pressed. Unlike paragraph/character styles, the "default" notes
+	//style isn't name-protected in the document engine, so renaming it
+	//is allowed. m_renamePending is reset on selection change and after
+	//a save, not here, since this function can be called again for the
+	//same entry mid-rename.
+	bool isDraft = isDraftNotesStyle(NS->name());
+	NewNameEdit->setEnabled(isDraft || m_renamePending);
+	RenameButton->setEnabled(!isDraft);
 	FootRadio->setChecked(!NS->isEndNotes());
 	EndRadio->setEnabled(true);
 	EndRadio->setChecked(NS->isEndNotes());
@@ -319,6 +325,7 @@
 void NotesStylesEditor::on_NSlistBox_currentTextChanged(const QString &arg1)
 {
 	DeleteButton->setEnabled(!isDefaultNotesStyle(arg1));
+	m_renamePending = false;
 	readNotesStyle(arg1);
 }
 
@@ -340,7 +347,11 @@
 		NotesStyle n = m_changesMap.value(nsName);
 
 		//validate settings
-		if (!m_Doc->validateNSet(n))
+		//pass the style's current (pre-rename) name so validateNSet can
+		//correctly recognise this entry as itself when it's being renamed,
+		//instead of comparing its new settings against its own old entry
+		//and reporting a false "duplicate numbering style" conflict
+		if (!m_Doc->validateNSet(n, nsName))
 		{
 			NSlistBox->setCurrentIndex(NSlistBox->findText(n.name()));
 			break;
@@ -436,7 +447,9 @@
 		m_Doc->changed();
 		m_Doc->regionsChanged()->update(QRectF());
 	}
-	//restore NStyle index
+	//restore NStyle index; any rename just committed is done, so the
+	//name field should re-lock rather than stay open
+	m_renamePending = false;
 	readNotesStyle(currNS);
 
 	ApplyButton->setEnabled(false);
@@ -507,6 +520,17 @@
 	markChanged();
 }
 
+void NotesStylesEditor::on_RenameButton_clicked()
+{
+	//unlock the style name field so the current notes style can be
+	//renamed; m_renamePending is cleared on selection change and after a
+	//successful save, which re-locks the field at either point
+	m_renamePending = true;
+	NewNameEdit->setEnabled(true);
+	NewNameEdit->setFocus();
+	NewNameEdit->selectAll();
+}
+
 void NotesStylesEditor::on_FootRadio_toggled(bool checked)
 {
 	bool wasSignalsBlocked = signalsBlocked();
Index: scribus/ui/notesstyleseditor.h
===================================================================
--- scribus/ui/notesstyleseditor.h	(revision 27767)
+++ scribus/ui/notesstyleseditor.h	(working copy)
@@ -25,6 +25,7 @@
 private:
 	ScribusDoc         *m_Doc { nullptr };
 	PrefsContext       *m_prefs { nullptr };
+	bool                m_renamePending { false };
 	QMap<QString, NotesStyle> m_changesMap; //<NSname to change, NSet new values>
 
 	void readNotesStyle(const QString& nsName);
@@ -48,6 +49,7 @@
 	void on_ApplyButton_clicked();
 	void on_DeleteButton_clicked();
 	void on_OKButton_clicked();
+	void on_RenameButton_clicked();
 	void on_NewNameEdit_textChanged(const QString &arg1);
 	void on_FootRadio_toggled(bool checked);
 	void on_EndRadio_toggled(bool checked);

qirat

2026-08-09 13:45

reporter   ~0054188

That messed up number is: "60% smaller..."

Issue History

Date Modified Username Field Change
2026-08-09 04:38 qirat New Issue
2026-08-09 04:38 qirat File Added: notesstyleseditor_C_rename_feature.patch
2026-08-09 13:44 qirat Note Added: 0054187
2026-08-09 13:44 qirat File Added: notesstyleseditor_C_rename_feature_v1.9.patch
2026-08-09 13:45 qirat Note Added: 0054188