TextAutoCorrectionCore::AutoCorrectionSettings Class

The AutoCorrectionSettings class Author: Laurent Montel <montel@kde.org>. More...

Header: #include <TextAutoCorrectionCore/AutoCorrectionSettings>
CMake: find_package(KF6TextAutoCorrectionCore REQUIRED)
target_link_libraries(mytarget PRIVATE KF6::TextAutoCorrectionCore)

Public Functions

AutoCorrectionSettings()
~AutoCorrectionSettings()
bool addAutoCorrect(const QString &currentWord, const QString &replaceWord)
QHash<QString, QString> autocorrectEntries() const
QString customSystemPath() const
QString customWritablePath() const
TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes doubleFrenchQuotes() const
std::optional<std::pair<QString, QString>> findEntry(const QString &word, const QString &wordFirstUpper) const
bool isAddNonBreakingSpace() const
bool isAdvancedAutocorrect() const
bool isAutoBoldUnderline() const
bool isAutoFormatUrl() const
bool isAutoFractions() const
bool isCapitalizeWeekDays() const
bool isEnabledAutoCorrection() const
bool isFixTwoUppercaseChars() const
bool isFrenchLanguage() const
bool isReplaceDoubleQuotes() const
bool isReplaceDoubleQuotesByFrenchQuotes() const
bool isReplaceSingleQuotes() const
bool isSingleSpaces() const
bool isSuperScript() const
bool isUppercaseFirstCharOfSentence() const
QString language() const
void loadGlobalFileName(const QString &fname)
void loadLocalFileName(const QString &localFileName, const QString &fname)
int maxFindStringLength() const
int minFindStringLength() const
QChar nonBreakingSpace() const
void readConfig()
void setAddNonBreakingSpace(bool b)
void setAdvancedAutocorrect(bool b)
void setAutoBoldUnderline(bool b)
void setAutoFormatUrl(bool b)
void setAutoFractions(bool newAutoFractions)
void setAutocorrectEntries(const QHash<QString, QString> &entries)
void setCapitalizeWeekDays(bool b)
void setCustomSystemPath(const QString &path)
void setCustomWritablePath(const QString &path)
void setDoubleFrenchQuotes(const TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes &newDoubleFrenchQuotes)
void setEnabledAutoCorrection(bool b)
void setFixTwoUppercaseChars(bool newFixTwoUppercaseChars)
void setLanguage(const QString &lang, bool forceGlobal = false)
void setNonBreakingSpace(const QChar &newNonBreakingSpace)
void setReplaceDoubleQuotes(bool b)
void setReplaceDoubleQuotesByFrenchQuotes(bool b)
void setReplaceSingleQuotes(bool b)
void setSingleSpaces(bool newSingleSpaces)
void setSuperScript(bool b)
void setSuperScriptEntries(const QHash<QString, QString> &newSuperScriptEntries)
void setTwoUpperLetterExceptions(const QSet<QString> &exceptions)
void setTypographicDoubleQuotes(TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes doubleQuote)
void setTypographicSingleQuotes(TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes singleQuote)
void setUpperCaseExceptions(const QSet<QString> &exceptions)
void setUppercaseFirstCharOfSentence(bool newUppercaseFirstCharOfSentence)
QHash<QString, QString> superScriptEntries() const
QSet<QString> twoUpperLetterExceptions() const
TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes typographicDoubleQuotes() const
TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes typographicSingleQuotes() const
const QSet<QString> &upperCaseExceptions() const
void writeAutoCorrectionFile(const QString &filename = QString())
void writeConfig()

Detailed Description

Member Function Documentation

AutoCorrectionSettings::AutoCorrectionSettings()

Constructs an AutoCorrectionSettings instance

[noexcept] AutoCorrectionSettings::~AutoCorrectionSettings()

Destroys the AutoCorrectionSettings instance

bool AutoCorrectionSettings::addAutoCorrect(const QString &currentWord, const QString &replaceWord)

Adds an autocorrection entry currentWord The word to be replaced replaceWord The replacement word Returns true if the entry was added successfully

QHash<QString, QString> AutoCorrectionSettings::autocorrectEntries() const

Returns the autocorrection entries Returns A hash of autocorrection replacements

See also setAutocorrectEntries().

QString AutoCorrectionSettings::customSystemPath() const

Returns the custom system path for autocorrection files Returns The custom system path

See also setCustomSystemPath().

QString AutoCorrectionSettings::customWritablePath() const

Returns the custom writable path for autocorrection files Returns The custom writable path

See also setCustomWritablePath().

TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes AutoCorrectionSettings::doubleFrenchQuotes() const

Returns the double French quote characters Returns The double French quotes

See also setDoubleFrenchQuotes().

std::optional<std::pair<QString, QString>> AutoCorrectionSettings::findEntry(const QString &word, const QString &wordFirstUpper) const

Looks up an autocorrection entry, ignoring case. word the word to look up wordFirstUpper the same word with its first character upper-cased Returns the matching {key, replacement} pair, or std::nullopt when there is none

bool AutoCorrectionSettings::isAddNonBreakingSpace() const

Checks if adding non-breaking spaces is enabled Returns true if add non-breaking space is enabled

bool AutoCorrectionSettings::isAdvancedAutocorrect() const

Checks if advanced autocorrection is enabled Returns true if advanced autocorrect is enabled

bool AutoCorrectionSettings::isAutoBoldUnderline() const

Checks if automatic bold and underline formatting is enabled Returns true if auto bold underline is enabled

bool AutoCorrectionSettings::isAutoFormatUrl() const

Checks if automatic URL formatting is enabled Returns true if auto format URL is enabled

bool AutoCorrectionSettings::isAutoFractions() const

Checks if automatic fraction conversion is enabled Returns true if auto fractions is enabled

bool AutoCorrectionSettings::isCapitalizeWeekDays() const

Checks if capitalizing weekday names is enabled Returns true if capitalize weekdays is enabled

bool AutoCorrectionSettings::isEnabledAutoCorrection() const

Checks if automatic correction is enabled Returns true if autocorrection is enabled

bool AutoCorrectionSettings::isFixTwoUppercaseChars() const

Checks if fixing two consecutive uppercase characters is enabled Returns true if fix two uppercase chars is enabled

bool AutoCorrectionSettings::isFrenchLanguage() const

Checks if the current language is French Returns true if the language is French

bool AutoCorrectionSettings::isReplaceDoubleQuotes() const

Checks if replacing double quotes is enabled Returns true if replace double quotes is enabled

bool AutoCorrectionSettings::isReplaceDoubleQuotesByFrenchQuotes() const

Checks if replacing double quotes with French quotes is enabled Returns true if replace double quotes by French quotes is enabled

bool AutoCorrectionSettings::isReplaceSingleQuotes() const

Checks if replacing single quotes is enabled Returns true if replace single quotes is enabled

bool AutoCorrectionSettings::isSingleSpaces() const

Checks if single spaces mode is enabled Returns true if single spaces is enabled

bool AutoCorrectionSettings::isSuperScript() const

Checks if superscript conversion is enabled Returns true if superscript is enabled

bool AutoCorrectionSettings::isUppercaseFirstCharOfSentence() const

Checks if first character of sentences should be uppercase Returns true if uppercase first character is enabled

QString AutoCorrectionSettings::language() const

Returns the current language setting Returns The language code

See also setLanguage().

void AutoCorrectionSettings::loadGlobalFileName(const QString &fname)

Loads autocorrection from a global file fname The path to the global autocorrection file

void AutoCorrectionSettings::loadLocalFileName(const QString &localFileName, const QString &fname)

Loads autocorrection from a local file localFileName The local file name to load from fname The full path to the file

int AutoCorrectionSettings::maxFindStringLength() const

Returns the maximum length of strings to find for replacement Returns The maximum find string length

int AutoCorrectionSettings::minFindStringLength() const

Returns the minimum length of strings to find for replacement Returns The minimum find string length

QChar AutoCorrectionSettings::nonBreakingSpace() const

Returns the non-breaking space character Returns The non-breaking space character

See also setNonBreakingSpace().

void AutoCorrectionSettings::readConfig()

Reads the configuration from settings

void AutoCorrectionSettings::setAddNonBreakingSpace(bool b)

Sets whether adding non-breaking spaces is enabled b true to enable add non-breaking space

See also isAddNonBreakingSpace().

void AutoCorrectionSettings::setAdvancedAutocorrect(bool b)

Sets whether advanced autocorrection is enabled b true to enable advanced autocorrect

See also isAdvancedAutocorrect().

void AutoCorrectionSettings::setAutoBoldUnderline(bool b)

Sets whether automatic bold and underline formatting is enabled b true to enable auto bold underline

See also isAutoBoldUnderline().

void AutoCorrectionSettings::setAutoFormatUrl(bool b)

Sets whether automatic URL formatting is enabled b true to enable auto format URL

See also isAutoFormatUrl().

void AutoCorrectionSettings::setAutoFractions(bool newAutoFractions)

Sets whether automatic fraction conversion is enabled newAutoFractions true to enable auto fractions

See also isAutoFractions().

void AutoCorrectionSettings::setAutocorrectEntries(const QHash<QString, QString> &entries)

Sets the autocorrection entries entries A hash mapping incorrect text to correct replacements

See also autocorrectEntries().

void AutoCorrectionSettings::setCapitalizeWeekDays(bool b)

Sets whether capitalizing weekday names is enabled b true to enable capitalize weekdays

See also isCapitalizeWeekDays().

void AutoCorrectionSettings::setCustomSystemPath(const QString &path)

Sets the custom system path for autocorrection files path The custom system path

See also customSystemPath().

void AutoCorrectionSettings::setCustomWritablePath(const QString &path)

Sets the custom writable path for autocorrection files path The custom writable path

See also customWritablePath().

void AutoCorrectionSettings::setDoubleFrenchQuotes(const TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes &newDoubleFrenchQuotes)

Sets the double French quote characters newDoubleFrenchQuotes The double French quotes to use

See also doubleFrenchQuotes().

void AutoCorrectionSettings::setEnabledAutoCorrection(bool b)

Sets whether automatic correction is enabled b true to enable autocorrection

See also isEnabledAutoCorrection().

void AutoCorrectionSettings::setFixTwoUppercaseChars(bool newFixTwoUppercaseChars)

Sets whether fixing two consecutive uppercase characters is enabled newFixTwoUppercaseChars true to enable fix two uppercase chars

See also isFixTwoUppercaseChars().

void AutoCorrectionSettings::setLanguage(const QString &lang, bool forceGlobal = false)

Sets the language for autocorrection lang The language code forceGlobal true to force use of global settings

See also language().

void AutoCorrectionSettings::setNonBreakingSpace(const QChar &newNonBreakingSpace)

Sets the non-breaking space character newNonBreakingSpace The non-breaking space character to use

See also nonBreakingSpace().

void AutoCorrectionSettings::setReplaceDoubleQuotes(bool b)

Sets whether replacing double quotes is enabled b true to enable replace double quotes

See also isReplaceDoubleQuotes().

void AutoCorrectionSettings::setReplaceDoubleQuotesByFrenchQuotes(bool b)

Sets whether replacing double quotes with French quotes is enabled b true to enable replace double quotes by French quotes

See also isReplaceDoubleQuotesByFrenchQuotes().

void AutoCorrectionSettings::setReplaceSingleQuotes(bool b)

Sets whether replacing single quotes is enabled b true to enable replace single quotes

See also isReplaceSingleQuotes().

void AutoCorrectionSettings::setSingleSpaces(bool newSingleSpaces)

Sets whether single spaces mode is enabled newSingleSpaces true to enable single spaces

See also isSingleSpaces().

void AutoCorrectionSettings::setSuperScript(bool b)

Sets whether superscript conversion is enabled b true to enable superscript

See also isSuperScript().

void AutoCorrectionSettings::setSuperScriptEntries(const QHash<QString, QString> &newSuperScriptEntries)

Sets the superscript entries newSuperScriptEntries A hash of superscript replacements

See also superScriptEntries().

void AutoCorrectionSettings::setTwoUpperLetterExceptions(const QSet<QString> &exceptions)

Sets the list of two-upper-letter exceptions exceptions The set of words that should not be changed from two uppercase letters

See also twoUpperLetterExceptions().

void AutoCorrectionSettings::setTypographicDoubleQuotes(TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes doubleQuote)

Sets the typographic double quote characters doubleQuote The double quote characters to use

See also typographicDoubleQuotes().

void AutoCorrectionSettings::setTypographicSingleQuotes(TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes singleQuote)

Sets the typographic single quote characters singleQuote The single quote characters to use

See also typographicSingleQuotes().

void AutoCorrectionSettings::setUpperCaseExceptions(const QSet<QString> &exceptions)

Sets the list of uppercase exceptions exceptions The set of words that should not have their first character uppercased

See also upperCaseExceptions().

void AutoCorrectionSettings::setUppercaseFirstCharOfSentence(bool newUppercaseFirstCharOfSentence)

Sets whether first character of sentences should be uppercase newUppercaseFirstCharOfSentence true to enable uppercase first char of sentence

See also isUppercaseFirstCharOfSentence().

QHash<QString, QString> AutoCorrectionSettings::superScriptEntries() const

Returns the superscript entries Returns A hash of superscript replacements

See also setSuperScriptEntries().

QSet<QString> AutoCorrectionSettings::twoUpperLetterExceptions() const

Returns the list of two-upper-letter exceptions Returns The set of words that should not be changed from two uppercase letters

See also setTwoUpperLetterExceptions().

TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes AutoCorrectionSettings::typographicDoubleQuotes() const

Returns the typographic double quote characters Returns The typographic double quotes

See also setTypographicDoubleQuotes().

TextAutoCorrectionCore::AutoCorrectionUtils::TypographicQuotes AutoCorrectionSettings::typographicSingleQuotes() const

Returns the typographic single quote characters Returns The typographic single quotes

See also setTypographicSingleQuotes().

const QSet<QString> &AutoCorrectionSettings::upperCaseExceptions() const

Returns the list of uppercase exceptions Returns The set of words that should not have their first character uppercased

See also setUpperCaseExceptions().

void AutoCorrectionSettings::writeAutoCorrectionFile(const QString &filename = QString())

Writes the autocorrection data to file filename The path to write to (uses default if empty)

void AutoCorrectionSettings::writeConfig()

Writes the configuration to settings