File: thailanguagefeatures.cpp

package info (click to toggle)
lomiri-keyboard 1.0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 133,064 kB
  • sloc: cpp: 13,755; python: 1,562; perl: 492; javascript: 399; sh: 99; xml: 96; makefile: 42
file content (78 lines) | stat: -rw-r--r-- 1,864 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Copyright 2014 Canonical Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "thailanguagefeatures.h"

ThaiLanguageFeatures::ThaiLanguageFeatures(QObject *parent) :
    QObject(parent)
{
}

ThaiLanguageFeatures::~ThaiLanguageFeatures()
{
}

bool ThaiLanguageFeatures::alwaysShowSuggestions() const
{
    return false;
}

bool ThaiLanguageFeatures::autoCapsAvailable() const
{
    return false;
}

bool ThaiLanguageFeatures::activateAutoCaps(const QString &preedit) const
{
    Q_UNUSED(preedit)
    return false;
}

QString ThaiLanguageFeatures::appendixForReplacedPreedit(const QString &preedit) const
{
    Q_UNUSED(preedit)
    return QString("");
}

bool ThaiLanguageFeatures::isSeparator(const QString &text) const
{
    static const QString separators = QString::fromUtf8("。、,!?:;.\r\n");

    if (text.isEmpty()) {
        return false;
    }

    if (separators.contains(text.right(1))) {
        return true;
    }

    return false;
}

bool ThaiLanguageFeatures::isSymbol(const QString &text) const
{
    static const QString symbols = QString::fromUtf8("*#+=()@~/\\€£$¥₹%<>[]`^|_§{}¡¿«»\"“”„&0123456789");

    if (text.isEmpty()) {
        return false;
    }

    if (symbols.contains(text.right(1))) {
        return true;
    }

    return false;
}