Hello community,

here is the log from the commit of package sonnet for openSUSE:Factory checked 
in at 2016-08-29 15:14:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sonnet (Old)
 and      /work/SRC/openSUSE:Factory/.sonnet.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sonnet"

Changes:
--------
--- /work/SRC/openSUSE:Factory/sonnet/sonnet.changes    2016-07-15 
12:42:09.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.sonnet.new/sonnet.changes       2016-08-29 
15:14:34.000000000 +0200
@@ -1,0 +2,11 @@
+Sun Aug  7 22:17:54 UTC 2016 - [email protected]
+
+- Update to 5.25.0
+  * Qt >= 5.5 is now required
+  * hunspell: Clean up code for searching for dictionaries,
+    add XDG dirs (kde#361409)
+  * Try to fix language filter usage of language detection a bit
+  * For more details please see:
+    https://www.kde.org/announcements/kde-frameworks-5.25.0.php
+
+-------------------------------------------------------------------

Old:
----
  sonnet-5.24.0.tar.xz

New:
----
  sonnet-5.25.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sonnet.spec ++++++
--- /var/tmp/diff_new_pack.cmGFMG/_old  2016-08-29 15:14:35.000000000 +0200
+++ /var/tmp/diff_new_pack.cmGFMG/_new  2016-08-29 15:14:35.000000000 +0200
@@ -18,9 +18,9 @@
 
 %bcond_without lang
 %define sonum   5
-%define _tar_path 5.24
+%define _tar_path 5.25
 Name:           sonnet
-Version:        5.24.0
+Version:        5.25.0
 Release:        0
 #BuildRequires:  aspell-devel
 BuildRequires:  cmake >= 2.8.12
@@ -30,12 +30,12 @@
 BuildRequires:  fdupes
 BuildRequires:  kf5-filesystem
 %if %{with lang}
-BuildRequires:  cmake(Qt5LinguistTools) >= 5.4.0
+BuildRequires:  cmake(Qt5LinguistTools) >= 5.5.0
 %endif
 BuildRequires:  myspell-dictionaries
-BuildRequires:  cmake(Qt5Core) >= 5.4.0
-BuildRequires:  cmake(Qt5Test) >= 5.4.0
-BuildRequires:  cmake(Qt5Widgets) >= 5.4.0
+BuildRequires:  cmake(Qt5Core) >= 5.5.0
+BuildRequires:  cmake(Qt5Test) >= 5.5.0
+BuildRequires:  cmake(Qt5Widgets) >= 5.5.0
 BuildRequires:  pkgconfig(hunspell)
 Summary:        KDE spell checking library
 License:        LGPL-2.1+
@@ -82,7 +82,7 @@
 Requires:       extra-cmake-modules
 Requires:       libKF5SonnetCore%sonum = %{version}
 Requires:       libKF5SonnetUi%sonum = %{version}
-Requires:       cmake(Qt5Core) >= 5.4.0
+Requires:       cmake(Qt5Core) >= 5.5.0
 
 %description devel
 Sonnet is a plugin-based spell checking library for Qt-based

++++++ sonnet-5.24.0.tar.xz -> sonnet-5.25.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sonnet-5.24.0/CMakeLists.txt 
new/sonnet-5.25.0/CMakeLists.txt
--- old/sonnet-5.24.0/CMakeLists.txt    2016-07-03 11:30:50.000000000 +0200
+++ new/sonnet-5.25.0/CMakeLists.txt    2016-08-07 16:03:38.000000000 +0200
@@ -4,7 +4,7 @@
 project(Sonnet)
 
 include(FeatureSummary)
-find_package(ECM 5.24.0  NO_MODULE)
+find_package(ECM 5.25.0  NO_MODULE)
 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake 
Modules." URL 
"https://projects.kde.org/projects/kdesupport/extra-cmake-modules";)
 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND 
FATAL_ON_MISSING_REQUIRED_PACKAGES)
 
@@ -15,7 +15,7 @@
 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
 include(KDECMakeSettings)
 
-set(REQUIRED_QT_VERSION 5.4.0)
+set(REQUIRED_QT_VERSION 5.5.0)
 find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets)
 
 
@@ -26,7 +26,7 @@
 
 include(ECMPoQmTools)
 
-set(KF5_VERSION "5.24.0") # handled by release scripts
+set(KF5_VERSION "5.25.0") # handled by release scripts
 
 ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX SONNET
                         VERSION_HEADER 
"${CMAKE_CURRENT_BINARY_DIR}/sonnet_version.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sonnet-5.24.0/examples/textedit.cpp 
new/sonnet-5.25.0/examples/textedit.cpp
--- old/sonnet-5.24.0/examples/textedit.cpp     2016-07-03 11:30:50.000000000 
+0200
+++ new/sonnet-5.25.0/examples/textedit.cpp     2016-08-07 16:03:38.000000000 
+0200
@@ -62,7 +62,7 @@
                      );
 
     Sonnet::SpellCheckDecorator *installer = new 
Sonnet::SpellCheckDecorator(textEdit);
-    installer->highlighter()->setCurrentLanguage(QStringLiteral("en"));
+    installer->highlighter()->setCurrentLanguage(QStringLiteral("en_US"));
     //@@snippet_end
 
     QObject::connect(comboBox, SIGNAL(dictionaryChanged(QString)), 
installer->highlighter(), SLOT(setCurrentLanguage(QString)));
@@ -72,7 +72,7 @@
         QStringLiteral("John Doe said:\n> Hello how aree you?\nI am ffine 
thanks"));
 
     installer = new MailSpellCheckDecorator(mailTextEdit);
-    installer->highlighter()->setCurrentLanguage(QStringLiteral("en"));
+    installer->highlighter()->setCurrentLanguage(QStringLiteral("en_US"));
     QObject::connect(comboBox, SIGNAL(dictionaryChanged(QString)), 
installer->highlighter(), SLOT(setCurrentLanguage(QString)));
 
     QVBoxLayout *layout = new QVBoxLayout(&window);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sonnet-5.24.0/src/core/languagefilter.cpp 
new/sonnet-5.25.0/src/core/languagefilter.cpp
--- old/sonnet-5.24.0/src/core/languagefilter.cpp       2016-07-03 
11:30:50.000000000 +0200
+++ new/sonnet-5.25.0/src/core/languagefilter.cpp       2016-08-07 
16:03:38.000000000 +0200
@@ -105,6 +105,17 @@
     if (d->lastLanguage.isNull()) {
         d->lastLanguage = d->gl.identify(d->lastToken.toString(), 
QStringList() << d->mainLanguage() << d->prevLanguage);
     }
+    const QStringList available = d->sp.availableLanguages();
+
+    //FIXME: do something a little more smart here
+    if (!available.contains(d->lastLanguage)) {
+        for(const QString& lang : available) {
+            if (lang.startsWith(d->lastLanguage)) {
+                d->lastLanguage = lang;
+                break;
+            }
+        }
+    }
 
     return d->lastLanguage;
 }
@@ -115,12 +126,10 @@
         return false;
     }
 
-    //FIXME: do something a little more smart here
-    Q_FOREACH(const QString& lang, d->sp.availableLanguages()) {
-        if (lang.startsWith(lastlang)) {
-            return true;
-        }
+    if (d->sp.availableLanguages().contains(lastlang)) {
+        return true;
     }
+
     return false;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sonnet-5.24.0/src/plugins/hunspell/hunspellclient.cpp 
new/sonnet-5.25.0/src/plugins/hunspell/hunspellclient.cpp
--- old/sonnet-5.24.0/src/plugins/hunspell/hunspellclient.cpp   2016-07-03 
11:30:50.000000000 +0200
+++ new/sonnet-5.25.0/src/plugins/hunspell/hunspellclient.cpp   2016-08-07 
16:03:38.000000000 +0200
@@ -26,6 +26,7 @@
 #include <QString>
 #include <QCoreApplication>
 #include <QDebug>
+#include <QStandardPaths>
 
 using namespace Sonnet;
 
@@ -33,22 +34,8 @@
     : Client(parent)
 {
     qCDebug(SONNET_HUNSPELL) << " HunspellClient::HunspellClient";
-}
-
-HunspellClient::~HunspellClient()
-{
-}
 
-SpellerPlugin *HunspellClient::createSpeller(const QString &language)
-{
-    qCDebug(SONNET_HUNSPELL) << " SpellerPlugin 
*HunspellClient::createSpeller(const QString &language) ;" << language;
-    HunspellDict *ad = new HunspellDict(language);
-    return ad;
-}
-
-QStringList HunspellClient::languages() const
-{
-    QStringList lst;
+    QStringList dirList;
     const QString AFF_MASK = QStringLiteral("*.aff");
 
 #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
@@ -61,24 +48,41 @@
     const QString DIR_MASK = QStringLiteral("dict-*");
     if (lodir.exists()) {
         foreach (const QString &d, lodir.entryList(QStringList(DIR_MASK), 
QDir::Dirs)) {
-            QDir dictDir(lodir.absoluteFilePath(d));
-            foreach (const QString &dict, 
dictDir.entryList(QStringList(AFF_MASK), QDir::Files)) {
-                lst << dict.left(dict.length() - 4); // remove ".aff"
-            }
+            dirList.append(lodir.absoluteFilePath(d));
         }
     }
 #endif
 
-    QDir dir(QStringLiteral(HUNSPELL_MAIN_DICT_PATH));
-    if (!dir.exists()) {
-        
dir.setPath(QStringLiteral("%1/../share/hunspell").arg(QCoreApplication::applicationDirPath()));
-    }
-
-    if (dir.exists()) {
-        foreach (const QString &dict, dir.entryList(QStringList(AFF_MASK), 
QDir::Files)) {
-            lst << dict.left(dict.length() - 4); // remove ".aff"
+    // search QStandardPaths
+    dirList.append(QStandardPaths::locateAll(
+            QStandardPaths::GenericDataLocation,
+            QStringLiteral("hunspell"),
+            QStandardPaths::LocateDirectory));
+
+    dirList.append(QStringLiteral(HUNSPELL_MAIN_DICT_PATH));
+    
dirList.append(QStringLiteral("%1/../share/hunspell").arg(QCoreApplication::applicationDirPath()));
+
+    for (const QString & dirString : dirList) {
+        QDir dir(dirString);
+        for (const QFileInfo &dict : dir.entryInfoList(QStringList(AFF_MASK), 
QDir::Files)) {
+            m_languagePaths.insert(dict.baseName(), dict.canonicalPath());
         }
     }
-    return lst;
+}
+
+HunspellClient::~HunspellClient()
+{
+}
+
+SpellerPlugin *HunspellClient::createSpeller(const QString &language)
+{
+    qCDebug(SONNET_HUNSPELL) << " SpellerPlugin 
*HunspellClient::createSpeller(const QString &language) ;" << language;
+    HunspellDict *ad = new HunspellDict(language, 
m_languagePaths.value(language));
+    return ad;
+}
+
+QStringList HunspellClient::languages() const
+{
+    return m_languagePaths.keys();
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sonnet-5.24.0/src/plugins/hunspell/hunspellclient.h 
new/sonnet-5.25.0/src/plugins/hunspell/hunspellclient.h
--- old/sonnet-5.24.0/src/plugins/hunspell/hunspellclient.h     2016-07-03 
11:30:50.000000000 +0200
+++ new/sonnet-5.25.0/src/plugins/hunspell/hunspellclient.h     2016-08-07 
16:03:38.000000000 +0200
@@ -22,6 +22,7 @@
 #define KSPELL_HUNSPELLCLIENT_H
 
 #include "client_p.h"
+#include <QMap>
 
 namespace Sonnet
 {
@@ -51,6 +52,9 @@
     {
         return QStringLiteral("Hunspell");
     }
+
+private:
+    QMap<QString, QString> m_languagePaths;
 };
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sonnet-5.24.0/src/plugins/hunspell/hunspelldict.cpp 
new/sonnet-5.25.0/src/plugins/hunspell/hunspelldict.cpp
--- old/sonnet-5.24.0/src/plugins/hunspell/hunspelldict.cpp     2016-07-03 
11:30:50.000000000 +0200
+++ new/sonnet-5.25.0/src/plugins/hunspell/hunspelldict.cpp     2016-08-07 
16:03:38.000000000 +0200
@@ -29,54 +29,36 @@
 #include <QTextStream>
 #include <QStringBuilder>
 #include <QCoreApplication>
+#include <QStandardPaths>
 
 using namespace Sonnet;
 
-static const QString composeDictName(const QByteArray &dirPath, const QString 
&lang)
-{
-    return QFile::decodeName(dirPath+'/') + lang + QStringLiteral(".dic");
-}
-
-HunspellDict::HunspellDict(const QString &lang)
+HunspellDict::HunspellDict(const QString &lang, QString path)
     : SpellerPlugin(lang)
     , m_speller(0)
     , m_codec(0)
 {
-    qCDebug(SONNET_HUNSPELL) << " HunspellDict::HunspellDict( const QString& 
lang ):" << lang;
-
-    QByteArray dirPath = QByteArrayLiteral(HUNSPELL_MAIN_DICT_PATH);
-    QString dic = composeDictName(dirPath, lang);
+    qCDebug(SONNET_HUNSPELL) << "Loading dictionary for" << lang << "from" << 
path;
 
-    if (!QFileInfo::exists(dic)) {
-        dirPath = QFile::encodeName(QCoreApplication::applicationDirPath()) + 
QByteArrayLiteral("/../share/hunspell");
-        dic = composeDictName(dirPath, lang);
+    if (!path.endsWith(QLatin1Char('/'))) {
+        path += QLatin1Char('/');
     }
+    path += lang;
+    QString dictionary = path + QStringLiteral(".dic");
+    QString aff = path + QStringLiteral(".aff");
 
-#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
-    if (!QFileInfo::exists(dic)) {
-#ifdef Q_OS_MAC
-        dirPath = 
QByteArrayLiteral("/Applications/LibreOffice.app/Contents/Resources/extensions/dict-")
 + lang.leftRef(2).toLatin1();
-#endif
-#ifdef Q_OS_WIN
-        dirPath = QByteArrayLiteral("C:/Program Files (x86)/LibreOffice 
5/share/extensions/dict-") + lang.leftRef(2).toLatin1();
-#endif
-        dic = composeDictName(dirPath, lang);
-        if (lang.length()==5 && !QFileInfo::exists(dic)) {
-            dirPath += '-' + lang.midRef(3,2).toLatin1();
-            dic = composeDictName(dirPath, lang);
-        }
-    }
-#endif
-
-    if (QFileInfo::exists(dic)) {
-        m_speller = new Hunspell(QByteArray(dirPath + "/" + lang.toLatin1() + 
".aff").constData(), dic.toLatin1().constData());
+    if (QFileInfo::exists(dictionary) && QFileInfo::exists(aff)) {
+        m_speller = new Hunspell(aff.toLocal8Bit().constData(), 
dictionary.toLocal8Bit().constData());
         m_codec = QTextCodec::codecForName(m_speller->get_dic_encoding());
         if (!m_codec) {
             qWarning() << "Failed to find a text codec for name" << 
m_speller->get_dic_encoding() << "defaulting to locale text codec";
             m_codec = QTextCodec::codecForLocale();
             Q_ASSERT(m_codec);
         }
+    } else {
+        qCWarning(SONNET_HUNSPELL) << "Unable to find dictionary for" << lang 
<< "in path" << path;
     }
+
     QString userDic = QDir::home().filePath(QLatin1String(".hunspell_") % 
lang);
     QFile userDicFile(userDic);
     if (userDicFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
@@ -95,7 +77,7 @@
         }
         userDicFile.close();
     }
-    qCDebug(SONNET_HUNSPELL) << " dddddd " << m_speller;
+    qCDebug(SONNET_HUNSPELL) << "Created " << m_speller;
 }
 
 HunspellDict::~HunspellDict()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sonnet-5.24.0/src/plugins/hunspell/hunspelldict.h 
new/sonnet-5.25.0/src/plugins/hunspell/hunspelldict.h
--- old/sonnet-5.24.0/src/plugins/hunspell/hunspelldict.h       2016-07-03 
11:30:50.000000000 +0200
+++ new/sonnet-5.25.0/src/plugins/hunspell/hunspelldict.h       2016-08-07 
16:03:38.000000000 +0200
@@ -35,7 +35,7 @@
 class HunspellDict : public Sonnet::SpellerPlugin
 {
 public:
-    explicit HunspellDict(const QString &lang);
+    explicit HunspellDict(const QString &lang, QString path);
     ~HunspellDict();
     bool isCorrect(const QString &word) const;
 


Reply via email to