View Issue Details

IDProjectCategoryView StatusLast Update
0017915ScribusText Frames / Story Editorpublic2026-08-09 04:34
Reporterbuttar Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Summary0017915: [PATCH] 1_Notes Styles Editor: default notes style incorrectly identified by name, not identity
Description[Patch 1 of 3]
It is something AI detected while I was working on the UI actually, and suggested patches to be applied in right sequence. I hope it is right.

NotesStylesEditor decides whether the current notes style is "the default" by comparing its name against tr("default"). The actual default style is seeded with the literal name "Default" and is never translated, so the comparison never matches in any locale — the Delete button's protection against removing the default style, and the name-lock logic, were silently ineffective. Fixed by identifying the default style the same way ScribusDoc::deleteNotesStyle() already does internally: by list position (m_docNotesStylesList.at(0)), not by name string. No user-visible behavior change beyond the button now being correctly greyed out for the true default style. Also removes a small piece of dead code in updateNSList() where the buggy check was immediately overwritten by a duplicate unconditional line.
TagsNo tags attached.
Attached Files
notesstyleseditor_A_default_identity_fix.patch (2,331 bytes)   
Index: scribus/ui/notesstyleseditor.ui
===================================================================
Index: scribus/ui/notesstyleseditor.cpp
===================================================================
--- scribus/ui/notesstyleseditor.cpp	(revision 27767)
+++ scribus/ui/notesstyleseditor.cpp	(working copy)
@@ -155,14 +155,21 @@
 		}
 		if (!m_Doc->m_docNotesStylesList.isEmpty())
 			NSlistBox->setEnabled(true);
-		if (NSlistBox->currentText() != tr("default"))
-			DeleteButton->setEnabled(true);
-		else
-			DeleteButton->setEnabled(false);
 	}
 	NSlistBox->blockSignals(wasSignalsBlocked);
 	
-	DeleteButton->setEnabled(NSlistBox->currentText() != tr("default"));
+	DeleteButton->setEnabled(!isDefaultNotesStyle(NSlistBox->currentText()));
+}
+
+bool NotesStylesEditor::isDefaultNotesStyle(const QString& nsName) const
+{
+	//the default notes style is identified by being the first entry in the
+	//document's list (the same test ScribusDoc::deleteNotesStyle() uses),
+	//not by matching a translated display string against its name
+	if ((m_Doc == nullptr) || m_Doc->m_docNotesStylesList.isEmpty())
+		return false;
+	NotesStyle* ns = m_Doc->getNotesStyle(nsName);
+	return (ns != nullptr) && (ns == m_Doc->m_docNotesStylesList.at(0));
 }
 
 void NotesStylesEditor::setBlockSignals(bool block)
@@ -183,7 +190,7 @@
 	setBlockSignals(true);
 	NSlistBox->setCurrentIndex(NSlistBox->findText(NS->name()));
 	NewNameEdit->setText(NS->name());
-	if (NS->name() == tr("default"))
+	if (isDefaultNotesStyle(NS->name()))
 		NewNameEdit->setEnabled(false);
 	else
 		NewNameEdit->setEnabled(true);
@@ -222,7 +229,7 @@
 
 void NotesStylesEditor::on_NSlistBox_currentTextChanged(const QString &arg1)
 {
-	DeleteButton->setEnabled(arg1 != tr("default"));
+	DeleteButton->setEnabled(!isDefaultNotesStyle(arg1));
 	readNotesStyle(arg1);
 }
 
Index: scribus/ui/notesstyleseditor.h
===================================================================
--- scribus/ui/notesstyleseditor.h	(revision 27767)
+++ scribus/ui/notesstyleseditor.h	(working copy)
@@ -31,6 +31,7 @@
 	void readNotesStyle(const QString& nsName);
 	void changeNotesStyle();
 	void setBlockSignals(bool block);
+	bool isDefaultNotesStyle(const QString& nsName) const;
 
 public slots:
 	void setDoc(ScribusDoc *doc);
PatchYes

Activities

Issue History

Date Modified Username Field Change
2026-08-09 04:34 buttar New Issue
2026-08-09 04:34 buttar File Added: notesstyleseditor_A_default_identity_fix.patch