From fb98f5e1d6e4142ae1b7302ced455d8afb9d2cbb Mon Sep 17 00:00:00 2001 From: craig Date: Tue, 17 Apr 2012 21:39:33 +0000 Subject: Another hunspell backup..., works a bit better now git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17455 11d20701-8431-0410-a711-e3c959e3b870 --- .../tools/hunspellcheck/hunspellpluginimpl.cpp | 77 ++++------------------ 1 file changed, 11 insertions(+), 66 deletions(-) (limited to 'scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp') diff --git a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp index 7d3c7da..61abd38 100644 --- a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp +++ b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp @@ -9,6 +9,7 @@ for which a new license (GPL+exception) is in place. #include "pageitem.h" #include "pageitem_textframe.h" #include "selection.h" +#include "scpaths.h" #include "scribusdoc.h" #include "scribus.h" #include "text/specialchars.h" @@ -62,65 +63,12 @@ bool HunspellPluginImpl::run(const QString & target, ScribusDoc* doc) bool HunspellPluginImpl::findDictionaries() { - //dictionaryPaths - QString macPortsPath("/opt/local/share/hunspell/"); - QString finkPath("/sw/share/hunspell/"); - QString osxLibreOfficePath("/Applications/LibreOffice.app/Contents/share/extensions"); - QString osxUserLibreOfficePath(QDir::homePath()+"/Applications/LibreOffice.app/Contents/share/extensions"); - QString linuxLocalPath("/usr/local/share/hunspell/"); - QString linuxPath("/usr/share/hunspell/"); - QString windowsLOPath("LibreOffice 3.5/share/extensions"); - QDir d; - -#ifdef Q_OS_MAC - d.setPath(macPortsPath); - if (d.exists()) - { - dictPath=macPortsPath; - return true; - } - d.setPath(finkPath); - if (d.exists()) - { - dictPath=finkPath; - return true; - } - d.setPath(osxLibreOfficePath); - if (d.exists()) - { - dictPath=osxLibreOfficePath; - return true; - } - d.setPath(osxUserLibreOfficePath); - if (d.exists()) - { - dictPath=osxUserLibreOfficePath; - return true; - } - return false; -#elif defined(Q_WS_X11) - d.setPath(linuxPath); - if (d.exists()) - { - dictPath=linuxPath; - return true; - } - d.setPath(linuxLocalPath); - if (d.exists()) - { - dictPath=linuxLocalPath; - return true; - } -#elif defined(Q_OS_WIN32) - QString progFiles = getSpecialDir(CSIDL_PROGRAM_FILES); - d.setPath(progFiles+windowsLOPath); - if (d.exists()) - { - dictPath=progFiles+windowsLOPath; - return true; - } -#endif - return false; + QStringList dirs(ScPaths::instance().spellDirs()); + if (dirs.count()==0) + return false; + //for development, just take the first for now + dictPath=dirs.first(); + return true; } bool HunspellPluginImpl::initHunspell() @@ -128,13 +76,12 @@ bool HunspellPluginImpl::initHunspell() int errorCount=0; bool dictPathFound=findDictionaries(); if (!dictPathFound) + { qDebug()<<"No preinstalled dictonary paths found"; + return false; + } else qDebug()<<"Preinstalled dictionary path selected"<itemText; int len=iText->length(); QString text=iText->text(0,len); -- cgit