Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kf6-sonnet for openSUSE:Factory checked in at 2026-11-16 09:07:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kf6-sonnet (Old) and /work/SRC/openSUSE:Factory/.kf6-sonnet.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kf6-sonnet" Mon Nov 16 09:07:20 2026 rev:33 rq:1397464 version:6.32.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kf6-sonnet/kf6-sonnet.changes 2026-10-11 15:19:23.975954806 +0200 +++ /work/SRC/openSUSE:Factory/.kf6-sonnet.new.1251/kf6-sonnet.changes 2026-11-16 09:10:59.185127734 +0100 @@ -1,0 +2,25 @@ +Sun Nov 8 10:36:32 UTC 2026 - Christophe Marin <[email protected]> + +- Update to 6.32.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/frameworks/6/6.32.0 +- Changes since 6.31.0: + * Update dependency version to 6.32.0 + * core/settings: Add restore function to revert changes + * Unexport, devirtualize and de-pimpl Sonnet::TextBreaks + * Remove unimplemented methods + * Use a dedicated trigram type for language detection + * Add view-based speller API overloads + * Use QStringView in the spell checker plugin interface + * List dictionary languages only once when guessing language + * aspell: Reduce allocation by half during spellchecking + * Make plugins findable prior to installation + * Don't leak Voikko instance + * Actually build manual tests + * Add missing docs + * quick: Don't use red text when we can have squiggly line + * Unify static and dynamic plugin loading + * Update version to 6.32.0 + +------------------------------------------------------------------- Old: ---- sonnet-6.31.0.tar.xz sonnet-6.31.0.tar.xz.sig New: ---- sonnet-6.32.0.tar.xz sonnet-6.32.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kf6-sonnet.spec ++++++ --- /var/tmp/diff_new_pack.ED9rgR/_old 2026-11-16 09:10:59.917158424 +0100 +++ /var/tmp/diff_new_pack.ED9rgR/_new 2026-11-16 09:10:59.919158508 +0100 @@ -16,14 +16,14 @@ # -%define qt6_version 6.9.0 +%define qt6_version 6.10.0 %define rname sonnet -# Full KF6 version (e.g. 6.31.0) +# Full KF6 version (e.g. 6.32.0) %{!?_kf6_version: %global _kf6_version %{version}} %bcond_without released Name: kf6-sonnet -Version: 6.31.0 +Version: 6.32.0 Release: 0 Summary: KDE spell checking library License: LGPL-2.1-or-later ++++++ sonnet-6.31.0.tar.xz -> sonnet-6.32.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/.kde-ci.yml new/sonnet-6.32.0/.kde-ci.yml --- old/sonnet-6.31.0/.kde-ci.yml 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/.kde-ci.yml 2026-11-07 16:31:24.000000000 +0100 @@ -5,7 +5,7 @@ Options: test-before-installing: True - require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows'] + require-passing-tests-on: ['Linux'] cmake-options: -DBUILD_EXAMPLES=ON enable-lsan: True run-installed-library-check-on: ['@all'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/CMakeLists.txt new/sonnet-6.32.0/CMakeLists.txt --- old/sonnet-6.31.0/CMakeLists.txt 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.30) -set(KF_VERSION "6.31.0") # handled by release scripts +set(KF_VERSION "6.32.0") # handled by release scripts project(Sonnet VERSION ${KF_VERSION}) include(FeatureSummary) include(CMakeDependentOption) -find_package(ECM 6.31.0 NO_MODULE) +find_package(ECM 6.32.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -61,15 +61,15 @@ QT 6.11.0 ) -if (NOT BUILD_SHARED_LIBS) - add_definitions(-DSONNET_STATIC) -endif() +# make plugins findable prior to installation for tests +set(SONNET_PLUGIN_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/kf6/sonnet") add_subdirectory(data) add_subdirectory(src) if (BUILD_TESTING) add_subdirectory(autotests) + add_subdirectory(tests) endif() cmake_dependent_option(BUILD_EXAMPLES "Whether to build the examples" OFF "SONNET_USE_WIDGETS" OFF) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/poqm/ia/sonnet6_qt.po new/sonnet-6.32.0/poqm/ia/sonnet6_qt.po --- old/sonnet-6.31.0/poqm/ia/sonnet6_qt.po 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/poqm/ia/sonnet6_qt.po 2026-11-07 16:31:24.000000000 +0100 @@ -4395,10 +4395,10 @@ #~ msgstr "Insimul de Characteres" #~ msgid "Repeats, Zero or More Times" -#~ msgstr "Repite, Zero o Multe Vices" +#~ msgstr "Repete, Zero o Multe Vices" #~ msgid "Repeats, One or More Times" -#~ msgstr "Il Repite, uno o multe Vices" +#~ msgstr "Il Repete, uno o multe Vices" #~ msgid "Optional" #~ msgstr "Optional" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/poqm/ru/sonnet6_qt.po new/sonnet-6.32.0/poqm/ru/sonnet6_qt.po --- old/sonnet-6.31.0/poqm/ru/sonnet6_qt.po 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/poqm/ru/sonnet6_qt.po 2026-11-07 16:31:24.000000000 +0100 @@ -181,8 +181,8 @@ msgctxt "SonnetConfigUI|" msgid "No backend like hunspell/aspell/myspell installed" msgstr "" -"Не установлено ни одной системы проверки орфографии: hunspell, aspell или " -"myspell" +"Не установлено ни одной системы проверки орфографии (hunspell, aspell или " +"myspell)" #: ui/configui.ui:35 msgctxt "SonnetConfigUI|" @@ -197,7 +197,7 @@ #: ui/configui.ui:79 msgctxt "SonnetConfigUI|" msgid "Choose your preferred languages" -msgstr "Выберите предпочитаемый язык" +msgstr "Выберите предпочитаемые языки" #: ui/configui.ui:89 msgctxt "SonnetConfigUI|" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/backgroundchecker.cpp new/sonnet-6.32.0/src/core/backgroundchecker.cpp --- old/sonnet-6.31.0/src/core/backgroundchecker.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/backgroundchecker.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -35,7 +35,7 @@ } // ok, this is valid word, do something - if (currentDict.isMisspelled(word.toString())) { + if (currentDict.isMisspelled(word.token)) { lastMisspelled = word; Q_EMIT misspelling(word.toString(), word.position() + sentenceOffset); return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/guesslanguage.cpp new/sonnet-6.32.0/src/core/guesslanguage.cpp --- old/sonnet-6.31.0/src/core/guesslanguage.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/guesslanguage.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -18,6 +18,7 @@ #include "speller.h" #include "spellerplugin_p.h" #include "tokenizer_p.h" +#include "trigram_p.h" /* All language tags should be valid according to IETF BCP 47, as codified in RFC 4646. @@ -53,8 +54,8 @@ void loadModels(); QList<QChar::Script> findRuns(const QString &text); - QList<QString> createOrderedModel(const QString &content); - int distance(const QList<QString> &model, const QHash<QString, int> &knownModel); + QList<Trigram> createOrderedModel(QStringView content); + int distance(const QList<Trigram> &model, const QHash<QString, int> &knownModel); QStringList guessFromTrigrams(const QString &sample, const QStringList &langs); QStringList identify(const QString &sample, const QList<QChar::Script> &scripts); QString guessFromDictionaries(const QString &sentence, const QStringList &candidates); @@ -717,7 +718,7 @@ { QStringList ret; - const QList<QString> sampleTrigrams = createOrderedModel(sample); + const QList<Trigram> sampleTrigrams = createOrderedModel(sample); // Sort by score QMultiMap<int, QString> scores; @@ -757,39 +758,36 @@ return ret; } -QList<QString> GuessLanguagePrivate::createOrderedModel(const QString &content) +QList<Trigram> GuessLanguagePrivate::createOrderedModel(QStringView content) { - QHash<QString, int> trigramCounts; + QHash<Trigram, int> trigramCounts; // collect trigrams trigramCounts.reserve(content.size() - 2); for (int i = 0; i < (content.size() - 2); ++i) { - QString tri = content.mid(i, 3).toLower(); + Trigram tri(content.mid(i, 3)); trigramCounts[tri]++; } // invert the map <freq, trigram> - QList<QPair<int, QString>> trigramFrequencyList; + QList<QPair<int, Trigram>> trigramFrequencyList; trigramFrequencyList.reserve(trigramCounts.size()); auto it = trigramCounts.constBegin(); for (; it != trigramCounts.constEnd(); ++it) { - const QChar *data = it.key().constData(); - bool hasTwoSpaces = (data[1].isSpace() && (data[0].isSpace() || data[2].isSpace())); - - if (!hasTwoSpaces) { + if (!it.key().hasTwoConsecutiveSpaces()) { const int freq = it.value(); - const QString &trigram = it.key(); + const Trigram &trigram = it.key(); trigramFrequencyList.append({freq, trigram}); } } // sort descending by frequency - std::sort(trigramFrequencyList.begin(), trigramFrequencyList.end(), [](const QPair<int, QString> &a, const QPair<int, QString> &b) { + std::sort(trigramFrequencyList.begin(), trigramFrequencyList.end(), [](const QPair<int, Trigram> &a, const QPair<int, Trigram> &b) { return a.first > b.first; }); - QList<QString> orderedTrigrams; + QList<Trigram> orderedTrigrams; orderedTrigrams.reserve(trigramFrequencyList.size()); for (const auto &tri : std::as_const(trigramFrequencyList)) { orderedTrigrams.append(tri.second); @@ -798,13 +796,13 @@ return orderedTrigrams; } -int GuessLanguagePrivate::distance(const QList<QString> &model, const QHash<QString, int> &knownModel) +int GuessLanguagePrivate::distance(const QList<Trigram> &model, const QHash<QString, int> &knownModel) { int counter = -1; int dist = 0; - for (const QString &trigram : model) { - const int val = knownModel.value(trigram, -1); + for (const auto &trigram : model) { + const int val = knownModel.value(QStringView(trigram), -1); if (val != -1) { dist += qAbs(++counter - val); } else { @@ -822,9 +820,10 @@ QString GuessLanguagePrivate::guessFromDictionaries(const QString &sentence, const QStringList &candidates) { // Try to see how many languages we can get spell checking for + const auto spellerLanguages = Loader::openLoader()->languages(); QList<QSharedPointer<SpellerPlugin>> spellers; for (const QString &lang : candidates) { - if (!Loader::openLoader()->languages().contains(lang)) { + if (!spellerLanguages.contains(lang)) { qCWarning(SONNET_LOG_CORE) << "Dictionary asked for invalid speller" << lang; continue; } @@ -849,7 +848,7 @@ } for (int i = 0; i < spellers.count(); ++i) { - if (spellers[i]->isCorrect(word.toString())) { + if (spellers[i]->isCorrect(word.token)) { correctHits[spellers[i]->language()]++; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/loader.cpp new/sonnet-6.32.0/src/core/loader.cpp --- old/sonnet-6.31.0/src/core/loader.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/loader.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -262,7 +262,6 @@ void Loader::loadPlugins() { -#ifndef SONNET_STATIC const QStringList libPaths = QCoreApplication::libraryPaths() << QStringLiteral(INSTALLATION_PLUGIN_PATH); const QString pathSuffix(QStringLiteral("/kf6/sonnet/")); for (const QString &libPath : libPaths) { @@ -275,16 +274,15 @@ } } - if (d->loadedPlugins.isEmpty()) { - qCWarning(SONNET_LOG_CORE) << "Sonnet: No speller backends available!"; - } -#else for (auto plugin : QPluginLoader::staticPlugins()) { if (plugin.metaData()[QLatin1String("IID")].toString() == QLatin1String("org.kde.sonnet.Client")) { loadPlugin(plugin); } } -#endif + + if (d->loadedPlugins.isEmpty()) { + qCWarning(SONNET_LOG_CORE) << "Sonnet: No speller backends available!"; + } } void Loader::loadPlugin(const QStaticPlugin &plugin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/settings.cpp new/sonnet-6.32.0/src/core/settings.cpp --- old/sonnet-6.31.0/src/core/settings.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/settings.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -269,6 +269,27 @@ Q_EMIT modifiedChanged(); } +void Settings::restore() +{ + d->loader->settings()->restore(); + + if (d->dictionaryModel) { + d->dictionaryModel->reload(); + d->dictionaryModel->setDefaultLanguage(defaultLanguage()); + } + + Q_EMIT skipUppercaseChanged(); + Q_EMIT autodetectLanguageChanged(); + Q_EMIT backgroundCheckerEnabledChanged(); + Q_EMIT defaultClientChanged(); + Q_EMIT defaultLanguageChanged(); + Q_EMIT preferredLanguagesChanged(); + Q_EMIT skipRunTogetherChanged(); + Q_EMIT checkerEnabledByDefaultChanged(); + Q_EMIT currentIgnoreListChanged(); + Q_EMIT modifiedChanged(); +} + bool Settings::modified() const { return d->loader->settings()->modified(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/settings.h new/sonnet-6.32.0/src/core/settings.h --- old/sonnet-6.31.0/src/core/settings.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/settings.h 2026-11-07 16:31:24.000000000 +0100 @@ -101,13 +101,60 @@ */ Q_PROPERTY(bool modified READ modified NOTIFY modifiedChanged) + /*! + * \property Sonnet::Settings::defaultIgnoreList + * + * This property holds the default value for the currentIgnoreList property. + */ Q_PROPERTY(QStringList defaultIgnoreList READ defaultIgnoreList CONSTANT) + + /*! + * \property Sonnet::Settings::defaultSkipUppercase + * + * This property holds the default value for the skipUppercase property. + */ Q_PROPERTY(bool defaultSkipUppercase READ defaultSkipUppercase CONSTANT) + + /*! + * \property Sonnet::Settings::defaultAutodetectLanguage + * + * This property holds the default value for the autoDetectLanguage property. + */ Q_PROPERTY(bool defaultAutodetectLanguage READ defaultAutodetectLanguage CONSTANT) + + /*! + * \property Sonnet::Settings::defaultBackgroundCheckerEnabled + * + * This property holds the default value for the backgroundCheckerEnabled property. + */ Q_PROPERTY(bool defaultBackgroundCheckerEnabled READ defaultBackgroundCheckerEnabled CONSTANT) + + /*! + * \property Sonnet::Settings::defaultCheckerEnabledByDefault + * + * This property holds the default value for the list checkerEnabledByDefault property. + */ Q_PROPERTY(bool defaultCheckerEnabledByDefault READ defaultCheckerEnabledByDefault CONSTANT) + + /*! + * \property Sonnet::Settings::defaultSkipRunTogether + * + * This property holds the default value for the skipRunTogether property. + */ Q_PROPERTY(bool defaultSkipRunTogether READ defaultSkipRunTogether CONSTANT) + + /*! + * \property Sonnet::Settings::defaultDefaultLanguage + * + * This property holds the default value for the defaultLanguage property. + */ Q_PROPERTY(QString defaultDefaultLanguage READ defaultDefaultLanguage CONSTANT) + + /*! + * \property Sonnet::Settings::defaultPreferredLanguages + * + * This property holds the default value for the preferredLanguages property. + */ Q_PROPERTY(QStringList defaultPreferredLanguages READ defaultPreferredLanguages CONSTANT) public: @@ -179,6 +226,13 @@ */ Q_INVOKABLE void save(); + /*! + * Discards all unsaved changes and reloads the settings from the saved configuration. + * + * \since 6.32 + */ + Q_INVOKABLE void restore(); + [[nodiscard]] static QStringList defaultIgnoreList(); [[nodiscard]] static bool defaultSkipUppercase(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/settingsimpl.cpp new/sonnet-6.32.0/src/core/settingsimpl.cpp --- old/sonnet-6.31.0/src/core/settingsimpl.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/settingsimpl.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -264,6 +264,9 @@ const QString ignoreEntry = QStringLiteral("ignore_%1").arg(d->defaultLanguage); const QStringList ignores = settings.value(ignoreEntry, Settings::defaultIgnoreList()).toStringList(); setQuietIgnoreList(ignores); + + d->modified = false; + d->loader->changed(); } bool SettingsImpl::modified() const diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/speller.cpp new/sonnet-6.32.0/src/core/speller.cpp --- old/sonnet-6.31.0/src/core/speller.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/speller.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -90,6 +90,11 @@ bool Speller::isCorrect(const QString &word) const { + return isCorrect(QStringView(word)); +} + +bool Speller::isCorrect(QStringView word) const +{ if (!d->isValid()) { return true; } @@ -98,6 +103,11 @@ bool Speller::isMisspelled(const QString &word) const { + return isMisspelled(QStringView(word)); +} + +bool Speller::isMisspelled(QStringView word) const +{ if (!d->isValid()) { return false; } @@ -106,6 +116,11 @@ QStringList Speller::suggest(const QString &word) const { + return suggest(QStringView(word)); +} + +QStringList Speller::suggest(QStringView word) const +{ if (!d->isValid()) { return QStringList(); } @@ -114,6 +129,11 @@ bool Speller::checkAndSuggest(const QString &word, QStringList &suggestions) const { + return checkAndSuggest(QStringView(word), suggestions); +} + +bool Speller::checkAndSuggest(QStringView word, QStringList &suggestions) const +{ if (!d->isValid()) { return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/speller.h new/sonnet-6.32.0/src/core/speller.h --- old/sonnet-6.31.0/src/core/speller.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/speller.h 2026-11-07 16:31:24.000000000 +0100 @@ -55,28 +55,57 @@ /*! * Checks the given word. - * Returns false if the word is misspelled. true otherwise + * \return \c false if the word is misspelled, \c true otherwise */ - bool isCorrect(const QString &word) const; + [[nodiscard]] bool isCorrect(const QString &word) const; + /*! + * Checks the given word. + * \return \c false if the word is misspelled, \c true otherwise + * + * \since 6.32 + */ + [[nodiscard]] bool isCorrect(QStringView word) const; /*! * Checks the given word. - * Returns true if the word is misspelled. false otherwise + * \return \c true if the word is misspelled, \c false otherwise */ - bool isMisspelled(const QString &word) const; + [[nodiscard]] bool isMisspelled(const QString &word) const; + /*! + * Checks the given word. + * \return \c true if the word is misspelled, \c false otherwise + * + * \since 6.32 + */ + [[nodiscard]] bool isMisspelled(QStringView word) const; /*! * Fetches suggestions for the word. * - * Returns list of all suggestions for the word + * \return list of all suggestions for the word + */ + [[nodiscard]] QStringList suggest(const QString &word) const; + /*! + * Fetches suggestions for the word. + * + * \return list of all suggestions for the word + * + * \since 6.32 */ - QStringList suggest(const QString &word) const; + [[nodiscard]] QStringList suggest(QStringView word) const; /*! * Convenience method calling isCorrect() and suggest() * if the word isn't correct. */ bool checkAndSuggest(const QString &word, QStringList &suggestions) const; + /*! + * Convenience method calling isCorrect() and suggest() + * if the word isn't correct. + * + * \since 6.32 + */ + bool checkAndSuggest(QStringView word, QStringList &suggestions) const; /*! * Stores user defined good replacement for the bad word. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/spellerplugin.cpp new/sonnet-6.32.0/src/core/spellerplugin.cpp --- old/sonnet-6.31.0/src/core/spellerplugin.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/spellerplugin.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -26,12 +26,12 @@ return d->language; } -bool SpellerPlugin::isMisspelled(const QString &word) const +bool SpellerPlugin::isMisspelled(QStringView word) const { return !isCorrect(word); } -bool SpellerPlugin::checkAndSuggest(const QString &word, QStringList &suggestions) const +bool SpellerPlugin::checkAndSuggest(QStringView word, QStringList &suggestions) const { bool c = isCorrect(word); if (!c) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/spellerplugin_p.h new/sonnet-6.32.0/src/core/spellerplugin_p.h --- old/sonnet-6.31.0/src/core/spellerplugin_p.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/spellerplugin_p.h 2026-11-07 16:31:24.000000000 +0100 @@ -32,26 +32,26 @@ * Checks the given word. * Returns false if the word is misspelled. true otherwise */ - virtual bool isCorrect(const QString &word) const = 0; + virtual bool isCorrect(QStringView word) const = 0; /*! * Checks the given word. * Returns true if the word is misspelled. false otherwise */ - bool isMisspelled(const QString &word) const; + bool isMisspelled(QStringView word) const; /*! * Fetches suggestions for the word. * * Returns list of all suggestions for the word */ - virtual QStringList suggest(const QString &word) const = 0; + virtual QStringList suggest(QStringView word) const = 0; /*! * Convenient method calling isCorrect() and suggest() * if the word isn't correct. */ - virtual bool checkAndSuggest(const QString &word, QStringList &suggestions) const; + virtual bool checkAndSuggest(QStringView word, QStringList &suggestions) const; /*! * Stores user defined good replacement for the bad word. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/textbreaks.cpp new/sonnet-6.32.0/src/core/textbreaks.cpp --- old/sonnet-6.31.0/src/core/textbreaks.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/textbreaks.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -13,18 +13,7 @@ namespace Sonnet { -class TextBreaksPrivate -{ -public: - TextBreaksPrivate() - { - } - - QString text; -}; - TextBreaks::TextBreaks(const QString &text) - : d(new TextBreaksPrivate()) { setText(text); } @@ -33,12 +22,12 @@ QString TextBreaks::text() const { - return d->text; + return m_text; } void TextBreaks::setText(const QString &text) { - d->text = text; + m_text = text; } TextBreaks::Positions TextBreaks::wordBreaks(const QString &text) @@ -106,11 +95,11 @@ TextBreaks::Positions TextBreaks::wordBreaks() const { - return wordBreaks(d->text); + return wordBreaks(m_text); } TextBreaks::Positions TextBreaks::sentenceBreaks() const { - return sentenceBreaks(d->text); + return sentenceBreaks(m_text); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/textbreaks_p.h new/sonnet-6.32.0/src/core/textbreaks_p.h --- old/sonnet-6.31.0/src/core/textbreaks_p.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/core/textbreaks_p.h 2026-11-07 16:31:24.000000000 +0100 @@ -7,13 +7,8 @@ #ifndef TEXTBREAKS_H #define TEXTBREAKS_H -class QString; - -#include "sonnetcore_export.h" - #include <QList> - -#include <memory> +#include <QString> namespace Sonnet { @@ -31,7 +26,7 @@ * * \since 4.3 */ -class SONNETCORE_EXPORT TextBreaks +class TextBreaks { public: struct Position { @@ -51,9 +46,9 @@ */ explicit TextBreaks(const QString &text = QString()); - /*! Virtual Destructor + /*! Destructor */ - virtual ~TextBreaks(); + ~TextBreaks(); /*! * Returns the text to be checked @@ -86,16 +81,16 @@ * Return the Positions of each word for the text previously set. * Returns positions of breaks */ - virtual Positions wordBreaks() const; + Positions wordBreaks() const; /*! * Return the Positions of each sentence for the text previously set. * Returns positions of breaks */ - virtual Positions sentenceBreaks() const; + Positions sentenceBreaks() const; private: - std::unique_ptr<TextBreaksPrivate> const d; + QString m_text; }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/core/trigram_p.h new/sonnet-6.32.0/src/core/trigram_p.h --- old/sonnet-6.31.0/src/core/trigram_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/sonnet-6.32.0/src/core/trigram_p.h 2026-11-07 16:31:24.000000000 +0100 @@ -0,0 +1,51 @@ +/* + SPDX-FileCopyrightText: 2026 Volker Krause <[email protected]> + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef SONNET_TRIGRAM_P_H +#define SONNET_TRIGRAM_P_H + +#include <QChar> + +namespace Sonnet +{ + +/** A trigram for language detection. */ +class Trigram +{ +public: + explicit Trigram(QStringView s) + { + Q_ASSERT(s.size() == 3); + trigram[0] = s[0].toCaseFolded(); + trigram[1] = s[1].toCaseFolded(); + trigram[2] = s[2].toCaseFolded(); + } + + /** Trigram contains to consecutive whitespaces. */ + [[nodiscard]] bool hasTwoConsecutiveSpaces() const + { + return trigram[1].isSpace() && (trigram[0].isSpace() || trigram[2].isSpace()); + } + + [[nodiscard]] std::strong_ordering operator<=>(const Trigram &other) const + { + return QStringView(trigram) <=> QStringView(other.trigram); + } + [[nodiscard]] bool operator==(const Trigram &other) const + { + return QStringView(trigram) == QStringView(other.trigram); + } + + constexpr operator QStringView() const + { + return QStringView(trigram); + } + +private: + QChar trigram[3]; +}; +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/aspell/CMakeLists.txt new/sonnet-6.32.0/src/plugins/aspell/CMakeLists.txt --- old/sonnet-6.31.0/src/plugins/aspell/CMakeLists.txt 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/aspell/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -17,6 +17,7 @@ ) target_link_libraries(sonnet_aspell PRIVATE KF6::SonnetCore ${ASPELL_LIBRARIES}) +set_target_properties(sonnet_aspell PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${SONNET_PLUGIN_OUTPUT_DIRECTORY}) install(TARGETS sonnet_aspell DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/sonnet/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/aspell/aspelldict.cpp new/sonnet-6.32.0/src/plugins/aspell/aspelldict.cpp --- old/sonnet-6.31.0/src/plugins/aspell/aspelldict.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/aspell/aspelldict.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -44,18 +44,19 @@ delete_aspell_config(m_config); } -bool ASpellDict::isCorrect(const QString &word) const +bool ASpellDict::isCorrect(QStringView word) const { /* ASpell is expecting length of a string in char representation */ /* word.length() != word.toUtf8().length() for nonlatin strings */ if (!m_speller) { return false; } - int correct = aspell_speller_check(m_speller, word.toUtf8().constData(), word.toUtf8().length()); + const auto utf8Word = word.toUtf8(); + int correct = aspell_speller_check(m_speller, utf8Word.constData(), utf8Word.length()); return correct; } -QStringList ASpellDict::suggest(const QString &word) const +QStringList ASpellDict::suggest(QStringView word) const { if (!m_speller) { return QStringList(); @@ -63,7 +64,8 @@ /* ASpell is expecting length of a string in char representation */ /* word.length() != word.toUtf8().length() for nonlatin strings */ - const AspellWordList *suggestions = aspell_speller_suggest(m_speller, word.toUtf8().constData(), word.toUtf8().length()); + const auto utf8Word = word.toUtf8(); + const AspellWordList *suggestions = aspell_speller_suggest(m_speller, utf8Word.constData(), utf8Word.length()); AspellStringEnumeration *elements = aspell_word_list_elements(suggestions); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/aspell/aspelldict.h new/sonnet-6.32.0/src/plugins/aspell/aspelldict.h --- old/sonnet-6.31.0/src/plugins/aspell/aspelldict.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/aspell/aspelldict.h 2026-11-07 16:31:24.000000000 +0100 @@ -17,9 +17,9 @@ public: explicit ASpellDict(const QString &lang); ~ASpellDict() override; - bool isCorrect(const QString &word) const override; + bool isCorrect(QStringView word) const override; - QStringList suggest(const QString &word) const override; + QStringList suggest(QStringView word) const override; bool storeReplacement(const QString &bad, const QString &good) override; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/hspell/CMakeLists.txt new/sonnet-6.32.0/src/plugins/hspell/CMakeLists.txt --- old/sonnet-6.31.0/src/plugins/hspell/CMakeLists.txt 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/hspell/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -26,6 +26,7 @@ ) target_link_libraries(sonnet_hspell PRIVATE KF6::SonnetCore ${HSPELL_LIBRARIES} ZLIB::ZLIB) +set_target_properties(sonnet_hspell PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${SONNET_PLUGIN_OUTPUT_DIRECTORY}) install(TARGETS sonnet_hspell DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/sonnet/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/hspell/hspelldict.cpp new/sonnet-6.32.0/src/plugins/hspell/hspelldict.cpp --- old/sonnet-6.31.0/src/plugins/hspell/hspelldict.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/hspell/hspelldict.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -32,7 +32,9 @@ QSettings settings(QStringLiteral("KDE"), QStringLiteral("SonnetHSpellPlugin")); const QStringList personalWordsList = settings.value(QStringLiteral("PersonalWords"), QStringList()).toStringList(); - m_personalWords = QSet<QString>(personalWordsList.begin(), personalWordsList.end()); + for (const auto &word : personalWordsList) { + m_personalWords.insert(word, QHashDummyValue{}); + } QVariantHash replacementMap = settings.value(QStringLiteral("Replacements"), QVariant()).toHash(); for (const QString &key : replacementMap.keys()) { m_replacements[key] = replacementMap[key].toString(); @@ -47,7 +49,7 @@ } } -bool HSpellDict::isCorrect(const QString &word) const +bool HSpellDict::isCorrect(QStringView word) const { if (m_sessionWords.contains(word)) { return true; @@ -78,7 +80,7 @@ return correct == 1; } -QStringList HSpellDict::suggest(const QString &word) const +QStringList HSpellDict::suggest(QStringView word) const { QStringList suggestions; @@ -107,21 +109,21 @@ bool HSpellDict::addToPersonal(const QString &word) { - m_personalWords.insert(word); + m_personalWords.insert(word, QHashDummyValue{}); storePersonalWords(); return true; } bool HSpellDict::addToSession(const QString &word) { - m_sessionWords.insert(word); + m_sessionWords.insert(word, QHashDummyValue{}); return true; } void HSpellDict::storePersonalWords() { QSettings settings(QStringLiteral("KDE"), QStringLiteral("SonnetHSpellPlugin")); - const QStringList personalWordsList(m_personalWords.begin(), m_personalWords.end()); + const QStringList personalWordsList = m_personalWords.keys(); settings.setValue(QStringLiteral("PersonalWords"), QVariant(personalWordsList)); QVariantHash variantHash; for (const QString &key : m_replacements.keys()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/hspell/hspelldict.h new/sonnet-6.32.0/src/plugins/hspell/hspelldict.h --- old/sonnet-6.31.0/src/plugins/hspell/hspelldict.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/hspell/hspelldict.h 2026-11-07 16:31:24.000000000 +0100 @@ -24,9 +24,9 @@ public: explicit HSpellDict(const QString &lang); ~HSpellDict(); - bool isCorrect(const QString &word) const override; + bool isCorrect(QStringView word) const override; - QStringList suggest(const QString &word) const override; + QStringList suggest(QStringView word) const override; bool storeReplacement(const QString &bad, const QString &good) override; @@ -44,8 +44,8 @@ mutable QStringDecoder m_decoder; mutable QStringEncoder m_encoder; bool initialized; - QSet<QString> m_sessionWords; - QSet<QString> m_personalWords; + QHash<QString, QHashDummyValue> m_sessionWords; // QSet doesn't support heterogeneous lookup + QHash<QString, QHashDummyValue> m_personalWords; QHash<QString, QString> m_replacements; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/hunspell/CMakeLists.txt new/sonnet-6.32.0/src/plugins/hunspell/CMakeLists.txt --- old/sonnet-6.31.0/src/plugins/hunspell/CMakeLists.txt 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/hunspell/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -25,6 +25,7 @@ target_include_directories(sonnet_hunspell SYSTEM PUBLIC ${HUNSPELL_INCLUDE_DIRS}) target_link_libraries(sonnet_hunspell PRIVATE KF6::SonnetCore ${HUNSPELL_LIBRARIES}) +set_target_properties(sonnet_hunspell PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${SONNET_PLUGIN_OUTPUT_DIRECTORY}) target_compile_definitions(sonnet_hunspell PRIVATE DEFINITIONS SONNET_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/hunspell/hunspelldict.cpp new/sonnet-6.32.0/src/plugins/hunspell/hunspelldict.cpp --- old/sonnet-6.31.0/src/plugins/hunspell/hunspelldict.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/hunspell/hunspelldict.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -91,7 +91,7 @@ { } -QByteArray HunspellDict::toDictEncoding(const QString &word) const +QByteArray HunspellDict::toDictEncoding(QStringView word) const { if (m_encoder.isValid()) { return m_encoder.encode(word); @@ -99,7 +99,7 @@ return {}; } -bool HunspellDict::isCorrect(const QString &word) const +bool HunspellDict::isCorrect(QStringView word) const { qCDebug(SONNET_HUNSPELL) << " isCorrect :" << word; if (!m_speller) { @@ -117,7 +117,7 @@ #endif } -QStringList HunspellDict::suggest(const QString &word) const +QStringList HunspellDict::suggest(QStringView word) const { if (!m_speller) { return QStringList(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/hunspell/hunspelldict.h new/sonnet-6.32.0/src/plugins/hunspell/hunspelldict.h --- old/sonnet-6.31.0/src/plugins/hunspell/hunspelldict.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/hunspell/hunspelldict.h 2026-11-07 16:31:24.000000000 +0100 @@ -21,9 +21,9 @@ public: explicit HunspellDict(const QString &name, const std::shared_ptr<Hunspell> &speller); ~HunspellDict() override; - bool isCorrect(const QString &word) const override; + bool isCorrect(QStringView word) const override; - QStringList suggest(const QString &word) const override; + QStringList suggest(QStringView word) const override; bool storeReplacement(const QString &bad, const QString &good) override; @@ -33,7 +33,7 @@ static std::shared_ptr<Hunspell> createHunspell(const QString &lang, QString path); private: - QByteArray toDictEncoding(const QString &word) const; + QByteArray toDictEncoding(QStringView word) const; std::shared_ptr<Hunspell> m_speller; mutable QStringEncoder m_encoder; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/ispellchecker/CMakeLists.txt new/sonnet-6.32.0/src/plugins/ispellchecker/CMakeLists.txt --- old/sonnet-6.31.0/src/plugins/ispellchecker/CMakeLists.txt 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/ispellchecker/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -27,6 +27,7 @@ target_link_libraries(sonnet_ispellchecker PRIVATE KF6::SonnetCore) target_compile_definitions(sonnet_ispellchecker PRIVATE DEFINITIONS SONNET_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") +set_target_properties(sonnet_ispellchecker PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${SONNET_PLUGIN_OUTPUT_DIRECTORY}) install(TARGETS sonnet_ispellchecker DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/sonnet/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/ispellchecker/ispellcheckerdict.cpp new/sonnet-6.32.0/src/plugins/ispellchecker/ispellcheckerdict.cpp --- old/sonnet-6.31.0/src/plugins/ispellchecker/ispellcheckerdict.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/ispellchecker/ispellcheckerdict.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -21,12 +21,20 @@ // we don't own m_spellChecker! } -bool ISpellCheckerDict::isCorrect(const QString &word) const +static std::wstring toStdWString(QStringView str) // only available on QString itself, not on QStringView +{ + std::wstring out; + out.resize(str.size()); + out.resize(str.toWCharArray(out.data())); + return out; +} + +bool ISpellCheckerDict::isCorrect(QStringView word) const { // check if we are incorrect, we only need to check one enum entry for that, only empty enum means OK bool ok = true; IEnumSpellingError *enumSpellingError = nullptr; - if (SUCCEEDED(m_spellChecker->Check(word.toStdWString().c_str(), &enumSpellingError))) { + if (SUCCEEDED(m_spellChecker->Check(toStdWString(word).c_str(), &enumSpellingError))) { ISpellingError *spellingError = nullptr; if (S_OK == enumSpellingError->Next(&spellingError)) { ok = false; @@ -37,12 +45,12 @@ return ok; } -QStringList ISpellCheckerDict::suggest(const QString &word) const +QStringList ISpellCheckerDict::suggest(QStringView word) const { // query suggestions QStringList replacements; IEnumString *words = nullptr; - if (SUCCEEDED(m_spellChecker->Suggest(word.toStdWString().c_str(), &words))) { + if (SUCCEEDED(m_spellChecker->Suggest(toStdWString(word).c_str(), &words))) { HRESULT hr = S_OK; while (S_OK == hr) { LPOLESTR string = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/ispellchecker/ispellcheckerdict.h new/sonnet-6.32.0/src/plugins/ispellchecker/ispellcheckerdict.h --- old/sonnet-6.31.0/src/plugins/ispellchecker/ispellcheckerdict.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/ispellchecker/ispellcheckerdict.h 2026-11-07 16:31:24.000000000 +0100 @@ -16,9 +16,9 @@ public: explicit ISpellCheckerDict(ISpellChecker *spellChecker, const QString &language); ~ISpellCheckerDict() override; - bool isCorrect(const QString &word) const override; + bool isCorrect(QStringView word) const override; - QStringList suggest(const QString &word) const override; + QStringList suggest(QStringView word) const override; bool storeReplacement(const QString &bad, const QString &good) override; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/nsspellchecker/CMakeLists.txt new/sonnet-6.32.0/src/plugins/nsspellchecker/CMakeLists.txt --- old/sonnet-6.31.0/src/plugins/nsspellchecker/CMakeLists.txt 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/nsspellchecker/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -15,6 +15,7 @@ ) target_link_libraries(sonnet_nsspellchecker PRIVATE KF6::SonnetCore "-framework AppKit") +set_target_properties(sonnet_nsspellchecker PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${SONNET_PLUGIN_OUTPUT_DIRECTORY}) install(TARGETS sonnet_nsspellchecker DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/sonnet/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/nsspellchecker/nsspellcheckerdict.h new/sonnet-6.32.0/src/plugins/nsspellchecker/nsspellcheckerdict.h --- old/sonnet-6.31.0/src/plugins/nsspellchecker/nsspellcheckerdict.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/nsspellchecker/nsspellcheckerdict.h 2026-11-07 16:31:24.000000000 +0100 @@ -15,9 +15,9 @@ public: explicit NSSpellCheckerDict(const QString &lang); ~NSSpellCheckerDict(); - virtual bool isCorrect(const QString &word) const; + virtual bool isCorrect(QStringView word) const; - virtual QStringList suggest(const QString &word) const; + virtual QStringList suggest(QStringView word) const; virtual bool storeReplacement(const QString &bad, const QString &good); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/nsspellchecker/nsspellcheckerdict.mm new/sonnet-6.32.0/src/plugins/nsspellchecker/nsspellcheckerdict.mm --- old/sonnet-6.31.0/src/plugins/nsspellchecker/nsspellcheckerdict.mm 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/nsspellchecker/nsspellcheckerdict.mm 2026-11-07 16:31:24.000000000 +0100 @@ -30,7 +30,7 @@ [m_langCode release]; } -bool NSSpellCheckerDict::isCorrect(const QString &word) const +bool NSSpellCheckerDict::isCorrect(QStringView word) const { NSString *nsWord = word.toNSString(); NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; @@ -50,7 +50,7 @@ return false; } -QStringList NSSpellCheckerDict::suggest(const QString &word) const +QStringList NSSpellCheckerDict::suggest(QStringView word) const { NSString *nsWord = word.toNSString(); NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/voikko/CMakeLists.txt new/sonnet-6.32.0/src/plugins/voikko/CMakeLists.txt --- old/sonnet-6.31.0/src/plugins/voikko/CMakeLists.txt 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/voikko/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -17,6 +17,7 @@ target_include_directories(sonnet_voikko PRIVATE ${VOIKKO_INCLUDE_DIR}) target_link_libraries(sonnet_voikko PRIVATE KF6::SonnetCore ${VOIKKO_LIBRARIES}) +set_target_properties(sonnet_voikko PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${SONNET_PLUGIN_OUTPUT_DIRECTORY}) install(TARGETS sonnet_voikko DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/sonnet/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/voikko/voikkodict.cpp new/sonnet-6.32.0/src/plugins/voikko/voikkodict.cpp --- old/sonnet-6.31.0/src/plugins/voikko/voikkodict.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/voikko/voikkodict.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -116,8 +116,8 @@ VoikkoHandle *m_handle; const VoikkoDict *q; - QSet<QString> m_sessionWords; - QSet<QString> m_personalWords; + QHash<QString, QHashDummyValue> m_sessionWords; // QSet doesn't support heterogeneous lookup + QHash<QString, QHashDummyValue> m_personalWords; QHash<QString, QString> m_replacements; QString m_userDictionaryFilepath; @@ -139,6 +139,13 @@ } } + ~VoikkoDictPrivate() + { + if (m_handle) { + voikkoTerminate(m_handle); + } + } + /** * Store a new ignored/personal word or replacement pair in the user's * dictionary m_userDictionaryFilepath. @@ -200,7 +207,7 @@ * Convert the given QString to a \0 terminated wchar_t string. * Uses QList as a buffer and return it's internal data pointer. */ - inline const wchar_t *QStringToWchar(const QString &str) Q_DECL_NOEXCEPT + inline const wchar_t *QStringToWchar(QStringView str) Q_DECL_NOEXCEPT { m_conversionBuffer.resize(str.length() + 1); int size = str.toWCharArray(m_conversionBuffer.data()); @@ -217,7 +224,7 @@ { const auto words = languageNode[personal_words_str()].toArray(); for (auto word : words) { - m_personalWords.insert(word.toString()); + m_personalWords.insert(word.toString(), QHashDummyValue{}); } qCDebug(SONNET_VOIKKO) << QStringLiteral("Loaded %1 words from the user dictionary.").arg(words.size()); } @@ -244,7 +251,7 @@ { } -bool VoikkoDict::isCorrect(const QString &word) const +bool VoikkoDict::isCorrect(QStringView word) const { // Check the session word list and personal word list first if (d->m_sessionWords.contains(word) || d->m_personalWords.contains(word)) { @@ -254,7 +261,7 @@ return voikkoSpellUcs4(d->m_handle, d->QStringToWchar(word)) == VOIKKO_SPELL_OK; } -QStringList VoikkoDict::suggest(const QString &word) const +QStringList VoikkoDict::suggest(QStringView word) const { QStringList suggestions; @@ -290,14 +297,14 @@ bool VoikkoDict::addToPersonal(const QString &word) { qCDebug(SONNET_VOIKKO()) << "Adding new word to user dictionary" << word; - d->m_personalWords.insert(word); + d->m_personalWords.insert(word, QHashDummyValue{}); return d->storePersonal(word); } bool VoikkoDict::addToSession(const QString &word) { qCDebug(SONNET_VOIKKO()) << "Adding new word to session dictionary" << word; - d->m_sessionWords.insert(word); + d->m_sessionWords.insert(word, QHashDummyValue{}); return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/plugins/voikko/voikkodict.h new/sonnet-6.32.0/src/plugins/voikko/voikkodict.h --- old/sonnet-6.31.0/src/plugins/voikko/voikkodict.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/plugins/voikko/voikkodict.h 2026-11-07 16:31:24.000000000 +0100 @@ -28,8 +28,8 @@ ~VoikkoDict(); - bool isCorrect(const QString &word) const override; - QStringList suggest(const QString &word) const override; + bool isCorrect(QStringView word) const override; + QStringList suggest(QStringView word) const override; bool storeReplacement(const QString &bad, const QString &good) override; bool addToPersonal(const QString &word) override; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/quick/spellcheckhighlighter.cpp new/sonnet-6.32.0/src/quick/spellcheckhighlighter.cpp --- old/sonnet-6.31.0/src/quick/spellcheckhighlighter.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/quick/spellcheckhighlighter.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -102,12 +102,12 @@ rehighlightRequest->start(); // Danger red from our color scheme - errorFormat.setForeground(spellColor); errorFormat.setUnderlineColor(spellColor); #if QT_VERSION >= QT_VERSION_CHECK(6, 12, 0) // Qt 6.12 has support for this underline style finally! errorFormat.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline); #else + errorFormat.setForeground(spellColor); errorFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); #endif @@ -375,7 +375,7 @@ continue; } ++d->wordCount; - if (d->spellchecker->isMisspelled(word.toString())) { + if (d->spellchecker->isMisspelled(word.token)) { ++d->errorCount; if (word.position() + offset <= cursor.position() && cursor.position() <= word.position() + offset + word.length()) { setMisspelledSelected(word.position() + offset, word.length()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/quick/spellcheckhighlighter.h new/sonnet-6.32.0/src/quick/spellcheckhighlighter.h --- old/sonnet-6.31.0/src/quick/spellcheckhighlighter.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/quick/spellcheckhighlighter.h 2026-11-07 16:31:24.000000000 +0100 @@ -260,9 +260,6 @@ void setMisspelledColor(const QColor &color); [[nodiscard]] QColor misspelledColor() const; - void setQuoteColor(const QColor &color); - [[nodiscard]] QColor quoteColor() const; - /* * Set a new QTextDocument for this highlighter to operate on. * @@ -341,8 +338,6 @@ [[nodiscard]] QTextDocument *textDocument() const; void contentsChange(int pos, int add, int rem); - void autodetectLanguage(const QString &sentence); - HighlighterPrivate *const d; Q_DISABLE_COPY(SpellcheckHighlighter) }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/src/ui/dialog.h new/sonnet-6.32.0/src/ui/dialog.h --- old/sonnet-6.31.0/src/ui/dialog.h 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/src/ui/dialog.h 2026-11-07 16:31:24.000000000 +0100 @@ -183,8 +183,6 @@ SONNETUI_NO_EXPORT void initGui(); - SONNETUI_NO_EXPORT void continueChecking(); - private: DialogPrivate *const d; Q_DISABLE_COPY(Dialog) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/tests/CMakeLists.txt new/sonnet-6.32.0/tests/CMakeLists.txt --- old/sonnet-6.31.0/tests/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/sonnet-6.32.0/tests/CMakeLists.txt 2026-11-07 16:31:24.000000000 +0100 @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2026 Volker Krause <[email protected]> +# SPDX-License-Identifier: BSD-3-Clause + +add_executable(backgroundtest backgroundtest.cpp) +target_link_libraries(backgroundtest PRIVATE KF6SonnetCore Qt6::Widgets) + +add_executable(languageguesstest languageguesstest.cpp) +target_link_libraries(languageguesstest PRIVATE KF6SonnetCore Qt6::Widgets) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/tests/backgroundtest.cpp new/sonnet-6.32.0/tests/backgroundtest.cpp --- old/sonnet-6.31.0/tests/backgroundtest.cpp 2026-10-02 15:24:21.000000000 +0200 +++ new/sonnet-6.32.0/tests/backgroundtest.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -8,6 +8,7 @@ #include "backgroundtest.h" #include "speller.h" +using namespace Qt::Literals; using namespace Sonnet; #include <QApplication> @@ -119,15 +120,15 @@ If you want to talk about this code feel free to mail us."; BackgroundTest::BackgroundTest() - : QObject(0) - , m_speller("en") + : QObject(nullptr) + , m_speller(u"en"_s) { m_checker = new BackgroundChecker(m_speller, this); connect(m_checker, SIGNAL(done()), SLOT(slotDone())); connect(m_checker, SIGNAL(misspelling(QString, int)), SLOT(slotMisspelling(QString, int))); m_len = strlen(text); - m_checker->setText(text); - m_checker->speller().setLanguage("en"); + m_checker->setText(QLatin1StringView(text)); + m_checker->speller().setLanguage(u"en"_s); m_timer.start(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sonnet-6.31.0/tests/languageguesstest.cpp new/sonnet-6.32.0/tests/languageguesstest.cpp --- old/sonnet-6.31.0/tests/languageguesstest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/sonnet-6.32.0/tests/languageguesstest.cpp 2026-11-07 16:31:24.000000000 +0100 @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2026 Volker Krause +// SPDX-License-Identifier: LGPL-2.0-or-later + +#include <Sonnet/GuessLanguage> + +#include <QApplication> +#include <QPlainTextEdit> +#include <QTextStream> + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QPlainTextEdit editor; + Sonnet::GuessLanguage guesser; + + QObject::connect(&editor, &QPlainTextEdit::textChanged, &app, [&]() { + QTextStream(stdout) << guesser.identify(editor.toPlainText()) << '\n'; + }); + + editor.show(); + return app.exec(); +}
