Sonnet

nsspellcheckerclient.mm
1/*
2 * nsspellcheckerclient.mm
3 *
4 * SPDX-FileCopyrightText: 2015 Nick Shaforostoff <shaforostoff@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8#include "nsspellcheckerclient.h"
9#include "nsspellcheckerdict.h"
10
11#import <AppKit/AppKit.h>
12
13using namespace Sonnet;
14
15NSSpellCheckerClient::NSSpellCheckerClient(QObject *parent)
16 : Client(parent)
17{
18}
19
20NSSpellCheckerClient::~NSSpellCheckerClient()
21{
22}
23
24int NSSpellCheckerClient::reliability() const
25{
26 return qEnvironmentVariableIsSet("SONNET_PREFER_NSSPELLCHECKER") ? 9999 : 30;
27}
28
29SpellerPlugin *NSSpellCheckerClient::createSpeller(const QString &language)
30{
31 return new NSSpellCheckerDict(language);
32}
33
34QStringList NSSpellCheckerClient::languages() const
35{
36 QStringList lst;
37 NSArray* availableLanguages = [[NSSpellChecker sharedSpellChecker]
38 availableLanguages];
39 for (NSString* lang_code in availableLanguages) {
40 lst.append(QString::fromNSString(lang_code));
41 }
42 return lst;
43}
44
45
46#include "moc_nsspellcheckerclient.cpp"
The sonnet namespace.
void append(QList< T > &&value)
QString fromNSString(const NSString *string)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.