diff libgui/src/m-editor/file-editor-tab.cc @ 16679:cf939872811c

options for auto completion threshold, source and word replacement in settings * settings-dialog.ui: new settings for auto completion threshold, source and word replacement * settings-dailog.cc(constructor): load values for new settings from file; (write_changed_settings): store values of new settings to settings file * file-editor-tab.cc(notice_settings): load values for auto completion threshold, source and word replacement from settings
author Torsten <ttl@justmail.de>
date Sat, 18 May 2013 16:13:53 +0200
parents 518dbe0ae857
children e9d0b8252a0a
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sat May 18 15:17:03 2013 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sat May 18 16:13:53 2013 +0200
@@ -1093,8 +1093,30 @@
   _edit_area->setCaretLineVisible
     (settings->value ("editor/highlightCurrentLine", true).toBool ());
 
-  if (settings->value ("editor/codeCompletion", true).toBool ())
-    _edit_area->setAutoCompletionThreshold (1);
+  if (settings->value ("editor/codeCompletion", true).toBool ())  // auto compl.
+    {
+      bool match_keywords = settings->value
+        ("editor/codeCompletion_keywords",true).toBool ();
+      bool match_document = settings->value
+        ("editor/codeCompletion_document",true).toBool ();
+
+      QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone;
+      if (match_keywords)
+        if (match_document)
+          source = QsciScintilla::AcsAll;
+        else
+          source = QsciScintilla::AcsAPIs;
+      else
+        if (match_document)
+          source = QsciScintilla::AcsDocument;
+      _edit_area->setAutoCompletionSource (source);
+
+      _edit_area->setAutoCompletionReplaceWord
+        (settings->value ("editor/codeCompletion_replace",false).toBool ());
+
+      _edit_area->setAutoCompletionThreshold
+        (settings->value ("editor/codeCompletion_threshold",2).toInt ());
+    }
   else
     _edit_area->setAutoCompletionThreshold (-1);