• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • sources
  • kde-4.12
  • applications
  • kate
  • part
  • utils
kateconfig.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2007, 2008 Matthew Woehlke <mw_triad@users.sourceforge.net>
3  Copyright (C) 2003 Christoph Cullmann <cullmann@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "kateconfig.h"
21 
22 #include "kateglobal.h"
23 #include "katerenderer.h"
24 #include "kateview.h"
25 #include "katedocument.h"
26 #include "kateschema.h"
27 
28 #include <math.h>
29 
30 #include <kconfig.h>
31 #include <kconfiggroup.h>
32 #include <kglobalsettings.h>
33 #include <kcolorscheme.h>
34 #include <kcolorutils.h>
35 #include <kcharsets.h>
36 #include <klocale.h>
37 #include <kcomponentdata.h>
38 #include <kdebug.h>
39 
40 #include <QtCore/QTextCodec>
41 #include <QStringListModel>
42 
43 //BEGIN KateConfig
44 KateConfig::KateConfig ()
45  : configSessionNumber (0), configIsRunning (false)
46 {
47 }
48 
49 KateConfig::~KateConfig ()
50 {
51 }
52 
53 void KateConfig::configStart ()
54 {
55  configSessionNumber++;
56 
57  if (configSessionNumber > 1)
58  return;
59 
60  configIsRunning = true;
61 }
62 
63 void KateConfig::configEnd ()
64 {
65  if (configSessionNumber == 0)
66  return;
67 
68  configSessionNumber--;
69 
70  if (configSessionNumber > 0)
71  return;
72 
73  configIsRunning = false;
74 
75  updateConfig ();
76 }
77 //END
78 
79 //BEGIN KateDocumentConfig
80 KateGlobalConfig *KateGlobalConfig::s_global = 0;
81 KateDocumentConfig *KateDocumentConfig::s_global = 0;
82 KateViewConfig *KateViewConfig::s_global = 0;
83 KateRendererConfig *KateRendererConfig::s_global = 0;
84 
85 KateGlobalConfig::KateGlobalConfig ()
86 {
87  s_global = this;
88 
89  // init with defaults from config or really hardcoded ones
90  KConfigGroup cg( KGlobal::config(), "Kate Part Defaults");
91  readConfig (cg);
92 }
93 
94 KateGlobalConfig::~KateGlobalConfig ()
95 {
96 }
97 
98 void KateGlobalConfig::readConfig (const KConfigGroup &config)
99 {
100  configStart ();
101 
102  setProberType ((KEncodingProber::ProberType)config.readEntry("Encoding Prober Type", (int)KEncodingProber::Universal));
103  setFallbackEncoding (config.readEntry("Fallback Encoding", ""));
104 
105  configEnd ();
106 }
107 
108 void KateGlobalConfig::writeConfig (KConfigGroup &config)
109 {
110  config.writeEntry("Encoding Prober Type", (int)proberType());
111  config.writeEntry("Fallback Encoding", fallbackEncoding());
112 }
113 
114 void KateGlobalConfig::updateConfig ()
115 {
116 }
117 
118 void KateGlobalConfig::setProberType (KEncodingProber::ProberType proberType)
119 {
120  configStart ();
121  m_proberType = proberType;
122  configEnd ();
123 }
124 
125 const QString &KateGlobalConfig::fallbackEncoding () const
126 {
127  return m_fallbackEncoding;
128 }
129 
130 QTextCodec *KateGlobalConfig::fallbackCodec () const
131 {
132  if (m_fallbackEncoding.isEmpty())
133  return QTextCodec::codecForName("ISO 8859-15");
134 
135  return KGlobal::charsets()->codecForName (m_fallbackEncoding);
136 }
137 
138 bool KateGlobalConfig::setFallbackEncoding (const QString &encoding)
139 {
140  QTextCodec *codec;
141  bool found = false;
142  if (encoding.isEmpty())
143  {
144  codec = s_global->fallbackCodec();
145  found = true;
146  }
147  else
148  codec = KGlobal::charsets()->codecForName (encoding, found);
149 
150  if (!found || !codec)
151  return false;
152 
153  configStart ();
154  m_fallbackEncoding = codec->name();
155  configEnd ();
156  return true;
157 }
158 
159 KateDocumentConfig::KateDocumentConfig ()
160  : m_indentationWidth (2),
161  m_tabWidth (8),
162  m_tabHandling (tabSmart),
163  m_configFlags (0),
164  m_wordWrapAt (80),
165  m_tabWidthSet (true),
166  m_indentationWidthSet (true),
167  m_indentationModeSet (true),
168  m_wordWrapSet (true),
169  m_wordWrapAtSet (true),
170  m_pageUpDownMovesCursorSet (true),
171  m_keepExtraSpacesSet (false),
172  m_indentPastedTextSet (false),
173  m_backspaceIndentsSet (false),
174  m_smartHomeSet (false),
175  m_showTabsSet (false),
176  m_showSpacesSet (false),
177  m_replaceTabsDynSet (false),
178  m_removeSpacesSet (false),
179  m_newLineAtEofSet (false),
180  m_overwiteModeSet (false),
181  m_tabIndentsSet (false),
182  m_encodingSet (true),
183  m_eolSet (true),
184  m_bomSet (true),
185  m_allowEolDetectionSet (false),
186  m_allowSimpleModeSet (false),
187  m_backupFlagsSet (true),
188  m_searchDirConfigDepthSet (true),
189  m_backupPrefixSet (true),
190  m_backupSuffixSet (true),
191  m_swapFileNoSyncSet (true),
192  m_onTheFlySpellCheckSet (true),
193  m_lineLengthLimitSet (true),
194  m_doc (0)
195 {
196  s_global = this;
197 
198  // init with defaults from config or really hardcoded ones
199  KConfigGroup cg( KGlobal::config(), "Kate Document Defaults");
200  readConfig (cg);
201 }
202 
203 KateDocumentConfig::KateDocumentConfig (const KConfigGroup &cg)
204  : m_indentationWidth (2),
205  m_tabWidth (8),
206  m_tabHandling (tabSmart),
207  m_configFlags (0),
208  m_wordWrapAt (80),
209  m_tabWidthSet (true),
210  m_indentationWidthSet (true),
211  m_indentationModeSet (true),
212  m_wordWrapSet (true),
213  m_wordWrapAtSet (true),
214  m_pageUpDownMovesCursorSet (true),
215  m_keepExtraSpacesSet (false),
216  m_indentPastedTextSet (false),
217  m_backspaceIndentsSet (false),
218  m_smartHomeSet (false),
219  m_showTabsSet (false),
220  m_showSpacesSet (false),
221  m_replaceTabsDynSet (false),
222  m_removeSpacesSet (false),
223  m_newLineAtEofSet (false),
224  m_overwiteModeSet (false),
225  m_tabIndentsSet (false),
226  m_encodingSet (true),
227  m_eolSet (true),
228  m_bomSet (true),
229  m_allowEolDetectionSet (false),
230  m_allowSimpleModeSet (false),
231  m_backupFlagsSet (true),
232  m_searchDirConfigDepthSet (true),
233  m_backupPrefixSet (true),
234  m_backupSuffixSet (true),
235  m_swapFileNoSyncSet (true),
236  m_onTheFlySpellCheckSet (true),
237  m_lineLengthLimitSet (true),
238  m_doc (0)
239 {
240  // init with defaults from config or really hardcoded ones
241  readConfig (cg);
242 }
243 
244 KateDocumentConfig::KateDocumentConfig (KateDocument *doc)
245  : m_tabHandling (tabSmart),
246  m_configFlags (0),
247  m_tabWidthSet (false),
248  m_indentationWidthSet (false),
249  m_indentationModeSet (false),
250  m_wordWrapSet (false),
251  m_wordWrapAtSet (false),
252  m_pageUpDownMovesCursorSet (false),
253  m_keepExtraSpacesSet (false),
254  m_indentPastedTextSet (false),
255  m_backspaceIndentsSet (false),
256  m_smartHomeSet (false),
257  m_showTabsSet (false),
258  m_showSpacesSet (false),
259  m_replaceTabsDynSet (false),
260  m_removeSpacesSet (false),
261  m_newLineAtEofSet (false),
262  m_overwiteModeSet (false),
263  m_tabIndentsSet (false),
264  m_encodingSet (false),
265  m_eolSet (false),
266  m_bomSet (false),
267  m_allowEolDetectionSet (false),
268  m_allowSimpleModeSet (false),
269  m_backupFlagsSet (false),
270  m_searchDirConfigDepthSet (false),
271  m_backupPrefixSet (false),
272  m_backupSuffixSet (false),
273  m_swapFileNoSyncSet (false),
274  m_onTheFlySpellCheckSet (false),
275  m_lineLengthLimitSet (false),
276  m_doc (doc)
277 {
278 }
279 
280 KateDocumentConfig::~KateDocumentConfig ()
281 {
282 }
283 
284 void KateDocumentConfig::readConfig (const KConfigGroup &config)
285 {
286  configStart ();
287 
288  setTabWidth (config.readEntry("Tab Width", 8));
289 
290  setIndentationWidth (config.readEntry("Indentation Width", 2));
291 
292  setIndentationMode (config.readEntry("Indentation Mode", "normal"));
293 
294  setTabHandling (config.readEntry("Tab Handling", int(KateDocumentConfig::tabSmart)));
295 
296  setWordWrap (config.readEntry("Word Wrap", false));
297  setWordWrapAt (config.readEntry("Word Wrap Column", 80));
298  setPageUpDownMovesCursor (config.readEntry("PageUp/PageDown Moves Cursor", false));
299 
300  setSmartHome (config.readEntry("Smart Home", true));
301  setShowTabs (config.readEntry("Show Tabs", true));
302  setTabIndents (config.readEntry("Indent On Tab", true));
303  setKeepExtraSpaces (config.readEntry("Keep Extra Spaces", false));
304  setIndentPastedText (config.readEntry("Indent On Text Paste", false));
305  setBackspaceIndents (config.readEntry("Indent On Backspace", false));
306  setShowSpaces (config.readEntry("Show Spaces", false));
307  setReplaceTabsDyn (config.readEntry("ReplaceTabsDyn", false));
308  setRemoveSpaces (config.readEntry("Remove Spaces", 0));
309  setNewLineAtEof (config.readEntry("Newline At EOF", false));
310  setOvr (config.readEntry("Overwrite Mode", false));
311 
312  setEncoding (config.readEntry("Encoding", ""));
313 
314  setEol (config.readEntry("End of Line", 0));
315  setAllowEolDetection (config.readEntry("Allow End of Line Detection", true));
316 
317  setBom (config.readEntry("BOM",false));
318 
319  setAllowSimpleMode (config.readEntry("Allow Simple Mode", true));
320 
321  setBackupFlags (config.readEntry("Backup Flags", 0));
322 
323  setSearchDirConfigDepth (config.readEntry("Search Dir Config Depth", 9));
324 
325  setBackupPrefix (config.readEntry("Backup Prefix", QString ("")));
326 
327  setBackupSuffix (config.readEntry("Backup Suffix", QString ("~")));
328 
329  setSwapFileNoSync (config.readEntry("No sync", false));
330 
331  setOnTheFlySpellCheck(config.readEntry("On-The-Fly Spellcheck", false));
332 
333  setLineLengthLimit(config.readEntry("Line Length Limit", 4096));
334 
335  configEnd ();
336 }
337 
338 void KateDocumentConfig::writeConfig (KConfigGroup &config)
339 {
340  config.writeEntry("Tab Width", tabWidth());
341 
342  config.writeEntry("Indentation Width", indentationWidth());
343  config.writeEntry("Indentation Mode", indentationMode());
344 
345  config.writeEntry("Tab Handling", tabHandling());
346 
347  config.writeEntry("Word Wrap", wordWrap());
348  config.writeEntry("Word Wrap Column", wordWrapAt());
349 
350  config.writeEntry("PageUp/PageDown Moves Cursor", pageUpDownMovesCursor());
351 
352  config.writeEntry("Smart Home", smartHome());
353  config.writeEntry("Show Tabs", showTabs());
354  config.writeEntry("Indent On Tab", tabIndentsEnabled());
355  config.writeEntry("Keep Extra Spaces", keepExtraSpaces());
356  config.writeEntry("Indent On Text Paste", indentPastedText());
357  config.writeEntry("Indent On Backspace", backspaceIndents());
358  config.writeEntry("Show Spaces", showSpaces());
359  config.writeEntry("ReplaceTabsDyn", replaceTabsDyn());
360  config.writeEntry("Remove Spaces", removeSpaces());
361  config.writeEntry("Newline At EOF", newLineAtEof());
362  config.writeEntry("Overwrite Mode", ovr());
363 
364  config.writeEntry("Encoding", encoding());
365 
366  config.writeEntry("End of Line", eol());
367  config.writeEntry("Allow End of Line Detection", allowEolDetection());
368 
369  config.writeEntry("BOM",bom());
370 
371  config.writeEntry("Allow Simple Mode", allowSimpleMode());
372 
373  config.writeEntry("Backup Flags", backupFlags());
374 
375  config.writeEntry("Search Dir Config Depth", searchDirConfigDepth());
376 
377  config.writeEntry("Backup Prefix", backupPrefix());
378 
379  config.writeEntry("Backup Suffix", backupSuffix());
380 
381  config.writeEntry("No sync", swapFileNoSync());
382 
383  config.writeEntry("On-The-Fly Spellcheck", onTheFlySpellCheck());
384 
385  config.writeEntry("Line Length Limit", lineLengthLimit());
386 }
387 
388 void KateDocumentConfig::updateConfig ()
389 {
390  if (m_doc)
391  {
392  m_doc->updateConfig ();
393  return;
394  }
395 
396  if (isGlobal())
397  {
398  for (int z=0; z < KateGlobal::self()->kateDocuments().size(); ++z)
399  (KateGlobal::self()->kateDocuments())[z]->updateConfig ();
400  }
401 }
402 
403 int KateDocumentConfig::tabWidth () const
404 {
405  if (m_tabWidthSet || isGlobal())
406  return m_tabWidth;
407 
408  return s_global->tabWidth();
409 }
410 
411 void KateDocumentConfig::setTabWidth (int tabWidth)
412 {
413  if (tabWidth < 1)
414  return;
415 
416  if (m_tabWidthSet && m_tabWidth == tabWidth)
417  return;
418 
419  configStart ();
420 
421  m_tabWidthSet = true;
422  m_tabWidth = tabWidth;
423 
424  configEnd ();
425 }
426 
427 int KateDocumentConfig::indentationWidth () const
428 {
429  if (m_indentationWidthSet || isGlobal())
430  return m_indentationWidth;
431 
432  return s_global->indentationWidth();
433 }
434 
435 void KateDocumentConfig::setIndentationWidth (int indentationWidth)
436 {
437  if (indentationWidth < 1)
438  return;
439 
440  if (m_indentationWidthSet && m_indentationWidth == indentationWidth)
441  return;
442 
443  configStart ();
444 
445  m_indentationWidthSet = true;
446  m_indentationWidth = indentationWidth;
447 
448  configEnd ();
449 }
450 
451 const QString &KateDocumentConfig::indentationMode () const
452 {
453  if (m_indentationModeSet || isGlobal())
454  return m_indentationMode;
455 
456  return s_global->indentationMode();
457 }
458 
459 void KateDocumentConfig::setIndentationMode (const QString &indentationMode)
460 {
461  if (m_indentationModeSet && m_indentationMode == indentationMode)
462  return;
463 
464  configStart ();
465 
466  m_indentationModeSet = true;
467  m_indentationMode = indentationMode;
468 
469  configEnd ();
470 }
471 
472 uint KateDocumentConfig::tabHandling () const
473 {
474  // This setting is purly a user preference,
475  // hence, there exists only the global setting.
476  if (isGlobal())
477  return m_tabHandling;
478 
479  return s_global->tabHandling();
480 }
481 
482 void KateDocumentConfig::setTabHandling (uint tabHandling)
483 {
484  configStart ();
485 
486  m_tabHandling = tabHandling;
487 
488  configEnd ();
489 }
490 
491 bool KateDocumentConfig::wordWrap () const
492 {
493  if (m_wordWrapSet || isGlobal())
494  return m_wordWrap;
495 
496  return s_global->wordWrap();
497 }
498 
499 void KateDocumentConfig::setWordWrap (bool on)
500 {
501  if (m_wordWrapSet && m_wordWrap == on)
502  return;
503 
504  configStart ();
505 
506  m_wordWrapSet = true;
507  m_wordWrap = on;
508 
509  configEnd ();
510 }
511 
512 int KateDocumentConfig::wordWrapAt () const
513 {
514  if (m_wordWrapAtSet || isGlobal())
515  return m_wordWrapAt;
516 
517  return s_global->wordWrapAt();
518 }
519 
520 void KateDocumentConfig::setWordWrapAt (int col)
521 {
522  if (col < 1)
523  return;
524 
525  if (m_wordWrapAtSet && m_wordWrapAt == col)
526  return;
527 
528  configStart ();
529 
530  m_wordWrapAtSet = true;
531  m_wordWrapAt = col;
532 
533  configEnd ();
534 }
535 
536 bool KateDocumentConfig::pageUpDownMovesCursor () const
537 {
538  if (m_pageUpDownMovesCursorSet || isGlobal())
539  return m_pageUpDownMovesCursor;
540 
541  return s_global->pageUpDownMovesCursor();
542 }
543 
544 void KateDocumentConfig::setPageUpDownMovesCursor (bool on)
545 {
546  if (m_pageUpDownMovesCursorSet && m_pageUpDownMovesCursor == on)
547  return;
548 
549  configStart ();
550 
551  m_pageUpDownMovesCursorSet = true;
552  m_pageUpDownMovesCursor = on;
553 
554  configEnd ();
555 }
556 
557 void KateDocumentConfig::setKeepExtraSpaces(bool on)
558 {
559  if (m_keepExtraSpacesSet && m_keepExtraSpaces == on)
560  return;
561 
562  configStart ();
563 
564  m_keepExtraSpacesSet = true;
565  m_keepExtraSpaces = on;
566 
567  configEnd ();
568 }
569 
570 bool KateDocumentConfig::keepExtraSpaces() const
571 {
572  if (m_keepExtraSpacesSet || isGlobal())
573  return m_keepExtraSpaces;
574 
575  return s_global->keepExtraSpaces();
576 }
577 
578 void KateDocumentConfig::setIndentPastedText(bool on)
579 {
580  if (m_indentPastedTextSet && m_indentPastedText == on)
581  return;
582 
583  configStart ();
584 
585  m_indentPastedTextSet = true;
586  m_indentPastedText = on;
587 
588  configEnd ();
589 }
590 
591 bool KateDocumentConfig::indentPastedText() const
592 {
593  if (m_indentPastedTextSet || isGlobal())
594  return m_indentPastedText;
595 
596  return s_global->indentPastedText();
597 }
598 
599 void KateDocumentConfig::setBackspaceIndents(bool on)
600 {
601  if (m_backspaceIndentsSet && m_backspaceIndents == on)
602  return;
603 
604  configStart ();
605 
606  m_backspaceIndentsSet = true;
607  m_backspaceIndents = on;
608 
609  configEnd ();
610 }
611 
612 bool KateDocumentConfig::backspaceIndents() const
613 {
614  if (m_backspaceIndentsSet || isGlobal())
615  return m_backspaceIndents;
616 
617  return s_global->backspaceIndents();
618 }
619 
620 void KateDocumentConfig::setSmartHome(bool on)
621 {
622  if (m_smartHomeSet && m_smartHome == on)
623  return;
624 
625  configStart ();
626 
627  m_smartHomeSet = true;
628  m_smartHome = on;
629 
630  configEnd ();
631 }
632 
633 bool KateDocumentConfig::smartHome() const
634 {
635  if (m_smartHomeSet || isGlobal())
636  return m_smartHome;
637 
638  return s_global->smartHome();
639 }
640 
641 void KateDocumentConfig::setShowTabs(bool on)
642 {
643  if (m_showTabsSet && m_showTabs == on)
644  return;
645 
646  configStart ();
647 
648  m_showTabsSet = true;
649  m_showTabs = on;
650 
651  configEnd ();
652 }
653 
654 bool KateDocumentConfig::showTabs() const
655 {
656  if (m_showTabsSet || isGlobal())
657  return m_showTabs;
658 
659  return s_global->showTabs();
660 }
661 
662 void KateDocumentConfig::setShowSpaces(bool on)
663 {
664  if (m_showSpacesSet && m_showSpaces == on)
665  return;
666 
667  configStart ();
668 
669  m_showSpacesSet = true;
670  m_showSpaces = on;
671 
672  configEnd ();
673 }
674 
675 bool KateDocumentConfig::showSpaces() const
676 {
677  if (m_showSpacesSet || isGlobal())
678  return m_showSpaces;
679 
680  return s_global->showSpaces();
681 }
682 
683 void KateDocumentConfig::setReplaceTabsDyn(bool on)
684 {
685  if (m_replaceTabsDynSet && m_replaceTabsDyn == on)
686  return;
687 
688  configStart ();
689 
690  m_replaceTabsDynSet = true;
691  m_replaceTabsDyn = on;
692 
693  configEnd ();
694 }
695 
696 bool KateDocumentConfig::replaceTabsDyn() const
697 {
698  if (m_replaceTabsDynSet || isGlobal())
699  return m_replaceTabsDyn;
700 
701  return s_global->replaceTabsDyn();
702 }
703 
704 void KateDocumentConfig::setRemoveSpaces(int triState)
705 {
706  if (m_removeSpacesSet && m_removeSpaces == triState)
707  return;
708 
709  configStart ();
710 
711  m_removeSpacesSet = true;
712  m_removeSpaces = triState;
713 
714  configEnd ();
715 }
716 
717 int KateDocumentConfig::removeSpaces() const
718 {
719  if (m_removeSpacesSet || isGlobal())
720  return m_removeSpaces;
721 
722  return s_global->removeSpaces();
723 }
724 
725 void KateDocumentConfig::setNewLineAtEof (bool on)
726 {
727  if (m_newLineAtEofSet && m_newLineAtEof == on)
728  return;
729 
730  configStart ();
731 
732  m_newLineAtEofSet = true;
733  m_newLineAtEof = on;
734 
735  configEnd ();
736 }
737 
738 bool KateDocumentConfig::newLineAtEof () const
739 {
740  if (m_newLineAtEofSet || isGlobal())
741  return m_newLineAtEof;
742 
743  return s_global->newLineAtEof();
744 }
745 
746 void KateDocumentConfig::setOvr(bool on)
747 {
748  if (m_overwiteModeSet && m_overwiteMode == on)
749  return;
750 
751  configStart ();
752 
753  m_overwiteModeSet = true;
754  m_overwiteMode = on;
755 
756  configEnd ();
757 }
758 
759 bool KateDocumentConfig::ovr() const
760 {
761  if (m_overwiteModeSet || isGlobal())
762  return m_overwiteMode;
763 
764  return s_global->ovr();
765 }
766 
767 void KateDocumentConfig::setTabIndents(bool on)
768 {
769  if (m_tabIndentsSet && m_tabIndents == on)
770  return;
771 
772  configStart ();
773 
774  m_tabIndentsSet = true;
775  m_tabIndents = on;
776 
777  configEnd ();
778 }
779 
780 bool KateDocumentConfig::tabIndentsEnabled() const
781 {
782  if (m_tabIndentsSet || isGlobal())
783  return m_tabIndents;
784 
785  return s_global->tabIndentsEnabled();
786 }
787 
788 const QString &KateDocumentConfig::encoding () const
789 {
790  if (m_encodingSet || isGlobal())
791  return m_encoding;
792 
793  return s_global->encoding();
794 }
795 
796 QTextCodec *KateDocumentConfig::codec () const
797 {
798  if (m_encodingSet || isGlobal())
799  {
800  if (m_encoding.isEmpty() && isGlobal())
801  return KGlobal::locale()->codecForEncoding();
802  else if (m_encoding.isEmpty())
803  return s_global->codec ();
804  else
805  return KGlobal::charsets()->codecForName (m_encoding);
806  }
807 
808  return s_global->codec ();
809 }
810 
811 bool KateDocumentConfig::setEncoding (const QString &encoding)
812 {
813  QTextCodec *codec;
814  bool found = false;
815  if (encoding.isEmpty())
816  {
817  codec = s_global->codec();
818  found=true;
819  }
820  else
821  codec = KGlobal::charsets()->codecForName (encoding, found);
822 
823  if (!found || !codec)
824  return false;
825 
826  configStart ();
827  m_encodingSet = true;
828  m_encoding = codec->name();
829 
830  if (isGlobal())
831  KateGlobal::self()->setDefaultEncoding (m_encoding);
832 
833  configEnd ();
834  return true;
835 }
836 
837 bool KateDocumentConfig::isSetEncoding () const
838 {
839  return m_encodingSet;
840 }
841 
842 int KateDocumentConfig::eol () const
843 {
844  if (m_eolSet || isGlobal())
845  return m_eol;
846 
847  return s_global->eol();
848 }
849 
850 QString KateDocumentConfig::eolString ()
851 {
852  if (eol() == KateDocumentConfig::eolUnix)
853  return QString ("\n");
854  else if (eol() == KateDocumentConfig::eolDos)
855  return QString ("\r\n");
856  else if (eol() == KateDocumentConfig::eolMac)
857  return QString ("\r");
858 
859  return QString ("\n");
860 }
861 
862 void KateDocumentConfig::setEol (int mode)
863 {
864  if (m_eolSet && m_eol == mode)
865  return;
866 
867  configStart ();
868 
869  m_eolSet = true;
870  m_eol = mode;
871 
872  configEnd ();
873 }
874 
875 void KateDocumentConfig::setBom (bool bom)
876 {
877  if (m_bomSet && m_bom == bom)
878  return;
879 
880  configStart ();
881 
882  m_bomSet = true;
883  m_bom = bom;
884 
885  configEnd ();
886 }
887 
888 bool KateDocumentConfig::bom() const
889 {
890  if (m_bomSet || isGlobal())
891  return m_bom;
892 
893  return s_global->bom();
894 }
895 
896 bool KateDocumentConfig::allowEolDetection () const
897 {
898  if (m_allowEolDetectionSet || isGlobal())
899  return m_allowEolDetection;
900 
901  return s_global->allowEolDetection();
902 }
903 
904 void KateDocumentConfig::setAllowEolDetection (bool on)
905 {
906  if (m_allowEolDetectionSet && m_allowEolDetection == on)
907  return;
908 
909  configStart ();
910 
911  m_allowEolDetectionSet = true;
912  m_allowEolDetection = on;
913 
914  configEnd ();
915 }
916 
917 bool KateDocumentConfig::allowSimpleMode () const
918 {
919  if (m_allowSimpleModeSet || isGlobal())
920  return m_allowSimpleMode;
921 
922  return s_global->allowSimpleMode();
923 }
924 
925 void KateDocumentConfig::setAllowSimpleMode (bool on)
926 {
927  if (m_allowSimpleModeSet && m_allowSimpleMode == on)
928  return;
929 
930  configStart ();
931 
932  m_allowSimpleModeSet = true;
933  m_allowSimpleMode = on;
934 
935  configEnd ();
936 }
937 
938 uint KateDocumentConfig::backupFlags () const
939 {
940  if (m_backupFlagsSet || isGlobal())
941  return m_backupFlags;
942 
943  return s_global->backupFlags();
944 }
945 
946 void KateDocumentConfig::setBackupFlags (uint flags)
947 {
948  if (m_backupFlagsSet && m_backupFlags == flags)
949  return;
950 
951  configStart ();
952 
953  m_backupFlagsSet = true;
954  m_backupFlags = flags;
955 
956  configEnd ();
957 }
958 
959 const QString &KateDocumentConfig::backupPrefix () const
960 {
961  if (m_backupPrefixSet || isGlobal())
962  return m_backupPrefix;
963 
964  return s_global->backupPrefix();
965 }
966 
967 const QString &KateDocumentConfig::backupSuffix () const
968 {
969  if (m_backupSuffixSet || isGlobal())
970  return m_backupSuffix;
971 
972  return s_global->backupSuffix();
973 }
974 
975 void KateDocumentConfig::setBackupPrefix (const QString &prefix)
976 {
977  if (m_backupPrefixSet && m_backupPrefix == prefix)
978  return;
979 
980  configStart ();
981 
982  m_backupPrefixSet = true;
983  m_backupPrefix = prefix;
984 
985  configEnd ();
986 }
987 
988 void KateDocumentConfig::setBackupSuffix (const QString &suffix)
989 {
990  if (m_backupSuffixSet && m_backupSuffix == suffix)
991  return;
992 
993  configStart ();
994 
995  m_backupSuffixSet = true;
996  m_backupSuffix = suffix;
997 
998  configEnd ();
999 }
1000 
1001 bool KateDocumentConfig::swapFileNoSync() const
1002 {
1003  if (m_swapFileNoSyncSet || isGlobal())
1004  return m_swapFileNoSync;
1005 
1006  return s_global->swapFileNoSync();
1007 }
1008 
1009 void KateDocumentConfig::setSwapFileNoSync(bool on)
1010 {
1011  if (m_swapFileNoSyncSet && m_swapFileNoSync == on)
1012  return;
1013 
1014  configStart();
1015 
1016  m_swapFileNoSyncSet = true;
1017  m_swapFileNoSync = on;
1018 
1019  configEnd();
1020 }
1021 
1022 int KateDocumentConfig::searchDirConfigDepth () const
1023 {
1024  if (m_searchDirConfigDepthSet || isGlobal())
1025  return m_searchDirConfigDepth;
1026 
1027  return s_global->searchDirConfigDepth ();
1028 }
1029 
1030 void KateDocumentConfig::setSearchDirConfigDepth (int depth)
1031 {
1032  if (m_searchDirConfigDepthSet && m_searchDirConfigDepth == depth)
1033  return;
1034 
1035  configStart ();
1036 
1037  m_searchDirConfigDepthSet = true;
1038  m_searchDirConfigDepth = depth;
1039 
1040  configEnd ();
1041 }
1042 
1043 bool KateDocumentConfig::onTheFlySpellCheck() const
1044 {
1045  if(isGlobal()) {
1046  // WARNING: this is slightly hackish, but it's currently the only way to
1047  // do it, see also the KTextEdit class
1048  KConfigGroup configGroup(KGlobal::config(), "Spelling");
1049  return configGroup.readEntry("checkerEnabledByDefault", false);
1050  }
1051  if (m_onTheFlySpellCheckSet) {
1052  return m_onTheFlySpellCheck;
1053  }
1054 
1055  return s_global->onTheFlySpellCheck();
1056 }
1057 
1058 void KateDocumentConfig::setOnTheFlySpellCheck(bool on)
1059 {
1060  if (m_onTheFlySpellCheckSet && m_onTheFlySpellCheck == on)
1061  return;
1062 
1063  configStart ();
1064 
1065  m_onTheFlySpellCheckSet = true;
1066  m_onTheFlySpellCheck = on;
1067 
1068  configEnd ();
1069 }
1070 
1071 
1072 int KateDocumentConfig::lineLengthLimit() const
1073 {
1074  if (m_lineLengthLimitSet || isGlobal())
1075  return m_lineLengthLimit;
1076 
1077  return s_global->lineLengthLimit();
1078 }
1079 
1080 void KateDocumentConfig::setLineLengthLimit(int lineLengthLimit)
1081 {
1082  if (m_lineLengthLimitSet && m_lineLengthLimit == lineLengthLimit)
1083  return;
1084 
1085  configStart();
1086 
1087  m_lineLengthLimitSet = true;
1088  m_lineLengthLimit = lineLengthLimit;
1089 
1090  configEnd();
1091 }
1092 
1093 
1094 
1095 //END
1096 
1097 //BEGIN KateViewConfig
1098 KateViewConfig::KateViewConfig ()
1099  :
1100  m_dynWordWrapSet (true),
1101  m_dynWordWrapIndicatorsSet (true),
1102  m_dynWordWrapAlignIndentSet (true),
1103  m_lineNumbersSet (true),
1104  m_scrollBarMarksSet (true),
1105  m_scrollBarMiniMapSet (true),
1106  m_scrollBarMiniMapAllSet (true),
1107  m_scrollBarMiniMapWidthSet (true),
1108  m_iconBarSet (true),
1109  m_foldingBarSet (true),
1110  m_lineModificationSet (true),
1111  m_bookmarkSortSet (true),
1112  m_autoCenterLinesSet (true),
1113  m_searchFlagsSet (true),
1114  m_defaultMarkTypeSet (true),
1115  m_persistentSelectionSet (true),
1116  m_viInputModeSet (true),
1117  m_viInputModeStealKeysSet (true),
1118  m_viInputModeEmulateCommandBarSet(false),
1119  m_automaticCompletionInvocationSet (true),
1120  m_wordCompletionSet (true),
1121  m_wordCompletionMinimalWordLengthSet (true),
1122  m_smartCopyCutSet (true),
1123  m_scrollPastEndSet (true),
1124  m_allowMarkMenu (true),
1125  m_wordCompletionRemoveTailSet (false),
1126  m_view (0)
1127 {
1128  s_global = this;
1129 
1130  // init with defaults from config or really hardcoded ones
1131  KConfigGroup config( KGlobal::config(), "Kate View Defaults");
1132  readConfig (config);
1133 }
1134 
1135 KateViewConfig::KateViewConfig (KateView *view)
1136  :
1137  m_searchFlags (PowerModePlainText),
1138  m_maxHistorySize (100),
1139  m_dynWordWrapSet (false),
1140  m_dynWordWrapIndicatorsSet (false),
1141  m_dynWordWrapAlignIndentSet (false),
1142  m_lineNumbersSet (false),
1143  m_scrollBarMarksSet (false),
1144  m_scrollBarMiniMapSet (false),
1145  m_scrollBarMiniMapAllSet (false),
1146  m_scrollBarMiniMapWidthSet (false),
1147  m_iconBarSet (false),
1148  m_foldingBarSet (false),
1149  m_lineModificationSet (false),
1150  m_bookmarkSortSet (false),
1151  m_autoCenterLinesSet (false),
1152  m_searchFlagsSet (false),
1153  m_defaultMarkTypeSet (false),
1154  m_persistentSelectionSet (false),
1155  m_viInputModeSet (false),
1156  m_viInputModeStealKeysSet (false),
1157  m_viInputModeEmulateCommandBarSet(false),
1158  m_automaticCompletionInvocationSet (false),
1159  m_wordCompletionSet (false),
1160  m_wordCompletionMinimalWordLengthSet (false),
1161  m_smartCopyCutSet (false),
1162  m_scrollPastEndSet (false),
1163  m_allowMarkMenu (true),
1164  m_wordCompletionRemoveTailSet (false),
1165  m_view (view)
1166 {
1167 }
1168 
1169 KateViewConfig::~KateViewConfig ()
1170 {
1171 }
1172 
1173 
1174 // TODO Extract more keys to constants for maintainability
1175 static const char * const KEY_SEARCH_REPLACE_FLAGS = "Search/Replace Flags";
1176 static const char * const KEY_PATTERN_HISTORY = "Search Pattern History";
1177 static const char * const KEY_REPLACEMENT_HISTORY = "Replacement Text History";
1178 
1179 
1180 void KateViewConfig::readConfig ( const KConfigGroup &config)
1181 {
1182  configStart ();
1183 
1184  // default off again, until this is usable for large size documents
1185  setDynWordWrap (config.readEntry( "Dynamic Word Wrap", false ));
1186  setDynWordWrapIndicators (config.readEntry( "Dynamic Word Wrap Indicators", 1 ));
1187  setDynWordWrapAlignIndent (config.readEntry( "Dynamic Word Wrap Align Indent", 80 ));
1188 
1189  setLineNumbers (config.readEntry( "Line Numbers", false));
1190 
1191  setScrollBarMarks (config.readEntry( "Scroll Bar Marks", false));
1192 
1193  setScrollBarMiniMap (config.readEntry( "Scroll Bar Mini Map", false));
1194 
1195  setScrollBarMiniMapAll (config.readEntry( "Scroll Bar Mini Map All", false));
1196 
1197  setScrollBarMiniMapWidth (config.readEntry( "Scroll Bar Mini Map Width", 60));
1198 
1199  setIconBar (config.readEntry( "Icon Bar", false ));
1200 
1201  setFoldingBar (config.readEntry( "Folding Bar", true));
1202 
1203  setLineModification (config.readEntry( "Line Modification", false));
1204 
1205  setBookmarkSort (config.readEntry( "Bookmark Menu Sorting", 0 ));
1206 
1207  setAutoCenterLines (config.readEntry( "Auto Center Lines", 0 ));
1208 
1209  setSearchFlags(config.readEntry(KEY_SEARCH_REPLACE_FLAGS,
1210  IncFromCursor|PowerMatchCase|PowerModePlainText));
1211 
1212  m_maxHistorySize = config.readEntry("Maximum Search History Size", 100);
1213 
1214  setDefaultMarkType (config.readEntry( "Default Mark Type", int(KTextEditor::MarkInterface::markType01) ));
1215  setAllowMarkMenu (config.readEntry( "Allow Mark Menu", true ));
1216 
1217  setPersistentSelection (config.readEntry( "Persistent Selection", false ));
1218 
1219  setViInputMode (config.readEntry( "Vi Input Mode", false));
1220  setViInputModeStealKeys (config.readEntry( "Vi Input Mode Steal Keys", false));
1221  setViInputModeEmulateCommandBar (config.readEntry( "Vi Input Mode Emulate Command Bar", false));
1222 
1223  setAutomaticCompletionInvocation (config.readEntry( "Auto Completion", true ));
1224  setWordCompletion (config.readEntry( "Word Completion", true ));
1225  setWordCompletionMinimalWordLength (config.readEntry( "Word Completion Minimal Word Length", 3 ));
1226  setWordCompletionRemoveTail (config.readEntry( "Word Completion Remove Tail", true ));
1227  setSmartCopyCut (config.readEntry( "Smart Copy Cut", false ));
1228  setScrollPastEnd (config.readEntry( "Scroll Past End", false ));
1229 
1230  if (isGlobal()) {
1231  // Read search pattern history
1232  QStringList patternHistory = config.readEntry(KEY_PATTERN_HISTORY, QStringList());
1233  m_patternHistoryModel.setStringList(patternHistory);
1234 
1235  // Read replacement text history
1236  QStringList replacementHistory = config.readEntry(KEY_REPLACEMENT_HISTORY, QStringList());
1237  m_replacementHistoryModel.setStringList(replacementHistory);
1238  }
1239 
1240  configEnd ();
1241 }
1242 
1243 void KateViewConfig::writeConfig (KConfigGroup &config)
1244 {
1245  config.writeEntry( "Dynamic Word Wrap", dynWordWrap() );
1246  config.writeEntry( "Dynamic Word Wrap Indicators", dynWordWrapIndicators() );
1247  config.writeEntry( "Dynamic Word Wrap Align Indent", dynWordWrapAlignIndent() );
1248 
1249  config.writeEntry( "Line Numbers", lineNumbers() );
1250 
1251  config.writeEntry( "Scroll Bar Marks", scrollBarMarks() );
1252 
1253  config.writeEntry( "Scroll Bar Mini Map", scrollBarMiniMap() );
1254 
1255  config.writeEntry( "Scroll Bar Mini Map All", scrollBarMiniMapAll() );
1256 
1257  config.writeEntry( "Scroll Bar Mini Map Width", scrollBarMiniMapWidth() );
1258 
1259  config.writeEntry( "Icon Bar", iconBar() );
1260 
1261  config.writeEntry( "Folding Bar", foldingBar() );
1262 
1263  config.writeEntry( "Line Modification", lineModification() );
1264 
1265  config.writeEntry( "Bookmark Menu Sorting", bookmarkSort() );
1266 
1267  config.writeEntry( "Auto Center Lines", autoCenterLines() );
1268 
1269  config.writeEntry(KEY_SEARCH_REPLACE_FLAGS, int(searchFlags()));
1270 
1271  config.writeEntry("Maximum Search History Size", m_maxHistorySize);
1272 
1273  config.writeEntry("Default Mark Type", defaultMarkType());
1274 
1275  config.writeEntry("Allow Mark Menu", allowMarkMenu());
1276 
1277  config.writeEntry("Persistent Selection", persistentSelection());
1278 
1279  config.writeEntry( "Auto Completion", automaticCompletionInvocation());
1280  config.writeEntry( "Word Completion", wordCompletion());
1281  config.writeEntry( "Word Completion Minimal Word Length", wordCompletionMinimalWordLength());
1282  config.writeEntry( "Word Completion Remove Tail", wordCompletionRemoveTail());
1283 
1284  config.writeEntry( "Smart Copy Cut", smartCopyCut() );
1285  config.writeEntry( "Scroll Past End" , scrollPastEnd() );
1286 
1287  config.writeEntry( "Vi Input Mode", viInputMode());
1288 
1289  config.writeEntry( "Vi Input Mode Steal Keys", viInputModeStealKeys());
1290 
1291  config.writeEntry( "Vi Input Mode Emulate Command Bar", viInputModeEmulateCommandBar());
1292 
1293 
1294  if (isGlobal()) {
1295  // Write search pattern history
1296  config.writeEntry(KEY_PATTERN_HISTORY, m_patternHistoryModel.stringList());
1297 
1298  // Write replacement text history
1299  config.writeEntry(KEY_REPLACEMENT_HISTORY, m_replacementHistoryModel.stringList());
1300  }
1301 }
1302 
1303 void KateViewConfig::updateConfig ()
1304 {
1305  if (m_view)
1306  {
1307  m_view->updateConfig ();
1308  return;
1309  }
1310 
1311  if (isGlobal())
1312  {
1313  for (int z=0; z < KateGlobal::self()->views().size(); ++z)
1314  (KateGlobal::self()->views())[z]->updateConfig ();
1315  }
1316 }
1317 
1318 bool KateViewConfig::dynWordWrap () const
1319 {
1320  if (m_dynWordWrapSet || isGlobal())
1321  return m_dynWordWrap;
1322 
1323  return s_global->dynWordWrap();
1324 }
1325 
1326 void KateViewConfig::setDynWordWrap (bool wrap)
1327 {
1328  if (m_dynWordWrapSet && m_dynWordWrap == wrap)
1329  return;
1330 
1331  configStart ();
1332 
1333  m_dynWordWrapSet = true;
1334  m_dynWordWrap = wrap;
1335 
1336  configEnd ();
1337 }
1338 
1339 int KateViewConfig::dynWordWrapIndicators () const
1340 {
1341  if (m_dynWordWrapIndicatorsSet || isGlobal())
1342  return m_dynWordWrapIndicators;
1343 
1344  return s_global->dynWordWrapIndicators();
1345 }
1346 
1347 void KateViewConfig::setDynWordWrapIndicators (int mode)
1348 {
1349  if (m_dynWordWrapIndicatorsSet && m_dynWordWrapIndicators == mode)
1350  return;
1351 
1352  configStart ();
1353 
1354  m_dynWordWrapIndicatorsSet = true;
1355  m_dynWordWrapIndicators = qBound(0, mode, 80);
1356 
1357  configEnd ();
1358 }
1359 
1360 int KateViewConfig::dynWordWrapAlignIndent () const
1361 {
1362  if (m_dynWordWrapAlignIndentSet || isGlobal())
1363  return m_dynWordWrapAlignIndent;
1364 
1365  return s_global->dynWordWrapAlignIndent();
1366 }
1367 
1368 void KateViewConfig::setDynWordWrapAlignIndent (int indent)
1369 {
1370  if (m_dynWordWrapAlignIndentSet && m_dynWordWrapAlignIndent == indent)
1371  return;
1372 
1373  configStart ();
1374 
1375  m_dynWordWrapAlignIndentSet = true;
1376  m_dynWordWrapAlignIndent = indent;
1377 
1378  configEnd ();
1379 }
1380 
1381 bool KateViewConfig::lineNumbers () const
1382 {
1383  if (m_lineNumbersSet || isGlobal())
1384  return m_lineNumbers;
1385 
1386  return s_global->lineNumbers();
1387 }
1388 
1389 void KateViewConfig::setLineNumbers (bool on)
1390 {
1391  if (m_lineNumbersSet && m_lineNumbers == on)
1392  return;
1393 
1394  configStart ();
1395 
1396  m_lineNumbersSet = true;
1397  m_lineNumbers = on;
1398 
1399  configEnd ();
1400 }
1401 
1402 bool KateViewConfig::scrollBarMarks () const
1403 {
1404  if (m_scrollBarMarksSet || isGlobal())
1405  return m_scrollBarMarks;
1406 
1407  return s_global->scrollBarMarks();
1408 }
1409 
1410 void KateViewConfig::setScrollBarMarks (bool on)
1411 {
1412  if (m_scrollBarMarksSet && m_scrollBarMarks == on)
1413  return;
1414 
1415  configStart ();
1416 
1417  m_scrollBarMarksSet = true;
1418  m_scrollBarMarks = on;
1419 
1420  configEnd ();
1421 }
1422 
1423 bool KateViewConfig::scrollBarMiniMap () const
1424 {
1425  if (m_scrollBarMiniMapSet || isGlobal())
1426  return m_scrollBarMiniMap;
1427 
1428  return s_global->scrollBarMiniMap();
1429 }
1430 
1431 void KateViewConfig::setScrollBarMiniMap (bool on)
1432 {
1433  if (m_scrollBarMiniMapSet && m_scrollBarMiniMap == on)
1434  return;
1435 
1436  configStart ();
1437 
1438  m_scrollBarMiniMapSet = true;
1439  m_scrollBarMiniMap = on;
1440 
1441  configEnd ();
1442 }
1443 
1444 bool KateViewConfig::scrollBarMiniMapAll () const
1445 {
1446  if (m_scrollBarMiniMapAllSet || isGlobal())
1447  return m_scrollBarMiniMapAll;
1448 
1449  return s_global->scrollBarMiniMapAll();
1450 }
1451 
1452 void KateViewConfig::setScrollBarMiniMapAll (bool on)
1453 {
1454  if (m_scrollBarMiniMapAllSet && m_scrollBarMiniMapAll == on)
1455  return;
1456 
1457  configStart ();
1458 
1459  m_scrollBarMiniMapAllSet = true;
1460  m_scrollBarMiniMapAll = on;
1461 
1462  configEnd ();
1463 }
1464 
1465 int KateViewConfig::scrollBarMiniMapWidth () const
1466 {
1467  if (m_scrollBarMiniMapWidthSet || isGlobal())
1468  return m_scrollBarMiniMapWidth;
1469 
1470  return s_global->scrollBarMiniMapWidth();
1471 }
1472 
1473 void KateViewConfig::setScrollBarMiniMapWidth (int width)
1474 {
1475  if (m_scrollBarMiniMapWidthSet && m_scrollBarMiniMapWidth == width)
1476  return;
1477 
1478  configStart ();
1479 
1480  m_scrollBarMiniMapWidthSet = true;
1481  m_scrollBarMiniMapWidth = width;
1482 
1483  configEnd ();
1484 }
1485 
1486 bool KateViewConfig::iconBar () const
1487 {
1488  if (m_iconBarSet || isGlobal())
1489  return m_iconBar;
1490 
1491  return s_global->iconBar();
1492 }
1493 
1494 void KateViewConfig::setIconBar (bool on)
1495 {
1496  if (m_iconBarSet && m_iconBar == on)
1497  return;
1498 
1499  configStart ();
1500 
1501  m_iconBarSet = true;
1502  m_iconBar = on;
1503 
1504  configEnd ();
1505 }
1506 
1507 bool KateViewConfig::foldingBar () const
1508 {
1509  if (m_foldingBarSet || isGlobal())
1510  return m_foldingBar;
1511 
1512  return s_global->foldingBar();
1513 }
1514 
1515 void KateViewConfig::setFoldingBar (bool on)
1516 {
1517  if (m_foldingBarSet && m_foldingBar == on)
1518  return;
1519 
1520  configStart ();
1521 
1522  m_foldingBarSet = true;
1523  m_foldingBar = on;
1524 
1525  configEnd ();
1526 }
1527 
1528 bool KateViewConfig::lineModification () const
1529 {
1530  if (m_lineModificationSet || isGlobal())
1531  return m_lineModification;
1532 
1533  return s_global->lineModification();
1534 }
1535 
1536 void KateViewConfig::setLineModification (bool on)
1537 {
1538  if (m_lineModificationSet && m_lineModification == on)
1539  return;
1540 
1541  configStart ();
1542 
1543  m_lineModificationSet = true;
1544  m_lineModification = on;
1545 
1546  configEnd ();
1547 }
1548 
1549 int KateViewConfig::bookmarkSort () const
1550 {
1551  if (m_bookmarkSortSet || isGlobal())
1552  return m_bookmarkSort;
1553 
1554  return s_global->bookmarkSort();
1555 }
1556 
1557 void KateViewConfig::setBookmarkSort (int mode)
1558 {
1559  if (m_bookmarkSortSet && m_bookmarkSort == mode)
1560  return;
1561 
1562  configStart ();
1563 
1564  m_bookmarkSortSet = true;
1565  m_bookmarkSort = mode;
1566 
1567  configEnd ();
1568 }
1569 
1570 int KateViewConfig::autoCenterLines () const
1571 {
1572  if (m_autoCenterLinesSet || isGlobal())
1573  return m_autoCenterLines;
1574 
1575  return s_global->autoCenterLines();
1576 }
1577 
1578 void KateViewConfig::setAutoCenterLines (int lines)
1579 {
1580  if (lines < 0)
1581  return;
1582 
1583  if (m_autoCenterLinesSet && m_autoCenterLines == lines)
1584  return;
1585 
1586  configStart ();
1587 
1588  m_autoCenterLinesSet = true;
1589  m_autoCenterLines = lines;
1590 
1591  configEnd ();
1592 }
1593 
1594 long KateViewConfig::searchFlags () const
1595 {
1596  if (m_searchFlagsSet || isGlobal())
1597  return m_searchFlags;
1598 
1599  return s_global->searchFlags();
1600 }
1601 
1602 void KateViewConfig::setSearchFlags (long flags)
1603 {
1604  if (m_searchFlagsSet && m_searchFlags == flags)
1605  return;
1606 
1607  configStart ();
1608 
1609  m_searchFlagsSet = true;
1610  m_searchFlags = flags;
1611 
1612  configEnd ();
1613 }
1614 
1615 QStringListModel *KateViewConfig::patternHistoryModel()
1616 {
1617  // always return global history
1618  if (isGlobal())
1619  return &m_patternHistoryModel;
1620 
1621  return s_global->patternHistoryModel();
1622 }
1623 
1624 int KateViewConfig::maxHistorySize() const
1625 {
1626  return m_maxHistorySize;
1627 }
1628 
1629 QStringListModel *KateViewConfig::replacementHistoryModel()
1630 {
1631  // always return global history
1632  if (isGlobal())
1633  return &m_replacementHistoryModel;
1634 
1635  return s_global->replacementHistoryModel();
1636 }
1637 
1638 uint KateViewConfig::defaultMarkType () const
1639 {
1640  if (m_defaultMarkTypeSet || isGlobal())
1641  return m_defaultMarkType;
1642 
1643  return s_global->defaultMarkType();
1644 }
1645 
1646 void KateViewConfig::setDefaultMarkType (uint type)
1647 {
1648  if (m_defaultMarkTypeSet && m_defaultMarkType == type)
1649  return;
1650 
1651  configStart ();
1652 
1653  m_defaultMarkTypeSet = true;
1654  m_defaultMarkType = type;
1655 
1656  configEnd ();
1657 }
1658 
1659 bool KateViewConfig::allowMarkMenu() const
1660 {
1661  return m_allowMarkMenu;
1662 }
1663 
1664 void KateViewConfig::setAllowMarkMenu (bool allow)
1665 {
1666  m_allowMarkMenu = allow;
1667 }
1668 
1669 bool KateViewConfig::persistentSelection () const
1670 {
1671  if (m_persistentSelectionSet || isGlobal())
1672  return m_persistentSelection;
1673 
1674  return s_global->persistentSelection();
1675 }
1676 
1677 void KateViewConfig::setPersistentSelection (bool on)
1678 {
1679  if (m_persistentSelectionSet && m_persistentSelection == on)
1680  return;
1681 
1682  configStart ();
1683 
1684  m_persistentSelectionSet = true;
1685  m_persistentSelection = on;
1686 
1687  configEnd ();
1688 }
1689 
1690 bool KateViewConfig::viInputMode () const
1691 {
1692  if (m_viInputModeSet || isGlobal())
1693  return m_viInputMode;
1694 
1695  return s_global->viInputMode();
1696 }
1697 
1698 void KateViewConfig::setViInputMode (bool on)
1699 {
1700  if (m_viInputModeSet && m_viInputMode == on)
1701  return;
1702 
1703  configStart ();
1704 
1705  m_viInputModeSet = true;
1706  m_viInputMode = on;
1707 
1708  // make sure to turn off edits mergin when leaving vi input mode
1709  if (!on && m_view) {
1710  m_view->doc()->setUndoMergeAllEdits(false);
1711  }
1712 
1713  configEnd ();
1714 }
1715 
1716 bool KateViewConfig::viInputModeStealKeys () const
1717 {
1718  if (m_viInputModeStealKeysSet || isGlobal())
1719  return m_viInputModeStealKeys;
1720 
1721  return s_global->viInputModeStealKeys();
1722 }
1723 
1724 void KateViewConfig::setViInputModeStealKeys (bool on)
1725 {
1726  if (m_viInputModeStealKeysSet && m_viInputModeStealKeys == on)
1727  return;
1728 
1729  configStart ();
1730  m_viInputModeStealKeysSet = true;
1731  m_viInputModeStealKeys = on;
1732  configEnd ();
1733 }
1734 
1735 
1736 bool KateViewConfig::viInputModeEmulateCommandBar() const
1737 {
1738  if (m_viInputModeEmulateCommandBarSet || isGlobal())
1739  return m_viInputModeEmulateCommandBar;
1740 
1741  return s_global->viInputModeEmulateCommandBar();
1742 }
1743 
1744 void KateViewConfig::setViInputModeEmulateCommandBar(bool on)
1745 {
1746  if (m_viInputModeEmulateCommandBarSet && m_viInputModeEmulateCommandBar == on)
1747  return;
1748 
1749  configStart();
1750  m_viInputModeEmulateCommandBarSet = true;
1751  m_viInputModeEmulateCommandBar = on;
1752  configEnd();
1753 }
1754 
1755 bool KateViewConfig::automaticCompletionInvocation () const
1756 {
1757  if (m_automaticCompletionInvocationSet || isGlobal())
1758  return m_automaticCompletionInvocation;
1759 
1760  return s_global->automaticCompletionInvocation();
1761 }
1762 
1763 void KateViewConfig::setAutomaticCompletionInvocation (bool on)
1764 {
1765  if (m_automaticCompletionInvocationSet && m_automaticCompletionInvocation == on)
1766  return;
1767 
1768  configStart ();
1769  m_automaticCompletionInvocationSet = true;
1770  m_automaticCompletionInvocation = on;
1771  configEnd ();
1772 }
1773 
1774 bool KateViewConfig::wordCompletion () const
1775 {
1776  if (m_wordCompletionSet || isGlobal())
1777  return m_wordCompletion;
1778 
1779  return s_global->wordCompletion();
1780 }
1781 
1782 void KateViewConfig::setWordCompletion (bool on)
1783 {
1784  if (m_wordCompletionSet && m_wordCompletion == on)
1785  return;
1786 
1787  configStart ();
1788  m_wordCompletionSet = true;
1789  m_wordCompletion = on;
1790  configEnd ();
1791 }
1792 
1793 int KateViewConfig::wordCompletionMinimalWordLength () const
1794 {
1795  if (m_wordCompletionMinimalWordLengthSet || isGlobal())
1796  return m_wordCompletionMinimalWordLength;
1797 
1798  return s_global->wordCompletionMinimalWordLength();
1799 }
1800 
1801 void KateViewConfig::setWordCompletionMinimalWordLength (int length)
1802 {
1803  if (m_wordCompletionMinimalWordLengthSet && m_wordCompletionMinimalWordLength == length)
1804  return;
1805 
1806  configStart ();
1807 
1808  m_wordCompletionMinimalWordLengthSet = true;
1809  m_wordCompletionMinimalWordLength = length;
1810 
1811  configEnd ();
1812 }
1813 
1814 bool KateViewConfig::wordCompletionRemoveTail () const
1815 {
1816  if (m_wordCompletionRemoveTailSet || isGlobal())
1817  return m_wordCompletionRemoveTail;
1818 
1819  return s_global->wordCompletionRemoveTail();
1820 }
1821 
1822 void KateViewConfig::setWordCompletionRemoveTail (bool on)
1823 {
1824  if (m_wordCompletionRemoveTailSet && m_wordCompletionRemoveTail == on)
1825  return;
1826 
1827  configStart ();
1828  m_wordCompletionRemoveTailSet = true;
1829  m_wordCompletionRemoveTail = on;
1830  configEnd ();
1831 }
1832 
1833 bool KateViewConfig::smartCopyCut () const
1834 {
1835  if (m_smartCopyCutSet || isGlobal())
1836  return m_smartCopyCut;
1837 
1838  return s_global->smartCopyCut();
1839 }
1840 
1841 void KateViewConfig::setSmartCopyCut (bool on)
1842 {
1843  if (m_smartCopyCutSet && m_smartCopyCut == on)
1844  return;
1845 
1846  configStart ();
1847 
1848  m_smartCopyCutSet = true;
1849  m_smartCopyCut = on;
1850 
1851  configEnd ();
1852 }
1853 
1854 bool KateViewConfig::scrollPastEnd () const
1855 {
1856  if (m_scrollPastEndSet || isGlobal())
1857  return m_scrollPastEnd;
1858 
1859  return s_global->scrollPastEnd();
1860 }
1861 
1862 void KateViewConfig::setScrollPastEnd (bool on)
1863 {
1864  if (m_scrollPastEndSet && m_scrollPastEnd == on)
1865  return;
1866 
1867  configStart ();
1868 
1869  m_scrollPastEndSet = true;
1870  m_scrollPastEnd = on;
1871 
1872  configEnd ();
1873 }
1874 
1875 //END
1876 
1877 //BEGIN KateRendererConfig
1878 KateRendererConfig::KateRendererConfig ()
1879  : m_fontMetrics(QFont()),
1880  m_lineMarkerColor (KTextEditor::MarkInterface::reservedMarkersCount()),
1881  m_schemaSet (true),
1882  m_fontSet (true),
1883  m_wordWrapMarkerSet (true),
1884  m_showIndentationLinesSet (true),
1885  m_showWholeBracketExpressionSet (true),
1886  m_backgroundColorSet (true),
1887  m_selectionColorSet (true),
1888  m_highlightedLineColorSet (true),
1889  m_highlightedBracketColorSet (true),
1890  m_wordWrapMarkerColorSet (true),
1891  m_tabMarkerColorSet(true),
1892  m_indentationLineColorSet(true),
1893  m_iconBarColorSet(true),
1894  m_foldingColorSet(true),
1895  m_lineNumberColorSet (true),
1896  m_separatorColorSet (true),
1897  m_spellingMistakeLineColorSet (true),
1898  m_templateColorsSet(true),
1899  m_modifiedLineColorSet(true),
1900  m_savedLineColorSet(true),
1901  m_searchHighlightColorSet(true),
1902  m_replaceHighlightColorSet(true),
1903  m_lineMarkerColorSet (m_lineMarkerColor.size()),
1904  m_renderer (0)
1905 {
1906  // init bitarray
1907  m_lineMarkerColorSet.fill (true);
1908 
1909  s_global = this;
1910 
1911  // init with defaults from config or really hardcoded ones
1912  KConfigGroup config(KGlobal::config(), "Kate Renderer Defaults");
1913  readConfig (config);
1914 }
1915 
1916 KateRendererConfig::KateRendererConfig (KateRenderer *renderer)
1917  : m_fontMetrics(QFont()),
1918  m_lineMarkerColor (KTextEditor::MarkInterface::reservedMarkersCount()),
1919  m_schemaSet (false),
1920  m_fontSet (false),
1921  m_wordWrapMarkerSet (false),
1922  m_showIndentationLinesSet (false),
1923  m_showWholeBracketExpressionSet (false),
1924  m_backgroundColorSet (false),
1925  m_selectionColorSet (false),
1926  m_highlightedLineColorSet (false),
1927  m_highlightedBracketColorSet (false),
1928  m_wordWrapMarkerColorSet (false),
1929  m_tabMarkerColorSet (false),
1930  m_indentationLineColorSet (false),
1931  m_iconBarColorSet (false),
1932  m_foldingColorSet (false),
1933  m_lineNumberColorSet (false),
1934  m_separatorColorSet (false),
1935  m_spellingMistakeLineColorSet (false),
1936  m_templateColorsSet(false),
1937  m_modifiedLineColorSet(false),
1938  m_savedLineColorSet(false),
1939  m_searchHighlightColorSet(false),
1940  m_replaceHighlightColorSet(false),
1941  m_lineMarkerColorSet (m_lineMarkerColor.size()),
1942  m_renderer (renderer)
1943 {
1944  // init bitarray
1945  m_lineMarkerColorSet.fill (false);
1946 }
1947 
1948 KateRendererConfig::~KateRendererConfig ()
1949 {
1950 }
1951 
1952 void KateRendererConfig::readConfig (const KConfigGroup &config)
1953 {
1954  configStart ();
1955 
1956  // "Normal" Schema MUST BE THERE, see global kateschemarc
1957  setSchema (config.readEntry("Schema", "Normal"));
1958 
1959  setWordWrapMarker (config.readEntry("Word Wrap Marker", false ));
1960 
1961  setShowIndentationLines (config.readEntry( "Show Indentation Lines", false));
1962 
1963  setShowWholeBracketExpression (config.readEntry( "Show Whole Bracket Expression", false));
1964 
1965  configEnd ();
1966 }
1967 
1968 void KateRendererConfig::writeConfig (KConfigGroup& config)
1969 {
1970  config.writeEntry ("Schema", schema());
1971 
1972  config.writeEntry("Word Wrap Marker", wordWrapMarker() );
1973 
1974  config.writeEntry("Show Indentation Lines", showIndentationLines());
1975 
1976  config.writeEntry("Show Whole Bracket Expression", showWholeBracketExpression());
1977 }
1978 
1979 void KateRendererConfig::updateConfig ()
1980 {
1981  if (m_renderer)
1982  {
1983  m_renderer->updateConfig ();
1984  return;
1985  }
1986 
1987  if (isGlobal())
1988  {
1989  for (int z=0; z < KateGlobal::self()->views().size(); ++z)
1990  (KateGlobal::self()->views())[z]->renderer()->updateConfig ();
1991  }
1992 }
1993 
1994 const QString &KateRendererConfig::schema () const
1995 {
1996  if (m_schemaSet || isGlobal())
1997  return m_schema;
1998 
1999  return s_global->schema();
2000 }
2001 
2002 void KateRendererConfig::setSchema (const QString &schema)
2003 {
2004  if (m_schemaSet && m_schema == schema)
2005  return;
2006 
2007  configStart ();
2008  m_schemaSet = true;
2009  m_schema = schema;
2010  setSchemaInternal( schema );
2011  configEnd ();
2012 }
2013 
2014 void KateRendererConfig::reloadSchema()
2015 {
2016  if ( isGlobal() ) {
2017  setSchemaInternal( m_schema );
2018  foreach (KateView* view, KateGlobal::self()->views() )
2019  view->renderer()->config()->reloadSchema();
2020  }
2021 
2022  else if ( m_renderer && m_schemaSet )
2023  setSchemaInternal( m_schema );
2024 }
2025 
2026 void KateRendererConfig::setSchemaInternal( const QString &schema )
2027 {
2028  m_schemaSet = true;
2029  m_schema = schema;
2030 
2031  KConfigGroup config = KateGlobal::self()->schemaManager()->schema(schema);
2032 
2033  // NOTE keep in sync with KateSchemaConfigColorTab::schemaChanged
2034  KColorScheme schemeView(QPalette::Active, KColorScheme::View);
2035  KColorScheme schemeWindow(QPalette::Active, KColorScheme::Window);
2036  KColorScheme schemeSelection(QPalette::Active, KColorScheme::Selection);
2037  QColor tmp0( schemeView.background().color() );
2038  QColor tmp1( schemeSelection.background().color() );
2039  QColor tmp2( schemeView.background(KColorScheme::AlternateBackground).color() );
2040  // using KColorUtils::shade wasn't working really well
2041  qreal bgLuma = KColorUtils::luma( tmp0 );
2042  QColor tmp3( KColorUtils::tint(tmp0, schemeView.decoration(KColorScheme::HoverColor).color()) );
2043  QColor tmp4( KColorUtils::shade( tmp0, bgLuma > 0.3 ? -0.15 : 0.03 ) );
2044  QColor tmp5( KColorUtils::shade( tmp0, bgLuma > 0.7 ? -0.35 : 0.3 ) );
2045  QColor tmp6( schemeWindow.background().color() );
2046  QColor tmp7( schemeWindow.foreground().color() );
2047  QColor tmp8( schemeView.foreground(KColorScheme::NegativeText).color() );
2048  QColor tmp9( schemeView.background(KColorScheme::NegativeBackground).color() );
2049  QColor tmp10( schemeView.background(KColorScheme::PositiveBackground).color() );
2050  QColor tmp11( schemeView.background(KColorScheme::NeutralBackground).color() );
2051  QColor tmp12( KColorScheme(QPalette::Inactive, KColorScheme::Selection).background().color() );
2052  QColor tmp13( schemeView.foreground(KColorScheme::InactiveText).color() );
2053 
2054  m_backgroundColor = config.readEntry("Color Background", tmp0);
2055  m_backgroundColorSet = true;
2056  m_selectionColor = config.readEntry("Color Selection", tmp1);
2057  m_selectionColorSet = true;
2058  m_highlightedLineColor = config.readEntry("Color Highlighted Line", tmp2);
2059  m_highlightedLineColorSet = true;
2060  m_highlightedBracketColor = config.readEntry("Color Highlighted Bracket", tmp3);
2061  m_highlightedBracketColorSet = true;
2062  m_wordWrapMarkerColor = config.readEntry("Color Word Wrap Marker", tmp4);
2063  m_wordWrapMarkerColorSet = true;
2064  m_tabMarkerColor = config.readEntry("Color Tab Marker", tmp5);
2065  m_tabMarkerColorSet = true;
2066  m_indentationLineColor = config.readEntry("Color Indentation Line", tmp5);
2067  m_indentationLineColorSet = true;
2068  m_iconBarColor = config.readEntry("Color Icon Bar", tmp6);
2069  m_iconBarColorSet = true;
2070  m_foldingColor = config.readEntry("Color Code Folding", tmp12);
2071  m_foldingColorSet = true;
2072  m_lineNumberColor = config.readEntry("Color Line Number", tmp7);
2073  m_lineNumberColorSet = true;
2074  m_separatorColor = config.readEntry("Color Separator", tmp13);
2075  m_separatorColorSet = true;
2076  m_spellingMistakeLineColor = config.readEntry("Color Spelling Mistake Line", tmp8);
2077  m_spellingMistakeLineColorSet = true;
2078 
2079  m_modifiedLineColor = config.readEntry("Color Modified Lines", tmp9);
2080  m_modifiedLineColorSet = true;
2081  m_savedLineColor = config.readEntry("Color Saved Lines", tmp10);
2082  m_savedLineColorSet = true;
2083  m_searchHighlightColor = config.readEntry("Color Search Highlight", QColor(Qt::yellow)); // tmp11);
2084  m_searchHighlightColorSet = true;
2085  m_replaceHighlightColor = config.readEntry("Color Replace Highlight", QColor(Qt::green)); // tmp10);
2086  m_replaceHighlightColorSet = true;
2087 
2088 
2089  // same std colors like in KateDocument::markColor
2090  QColor mark[7];
2091  mark[0] = Qt::blue;
2092  mark[1] = Qt::red;
2093  mark[2] = Qt::yellow;
2094  mark[3] = Qt::magenta;
2095  mark[4] = Qt::gray;
2096  mark[5] = Qt::green;
2097  mark[6] = Qt::red;
2098 
2099  for (int i = 1; i <= KTextEditor::MarkInterface::reservedMarkersCount(); i++) {
2100  QColor col = config.readEntry(QString("Color MarkType %1").arg(i), mark[i - 1]);
2101  int index = i-1;
2102  m_lineMarkerColorSet[index] = true;
2103  m_lineMarkerColor[index] = col;
2104  }
2105 
2106  QFont f (KGlobalSettings::fixedFont());
2107 
2108  m_font = config.readEntry("Font", f);
2109  m_fontMetrics = QFontMetricsF (m_font);
2110  m_fontSet = true;
2111 
2112  QColor c = schemeWindow.background().color();
2113  m_templateBackgroundColor = config.readEntry(QString("Color Template Background"), c);
2114 
2115  c = schemeView.background(KColorScheme::PositiveBackground).color();
2116  m_templateFocusedEditablePlaceholderColor = config.readEntry(QString("Color Template Focused Editable Placeholder"), c);
2117 
2118  c = schemeWindow.background(KColorScheme::PositiveBackground).color();
2119  m_templateEditablePlaceholderColor = config.readEntry(QString("Color Template Editable Placeholder"), c);
2120 
2121  c = schemeView.background(KColorScheme::NegativeBackground).color();
2122  m_templateNotEditablePlaceholderColor = config.readEntry(QString("Color Template Not Editable Placeholder"), c);
2123 
2124  m_templateColorsSet=true;
2125 }
2126 
2127 const QFont& KateRendererConfig::font() const
2128 {
2129  if (m_fontSet || isGlobal())
2130  return m_font;
2131 
2132  return s_global->font();
2133 }
2134 
2135 const QFontMetricsF& KateRendererConfig::fontMetrics() const
2136 {
2137  if (m_fontSet || isGlobal())
2138  return m_fontMetrics;
2139 
2140  return s_global->fontMetrics();
2141 }
2142 
2143 void KateRendererConfig::setFont(const QFont &font)
2144 {
2145  if (m_fontSet && m_font == font)
2146  return;
2147 
2148  configStart ();
2149 
2150  m_fontSet = true;
2151  m_font = font;
2152  m_fontMetrics = QFontMetricsF (m_font);
2153 
2154  configEnd ();
2155 }
2156 
2157 bool KateRendererConfig::wordWrapMarker () const
2158 {
2159  if (m_wordWrapMarkerSet || isGlobal())
2160  return m_wordWrapMarker;
2161 
2162  return s_global->wordWrapMarker();
2163 }
2164 
2165 void KateRendererConfig::setWordWrapMarker (bool on)
2166 {
2167  if (m_wordWrapMarkerSet && m_wordWrapMarker == on)
2168  return;
2169 
2170  configStart ();
2171 
2172  m_wordWrapMarkerSet = true;
2173  m_wordWrapMarker = on;
2174 
2175  configEnd ();
2176 }
2177 
2178 const QColor& KateRendererConfig::backgroundColor() const
2179 {
2180  if (m_backgroundColorSet || isGlobal())
2181  return m_backgroundColor;
2182 
2183  return s_global->backgroundColor();
2184 }
2185 
2186 void KateRendererConfig::setBackgroundColor (const QColor &col)
2187 {
2188  if (m_backgroundColorSet && m_backgroundColor == col)
2189  return;
2190 
2191  configStart ();
2192 
2193  m_backgroundColorSet = true;
2194  m_backgroundColor = col;
2195 
2196  configEnd ();
2197 }
2198 
2199 const QColor& KateRendererConfig::selectionColor() const
2200 {
2201  if (m_selectionColorSet || isGlobal())
2202  return m_selectionColor;
2203 
2204  return s_global->selectionColor();
2205 }
2206 
2207 void KateRendererConfig::setSelectionColor (const QColor &col)
2208 {
2209  if (m_selectionColorSet && m_selectionColor == col)
2210  return;
2211 
2212  configStart ();
2213 
2214  m_selectionColorSet = true;
2215  m_selectionColor = col;
2216 
2217  configEnd ();
2218 }
2219 
2220 const QColor& KateRendererConfig::highlightedLineColor() const
2221 {
2222  if (m_highlightedLineColorSet || isGlobal())
2223  return m_highlightedLineColor;
2224 
2225  return s_global->highlightedLineColor();
2226 }
2227 
2228 void KateRendererConfig::setHighlightedLineColor (const QColor &col)
2229 {
2230  if (m_highlightedLineColorSet && m_highlightedLineColor == col)
2231  return;
2232 
2233  configStart ();
2234 
2235  m_highlightedLineColorSet = true;
2236  m_highlightedLineColor = col;
2237 
2238  configEnd ();
2239 }
2240 
2241 const QColor& KateRendererConfig::lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type) const
2242 {
2243  int index = 0;
2244  if (type > 0) { while((type >> index++) ^ 1) {} }
2245  index -= 1;
2246 
2247  if ( index < 0 || index >= KTextEditor::MarkInterface::reservedMarkersCount() )
2248  {
2249  static QColor dummy;
2250  return dummy;
2251  }
2252 
2253  if (m_lineMarkerColorSet[index] || isGlobal())
2254  return m_lineMarkerColor[index];
2255 
2256  return s_global->lineMarkerColor( type );
2257 }
2258 
2259 void KateRendererConfig::setLineMarkerColor (const QColor &col, KTextEditor::MarkInterface::MarkTypes type)
2260 {
2261  int index = static_cast<int>( log(static_cast<double>(type)) / log(2.0) );
2262  Q_ASSERT( index >= 0 && index < KTextEditor::MarkInterface::reservedMarkersCount() );
2263 
2264  if (m_lineMarkerColorSet[index] && m_lineMarkerColor[index] == col)
2265  return;
2266 
2267  configStart ();
2268 
2269  m_lineMarkerColorSet[index] = true;
2270  m_lineMarkerColor[index] = col;
2271 
2272  configEnd ();
2273 }
2274 
2275 const QColor& KateRendererConfig::highlightedBracketColor() const
2276 {
2277  if (m_highlightedBracketColorSet || isGlobal())
2278  return m_highlightedBracketColor;
2279 
2280  return s_global->highlightedBracketColor();
2281 }
2282 
2283 void KateRendererConfig::setHighlightedBracketColor (const QColor &col)
2284 {
2285  if (m_highlightedBracketColorSet && m_highlightedBracketColor == col)
2286  return;
2287 
2288  configStart ();
2289 
2290  m_highlightedBracketColorSet = true;
2291  m_highlightedBracketColor = col;
2292 
2293  configEnd ();
2294 }
2295 
2296 const QColor& KateRendererConfig::wordWrapMarkerColor() const
2297 {
2298  if (m_wordWrapMarkerColorSet || isGlobal())
2299  return m_wordWrapMarkerColor;
2300 
2301  return s_global->wordWrapMarkerColor();
2302 }
2303 
2304 void KateRendererConfig::setWordWrapMarkerColor (const QColor &col)
2305 {
2306  if (m_wordWrapMarkerColorSet && m_wordWrapMarkerColor == col)
2307  return;
2308 
2309  configStart ();
2310 
2311  m_wordWrapMarkerColorSet = true;
2312  m_wordWrapMarkerColor = col;
2313 
2314  configEnd ();
2315 }
2316 
2317 const QColor& KateRendererConfig::tabMarkerColor() const
2318 {
2319  if (m_tabMarkerColorSet || isGlobal())
2320  return m_tabMarkerColor;
2321 
2322  return s_global->tabMarkerColor();
2323 }
2324 
2325 void KateRendererConfig::setTabMarkerColor (const QColor &col)
2326 {
2327  if (m_tabMarkerColorSet && m_tabMarkerColor == col)
2328  return;
2329 
2330  configStart ();
2331 
2332  m_tabMarkerColorSet = true;
2333  m_tabMarkerColor = col;
2334 
2335  configEnd ();
2336 }
2337 
2338 const QColor& KateRendererConfig::indentationLineColor() const
2339 {
2340  if (m_indentationLineColorSet || isGlobal())
2341  return m_indentationLineColor;
2342 
2343  return s_global->indentationLineColor();
2344 }
2345 
2346 void KateRendererConfig::setIndentationLineColor (const QColor &col)
2347 {
2348  if (m_indentationLineColorSet && m_indentationLineColor == col)
2349  return;
2350 
2351  configStart ();
2352 
2353  m_indentationLineColorSet = true;
2354  m_indentationLineColor = col;
2355 
2356  configEnd ();
2357 }
2358 
2359 const QColor& KateRendererConfig::iconBarColor() const
2360 {
2361  if (m_iconBarColorSet || isGlobal())
2362  return m_iconBarColor;
2363 
2364  return s_global->iconBarColor();
2365 }
2366 
2367 void KateRendererConfig::setIconBarColor (const QColor &col)
2368 {
2369  if (m_iconBarColorSet && m_iconBarColor == col)
2370  return;
2371 
2372  configStart ();
2373 
2374  m_iconBarColorSet = true;
2375  m_iconBarColor = col;
2376 
2377  configEnd ();
2378 }
2379 
2380 const QColor& KateRendererConfig::foldingColor() const
2381 {
2382  if (m_foldingColorSet || isGlobal())
2383  return m_foldingColor;
2384 
2385  return s_global->foldingColor();
2386 }
2387 
2388 void KateRendererConfig::setFoldingColor (const QColor &col)
2389 {
2390  if (m_foldingColorSet && m_foldingColor == col)
2391  return;
2392 
2393  configStart ();
2394 
2395  m_foldingColorSet = true;
2396  m_foldingColor = col;
2397 
2398  configEnd ();
2399 }
2400 
2401 const QColor &KateRendererConfig::templateBackgroundColor() const
2402 {
2403  if (m_templateColorsSet || isGlobal())
2404  return m_templateBackgroundColor;
2405 
2406  return s_global->templateBackgroundColor();
2407 }
2408 
2409 const QColor &KateRendererConfig::templateEditablePlaceholderColor() const
2410 {
2411  if (m_templateColorsSet || isGlobal())
2412  return m_templateEditablePlaceholderColor;
2413 
2414  return s_global->templateEditablePlaceholderColor();
2415 }
2416 
2417 const QColor &KateRendererConfig::templateFocusedEditablePlaceholderColor() const
2418 {
2419  if (m_templateColorsSet || isGlobal())
2420  return m_templateFocusedEditablePlaceholderColor;
2421 
2422  return s_global->templateFocusedEditablePlaceholderColor();
2423 }
2424 
2425 const QColor &KateRendererConfig::templateNotEditablePlaceholderColor() const
2426 {
2427  if (m_templateColorsSet || isGlobal())
2428  return m_templateNotEditablePlaceholderColor;
2429 
2430  return s_global->templateNotEditablePlaceholderColor();
2431 }
2432 
2433 const QColor& KateRendererConfig::lineNumberColor() const
2434 {
2435  if (m_lineNumberColorSet || isGlobal())
2436  return m_lineNumberColor;
2437 
2438  return s_global->lineNumberColor();
2439 }
2440 
2441 void KateRendererConfig::setLineNumberColor (const QColor &col)
2442 {
2443  if (m_lineNumberColorSet && m_lineNumberColor == col)
2444  return;
2445 
2446  configStart ();
2447 
2448  m_lineNumberColorSet = true;
2449  m_lineNumberColor = col;
2450 
2451  configEnd ();
2452 }
2453 
2454 const QColor& KateRendererConfig::separatorColor() const
2455 {
2456  if (m_separatorColorSet || isGlobal())
2457  return m_separatorColor;
2458 
2459  return s_global->separatorColor();
2460 }
2461 
2462 void KateRendererConfig::setSeparatorColor(const QColor& col)
2463 {
2464  if (m_separatorColorSet && m_separatorColor == col)
2465  return;
2466 
2467  configStart ();
2468 
2469  m_separatorColorSet = true;
2470  m_separatorColor = col;
2471 
2472  configEnd ();
2473 }
2474 
2475 const QColor& KateRendererConfig::spellingMistakeLineColor() const
2476 {
2477  if (m_spellingMistakeLineColorSet || isGlobal())
2478  return m_spellingMistakeLineColor;
2479 
2480  return s_global->spellingMistakeLineColor();
2481 }
2482 
2483 void KateRendererConfig::setSpellingMistakeLineColor (const QColor &col)
2484 {
2485  if (m_spellingMistakeLineColorSet && m_spellingMistakeLineColor == col)
2486  return;
2487 
2488  configStart ();
2489 
2490  m_spellingMistakeLineColorSet = true;
2491  m_spellingMistakeLineColor = col;
2492 
2493  configEnd ();
2494 }
2495 
2496 const QColor& KateRendererConfig::modifiedLineColor() const
2497 {
2498  if (m_modifiedLineColorSet || isGlobal())
2499  return m_modifiedLineColor;
2500 
2501  return s_global->modifiedLineColor();
2502 }
2503 
2504 void KateRendererConfig::setModifiedLineColor(const QColor &col)
2505 {
2506  if (m_modifiedLineColorSet && m_modifiedLineColor == col)
2507  return;
2508 
2509  configStart ();
2510 
2511  m_modifiedLineColorSet = true;
2512  m_modifiedLineColor = col;
2513 
2514  configEnd ();
2515 }
2516 
2517 const QColor& KateRendererConfig::savedLineColor() const
2518 {
2519  if (m_savedLineColorSet || isGlobal())
2520  return m_savedLineColor;
2521 
2522  return s_global->savedLineColor();
2523 }
2524 
2525 void KateRendererConfig::setSavedLineColor(const QColor &col)
2526 {
2527  if (m_savedLineColorSet && m_savedLineColor == col)
2528  return;
2529 
2530  configStart ();
2531 
2532  m_savedLineColorSet = true;
2533  m_savedLineColor = col;
2534 
2535  configEnd ();
2536 }
2537 
2538 const QColor& KateRendererConfig::searchHighlightColor() const
2539 {
2540  if (m_searchHighlightColorSet || isGlobal())
2541  return m_searchHighlightColor;
2542 
2543  return s_global->searchHighlightColor();
2544 }
2545 
2546 void KateRendererConfig::setSearchHighlightColor(const QColor &col)
2547 {
2548  if (m_searchHighlightColorSet && m_searchHighlightColor == col)
2549  return;
2550 
2551  configStart ();
2552 
2553  m_searchHighlightColorSet = true;
2554  m_searchHighlightColor = col;
2555 
2556  configEnd ();
2557 }
2558 
2559 const QColor& KateRendererConfig::replaceHighlightColor() const
2560 {
2561  if (m_replaceHighlightColorSet || isGlobal())
2562  return m_replaceHighlightColor;
2563 
2564  return s_global->replaceHighlightColor();
2565 }
2566 
2567 void KateRendererConfig::setReplaceHighlightColor(const QColor &col)
2568 {
2569  if (m_replaceHighlightColorSet && m_replaceHighlightColor == col)
2570  return;
2571 
2572  configStart ();
2573 
2574  m_replaceHighlightColorSet = true;
2575  m_replaceHighlightColor = col;
2576 
2577  configEnd ();
2578 }
2579 
2580 
2581 bool KateRendererConfig::showIndentationLines () const
2582 {
2583  if (m_showIndentationLinesSet || isGlobal())
2584  return m_showIndentationLines;
2585 
2586  return s_global->showIndentationLines();
2587 }
2588 
2589 void KateRendererConfig::setShowIndentationLines (bool on)
2590 {
2591  if (m_showIndentationLinesSet && m_showIndentationLines == on)
2592  return;
2593 
2594  configStart ();
2595 
2596  m_showIndentationLinesSet = true;
2597  m_showIndentationLines = on;
2598 
2599  configEnd ();
2600 }
2601 
2602 bool KateRendererConfig::showWholeBracketExpression () const
2603 {
2604  if (m_showWholeBracketExpressionSet || isGlobal())
2605  return m_showWholeBracketExpression;
2606 
2607  return s_global->showWholeBracketExpression();
2608 }
2609 
2610 void KateRendererConfig::setShowWholeBracketExpression (bool on)
2611 {
2612  if (m_showWholeBracketExpressionSet && m_showWholeBracketExpression == on)
2613  return;
2614 
2615  configStart ();
2616 
2617  m_showWholeBracketExpressionSet = true;
2618  m_showWholeBracketExpression = on;
2619 
2620  configEnd ();
2621 }
2622 
2623 //END
2624 
2625 // kate: space-indent on; indent-width 2; replace-tabs on;
QColor
KateDocumentConfig::setKeepExtraSpaces
void setKeepExtraSpaces(bool on)
Definition: kateconfig.cpp:557
KCharsets::codecForName
QTextCodec * codecForName(const QString &name) const
KateRendererConfig::showWholeBracketExpression
bool showWholeBracketExpression() const
Definition: kateconfig.cpp:2602
KateViewConfig::setWordCompletionRemoveTail
void setWordCompletionRemoveTail(bool on)
Definition: kateconfig.cpp:1822
KateRendererConfig::setSchema
void setSchema(const QString &schema)
Definition: kateconfig.cpp:2002
KTextEditor::MarkInterface::markType01
KateRenderer::updateConfig
void updateConfig()
Definition: katerenderer.cpp:877
kateview.h
KateDocumentConfig::backupPrefix
const QString & backupPrefix() const
Definition: kateconfig.cpp:959
KateDocumentConfig::keepExtraSpaces
bool keepExtraSpaces() const
Definition: kateconfig.cpp:570
KateRendererConfig::selectionColor
const QColor & selectionColor() const
Definition: kateconfig.cpp:2199
KateDocumentConfig::eolString
QString eolString()
Definition: kateconfig.cpp:850
KateDocumentConfig::setIndentationMode
void setIndentationMode(const QString &identationMode)
Definition: kateconfig.cpp:459
kcharsets.h
KateViewConfig::viInputModeEmulateCommandBar
bool viInputModeEmulateCommandBar() const
Definition: kateconfig.cpp:1736
KateRendererConfig::wordWrapMarker
bool wordWrapMarker() const
Definition: kateconfig.cpp:2157
KateViewConfig::setViInputModeStealKeys
void setViInputModeStealKeys(bool on)
Definition: kateconfig.cpp:1724
KColorScheme::HoverColor
KateRendererConfig::highlightedBracketColor
const QColor & highlightedBracketColor() const
Definition: kateconfig.cpp:2275
dummy
static int dummy
Definition: katedocument.cpp:101
KColorScheme::NegativeText
KateGlobal::kateDocuments
QList< KateDocument * > & kateDocuments()
return a list of all registered docs
Definition: kateglobal.h:266
KateRendererConfig::setHighlightedBracketColor
void setHighlightedBracketColor(const QColor &col)
Definition: kateconfig.cpp:2283
kdebug.h
KateConfig::updateConfig
virtual void updateConfig()=0
do the real update
KateView::renderer
KateRenderer * renderer()
Definition: kateview.cpp:1653
katerenderer.h
KateRendererConfig::lineMarkerColor
const QColor & lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type=KTextEditor::MarkInterface::markType01) const
Definition: kateconfig.cpp:2241
KateDocumentConfig::setTabHandling
void setTabHandling(uint tabHandling)
Definition: kateconfig.cpp:482
KateDocumentConfig::ovr
bool ovr() const
Definition: kateconfig.cpp:759
KateViewConfig::smartCopyCut
bool smartCopyCut() const
Definition: kateconfig.cpp:1833
KateViewConfig::scrollBarMarks
bool scrollBarMarks() const
Definition: kateconfig.cpp:1402
KateDocumentConfig::onTheFlySpellCheck
bool onTheFlySpellCheck() const
Definition: kateconfig.cpp:1043
KateDocumentConfig::setAllowEolDetection
void setAllowEolDetection(bool on)
Definition: kateconfig.cpp:904
KateRendererConfig::replaceHighlightColor
const QColor & replaceHighlightColor() const
Definition: kateconfig.cpp:2559
KateDocumentConfig::setNewLineAtEof
void setNewLineAtEof(bool on)
Definition: kateconfig.cpp:725
KateRendererConfig::setFoldingColor
void setFoldingColor(const QColor &col)
Definition: kateconfig.cpp:2388
KateRendererConfig::setLineMarkerColor
void setLineMarkerColor(const QColor &col, KTextEditor::MarkInterface::MarkTypes type=KTextEditor::MarkInterface::markType01)
Definition: kateconfig.cpp:2259
kglobalsettings.h
KateDocumentConfig::showSpaces
bool showSpaces() const
Definition: kateconfig.cpp:675
KateDocumentConfig::setOvr
void setOvr(bool on)
Definition: kateconfig.cpp:746
KateViewConfig::setViInputModeEmulateCommandBar
void setViInputModeEmulateCommandBar(bool on)
Definition: kateconfig.cpp:1744
KateViewConfig::scrollBarMiniMap
bool scrollBarMiniMap() const
Definition: kateconfig.cpp:1423
KateViewConfig::lineModification
bool lineModification() const
Definition: kateconfig.cpp:1528
KateViewConfig::wordCompletionMinimalWordLength
int wordCompletionMinimalWordLength() const
Definition: kateconfig.cpp:1793
KateDocumentConfig::setBackupSuffix
void setBackupSuffix(const QString &suffix)
Definition: kateconfig.cpp:988
KateDocumentConfig::indentPastedText
bool indentPastedText() const
Definition: kateconfig.cpp:591
KateViewConfig::setIconBar
void setIconBar(bool on)
Definition: kateconfig.cpp:1494
KateViewConfig::setScrollBarMiniMapAll
void setScrollBarMiniMapAll(bool on)
Definition: kateconfig.cpp:1452
KateViewConfig::setLineModification
void setLineModification(bool on)
Definition: kateconfig.cpp:1536
kcolorutils.h
kconfig.h
KateDocumentConfig::setTabIndents
void setTabIndents(bool on)
Definition: kateconfig.cpp:767
KColorUtils::tint
QColor tint(const QColor &base, const QColor &color, qreal amount=0.3)
KColorScheme::Selection
KateConfig::configEnd
void configEnd()
end a config change transaction, update the concerned documents/views/renderers
Definition: kateconfig.cpp:63
KateDocument::updateConfig
void updateConfig()
Definition: katedocument.cpp:3963
KateViewConfig::setWordCompletion
void setWordCompletion(bool on)
Definition: kateconfig.cpp:1782
KateGlobalConfig::writeConfig
void writeConfig(KConfigGroup &config)
Write config to object.
Definition: kateconfig.cpp:108
katedocument.h
KateRendererConfig::iconBarColor
const QColor & iconBarColor() const
Definition: kateconfig.cpp:2359
KateDocumentConfig::isGlobal
bool isGlobal() const
Definition: kateconfig.h:167
KateDocumentConfig::wordWrapAt
int wordWrapAt() const
Definition: kateconfig.cpp:512
KConfigGroup::writeEntry
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
KateDocumentConfig::readConfig
void readConfig(const KConfigGroup &config)
Read config from object.
Definition: kateconfig.cpp:284
KColorScheme::InactiveText
KateRendererConfig::setFont
void setFont(const QFont &font)
Definition: kateconfig.cpp:2143
KateGlobal::self
static KateGlobal * self()
Kate Part Internal stuff ;)
Definition: kateglobal.cpp:462
KateDocumentConfig::setSwapFileNoSync
void setSwapFileNoSync(bool on)
Definition: kateconfig.cpp:1009
KateDocumentConfig::eolMac
Definition: kateconfig.h:260
KateDocumentConfig::eolUnix
Definition: kateconfig.h:258
KateRendererConfig::wordWrapMarkerColor
const QColor & wordWrapMarkerColor() const
Definition: kateconfig.cpp:2296
KateRendererConfig::setSelectionColor
void setSelectionColor(const QColor &col)
Definition: kateconfig.cpp:2207
QString
KateRendererConfig::foldingColor
const QColor & foldingColor() const
Definition: kateconfig.cpp:2380
klocale.h
KateRendererConfig::setSpellingMistakeLineColor
void setSpellingMistakeLineColor(const QColor &col)
Definition: kateconfig.cpp:2483
KateDocumentConfig::removeSpaces
int removeSpaces() const
Definition: kateconfig.cpp:717
KateRendererConfig::setModifiedLineColor
void setModifiedLineColor(const QColor &col)
Definition: kateconfig.cpp:2504
KateDocumentConfig::backupFlags
uint backupFlags() const
Definition: kateconfig.cpp:938
KColorScheme::Window
KateDocumentConfig::codec
QTextCodec * codec() const
Definition: kateconfig.cpp:796
KateViewConfig::foldingBar
bool foldingBar() const
Definition: kateconfig.cpp:1507
KateViewConfig::setScrollBarMarks
void setScrollBarMarks(bool on)
Definition: kateconfig.cpp:1410
KGlobal::config
KSharedConfigPtr config()
KateRendererConfig::indentationLineColor
const QColor & indentationLineColor() const
Definition: kateconfig.cpp:2338
KateRendererConfig::lineNumberColor
const QColor & lineNumberColor() const
Definition: kateconfig.cpp:2433
KateViewConfig::wordCompletionRemoveTail
bool wordCompletionRemoveTail() const
Definition: kateconfig.cpp:1814
KateViewConfig::setDynWordWrapAlignIndent
void setDynWordWrapAlignIndent(int indent)
Definition: kateconfig.cpp:1368
KateConfig::configStart
void configStart()
start some config changes this method is needed to init some kind of transaction for config changes...
Definition: kateconfig.cpp:53
KateViewConfig::setScrollPastEnd
void setScrollPastEnd(bool on)
Definition: kateconfig.cpp:1862
KateViewConfig::dynWordWrapAlignIndent
int dynWordWrapAlignIndent() const
Definition: kateconfig.cpp:1360
KateRendererConfig::modifiedLineColor
const QColor & modifiedLineColor() const
Definition: kateconfig.cpp:2496
KColorUtils::luma
qreal luma(const QColor &)
KateViewConfig::scrollBarMiniMapAll
bool scrollBarMiniMapAll() const
Definition: kateconfig.cpp:1444
KateDocumentConfig::setOnTheFlySpellCheck
void setOnTheFlySpellCheck(bool on)
Definition: kateconfig.cpp:1058
KateDocumentConfig::replaceTabsDyn
bool replaceTabsDyn() const
Definition: kateconfig.cpp:696
KateRenderer
Handles all of the work of rendering the text (used for the views and printing)
Definition: katerenderer.h:50
KateViewConfig::IncFromCursor
Definition: kateconfig.h:463
KateGlobalConfig::fallbackCodec
QTextCodec * fallbackCodec() const
Definition: kateconfig.cpp:130
KateDocumentConfig::setBackspaceIndents
void setBackspaceIndents(bool on)
Definition: kateconfig.cpp:599
KateRendererConfig::templateBackgroundColor
const QColor & templateBackgroundColor() const
Definition: kateconfig.cpp:2401
KateGlobalConfig
Definition: kateconfig.h:93
KateViewConfig::setViInputMode
void setViInputMode(bool on)
Definition: kateconfig.cpp:1698
KateRendererConfig::setShowWholeBracketExpression
void setShowWholeBracketExpression(bool on)
Definition: kateconfig.cpp:2610
KateDocumentConfig::backupSuffix
const QString & backupSuffix() const
Definition: kateconfig.cpp:967
KLocale::codecForEncoding
QTextCodec * codecForEncoding() const
KateViewConfig::setAutoCenterLines
void setAutoCenterLines(int lines)
Definition: kateconfig.cpp:1578
kateschema.h
KateRenderer::config
KateRendererConfig * config() const
Configuration.
Definition: katerenderer.h:362
KateGlobalConfig::setProberType
void setProberType(KEncodingProber::ProberType proberType)
Definition: kateconfig.cpp:118
KateDocumentConfig::showTabs
bool showTabs() const
Definition: kateconfig.cpp:654
KateRendererConfig::templateEditablePlaceholderColor
const QColor & templateEditablePlaceholderColor() const
Definition: kateconfig.cpp:2409
KateConfig::KateConfig
KateConfig()
Default Constructor.
Definition: kateconfig.cpp:44
KateViewConfig::PowerMatchCase
Definition: kateconfig.h:464
KColorScheme::PositiveBackground
kateglobal.h
KateDocumentConfig::setWordWrapAt
void setWordWrapAt(int col)
Definition: kateconfig.cpp:520
KTextEditor::Editor::setDefaultEncoding
void setDefaultEncoding(const QString &defaultEncoding)
KateViewConfig::viInputModeStealKeys
bool viInputModeStealKeys() const
Definition: kateconfig.cpp:1716
QStringList
KateViewConfig::setWordCompletionMinimalWordLength
void setWordCompletionMinimalWordLength(int length)
Definition: kateconfig.cpp:1801
KateDocumentConfig::updateConfig
void updateConfig()
do the real update
Definition: kateconfig.cpp:388
KateDocumentConfig::eol
int eol() const
Definition: kateconfig.cpp:842
KColorScheme::AlternateBackground
KateGlobalConfig::fallbackEncoding
const QString & fallbackEncoding() const
Definition: kateconfig.cpp:125
KateDocumentConfig::~KateDocumentConfig
~KateDocumentConfig()
Cu DocumentConfig.
Definition: kateconfig.cpp:280
KateViewConfig::persistentSelection
bool persistentSelection() const
Definition: kateconfig.cpp:1669
KateRendererConfig::setLineNumberColor
void setLineNumberColor(const QColor &col)
Definition: kateconfig.cpp:2441
KGlobal::charsets
KCharsets * charsets()
KateViewConfig::setPersistentSelection
void setPersistentSelection(bool on)
Definition: kateconfig.cpp:1677
KateViewConfig::replacementHistoryModel
QStringListModel * replacementHistoryModel()
Definition: kateconfig.cpp:1629
KateGlobal::views
QList< KateView * > & views()
return a list of all registered views
Definition: kateglobal.h:272
KateDocumentConfig::setLineLengthLimit
void setLineLengthLimit(int limit)
Definition: kateconfig.cpp:1080
KateViewConfig::lineNumbers
bool lineNumbers() const
Definition: kateconfig.cpp:1381
KateRendererConfig::setTabMarkerColor
void setTabMarkerColor(const QColor &col)
Definition: kateconfig.cpp:2325
KateGlobalConfig::proberType
KEncodingProber::ProberType proberType() const
Definition: kateconfig.h:126
KateRendererConfig::setBackgroundColor
void setBackgroundColor(const QColor &col)
Definition: kateconfig.cpp:2186
KateDocumentConfig::setSmartHome
void setSmartHome(bool on)
Definition: kateconfig.cpp:620
KateViewConfig::updateConfig
void updateConfig()
do the real update
Definition: kateconfig.cpp:1303
KateViewConfig::setDefaultMarkType
void setDefaultMarkType(uint type)
Definition: kateconfig.cpp:1646
KColorScheme::View
KColorUtils::shade
QColor shade(const QColor &, qreal lumaAmount, qreal chromaAmount=0.0)
KateRendererConfig::tabMarkerColor
const QColor & tabMarkerColor() const
Definition: kateconfig.cpp:2317
KateDocumentConfig::setRemoveSpaces
void setRemoveSpaces(int triState)
Remove trailing spaces on save.
Definition: kateconfig.cpp:704
KateRendererConfig::reloadSchema
void reloadSchema()
Reload the schema from the schema manager.
Definition: kateconfig.cpp:2014
KateView::updateConfig
void updateConfig()
Definition: kateview.cpp:1658
KateRendererConfig::~KateRendererConfig
~KateRendererConfig()
Cu DocumentConfig.
Definition: kateconfig.cpp:1948
KateDocumentConfig::allowEolDetection
bool allowEolDetection() const
Definition: kateconfig.cpp:896
KateViewConfig::wordCompletion
bool wordCompletion() const
Definition: kateconfig.cpp:1774
KateDocumentConfig::eolDos
Definition: kateconfig.h:259
KateRendererConfig::setIndentationLineColor
void setIndentationLineColor(const QColor &col)
Definition: kateconfig.cpp:2346
KateDocumentConfig::setShowTabs
void setShowTabs(bool on)
Definition: kateconfig.cpp:641
KateRendererConfig::setShowIndentationLines
void setShowIndentationLines(bool on)
Definition: kateconfig.cpp:2589
KateRendererConfig::writeConfig
void writeConfig(KConfigGroup &config)
Write config to object.
Definition: kateconfig.cpp:1968
KateDocumentConfig::encoding
const QString & encoding() const
Definition: kateconfig.cpp:788
KateGlobalConfig::readConfig
void readConfig(const KConfigGroup &config)
Read config from object.
Definition: kateconfig.cpp:98
KateViewConfig::iconBar
bool iconBar() const
Definition: kateconfig.cpp:1486
KateRendererConfig::setWordWrapMarker
void setWordWrapMarker(bool on)
Definition: kateconfig.cpp:2165
KateDocumentConfig::setBackupPrefix
void setBackupPrefix(const QString &prefix)
Definition: kateconfig.cpp:975
KateView
Definition: kateview.h:78
KateGlobalConfig::updateConfig
void updateConfig()
do the real update
Definition: kateconfig.cpp:114
KateRendererConfig::highlightedLineColor
const QColor & highlightedLineColor() const
Definition: kateconfig.cpp:2220
KateDocumentConfig::setSearchDirConfigDepth
void setSearchDirConfigDepth(int depth)
Definition: kateconfig.cpp:1030
KateDocument
Definition: katedocument.h:74
KateViewConfig::setAutomaticCompletionInvocation
void setAutomaticCompletionInvocation(bool on)
Definition: kateconfig.cpp:1763
KateViewConfig::writeConfig
void writeConfig(KConfigGroup &config)
Write config to object.
Definition: kateconfig.cpp:1243
KateViewConfig::allowMarkMenu
bool allowMarkMenu() const
Definition: kateconfig.cpp:1659
KateGlobal::schemaManager
KateSchemaManager * schemaManager()
manager for the katepart schemas
Definition: kateglobal.h:297
KateDocument::setUndoMergeAllEdits
void setUndoMergeAllEdits(bool merge)
Definition: katedocument.cpp:4723
KateViewConfig::setFoldingBar
void setFoldingBar(bool on)
Definition: kateconfig.cpp:1515
KateDocumentConfig::setAllowSimpleMode
void setAllowSimpleMode(bool on)
Definition: kateconfig.cpp:925
KateSchemaManager::schema
KConfigGroup schema(const QString &name)
return kconfiggroup for the given schema
Definition: kateschema.cpp:43
KColorScheme::NegativeBackground
KGlobal::locale
KLocale * locale()
KateDocumentConfig::indentationMode
const QString & indentationMode() const
Definition: kateconfig.cpp:451
KateRendererConfig::setSearchHighlightColor
void setSearchHighlightColor(const QColor &col)
Definition: kateconfig.cpp:2546
KateDocumentConfig::indentationWidth
int indentationWidth() const
Definition: kateconfig.cpp:427
KateDocumentConfig::setWordWrap
void setWordWrap(bool on)
Definition: kateconfig.cpp:499
KConfigGroup
KateRendererConfig::schema
const QString & schema() const
Definition: kateconfig.cpp:1994
KTextEditor::MarkInterface::MarkTypes
MarkTypes
KateViewConfig::autoCenterLines
int autoCenterLines() const
Definition: kateconfig.cpp:1570
QFont
KateViewConfig::~KateViewConfig
~KateViewConfig()
Cu DocumentConfig.
Definition: kateconfig.cpp:1169
KateRendererConfig::separatorColor
const QColor & separatorColor() const
Definition: kateconfig.cpp:2454
KateRendererConfig::setSavedLineColor
void setSavedLineColor(const QColor &col)
Definition: kateconfig.cpp:2525
KateRendererConfig
Definition: kateconfig.h:591
KateDocumentConfig::setEol
void setEol(int mode)
Definition: kateconfig.cpp:862
KateDocumentConfig::swapFileNoSync
bool swapFileNoSync() const
Definition: kateconfig.cpp:1001
KateDocumentConfig::wordWrap
bool wordWrap() const
Definition: kateconfig.cpp:491
KateViewConfig::automaticCompletionInvocation
bool automaticCompletionInvocation() const
Definition: kateconfig.cpp:1755
KateRendererConfig::updateConfig
void updateConfig()
do the real update
Definition: kateconfig.cpp:1979
KateRendererConfig::font
const QFont & font() const
Definition: kateconfig.cpp:2127
KateViewConfig::viInputMode
bool viInputMode() const
Definition: kateconfig.cpp:1690
KateViewConfig::PowerModePlainText
Definition: kateconfig.h:468
KateDocumentConfig::setShowSpaces
void setShowSpaces(bool on)
Definition: kateconfig.cpp:662
KateDocumentConfig::setPageUpDownMovesCursor
void setPageUpDownMovesCursor(bool on)
Definition: kateconfig.cpp:544
KateViewConfig::scrollBarMiniMapWidth
int scrollBarMiniMapWidth() const
Definition: kateconfig.cpp:1465
KColorScheme
KateRendererConfig::savedLineColor
const QColor & savedLineColor() const
Definition: kateconfig.cpp:2517
KateViewConfig::bookmarkSort
int bookmarkSort() const
Definition: kateconfig.cpp:1549
KateViewConfig::setBookmarkSort
void setBookmarkSort(int mode)
Definition: kateconfig.cpp:1557
KateViewConfig::setSmartCopyCut
void setSmartCopyCut(bool on)
Definition: kateconfig.cpp:1841
KateViewConfig::readConfig
void readConfig(const KConfigGroup &config)
Read config from object.
Definition: kateconfig.cpp:1180
KateViewConfig::scrollPastEnd
bool scrollPastEnd() const
Definition: kateconfig.cpp:1854
KateGlobalConfig::setFallbackEncoding
bool setFallbackEncoding(const QString &encoding)
Definition: kateconfig.cpp:138
KEncodingProber::ProberType
ProberType
KateRendererConfig::searchHighlightColor
const QColor & searchHighlightColor() const
Definition: kateconfig.cpp:2538
KTextEditor::MarkInterface::reservedMarkersCount
static int reservedMarkersCount()
KateDocumentConfig::isSetEncoding
bool isSetEncoding() const
Definition: kateconfig.cpp:837
KateDocumentConfig::setReplaceTabsDyn
void setReplaceTabsDyn(bool on)
Definition: kateconfig.cpp:683
KateRendererConfig::backgroundColor
const QColor & backgroundColor() const
Definition: kateconfig.cpp:2178
KateDocumentConfig::pageUpDownMovesCursor
bool pageUpDownMovesCursor() const
Definition: kateconfig.cpp:536
KateRendererConfig::setWordWrapMarkerColor
void setWordWrapMarkerColor(const QColor &col)
Definition: kateconfig.cpp:2304
KateDocumentConfig
Definition: kateconfig.h:145
KateRendererConfig::showIndentationLines
bool showIndentationLines() const
Definition: kateconfig.cpp:2581
KateDocumentConfig::writeConfig
void writeConfig(KConfigGroup &config)
Write config to object.
Definition: kateconfig.cpp:338
KateViewConfig::setLineNumbers
void setLineNumbers(bool on)
Definition: kateconfig.cpp:1389
KateViewConfig::dynWordWrap
bool dynWordWrap() const
Definition: kateconfig.cpp:1318
KateRendererConfig::setIconBarColor
void setIconBarColor(const QColor &col)
Definition: kateconfig.cpp:2367
KateView::doc
KateDocument * doc()
accessor to katedocument pointer
Definition: kateview.h:552
KateDocumentConfig::tabIndentsEnabled
bool tabIndentsEnabled() const
Definition: kateconfig.cpp:780
KateRendererConfig::templateNotEditablePlaceholderColor
const QColor & templateNotEditablePlaceholderColor() const
Definition: kateconfig.cpp:2425
KateViewConfig::defaultMarkType
uint defaultMarkType() const
Definition: kateconfig.cpp:1638
KateViewConfig
Definition: kateconfig.h:381
KateViewConfig::dynWordWrapIndicators
int dynWordWrapIndicators() const
Definition: kateconfig.cpp:1339
KateViewConfig::setScrollBarMiniMapWidth
void setScrollBarMiniMapWidth(int width)
Definition: kateconfig.cpp:1473
KateRendererConfig::fontMetrics
const QFontMetricsF & fontMetrics() const
Definition: kateconfig.cpp:2135
KateDocumentConfig::setIndentPastedText
void setIndentPastedText(bool on)
Definition: kateconfig.cpp:578
KateDocumentConfig::lineLengthLimit
int lineLengthLimit() const
Definition: kateconfig.cpp:1072
KateRendererConfig::setReplaceHighlightColor
void setReplaceHighlightColor(const QColor &col)
Definition: kateconfig.cpp:2567
KateViewConfig::maxHistorySize
int maxHistorySize() const
Definition: kateconfig.cpp:1624
KEY_REPLACEMENT_HISTORY
static const char *const KEY_REPLACEMENT_HISTORY
Definition: kateconfig.cpp:1177
KateViewConfig::setAllowMarkMenu
void setAllowMarkMenu(bool allow)
Definition: kateconfig.cpp:1664
kcomponentdata.h
KateConfig::~KateConfig
virtual ~KateConfig()
Virtual Destructor.
Definition: kateconfig.cpp:49
KateViewConfig::setDynWordWrap
void setDynWordWrap(bool wrap)
Definition: kateconfig.cpp:1326
KateDocumentConfig::backspaceIndents
bool backspaceIndents() const
Definition: kateconfig.cpp:612
KateDocumentConfig::setBom
void setBom(bool bom)
Definition: kateconfig.cpp:875
KateDocumentConfig::setTabWidth
void setTabWidth(int tabWidth)
Definition: kateconfig.cpp:411
KateDocumentConfig::tabWidth
int tabWidth() const
Definition: kateconfig.cpp:403
KEY_PATTERN_HISTORY
static const char *const KEY_PATTERN_HISTORY
Definition: kateconfig.cpp:1176
kateconfig.h
KConfigGroup::readEntry
T readEntry(const QString &key, const T &aDefault) const
KateViewConfig::isGlobal
bool isGlobal() const
Definition: kateconfig.h:404
KColorScheme::NeutralBackground
KateDocumentConfig::searchDirConfigDepth
int searchDirConfigDepth() const
Should Kate Part search for dir wide config file and if, how depth?
Definition: kateconfig.cpp:1022
kcolorscheme.h
KateRendererConfig::setSeparatorColor
void setSeparatorColor(const QColor &col)
Definition: kateconfig.cpp:2462
KateDocumentConfig::setIndentationWidth
void setIndentationWidth(int indentationWidth)
Definition: kateconfig.cpp:435
KEY_SEARCH_REPLACE_FLAGS
static const char *const KEY_SEARCH_REPLACE_FLAGS
Definition: kateconfig.cpp:1175
KateDocumentConfig::allowSimpleMode
bool allowSimpleMode() const
Definition: kateconfig.cpp:917
KateRendererConfig::setHighlightedLineColor
void setHighlightedLineColor(const QColor &col)
Definition: kateconfig.cpp:2228
KateViewConfig::patternHistoryModel
QStringListModel * patternHistoryModel()
Definition: kateconfig.cpp:1615
KateDocumentConfig::tabHandling
uint tabHandling() const
Definition: kateconfig.cpp:472
KateRendererConfig::readConfig
void readConfig(const KConfigGroup &config)
Read config from object.
Definition: kateconfig.cpp:1952
KateViewConfig::setScrollBarMiniMap
void setScrollBarMiniMap(bool on)
Definition: kateconfig.cpp:1431
KGlobalSettings::fixedFont
static QFont fixedFont()
kconfiggroup.h
KateRendererConfig::spellingMistakeLineColor
const QColor & spellingMistakeLineColor() const
Definition: kateconfig.cpp:2475
KateViewConfig::setDynWordWrapIndicators
void setDynWordWrapIndicators(int mode)
Definition: kateconfig.cpp:1347
KateDocumentConfig::smartHome
bool smartHome() const
Definition: kateconfig.cpp:633
KateViewConfig::setSearchFlags
void setSearchFlags(long flags)
Definition: kateconfig.cpp:1602
KateDocumentConfig::setEncoding
bool setEncoding(const QString &encoding)
Definition: kateconfig.cpp:811
KateDocumentConfig::bom
bool bom() const
Definition: kateconfig.cpp:888
KateRendererConfig::templateFocusedEditablePlaceholderColor
const QColor & templateFocusedEditablePlaceholderColor() const
Definition: kateconfig.cpp:2417
KateDocumentConfig::newLineAtEof
bool newLineAtEof() const
Definition: kateconfig.cpp:738
KateDocumentConfig::setBackupFlags
void setBackupFlags(uint flags)
Definition: kateconfig.cpp:946
KateViewConfig::searchFlags
long searchFlags() const
Definition: kateconfig.cpp:1594
KateDocumentConfig::tabSmart
indents in leading space, otherwise inserts tab
Definition: kateconfig.h:197
KateRendererConfig::isGlobal
bool isGlobal() const
Definition: kateconfig.h:615
KEncodingProber::Universal
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Applications
  •   Libraries
  •     libkonq
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal