KTextEditor

spellcheckbar.h
1/*
2 SPDX-FileCopyrightText: 2003 Zack Rusin <zack@kde.org>
3 SPDX-FileCopyrightText: 2009-2010 Michel Ludwig <michel.ludwig@kdemail.net>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef SPELLCHECK_BAR_H
9#define SPELLCHECK_BAR_H
10
11#include "kateviewhelpers.h"
12
13class QListWidgetItem;
14class QModelIndex;
15
16namespace Sonnet
17{
18class BackgroundChecker;
19}
20
21/**
22 * @short Spellcheck dialog
23 *
24 * \code
25 * Sonnet::SpellCheckBar dlg = new Sonnet::SpellCheckBar(
26 * new Sonnet::BackgroundChecker(this), this);
27 * //connect signals
28 * ...
29 * dlg->setBuffer( someText );
30 * dlg->show();
31 * \endcode
32 *
33 * You can change buffer inside a slot connected to done() signal
34 * and spellcheck will continue with new data automatically.
35 */
36class SpellCheckBar : public KateViewBarWidget
37{
39public:
41 ~SpellCheckBar() override;
42
43 QString originalBuffer() const;
44 QString buffer() const;
45
46 void closed() override;
47
48 void show();
49 void activeAutoCorrect(bool _active);
50
51 /**
52 * Controls whether an (indefinite) progress dialog is shown when the spell
53 * checking takes longer than the given time to complete. By default no
54 * progress dialog is shown. If the progress dialog is set to be shown, no
55 * time consuming operation (for example, showing a notification message) should
56 * be performed in a slot connected to the 'done' signal as this might trigger
57 * the progress dialog unnecessarily.
58 *
59 * @param timeout time after which the progress dialog should appear; a negative
60 * value can be used to hide it
61 * @since 4.4
62 */
63 void showProgressDialog(int timeout = 500);
64
65 /**
66 * Controls whether a message box indicating the completion of the spell checking
67 * is shown or not. By default it is not shown.
68 *
69 * @since 4.4
70 */
71 void showSpellCheckCompletionMessage(bool b = true);
72
73 /**
74 * Controls whether the spell checking is continued after the replacement of a
75 * misspelled word has been performed. By default it is continued.
76 *
77 * @since 4.4
78 */
80
81public Q_SLOTS:
82 void setBuffer(const QString &);
83
85 /**
86 * The dialog won't be closed if you setBuffer() in slot connected to this signal
87 *
88 * Also emitted after stop() signal
89 */
90 void done(const QString &newBuffer);
91 void misspelling(const QString &word, int start);
92 void replace(const QString &oldWord, int start, const QString &newWord);
93
94 void stop();
95 void cancel();
96 void autoCorrect(const QString &currentWord, const QString &replaceWord);
97
98 /**
99 * Signal sends when spell checking is finished/stopped/completed
100 * @since 4.1
101 */
103
104 /**
105 * Emitted when the user changes the language used for spellchecking,
106 * which is shown in a combobox of this dialog.
107 *
108 * @param language the new language the user selected
109 * @since 4.1
110 */
111 void languageChanged(const QString &language);
112
113private Q_SLOTS:
114 void slotMisspelling(const QString &word, int start);
115 void slotDone();
116
117 void slotCancel();
118
119 void slotAddWord();
120 void slotReplaceWord();
121 void slotReplaceAll();
122 void slotSkip();
123 void slotSkipAll();
124 void slotSuggest();
125 void slotChangeLanguage(const QString &);
126 void slotAutocorrect();
127
128 void setGuiEnabled(bool b);
129 void setProgressDialogVisible(bool b);
130
131private:
132 void updateDialog(const QString &word);
133 void fillDictionaryComboBox();
134 void updateDictionaryComboBox();
135 void fillSuggestions(const QStringList &suggs);
136 void initConnections();
137 void initGui();
138 void continueChecking();
139
140private:
141 class Private;
142 Private *const d;
143};
144
145#endif
Spellcheck dialog.
void setSpellCheckContinuedAfterReplacement(bool b)
Controls whether the spell checking is continued after the replacement of a misspelled word has been ...
void showSpellCheckCompletionMessage(bool b=true)
Controls whether a message box indicating the completion of the spell checking is shown or not.
void languageChanged(const QString &language)
Emitted when the user changes the language used for spellchecking, which is shown in a combobox of th...
void spellCheckStatus(const QString &)
Signal sends when spell checking is finished/stopped/completed.
void done(const QString &newBuffer)
The dialog won't be closed if you setBuffer() in slot connected to this signal.
void showProgressDialog(int timeout=500)
Controls whether an (indefinite) progress dialog is shown when the spell checking takes longer than t...
Q_SCRIPTABLE Q_NOREPLY void start()
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.