~ubuntu-branches/ubuntu/wily/sonnet/wily

« back to all changes in this revision

Viewing changes to src/plugins/nsspellchecker/nsspellcheckerclient.mm

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell, Scarlett Clark, Jonathan Riddell
  • Date: 2015-10-07 14:00:43 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20151007140043-xwyl21j9rxyqn1pa
Tags: 5.15.0-0ubuntu1
[ Scarlett Clark ]
* Vivid backport

[ Jonathan Riddell ]
* new upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * nsspellcheckerclient.mm
 
3
 *
 
4
 * Copyright (C)  2015  Nick Shaforostoff <shaforostoff@gmail.com>
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2.1 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
19
 * 02110-1301  USA
 
20
 */
 
21
#include "nsspellcheckerclient.h"
 
22
#include "nsspellcheckerdict.h"
 
23
 
 
24
#import <Cocoa/Cocoa.h>
 
25
 
 
26
using namespace Sonnet;
 
27
 
 
28
NSSpellCheckerClient::NSSpellCheckerClient(QObject *parent)
 
29
    : Client(parent)
 
30
{
 
31
}
 
32
 
 
33
NSSpellCheckerClient::~NSSpellCheckerClient()
 
34
{
 
35
}
 
36
 
 
37
SpellerPlugin *NSSpellCheckerClient::createSpeller(const QString &language)
 
38
{
 
39
    return new NSSpellCheckerDict(language);
 
40
}
 
41
 
 
42
QStringList NSSpellCheckerClient::languages() const
 
43
{
 
44
    QStringList lst;
 
45
    NSArray* availableLanguages = [[NSSpellChecker sharedSpellChecker]
 
46
                                   availableLanguages];
 
47
    for (NSString* lang_code in availableLanguages) {
 
48
        lst.append(QString::fromNSString(lang_code));
 
49
    }
 
50
    return lst;
 
51
}
 
52