Git commit 1e259851d079f32437b90f5900dc752cbeec6374 by Robby Stephenson. Committed on 07/09/2026 at 01:05. Pushed by rstephenson into branch '4.3'.
Add config option to disable ISBN auto-formatting M +5 -1 ChangeLog M +15 -0 doc/hacking.docbook M +3 -0 src/config/tellico_config.kcfg M +1 -2 src/fetch/hardcoverfetcher.cpp M +2 -0 src/mainwindow.cpp M +3 -1 src/utils/isbnvalidator.cpp M +3 -0 src/utils/isbnvalidator.h https://invent.kde.org/office/tellico/-/commit/1e259851d079f32437b90f5900dc752cbeec6374 diff --git a/ChangeLog b/ChangeLog index ca2b194b6..3fdedace1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2026-09-06 Robby Stephenson <[email protected]> + + * Added config option to disable ISBN auto-formatting. + 2026-08-30 Robby Stephenson <[email protected]> - * Fix IMDB search to include all certificates (Bug 525019). + * Fixed IMDB search to include all certificates (Bug 525019). 2026-08-29 Robby Stephenson <[email protected]> diff --git a/doc/hacking.docbook b/doc/hacking.docbook index 4bc65c28c..dba6084e5 100644 --- a/doc/hacking.docbook +++ b/doc/hacking.docbook @@ -327,6 +327,21 @@ The maximum amount of memory in bytes used for caching all the images may be cha </informalexample> </sect3> +<sect3> +<title>Auto ISBN Formatting</title> + +<para> +Tellico auto-formats ISBN values according to this setting. The default value is <emphasis>true</emphasis>. +</para> +</sect3> + +<sect3> + <title>Example</title> + <informalexample> + <para><userinput>Format ISBN=false</userinput></para> + </informalexample> +</sect3> + </sect2> <sect2 id="hidden-bibtex-options"> diff --git a/src/config/tellico_config.kcfg b/src/config/tellico_config.kcfg index 32c49352f..18d619a3f 100644 --- a/src/config/tellico_config.kcfg +++ b/src/config/tellico_config.kcfg @@ -75,6 +75,9 @@ <entry key="Auto Format" type="Bool"> <default>true</default> </entry> + <entry key="Format ISBN" type="Bool"> + <default>true</default> + </entry> <entry key="Last Open File" type="String"/> <entry key="No Capitalization" name="noCapitalizationString" type="String"> <default code="true">i18nc("comma-separated list of words ignored by auto-capitalize", "a,an,and,as,at,but,by,for,from,in,into,nor,of,off,on,onto,or,out,over,the,to,up,with")</default> diff --git a/src/fetch/hardcoverfetcher.cpp b/src/fetch/hardcoverfetcher.cpp index 087f93386..8b16999f8 100644 --- a/src/fetch/hardcoverfetcher.cpp +++ b/src/fetch/hardcoverfetcher.cpp @@ -270,8 +270,7 @@ Tellico::Data::EntryPtr HardcoverFetcher::fetchEntryHook(uint uid_) { const QString isbnName = QStringLiteral("isbn"); QString isbn = entry->field(isbnName); - ISBNValidator val; - val.fixup(isbn); + ISBNValidator::staticFixup(isbn); entry->setField(isbnName, isbn); // image might still be a URL diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7b688aff1..51c2b94b9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -78,6 +78,7 @@ #include "utils/tellico_utils.h" #include "utils/bibtexhandler.h" // needed for bibtex options #include "utils/datafileregistry.h" +#include "utils/isbnvalidator.h" #include "tellico_debug.h" #include <KComboBox> @@ -1136,6 +1137,7 @@ void MainWindow::readOptions() { m_groupView->setSorting(sortOrder, sortRole); BibtexHandler::s_quoteStyle = Config::useBraces() ? BibtexHandler::BRACES : BibtexHandler::QUOTES; + ISBNValidator::s_validateOnly = !Config::formatISBN(); // the validate only is opposite logic // Don't read any options for the edit dialog here, since it's not yet initialized. // Put them in init() diff --git a/src/utils/isbnvalidator.cpp b/src/utils/isbnvalidator.cpp index 145c65014..905e56323 100644 --- a/src/utils/isbnvalidator.cpp +++ b/src/utils/isbnvalidator.cpp @@ -31,6 +31,8 @@ using Tellico::ISBNValidator; +bool ISBNValidator::s_validateOnly = false; + //static QString ISBNValidator::isbn10(QString isbn13) { QString original = isbn13; @@ -101,7 +103,7 @@ QString ISBNValidator::cleanValue(QString isbn) { } ISBNValidator::ISBNValidator(QObject* parent_) - : QValidator(parent_), m_allowMultiple(false), m_validateOnly(false) { + : QValidator(parent_), m_allowMultiple(false), m_validateOnly(s_validateOnly) { } void ISBNValidator::setAllowMultiple(bool allow_) { diff --git a/src/utils/isbnvalidator.h b/src/utils/isbnvalidator.h index d8688eb36..92346af83 100644 --- a/src/utils/isbnvalidator.h +++ b/src/utils/isbnvalidator.h @@ -143,6 +143,9 @@ public: // returns the values in list1 that are not in list2 static QStringList listDifference(const QStringList& list1, const QStringList& list2); + // default setting, can be set through config option + static bool s_validateOnly; + private: struct isbn_band { unsigned long MaxValue;
