mirror of https://github.com/procxx/kepka.git
				
				
				
			Added updating of spell highlighter when enabled languages are changed.
This commit is contained in:
		
							parent
							
								
									4cc46f1ffa
								
							
						
					
					
						commit
						26a45885ff
					
				| 
						 | 
					@ -283,15 +283,34 @@ void InitSpellchecker(
 | 
				
			||||||
	if (!Platform::Spellchecker::IsAvailable()) {
 | 
						if (!Platform::Spellchecker::IsAvailable()) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Spellchecker::SetWorkingDirPath(Spellchecker::DictionariesPath());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const auto s = Ui::CreateChild<Spellchecker::SpellingHighlighter>(
 | 
						const auto s = Ui::CreateChild<Spellchecker::SpellingHighlighter>(
 | 
				
			||||||
		field.get(),
 | 
							field.get(),
 | 
				
			||||||
		session->settings().spellcheckerEnabledValue());
 | 
							session->settings().spellcheckerEnabledValue());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const auto applyDictionaries = [=] {
 | 
				
			||||||
 | 
							crl::async([=] {
 | 
				
			||||||
 | 
								Platform::Spellchecker::UpdateLanguages(
 | 
				
			||||||
 | 
									session->settings().dictionariesEnabled());
 | 
				
			||||||
 | 
								crl::on_main([=] {
 | 
				
			||||||
 | 
									s->checkCurrentText();
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
						session->settings().dictionariesChanges(
 | 
				
			||||||
 | 
						) | rpl::start_with_next(applyDictionaries, field->lifetime());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Spellchecker::SetPhrases({ {
 | 
						Spellchecker::SetPhrases({ {
 | 
				
			||||||
		{ &ph::lng_spellchecker_add, tr::lng_spellchecker_add() },
 | 
							{ &ph::lng_spellchecker_add, tr::lng_spellchecker_add() },
 | 
				
			||||||
		{ &ph::lng_spellchecker_remove, tr::lng_spellchecker_remove() },
 | 
							{ &ph::lng_spellchecker_remove, tr::lng_spellchecker_remove() },
 | 
				
			||||||
		{ &ph::lng_spellchecker_ignore, tr::lng_spellchecker_ignore() },
 | 
							{ &ph::lng_spellchecker_ignore, tr::lng_spellchecker_ignore() },
 | 
				
			||||||
	} });
 | 
						} });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	field->setExtendedContextMenu(s->contextMenuCreated());
 | 
						field->setExtendedContextMenu(s->contextMenuCreated());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						applyDictionaries();
 | 
				
			||||||
#endif // TDESKTOP_DISABLE_SPELLCHECK
 | 
					#endif // TDESKTOP_DISABLE_SPELLCHECK
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
#include "base/qt_connection.h"
 | 
					#include "base/qt_connection.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef TDESKTOP_DISABLE_SPELLCHECK
 | 
					#ifndef TDESKTOP_DISABLE_SPELLCHECK
 | 
				
			||||||
 | 
					#include "boxes/dictionaries_manager.h"
 | 
				
			||||||
#include "spellcheck/spelling_highlighter.h"
 | 
					#include "spellcheck/spelling_highlighter.h"
 | 
				
			||||||
 | 
					#include "spellcheck/spellcheck_value.h"
 | 
				
			||||||
#endif // TDESKTOP_DISABLE_SPELLCHECK
 | 
					#endif // TDESKTOP_DISABLE_SPELLCHECK
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QtGui/QClipboard>
 | 
					#include <QtGui/QClipboard>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue