Commit 74295a29 authored by Marius Gripsgard's avatar Marius Gripsgard
Browse files

Hack keyboard to build

parent 5ac2dd8a
Pipeline #839 failed with stage
in 3 minutes and 44 seconds
......@@ -10,13 +10,19 @@ url="https://github.com/ubports/keyboard-component"
license=('GPL')
groups=()
depends=('maliit-framework-git' 'qt5-feedback' 'qt5-multimedia'
'hunspell' 'libchewing' 'presage-git' 'libpinyin' 'sqlite')
'hunspell' 'libchewing' 'presage-git' 'libpinyin' 'sqlite' 'anthy')
makedepends=('git' 'cmake')
provides=(maliit-keyboard)
conflicts=(maliit-keyboard maliit-keyboard-git)
install=
source=("git+$url.git")
md5sums=('SKIP')
source=("git+$url.git"
"fix-for-newer-cpp.patch"
"hack-maliit-dirs.patch"
"https://github.com/maliit/keyboard/commit/269646fd87ef79118493011fae3a3c30ac395586.patch")
md5sums=('SKIP'
'SKIP'
'SKIP'
'SKIP')
pkgver() {
cd $_pkgname
......@@ -25,11 +31,15 @@ pkgver() {
prepare() {
cd $_pkgname
patch -Np1 -i "${srcdir}/fix-for-newer-cpp.patch"
patch -Np1 -i "${srcdir}/hack-maliit-dirs.patch"
patch -Np1 -i "${srcdir}/269646fd87ef79118493011fae3a3c30ac395586.patch"
}
build() {
cd ${_pkgname}
qmake CONFIG+=no_docs INCLUDEPATH+="/usr/include/maliit-2"
qmake CONFIG+=no_docs CONFIG+=notests INCLUDEPATH+="/usr/include/maliit-2" QMAKE_CXXFLAGS+="-I/usr/include/maliit-2"
make
}
......
diff --git a/plugins/westernsupport/spellchecker.cpp b/plugins/westernsupport/spellchecker.cpp
index fbd9be3a..c34e4373 100644
--- a/plugins/westernsupport/spellchecker.cpp
+++ b/plugins/westernsupport/spellchecker.cpp
@@ -108,7 +108,7 @@ void SpellCheckerPrivate::addUserDictionary(const QString &user_dictionary)
if (file.open(QFile::ReadOnly)) {
QTextStream stream(&file);
while (!stream.atEnd()) {
- hunspell->add(codec->fromUnicode(stream.readLine()));
+ hunspell->add(codec->fromUnicode(stream.readLine()).toStdString());
}
}
}
@@ -191,7 +191,7 @@ bool SpellChecker::spell(const QString &word)
return true;
}
- return d->hunspell->spell(d->codec->fromUnicode(word));
+ return d->hunspell->spell(d->codec->fromUnicode(word).toStdString());
}
@@ -208,22 +208,20 @@ QStringList SpellChecker::suggest(const QString &word,
return QStringList();
}
- char** suggestions = NULL;
- const int suggestions_count = d->hunspell->suggest(&suggestions, d->codec->fromUnicode(word));
+ const auto suggestions = d->hunspell->suggest(d->codec->fromUnicode(word).toStdString());
// Less than zero means some error.
- if (suggestions_count < 0) {
+ if (suggestions.empty()) {
qWarning() << __PRETTY_FUNCTION__ << ": Failed to get suggestions for" << word << ".";
return QStringList();
}
QStringList result;
- const int final_limit((limit < 0) ? suggestions_count : qMin(limit, suggestions_count));
+ const int final_limit((limit < 0) ? suggestions.size() : qMin(limit, static_cast<int>(suggestions.size())));
for (int index(0); index < final_limit; ++index) {
- result << d->codec->toUnicode(suggestions[index]);
+ result << d->codec->toUnicode(suggestions[index].c_str());
}
- d->hunspell->free_list(&suggestions, suggestions_count);
return result;
}
@@ -273,7 +271,7 @@ void SpellChecker::updateWord(const QString &word)
}
// Non-zero return value means some error.
- if (d->hunspell->add(d->codec->fromUnicode(word))) {
+ if (d->hunspell->add(d->codec->fromUnicode(word).toStdString())) {
qWarning() << __PRETTY_FUNCTION__ << ": Failed to add '" << word << "' to user dictionary.";
}
}
diff --git a/config.pri b/config.pri
index 3bda05a1..bc12c4cd 100644
--- a/config.pri
+++ b/config.pri
@@ -48,6 +48,8 @@ enable-opengl {
DEFINES += MALIIT_KEYBOARD_HAVE_OPENGL
}
+MALIIT_PLUGINS_DIR = "/usr/lib/maliit/plugins"
+MALIIT_PLUGINS_DATA_DIR = "/usr/share/maliit/plugins"
UBUNTU_KEYBOARD_PACKAGENAME = ubuntu-keyboard
UBUNTU_KEYBOARD_VERSION = $$system(cat $$PWD/VERSION)
UBUNTU_KEYBOARD_DATA_DIR = "$${MALIIT_PLUGINS_DATA_DIR}/com/ubuntu"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment