libquentier 0.8.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
SpellChecker.h
1/*
2 * Copyright 2017-2025 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <quentier/utility/Fwd.h>
22#include <quentier/utility/Linkage.h>
23
24#include <QList>
25#include <QObject>
26
27#include <utility>
28
29namespace quentier {
30
31class Account;
32class FileIOProcessorAsync;
33class SpellCheckerPrivate;
34
35class QUENTIER_EXPORT SpellChecker : public QObject
36{
37 Q_OBJECT
38public:
39 SpellChecker(
40 utility::FileIOProcessorAsync * fileIOProcessorAsync, Account account,
41 QObject * parent = nullptr, const QString & userDictionaryPath = {});
42
43 // The second bool in the pair indicates whether the dictionary
44 // is enabled or disabled
45 [[nodiscard]] QList<std::pair<QString, bool>> listAvailableDictionaries()
46 const;
47
48 void setAccount(const Account & account);
49
50 void enableDictionary(const QString & language);
51 void disableDictionary(const QString & language);
52
53 [[nodiscard]] bool checkSpell(const QString & word) const;
54
55 [[nodiscard]] QStringList spellCorrectionSuggestions(
56 const QString & misSpelledWord) const;
57
58 void addToUserWordlist(const QString & word);
59 void removeFromUserWordList(const QString & word);
60 void ignoreWord(const QString & word);
61 void removeWord(const QString & word);
62
63 [[nodiscard]] bool isReady() const noexcept;
64
65Q_SIGNALS:
66 void ready();
67
68private:
69 SpellCheckerPrivate * const d_ptr;
70 Q_DECLARE_PRIVATE(SpellChecker)
71};
72
73} // namespace quentier
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition Account.h:38
The FileIOProcessorAsync class is a wrapper under simple file IO operations, it is meant to be used f...
Definition FileIOProcessorAsync.h:39