View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017915 | Scribus | Text Frames / Story Editor | public | 2026-08-09 04:34 | 2026-08-09 04:34 |
| Reporter | buttar | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | N/A |
| Status | new | Resolution | open | ||
| Platform | Linux | OS | Fedora Workstation | OS Version | 44 |
| Product Version | 1.7.4.svn | ||||
| Summary | 0017915: [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. | ||||
| Tags | No 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);
| ||||
| Patch | Yes | ||||