r23102 by jghali - Small refactoring and code style fixes for HunspellPluginImpl::parseTextFrame()

scribus-commit scribus-commit at lists.scribus.net
Sun Aug 4 07:17:19 UTC 2019


Author: jghali
Date: Sun Aug  4 07:17:19 2019
New Revision: 23102

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23102
Log:
Small refactoring and code style fixes for HunspellPluginImpl::parseTextFrame()

Modified:
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23102&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp	Sun Aug  4 07:17:19 2019
@@ -136,13 +136,9 @@
 		if (wordLang.isEmpty())
 		{
 			const StyleSet<CharStyle> &tmp(m_doc->charStyles());
-			for (int i = 0; i < tmp.count(); ++i)
-				if (tmp[i].isDefaultStyle())
-				{
-					//check out why we are getting "German" back here next
-					wordLang=tmp[i].language();
-					//qDebug()<<"Default char style lang"<<tmp[i].language();
-				}
+			const CharStyle* defaultStyle = tmp.getDefault();
+			if (defaultStyle)
+				wordLang = defaultStyle->language();
 		}
 		//we now use the abbreviation
 		//wordLang=LanguageManager::instance()->getAbbrevFromLang(wordLang, true, false);
@@ -153,11 +149,11 @@
 		if (!dictionaryMap.contains(wordLang))
 		{
 			//qDebug()<<"Spelling language to match style language NOT installed ("<<wordLang<<")";
-			QString altLang=LanguageManager::instance()->getAlternativeAbbrevfromAbbrev(wordLang);
-			if (altLang!="")
+			QString altLang = LanguageManager::instance()->getAlternativeAbbrevfromAbbrev(wordLang);
+			if (!altLang.isEmpty())
 			{
 				//qDebug()<<"altLang"<<altLang<<dictionaryMap.contains(altLang);
-				wordLang=altLang;
+				wordLang = altLang;
 			}
 		}
 		else




More information about the scribus-commit mailing list